@sunbird-cb/resolver 0.0.1-ang-17-20
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/README.md +24 -0
- package/fesm2022/sunbird-cb-resolver.mjs +419 -0
- package/fesm2022/sunbird-cb-resolver.mjs.map +1 -0
- package/index.d.ts +150 -0
- package/index.d.ts.map +1 -0
- package/package.json +32 -0
- package/sunbird-cb-resolver-0.0.1-ang-17-20.tgz +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Resolver
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.0.3.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project resolver` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project resolver`.
|
|
8
|
+
> Note: Don't forget to add `--project resolver` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build resolver` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build resolver`, go to the dist folder `cd dist/resolver` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test resolver` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Input, HostBinding, Component, Inject, Injectable, Directive, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/material/button';
|
|
6
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
7
|
+
import * as i3 from '@angular/material/icon';
|
|
8
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
9
|
+
import * as i4 from '@angular/material/card';
|
|
10
|
+
import { MatCardModule } from '@angular/material/card';
|
|
11
|
+
import * as i1$1 from '@angular/platform-browser';
|
|
12
|
+
import * as i2$1 from '@sunbird-cb/utils';
|
|
13
|
+
import { ConfigurationsService } from '@sunbird-cb/utils';
|
|
14
|
+
|
|
15
|
+
const WIDGET_RESOLVER_GLOBAL_CONFIG = new InjectionToken('Global Registration Configuration for Widget Resolvers');
|
|
16
|
+
const WIDGET_RESOLVER_SCOPED_CONFIG = new InjectionToken('Scoped Registration Configuration for Widget Resolvers');
|
|
17
|
+
|
|
18
|
+
function isStringArray(strArr) {
|
|
19
|
+
return Array.isArray(strArr) && strArr.every(u => typeof u === 'string');
|
|
20
|
+
}
|
|
21
|
+
function isCheckRequired(requiredPermission) {
|
|
22
|
+
if (requiredPermission === undefined ||
|
|
23
|
+
requiredPermission === null ||
|
|
24
|
+
requiredPermission === '' ||
|
|
25
|
+
(Array.isArray(requiredPermission) && requiredPermission.length === 0)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
function flipBoolean(value, flip = false) {
|
|
31
|
+
return flip ? !value : value;
|
|
32
|
+
}
|
|
33
|
+
function permissionTest(testFor, requiredPermission, matchAgainst, isRestrictive = false) {
|
|
34
|
+
if (!isCheckRequired(requiredPermission)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (typeof requiredPermission === 'string') {
|
|
38
|
+
switch (testFor) {
|
|
39
|
+
case 'all':
|
|
40
|
+
case 'some':
|
|
41
|
+
return flipBoolean(matchAgainst.has(requiredPermission), isRestrictive);
|
|
42
|
+
case 'none':
|
|
43
|
+
return flipBoolean(!matchAgainst.has(requiredPermission), isRestrictive);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(requiredPermission)) {
|
|
47
|
+
const matcher = (u) => typeof u === 'string' && flipBoolean(matchAgainst.has(u), isRestrictive);
|
|
48
|
+
switch (testFor) {
|
|
49
|
+
case 'all':
|
|
50
|
+
return requiredPermission.every(matcher);
|
|
51
|
+
case 'some':
|
|
52
|
+
return requiredPermission.some(matcher);
|
|
53
|
+
case 'none':
|
|
54
|
+
return !requiredPermission.every(matcher);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
function hasUnitPermission(requiredPermission, matchAgainst, isRestrictive = false) {
|
|
60
|
+
if (!isCheckRequired(requiredPermission)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
const accessValues = matchAgainst instanceof Set
|
|
64
|
+
? matchAgainst
|
|
65
|
+
: Array.isArray(matchAgainst) && isStringArray(matchAgainst)
|
|
66
|
+
? new Set(matchAgainst)
|
|
67
|
+
: typeof matchAgainst === 'string'
|
|
68
|
+
? new Set([matchAgainst])
|
|
69
|
+
: new Set();
|
|
70
|
+
if (typeof requiredPermission === 'object' && requiredPermission !== null) {
|
|
71
|
+
if (Array.isArray(requiredPermission)) {
|
|
72
|
+
return permissionTest('all', requiredPermission, accessValues, isRestrictive);
|
|
73
|
+
}
|
|
74
|
+
return (permissionTest('all', 'all' in requiredPermission ? requiredPermission.all : null, accessValues, isRestrictive) &&
|
|
75
|
+
permissionTest('some', 'some' in requiredPermission ? requiredPermission.some : null, accessValues, isRestrictive) &&
|
|
76
|
+
permissionTest('none', 'none' in requiredPermission ? requiredPermission.none : null, accessValues, isRestrictive));
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
function hasPermissions(requiredPermission, availableRoles, availableGroups, restrictedFeatures) {
|
|
81
|
+
if (!requiredPermission) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
if (!requiredPermission.available || !requiredPermission.enabled) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
return (hasUnitPermission(requiredPermission.groups, availableGroups) &&
|
|
88
|
+
hasUnitPermission(requiredPermission.roles, availableRoles) &&
|
|
89
|
+
hasUnitPermission(requiredPermission.features, restrictedFeatures, true));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
class WidgetBaseComponent {
|
|
93
|
+
constructor() {
|
|
94
|
+
this.widgetType = '';
|
|
95
|
+
this.widgetSubType = '';
|
|
96
|
+
}
|
|
97
|
+
updateBaseComponent(widgetType, widgetSubType, widgetInstanceId, widgetHostClass, widgetSafeStyle) {
|
|
98
|
+
this.widgetType = widgetType;
|
|
99
|
+
this.widgetSubType = widgetSubType;
|
|
100
|
+
this.widgetInstanceId = widgetInstanceId;
|
|
101
|
+
this.widgetHostClass = widgetHostClass;
|
|
102
|
+
this.widgetSafeStyle = widgetSafeStyle;
|
|
103
|
+
if (this.widgetHostClass) {
|
|
104
|
+
this.className = `${this.className} ${this.widgetHostClass}`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
ngAfterViewInit() {
|
|
108
|
+
const hash = window.location.hash ? window.location.hash.split('#')[1] : '';
|
|
109
|
+
if (hash && !isNaN(hash) && hash === this.widgetInstanceId) {
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
const element = document.getElementById(this.widgetInstanceId || '');
|
|
112
|
+
if (element) {
|
|
113
|
+
element.scrollIntoView();
|
|
114
|
+
}
|
|
115
|
+
}, 200);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
119
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: WidgetBaseComponent, isStandalone: false, selector: "ws-resolver-base", inputs: { widgetType: "widgetType", widgetSubType: "widgetSubType", widgetHostClass: "widgetHostClass", widgetInstanceId: "widgetInstanceId", widgetSafeStyle: "widgetSafeStyle", className: "className" }, host: { properties: { "id": "this.widgetInstanceId", "style": "this.widgetSafeStyle", "class": "this.className" } }, ngImport: i0, template: 'Base Component', isInline: true }); }
|
|
120
|
+
}
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetBaseComponent, decorators: [{
|
|
122
|
+
type: Component,
|
|
123
|
+
args: [{
|
|
124
|
+
selector: 'ws-resolver-base',
|
|
125
|
+
template: 'Base Component',
|
|
126
|
+
standalone: false
|
|
127
|
+
}]
|
|
128
|
+
}], propDecorators: { widgetType: [{
|
|
129
|
+
type: Input
|
|
130
|
+
}], widgetSubType: [{
|
|
131
|
+
type: Input
|
|
132
|
+
}], widgetHostClass: [{
|
|
133
|
+
type: Input
|
|
134
|
+
}], widgetInstanceId: [{
|
|
135
|
+
type: Input
|
|
136
|
+
}, {
|
|
137
|
+
type: HostBinding,
|
|
138
|
+
args: ['id']
|
|
139
|
+
}], widgetSafeStyle: [{
|
|
140
|
+
type: Input
|
|
141
|
+
}, {
|
|
142
|
+
type: HostBinding,
|
|
143
|
+
args: ['style']
|
|
144
|
+
}], className: [{
|
|
145
|
+
type: Input
|
|
146
|
+
}, {
|
|
147
|
+
type: HostBinding,
|
|
148
|
+
args: ['class']
|
|
149
|
+
}] } });
|
|
150
|
+
|
|
151
|
+
class RestrictedComponent extends WidgetBaseComponent {
|
|
152
|
+
constructor() {
|
|
153
|
+
super(...arguments);
|
|
154
|
+
this.showData = true;
|
|
155
|
+
}
|
|
156
|
+
ngOnInit() { }
|
|
157
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RestrictedComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
158
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: RestrictedComponent, isStandalone: false, selector: "ws-resolver-restricted", inputs: { widgetData: "widgetData" }, usesInheritance: true, ngImport: i0, template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Restricted Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { kind: "component", type: i4.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "pipe", type: i1.JsonPipe, name: "json" }] }); }
|
|
159
|
+
}
|
|
160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RestrictedComponent, decorators: [{
|
|
161
|
+
type: Component,
|
|
162
|
+
args: [{ selector: 'ws-resolver-restricted', standalone: false, template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Restricted Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"] }]
|
|
163
|
+
}], propDecorators: { widgetData: [{
|
|
164
|
+
type: Input
|
|
165
|
+
}] } });
|
|
166
|
+
|
|
167
|
+
class InvalidRegistrationComponent extends WidgetBaseComponent {
|
|
168
|
+
constructor() {
|
|
169
|
+
super(...arguments);
|
|
170
|
+
this.showData = true;
|
|
171
|
+
}
|
|
172
|
+
ngOnInit() { }
|
|
173
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InvalidRegistrationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
174
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: InvalidRegistrationComponent, isStandalone: false, selector: "ws-resolver-invalid-registration", inputs: { widgetData: "widgetData" }, usesInheritance: true, ngImport: i0, template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Registration for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { kind: "component", type: i4.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "pipe", type: i1.JsonPipe, name: "json" }] }); }
|
|
175
|
+
}
|
|
176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InvalidRegistrationComponent, decorators: [{
|
|
177
|
+
type: Component,
|
|
178
|
+
args: [{ selector: 'ws-resolver-invalid-registration', standalone: false, template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Registration for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"] }]
|
|
179
|
+
}], propDecorators: { widgetData: [{
|
|
180
|
+
type: Input
|
|
181
|
+
}] } });
|
|
182
|
+
|
|
183
|
+
class InvalidPermissionComponent extends WidgetBaseComponent {
|
|
184
|
+
constructor() {
|
|
185
|
+
super(...arguments);
|
|
186
|
+
this.showData = true;
|
|
187
|
+
}
|
|
188
|
+
ngOnInit() { }
|
|
189
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InvalidPermissionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
190
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: InvalidPermissionComponent, isStandalone: false, selector: "ws-resolver-invalid-permission", inputs: { widgetType: "widgetType", widgetSubType: "widgetSubType", widgetInstanceId: "widgetInstanceId", widgetData: "widgetData" }, usesInheritance: true, ngImport: i0, template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Permission for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { kind: "component", type: i4.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "pipe", type: i1.JsonPipe, name: "json" }] }); }
|
|
191
|
+
}
|
|
192
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InvalidPermissionComponent, decorators: [{
|
|
193
|
+
type: Component,
|
|
194
|
+
args: [{ selector: 'ws-resolver-invalid-permission', standalone: false, template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Permission for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"] }]
|
|
195
|
+
}], propDecorators: { widgetType: [{
|
|
196
|
+
type: Input
|
|
197
|
+
}], widgetSubType: [{
|
|
198
|
+
type: Input
|
|
199
|
+
}], widgetInstanceId: [{
|
|
200
|
+
type: Input
|
|
201
|
+
}], widgetData: [{
|
|
202
|
+
type: Input
|
|
203
|
+
}] } });
|
|
204
|
+
|
|
205
|
+
class UnresolvedComponent extends WidgetBaseComponent {
|
|
206
|
+
constructor() {
|
|
207
|
+
super(...arguments);
|
|
208
|
+
this.showData = true;
|
|
209
|
+
this.previewMode = false;
|
|
210
|
+
this.searchArray = ['preview', 'channel'];
|
|
211
|
+
}
|
|
212
|
+
ngOnInit() {
|
|
213
|
+
const url = window.location.href;
|
|
214
|
+
this.previewMode = this.searchArray.some((word) => {
|
|
215
|
+
return url.indexOf(word) > -1;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UnresolvedComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
219
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: UnresolvedComponent, isStandalone: false, selector: "ws-resolver-unresolved", inputs: { widgetData: "widgetData" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"previewMode\" [ngTemplateOutlet]=\"previewCardTemplate\"></ng-container>\r\n<ng-container *ngIf=\"!previewMode\" [ngTemplateOutlet]=\"unresolvedTemplate\"></ng-container>\r\n\r\n<ng-template #unresolvedTemplate>\r\n <mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error in Resolving Json for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s\"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n </mat-card>\r\n</ng-template>\r\n<ng-template #previewCardTemplate>\r\n <mat-card>\r\n <div class=\"w-full\">\r\n <div class=\"p-4\">\r\n <div class=\"text-3xl font-semibold text-center leading-tight\" i18n>\r\n Content not available\r\n </div>\r\n <br />\r\n <div class=\"text-base font-medium text-center leading-normal\" i18n>\r\n Please add widget or provide data to widget template\r\n </div>\r\n </div>\r\n </div>\r\n </mat-card>\r\n</ng-template>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { kind: "component", type: i4.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "pipe", type: i1.JsonPipe, name: "json" }] }); }
|
|
220
|
+
}
|
|
221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UnresolvedComponent, decorators: [{
|
|
222
|
+
type: Component,
|
|
223
|
+
args: [{ selector: 'ws-resolver-unresolved', standalone: false, template: "<ng-container *ngIf=\"previewMode\" [ngTemplateOutlet]=\"previewCardTemplate\"></ng-container>\r\n<ng-container *ngIf=\"!previewMode\" [ngTemplateOutlet]=\"unresolvedTemplate\"></ng-container>\r\n\r\n<ng-template #unresolvedTemplate>\r\n <mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error in Resolving Json for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s\"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n </mat-card>\r\n</ng-template>\r\n<ng-template #previewCardTemplate>\r\n <mat-card>\r\n <div class=\"w-full\">\r\n <div class=\"p-4\">\r\n <div class=\"text-3xl font-semibold text-center leading-tight\" i18n>\r\n Content not available\r\n </div>\r\n <br />\r\n <div class=\"text-base font-medium text-center leading-normal\" i18n>\r\n Please add widget or provide data to widget template\r\n </div>\r\n </div>\r\n </div>\r\n </mat-card>\r\n</ng-template>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"] }]
|
|
224
|
+
}], propDecorators: { widgetData: [{
|
|
225
|
+
type: Input
|
|
226
|
+
}] } });
|
|
227
|
+
|
|
228
|
+
class WidgetResolverService {
|
|
229
|
+
constructor(domSanitizer, componentFactoryResolver,
|
|
230
|
+
// private loggerSvc: LoggerService,
|
|
231
|
+
globalConfig, scopedConfig) {
|
|
232
|
+
this.domSanitizer = domSanitizer;
|
|
233
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
234
|
+
this.globalConfig = globalConfig;
|
|
235
|
+
this.scopedConfig = scopedConfig;
|
|
236
|
+
this.roles = null;
|
|
237
|
+
this.groups = null;
|
|
238
|
+
this.restrictedFeatures = null;
|
|
239
|
+
this.isInitialized = false;
|
|
240
|
+
this.availableRegisteredWidgets = null;
|
|
241
|
+
this.restrictedWidgetKeys = null;
|
|
242
|
+
}
|
|
243
|
+
static getWidgetKey(config) {
|
|
244
|
+
return `widget:${config.widgetType}::${config.widgetSubType}`;
|
|
245
|
+
}
|
|
246
|
+
initialize(restrictedWidgetKeys, roles, groups, restrictedFeatures) {
|
|
247
|
+
this.roles = roles;
|
|
248
|
+
this.groups = groups;
|
|
249
|
+
this.restrictedFeatures = restrictedFeatures;
|
|
250
|
+
const restrictedWidgetKeysSet = restrictedWidgetKeys
|
|
251
|
+
? restrictedWidgetKeys
|
|
252
|
+
: new Set();
|
|
253
|
+
const registrationConfig = new Map();
|
|
254
|
+
const allWidgetsConfigurations = [];
|
|
255
|
+
if (this.globalConfig && Array.isArray(this.globalConfig)) {
|
|
256
|
+
allWidgetsConfigurations.push(...this.globalConfig);
|
|
257
|
+
}
|
|
258
|
+
if (this.scopedConfig && Array.isArray(this.scopedConfig)) {
|
|
259
|
+
allWidgetsConfigurations.push(...this.scopedConfig);
|
|
260
|
+
}
|
|
261
|
+
allWidgetsConfigurations.forEach(u => {
|
|
262
|
+
const key = WidgetResolverService.getWidgetKey(u);
|
|
263
|
+
if (!restrictedWidgetKeysSet.has(key)) {
|
|
264
|
+
registrationConfig.set(key, u);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
this.restrictedWidgetKeys = restrictedWidgetKeysSet;
|
|
268
|
+
this.availableRegisteredWidgets = registrationConfig;
|
|
269
|
+
this.isInitialized = true;
|
|
270
|
+
// this.loggerSvc.log(
|
|
271
|
+
// `Widget Configurations`,
|
|
272
|
+
// this.globalConfig,
|
|
273
|
+
// this.scopedConfig,
|
|
274
|
+
// this.availableRegisteredWidgets,
|
|
275
|
+
// )
|
|
276
|
+
}
|
|
277
|
+
resolveWidget(receivedConfig, containerRef) {
|
|
278
|
+
const key = WidgetResolverService.getWidgetKey(receivedConfig);
|
|
279
|
+
if (this.restrictedWidgetKeys && this.restrictedWidgetKeys.has(key)) {
|
|
280
|
+
// Restricted
|
|
281
|
+
return this.widgetResolved(containerRef, receivedConfig, RestrictedComponent);
|
|
282
|
+
}
|
|
283
|
+
if (this.availableRegisteredWidgets && this.availableRegisteredWidgets.has(key)) {
|
|
284
|
+
if (hasPermissions(receivedConfig.widgetPermission, this.roles, this.groups, this.restrictedFeatures)) {
|
|
285
|
+
const config = this.availableRegisteredWidgets.get(key);
|
|
286
|
+
if (config && config.component) {
|
|
287
|
+
return this.widgetResolved(containerRef, receivedConfig, config.component);
|
|
288
|
+
}
|
|
289
|
+
// Not properly registered
|
|
290
|
+
return this.widgetResolved(containerRef, receivedConfig, InvalidRegistrationComponent);
|
|
291
|
+
}
|
|
292
|
+
// No Permission
|
|
293
|
+
return this.widgetResolved(containerRef, receivedConfig, InvalidPermissionComponent);
|
|
294
|
+
}
|
|
295
|
+
// Not Resolved
|
|
296
|
+
return this.widgetResolved(containerRef, receivedConfig, UnresolvedComponent);
|
|
297
|
+
}
|
|
298
|
+
widgetResolved(containerRef, compData, component) {
|
|
299
|
+
const factory = this.componentFactoryResolver.resolveComponentFactory(component);
|
|
300
|
+
containerRef.clear();
|
|
301
|
+
const compRef = containerRef.createComponent(factory);
|
|
302
|
+
compRef.instance.widgetData = compData.widgetData;
|
|
303
|
+
if (compRef.instance.updateBaseComponent) {
|
|
304
|
+
const widgetSafeStyle = compData.widgetHostStyle
|
|
305
|
+
? this.domSanitizer.bypassSecurityTrustStyle(Object.entries(compData.widgetHostStyle).reduce((s, [k, v]) => `${s}${k}:${v};`, ''))
|
|
306
|
+
: undefined;
|
|
307
|
+
compRef.instance.updateBaseComponent(compData.widgetType, compData.widgetSubType, compData.widgetInstanceId, compData.widgetHostClass, widgetSafeStyle);
|
|
308
|
+
}
|
|
309
|
+
return compRef;
|
|
310
|
+
}
|
|
311
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetResolverService, deps: [{ token: i1$1.DomSanitizer }, { token: i0.ComponentFactoryResolver }, { token: WIDGET_RESOLVER_GLOBAL_CONFIG }, { token: WIDGET_RESOLVER_SCOPED_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
312
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetResolverService, providedIn: 'root' }); }
|
|
313
|
+
}
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetResolverService, decorators: [{
|
|
315
|
+
type: Injectable,
|
|
316
|
+
args: [{
|
|
317
|
+
providedIn: 'root',
|
|
318
|
+
}]
|
|
319
|
+
}], ctorParameters: () => [{ type: i1$1.DomSanitizer }, { type: i0.ComponentFactoryResolver }, { type: undefined, decorators: [{
|
|
320
|
+
type: Inject,
|
|
321
|
+
args: [WIDGET_RESOLVER_GLOBAL_CONFIG]
|
|
322
|
+
}] }, { type: undefined, decorators: [{
|
|
323
|
+
type: Inject,
|
|
324
|
+
args: [WIDGET_RESOLVER_SCOPED_CONFIG]
|
|
325
|
+
}] }] });
|
|
326
|
+
|
|
327
|
+
class WidgetResolverDirective {
|
|
328
|
+
constructor(viewContainerRef, widgetResolverSvc, logger) {
|
|
329
|
+
this.viewContainerRef = viewContainerRef;
|
|
330
|
+
this.widgetResolverSvc = widgetResolverSvc;
|
|
331
|
+
this.logger = logger;
|
|
332
|
+
this.wsResolverWidget = null;
|
|
333
|
+
}
|
|
334
|
+
ngOnChanges() {
|
|
335
|
+
if (!this.widgetResolverSvc.isInitialized) {
|
|
336
|
+
this.logger.error('Widgets Registration Not Done. Used Before Initialization.', this.wsResolverWidget);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (this.wsResolverWidget) {
|
|
340
|
+
const compRef = this.widgetResolverSvc.resolveWidget(this.wsResolverWidget, this.viewContainerRef);
|
|
341
|
+
if (compRef) {
|
|
342
|
+
compRef.changeDetectorRef.detectChanges();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetResolverDirective, deps: [{ token: i0.ViewContainerRef }, { token: WidgetResolverService }, { token: i2$1.LoggerService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
347
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: WidgetResolverDirective, isStandalone: false, selector: "[wsResolverWidget]", inputs: { wsResolverWidget: "wsResolverWidget" }, usesOnChanges: true, ngImport: i0 }); }
|
|
348
|
+
}
|
|
349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetResolverDirective, decorators: [{
|
|
350
|
+
type: Directive,
|
|
351
|
+
args: [{
|
|
352
|
+
selector: '[wsResolverWidget]',
|
|
353
|
+
standalone: false
|
|
354
|
+
}]
|
|
355
|
+
}], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: WidgetResolverService }, { type: i2$1.LoggerService }], propDecorators: { wsResolverWidget: [{
|
|
356
|
+
type: Input
|
|
357
|
+
}] } });
|
|
358
|
+
|
|
359
|
+
class WidgetResolverModule {
|
|
360
|
+
static forRoot(config) {
|
|
361
|
+
return {
|
|
362
|
+
ngModule: WidgetResolverModule,
|
|
363
|
+
providers: [
|
|
364
|
+
WidgetResolverService,
|
|
365
|
+
{
|
|
366
|
+
provide: WIDGET_RESOLVER_GLOBAL_CONFIG,
|
|
367
|
+
useValue: config,
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
provide: WIDGET_RESOLVER_SCOPED_CONFIG,
|
|
371
|
+
useValue: [],
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
static forChild(config) {
|
|
377
|
+
return {
|
|
378
|
+
ngModule: WidgetResolverModule,
|
|
379
|
+
providers: [
|
|
380
|
+
WidgetResolverService,
|
|
381
|
+
{
|
|
382
|
+
provide: WIDGET_RESOLVER_SCOPED_CONFIG,
|
|
383
|
+
useValue: config,
|
|
384
|
+
},
|
|
385
|
+
],
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetResolverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
389
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: WidgetResolverModule, declarations: [WidgetBaseComponent,
|
|
390
|
+
WidgetResolverDirective,
|
|
391
|
+
RestrictedComponent,
|
|
392
|
+
InvalidRegistrationComponent,
|
|
393
|
+
InvalidPermissionComponent,
|
|
394
|
+
UnresolvedComponent], imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule], exports: [WidgetResolverDirective, WidgetBaseComponent] }); }
|
|
395
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetResolverModule, providers: [ConfigurationsService], imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule] }); }
|
|
396
|
+
}
|
|
397
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WidgetResolverModule, decorators: [{
|
|
398
|
+
type: NgModule,
|
|
399
|
+
args: [{
|
|
400
|
+
declarations: [
|
|
401
|
+
WidgetBaseComponent,
|
|
402
|
+
WidgetResolverDirective,
|
|
403
|
+
RestrictedComponent,
|
|
404
|
+
InvalidRegistrationComponent,
|
|
405
|
+
InvalidPermissionComponent,
|
|
406
|
+
UnresolvedComponent,
|
|
407
|
+
],
|
|
408
|
+
imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule],
|
|
409
|
+
exports: [WidgetResolverDirective, WidgetBaseComponent],
|
|
410
|
+
providers: [ConfigurationsService]
|
|
411
|
+
}]
|
|
412
|
+
}] });
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Generated bundle index. Do not edit.
|
|
416
|
+
*/
|
|
417
|
+
|
|
418
|
+
export { WidgetBaseComponent, WidgetResolverDirective, WidgetResolverModule, WidgetResolverService, hasPermissions, hasUnitPermission };
|
|
419
|
+
//# sourceMappingURL=sunbird-cb-resolver.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sunbird-cb-resolver.mjs","sources":["../../../../library/sunbird-cb/resolver/src/lib/widget-resolver.constant.ts","../../../../library/sunbird-cb/resolver/src/lib/widget-resolver.permissions.ts","../../../../library/sunbird-cb/resolver/src/lib/widget-base.component.ts","../../../../library/sunbird-cb/resolver/src/lib/restricted/restricted.component.ts","../../../../library/sunbird-cb/resolver/src/lib/restricted/restricted.component.html","../../../../library/sunbird-cb/resolver/src/lib/invalid-registration/invalid-registration.component.ts","../../../../library/sunbird-cb/resolver/src/lib/invalid-registration/invalid-registration.component.html","../../../../library/sunbird-cb/resolver/src/lib/invalid-permission/invalid-permission.component.ts","../../../../library/sunbird-cb/resolver/src/lib/invalid-permission/invalid-permission.component.html","../../../../library/sunbird-cb/resolver/src/lib/unresolved/unresolved.component.ts","../../../../library/sunbird-cb/resolver/src/lib/unresolved/unresolved.component.html","../../../../library/sunbird-cb/resolver/src/lib/widget-resolver.service.ts","../../../../library/sunbird-cb/resolver/src/lib/widget-resolver.directive.ts","../../../../library/sunbird-cb/resolver/src/lib/widget-resolver.module.ts","../../../../library/sunbird-cb/resolver/src/sunbird-cb-resolver.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\r\nimport { NsWidgetResolver as resolver } from './widget-resolver.model'\r\n\r\nexport const WIDGET_RESOLVER_GLOBAL_CONFIG = new InjectionToken<resolver.IRegistrationConfig[]>(\r\n 'Global Registration Configuration for Widget Resolvers',\r\n)\r\n\r\nexport const WIDGET_RESOLVER_SCOPED_CONFIG = new InjectionToken<resolver.IRegistrationConfig[]>(\r\n 'Scoped Registration Configuration for Widget Resolvers',\r\n)\r\n","import { NsWidgetResolver } from './widget-resolver.model'\r\n\r\nfunction isStringArray(strArr: string[] | any): boolean {\r\n return Array.isArray(strArr) && strArr.every(u => typeof u === 'string')\r\n}\r\n\r\nfunction isCheckRequired(requiredPermission: NsWidgetResolver.UnitPermission): boolean {\r\n if (\r\n requiredPermission === undefined ||\r\n requiredPermission === null ||\r\n requiredPermission === '' ||\r\n (Array.isArray(requiredPermission) && requiredPermission.length === 0)\r\n ) {\r\n return false\r\n }\r\n return true\r\n}\r\n\r\nfunction flipBoolean(value: boolean, flip = false) {\r\n return flip ? !value : value\r\n}\r\n\r\nfunction permissionTest(\r\n testFor: 'all' | 'some' | 'none',\r\n requiredPermission: NsWidgetResolver.UnitPermissionPrimitive | string[],\r\n matchAgainst: Set<string>,\r\n isRestrictive = false,\r\n) {\r\n if (!isCheckRequired(requiredPermission)) {\r\n return true\r\n }\r\n if (typeof requiredPermission === 'string') {\r\n switch (testFor) {\r\n case 'all':\r\n case 'some':\r\n return flipBoolean(matchAgainst.has(requiredPermission), isRestrictive)\r\n case 'none':\r\n return flipBoolean(!matchAgainst.has(requiredPermission), isRestrictive)\r\n }\r\n }\r\n if (Array.isArray(requiredPermission)) {\r\n const matcher = (u: string) =>\r\n typeof u === 'string' && flipBoolean(matchAgainst.has(u), isRestrictive)\r\n switch (testFor) {\r\n case 'all':\r\n return requiredPermission.every(matcher)\r\n case 'some':\r\n return requiredPermission.some(matcher)\r\n case 'none':\r\n return !requiredPermission.every(matcher)\r\n }\r\n }\r\n return false\r\n}\r\n\r\nexport function hasUnitPermission(\r\n requiredPermission: NsWidgetResolver.UnitPermission,\r\n matchAgainst?: Set<string> | string[] | string | null | undefined,\r\n isRestrictive = false,\r\n): boolean {\r\n if (!isCheckRequired(requiredPermission)) {\r\n return true\r\n }\r\n const accessValues: Set<string> =\r\n matchAgainst instanceof Set\r\n ? matchAgainst\r\n : Array.isArray(matchAgainst) && isStringArray(matchAgainst)\r\n ? new Set(matchAgainst)\r\n : typeof matchAgainst === 'string'\r\n ? new Set([matchAgainst])\r\n : new Set()\r\n\r\n if (typeof requiredPermission === 'object' && requiredPermission !== null) {\r\n if (Array.isArray(requiredPermission)) {\r\n return permissionTest('all', requiredPermission, accessValues, isRestrictive)\r\n }\r\n return (\r\n permissionTest(\r\n 'all',\r\n 'all' in requiredPermission ? requiredPermission.all : null,\r\n accessValues,\r\n isRestrictive,\r\n ) &&\r\n permissionTest(\r\n 'some',\r\n 'some' in requiredPermission ? requiredPermission.some : null,\r\n accessValues,\r\n isRestrictive,\r\n ) &&\r\n permissionTest(\r\n 'none',\r\n 'none' in requiredPermission ? requiredPermission.none : null,\r\n accessValues,\r\n isRestrictive,\r\n )\r\n )\r\n }\r\n return false\r\n}\r\n\r\nexport function hasPermissions(\r\n requiredPermission?: NsWidgetResolver.IPermissions,\r\n availableRoles?: Set<string> | string | string[] | null | undefined,\r\n availableGroups?: Set<string> | string | string[] | null | undefined,\r\n restrictedFeatures?: Set<string> | string | string[] | null | undefined,\r\n): boolean {\r\n if (!requiredPermission) {\r\n return true\r\n }\r\n if (!requiredPermission.available || !requiredPermission.enabled) {\r\n return false\r\n }\r\n return (\r\n hasUnitPermission(requiredPermission.groups, availableGroups) &&\r\n hasUnitPermission(requiredPermission.roles, availableRoles) &&\r\n hasUnitPermission(requiredPermission.features, restrictedFeatures, true)\r\n )\r\n}\r\n","import { AfterViewInit, Component, HostBinding, Input } from '@angular/core'\r\nimport { SafeStyle } from '@angular/platform-browser'\r\nimport { NsWidgetResolver } from './widget-resolver.model'\r\ntype TWidgetBase = Omit<NsWidgetResolver.IWidgetData<any>, 'widgetData'>\r\n\r\n@Component({\n selector: 'ws-resolver-base',\n template: 'Base Component',\n standalone: false\n})\r\nexport class WidgetBaseComponent implements TWidgetBase, AfterViewInit {\r\n @Input() widgetType = ''\r\n @Input() widgetSubType = ''\r\n @Input() widgetHostClass?: string\r\n\r\n @Input()\r\n @HostBinding('id')\r\n public widgetInstanceId?: string\r\n\r\n @Input()\r\n @HostBinding('style')\r\n public widgetSafeStyle?: SafeStyle\r\n\r\n @Input()\r\n @HostBinding('class') className?: string\r\n\r\n updateBaseComponent(\r\n widgetType: string,\r\n widgetSubType: string,\r\n widgetInstanceId?: string,\r\n widgetHostClass?: string,\r\n widgetSafeStyle?: SafeStyle,\r\n ) {\r\n this.widgetType = widgetType\r\n this.widgetSubType = widgetSubType\r\n this.widgetInstanceId = widgetInstanceId\r\n this.widgetHostClass = widgetHostClass\r\n this.widgetSafeStyle = widgetSafeStyle\r\n if (this.widgetHostClass) {\r\n this.className = `${this.className} ${this.widgetHostClass}`\r\n }\r\n }\r\n\r\n ngAfterViewInit() {\r\n const hash: any = window.location.hash ? window.location.hash.split('#')[1] : ''\r\n if (hash && !isNaN(hash) && hash === this.widgetInstanceId) {\r\n setTimeout(\r\n () => {\r\n const element = document.getElementById(this.widgetInstanceId || '')\r\n if (element) {\r\n element.scrollIntoView()\r\n }\r\n },\r\n 200,\r\n )\r\n }\r\n }\r\n}\r\n","import { Component, OnInit, Input } from '@angular/core'\r\nimport { NsWidgetResolver } from '../widget-resolver.model'\r\nimport { WidgetBaseComponent } from '../widget-base.component'\r\n@Component({\n selector: 'ws-resolver-restricted',\n templateUrl: './restricted.component.html',\n styleUrls: ['./restricted.component.scss'],\n standalone: false\n})\r\nexport class RestrictedComponent extends WidgetBaseComponent\r\n implements OnInit, NsWidgetResolver.IWidgetData<any> {\r\n @Input() widgetData!: any\r\n showData = true\r\n\r\n ngOnInit() { }\r\n}\r\n","<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Restricted Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>","import { Component, OnInit, Input } from '@angular/core'\r\nimport { NsWidgetResolver } from '../widget-resolver.model'\r\nimport { WidgetBaseComponent } from '../widget-base.component'\r\n@Component({\n selector: 'ws-resolver-invalid-registration',\n templateUrl: './invalid-registration.component.html',\n styleUrls: ['./invalid-registration.component.scss'],\n standalone: false\n})\r\nexport class InvalidRegistrationComponent extends WidgetBaseComponent\r\n implements OnInit, NsWidgetResolver.IWidgetData<any> {\r\n @Input() widgetData!: any\r\n showData = true\r\n ngOnInit() { }\r\n}\r\n","<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Registration for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>","import { Component, OnInit, Input } from '@angular/core'\r\nimport { WidgetBaseComponent } from '../widget-base.component'\r\nimport { NsWidgetResolver } from '../widget-resolver.model'\r\n\r\n@Component({\n selector: 'ws-resolver-invalid-permission',\n templateUrl: './invalid-permission.component.html',\n styleUrls: ['./invalid-permission.component.scss'],\n standalone: false\n})\r\nexport class InvalidPermissionComponent extends WidgetBaseComponent\r\n implements OnInit, NsWidgetResolver.IWidgetData<any> {\r\n @Input() widgetType!: string\r\n @Input() widgetSubType!: string\r\n @Input() widgetInstanceId?: string\r\n @Input() widgetData!: any\r\n showData = true\r\n\r\n ngOnInit() { }\r\n}\r\n","<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Permission for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>","import { Component, OnInit, Input } from '@angular/core'\r\nimport { NsWidgetResolver } from '../widget-resolver.model'\r\nimport { WidgetBaseComponent } from '../widget-base.component'\r\n@Component({\n selector: 'ws-resolver-unresolved',\n templateUrl: './unresolved.component.html',\n styleUrls: ['./unresolved.component.scss'],\n standalone: false\n})\r\nexport class UnresolvedComponent extends WidgetBaseComponent\r\n implements OnInit, NsWidgetResolver.IWidgetData<any> {\r\n @Input() widgetData!: any\r\n showData = true\r\n previewMode = false\r\n searchArray = ['preview', 'channel']\r\n\r\n ngOnInit() {\r\n const url = window.location.href\r\n this.previewMode = this.searchArray.some((word: string) => {\r\n return url.indexOf(word) > -1\r\n })\r\n }\r\n}\r\n","<ng-container *ngIf=\"previewMode\" [ngTemplateOutlet]=\"previewCardTemplate\"></ng-container>\r\n<ng-container *ngIf=\"!previewMode\" [ngTemplateOutlet]=\"unresolvedTemplate\"></ng-container>\r\n\r\n<ng-template #unresolvedTemplate>\r\n <mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error in Resolving Json for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s\"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n </mat-card>\r\n</ng-template>\r\n<ng-template #previewCardTemplate>\r\n <mat-card>\r\n <div class=\"w-full\">\r\n <div class=\"p-4\">\r\n <div class=\"text-3xl font-semibold text-center leading-tight\" i18n>\r\n Content not available\r\n </div>\r\n <br />\r\n <div class=\"text-base font-medium text-center leading-normal\" i18n>\r\n Please add widget or provide data to widget template\r\n </div>\r\n </div>\r\n </div>\r\n </mat-card>\r\n</ng-template>","import {\r\n Injectable,\r\n Inject,\r\n ComponentFactoryResolver,\r\n ViewContainerRef,\r\n ComponentRef,\r\n Type,\r\n} from '@angular/core'\r\nimport {\r\n WIDGET_RESOLVER_GLOBAL_CONFIG,\r\n WIDGET_RESOLVER_SCOPED_CONFIG,\r\n} from './widget-resolver.constant'\r\n// import { LoggerService } from '@sunbird-cb/utils'\r\nimport { NsWidgetResolver } from './widget-resolver.model'\r\nimport { hasPermissions } from './widget-resolver.permissions'\r\nimport { RestrictedComponent } from './restricted/restricted.component'\r\nimport { InvalidRegistrationComponent } from './invalid-registration/invalid-registration.component'\r\nimport { InvalidPermissionComponent } from './invalid-permission/invalid-permission.component'\r\nimport { UnresolvedComponent } from './unresolved/unresolved.component'\r\nimport { DomSanitizer } from '@angular/platform-browser'\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class WidgetResolverService {\r\n private roles: Set<string> | null = null\r\n private groups: Set<string> | null = null\r\n private restrictedFeatures: Set<string> | null = null\r\n isInitialized = false\r\n constructor(\r\n private domSanitizer: DomSanitizer,\r\n private componentFactoryResolver: ComponentFactoryResolver,\r\n // private loggerSvc: LoggerService,\r\n @Inject(WIDGET_RESOLVER_GLOBAL_CONFIG)\r\n private globalConfig: null | NsWidgetResolver.IRegistrationConfig[],\r\n @Inject(WIDGET_RESOLVER_SCOPED_CONFIG)\r\n private scopedConfig: null | NsWidgetResolver.IRegistrationConfig[],\r\n ) { }\r\n private availableRegisteredWidgets: Map<\r\n string,\r\n NsWidgetResolver.IRegistrationConfig\r\n > | null = null\r\n private restrictedWidgetKeys: Set<string> | null = null\r\n static getWidgetKey(config: NsWidgetResolver.IBaseConfig) {\r\n return `widget:${config.widgetType}::${config.widgetSubType}`\r\n }\r\n\r\n initialize(\r\n restrictedWidgetKeys: Set<string> | null,\r\n roles: Set<string> | null,\r\n groups: Set<string> | null,\r\n restrictedFeatures: Set<string> | null,\r\n ) {\r\n this.roles = roles\r\n\r\n this.groups = groups\r\n this.restrictedFeatures = restrictedFeatures\r\n const restrictedWidgetKeysSet: Set<string> = restrictedWidgetKeys\r\n ? restrictedWidgetKeys\r\n : new Set<string>()\r\n const registrationConfig: Map<string, NsWidgetResolver.IRegistrationConfig> = new Map()\r\n const allWidgetsConfigurations: NsWidgetResolver.IRegistrationConfig[] = []\r\n if (this.globalConfig && Array.isArray(this.globalConfig)) {\r\n allWidgetsConfigurations.push(...this.globalConfig)\r\n }\r\n if (this.scopedConfig && Array.isArray(this.scopedConfig)) {\r\n allWidgetsConfigurations.push(...this.scopedConfig)\r\n }\r\n allWidgetsConfigurations.forEach(u => {\r\n const key = WidgetResolverService.getWidgetKey(u)\r\n if (!restrictedWidgetKeysSet.has(key)) {\r\n registrationConfig.set(key, u)\r\n }\r\n })\r\n this.restrictedWidgetKeys = restrictedWidgetKeysSet\r\n this.availableRegisteredWidgets = registrationConfig\r\n this.isInitialized = true\r\n // this.loggerSvc.log(\r\n // `Widget Configurations`,\r\n // this.globalConfig,\r\n // this.scopedConfig,\r\n // this.availableRegisteredWidgets,\r\n // )\r\n }\r\n\r\n resolveWidget(\r\n receivedConfig: NsWidgetResolver.IRenderConfigWithAnyData,\r\n containerRef: ViewContainerRef,\r\n ): ComponentRef<any> | null {\r\n const key = WidgetResolverService.getWidgetKey(receivedConfig)\r\n if (this.restrictedWidgetKeys && this.restrictedWidgetKeys.has(key)) {\r\n // Restricted\r\n return this.widgetResolved(containerRef, receivedConfig, RestrictedComponent)\r\n }\r\n if (this.availableRegisteredWidgets && this.availableRegisteredWidgets.has(key)) {\r\n if (\r\n hasPermissions(\r\n receivedConfig.widgetPermission,\r\n this.roles,\r\n this.groups,\r\n this.restrictedFeatures,\r\n )\r\n ) {\r\n const config = this.availableRegisteredWidgets.get(key)\r\n if (config && config.component) {\r\n return this.widgetResolved(containerRef, receivedConfig, config.component)\r\n }\r\n // Not properly registered\r\n return this.widgetResolved(containerRef, receivedConfig, InvalidRegistrationComponent)\r\n }\r\n // No Permission\r\n return this.widgetResolved(containerRef, receivedConfig, InvalidPermissionComponent)\r\n }\r\n // Not Resolved\r\n return this.widgetResolved(containerRef, receivedConfig, UnresolvedComponent)\r\n }\r\n\r\n private widgetResolved(\r\n containerRef: ViewContainerRef,\r\n compData: NsWidgetResolver.IRenderConfigWithAnyData,\r\n component: Type<NsWidgetResolver.IWidgetData<any>>,\r\n ): ComponentRef<NsWidgetResolver.IWidgetData<any>> {\r\n const factory = this.componentFactoryResolver.resolveComponentFactory(component)\r\n containerRef.clear()\r\n const compRef: ComponentRef<NsWidgetResolver.IWidgetData<any>> = containerRef.createComponent(\r\n factory,\r\n )\r\n compRef.instance.widgetData = compData.widgetData\r\n if (compRef.instance.updateBaseComponent) {\r\n const widgetSafeStyle = compData.widgetHostStyle\r\n ? this.domSanitizer.bypassSecurityTrustStyle(\r\n Object.entries(compData.widgetHostStyle).reduce((s, [k, v]) => `${s}${k}:${v};`, ''),\r\n )\r\n : undefined\r\n compRef.instance.updateBaseComponent(\r\n compData.widgetType,\r\n compData.widgetSubType,\r\n compData.widgetInstanceId,\r\n compData.widgetHostClass,\r\n widgetSafeStyle,\r\n )\r\n }\r\n return compRef\r\n }\r\n}\r\n","import { Directive, Input, ViewContainerRef, OnChanges } from '@angular/core'\r\nimport { LoggerService } from '@sunbird-cb/utils'\r\nimport { NsWidgetResolver } from './widget-resolver.model'\r\nimport { WidgetResolverService } from './widget-resolver.service'\r\n\r\n@Directive({\n selector: '[wsResolverWidget]',\n standalone: false\n})\r\nexport class WidgetResolverDirective implements OnChanges {\r\n @Input() wsResolverWidget: NsWidgetResolver.IRenderConfigWithAnyData | null = null\r\n constructor(\r\n private viewContainerRef: ViewContainerRef,\r\n private widgetResolverSvc: WidgetResolverService,\r\n private logger: LoggerService,\r\n ) { }\r\n\r\n ngOnChanges() {\r\n if (!this.widgetResolverSvc.isInitialized) {\r\n this.logger.error(\r\n 'Widgets Registration Not Done. Used Before Initialization.',\r\n this.wsResolverWidget,\r\n )\r\n return\r\n }\r\n if (this.wsResolverWidget) {\r\n const compRef = this.widgetResolverSvc.resolveWidget(\r\n this.wsResolverWidget,\r\n this.viewContainerRef,\r\n )\r\n if (compRef) {\r\n compRef.changeDetectorRef.detectChanges()\r\n }\r\n }\r\n }\r\n}\r\n","import { NgModule, ModuleWithProviders } from '@angular/core'\r\nimport { CommonModule } from '@angular/common'\r\nimport { WidgetResolverDirective } from './widget-resolver.directive'\r\nimport { RestrictedComponent } from './restricted/restricted.component'\r\nimport { InvalidRegistrationComponent } from './invalid-registration/invalid-registration.component'\r\nimport { InvalidPermissionComponent } from './invalid-permission/invalid-permission.component'\r\nimport { UnresolvedComponent } from './unresolved/unresolved.component'\r\nimport { MatButtonModule } from '@angular/material/button'\r\nimport { MatCardModule } from '@angular/material/card'\r\nimport { MatIconModule } from '@angular/material/icon'\r\nimport { NsWidgetResolver } from './widget-resolver.model'\r\nimport { WidgetResolverService } from './widget-resolver.service'\r\nimport { ConfigurationsService } from '@sunbird-cb/utils'\r\nimport {\r\n WIDGET_RESOLVER_GLOBAL_CONFIG,\r\n WIDGET_RESOLVER_SCOPED_CONFIG,\r\n} from './widget-resolver.constant'\r\nimport { WidgetBaseComponent } from './widget-base.component'\r\n@NgModule({\r\n declarations: [\r\n WidgetBaseComponent,\r\n WidgetResolverDirective,\r\n RestrictedComponent,\r\n InvalidRegistrationComponent,\r\n InvalidPermissionComponent,\r\n UnresolvedComponent,\r\n ],\r\n imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule],\r\n exports: [WidgetResolverDirective, WidgetBaseComponent],\r\n providers: [ConfigurationsService]\r\n})\r\nexport class WidgetResolverModule {\r\n static forRoot(config: NsWidgetResolver.IRegistrationConfig[]): ModuleWithProviders<WidgetResolverModule> {\r\n return {\r\n ngModule: WidgetResolverModule,\r\n providers: [\r\n WidgetResolverService,\r\n {\r\n provide: WIDGET_RESOLVER_GLOBAL_CONFIG,\r\n useValue: config,\r\n },\r\n {\r\n provide: WIDGET_RESOLVER_SCOPED_CONFIG,\r\n useValue: [],\r\n },\r\n ],\r\n }\r\n }\r\n static forChild(config: NsWidgetResolver.IRegistrationConfig[]): ModuleWithProviders<WidgetResolverModule> {\r\n return {\r\n ngModule: WidgetResolverModule,\r\n providers: [\r\n WidgetResolverService,\r\n {\r\n provide: WIDGET_RESOLVER_SCOPED_CONFIG,\r\n useValue: config,\r\n },\r\n ],\r\n }\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i1.WidgetResolverService","i2"],"mappings":";;;;;;;;;;;;;;AAGO,MAAM,6BAA6B,GAAG,IAAI,cAAc,CAC7D,wDAAwD,CACzD;AAEM,MAAM,6BAA6B,GAAG,IAAI,cAAc,CAC7D,wDAAwD,CACzD;;ACPD,SAAS,aAAa,CAAC,MAAsB,EAAA;IAC3C,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC;AAC1E;AAEA,SAAS,eAAe,CAAC,kBAAmD,EAAA;IAC1E,IACE,kBAAkB,KAAK,SAAS;AAChC,QAAA,kBAAkB,KAAK,IAAI;AAC3B,QAAA,kBAAkB,KAAK,EAAE;AACzB,SAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,CAAC,EACtE;AACA,QAAA,OAAO,KAAK;IACd;AACA,IAAA,OAAO,IAAI;AACb;AAEA,SAAS,WAAW,CAAC,KAAc,EAAE,IAAI,GAAG,KAAK,EAAA;IAC/C,OAAO,IAAI,GAAG,CAAC,KAAK,GAAG,KAAK;AAC9B;AAEA,SAAS,cAAc,CACrB,OAAgC,EAChC,kBAAuE,EACvE,YAAyB,EACzB,aAAa,GAAG,KAAK,EAAA;AAErB,IAAA,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE;AACxC,QAAA,OAAO,IAAI;IACb;AACA,IAAA,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE;QAC1C,QAAQ,OAAO;AACb,YAAA,KAAK,KAAK;AACV,YAAA,KAAK,MAAM;gBACT,OAAO,WAAW,CAAC,Y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;4FAI1D,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAbhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,mBAAmB;wBACnB,uBAAuB;wBACvB,mBAAmB;wBACnB,4BAA4B;wBAC5B,0BAA0B;wBAC1B,mBAAmB;AACpB,qBAAA;oBACD,OAAO,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,CAAC;AACtE,oBAAA,OAAO,EAAE,CAAC,uBAAuB,EAAE,mBAAmB,CAAC;oBACvD,SAAS,EAAE,CAAC,qBAAqB;AAClC,iBAAA;;;AC9BD;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Type, AfterViewInit, ComponentFactoryResolver, ViewContainerRef, ComponentRef, OnChanges, OnInit, ModuleWithProviders } from '@angular/core';
|
|
3
|
+
import { SafeStyle, DomSanitizer } from '@angular/platform-browser';
|
|
4
|
+
import { LoggerService } from '@sunbird-cb/utils';
|
|
5
|
+
import * as i7 from '@angular/common';
|
|
6
|
+
import * as i8 from '@angular/material/button';
|
|
7
|
+
import * as i9 from '@angular/material/icon';
|
|
8
|
+
import * as i10 from '@angular/material/card';
|
|
9
|
+
|
|
10
|
+
type TUrl = undefined | 'none' | 'back' | string;
|
|
11
|
+
declare namespace NsWidgetResolver {
|
|
12
|
+
type UnitPermissionPrimitive = undefined | null | string;
|
|
13
|
+
interface IUnitPermissionObject {
|
|
14
|
+
all: UnitPermissionPrimitive | string[];
|
|
15
|
+
none: UnitPermissionPrimitive | string[];
|
|
16
|
+
some: UnitPermissionPrimitive | string[];
|
|
17
|
+
}
|
|
18
|
+
type UnitPermission = UnitPermissionPrimitive | string[] | IUnitPermissionObject | Pick<IUnitPermissionObject, 'all'> | Pick<IUnitPermissionObject, 'none'> | Pick<IUnitPermissionObject, 'some'> | Exclude<IUnitPermissionObject, 'all'> | Exclude<IUnitPermissionObject, 'none'> | Exclude<IUnitPermissionObject, 'some'>;
|
|
19
|
+
interface IPermissions {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
available: boolean;
|
|
22
|
+
roles?: UnitPermission;
|
|
23
|
+
features?: UnitPermission;
|
|
24
|
+
groups?: UnitPermission;
|
|
25
|
+
}
|
|
26
|
+
interface IBaseConfig {
|
|
27
|
+
widgetType: string;
|
|
28
|
+
widgetSubType: string;
|
|
29
|
+
}
|
|
30
|
+
interface IRegistrationConfig extends IBaseConfig {
|
|
31
|
+
component: Type<IWidgetData<any>>;
|
|
32
|
+
}
|
|
33
|
+
interface IRegistrationsPermissionConfig extends IBaseConfig {
|
|
34
|
+
widgetPermission?: IPermissions;
|
|
35
|
+
}
|
|
36
|
+
interface IRenderConfigWithTypedData<T> extends IRegistrationsPermissionConfig {
|
|
37
|
+
widgetData: T;
|
|
38
|
+
widgetInstanceId?: string;
|
|
39
|
+
widgetHostClass?: string;
|
|
40
|
+
widgetHostStyle?: {
|
|
41
|
+
[key: string]: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
type IRenderConfigWithAnyData = IRenderConfigWithTypedData<any>;
|
|
45
|
+
interface IWidgetData<T> extends Omit<IRenderConfigWithTypedData<T>, 'widgetPermission' | 'widgetHostStyle'> {
|
|
46
|
+
widgetSafeStyle?: SafeStyle;
|
|
47
|
+
updateBaseComponent: (widgetType: string, widgetSubType: string, widgetInstanceId?: string, widgetHostClass?: string, widgetSafeStyle?: SafeStyle) => void;
|
|
48
|
+
}
|
|
49
|
+
interface ITitle {
|
|
50
|
+
title: string;
|
|
51
|
+
url: TUrl;
|
|
52
|
+
icon?: string;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type TWidgetBase = Omit<NsWidgetResolver.IWidgetData<any>, 'widgetData'>;
|
|
57
|
+
declare class WidgetBaseComponent implements TWidgetBase, AfterViewInit {
|
|
58
|
+
widgetType: string;
|
|
59
|
+
widgetSubType: string;
|
|
60
|
+
widgetHostClass?: string;
|
|
61
|
+
widgetInstanceId?: string;
|
|
62
|
+
widgetSafeStyle?: SafeStyle;
|
|
63
|
+
className?: string;
|
|
64
|
+
updateBaseComponent(widgetType: string, widgetSubType: string, widgetInstanceId?: string, widgetHostClass?: string, widgetSafeStyle?: SafeStyle): void;
|
|
65
|
+
ngAfterViewInit(): void;
|
|
66
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WidgetBaseComponent, never>;
|
|
67
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WidgetBaseComponent, "ws-resolver-base", never, { "widgetType": { "alias": "widgetType"; "required": false; }; "widgetSubType": { "alias": "widgetSubType"; "required": false; }; "widgetHostClass": { "alias": "widgetHostClass"; "required": false; }; "widgetInstanceId": { "alias": "widgetInstanceId"; "required": false; }; "widgetSafeStyle": { "alias": "widgetSafeStyle"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, false, never>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare class WidgetResolverService {
|
|
71
|
+
private domSanitizer;
|
|
72
|
+
private componentFactoryResolver;
|
|
73
|
+
private globalConfig;
|
|
74
|
+
private scopedConfig;
|
|
75
|
+
private roles;
|
|
76
|
+
private groups;
|
|
77
|
+
private restrictedFeatures;
|
|
78
|
+
isInitialized: boolean;
|
|
79
|
+
constructor(domSanitizer: DomSanitizer, componentFactoryResolver: ComponentFactoryResolver, globalConfig: null | NsWidgetResolver.IRegistrationConfig[], scopedConfig: null | NsWidgetResolver.IRegistrationConfig[]);
|
|
80
|
+
private availableRegisteredWidgets;
|
|
81
|
+
private restrictedWidgetKeys;
|
|
82
|
+
static getWidgetKey(config: NsWidgetResolver.IBaseConfig): string;
|
|
83
|
+
initialize(restrictedWidgetKeys: Set<string> | null, roles: Set<string> | null, groups: Set<string> | null, restrictedFeatures: Set<string> | null): void;
|
|
84
|
+
resolveWidget(receivedConfig: NsWidgetResolver.IRenderConfigWithAnyData, containerRef: ViewContainerRef): ComponentRef<any> | null;
|
|
85
|
+
private widgetResolved;
|
|
86
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WidgetResolverService, never>;
|
|
87
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WidgetResolverService>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
declare class WidgetResolverDirective implements OnChanges {
|
|
91
|
+
private viewContainerRef;
|
|
92
|
+
private widgetResolverSvc;
|
|
93
|
+
private logger;
|
|
94
|
+
wsResolverWidget: NsWidgetResolver.IRenderConfigWithAnyData | null;
|
|
95
|
+
constructor(viewContainerRef: ViewContainerRef, widgetResolverSvc: WidgetResolverService, logger: LoggerService);
|
|
96
|
+
ngOnChanges(): void;
|
|
97
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WidgetResolverDirective, never>;
|
|
98
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<WidgetResolverDirective, "[wsResolverWidget]", never, { "wsResolverWidget": { "alias": "wsResolverWidget"; "required": false; }; }, {}, never, never, false, never>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class RestrictedComponent extends WidgetBaseComponent implements OnInit, NsWidgetResolver.IWidgetData<any> {
|
|
102
|
+
widgetData: any;
|
|
103
|
+
showData: boolean;
|
|
104
|
+
ngOnInit(): void;
|
|
105
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RestrictedComponent, never>;
|
|
106
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RestrictedComponent, "ws-resolver-restricted", never, { "widgetData": { "alias": "widgetData"; "required": false; }; }, {}, never, never, false, never>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare class InvalidRegistrationComponent extends WidgetBaseComponent implements OnInit, NsWidgetResolver.IWidgetData<any> {
|
|
110
|
+
widgetData: any;
|
|
111
|
+
showData: boolean;
|
|
112
|
+
ngOnInit(): void;
|
|
113
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InvalidRegistrationComponent, never>;
|
|
114
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InvalidRegistrationComponent, "ws-resolver-invalid-registration", never, { "widgetData": { "alias": "widgetData"; "required": false; }; }, {}, never, never, false, never>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
declare class InvalidPermissionComponent extends WidgetBaseComponent implements OnInit, NsWidgetResolver.IWidgetData<any> {
|
|
118
|
+
widgetType: string;
|
|
119
|
+
widgetSubType: string;
|
|
120
|
+
widgetInstanceId?: string;
|
|
121
|
+
widgetData: any;
|
|
122
|
+
showData: boolean;
|
|
123
|
+
ngOnInit(): void;
|
|
124
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InvalidPermissionComponent, never>;
|
|
125
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InvalidPermissionComponent, "ws-resolver-invalid-permission", never, { "widgetType": { "alias": "widgetType"; "required": false; }; "widgetSubType": { "alias": "widgetSubType"; "required": false; }; "widgetInstanceId": { "alias": "widgetInstanceId"; "required": false; }; "widgetData": { "alias": "widgetData"; "required": false; }; }, {}, never, never, false, never>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
declare class UnresolvedComponent extends WidgetBaseComponent implements OnInit, NsWidgetResolver.IWidgetData<any> {
|
|
129
|
+
widgetData: any;
|
|
130
|
+
showData: boolean;
|
|
131
|
+
previewMode: boolean;
|
|
132
|
+
searchArray: string[];
|
|
133
|
+
ngOnInit(): void;
|
|
134
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UnresolvedComponent, never>;
|
|
135
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UnresolvedComponent, "ws-resolver-unresolved", never, { "widgetData": { "alias": "widgetData"; "required": false; }; }, {}, never, never, false, never>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
declare class WidgetResolverModule {
|
|
139
|
+
static forRoot(config: NsWidgetResolver.IRegistrationConfig[]): ModuleWithProviders<WidgetResolverModule>;
|
|
140
|
+
static forChild(config: NsWidgetResolver.IRegistrationConfig[]): ModuleWithProviders<WidgetResolverModule>;
|
|
141
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WidgetResolverModule, never>;
|
|
142
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<WidgetResolverModule, [typeof WidgetBaseComponent, typeof WidgetResolverDirective, typeof RestrictedComponent, typeof InvalidRegistrationComponent, typeof InvalidPermissionComponent, typeof UnresolvedComponent], [typeof i7.CommonModule, typeof i8.MatButtonModule, typeof i9.MatIconModule, typeof i10.MatCardModule], [typeof WidgetResolverDirective, typeof WidgetBaseComponent]>;
|
|
143
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<WidgetResolverModule>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare function hasUnitPermission(requiredPermission: NsWidgetResolver.UnitPermission, matchAgainst?: Set<string> | string[] | string | null | undefined, isRestrictive?: boolean): boolean;
|
|
147
|
+
declare function hasPermissions(requiredPermission?: NsWidgetResolver.IPermissions, availableRoles?: Set<string> | string | string[] | null | undefined, availableGroups?: Set<string> | string | string[] | null | undefined, restrictedFeatures?: Set<string> | string | string[] | null | undefined): boolean;
|
|
148
|
+
|
|
149
|
+
export { NsWidgetResolver, WidgetBaseComponent, WidgetResolverDirective, WidgetResolverModule, WidgetResolverService, hasPermissions, hasUnitPermission };
|
|
150
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../../library/sunbird-cb/resolver/src/lib/widget-resolver.model.ts","../../../library/sunbird-cb/resolver/src/lib/widget-base.component.ts","../../../library/sunbird-cb/resolver/src/lib/widget-resolver.service.ts","../../../library/sunbird-cb/resolver/src/lib/widget-resolver.directive.ts","../../../library/sunbird-cb/resolver/src/lib/restricted/restricted.component.ts","../../../library/sunbird-cb/resolver/src/lib/invalid-registration/invalid-registration.component.ts","../../../library/sunbird-cb/resolver/src/lib/invalid-permission/invalid-permission.component.ts","../../../library/sunbird-cb/resolver/src/lib/unresolved/unresolved.component.ts","../../../library/sunbird-cb/resolver/src/lib/widget-resolver.module.ts","../../../library/sunbird-cb/resolver/src/lib/widget-resolver.permissions.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;AAEA,KAAA,IAAA;AACA,kBAAA,gBAAA;AACE;AACA;AACE;AACA;AACA;AACD;;AAWD;;;;;;AAMC;AAED;;;AAGC;;;AAIA;;;AAIA;AAED;;;;AAIE;AAAoB;;AACrB;AACD;AACA,qCAAA,IAAA;;;AAUC;AACD;;;;AAIC;AACF;;AC7DD,KAAA,WAAA,GAAA,IAAA,CAAA,gBAAA,CAAA,WAAA;AAEA,cAAA,mBAAA,YAAA,WAAA,EAAA,aAAA;AAMW;AACA;;;;;;;;;AA6CV;;ACpCD,cAAA,qBAAA;AASI;AACA;AAGA;AAEA;;;;AARF;;;;AAeA,gCAAA,gBAAA,CAAA,WAAA;AAIA,qCAAA,GAAA,wBAAA,GAAA,yBAAA,GAAA,qCAAA,GAAA;AAsCA,kCAAA,gBAAA,CAAA,wBAAA,gBAAA,gBAAA,GAAA,YAAA;AAgCA;;;AA2BD;;AC3ID,cAAA,uBAAA,YAAA,SAAA;AAOI;AACA;AACA;AAJO,sBAAA,gBAAA,CAAA,wBAAA;;;;;AAyBV;;AChCD,cAAA,mBAAA,SAAA,mBAAA,YAAA,MAAA,EAAA,gBAAA,CAAA,WAAA;;AASE;;;;AAGD;;ACZD,cAAA,4BAAA,SAAA,mBAAA,YAAA,MAAA,EAAA,gBAAA,CAAA,WAAA;;AASE;;;;AAED;;ACVD,cAAA,0BAAA,SAAA,mBAAA,YAAA,MAAA,EAAA,gBAAA,CAAA,WAAA;;;;;AAYE;;;;AAGD;;AChBD,cAAA,mBAAA,SAAA,mBAAA,YAAA,MAAA,EAAA,gBAAA,CAAA,WAAA;;AASE;AACA;AACA;;;;AAQD;;ACJD,cAAA,oBAAA;AAcE,2BAAA,gBAAA,CAAA,mBAAA,KAAA,mBAAA,CAAA,oBAAA;AAgBA,4BAAA,gBAAA,CAAA,mBAAA,KAAA,mBAAA,CAAA,oBAAA;;;;AAYD;;ACLD,iBAAA,iBAAA,qBAAA,gBAAA,CAAA,cAAA,iBAAA,GAAA;AA6CA,iBAAA,cAAA,sBAAA,gBAAA,CAAA,YAAA,mBAAA,GAAA,mEAAA,GAAA,sEAAA,GAAA;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sunbird-cb/resolver",
|
|
3
|
+
"version": "0.0.1-ang-17-20",
|
|
4
|
+
"main": "src/public-api.ts",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"tslib": "^2.0.0"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@angular/animations": "^20.3.16",
|
|
10
|
+
"@angular/cdk": "^20.2.14",
|
|
11
|
+
"@angular/common": "^20.3.16",
|
|
12
|
+
"@angular/compiler": "^20.3.16",
|
|
13
|
+
"@angular/core": "^20.3.16",
|
|
14
|
+
"@angular/forms": "^20.3.16",
|
|
15
|
+
"@angular/material": "^20.2.14",
|
|
16
|
+
"@angular/platform-browser": "^20.3.16",
|
|
17
|
+
"@angular/platform-browser-dynamic": "^20.3.16",
|
|
18
|
+
"@angular/router": "^20.3.16"
|
|
19
|
+
},
|
|
20
|
+
"module": "fesm2022/sunbird-cb-resolver.mjs",
|
|
21
|
+
"typings": "index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
"./package.json": {
|
|
24
|
+
"default": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./index.d.ts",
|
|
28
|
+
"default": "./fesm2022/sunbird-cb-resolver.mjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"sideEffects": false
|
|
32
|
+
}
|
|
Binary file
|