@memberjunction/ng-resource-permissions 2.8.0
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/available-resources-dialog.component.d.ts +39 -0
- package/dist/lib/available-resources-dialog.component.d.ts.map +1 -0
- package/dist/lib/available-resources-dialog.component.js +111 -0
- package/dist/lib/available-resources-dialog.component.js.map +1 -0
- package/dist/lib/available-resources.component.d.ts +32 -0
- package/dist/lib/available-resources.component.d.ts.map +1 -0
- package/dist/lib/available-resources.component.js +162 -0
- package/dist/lib/available-resources.component.js.map +1 -0
- package/dist/lib/module.d.ts +22 -0
- package/dist/lib/module.d.ts.map +1 -0
- package/dist/lib/module.js +80 -0
- package/dist/lib/module.js.map +1 -0
- package/dist/lib/resource-permissions.component.d.ts +33 -0
- package/dist/lib/resource-permissions.component.d.ts.map +1 -0
- package/dist/lib/resource-permissions.component.js +324 -0
- package/dist/lib/resource-permissions.component.js.map +1 -0
- package/dist/public-api.d.ts +5 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +8 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { UserInfo } from '@memberjunction/core';
|
|
3
|
+
import { ResourceData } from '@memberjunction/ng-shared';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class AvailableResourcesDialogComponent implements OnInit {
|
|
6
|
+
DialogTitle: string;
|
|
7
|
+
DialogWidth: string;
|
|
8
|
+
DialogHeight: string;
|
|
9
|
+
get DialogVisible(): boolean;
|
|
10
|
+
set DialogVisible(value: boolean);
|
|
11
|
+
private _dialogVisible;
|
|
12
|
+
OnCancel(): void;
|
|
13
|
+
OnOK(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Emits when the dialog is closed, the parameter is true if the dialog was closed with the OK button, false if it was closed with the Cancel button
|
|
16
|
+
*/
|
|
17
|
+
DialogClosed: EventEmitter<boolean>;
|
|
18
|
+
SelectedResourcesChanged: EventEmitter<ResourceData[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Optional, set this to the currently selected record to start the dialog with that record selected, if desired. This property will be updated as the user selects records in the dialog.
|
|
21
|
+
*/
|
|
22
|
+
SelectedResources: ResourceData[];
|
|
23
|
+
ResourceExtraFilter?: string;
|
|
24
|
+
User: UserInfo;
|
|
25
|
+
/**
|
|
26
|
+
* Resource Type to show available resources for
|
|
27
|
+
*/
|
|
28
|
+
ResourceTypeID: string;
|
|
29
|
+
SelectionMode: 'Single' | 'Multiple';
|
|
30
|
+
/**
|
|
31
|
+
* Optional, comma-delimited list of field names to provide extra columns here to display in the grid. These columns will be displayed after the Name of the resource
|
|
32
|
+
*/
|
|
33
|
+
ExtraColumns: string;
|
|
34
|
+
BubbleOnSelectedResourcesChanged(resources: ResourceData[]): void;
|
|
35
|
+
ngOnInit(): void;
|
|
36
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AvailableResourcesDialogComponent, never>;
|
|
37
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AvailableResourcesDialogComponent, "mj-available-resources-dialog", never, { "DialogTitle": { "alias": "DialogTitle"; "required": false; }; "DialogWidth": { "alias": "DialogWidth"; "required": false; }; "DialogHeight": { "alias": "DialogHeight"; "required": false; }; "DialogVisible": { "alias": "DialogVisible"; "required": false; }; "SelectedResources": { "alias": "SelectedResources"; "required": false; }; "ResourceExtraFilter": { "alias": "ResourceExtraFilter"; "required": false; }; "User": { "alias": "User"; "required": false; }; "ResourceTypeID": { "alias": "ResourceTypeID"; "required": false; }; "SelectionMode": { "alias": "SelectionMode"; "required": false; }; "ExtraColumns": { "alias": "ExtraColumns"; "required": false; }; }, { "DialogClosed": "DialogClosed"; "SelectedResourcesChanged": "SelectedResourcesChanged"; }, never, never, false, never>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=available-resources-dialog.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"available-resources-dialog.component.d.ts","sourceRoot":"","sources":["../../src/lib/available-resources-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAS,MAAM,EAAG,MAAM,eAAe,CAAC;AAEhF,OAAO,EAA+B,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;;AAGzD,qBAKa,iCAAkC,YAAW,MAAM;IACrD,WAAW,EAAE,MAAM,CAAyB;IAC5C,WAAW,EAAE,MAAM,CAAW;IAC9B,YAAY,EAAE,MAAM,CAAW;IAExC,IAAa,aAAa,IAAI,OAAO,CAEpC;IACD,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,EAK/B;IACD,OAAO,CAAC,cAAc,CAAkB;IAEjC,QAAQ;IAKR,IAAI;IAIX;;OAEG;IACO,YAAY,wBAA+B;IAE3C,wBAAwB,+BAAsC;IAGxE;;OAEG;IACM,iBAAiB,EAAE,YAAY,EAAE,CAAK;IACtC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,IAAI,EAAG,QAAQ,CAAC;IACzB;;OAEG;IACM,cAAc,EAAG,MAAM,CAAC;IACxB,aAAa,EAAE,QAAQ,GAAG,UAAU,CAAY;IAEzD;;OAEG;IACM,YAAY,EAAE,MAAM,CAAM;IAG5B,gCAAgC,CAAC,SAAS,EAAE,YAAY,EAAE;IAK1D,QAAQ,IAAI,IAAI;yCAxDZ,iCAAiC;2CAAjC,iCAAiC;CA6D7C"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Component, Output, EventEmitter, Input } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import * as i1 from "@progress/kendo-angular-dialog";
|
|
4
|
+
import * as i2 from "@progress/kendo-angular-buttons";
|
|
5
|
+
import * as i3 from "./available-resources.component";
|
|
6
|
+
function AvailableResourcesDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
7
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
8
|
+
i0.ɵɵelementStart(0, "kendo-dialog", 1);
|
|
9
|
+
i0.ɵɵlistener("close", function AvailableResourcesDialogComponent_Conditional_0_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCancel()); });
|
|
10
|
+
i0.ɵɵelementStart(1, "mj-available-resources", 2);
|
|
11
|
+
i0.ɵɵlistener("SelectionChanged", function AvailableResourcesDialogComponent_Conditional_0_Template_mj_available_resources_SelectionChanged_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.BubbleOnSelectedResourcesChanged($event)); });
|
|
12
|
+
i0.ɵɵelementEnd();
|
|
13
|
+
i0.ɵɵelementStart(2, "kendo-dialog-actions")(3, "button", 3);
|
|
14
|
+
i0.ɵɵlistener("click", function AvailableResourcesDialogComponent_Conditional_0_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnOK()); });
|
|
15
|
+
i0.ɵɵtext(4, "OK");
|
|
16
|
+
i0.ɵɵelementEnd();
|
|
17
|
+
i0.ɵɵelementStart(5, "button", 4);
|
|
18
|
+
i0.ɵɵlistener("click", function AvailableResourcesDialogComponent_Conditional_0_Template_button_click_5_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCancel()); });
|
|
19
|
+
i0.ɵɵtext(6, "Cancel");
|
|
20
|
+
i0.ɵɵelementEnd()()();
|
|
21
|
+
} if (rf & 2) {
|
|
22
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
23
|
+
i0.ɵɵproperty("width", ctx_r1.DialogWidth)("height", ctx_r1.DialogHeight)("title", ctx_r1.DialogTitle);
|
|
24
|
+
i0.ɵɵadvance();
|
|
25
|
+
i0.ɵɵproperty("User", ctx_r1.User)("ResourceTypeID", ctx_r1.ResourceTypeID)("ResourceExtraFilter", ctx_r1.ResourceExtraFilter)("ExtraColumns", ctx_r1.ExtraColumns)("SelectionMode", ctx_r1.SelectionMode)("SelectedResources", ctx_r1.SelectedResources);
|
|
26
|
+
} }
|
|
27
|
+
export class AvailableResourcesDialogComponent {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.DialogTitle = 'Available Resources';
|
|
30
|
+
this.DialogWidth = '700px';
|
|
31
|
+
this.DialogHeight = '450px';
|
|
32
|
+
this._dialogVisible = false;
|
|
33
|
+
/**
|
|
34
|
+
* Emits when the dialog is closed, the parameter is true if the dialog was closed with the OK button, false if it was closed with the Cancel button
|
|
35
|
+
*/
|
|
36
|
+
this.DialogClosed = new EventEmitter();
|
|
37
|
+
this.SelectedResourcesChanged = new EventEmitter();
|
|
38
|
+
///// REST OF THE BELOW JUST GET MAPPED TO THE CONTAINED RecordSelectorComponent
|
|
39
|
+
/**
|
|
40
|
+
* Optional, set this to the currently selected record to start the dialog with that record selected, if desired. This property will be updated as the user selects records in the dialog.
|
|
41
|
+
*/
|
|
42
|
+
this.SelectedResources = [];
|
|
43
|
+
this.SelectionMode = 'Single';
|
|
44
|
+
/**
|
|
45
|
+
* Optional, comma-delimited list of field names to provide extra columns here to display in the grid. These columns will be displayed after the Name of the resource
|
|
46
|
+
*/
|
|
47
|
+
this.ExtraColumns = "";
|
|
48
|
+
}
|
|
49
|
+
get DialogVisible() {
|
|
50
|
+
return this._dialogVisible;
|
|
51
|
+
}
|
|
52
|
+
set DialogVisible(value) {
|
|
53
|
+
if (value !== this._dialogVisible && value) {
|
|
54
|
+
// do init stuff here as needed
|
|
55
|
+
}
|
|
56
|
+
this._dialogVisible = value;
|
|
57
|
+
}
|
|
58
|
+
OnCancel() {
|
|
59
|
+
this.DialogVisible = false;
|
|
60
|
+
this.DialogClosed.emit(false);
|
|
61
|
+
}
|
|
62
|
+
OnOK() {
|
|
63
|
+
this.DialogVisible = false;
|
|
64
|
+
this.DialogClosed.emit(true);
|
|
65
|
+
}
|
|
66
|
+
BubbleOnSelectedResourcesChanged(resources) {
|
|
67
|
+
this.SelectedResources = resources;
|
|
68
|
+
this.SelectedResourcesChanged.emit(resources);
|
|
69
|
+
}
|
|
70
|
+
ngOnInit() {
|
|
71
|
+
if (!this.User) {
|
|
72
|
+
throw new Error('User is a required property for the AvailableResourcesDialogComponent');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
AvailableResourcesDialogComponent.ɵfac = function AvailableResourcesDialogComponent_Factory(t) { return new (t || AvailableResourcesDialogComponent)(); };
|
|
77
|
+
AvailableResourcesDialogComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AvailableResourcesDialogComponent, selectors: [["mj-available-resources-dialog"]], inputs: { DialogTitle: "DialogTitle", DialogWidth: "DialogWidth", DialogHeight: "DialogHeight", DialogVisible: "DialogVisible", SelectedResources: "SelectedResources", ResourceExtraFilter: "ResourceExtraFilter", User: "User", ResourceTypeID: "ResourceTypeID", SelectionMode: "SelectionMode", ExtraColumns: "ExtraColumns" }, outputs: { DialogClosed: "DialogClosed", SelectedResourcesChanged: "SelectedResourcesChanged" }, decls: 1, vars: 1, consts: [[3, "width", "height", "title"], [3, "close", "width", "height", "title"], [3, "SelectionChanged", "User", "ResourceTypeID", "ResourceExtraFilter", "ExtraColumns", "SelectionMode", "SelectedResources"], ["kendoButton", "", "themeColor", "primary", 3, "click"], ["kendoButton", "", 3, "click"]], template: function AvailableResourcesDialogComponent_Template(rf, ctx) { if (rf & 1) {
|
|
78
|
+
i0.ɵɵtemplate(0, AvailableResourcesDialogComponent_Conditional_0_Template, 7, 9, "kendo-dialog", 0);
|
|
79
|
+
} if (rf & 2) {
|
|
80
|
+
i0.ɵɵconditional(ctx.DialogVisible ? 0 : -1);
|
|
81
|
+
} }, dependencies: [i1.DialogComponent, i1.DialogActionsComponent, i2.ButtonComponent, i3.AvailableResourcesComponent] });
|
|
82
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AvailableResourcesDialogComponent, [{
|
|
83
|
+
type: Component,
|
|
84
|
+
args: [{ selector: 'mj-available-resources-dialog', template: "@if (DialogVisible) {\n <kendo-dialog\n [width]=\"DialogWidth\"\n [height]=\"DialogHeight\"\n [title]=\"DialogTitle\" \n (close)=\"OnCancel()\"\n >\n <mj-available-resources\n [User]=\"User\"\n [ResourceTypeID]=\"ResourceTypeID\"\n [ResourceExtraFilter]=\"ResourceExtraFilter\"\n [ExtraColumns]=\"ExtraColumns\"\n [SelectionMode]=\"SelectionMode\"\n [SelectedResources]=\"SelectedResources\"\n (SelectionChanged)=\"BubbleOnSelectedResourcesChanged($event)\"\n >\n </mj-available-resources>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"OnOK()\" themeColor=\"primary\">OK</button>\n <button kendoButton (click)=\"OnCancel()\">Cancel</button>\n </kendo-dialog-actions> \n </kendo-dialog> \n}" }]
|
|
85
|
+
}], null, { DialogTitle: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}], DialogWidth: [{
|
|
88
|
+
type: Input
|
|
89
|
+
}], DialogHeight: [{
|
|
90
|
+
type: Input
|
|
91
|
+
}], DialogVisible: [{
|
|
92
|
+
type: Input
|
|
93
|
+
}], DialogClosed: [{
|
|
94
|
+
type: Output
|
|
95
|
+
}], SelectedResourcesChanged: [{
|
|
96
|
+
type: Output
|
|
97
|
+
}], SelectedResources: [{
|
|
98
|
+
type: Input
|
|
99
|
+
}], ResourceExtraFilter: [{
|
|
100
|
+
type: Input
|
|
101
|
+
}], User: [{
|
|
102
|
+
type: Input
|
|
103
|
+
}], ResourceTypeID: [{
|
|
104
|
+
type: Input
|
|
105
|
+
}], SelectionMode: [{
|
|
106
|
+
type: Input
|
|
107
|
+
}], ExtraColumns: [{
|
|
108
|
+
type: Input
|
|
109
|
+
}] }); })();
|
|
110
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AvailableResourcesDialogComponent, { className: "AvailableResourcesDialogComponent", filePath: "src/lib/available-resources-dialog.component.ts", lineNumber: 12 }); })();
|
|
111
|
+
//# sourceMappingURL=available-resources-dialog.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"available-resources-dialog.component.js","sourceRoot":"","sources":["../../src/lib/available-resources-dialog.component.ts","../../src/lib/available-resources-dialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAW,MAAM,eAAe,CAAC;;;;;;;ICC5E,uCAKC;IADG,2MAAS,iBAAU,KAAC;IAEpB,iDAQC;IADG,iPAAoB,+CAAwC,KAAC;IAEjE,iBAAyB;IAErB,AADJ,4CAAsB,gBACwC;IAAtC,qMAAS,aAAM,KAAC;IAAsB,kBAAE;IAAA,iBAAS;IACrE,iCAAyC;IAArB,qMAAS,iBAAU,KAAC;IAAC,sBAAM;IAEvD,AADI,AADmD,iBAAS,EACrC,EACZ;;;IAjBX,AADA,AADA,0CAAqB,+BACE,6BACF;IAIjB,cAAa;IAKb,AADA,AADA,AADA,AADA,AADA,kCAAa,yCACoB,mDACU,qCACd,uCACE,+CACQ;;ADFnD,MAAM,OAAO,iCAAiC;IAL9C;QAMW,gBAAW,GAAW,qBAAqB,CAAC;QAC5C,gBAAW,GAAW,OAAO,CAAC;QAC9B,iBAAY,GAAW,OAAO,CAAC;QAWhC,mBAAc,GAAY,KAAK,CAAC;QAWxC;;WAEG;QACO,iBAAY,GAAG,IAAI,YAAY,EAAW,CAAC;QAE3C,6BAAwB,GAAG,IAAI,YAAY,EAAkB,CAAC;QAExE,gFAAgF;QAChF;;WAEG;QACM,sBAAiB,GAAkB,EAAE,CAAC;QAOtC,kBAAa,GAA0B,QAAQ,CAAC;QAEzD;;WAEG;QACM,iBAA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KAAK;;kFAhDK,iCAAiC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AfterViewInit, EventEmitter } from '@angular/core';
|
|
2
|
+
import { EntityFieldInfo, UserInfo } from '@memberjunction/core';
|
|
3
|
+
import { ResourcePermissionEntity } from '@memberjunction/core-entities';
|
|
4
|
+
import { ResourceData } from '@memberjunction/ng-shared';
|
|
5
|
+
import { SelectionEvent } from '@progress/kendo-angular-grid';
|
|
6
|
+
import { GridComponent } from '@progress/kendo-angular-grid';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
/**
|
|
9
|
+
* This component displays a list of available resources for a user for a specific Resource Type.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AvailableResourcesComponent implements AfterViewInit {
|
|
12
|
+
User: UserInfo;
|
|
13
|
+
ResourceTypeID: string;
|
|
14
|
+
ResourceExtraFilter?: string;
|
|
15
|
+
SelectionMode: 'Single' | 'Multiple';
|
|
16
|
+
/**
|
|
17
|
+
* Optional, comma-delimited list of field names to provide extra columns here to display in the grid. These columns will be displayed after the Name of the resource
|
|
18
|
+
*/
|
|
19
|
+
ExtraColumns: string;
|
|
20
|
+
SelectedResources: ResourceData[];
|
|
21
|
+
SelectionChanged: EventEmitter<ResourceData[]>;
|
|
22
|
+
gridRecordSelection: string[];
|
|
23
|
+
gridExtraColumns: EntityFieldInfo[];
|
|
24
|
+
resourcesGrid: GridComponent;
|
|
25
|
+
onSelectionChange(e: SelectionEvent): void;
|
|
26
|
+
resourcePermissions: ResourcePermissionEntity[];
|
|
27
|
+
resources: ResourceData[];
|
|
28
|
+
ngAfterViewInit(): Promise<void>;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AvailableResourcesComponent, never>;
|
|
30
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AvailableResourcesComponent, "mj-available-resources", never, { "User": { "alias": "User"; "required": false; }; "ResourceTypeID": { "alias": "ResourceTypeID"; "required": false; }; "ResourceExtraFilter": { "alias": "ResourceExtraFilter"; "required": false; }; "SelectionMode": { "alias": "SelectionMode"; "required": false; }; "ExtraColumns": { "alias": "ExtraColumns"; "required": false; }; "SelectedResources": { "alias": "SelectedResources"; "required": false; }; }, { "SelectionChanged": "SelectionChanged"; }, never, never, false, never>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=available-resources.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"available-resources.component.d.ts","sourceRoot":"","sources":["../../src/lib/available-resources.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,YAAY,EAA4B,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,eAAe,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAA4B,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,YAAY,EAAiB,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAqB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;;AAE7D;;GAEG;AACH,qBAKa,2BAA4B,YAAW,aAAa;IACpD,IAAI,EAAG,QAAQ,CAAC;IAChB,cAAc,EAAG,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,QAAQ,GAAG,UAAU,CAAY;IAEzD;;OAEG;IACM,YAAY,EAAE,MAAM,CAAM;IAE1B,iBAAiB,EAAE,YAAY,EAAE,CAAM;IACtC,gBAAgB,+BAAsC;IAEzD,mBAAmB,EAAE,MAAM,EAAE,CAAM;IACnC,gBAAgB,EAAE,eAAe,EAAE,CAAM;IAEpB,aAAa,EAAG,aAAa,CAAC;IACnD,iBAAiB,CAAC,CAAC,EAAE,cAAc;IAcnC,mBAAmB,EAAE,wBAAwB,EAAE,CAAM;IACrD,SAAS,EAAE,YAAY,EAAE,CAAM;IAChC,eAAe;yCAlCZ,2BAA2B;2CAA3B,2BAA2B;CAmFvC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
|
11
|
+
import { Metadata, RunView } from '@memberjunction/core';
|
|
12
|
+
import { ResourcePermissionEngine } from '@memberjunction/core-entities';
|
|
13
|
+
import { ResourceData, SharedService } from '@memberjunction/ng-shared';
|
|
14
|
+
import * as i0 from "@angular/core";
|
|
15
|
+
import * as i1 from "@progress/kendo-angular-grid";
|
|
16
|
+
const _c0 = ["resourcesGrid"];
|
|
17
|
+
const _c1 = a0 => ({ mode: a0 });
|
|
18
|
+
function AvailableResourcesComponent_Conditional_1_For_4_ng_template_1_Template(rf, ctx) { if (rf & 1) {
|
|
19
|
+
i0.ɵɵtext(0);
|
|
20
|
+
} if (rf & 2) {
|
|
21
|
+
const dataItem_r3 = ctx.$implicit;
|
|
22
|
+
const col_r4 = i0.ɵɵnextContext().$implicit;
|
|
23
|
+
i0.ɵɵtextInterpolate1(" ", dataItem_r3.Configuration[col_r4.Name], " ");
|
|
24
|
+
} }
|
|
25
|
+
function AvailableResourcesComponent_Conditional_1_For_4_Template(rf, ctx) { if (rf & 1) {
|
|
26
|
+
i0.ɵɵelementStart(0, "kendo-grid-column", 5);
|
|
27
|
+
i0.ɵɵtemplate(1, AvailableResourcesComponent_Conditional_1_For_4_ng_template_1_Template, 1, 1, "ng-template", 6);
|
|
28
|
+
i0.ɵɵelementEnd();
|
|
29
|
+
} if (rf & 2) {
|
|
30
|
+
const col_r4 = ctx.$implicit;
|
|
31
|
+
i0.ɵɵproperty("title", col_r4.DisplayNameOrName);
|
|
32
|
+
} }
|
|
33
|
+
function AvailableResourcesComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
34
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
35
|
+
i0.ɵɵelementStart(0, "kendo-grid", 3, 0);
|
|
36
|
+
i0.ɵɵlistener("selectionChange", function AvailableResourcesComponent_Conditional_1_Template_kendo_grid_selectionChange_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onSelectionChange($event)); });
|
|
37
|
+
i0.ɵɵtwoWayListener("selectedKeysChange", function AvailableResourcesComponent_Conditional_1_Template_kendo_grid_selectedKeysChange_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵtwoWayBindingSet(ctx_r1.gridRecordSelection, $event) || (ctx_r1.gridRecordSelection = $event); return i0.ɵɵresetView($event); });
|
|
38
|
+
i0.ɵɵelement(2, "kendo-grid-column", 4);
|
|
39
|
+
i0.ɵɵrepeaterCreate(3, AvailableResourcesComponent_Conditional_1_For_4_Template, 2, 1, "kendo-grid-column", 5, i0.ɵɵrepeaterTrackByIdentity);
|
|
40
|
+
i0.ɵɵelementEnd();
|
|
41
|
+
} if (rf & 2) {
|
|
42
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
43
|
+
i0.ɵɵproperty("data", ctx_r1.resources)("selectable", i0.ɵɵpureFunction1(4, _c1, ctx_r1.SelectionMode.toLowerCase() === "Single" ? "single" : "multiple"));
|
|
44
|
+
i0.ɵɵtwoWayProperty("selectedKeys", ctx_r1.gridRecordSelection);
|
|
45
|
+
i0.ɵɵadvance(2);
|
|
46
|
+
i0.ɵɵproperty("width", 225);
|
|
47
|
+
i0.ɵɵadvance();
|
|
48
|
+
i0.ɵɵrepeater(ctx_r1.gridExtraColumns);
|
|
49
|
+
} }
|
|
50
|
+
/**
|
|
51
|
+
* This component displays a list of available resources for a user for a specific Resource Type.
|
|
52
|
+
*/
|
|
53
|
+
export class AvailableResourcesComponent {
|
|
54
|
+
constructor() {
|
|
55
|
+
this.SelectionMode = 'Single';
|
|
56
|
+
/**
|
|
57
|
+
* Optional, comma-delimited list of field names to provide extra columns here to display in the grid. These columns will be displayed after the Name of the resource
|
|
58
|
+
*/
|
|
59
|
+
this.ExtraColumns = "";
|
|
60
|
+
this.SelectedResources = [];
|
|
61
|
+
this.SelectionChanged = new EventEmitter();
|
|
62
|
+
this.gridRecordSelection = [];
|
|
63
|
+
this.gridExtraColumns = [];
|
|
64
|
+
this.resourcePermissions = [];
|
|
65
|
+
this.resources = [];
|
|
66
|
+
}
|
|
67
|
+
onSelectionChange(e) {
|
|
68
|
+
this.SelectedResources.splice(0, this.SelectedResources.length); // empty the array
|
|
69
|
+
this.gridRecordSelection.forEach((item) => {
|
|
70
|
+
const resourceMatch = this.resources.find((r) => r.ResourceRecordID === item);
|
|
71
|
+
if (resourceMatch) {
|
|
72
|
+
this.SelectedResources.push(resourceMatch);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
// now bubble up the event
|
|
76
|
+
this.SelectionChanged.emit(this.SelectedResources);
|
|
77
|
+
}
|
|
78
|
+
ngAfterViewInit() {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
if (!this.User) {
|
|
81
|
+
throw new Error('User is a required property for the AvailableResourcesDialogComponent');
|
|
82
|
+
}
|
|
83
|
+
// load up the current permissions for the specified ResourceTypeID and user
|
|
84
|
+
yield ResourcePermissionEngine.Instance.Config();
|
|
85
|
+
// now we can get the permissions for the specified resource
|
|
86
|
+
this.resourcePermissions = ResourcePermissionEngine.Instance.GetUserAvailableResources(this.User, this.ResourceTypeID);
|
|
87
|
+
const rt = SharedService.Instance.ResourceTypeByID(this.ResourceTypeID);
|
|
88
|
+
if (!rt || !rt.EntityID)
|
|
89
|
+
throw new Error(`Resource Type ${this.ResourceTypeID} not found`);
|
|
90
|
+
const md = new Metadata();
|
|
91
|
+
const entity = md.EntityByID(rt.EntityID);
|
|
92
|
+
if (!entity || !entity.NameField)
|
|
93
|
+
throw new Error(`Entity ${rt.EntityID} not found, or no Name field defined`);
|
|
94
|
+
const rv = new RunView();
|
|
95
|
+
const nameField = entity.NameField;
|
|
96
|
+
if (this.ExtraColumns && this.ExtraColumns.length > 0) {
|
|
97
|
+
/// split the comma delim string and for each item find it in the EntityFields collection
|
|
98
|
+
const extraColumns = this.ExtraColumns.split(',');
|
|
99
|
+
extraColumns.forEach((ec) => {
|
|
100
|
+
const field = entity.Fields.find((f) => f.Name.trim().toLowerCase() === ec.trim().toLowerCase());
|
|
101
|
+
if (field)
|
|
102
|
+
this.gridExtraColumns.push(field);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const extraFilter = this.ResourceExtraFilter ? ` AND (${this.ResourceExtraFilter})` : '';
|
|
106
|
+
const result = yield rv.RunView({
|
|
107
|
+
EntityName: entity.Name,
|
|
108
|
+
ExtraFilter: `(ID in (${this.resourcePermissions.map((r) => `'${r.ResourceRecordID}'`).join(',')})${extraFilter})`,
|
|
109
|
+
OrderBy: nameField.Name
|
|
110
|
+
});
|
|
111
|
+
if (!result || !result.Success)
|
|
112
|
+
throw new Error(`Error running view for entity ${entity.Name}`);
|
|
113
|
+
// only return rows where we have a record in result.Results
|
|
114
|
+
this.resources = result.Results.map((r) => {
|
|
115
|
+
return new ResourceData({
|
|
116
|
+
ResourceRecordID: r.ID,
|
|
117
|
+
Name: r[nameField.Name],
|
|
118
|
+
ResourceTypeID: this.ResourceTypeID,
|
|
119
|
+
ResourceType: rt.Name,
|
|
120
|
+
Configuration: r // pass the whole resource record into configuration so it is accessible as desired
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
AvailableResourcesComponent.ɵfac = function AvailableResourcesComponent_Factory(t) { return new (t || AvailableResourcesComponent)(); };
|
|
127
|
+
AvailableResourcesComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AvailableResourcesComponent, selectors: [["mj-available-resources"]], viewQuery: function AvailableResourcesComponent_Query(rf, ctx) { if (rf & 1) {
|
|
128
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
129
|
+
} if (rf & 2) {
|
|
130
|
+
let _t;
|
|
131
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.resourcesGrid = _t.first);
|
|
132
|
+
} }, inputs: { User: "User", ResourceTypeID: "ResourceTypeID", ResourceExtraFilter: "ResourceExtraFilter", SelectionMode: "SelectionMode", ExtraColumns: "ExtraColumns", SelectedResources: "SelectedResources" }, outputs: { SelectionChanged: "SelectionChanged" }, decls: 2, vars: 1, consts: [["resourcesGrid", ""], [1, "container"], ["kendoGridSelectBy", "ResourceRecordID", 2, "width", "100%", "max-height", "400px", 3, "data", "selectable", "selectedKeys"], ["kendoGridSelectBy", "ResourceRecordID", 2, "width", "100%", "max-height", "400px", 3, "selectionChange", "selectedKeysChange", "data", "selectable", "selectedKeys"], ["field", "Name", "title", "Name", 3, "width"], [3, "title"], ["kendoGridCellTemplate", ""]], template: function AvailableResourcesComponent_Template(rf, ctx) { if (rf & 1) {
|
|
133
|
+
i0.ɵɵelementStart(0, "div", 1);
|
|
134
|
+
i0.ɵɵtemplate(1, AvailableResourcesComponent_Conditional_1_Template, 5, 6, "kendo-grid", 2);
|
|
135
|
+
i0.ɵɵelementEnd();
|
|
136
|
+
} if (rf & 2) {
|
|
137
|
+
i0.ɵɵadvance();
|
|
138
|
+
i0.ɵɵconditional(ctx.User ? 1 : -1);
|
|
139
|
+
} }, dependencies: [i1.GridComponent, i1.SelectionDirective, i1.ColumnComponent, i1.CellTemplateDirective], styles: ["\n\n.container[_ngcontent-%COMP%] {\n max-width: 100%;\n }\n \n h3[_ngcontent-%COMP%] {\n margin-bottom: 15px;\n font-size: 1.5em;\n color: #333;\n }\n \n \n\n kendo-grid[_ngcontent-%COMP%] {\n border: 1px solid #ccc;\n border-radius: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n }\n \n kendo-grid-header[_ngcontent-%COMP%] {\n background-color: #f4f4f4;\n font-weight: bold;\n position: sticky;\n top: 0;\n z-index: 1;\n }\n \n kendo-grid[_ngcontent-%COMP%] td[_ngcontent-%COMP%] {\n padding: 12px;\n border-bottom: 1px solid #ddd;\n cursor: pointer;\n }"] });
|
|
140
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AvailableResourcesComponent, [{
|
|
141
|
+
type: Component,
|
|
142
|
+
args: [{ selector: 'mj-available-resources', template: "<div class=\"container\">\n @if (User) {\n <kendo-grid\n #resourcesGrid\n [data]=\"resources\"\n [selectable]=\"{ mode: SelectionMode.toLowerCase() === 'Single' ? 'single' : 'multiple' }\"\n (selectionChange)=\"onSelectionChange($event)\"\n style=\"width: 100%; max-height: 400px;\"\n kendoGridSelectBy=\"ResourceRecordID\"\n [(selectedKeys)]=\"gridRecordSelection\"\n >\n <kendo-grid-column field=\"Name\" title=\"Name\" [width]=\"225\">\n </kendo-grid-column>\n\n @for (col of gridExtraColumns; track col) {\n <kendo-grid-column [title]=\"col.DisplayNameOrName\">\n <ng-template kendoGridCellTemplate let-dataItem>\n {{ dataItem.Configuration[col.Name] }} \n </ng-template>\n </kendo-grid-column>\n }\n </kendo-grid> \n }\n </div>\n ", styles: ["/* Container styling */\n.container {\n max-width: 100%;\n }\n \n h3 {\n margin-bottom: 15px;\n font-size: 1.5em;\n color: #333;\n }\n \n /* Grid styling */\n kendo-grid {\n border: 1px solid #ccc;\n border-radius: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n }\n \n kendo-grid-header {\n background-color: #f4f4f4;\n font-weight: bold;\n position: sticky;\n top: 0;\n z-index: 1;\n }\n \n kendo-grid td {\n padding: 12px;\n border-bottom: 1px solid #ddd;\n cursor: pointer;\n }\n "] }]
|
|
143
|
+
}], null, { User: [{
|
|
144
|
+
type: Input
|
|
145
|
+
}], ResourceTypeID: [{
|
|
146
|
+
type: Input
|
|
147
|
+
}], ResourceExtraFilter: [{
|
|
148
|
+
type: Input
|
|
149
|
+
}], SelectionMode: [{
|
|
150
|
+
type: Input
|
|
151
|
+
}], ExtraColumns: [{
|
|
152
|
+
type: Input
|
|
153
|
+
}], SelectedResources: [{
|
|
154
|
+
type: Input
|
|
155
|
+
}], SelectionChanged: [{
|
|
156
|
+
type: Output
|
|
157
|
+
}], resourcesGrid: [{
|
|
158
|
+
type: ViewChild,
|
|
159
|
+
args: ['resourcesGrid']
|
|
160
|
+
}] }); })();
|
|
161
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AvailableResourcesComponent, { className: "AvailableResourcesComponent", filePath: "src/lib/available-resources.component.ts", lineNumber: 16 }); })();
|
|
162
|
+
//# sourceMappingURL=available-resources.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"available-resources.component.js","sourceRoot":"","sources":["../../src/lib/available-resources.component.ts","../../src/lib/available-resources.component.html"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAiB,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAmB,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAA4B,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;;;;;;ICchD,YACJ;;;;IADI,uEACJ;;;IAHJ,4CAAmD;IAC/C,gHAAgD;IAGpD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uB;QACnB,2FAAY;QAsBd,iBAAM;;QAtBJ,cAqBC;QArBD,mCAqBC;;iFDPQ,2BAA2B;cALvC,SAAS;2BACE,wBAAwB;gBAKvB,IAAI;kBAAZ,KAAK;YACG,cAAc;kBAAtB,KAAK;YACG,mBAAmB;kBAA3B,KAAK;YACG,aAAa;kBAArB,KAAK;YAKG,YAAY;kBAApB,KAAK;YAEG,iBAAiB;kBAAzB,KAAK;YACI,gBAAgB;kBAAzB,MAAM;YAKqB,aAAa;kBAAxC,SAAS;mBAAC,eAAe;;kFAjBjB,2BAA2B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./resource-permissions.component";
|
|
3
|
+
import * as i2 from "./available-resources.component";
|
|
4
|
+
import * as i3 from "./available-resources-dialog.component";
|
|
5
|
+
import * as i4 from "@angular/common";
|
|
6
|
+
import * as i5 from "@progress/kendo-angular-grid";
|
|
7
|
+
import * as i6 from "@angular/forms";
|
|
8
|
+
import * as i7 from "@progress/kendo-angular-dialog";
|
|
9
|
+
import * as i8 from "@progress/kendo-angular-excel-export";
|
|
10
|
+
import * as i9 from "@memberjunction/ng-compare-records";
|
|
11
|
+
import * as i10 from "@memberjunction/ng-container-directives";
|
|
12
|
+
import * as i11 from "@progress/kendo-angular-buttons";
|
|
13
|
+
import * as i12 from "@progress/kendo-angular-dropdowns";
|
|
14
|
+
import * as i13 from "@progress/kendo-angular-indicators";
|
|
15
|
+
import * as i14 from "@progress/kendo-angular-listview";
|
|
16
|
+
import * as i15 from "@progress/kendo-angular-layout";
|
|
17
|
+
export declare class ResourcePermissionsModule {
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ResourcePermissionsModule, never>;
|
|
19
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ResourcePermissionsModule, [typeof i1.ResourcePermissionsComponent, typeof i2.AvailableResourcesComponent, typeof i3.AvailableResourcesDialogComponent], [typeof i4.CommonModule, typeof i5.GridModule, typeof i6.FormsModule, typeof i7.DialogsModule, typeof i8.ExcelExportModule, typeof i9.CompareRecordsModule, typeof i10.ContainerDirectivesModule, typeof i11.ButtonsModule, typeof i12.DropDownsModule, typeof i13.IndicatorsModule, typeof i14.ListViewModule, typeof i15.LayoutModule], [typeof i1.ResourcePermissionsComponent, typeof i2.AvailableResourcesComponent, typeof i3.AvailableResourcesDialogComponent]>;
|
|
20
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ResourcePermissionsModule>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/lib/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAqBA,qBA0Ba,yBAAyB;yCAAzB,yBAAyB;0CAAzB,yBAAyB;0CAAzB,yBAAyB;CAAI"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { ResourcePermissionsComponent } from './resource-permissions.component';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
// Kendo UI Angular imports
|
|
5
|
+
import { GridModule } from '@progress/kendo-angular-grid';
|
|
6
|
+
import { ListViewModule } from '@progress/kendo-angular-listview';
|
|
7
|
+
import { LayoutModule } from '@progress/kendo-angular-layout';
|
|
8
|
+
import { ExcelExportModule } from '@progress/kendo-angular-excel-export';
|
|
9
|
+
import { DialogsModule } from "@progress/kendo-angular-dialog";
|
|
10
|
+
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
11
|
+
import { CompareRecordsModule } from '@memberjunction/ng-compare-records';
|
|
12
|
+
import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
|
|
13
|
+
import { FormsModule } from '@angular/forms';
|
|
14
|
+
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
|
|
15
|
+
import { IndicatorsModule } from '@progress/kendo-angular-indicators';
|
|
16
|
+
import { AvailableResourcesComponent } from './available-resources.component';
|
|
17
|
+
import { AvailableResourcesDialogComponent } from './available-resources-dialog.component';
|
|
18
|
+
import * as i0 from "@angular/core";
|
|
19
|
+
export class ResourcePermissionsModule {
|
|
20
|
+
}
|
|
21
|
+
ResourcePermissionsModule.ɵfac = function ResourcePermissionsModule_Factory(t) { return new (t || ResourcePermissionsModule)(); };
|
|
22
|
+
ResourcePermissionsModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: ResourcePermissionsModule });
|
|
23
|
+
ResourcePermissionsModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
24
|
+
GridModule,
|
|
25
|
+
FormsModule,
|
|
26
|
+
DialogsModule,
|
|
27
|
+
ExcelExportModule,
|
|
28
|
+
CompareRecordsModule,
|
|
29
|
+
ContainerDirectivesModule,
|
|
30
|
+
ButtonsModule,
|
|
31
|
+
DropDownsModule,
|
|
32
|
+
IndicatorsModule,
|
|
33
|
+
ListViewModule,
|
|
34
|
+
LayoutModule] });
|
|
35
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ResourcePermissionsModule, [{
|
|
36
|
+
type: NgModule,
|
|
37
|
+
args: [{
|
|
38
|
+
declarations: [
|
|
39
|
+
ResourcePermissionsComponent,
|
|
40
|
+
AvailableResourcesComponent,
|
|
41
|
+
AvailableResourcesDialogComponent
|
|
42
|
+
],
|
|
43
|
+
imports: [
|
|
44
|
+
CommonModule,
|
|
45
|
+
GridModule,
|
|
46
|
+
FormsModule,
|
|
47
|
+
DialogsModule,
|
|
48
|
+
ExcelExportModule,
|
|
49
|
+
CompareRecordsModule,
|
|
50
|
+
ContainerDirectivesModule,
|
|
51
|
+
ButtonsModule,
|
|
52
|
+
DropDownsModule,
|
|
53
|
+
IndicatorsModule,
|
|
54
|
+
ListViewModule,
|
|
55
|
+
LayoutModule
|
|
56
|
+
],
|
|
57
|
+
exports: [
|
|
58
|
+
ResourcePermissionsComponent,
|
|
59
|
+
AvailableResourcesComponent,
|
|
60
|
+
AvailableResourcesDialogComponent
|
|
61
|
+
]
|
|
62
|
+
}]
|
|
63
|
+
}], null, null); })();
|
|
64
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(ResourcePermissionsModule, { declarations: [ResourcePermissionsComponent,
|
|
65
|
+
AvailableResourcesComponent,
|
|
66
|
+
AvailableResourcesDialogComponent], imports: [CommonModule,
|
|
67
|
+
GridModule,
|
|
68
|
+
FormsModule,
|
|
69
|
+
DialogsModule,
|
|
70
|
+
ExcelExportModule,
|
|
71
|
+
CompareRecordsModule,
|
|
72
|
+
ContainerDirectivesModule,
|
|
73
|
+
ButtonsModule,
|
|
74
|
+
DropDownsModule,
|
|
75
|
+
IndicatorsModule,
|
|
76
|
+
ListViewModule,
|
|
77
|
+
LayoutModule], exports: [ResourcePermissionsComponent,
|
|
78
|
+
AvailableResourcesComponent,
|
|
79
|
+
AvailableResourcesDialogComponent] }); })();
|
|
80
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/lib/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,2BAA2B;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,M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CAAiC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AfterViewInit } from '@angular/core';
|
|
2
|
+
import { RoleInfo } from '@memberjunction/core';
|
|
3
|
+
import { ResourcePermissionEntity, UserEntity } from '@memberjunction/core-entities';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class ResourcePermissionsComponent implements AfterViewInit {
|
|
6
|
+
ResourceTypeID: string;
|
|
7
|
+
ResourceRecordID: string;
|
|
8
|
+
ShowSaveButton: boolean;
|
|
9
|
+
ShowUserErrorMessages: boolean;
|
|
10
|
+
AllowAddPermissions: boolean;
|
|
11
|
+
AllowEditPermissions: boolean;
|
|
12
|
+
AllowDeletePermissions: boolean;
|
|
13
|
+
permissionLevels: string[];
|
|
14
|
+
permissionTypes: string[];
|
|
15
|
+
AllUsers: UserEntity[];
|
|
16
|
+
AllRoles: RoleInfo[];
|
|
17
|
+
SelectedUser: UserEntity | null;
|
|
18
|
+
SelectedRole: RoleInfo | null;
|
|
19
|
+
SelectedType: 'User' | 'Role';
|
|
20
|
+
SelectedPermissionLevel: 'View' | 'Edit' | 'Owner';
|
|
21
|
+
UpdateResourceRecordID(ResourceRecordID: string): Promise<void>;
|
|
22
|
+
resourcePermissions: ResourcePermissionEntity[];
|
|
23
|
+
ngAfterViewInit(): Promise<void>;
|
|
24
|
+
private _pendingDeletes;
|
|
25
|
+
deletePermission(permission: ResourcePermissionEntity): void;
|
|
26
|
+
private _pendingAdds;
|
|
27
|
+
addPermission(): Promise<void>;
|
|
28
|
+
permissionAlreadyExists(): boolean;
|
|
29
|
+
SavePermissions(): Promise<boolean>;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ResourcePermissionsComponent, never>;
|
|
31
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ResourcePermissionsComponent, "mj-resource-permissions", never, { "ResourceTypeID": { "alias": "ResourceTypeID"; "required": false; }; "ResourceRecordID": { "alias": "ResourceRecordID"; "required": false; }; "ShowSaveButton": { "alias": "ShowSaveButton"; "required": false; }; "ShowUserErrorMessages": { "alias": "ShowUserErrorMessages"; "required": false; }; "AllowAddPermissions": { "alias": "AllowAddPermissions"; "required": false; }; "AllowEditPermissions": { "alias": "AllowEditPermissions"; "required": false; }; "AllowDeletePermissions": { "alias": "AllowDeletePermissions"; "required": false; }; }, {}, never, never, false, never>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=resource-permissions.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-permissions.component.d.ts","sourceRoot":"","sources":["../../src/lib/resource-permissions.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAsB,QAAQ,EAAqB,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAA4B,wBAAwB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;;AAG/G,qBAKa,4BAA6B,YAAW,aAAa;IACvD,cAAc,EAAG,MAAM,CAAC;IACxB,gBAAgB,EAAG,MAAM,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAS;IAChC,qBAAqB,EAAE,OAAO,CAAS;IACvC,mBAAmB,EAAE,OAAO,CAAQ;IACpC,oBAAoB,EAAE,OAAO,CAAQ;IACrC,sBAAsB,EAAE,OAAO,CAAQ;IAIzC,gBAAgB,WAA6B;IAE7C,eAAe,WAAoB;IAEnC,QAAQ,EAAE,UAAU,EAAE,CAAM;IAC5B,QAAQ,EAAE,QAAQ,EAAE,CAAM;IAE1B,YAAY,EAAE,UAAU,GAAG,IAAI,CAAQ;IACvC,YAAY,EAAE,QAAQ,GAAG,IAAI,CAAQ;IACrC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAU;IACvC,uBAAuB,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAU;IAEtD,sBAAsB,CAAC,gBAAgB,EAAE,MAAM;IAQrD,mBAAmB,EAAE,wBAAwB,EAAE,CAAM;IACtD,eAAe;IAwBrB,OAAO,CAAC,eAAe,CAAkC;IAClD,gBAAgB,CAAC,UAAU,EAAE,wBAAwB;IAK5D,OAAO,CAAC,YAAY,CAAkC;IACzC,aAAa;IAuBnB,uBAAuB,IAAI,OAAO;IAkB5B,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;yCAxGrC,4BAA4B;2CAA5B,4BAA4B;CAsJxC"}
|
|
@@ -0,0 +1,324 @@
|
|
|
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 } from '@angular/core';
|
|
11
|
+
import { LogError, Metadata, RunView } from '@memberjunction/core';
|
|
12
|
+
import { ResourcePermissionEngine } from '@memberjunction/core-entities';
|
|
13
|
+
import { SharedService } from '@memberjunction/ng-shared';
|
|
14
|
+
import * as i0 from "@angular/core";
|
|
15
|
+
import * as i1 from "@angular/forms";
|
|
16
|
+
import * as i2 from "@progress/kendo-angular-buttons";
|
|
17
|
+
import * as i3 from "@progress/kendo-angular-dropdowns";
|
|
18
|
+
function ResourcePermissionsComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
19
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
20
|
+
i0.ɵɵelementStart(0, "button", 5);
|
|
21
|
+
i0.ɵɵlistener("click", function ResourcePermissionsComponent_Conditional_1_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.SavePermissions()); });
|
|
22
|
+
i0.ɵɵtext(1, "Save");
|
|
23
|
+
i0.ɵɵelementEnd();
|
|
24
|
+
} }
|
|
25
|
+
function ResourcePermissionsComponent_Conditional_3_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
26
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
27
|
+
i0.ɵɵelementStart(0, "kendo-dropdownlist", 11);
|
|
28
|
+
i0.ɵɵtwoWayListener("ngModelChange", function ResourcePermissionsComponent_Conditional_3_Conditional_4_Template_kendo_dropdownlist_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(2); i0.ɵɵtwoWayBindingSet(ctx_r1.SelectedUser, $event) || (ctx_r1.SelectedUser = $event); return i0.ɵɵresetView($event); });
|
|
29
|
+
i0.ɵɵelementEnd();
|
|
30
|
+
} if (rf & 2) {
|
|
31
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
32
|
+
i0.ɵɵproperty("data", ctx_r1.AllUsers);
|
|
33
|
+
i0.ɵɵtwoWayProperty("ngModel", ctx_r1.SelectedUser);
|
|
34
|
+
} }
|
|
35
|
+
function ResourcePermissionsComponent_Conditional_3_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
36
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
37
|
+
i0.ɵɵelementStart(0, "kendo-dropdownlist", 12);
|
|
38
|
+
i0.ɵɵtwoWayListener("ngModelChange", function ResourcePermissionsComponent_Conditional_3_Conditional_5_Template_kendo_dropdownlist_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); i0.ɵɵtwoWayBindingSet(ctx_r1.SelectedRole, $event) || (ctx_r1.SelectedRole = $event); return i0.ɵɵresetView($event); });
|
|
39
|
+
i0.ɵɵelementEnd();
|
|
40
|
+
} if (rf & 2) {
|
|
41
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
42
|
+
i0.ɵɵproperty("data", ctx_r1.AllRoles);
|
|
43
|
+
i0.ɵɵtwoWayProperty("ngModel", ctx_r1.SelectedRole);
|
|
44
|
+
} }
|
|
45
|
+
function ResourcePermissionsComponent_Conditional_3_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
46
|
+
i0.ɵɵtext(0);
|
|
47
|
+
} if (rf & 2) {
|
|
48
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
49
|
+
i0.ɵɵtextInterpolate1(" SelectedType: ", ctx_r1.SelectedType, " ");
|
|
50
|
+
} }
|
|
51
|
+
function ResourcePermissionsComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
52
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
53
|
+
i0.ɵɵelementStart(0, "div", 3)(1, "span", 6);
|
|
54
|
+
i0.ɵɵtext(2, "Add Permission");
|
|
55
|
+
i0.ɵɵelementEnd();
|
|
56
|
+
i0.ɵɵelementStart(3, "kendo-dropdownlist", 7);
|
|
57
|
+
i0.ɵɵtwoWayListener("ngModelChange", function ResourcePermissionsComponent_Conditional_3_Template_kendo_dropdownlist_ngModelChange_3_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵtwoWayBindingSet(ctx_r1.SelectedType, $event) || (ctx_r1.SelectedType = $event); return i0.ɵɵresetView($event); });
|
|
58
|
+
i0.ɵɵelementEnd();
|
|
59
|
+
i0.ɵɵtemplate(4, ResourcePermissionsComponent_Conditional_3_Conditional_4_Template, 1, 2, "kendo-dropdownlist", 8)(5, ResourcePermissionsComponent_Conditional_3_Conditional_5_Template, 1, 2, "kendo-dropdownlist", 9)(6, ResourcePermissionsComponent_Conditional_3_Conditional_6_Template, 1, 1);
|
|
60
|
+
i0.ɵɵelementStart(7, "kendo-dropdownlist", 7);
|
|
61
|
+
i0.ɵɵtwoWayListener("ngModelChange", function ResourcePermissionsComponent_Conditional_3_Template_kendo_dropdownlist_ngModelChange_7_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵtwoWayBindingSet(ctx_r1.SelectedPermissionLevel, $event) || (ctx_r1.SelectedPermissionLevel = $event); return i0.ɵɵresetView($event); });
|
|
62
|
+
i0.ɵɵelementEnd();
|
|
63
|
+
i0.ɵɵelementStart(8, "button", 10);
|
|
64
|
+
i0.ɵɵlistener("click", function ResourcePermissionsComponent_Conditional_3_Template_button_click_8_listener() { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.addPermission()); });
|
|
65
|
+
i0.ɵɵtext(9, "Add");
|
|
66
|
+
i0.ɵɵelementEnd()();
|
|
67
|
+
} if (rf & 2) {
|
|
68
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
69
|
+
i0.ɵɵadvance(3);
|
|
70
|
+
i0.ɵɵproperty("data", ctx_r1.permissionTypes);
|
|
71
|
+
i0.ɵɵtwoWayProperty("ngModel", ctx_r1.SelectedType);
|
|
72
|
+
i0.ɵɵadvance();
|
|
73
|
+
i0.ɵɵconditional(ctx_r1.SelectedType === "User" ? 4 : ctx_r1.SelectedType === "Role" ? 5 : 6);
|
|
74
|
+
i0.ɵɵadvance(3);
|
|
75
|
+
i0.ɵɵproperty("data", ctx_r1.permissionLevels);
|
|
76
|
+
i0.ɵɵtwoWayProperty("ngModel", ctx_r1.SelectedPermissionLevel);
|
|
77
|
+
i0.ɵɵadvance();
|
|
78
|
+
i0.ɵɵproperty("disabled", ctx_r1.permissionAlreadyExists())("title", ctx_r1.permissionAlreadyExists() ? "This combination of Type/User/Role already exists below" : "");
|
|
79
|
+
} }
|
|
80
|
+
function ResourcePermissionsComponent_Conditional_13_Template(rf, ctx) { if (rf & 1) {
|
|
81
|
+
i0.ɵɵelementStart(0, "th");
|
|
82
|
+
i0.ɵɵtext(1, "Actions");
|
|
83
|
+
i0.ɵɵelementEnd();
|
|
84
|
+
} }
|
|
85
|
+
function ResourcePermissionsComponent_For_16_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
86
|
+
const _r6 = i0.ɵɵgetCurrentView();
|
|
87
|
+
i0.ɵɵelementStart(0, "kendo-dropdownlist", 14);
|
|
88
|
+
i0.ɵɵtwoWayListener("ngModelChange", function ResourcePermissionsComponent_For_16_Conditional_6_Template_kendo_dropdownlist_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r6); const p_r7 = i0.ɵɵnextContext().$implicit; i0.ɵɵtwoWayBindingSet(p_r7.PermissionLevel, $event) || (p_r7.PermissionLevel = $event); return i0.ɵɵresetView($event); });
|
|
89
|
+
i0.ɵɵelementEnd();
|
|
90
|
+
} if (rf & 2) {
|
|
91
|
+
const p_r7 = i0.ɵɵnextContext().$implicit;
|
|
92
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
93
|
+
i0.ɵɵtwoWayProperty("ngModel", p_r7.PermissionLevel);
|
|
94
|
+
i0.ɵɵproperty("data", ctx_r1.permissionLevels);
|
|
95
|
+
} }
|
|
96
|
+
function ResourcePermissionsComponent_For_16_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
97
|
+
i0.ɵɵtext(0);
|
|
98
|
+
} if (rf & 2) {
|
|
99
|
+
const p_r7 = i0.ɵɵnextContext().$implicit;
|
|
100
|
+
i0.ɵɵtextInterpolate1(" ", p_r7.PermissionLevel, " ");
|
|
101
|
+
} }
|
|
102
|
+
function ResourcePermissionsComponent_For_16_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
103
|
+
const _r8 = i0.ɵɵgetCurrentView();
|
|
104
|
+
i0.ɵɵelementStart(0, "td")(1, "button", 5);
|
|
105
|
+
i0.ɵɵlistener("click", function ResourcePermissionsComponent_For_16_Conditional_8_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r8); const p_r7 = i0.ɵɵnextContext().$implicit; const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.deletePermission(p_r7)); });
|
|
106
|
+
i0.ɵɵelement(2, "span", 15);
|
|
107
|
+
i0.ɵɵelementEnd()();
|
|
108
|
+
} }
|
|
109
|
+
function ResourcePermissionsComponent_For_16_Template(rf, ctx) { if (rf & 1) {
|
|
110
|
+
i0.ɵɵelementStart(0, "tr")(1, "td");
|
|
111
|
+
i0.ɵɵtext(2);
|
|
112
|
+
i0.ɵɵelementEnd();
|
|
113
|
+
i0.ɵɵelementStart(3, "td");
|
|
114
|
+
i0.ɵɵtext(4);
|
|
115
|
+
i0.ɵɵelementEnd();
|
|
116
|
+
i0.ɵɵelementStart(5, "td");
|
|
117
|
+
i0.ɵɵtemplate(6, ResourcePermissionsComponent_For_16_Conditional_6_Template, 1, 2, "kendo-dropdownlist", 13)(7, ResourcePermissionsComponent_For_16_Conditional_7_Template, 1, 1);
|
|
118
|
+
i0.ɵɵelementEnd();
|
|
119
|
+
i0.ɵɵtemplate(8, ResourcePermissionsComponent_For_16_Conditional_8_Template, 3, 0, "td");
|
|
120
|
+
i0.ɵɵelementEnd();
|
|
121
|
+
} if (rf & 2) {
|
|
122
|
+
const p_r7 = ctx.$implicit;
|
|
123
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
124
|
+
i0.ɵɵadvance(2);
|
|
125
|
+
i0.ɵɵtextInterpolate(p_r7.Type);
|
|
126
|
+
i0.ɵɵadvance(2);
|
|
127
|
+
i0.ɵɵtextInterpolate(p_r7.Type === "User" ? p_r7.User : p_r7.Role);
|
|
128
|
+
i0.ɵɵadvance(2);
|
|
129
|
+
i0.ɵɵconditional(ctx_r1.AllowEditPermissions ? 6 : 7);
|
|
130
|
+
i0.ɵɵadvance(2);
|
|
131
|
+
i0.ɵɵconditional(ctx_r1.AllowDeletePermissions ? 8 : -1);
|
|
132
|
+
} }
|
|
133
|
+
export class ResourcePermissionsComponent {
|
|
134
|
+
constructor() {
|
|
135
|
+
this.ShowSaveButton = false;
|
|
136
|
+
this.ShowUserErrorMessages = false;
|
|
137
|
+
this.AllowAddPermissions = true;
|
|
138
|
+
this.AllowEditPermissions = true;
|
|
139
|
+
this.AllowDeletePermissions = true;
|
|
140
|
+
// Define permission levels
|
|
141
|
+
this.permissionLevels = ['View', 'Edit', 'Owner']; // these are the possible permission levels
|
|
142
|
+
this.permissionTypes = ['User', 'Role'];
|
|
143
|
+
this.AllUsers = [];
|
|
144
|
+
this.AllRoles = [];
|
|
145
|
+
this.SelectedUser = null;
|
|
146
|
+
this.SelectedRole = null;
|
|
147
|
+
this.SelectedType = 'Role';
|
|
148
|
+
this.SelectedPermissionLevel = 'View';
|
|
149
|
+
this.resourcePermissions = [];
|
|
150
|
+
this._pendingDeletes = [];
|
|
151
|
+
this._pendingAdds = [];
|
|
152
|
+
}
|
|
153
|
+
UpdateResourceRecordID(ResourceRecordID) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
this.ResourceRecordID = ResourceRecordID;
|
|
156
|
+
// now go through all of our permissions and update the ResourceRecordID
|
|
157
|
+
for (const permission of this.resourcePermissions) {
|
|
158
|
+
permission.ResourceRecordID = ResourceRecordID;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
ngAfterViewInit() {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
// load up the current permissions for the specified ResourceTypeID and ResourceRecordID
|
|
165
|
+
yield ResourcePermissionEngine.Instance.Config();
|
|
166
|
+
// now we can get the permissions for the specified resource
|
|
167
|
+
const allResourcePermissions = ResourcePermissionEngine.Instance.GetResourcePermissions(this.ResourceTypeID, this.ResourceRecordID);
|
|
168
|
+
this.resourcePermissions = allResourcePermissions.filter((p) => p.Status === 'Approved'); // only include approved permissions in the UI, we don't show requested, rejected, revoked permissions here, just suppress them.
|
|
169
|
+
const md = new Metadata();
|
|
170
|
+
const rv = new RunView();
|
|
171
|
+
const result = yield rv.RunView({
|
|
172
|
+
EntityName: "Users",
|
|
173
|
+
ResultType: "entity_object",
|
|
174
|
+
OrderBy: "Name",
|
|
175
|
+
ExtraFilter: "IsActive=1"
|
|
176
|
+
});
|
|
177
|
+
this.AllUsers = result.Results;
|
|
178
|
+
this.AllRoles = md.Roles;
|
|
179
|
+
if (this.AllUsers.length > 0)
|
|
180
|
+
this.SelectedUser = this.AllUsers[0];
|
|
181
|
+
if (this.AllRoles.length > 0)
|
|
182
|
+
this.SelectedRole = this.AllRoles[0];
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
deletePermission(permission) {
|
|
186
|
+
this._pendingDeletes.push(permission);
|
|
187
|
+
this.resourcePermissions = this.resourcePermissions.filter((p) => p !== permission);
|
|
188
|
+
}
|
|
189
|
+
addPermission() {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
const md = new Metadata();
|
|
192
|
+
const permission = yield md.GetEntityObject("Resource Permissions");
|
|
193
|
+
permission.ResourceTypeID = this.ResourceTypeID;
|
|
194
|
+
permission.ResourceRecordID = this.ResourceRecordID;
|
|
195
|
+
permission.Type = this.SelectedType;
|
|
196
|
+
permission.Status = 'Approved';
|
|
197
|
+
permission.PermissionLevel = this.SelectedPermissionLevel;
|
|
198
|
+
if (this.SelectedType === 'User' && this.SelectedUser) {
|
|
199
|
+
permission.UserID = this.SelectedUser.ID;
|
|
200
|
+
permission.Set("User", this.SelectedUser.Name); // set the virtual field for display purposes
|
|
201
|
+
}
|
|
202
|
+
else if (this.SelectedType === 'Role' && this.SelectedRole) {
|
|
203
|
+
permission.RoleID = this.SelectedRole.ID;
|
|
204
|
+
permission.Set("Role", this.SelectedRole.Name); // set the virtual field for display purposes
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
LogError('Invalid permission type or missing user/role');
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
this.resourcePermissions.push(permission);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
permissionAlreadyExists() {
|
|
214
|
+
var _a, _b;
|
|
215
|
+
// check to see if the selection that the user currently has in place for the combination of TYPE + either USER or ROLE already exists
|
|
216
|
+
// in our list of permissions
|
|
217
|
+
for (const permission of this.resourcePermissions) {
|
|
218
|
+
if (permission.Type === this.SelectedType) {
|
|
219
|
+
if (this.SelectedType === 'User' && permission.UserID === ((_a = this.SelectedUser) === null || _a === void 0 ? void 0 : _a.ID)) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
else if (this.SelectedType === 'Role' && permission.RoleID === ((_b = this.SelectedRole) === null || _b === void 0 ? void 0 : _b.ID)) {
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// if we get here, then the permission does not already exist
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
SavePermissions() {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
// first delete any permissions that were marked for deletion
|
|
233
|
+
const md = new Metadata();
|
|
234
|
+
const tg = yield md.CreateTransactionGroup();
|
|
235
|
+
for (const permission of this._pendingDeletes) {
|
|
236
|
+
if (permission.IsSaved) {
|
|
237
|
+
// only delete records previously saved, sometimes a user adds a new permission and deletes it before saving it
|
|
238
|
+
permission.TransactionGroup = tg;
|
|
239
|
+
permission.Delete(); // no await - we await the tg.submit below
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// next add new permissions by saving them in the transaction group
|
|
243
|
+
for (const permission of this._pendingAdds) {
|
|
244
|
+
if (this._pendingDeletes.includes(permission)) {
|
|
245
|
+
// don't save a permission record that is new, if it was also marked for deletion
|
|
246
|
+
permission.TransactionGroup = tg;
|
|
247
|
+
permission.Save(); // no await - we await the tg.submit below
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// now save the existing permissions
|
|
251
|
+
for (const permission of this.resourcePermissions) {
|
|
252
|
+
// make sure not in the delete array
|
|
253
|
+
if (!this._pendingDeletes.includes(permission)) {
|
|
254
|
+
permission.TransactionGroup = tg;
|
|
255
|
+
permission.Save(); // no await - we await the tg.submit below
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// now save the changes
|
|
259
|
+
if (yield tg.Submit()) {
|
|
260
|
+
this._pendingDeletes = [];
|
|
261
|
+
this._pendingAdds = [];
|
|
262
|
+
yield ResourcePermissionEngine.Instance.RefreshAllItems(); // refresh the permissions cache
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
// we had an error, show the user via SharedService
|
|
267
|
+
if (this.ShowUserErrorMessages)
|
|
268
|
+
SharedService.Instance.CreateSimpleNotification('Error saving permissions', 'error');
|
|
269
|
+
LogError('Error saving permissions in the transaction group');
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
ResourcePermissionsComponent.ɵfac = function ResourcePermissionsComponent_Factory(t) { return new (t || ResourcePermissionsComponent)(); };
|
|
276
|
+
ResourcePermissionsComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ResourcePermissionsComponent, selectors: [["mj-resource-permissions"]], inputs: { ResourceTypeID: "ResourceTypeID", ResourceRecordID: "ResourceRecordID", ShowSaveButton: "ShowSaveButton", ShowUserErrorMessages: "ShowUserErrorMessages", AllowAddPermissions: "AllowAddPermissions", AllowEditPermissions: "AllowEditPermissions", AllowDeletePermissions: "AllowDeletePermissions" }, decls: 17, vars: 3, consts: [[1, "container"], ["kendoButton", ""], [1, "table-container"], [1, "add-permission-section"], [1, "resource-table"], ["kendoButton", "", 3, "click"], [1, "add-permission-label"], [2, "width", "100px", 3, "ngModelChange", "data", "ngModel"], ["textField", "Name", "valueField", "ID", 2, "width", "225px", 3, "data", "ngModel"], ["textField", "Name", "valueField", "ID", 2, "width", "150px", 3, "data", "ngModel"], ["kendoButton", "", 3, "click", "disabled", "title"], ["textField", "Name", "valueField", "ID", 2, "width", "225px", 3, "ngModelChange", "data", "ngModel"], ["textField", "Name", "valueField", "ID", 2, "width", "150px", 3, "ngModelChange", "data", "ngModel"], [2, "width", "100px", 3, "ngModel", "data"], [2, "width", "100px", 3, "ngModelChange", "ngModel", "data"], [1, "fa-solid", "fa-trash-can"]], template: function ResourcePermissionsComponent_Template(rf, ctx) { if (rf & 1) {
|
|
277
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
278
|
+
i0.ɵɵtemplate(1, ResourcePermissionsComponent_Conditional_1_Template, 2, 0, "button", 1);
|
|
279
|
+
i0.ɵɵelementStart(2, "div", 2);
|
|
280
|
+
i0.ɵɵtemplate(3, ResourcePermissionsComponent_Conditional_3_Template, 10, 7, "div", 3);
|
|
281
|
+
i0.ɵɵelementStart(4, "table", 4)(5, "thead")(6, "tr")(7, "th");
|
|
282
|
+
i0.ɵɵtext(8, "Type");
|
|
283
|
+
i0.ɵɵelementEnd();
|
|
284
|
+
i0.ɵɵelementStart(9, "th");
|
|
285
|
+
i0.ɵɵtext(10, "Name");
|
|
286
|
+
i0.ɵɵelementEnd();
|
|
287
|
+
i0.ɵɵelementStart(11, "th");
|
|
288
|
+
i0.ɵɵtext(12, "Level");
|
|
289
|
+
i0.ɵɵelementEnd();
|
|
290
|
+
i0.ɵɵtemplate(13, ResourcePermissionsComponent_Conditional_13_Template, 2, 0, "th");
|
|
291
|
+
i0.ɵɵelementEnd()();
|
|
292
|
+
i0.ɵɵelementStart(14, "tbody");
|
|
293
|
+
i0.ɵɵrepeaterCreate(15, ResourcePermissionsComponent_For_16_Template, 9, 4, "tr", null, i0.ɵɵrepeaterTrackByIdentity);
|
|
294
|
+
i0.ɵɵelementEnd()()()();
|
|
295
|
+
} if (rf & 2) {
|
|
296
|
+
i0.ɵɵadvance();
|
|
297
|
+
i0.ɵɵconditional(ctx.ShowSaveButton ? 1 : -1);
|
|
298
|
+
i0.ɵɵadvance(2);
|
|
299
|
+
i0.ɵɵconditional(ctx.AllowAddPermissions ? 3 : -1);
|
|
300
|
+
i0.ɵɵadvance(10);
|
|
301
|
+
i0.ɵɵconditional(ctx.AllowDeletePermissions ? 13 : -1);
|
|
302
|
+
i0.ɵɵadvance(2);
|
|
303
|
+
i0.ɵɵrepeater(ctx.resourcePermissions);
|
|
304
|
+
} }, dependencies: [i1.NgControlStatus, i1.NgModel, i2.ButtonComponent, i3.DropDownListComponent], styles: ["\n\n.container[_ngcontent-%COMP%] {\n max-width: 100%;\n}\n\n\n\n.table-container[_ngcontent-%COMP%] {\n max-height: 400px; \n\n overflow-y: auto;\n border: 1px solid #ccc;\n border-radius: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n}\n\n\n\n.resource-table[_ngcontent-%COMP%] {\n width: 100%;\n border-collapse: collapse;\n}\n\n.resource-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] {\n background-color: #f4f4f4;\n font-weight: bold;\n position: sticky;\n top: 0;\n z-index: 1;\n}\n\n.resource-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .resource-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] {\n padding: 12px;\n text-align: left;\n border-bottom: 1px solid #ddd;\n}\n\n.resource-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%] {\n background-color: #f8f8f8;\n}\n\n.resource-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(even) {\n background-color: #f9f9f9;\n}\n\n.resource-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover {\n background-color: #f1f1f1;\n}\n\n\n\nbutton.k-button[_ngcontent-%COMP%] {\n background-color: #ff5252;\n color: white;\n border: none;\n padding: 5px 10px;\n border-radius: 4px;\n cursor: pointer;\n}\n\nbutton.k-button[_ngcontent-%COMP%]:hover {\n background-color: #ff1744;\n}\n\n.add-permission-label[_ngcontent-%COMP%] {\n margin-left: 5px;\n margin-right: 5px;\n font-weight: bold;\n}\n\n.add-permission-section[_ngcontent-%COMP%] {\n margin-top: 10px;\n margin-bottom: 10px;\n}"] });
|
|
305
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ResourcePermissionsComponent, [{
|
|
306
|
+
type: Component,
|
|
307
|
+
args: [{ selector: 'mj-resource-permissions', template: "<div class=\"container\">\n @if(ShowSaveButton) {\n <button kendoButton (click)=\"SavePermissions()\">Save</button>\n }\n <div class=\"table-container\">\n @if(AllowAddPermissions) {\n <div class=\"add-permission-section\">\n <span class=\"add-permission-label\">Add Permission</span>\n <kendo-dropdownlist \n [data]=\"permissionTypes\"\n [(ngModel)]=\"SelectedType\"\n style=\"width: 100px;\">\n </kendo-dropdownlist>\n @if (SelectedType === 'User') {\n <kendo-dropdownlist \n [data]=\"AllUsers\"\n [(ngModel)]=\"SelectedUser\"\n textField=\"Name\"\n valueField=\"ID\"\n style=\"width: 225px;\">\n </kendo-dropdownlist>\n }\n @else if (SelectedType === 'Role') {\n <kendo-dropdownlist \n [data]=\"AllRoles\"\n [(ngModel)]=\"SelectedRole\"\n textField=\"Name\"\n valueField=\"ID\"\n style=\"width: 150px;\">\n </kendo-dropdownlist>\n }\n @else {\n SelectedType: {{ SelectedType }}\n }\n <kendo-dropdownlist \n [data]=\"permissionLevels\"\n [(ngModel)]=\"SelectedPermissionLevel\"\n style=\"width: 100px;\">\n </kendo-dropdownlist>\n <button kendoButton (click)=\"addPermission()\" [disabled]=\"permissionAlreadyExists()\" [title]=\"permissionAlreadyExists() ? 'This combination of Type/User/Role already exists below' : ''\" >Add</button>\n </div>\n }\n <table class=\"resource-table\">\n <thead>\n <tr>\n <th>Type</th>\n <th>Name</th>\n <th>Level</th>\n @if(AllowDeletePermissions) {\n <th>Actions</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (p of resourcePermissions; track p) {\n <tr>\n <td>{{ p.Type }}</td>\n <td>{{ p.Type === 'User' ? p.User : p.Role }}</td>\n <td>\n @if (AllowEditPermissions) {\n <kendo-dropdownlist \n [(ngModel)]=\"p.PermissionLevel\"\n [data]=\"permissionLevels\"\n style=\"width: 100px;\">\n </kendo-dropdownlist>\n }\n @else {\n {{ p.PermissionLevel }}\n }\n </td>\n @if(AllowDeletePermissions) {\n <td>\n <button kendoButton (click)=\"deletePermission(p)\"><span class=\"fa-solid fa-trash-can\"></span></button>\n </td>\n }\n </tr> \n }\n </tbody>\n </table>\n </div>\n</div>\n", styles: ["/* Container styling */\n.container {\n max-width: 100%;\n}\n\n/* Table container for vertical scrolling */\n.table-container {\n max-height: 400px; /* Adjust as needed */\n overflow-y: auto;\n border: 1px solid #ccc;\n border-radius: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n}\n\n/* Table styling */\n.resource-table {\n width: 100%;\n border-collapse: collapse;\n}\n\n.resource-table thead {\n background-color: #f4f4f4;\n font-weight: bold;\n position: sticky;\n top: 0;\n z-index: 1;\n}\n\n.resource-table th, .resource-table td {\n padding: 12px;\n text-align: left;\n border-bottom: 1px solid #ddd;\n}\n\n.resource-table th {\n background-color: #f8f8f8;\n}\n\n.resource-table tbody tr:nth-child(even) {\n background-color: #f9f9f9;\n}\n\n.resource-table tbody tr:hover {\n background-color: #f1f1f1;\n}\n\n/* Button styling */\nbutton.k-button {\n background-color: #ff5252;\n color: white;\n border: none;\n padding: 5px 10px;\n border-radius: 4px;\n cursor: pointer;\n}\n\nbutton.k-button:hover {\n background-color: #ff1744;\n}\n\n.add-permission-label {\n margin-left: 5px;\n margin-right: 5px;\n font-weight: bold;\n}\n\n.add-permission-section {\n margin-top: 10px;\n margin-bottom: 10px;\n}"] }]
|
|
308
|
+
}], null, { ResourceTypeID: [{
|
|
309
|
+
type: Input
|
|
310
|
+
}], ResourceRecordID: [{
|
|
311
|
+
type: Input
|
|
312
|
+
}], ShowSaveButton: [{
|
|
313
|
+
type: Input
|
|
314
|
+
}], ShowUserErrorMessages: [{
|
|
315
|
+
type: Input
|
|
316
|
+
}], AllowAddPermissions: [{
|
|
317
|
+
type: Input
|
|
318
|
+
}], AllowEditPermissions: [{
|
|
319
|
+
type: Input
|
|
320
|
+
}], AllowDeletePermissions: [{
|
|
321
|
+
type: Input
|
|
322
|
+
}] }); })();
|
|
323
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ResourcePermissionsComponent, { className: "ResourcePermissionsComponent", filePath: "src/lib/resource-permissions.component.ts", lineNumber: 11 }); })();
|
|
324
|
+
//# sourceMappingURL=resource-permissions.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-permissions.component.js","sourceRoot":"","sources":["../../src/lib/resource-permissions.component.ts","../../src/lib/resource-permissions.component.html"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAiB,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAY,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAwC,MAAM,+BAA+B,CAAC;AAC/G,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;;;;;;;ICDtD,iCAAgD;IAA5B,gMAAS,wBAAiB,KAAC;IAAC,oBAAI;IAAA,iBAAS;;;;IAYvD,8CAKwB;IAHtB,wVAA0B;IAI5B,iBAAqB;;;IALnB,sCAAiB;IACjB,mDAA0B;;;;IAO5B,8CAKwB;IAHtB,wVAA0B;IAI5B,iBAAqB;;;IALnB,sCAAiB;IACjB,mDAA0B;;;IAO5B,YACF;;;IADE,kEACF;;;;IA1BA,AADF,8BAAoC,cACC;IAAA,8BAAc;IAAA,iBAAO;IACxD,6CAGwB;IADtB,yUAA0B;IAE5B,iBAAqB;IAmBrB,AATA,AATA,kHAA+B,qGASK,4EAS7B;IAGP,6CAGwB;IADtB,+VAAqC;IAEvC,iBAAqB;IACrB,kCAA2L;IAAvK,gMAAS,sBAAe,KAAC;IAA8I,mBAAG;IAChM,AADgM,iBAAS,EACnM;;;IA/BF,eAAwB;IAAxB,6CAAwB;IACxB,mDAA0B;IAG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BAAK;QACb,2BAAI;QAAA,sBAAK;QAAA,iBAAK;QACd,mFAA6B;QAIjC,AADE,iBAAK,EACC;QACR,8BAAO;QACL,qHAsBC;QAIT,AADE,AADE,AADE,iBAAQ,EACF,EACJ,EACF;;QA/EJ,cAEC;QAFD,6CAEC;QAEC,eAoCC;QApCD,kDAoCC;QAOK,gBAEC;QAFD,sDAEC;QAIH,eAsBC;QAtBD,sCAsBC;;iFDlEI,4BAA4B;cALxC,SAAS;2BACE,yBAAyB;gBAK1B,cAAc;kBAAtB,KAAK;YACG,gBAAgB;kBAAxB,KAAK;YACG,cAAc;kBAAtB,KAAK;YACG,qBAAqB;kBAA7B,KAAK;YACG,mBAAmB;kBAA3B,KAAK;YACG,oBAAoB;kBAA5B,KAAK;YACG,sBAAsB;kBAA9B,KAAK;;kFAPK,4BAA4B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/resource-permissions.component';
|
|
5
|
+
export * from './lib/available-resources.component';
|
|
6
|
+
export * from './lib/available-resources-dialog.component';
|
|
7
|
+
export * from './lib/module';
|
|
8
|
+
//# sourceMappingURL=public-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@memberjunction/ng-resource-permissions",
|
|
3
|
+
"version": "2.8.0",
|
|
4
|
+
"description": "MemberJunction: Angular components for displaying/editing permissions for a resource",
|
|
5
|
+
"main": "./dist/public-api.js",
|
|
6
|
+
"typings": "./dist/public-api.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
|
+
"build": "ngc"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@angular/compiler": "18.0.2",
|
|
19
|
+
"@angular/compiler-cli": "18.0.2"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@angular/common": "18.0.2",
|
|
23
|
+
"@angular/core": "18.0.2",
|
|
24
|
+
"@angular/forms": "18.0.2",
|
|
25
|
+
"@angular/router": "18.0.2"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@memberjunction/core-entities": "2.8.0",
|
|
29
|
+
"@memberjunction/global": "2.8.0",
|
|
30
|
+
"@memberjunction/core": "2.8.0",
|
|
31
|
+
"@memberjunction/ng-container-directives": "2.8.0",
|
|
32
|
+
"@memberjunction/ng-shared": "2.8.0",
|
|
33
|
+
"@progress/kendo-angular-dropdowns": "16.2.0",
|
|
34
|
+
"@progress/kendo-angular-grid": "16.2.0",
|
|
35
|
+
"@progress/kendo-angular-buttons": "16.2.0",
|
|
36
|
+
"@progress/kendo-angular-dialog": "16.2.0",
|
|
37
|
+
"@progress/kendo-angular-indicators": "16.2.0",
|
|
38
|
+
"tslib": "^2.3.0"
|
|
39
|
+
},
|
|
40
|
+
"sideEffects": false
|
|
41
|
+
}
|