@memberjunction/ng-entity-permissions 0.9.3 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/entity-selector-with-grid/entity-selector-with-grid.component.d.ts +1 -0
- package/dist/lib/entity-selector-with-grid/entity-selector-with-grid.component.d.ts.map +1 -0
- package/dist/lib/grid/entity-permissions-grid.component.d.ts +10 -2
- package/dist/lib/grid/entity-permissions-grid.component.d.ts.map +1 -0
- package/dist/lib/grid/entity-permissions-grid.component.js +302 -101
- package/dist/lib/module.d.ts +1 -0
- package/dist/lib/module.d.ts.map +1 -0
- package/dist/public-api.d.ts +1 -0
- package/dist/public-api.d.ts.map +1 -0
- package/package.json +6 -6
|
@@ -14,3 +14,4 @@ export declare class EntityPermissionsSelectorWithGridComponent implements OnIni
|
|
|
14
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntityPermissionsSelectorWithGridComponent, never>;
|
|
15
15
|
static ɵcmp: i0.ɵɵComponentDeclaration<EntityPermissionsSelectorWithGridComponent, "mj-entity-permissions-selector-with-grid", never, { "EntityName": { "alias": "EntityName"; "required": false; }; "BottomMargin": { "alias": "BottomMargin"; "required": false; }; "CurrentEntity": { "alias": "CurrentEntity"; "required": false; }; }, { "PermissionChanged": "PermissionChanged"; }, never, never, false, never>;
|
|
16
16
|
}
|
|
17
|
+
//# sourceMappingURL=entity-selector-with-grid.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-selector-with-grid.component.d.ts","sourceRoot":"","sources":["../../../src/lib/entity-selector-with-grid/entity-selector-with-grid.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;;AAIzF,qBAKa,0CAA2C,YAAW,MAAM;IAC9D,UAAU,EAAG,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAK;IAExB,iBAAiB,6CAAoD;IAEtE,aAAa,EAAE,UAAU,GAAG,SAAS,CAAC;IAE/C,OAAO,CAAC,GAAG,CAAuB;IAC3B,UAAU,EAAE,UAAU,EAAE,CAAM;IAC9B,QAAQ,IAAI,IAAI;IAOhB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B;yCAjBvD,0CAA0C;2CAA1C,0CAA0C;CAuBtD"}
|
|
@@ -10,7 +10,9 @@ export type EntityPermissionChangedEvent = {
|
|
|
10
10
|
Cancel: boolean;
|
|
11
11
|
};
|
|
12
12
|
export declare class EntityPermissionsGridComponent implements OnInit, OnChanges {
|
|
13
|
+
Mode: 'Entity' | 'Role';
|
|
13
14
|
EntityName: string;
|
|
15
|
+
RoleName: string;
|
|
14
16
|
BottomMargin: number;
|
|
15
17
|
PermissionChanged: EventEmitter<EntityPermissionChangedEvent>;
|
|
16
18
|
permissions: EntityPermissionEntity[];
|
|
@@ -20,11 +22,17 @@ export declare class EntityPermissionsGridComponent implements OnInit, OnChanges
|
|
|
20
22
|
constructor();
|
|
21
23
|
ngOnInit(): void;
|
|
22
24
|
ngOnChanges(changes: SimpleChanges): void;
|
|
25
|
+
ValidateInputs(): void;
|
|
23
26
|
Refresh(): Promise<void>;
|
|
24
27
|
savePermissions(): Promise<void>;
|
|
28
|
+
cancelEdit(): Promise<void>;
|
|
25
29
|
get NumDirtyPermissions(): number;
|
|
26
30
|
protected IsPermissionReallyDirty(p: EntityPermissionEntity): boolean;
|
|
27
|
-
|
|
31
|
+
flipAllPermissions(type: 'Read' | 'Create' | 'Update' | 'Delete'): void;
|
|
32
|
+
revertRow(event: MouseEvent, permission: EntityPermissionEntity): void;
|
|
33
|
+
flipRow(permission: EntityPermissionEntity): void;
|
|
34
|
+
flipPermission(event: MouseEvent | undefined, permission: EntityPermissionEntity, type: 'Read' | 'Create' | 'Update' | 'Delete', flipPermission: boolean): void;
|
|
28
35
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntityPermissionsGridComponent, never>;
|
|
29
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EntityPermissionsGridComponent, "mj-entity-permissions-grid", never, { "EntityName": { "alias": "EntityName"; "required": false; }; "BottomMargin": { "alias": "BottomMargin"; "required": false; }; }, { "PermissionChanged": "PermissionChanged"; }, never, never, false, never>;
|
|
36
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EntityPermissionsGridComponent, "mj-entity-permissions-grid", never, { "Mode": { "alias": "Mode"; "required": false; }; "EntityName": { "alias": "EntityName"; "required": false; }; "RoleName": { "alias": "RoleName"; "required": false; }; "BottomMargin": { "alias": "BottomMargin"; "required": false; }; }, { "PermissionChanged": "PermissionChanged"; }, never, never, false, never>;
|
|
30
37
|
}
|
|
38
|
+
//# sourceMappingURL=entity-permissions-grid.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-permissions-grid.component.d.ts","sourceRoot":"","sources":["../../../src/lib/grid/entity-permissions-grid.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAE,MAAM,EAAS,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGzG,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;;AAGvE,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,qBAAqB,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAC9D,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,qBAKa,8BAA+B,YAAW,MAAM,EAAE,SAAS;IAC7D,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAY;IACnC,UAAU,EAAG,MAAM,CAAC;IACpB,QAAQ,EAAG,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAK;IAExB,iBAAiB,6CAAoD;IAExE,WAAW,EAAE,sBAAsB,EAAE,CAAM;IAC3C,UAAU,EAAE,MAAM,CAAO;IACzB,SAAS,EAAE,OAAO,CAAS;IAG3B,YAAY,sBAAe;;IAKlC,QAAQ,IAAI,IAAI;IAIhB,WAAW,CAAC,OAAO,EAAE,aAAa;IAOlC,cAAc;IAMR,OAAO;IAyFA,eAAe;IAkBf,UAAU;IAWvB,IAAW,mBAAmB,IAAI,MAAM,CAEvC;IAED,SAAS,CAAC,uBAAuB,CAAC,CAAC,EAAE,sBAAsB,GAAG,OAAO;IAS9D,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ;IAoDhE,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,sBAAsB;IAO/D,OAAO,CAAC,UAAU,EAAE,sBAAsB;IA0B1C,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAAE,UAAU,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,EAAE,cAAc,EAAE,OAAO;yCA3PpJ,8BAA8B;2CAA9B,8BAA8B;CAyR1C"}
|
|
@@ -15,86 +15,133 @@ import * as i1 from "@angular/common";
|
|
|
15
15
|
import * as i2 from "@angular/forms";
|
|
16
16
|
import * as i3 from "@memberjunction/ng-container-directives";
|
|
17
17
|
import * as i4 from "@progress/kendo-angular-buttons";
|
|
18
|
+
import * as i5 from "@progress/kendo-angular-icons";
|
|
18
19
|
function EntityPermissionsGridComponent_div_1_Template(rf, ctx) { if (rf & 1) {
|
|
19
20
|
i0.ɵɵelementStart(0, "div");
|
|
20
21
|
i0.ɵɵtext(1, "Loading permissions...");
|
|
21
22
|
i0.ɵɵelementEnd();
|
|
22
23
|
} }
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
i0.ɵɵ
|
|
26
|
-
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r4); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.savePermissions()); });
|
|
27
|
-
i0.ɵɵtext(1, "Save");
|
|
24
|
+
function EntityPermissionsGridComponent_table_6_th_3_Template(rf, ctx) { if (rf & 1) {
|
|
25
|
+
i0.ɵɵelementStart(0, "th");
|
|
26
|
+
i0.ɵɵtext(1, "Role");
|
|
28
27
|
i0.ɵɵelementEnd();
|
|
29
28
|
} }
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
i0.ɵɵ
|
|
33
|
-
i0.ɵɵtext(2);
|
|
29
|
+
function EntityPermissionsGridComponent_table_6_th_4_Template(rf, ctx) { if (rf & 1) {
|
|
30
|
+
i0.ɵɵelementStart(0, "th");
|
|
31
|
+
i0.ɵɵtext(1, "Entity");
|
|
34
32
|
i0.ɵɵelementEnd();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
i0.ɵɵelementStart(
|
|
38
|
-
i0.ɵɵ
|
|
39
|
-
i0.ɵɵ
|
|
33
|
+
} }
|
|
34
|
+
function EntityPermissionsGridComponent_table_6_tr_14_span_2_Template(rf, ctx) { if (rf & 1) {
|
|
35
|
+
i0.ɵɵelementStart(0, "span");
|
|
36
|
+
i0.ɵɵtext(1);
|
|
37
|
+
i0.ɵɵelementEnd();
|
|
38
|
+
} if (rf & 2) {
|
|
39
|
+
const permission_r5 = i0.ɵɵnextContext().$implicit;
|
|
40
|
+
i0.ɵɵadvance();
|
|
41
|
+
i0.ɵɵtextInterpolate1(" ", permission_r5.RoleName, " ");
|
|
42
|
+
} }
|
|
43
|
+
function EntityPermissionsGridComponent_table_6_tr_14_span_3_Template(rf, ctx) { if (rf & 1) {
|
|
44
|
+
i0.ɵɵelementStart(0, "span");
|
|
45
|
+
i0.ɵɵtext(1);
|
|
46
|
+
i0.ɵɵelementEnd();
|
|
47
|
+
} if (rf & 2) {
|
|
48
|
+
const permission_r5 = i0.ɵɵnextContext().$implicit;
|
|
49
|
+
i0.ɵɵadvance();
|
|
50
|
+
i0.ɵɵtextInterpolate1(" ", permission_r5.Entity, " ");
|
|
51
|
+
} }
|
|
52
|
+
function EntityPermissionsGridComponent_table_6_tr_14_kendo_svgicon_4_Template(rf, ctx) { if (rf & 1) {
|
|
53
|
+
const _r13 = i0.ɵɵgetCurrentView();
|
|
54
|
+
i0.ɵɵelementStart(0, "kendo-svgicon", 11);
|
|
55
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_kendo_svgicon_4_Template_kendo_svgicon_click_0_listener($event) { i0.ɵɵrestoreView(_r13); const permission_r5 = i0.ɵɵnextContext().$implicit; const ctx_r11 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r11.revertRow($event, permission_r5)); });
|
|
56
|
+
i0.ɵɵelementEnd();
|
|
57
|
+
} if (rf & 2) {
|
|
58
|
+
const ctx_r8 = i0.ɵɵnextContext(3);
|
|
59
|
+
i0.ɵɵproperty("icon", ctx_r8.kendoSVGIcon("arrowRotateCcwSmallIcon"));
|
|
60
|
+
} }
|
|
61
|
+
function EntityPermissionsGridComponent_table_6_tr_14_Template(rf, ctx) { if (rf & 1) {
|
|
62
|
+
const _r15 = i0.ɵɵgetCurrentView();
|
|
63
|
+
i0.ɵɵelementStart(0, "tr", 7)(1, "td", 8);
|
|
64
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_Template_td_click_1_listener() { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; const ctx_r14 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r14.flipRow(permission_r5)); });
|
|
65
|
+
i0.ɵɵtemplate(2, EntityPermissionsGridComponent_table_6_tr_14_span_2_Template, 2, 1, "span", 1)(3, EntityPermissionsGridComponent_table_6_tr_14_span_3_Template, 2, 1, "span", 1)(4, EntityPermissionsGridComponent_table_6_tr_14_kendo_svgicon_4_Template, 1, 1, "kendo-svgicon", 9);
|
|
66
|
+
i0.ɵɵelementEnd();
|
|
67
|
+
i0.ɵɵelementStart(5, "td", 5);
|
|
68
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_Template_td_click_5_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; const ctx_r16 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r16.flipPermission($event, permission_r5, "Read", true)); });
|
|
69
|
+
i0.ɵɵelementStart(6, "input", 10);
|
|
70
|
+
i0.ɵɵtwoWayListener("ngModelChange", function EntityPermissionsGridComponent_table_6_tr_14_Template_input_ngModelChange_6_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; i0.ɵɵtwoWayBindingSet(permission_r5.CanRead, $event) || (permission_r5.CanRead = $event); return i0.ɵɵresetView($event); });
|
|
71
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_Template_input_click_6_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; const ctx_r18 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r18.flipPermission($event, permission_r5, "Read", false)); });
|
|
40
72
|
i0.ɵɵelementEnd()();
|
|
41
|
-
i0.ɵɵelementStart(
|
|
42
|
-
i0.ɵɵlistener("click", function
|
|
43
|
-
i0.ɵɵelementStart(
|
|
44
|
-
i0.ɵɵtwoWayListener("ngModelChange", function
|
|
45
|
-
i0.ɵɵlistener("click", function
|
|
73
|
+
i0.ɵɵelementStart(7, "td", 5);
|
|
74
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_Template_td_click_7_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; const ctx_r19 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r19.flipPermission($event, permission_r5, "Create", true)); });
|
|
75
|
+
i0.ɵɵelementStart(8, "input", 10);
|
|
76
|
+
i0.ɵɵtwoWayListener("ngModelChange", function EntityPermissionsGridComponent_table_6_tr_14_Template_input_ngModelChange_8_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; i0.ɵɵtwoWayBindingSet(permission_r5.CanCreate, $event) || (permission_r5.CanCreate = $event); return i0.ɵɵresetView($event); });
|
|
77
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_Template_input_click_8_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; const ctx_r21 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r21.flipPermission($event, permission_r5, "Create", false)); });
|
|
46
78
|
i0.ɵɵelementEnd()();
|
|
47
|
-
i0.ɵɵelementStart(
|
|
48
|
-
i0.ɵɵlistener("click", function
|
|
49
|
-
i0.ɵɵelementStart(
|
|
50
|
-
i0.ɵɵtwoWayListener("ngModelChange", function
|
|
51
|
-
i0.ɵɵlistener("click", function
|
|
79
|
+
i0.ɵɵelementStart(9, "td", 5);
|
|
80
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_Template_td_click_9_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; const ctx_r22 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r22.flipPermission($event, permission_r5, "Update", true)); });
|
|
81
|
+
i0.ɵɵelementStart(10, "input", 10);
|
|
82
|
+
i0.ɵɵtwoWayListener("ngModelChange", function EntityPermissionsGridComponent_table_6_tr_14_Template_input_ngModelChange_10_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; i0.ɵɵtwoWayBindingSet(permission_r5.CanUpdate, $event) || (permission_r5.CanUpdate = $event); return i0.ɵɵresetView($event); });
|
|
83
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_Template_input_click_10_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; const ctx_r24 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r24.flipPermission($event, permission_r5, "Update", false)); });
|
|
52
84
|
i0.ɵɵelementEnd()();
|
|
53
|
-
i0.ɵɵelementStart(
|
|
54
|
-
i0.ɵɵlistener("click", function
|
|
55
|
-
i0.ɵɵelementStart(
|
|
56
|
-
i0.ɵɵtwoWayListener("ngModelChange", function
|
|
57
|
-
i0.ɵɵlistener("click", function
|
|
85
|
+
i0.ɵɵelementStart(11, "td", 5);
|
|
86
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_Template_td_click_11_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; const ctx_r25 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r25.flipPermission($event, permission_r5, "Delete", true)); });
|
|
87
|
+
i0.ɵɵelementStart(12, "input", 10);
|
|
88
|
+
i0.ɵɵtwoWayListener("ngModelChange", function EntityPermissionsGridComponent_table_6_tr_14_Template_input_ngModelChange_12_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; i0.ɵɵtwoWayBindingSet(permission_r5.CanDelete, $event) || (permission_r5.CanDelete = $event); return i0.ɵɵresetView($event); });
|
|
89
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_tr_14_Template_input_click_12_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r15); const permission_r5 = restoredCtx.$implicit; const ctx_r27 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r27.flipPermission($event, permission_r5, "Delete", false)); });
|
|
58
90
|
i0.ɵɵelementEnd()()();
|
|
59
91
|
} if (rf & 2) {
|
|
60
|
-
const
|
|
92
|
+
const permission_r5 = ctx.$implicit;
|
|
93
|
+
const ctx_r4 = i0.ɵɵnextContext(2);
|
|
94
|
+
i0.ɵɵproperty("ngClass", ctx_r4.IsPermissionReallyDirty(permission_r5) ? "dirty-row" : "");
|
|
61
95
|
i0.ɵɵadvance(2);
|
|
62
|
-
i0.ɵɵ
|
|
96
|
+
i0.ɵɵproperty("ngIf", ctx_r4.Mode === "Entity");
|
|
97
|
+
i0.ɵɵadvance();
|
|
98
|
+
i0.ɵɵproperty("ngIf", ctx_r4.Mode === "Role");
|
|
99
|
+
i0.ɵɵadvance();
|
|
100
|
+
i0.ɵɵproperty("ngIf", ctx_r4.IsPermissionReallyDirty(permission_r5));
|
|
63
101
|
i0.ɵɵadvance(2);
|
|
64
|
-
i0.ɵɵtwoWayProperty("ngModel",
|
|
102
|
+
i0.ɵɵtwoWayProperty("ngModel", permission_r5.CanRead);
|
|
65
103
|
i0.ɵɵadvance(2);
|
|
66
|
-
i0.ɵɵtwoWayProperty("ngModel",
|
|
104
|
+
i0.ɵɵtwoWayProperty("ngModel", permission_r5.CanCreate);
|
|
67
105
|
i0.ɵɵadvance(2);
|
|
68
|
-
i0.ɵɵtwoWayProperty("ngModel",
|
|
106
|
+
i0.ɵɵtwoWayProperty("ngModel", permission_r5.CanUpdate);
|
|
69
107
|
i0.ɵɵadvance(2);
|
|
70
|
-
i0.ɵɵtwoWayProperty("ngModel",
|
|
108
|
+
i0.ɵɵtwoWayProperty("ngModel", permission_r5.CanDelete);
|
|
71
109
|
} }
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
i0.ɵɵ
|
|
75
|
-
i0.ɵɵ
|
|
76
|
-
i0.ɵɵelementStart(5, "th");
|
|
110
|
+
function EntityPermissionsGridComponent_table_6_Template(rf, ctx) { if (rf & 1) {
|
|
111
|
+
const _r29 = i0.ɵɵgetCurrentView();
|
|
112
|
+
i0.ɵɵelementStart(0, "table", 4)(1, "thead")(2, "tr");
|
|
113
|
+
i0.ɵɵtemplate(3, EntityPermissionsGridComponent_table_6_th_3_Template, 2, 0, "th", 1)(4, EntityPermissionsGridComponent_table_6_th_4_Template, 2, 0, "th", 1);
|
|
114
|
+
i0.ɵɵelementStart(5, "th", 5);
|
|
115
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_Template_th_click_5_listener() { i0.ɵɵrestoreView(_r29); const ctx_r28 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r28.flipAllPermissions("Read")); });
|
|
77
116
|
i0.ɵɵtext(6, "Read");
|
|
78
117
|
i0.ɵɵelementEnd();
|
|
79
|
-
i0.ɵɵelementStart(7, "th");
|
|
80
|
-
i0.ɵɵ
|
|
118
|
+
i0.ɵɵelementStart(7, "th", 5);
|
|
119
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_Template_th_click_7_listener() { i0.ɵɵrestoreView(_r29); const ctx_r30 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r30.flipAllPermissions("Create")); });
|
|
120
|
+
i0.ɵɵtext(8, "Create");
|
|
81
121
|
i0.ɵɵelementEnd();
|
|
82
|
-
i0.ɵɵelementStart(9, "th");
|
|
83
|
-
i0.ɵɵ
|
|
122
|
+
i0.ɵɵelementStart(9, "th", 5);
|
|
123
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_Template_th_click_9_listener() { i0.ɵɵrestoreView(_r29); const ctx_r31 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r31.flipAllPermissions("Update")); });
|
|
124
|
+
i0.ɵɵtext(10, "Update");
|
|
84
125
|
i0.ɵɵelementEnd();
|
|
85
|
-
i0.ɵɵelementStart(11, "th");
|
|
126
|
+
i0.ɵɵelementStart(11, "th", 5);
|
|
127
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_table_6_Template_th_click_11_listener() { i0.ɵɵrestoreView(_r29); const ctx_r32 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r32.flipAllPermissions("Delete")); });
|
|
86
128
|
i0.ɵɵtext(12, "Delete");
|
|
87
129
|
i0.ɵɵelementEnd()()();
|
|
88
130
|
i0.ɵɵelementStart(13, "tbody");
|
|
89
|
-
i0.ɵɵtemplate(14,
|
|
131
|
+
i0.ɵɵtemplate(14, EntityPermissionsGridComponent_table_6_tr_14_Template, 13, 8, "tr", 6);
|
|
90
132
|
i0.ɵɵelementEnd()();
|
|
91
133
|
} if (rf & 2) {
|
|
92
|
-
const
|
|
93
|
-
i0.ɵɵadvance(
|
|
94
|
-
i0.ɵɵproperty("
|
|
134
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
135
|
+
i0.ɵɵadvance(3);
|
|
136
|
+
i0.ɵɵproperty("ngIf", ctx_r1.Mode === "Entity");
|
|
137
|
+
i0.ɵɵadvance();
|
|
138
|
+
i0.ɵɵproperty("ngIf", ctx_r1.Mode === "Role");
|
|
139
|
+
i0.ɵɵadvance(10);
|
|
140
|
+
i0.ɵɵproperty("ngForOf", ctx_r1.permissions);
|
|
95
141
|
} }
|
|
96
142
|
export class EntityPermissionsGridComponent {
|
|
97
143
|
constructor() {
|
|
144
|
+
this.Mode = 'Entity';
|
|
98
145
|
this.BottomMargin = 0;
|
|
99
146
|
this.PermissionChanged = new EventEmitter();
|
|
100
147
|
this.permissions = [];
|
|
@@ -111,65 +158,127 @@ export class EntityPermissionsGridComponent {
|
|
|
111
158
|
this.Refresh();
|
|
112
159
|
}
|
|
113
160
|
}
|
|
161
|
+
ValidateInputs() {
|
|
162
|
+
if (this.Mode === 'Entity' && (!this.EntityName || this.EntityName.length === 0))
|
|
163
|
+
throw new Error("EntityName is required when Mode is 'Entity'");
|
|
164
|
+
if (this.Mode === 'Role' && (!this.RoleName || this.RoleName.length === 0))
|
|
165
|
+
throw new Error("RoleName is required when Mode is 'Role'");
|
|
166
|
+
}
|
|
114
167
|
Refresh() {
|
|
115
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
169
|
+
this.ValidateInputs();
|
|
170
|
+
const startTime = new Date().getTime();
|
|
171
|
+
this.isLoading = true;
|
|
172
|
+
const md = new Metadata();
|
|
173
|
+
const entity = md.Entities.find(e => e.Name === this.EntityName);
|
|
174
|
+
if (this.Mode === 'Entity' && !entity)
|
|
175
|
+
throw new Error("Entity not found: " + this.EntityName);
|
|
176
|
+
const r = md.Roles.find(r => r.Name === this.RoleName);
|
|
177
|
+
if (this.Mode === 'Role' && !r)
|
|
178
|
+
throw new Error("Role not found: " + this.RoleName);
|
|
179
|
+
const rv = new RunView();
|
|
180
|
+
const filter = this.Mode === 'Entity' ? 'EntityID=' + entity.ID : `RoleName='${r === null || r === void 0 ? void 0 : r.Name}'`;
|
|
181
|
+
const result = yield rv.RunView({
|
|
182
|
+
EntityName: 'Entity Permissions',
|
|
183
|
+
ExtraFilter: filter,
|
|
184
|
+
OrderBy: 'RoleName ASC, Entity ASC',
|
|
185
|
+
ResultType: 'entity_object'
|
|
186
|
+
});
|
|
187
|
+
if (result.Success) {
|
|
188
|
+
// we have all of the saved permissions now
|
|
189
|
+
// 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
|
|
190
|
+
// new permission records for them. We won't actually consider those "Dirty" and save those unless the user actually selects one or more
|
|
191
|
+
// to turn on, we are just doing this to make the grid easy to manage from the user perspective.
|
|
192
|
+
const existingPermissions = result.Results;
|
|
193
|
+
const roles = md.Roles;
|
|
194
|
+
if (this.Mode === 'Entity') {
|
|
137
195
|
const rolesWithNoPermissions = roles.filter(r => !existingPermissions.some(p => p.RoleName === r.Name));
|
|
138
196
|
for (const r of rolesWithNoPermissions) {
|
|
139
197
|
const p = yield md.GetEntityObject('Entity Permissions');
|
|
140
|
-
p.NewRecord();
|
|
141
|
-
p.EntityID = e
|
|
142
|
-
p.RoleName = r.Name;
|
|
143
|
-
p.CanRead = false;
|
|
144
|
-
p.CanCreate = false;
|
|
145
|
-
p.CanUpdate = false;
|
|
146
|
-
p.CanDelete = false;
|
|
198
|
+
// p.NewRecord();
|
|
199
|
+
// p.EntityID = e!.ID;
|
|
200
|
+
// p.RoleName = r.Name;
|
|
201
|
+
// p.CanRead = false;
|
|
202
|
+
// p.CanCreate = false;
|
|
203
|
+
// p.CanUpdate = false;
|
|
204
|
+
// p.CanDelete = false;
|
|
205
|
+
p.LoadFromData({
|
|
206
|
+
ID: null,
|
|
207
|
+
Entity: entity.Name,
|
|
208
|
+
EntityID: entity.ID,
|
|
209
|
+
RoleName: r.Name,
|
|
210
|
+
CanRead: false,
|
|
211
|
+
CanCreate: false,
|
|
212
|
+
CanUpdate: false,
|
|
213
|
+
CanDelete: false
|
|
214
|
+
});
|
|
147
215
|
existingPermissions.push(p);
|
|
148
216
|
}
|
|
149
217
|
this.permissions = existingPermissions.sort((a, b) => a.RoleName.localeCompare(b.RoleName));
|
|
150
218
|
}
|
|
151
|
-
else {
|
|
152
|
-
|
|
219
|
+
else if (this.Mode === 'Role') {
|
|
220
|
+
// for the mode of Role, that means we want to show all entities and their permissions for the given role
|
|
221
|
+
const entitiesWithNoPermissions = md.Entities.filter(e => !existingPermissions.some(p => p.EntityID === e.ID));
|
|
222
|
+
for (const e of entitiesWithNoPermissions) {
|
|
223
|
+
const p = yield md.GetEntityObject('Entity Permissions');
|
|
224
|
+
// p.NewRecord();
|
|
225
|
+
// p.EntityID = e.ID;
|
|
226
|
+
// p.Set('Entity', e.Name); // this is a virtual field (not in the database, but we need it for the grid to display properly)
|
|
227
|
+
// p.RoleName = r!.Name;
|
|
228
|
+
// p.CanRead = false;
|
|
229
|
+
// p.CanCreate = false;
|
|
230
|
+
// p.CanUpdate = false;
|
|
231
|
+
// p.CanDelete = false;
|
|
232
|
+
p.LoadFromData({
|
|
233
|
+
ID: null,
|
|
234
|
+
Entity: e.Name,
|
|
235
|
+
EntityID: e.ID,
|
|
236
|
+
RoleName: r.Name,
|
|
237
|
+
CanRead: false,
|
|
238
|
+
CanCreate: false,
|
|
239
|
+
CanUpdate: false,
|
|
240
|
+
CanDelete: false
|
|
241
|
+
});
|
|
242
|
+
existingPermissions.push(p);
|
|
243
|
+
}
|
|
244
|
+
this.permissions = existingPermissions.sort((a, b) => a.Entity.localeCompare(b.Entity));
|
|
153
245
|
}
|
|
154
|
-
this.isLoading = false;
|
|
155
246
|
}
|
|
247
|
+
else {
|
|
248
|
+
throw new Error("Error loading entity permissions: " + result.ErrorMessage);
|
|
249
|
+
}
|
|
250
|
+
this.isLoading = false;
|
|
156
251
|
});
|
|
157
252
|
}
|
|
158
253
|
savePermissions() {
|
|
159
254
|
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
p
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
255
|
+
if (this.NumDirtyPermissions > 0) {
|
|
256
|
+
// iterate through each permisison and for the ones that are dirty, add to transaction group then commit at once
|
|
257
|
+
const md = new Metadata();
|
|
258
|
+
const tg = yield md.CreateTransactionGroup();
|
|
259
|
+
let itemCount = 0;
|
|
260
|
+
this.permissions.forEach(p => {
|
|
261
|
+
if (this.IsPermissionReallyDirty(p)) {
|
|
262
|
+
p.TransactionGroup = tg;
|
|
263
|
+
itemCount++;
|
|
264
|
+
p.Save(); // don't await since we are using a tg
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
if (itemCount > 0)
|
|
268
|
+
yield tg.Submit();
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
cancelEdit() {
|
|
273
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
+
if (this.NumDirtyPermissions > 0) {
|
|
275
|
+
// go through and revert each permission that is REALLY dirty
|
|
276
|
+
this.permissions.forEach(p => {
|
|
277
|
+
if (this.IsPermissionReallyDirty(p)) {
|
|
278
|
+
p.Revert();
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
173
282
|
});
|
|
174
283
|
}
|
|
175
284
|
get NumDirtyPermissions() {
|
|
@@ -183,6 +292,83 @@ export class EntityPermissionsGridComponent {
|
|
|
183
292
|
else
|
|
184
293
|
return p.CanRead || p.CanCreate || p.CanUpdate || p.CanDelete; // if we have a new record, only consider it dirty if at least one permission is true
|
|
185
294
|
}
|
|
295
|
+
flipAllPermissions(type) {
|
|
296
|
+
// first, figure out what we have the majority of, if we have more ON, then we will flip to OFF, otherwise we will flip to ON
|
|
297
|
+
let onCount = 0;
|
|
298
|
+
let offCount = 0;
|
|
299
|
+
this.permissions.forEach(p => {
|
|
300
|
+
if (type === 'Read') {
|
|
301
|
+
if (p.CanRead)
|
|
302
|
+
onCount++;
|
|
303
|
+
else
|
|
304
|
+
offCount++;
|
|
305
|
+
}
|
|
306
|
+
else if (type === 'Create') {
|
|
307
|
+
if (p.CanCreate)
|
|
308
|
+
onCount++;
|
|
309
|
+
else
|
|
310
|
+
offCount++;
|
|
311
|
+
}
|
|
312
|
+
else if (type === 'Update') {
|
|
313
|
+
if (p.CanUpdate)
|
|
314
|
+
onCount++;
|
|
315
|
+
else
|
|
316
|
+
offCount++;
|
|
317
|
+
}
|
|
318
|
+
else if (type === 'Delete') {
|
|
319
|
+
if (p.CanDelete)
|
|
320
|
+
onCount++;
|
|
321
|
+
else
|
|
322
|
+
offCount++;
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
const value = offCount > onCount;
|
|
326
|
+
// now set the permission for each permission record
|
|
327
|
+
for (const p of this.permissions) {
|
|
328
|
+
switch (type) {
|
|
329
|
+
case 'Read':
|
|
330
|
+
p.CanRead = value;
|
|
331
|
+
break;
|
|
332
|
+
case 'Create':
|
|
333
|
+
p.CanCreate = value;
|
|
334
|
+
break;
|
|
335
|
+
case 'Update':
|
|
336
|
+
p.CanUpdate = value;
|
|
337
|
+
break;
|
|
338
|
+
case 'Delete':
|
|
339
|
+
p.CanDelete = value;
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
this.flipPermission(undefined, p, type, false); // call this function but tell it to NOT actually flip the permission, just to fire the event
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
revertRow(event, permission) {
|
|
346
|
+
if (this.IsPermissionReallyDirty(permission)) {
|
|
347
|
+
permission.Revert();
|
|
348
|
+
event.stopPropagation(); // don't bubble up to the parent row because that will do something else...
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
flipRow(permission) {
|
|
352
|
+
// if 2 or more are on, flip all to off, otherwise flip all to on
|
|
353
|
+
const onCount = (permission.CanRead ? 1 : 0) + (permission.CanCreate ? 1 : 0) + (permission.CanUpdate ? 1 : 0) + (permission.CanDelete ? 1 : 0);
|
|
354
|
+
const newValue = onCount < 2;
|
|
355
|
+
if (permission.CanRead !== newValue) {
|
|
356
|
+
permission.CanRead = newValue;
|
|
357
|
+
this.flipPermission(undefined, permission, 'Read', false); // fire the event but don't actually flip the permission
|
|
358
|
+
}
|
|
359
|
+
if (permission.CanCreate !== newValue) {
|
|
360
|
+
permission.CanCreate = newValue;
|
|
361
|
+
this.flipPermission(undefined, permission, 'Create', false); // fire the event but don't actually flip the permission
|
|
362
|
+
}
|
|
363
|
+
if (permission.CanUpdate !== newValue) {
|
|
364
|
+
permission.CanUpdate = newValue;
|
|
365
|
+
this.flipPermission(undefined, permission, 'Update', false); // fire the event but don't actually flip the permission
|
|
366
|
+
}
|
|
367
|
+
if (permission.CanDelete !== newValue) {
|
|
368
|
+
permission.CanDelete = newValue;
|
|
369
|
+
this.flipPermission(undefined, permission, 'Delete', false); // fire the event but don't actually flip the permission
|
|
370
|
+
}
|
|
371
|
+
}
|
|
186
372
|
flipPermission(event, permission, type, flipPermission) {
|
|
187
373
|
if (flipPermission) {
|
|
188
374
|
switch (type) {
|
|
@@ -209,27 +395,42 @@ export class EntityPermissionsGridComponent {
|
|
|
209
395
|
Value: value,
|
|
210
396
|
Cancel: false
|
|
211
397
|
});
|
|
212
|
-
if (!flipPermission)
|
|
398
|
+
if (!flipPermission && event)
|
|
213
399
|
event.stopPropagation();
|
|
214
400
|
}
|
|
215
401
|
}
|
|
216
402
|
EntityPermissionsGridComponent.ɵfac = function EntityPermissionsGridComponent_Factory(t) { return new (t || EntityPermissionsGridComponent)(); };
|
|
217
|
-
EntityPermissionsGridComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityPermissionsGridComponent, selectors: [["mj-entity-permissions-grid"]], inputs: { EntityName: "EntityName", BottomMargin: "BottomMargin" }, outputs: { PermissionChanged: "PermissionChanged" }, features: [i0.ɵɵNgOnChangesFeature], decls:
|
|
403
|
+
EntityPermissionsGridComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityPermissionsGridComponent, selectors: [["mj-entity-permissions-grid"]], inputs: { Mode: "Mode", EntityName: "EntityName", RoleName: "RoleName", BottomMargin: "BottomMargin" }, outputs: { PermissionChanged: "PermissionChanged" }, features: [i0.ɵɵNgOnChangesFeature], decls: 7, vars: 4, consts: [["mjFillContainer", ""], [4, "ngIf"], ["kendoButton", "", 3, "disabled", "click"], ["class", "grid", 4, "ngIf"], [1, "grid"], [3, "click"], [3, "ngClass", 4, "ngFor", "ngForOf"], [3, "ngClass"], [1, "permission-left-col", 3, "click"], [3, "icon", "click", 4, "ngIf"], ["type", "checkbox", "kendoCheckBox", "", 3, "ngModel", "ngModelChange", "click"], [3, "icon", "click"]], template: function EntityPermissionsGridComponent_Template(rf, ctx) { if (rf & 1) {
|
|
218
404
|
i0.ɵɵelementStart(0, "div", 0);
|
|
219
|
-
i0.ɵɵtemplate(1, EntityPermissionsGridComponent_div_1_Template, 2, 0, "div", 1)
|
|
405
|
+
i0.ɵɵtemplate(1, EntityPermissionsGridComponent_div_1_Template, 2, 0, "div", 1);
|
|
406
|
+
i0.ɵɵelementStart(2, "button", 2);
|
|
407
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_Template_button_click_2_listener() { return ctx.savePermissions(); });
|
|
408
|
+
i0.ɵɵtext(3, "Save");
|
|
409
|
+
i0.ɵɵelementEnd();
|
|
410
|
+
i0.ɵɵelementStart(4, "button", 2);
|
|
411
|
+
i0.ɵɵlistener("click", function EntityPermissionsGridComponent_Template_button_click_4_listener() { return ctx.cancelEdit(); });
|
|
412
|
+
i0.ɵɵtext(5, "Cancel");
|
|
413
|
+
i0.ɵɵelementEnd();
|
|
414
|
+
i0.ɵɵtemplate(6, EntityPermissionsGridComponent_table_6_Template, 15, 3, "table", 3);
|
|
220
415
|
i0.ɵɵelementEnd();
|
|
221
416
|
} if (rf & 2) {
|
|
222
417
|
i0.ɵɵadvance();
|
|
223
418
|
i0.ɵɵproperty("ngIf", ctx.isLoading);
|
|
224
419
|
i0.ɵɵadvance();
|
|
225
|
-
i0.ɵɵproperty("
|
|
226
|
-
i0.ɵɵadvance();
|
|
420
|
+
i0.ɵɵproperty("disabled", ctx.NumDirtyPermissions === 0);
|
|
421
|
+
i0.ɵɵadvance(2);
|
|
422
|
+
i0.ɵɵproperty("disabled", ctx.NumDirtyPermissions === 0);
|
|
423
|
+
i0.ɵɵadvance(2);
|
|
227
424
|
i0.ɵɵproperty("ngIf", !ctx.isLoading);
|
|
228
|
-
} }, dependencies: [i1.NgForOf, i1.NgIf, i2.CheckboxControlValueAccessor, i2.NgControlStatus, i2.NgModel, i3.FillContainer, i4.ButtonComponent], 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}\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}"] });
|
|
425
|
+
} }, dependencies: [i1.NgClass, i1.NgForOf, i1.NgIf, i2.CheckboxControlValueAccessor, i2.NgControlStatus, i2.NgModel, i3.FillContainer, i4.ButtonComponent, i5.SVGIconComponent], 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 cursor: pointer;\r\n}\r\n\r\n.permission-left-col[_ngcontent-%COMP%] {\r\n cursor: pointer;\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 min-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\ntable[_ngcontent-%COMP%] tr.dirty-row[_ngcontent-%COMP%] {\r\n font-style: italic;\r\n background-color: #ffcccc;\r\n}"] });
|
|
229
426
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntityPermissionsGridComponent, [{
|
|
230
427
|
type: Component,
|
|
231
|
-
args: [{ selector: 'mj-entity-permissions-grid', template: "<div mjFillContainer>\r\n
|
|
232
|
-
}], () => [], {
|
|
428
|
+
args: [{ selector: 'mj-entity-permissions-grid', template: "<div mjFillContainer>\r\n <div *ngIf=\"isLoading\">Loading permissions...</div>\r\n <button [disabled]=\"NumDirtyPermissions === 0\" kendoButton (click)=\"savePermissions()\">Save</button>\r\n <button [disabled]=\"NumDirtyPermissions === 0\" kendoButton (click)=\"cancelEdit()\">Cancel</button>\r\n <table *ngIf=\"!isLoading\" class=\"grid\">\r\n <thead>\r\n <tr>\r\n <th *ngIf=\"this.Mode==='Entity'\">Role</th>\r\n <th *ngIf=\"this.Mode==='Role'\">Entity</th>\r\n <th (click)=\"flipAllPermissions('Read')\">Read</th>\r\n <th (click)=\"flipAllPermissions('Create')\">Create</th>\r\n <th (click)=\"flipAllPermissions('Update')\">Update</th>\r\n <th (click)=\"flipAllPermissions('Delete')\">Delete</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let permission of permissions\" [ngClass]=\"IsPermissionReallyDirty(permission) ? 'dirty-row' : ''\">\r\n <td class=\"permission-left-col\" (click)=\"flipRow(permission)\">\r\n <span *ngIf=\"this.Mode==='Entity'\">\r\n {{ permission.RoleName }}\r\n </span>\r\n <span *ngIf=\"this.Mode==='Role'\">\r\n {{ permission.Entity }}\r\n </span>\r\n <kendo-svgicon *ngIf=\"IsPermissionReallyDirty(permission)\" \r\n [icon]=\"kendoSVGIcon('arrowRotateCcwSmallIcon')\" \r\n (click)=\"revertRow($event, permission)\"></kendo-svgicon></td>\r\n <td (click)=\"flipPermission($event, permission, 'Read', true)\">\r\n <input type=\"checkbox\" kendoCheckBox [(ngModel)]=\"permission.CanRead\" (click)=\"flipPermission($event, permission, 'Read', false)\">\r\n </td>\r\n <td (click)=\"flipPermission($event, permission, 'Create', true)\">\r\n <input type=\"checkbox\" kendoCheckBox [(ngModel)]=\"permission.CanCreate\" (click)=\"flipPermission($event, permission, 'Create', false)\">\r\n </td>\r\n <td (click)=\"flipPermission($event, permission, 'Update', true)\">\r\n <input type=\"checkbox\" kendoCheckBox [(ngModel)]=\"permission.CanUpdate\" (click)=\"flipPermission($event, permission, 'Update', false)\">\r\n </td>\r\n <td (click)=\"flipPermission($event, permission, 'Delete', true)\">\r\n <input type=\"checkbox\" kendoCheckBox [(ngModel)]=\"permission.CanDelete\" (click)=\"flipPermission($event, permission, 'Delete', false)\">\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\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 cursor: pointer;\r\n}\r\n\r\n.permission-left-col {\r\n cursor: pointer;\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 min-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\ntable tr.dirty-row {\r\n font-style: italic;\r\n background-color: #ffcccc;\r\n}\r\n\r\n"] }]
|
|
429
|
+
}], () => [], { Mode: [{
|
|
430
|
+
type: Input
|
|
431
|
+
}], EntityName: [{
|
|
432
|
+
type: Input
|
|
433
|
+
}], RoleName: [{
|
|
233
434
|
type: Input
|
|
234
435
|
}], BottomMargin: [{
|
|
235
436
|
type: Input
|
package/dist/lib/module.d.ts
CHANGED
|
@@ -16,3 +16,4 @@ export declare class EntityPermissionsModule {
|
|
|
16
16
|
static ɵmod: i0.ɵɵNgModuleDeclaration<EntityPermissionsModule, [typeof i1.EntityPermissionsGridComponent, typeof i2.EntityPermissionsSelectorWithGridComponent], [typeof i3.CommonModule, typeof i4.GridModule, typeof i5.FormsModule, typeof i6.DialogsModule, typeof i7.ExcelExportModule, typeof i8.CompareRecordsModule, typeof i9.ContainerDirectivesModule, typeof i10.ButtonsModule, typeof i11.IconsModule, typeof i12.DropDownsModule], [typeof i1.EntityPermissionsGridComponent, typeof i2.EntityPermissionsSelectorWithGridComponent]>;
|
|
17
17
|
static ɵinj: i0.ɵɵInjectorDeclaration<EntityPermissionsModule>;
|
|
18
18
|
}
|
|
19
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/lib/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAiBA,qBAsBa,uBAAuB;yCAAvB,uBAAuB;0CAAvB,uBAAuB;0CAAvB,uBAAuB;CAAI"}
|
package/dist/public-api.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,qEAAqE,CAAA;AACnF,cAAc,8CAA8C,CAAA;AAC5D,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-entity-permissions",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "MemberJunction: Angular components for displaying/editing permissions for an entity, and related components.",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"@angular/router": "~17.2.2"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@memberjunction/core-entities": "^0.9.
|
|
29
|
-
"@memberjunction/global": "^0.9.
|
|
30
|
-
"@memberjunction/core": "^0.9.
|
|
31
|
-
"@memberjunction/ng-container-directives": "^0.9.
|
|
32
|
-
"@memberjunction/ng-shared": "^0.9.
|
|
28
|
+
"@memberjunction/core-entities": "^0.9.159",
|
|
29
|
+
"@memberjunction/global": "^0.9.155",
|
|
30
|
+
"@memberjunction/core": "^0.9.174",
|
|
31
|
+
"@memberjunction/ng-container-directives": "^0.9.138",
|
|
32
|
+
"@memberjunction/ng-shared": "^0.9.28",
|
|
33
33
|
"@progress/kendo-angular-dropdowns": "~15.1.0",
|
|
34
34
|
"@progress/kendo-angular-grid": "~15.1.0",
|
|
35
35
|
"@progress/kendo-angular-buttons": "~15.1.0",
|