@sunbird-cb/resolver 0.0.2 → 1.0.0-ang-9-12
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 -24
- package/bundles/sunbird-cb-resolver.umd.js +945 -732
- package/bundles/sunbird-cb-resolver.umd.js.map +1 -1
- package/esm2015/lib/invalid-permission/invalid-permission.component.js +24 -21
- package/esm2015/lib/invalid-registration/invalid-registration.component.js +18 -15
- package/esm2015/lib/restricted/restricted.component.js +18 -15
- package/esm2015/lib/unresolved/unresolved.component.js +20 -19
- package/esm2015/lib/widget-base.component.js +34 -25
- package/esm2015/lib/widget-resolver.constant.js +1 -1
- package/esm2015/lib/widget-resolver.directive.js +15 -23
- package/esm2015/lib/widget-resolver.model.js +2 -57
- package/esm2015/lib/widget-resolver.module.js +36 -24
- package/esm2015/lib/widget-resolver.permissions.js +3 -3
- package/esm2015/lib/widget-resolver.service.js +20 -38
- package/esm2015/public-api.js +7 -6
- package/esm2015/sunbird-cb-resolver.js +2 -8
- package/fesm2015/sunbird-cb-resolver.js +162 -227
- package/fesm2015/sunbird-cb-resolver.js.map +1 -1
- package/lib/invalid-permission/invalid-permission.component.d.ts +3 -0
- package/lib/invalid-registration/invalid-registration.component.d.ts +3 -0
- package/lib/restricted/restricted.component.d.ts +3 -0
- package/lib/unresolved/unresolved.component.d.ts +3 -0
- package/lib/widget-base.component.d.ts +3 -0
- package/lib/widget-resolver.directive.d.ts +3 -0
- package/lib/widget-resolver.module.d.ts +16 -2
- package/lib/widget-resolver.service.d.ts +4 -3
- package/package.json +17 -20
- package/public-api.d.ts +1 -0
- package/sunbird-cb-resolver.d.ts +1 -7
- package/bundles/sunbird-cb-resolver.umd.min.js +0 -16
- package/bundles/sunbird-cb-resolver.umd.min.js.map +0 -1
- package/esm5/lib/invalid-permission/invalid-permission.component.js +0 -35
- package/esm5/lib/invalid-registration/invalid-registration.component.js +0 -29
- package/esm5/lib/restricted/restricted.component.js +0 -29
- package/esm5/lib/unresolved/unresolved.component.js +0 -38
- package/esm5/lib/widget-base.component.js +0 -54
- package/esm5/lib/widget-resolver.constant.js +0 -4
- package/esm5/lib/widget-resolver.directive.js +0 -45
- package/esm5/lib/widget-resolver.model.js +0 -57
- package/esm5/lib/widget-resolver.module.js +0 -69
- package/esm5/lib/widget-resolver.permissions.js +0 -79
- package/esm5/lib/widget-resolver.service.js +0 -120
- package/esm5/public-api.js +0 -6
- package/esm5/sunbird-cb-resolver.js +0 -8
- package/fesm5/sunbird-cb-resolver.js +0 -517
- package/fesm5/sunbird-cb-resolver.js.map +0 -1
- package/sunbird-cb-resolver.metadata.json +0 -1
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Component, Input, HostBinding, Injectable, Inject, Directive, NgModule } from '@angular/core';
|
|
3
|
+
import * as i4 from '@angular/common';
|
|
2
4
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
5
|
+
import * as i1 from '@angular/material/card';
|
|
6
|
+
import { MatCardModule } from '@angular/material/card';
|
|
7
|
+
import * as i2 from '@angular/material/icon';
|
|
8
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
9
|
+
import * as i3 from '@angular/material/button';
|
|
10
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
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';
|
|
6
14
|
|
|
7
15
|
const WIDGET_RESOLVER_GLOBAL_CONFIG = new InjectionToken('Global Registration Configuration for Widget Resolvers');
|
|
8
16
|
const WIDGET_RESOLVER_SCOPED_CONFIG = new InjectionToken('Scoped Registration Configuration for Widget Resolvers');
|
|
9
17
|
|
|
10
18
|
function isStringArray(strArr) {
|
|
11
|
-
return Array.isArray(strArr) && strArr.every(
|
|
19
|
+
return Array.isArray(strArr) && strArr.every(u => typeof u === 'string');
|
|
12
20
|
}
|
|
13
21
|
function isCheckRequired(requiredPermission) {
|
|
14
22
|
if (requiredPermission === undefined ||
|
|
@@ -36,7 +44,7 @@ function permissionTest(testFor, requiredPermission, matchAgainst, isRestrictive
|
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
if (Array.isArray(requiredPermission)) {
|
|
39
|
-
const matcher = (
|
|
47
|
+
const matcher = (u) => typeof u === 'string' && flipBoolean(matchAgainst.has(u), isRestrictive);
|
|
40
48
|
switch (testFor) {
|
|
41
49
|
case 'all':
|
|
42
50
|
return requiredPermission.every(matcher);
|
|
@@ -99,37 +107,45 @@ class WidgetBaseComponent {
|
|
|
99
107
|
ngAfterViewInit() {
|
|
100
108
|
const hash = window.location.hash ? window.location.hash.split('#')[1] : '';
|
|
101
109
|
if (hash && !isNaN(hash) && hash === this.widgetInstanceId) {
|
|
102
|
-
setTimeout((
|
|
110
|
+
setTimeout(() => {
|
|
103
111
|
const element = document.getElementById(this.widgetInstanceId || '');
|
|
104
112
|
if (element) {
|
|
105
113
|
element.scrollIntoView();
|
|
106
114
|
}
|
|
107
|
-
}
|
|
115
|
+
}, 200);
|
|
108
116
|
}
|
|
109
117
|
}
|
|
110
118
|
}
|
|
111
|
-
WidgetBaseComponent
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
119
|
+
WidgetBaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
120
|
+
WidgetBaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: WidgetBaseComponent, 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 });
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetBaseComponent, decorators: [{
|
|
122
|
+
type: Component,
|
|
123
|
+
args: [{
|
|
124
|
+
selector: 'ws-resolver-base',
|
|
125
|
+
template: 'Base Component',
|
|
126
|
+
}]
|
|
127
|
+
}], propDecorators: { widgetType: [{
|
|
128
|
+
type: Input
|
|
129
|
+
}], widgetSubType: [{
|
|
130
|
+
type: Input
|
|
131
|
+
}], widgetHostClass: [{
|
|
132
|
+
type: Input
|
|
133
|
+
}], widgetInstanceId: [{
|
|
134
|
+
type: Input
|
|
135
|
+
}, {
|
|
136
|
+
type: HostBinding,
|
|
137
|
+
args: ['id']
|
|
138
|
+
}], widgetSafeStyle: [{
|
|
139
|
+
type: Input
|
|
140
|
+
}, {
|
|
141
|
+
type: HostBinding,
|
|
142
|
+
args: ['style']
|
|
143
|
+
}], className: [{
|
|
144
|
+
type: Input
|
|
145
|
+
}, {
|
|
146
|
+
type: HostBinding,
|
|
147
|
+
args: ['class']
|
|
148
|
+
}] } });
|
|
133
149
|
|
|
134
150
|
class RestrictedComponent extends WidgetBaseComponent {
|
|
135
151
|
constructor() {
|
|
@@ -138,20 +154,18 @@ class RestrictedComponent extends WidgetBaseComponent {
|
|
|
138
154
|
}
|
|
139
155
|
ngOnInit() { }
|
|
140
156
|
}
|
|
141
|
-
RestrictedComponent
|
|
142
|
-
{ type:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
RestrictedComponent.prototype.showData;
|
|
154
|
-
}
|
|
157
|
+
RestrictedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RestrictedComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
158
|
+
RestrictedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RestrictedComponent, 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"], components: [{ type: i1.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i1.MatCardHeader, selector: "mat-card-header" }, { type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { type: i1.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "json": i4.JsonPipe } });
|
|
159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RestrictedComponent, decorators: [{
|
|
160
|
+
type: Component,
|
|
161
|
+
args: [{
|
|
162
|
+
selector: 'ws-resolver-restricted',
|
|
163
|
+
templateUrl: './restricted.component.html',
|
|
164
|
+
styleUrls: ['./restricted.component.scss'],
|
|
165
|
+
}]
|
|
166
|
+
}], propDecorators: { widgetData: [{
|
|
167
|
+
type: Input
|
|
168
|
+
}] } });
|
|
155
169
|
|
|
156
170
|
class InvalidRegistrationComponent extends WidgetBaseComponent {
|
|
157
171
|
constructor() {
|
|
@@ -160,20 +174,18 @@ class InvalidRegistrationComponent extends WidgetBaseComponent {
|
|
|
160
174
|
}
|
|
161
175
|
ngOnInit() { }
|
|
162
176
|
}
|
|
163
|
-
InvalidRegistrationComponent
|
|
164
|
-
{ type:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
InvalidRegistrationComponent.prototype.showData;
|
|
176
|
-
}
|
|
177
|
+
InvalidRegistrationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InvalidRegistrationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
178
|
+
InvalidRegistrationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: InvalidRegistrationComponent, 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"], components: [{ type: i1.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i1.MatCardHeader, selector: "mat-card-header" }, { type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { type: i1.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "json": i4.JsonPipe } });
|
|
179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InvalidRegistrationComponent, decorators: [{
|
|
180
|
+
type: Component,
|
|
181
|
+
args: [{
|
|
182
|
+
selector: 'ws-resolver-invalid-registration',
|
|
183
|
+
templateUrl: './invalid-registration.component.html',
|
|
184
|
+
styleUrls: ['./invalid-registration.component.scss'],
|
|
185
|
+
}]
|
|
186
|
+
}], propDecorators: { widgetData: [{
|
|
187
|
+
type: Input
|
|
188
|
+
}] } });
|
|
177
189
|
|
|
178
190
|
class InvalidPermissionComponent extends WidgetBaseComponent {
|
|
179
191
|
constructor() {
|
|
@@ -182,26 +194,24 @@ class InvalidPermissionComponent extends WidgetBaseComponent {
|
|
|
182
194
|
}
|
|
183
195
|
ngOnInit() { }
|
|
184
196
|
}
|
|
185
|
-
InvalidPermissionComponent
|
|
186
|
-
{ type:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
InvalidPermissionComponent.prototype.showData;
|
|
204
|
-
}
|
|
197
|
+
InvalidPermissionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InvalidPermissionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
198
|
+
InvalidPermissionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: InvalidPermissionComponent, 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"], components: [{ type: i1.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i1.MatCardHeader, selector: "mat-card-header" }, { type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { type: i1.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "json": i4.JsonPipe } });
|
|
199
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InvalidPermissionComponent, decorators: [{
|
|
200
|
+
type: Component,
|
|
201
|
+
args: [{
|
|
202
|
+
selector: 'ws-resolver-invalid-permission',
|
|
203
|
+
templateUrl: './invalid-permission.component.html',
|
|
204
|
+
styleUrls: ['./invalid-permission.component.scss'],
|
|
205
|
+
}]
|
|
206
|
+
}], propDecorators: { widgetType: [{
|
|
207
|
+
type: Input
|
|
208
|
+
}], widgetSubType: [{
|
|
209
|
+
type: Input
|
|
210
|
+
}], widgetInstanceId: [{
|
|
211
|
+
type: Input
|
|
212
|
+
}], widgetData: [{
|
|
213
|
+
type: Input
|
|
214
|
+
}] } });
|
|
205
215
|
|
|
206
216
|
class UnresolvedComponent extends WidgetBaseComponent {
|
|
207
217
|
constructor() {
|
|
@@ -212,33 +222,28 @@ class UnresolvedComponent extends WidgetBaseComponent {
|
|
|
212
222
|
}
|
|
213
223
|
ngOnInit() {
|
|
214
224
|
const url = window.location.href;
|
|
215
|
-
this.previewMode = this.searchArray.some((
|
|
225
|
+
this.previewMode = this.searchArray.some((word) => {
|
|
216
226
|
return url.indexOf(word) > -1;
|
|
217
|
-
})
|
|
227
|
+
});
|
|
218
228
|
}
|
|
219
229
|
}
|
|
220
|
-
UnresolvedComponent
|
|
221
|
-
{ type:
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
UnresolvedComponent.prototype.showData;
|
|
233
|
-
UnresolvedComponent.prototype.previewMode;
|
|
234
|
-
UnresolvedComponent.prototype.searchArray;
|
|
235
|
-
}
|
|
230
|
+
UnresolvedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UnresolvedComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
231
|
+
UnresolvedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: UnresolvedComponent, 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"], components: [{ type: i1.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i1.MatCardHeader, selector: "mat-card-header" }, { type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { type: i1.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }], pipes: { "json": i4.JsonPipe } });
|
|
232
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UnresolvedComponent, decorators: [{
|
|
233
|
+
type: Component,
|
|
234
|
+
args: [{
|
|
235
|
+
selector: 'ws-resolver-unresolved',
|
|
236
|
+
templateUrl: './unresolved.component.html',
|
|
237
|
+
styleUrls: ['./unresolved.component.scss'],
|
|
238
|
+
}]
|
|
239
|
+
}], propDecorators: { widgetData: [{
|
|
240
|
+
type: Input
|
|
241
|
+
}] } });
|
|
236
242
|
|
|
237
243
|
class WidgetResolverService {
|
|
238
|
-
constructor(domSanitizer, componentFactoryResolver,
|
|
244
|
+
constructor(domSanitizer, componentFactoryResolver, globalConfig, scopedConfig) {
|
|
239
245
|
this.domSanitizer = domSanitizer;
|
|
240
246
|
this.componentFactoryResolver = componentFactoryResolver;
|
|
241
|
-
this.loggerSvc = loggerSvc;
|
|
242
247
|
this.globalConfig = globalConfig;
|
|
243
248
|
this.scopedConfig = scopedConfig;
|
|
244
249
|
this.roles = null;
|
|
@@ -266,16 +271,15 @@ class WidgetResolverService {
|
|
|
266
271
|
if (this.scopedConfig && Array.isArray(this.scopedConfig)) {
|
|
267
272
|
allWidgetsConfigurations.push(...this.scopedConfig);
|
|
268
273
|
}
|
|
269
|
-
allWidgetsConfigurations.forEach(
|
|
274
|
+
allWidgetsConfigurations.forEach(u => {
|
|
270
275
|
const key = WidgetResolverService.getWidgetKey(u);
|
|
271
276
|
if (!restrictedWidgetKeysSet.has(key)) {
|
|
272
277
|
registrationConfig.set(key, u);
|
|
273
278
|
}
|
|
274
|
-
})
|
|
279
|
+
});
|
|
275
280
|
this.restrictedWidgetKeys = restrictedWidgetKeysSet;
|
|
276
281
|
this.availableRegisteredWidgets = registrationConfig;
|
|
277
282
|
this.isInitialized = true;
|
|
278
|
-
this.loggerSvc.log(`Widget Configurations`, this.globalConfig, this.scopedConfig, this.availableRegisteredWidgets);
|
|
279
283
|
}
|
|
280
284
|
resolveWidget(receivedConfig, containerRef) {
|
|
281
285
|
const key = WidgetResolverService.getWidgetKey(receivedConfig);
|
|
@@ -301,39 +305,27 @@ class WidgetResolverService {
|
|
|
301
305
|
compRef.instance.widgetData = compData.widgetData;
|
|
302
306
|
if (compRef.instance.updateBaseComponent) {
|
|
303
307
|
const widgetSafeStyle = compData.widgetHostStyle
|
|
304
|
-
? this.domSanitizer.bypassSecurityTrustStyle(Object.entries(compData.widgetHostStyle).reduce((
|
|
308
|
+
? this.domSanitizer.bypassSecurityTrustStyle(Object.entries(compData.widgetHostStyle).reduce((s, [k, v]) => `${s}${k}:${v};`, ''))
|
|
305
309
|
: undefined;
|
|
306
310
|
compRef.instance.updateBaseComponent(compData.widgetType, compData.widgetSubType, compData.widgetInstanceId, compData.widgetHostClass, widgetSafeStyle);
|
|
307
311
|
}
|
|
308
312
|
return compRef;
|
|
309
313
|
}
|
|
310
314
|
}
|
|
311
|
-
WidgetResolverService
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
WidgetResolverService.prototype.roles;
|
|
326
|
-
WidgetResolverService.prototype.groups;
|
|
327
|
-
WidgetResolverService.prototype.restrictedFeatures;
|
|
328
|
-
WidgetResolverService.prototype.isInitialized;
|
|
329
|
-
WidgetResolverService.prototype.availableRegisteredWidgets;
|
|
330
|
-
WidgetResolverService.prototype.restrictedWidgetKeys;
|
|
331
|
-
WidgetResolverService.prototype.domSanitizer;
|
|
332
|
-
WidgetResolverService.prototype.componentFactoryResolver;
|
|
333
|
-
WidgetResolverService.prototype.loggerSvc;
|
|
334
|
-
WidgetResolverService.prototype.globalConfig;
|
|
335
|
-
WidgetResolverService.prototype.scopedConfig;
|
|
336
|
-
}
|
|
315
|
+
WidgetResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", 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 });
|
|
316
|
+
WidgetResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetResolverService, providedIn: 'root' });
|
|
317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetResolverService, decorators: [{
|
|
318
|
+
type: Injectable,
|
|
319
|
+
args: [{
|
|
320
|
+
providedIn: 'root',
|
|
321
|
+
}]
|
|
322
|
+
}], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }, { type: i0.ComponentFactoryResolver }, { type: undefined, decorators: [{
|
|
323
|
+
type: Inject,
|
|
324
|
+
args: [WIDGET_RESOLVER_GLOBAL_CONFIG]
|
|
325
|
+
}] }, { type: undefined, decorators: [{
|
|
326
|
+
type: Inject,
|
|
327
|
+
args: [WIDGET_RESOLVER_SCOPED_CONFIG]
|
|
328
|
+
}] }]; } });
|
|
337
329
|
|
|
338
330
|
class WidgetResolverDirective {
|
|
339
331
|
constructor(viewContainerRef, widgetResolverSvc, logger) {
|
|
@@ -355,25 +347,16 @@ class WidgetResolverDirective {
|
|
|
355
347
|
}
|
|
356
348
|
}
|
|
357
349
|
}
|
|
358
|
-
WidgetResolverDirective
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
];
|
|
368
|
-
WidgetResolverDirective.propDecorators = {
|
|
369
|
-
wsResolverWidget: [{ type: Input }]
|
|
370
|
-
};
|
|
371
|
-
if (false) {
|
|
372
|
-
WidgetResolverDirective.prototype.wsResolverWidget;
|
|
373
|
-
WidgetResolverDirective.prototype.viewContainerRef;
|
|
374
|
-
WidgetResolverDirective.prototype.widgetResolverSvc;
|
|
375
|
-
WidgetResolverDirective.prototype.logger;
|
|
376
|
-
}
|
|
350
|
+
WidgetResolverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetResolverDirective, deps: [{ token: i0.ViewContainerRef }, { token: WidgetResolverService }, { token: i2$1.LoggerService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
351
|
+
WidgetResolverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: WidgetResolverDirective, selector: "[wsResolverWidget]", inputs: { wsResolverWidget: "wsResolverWidget" }, usesOnChanges: true, ngImport: i0 });
|
|
352
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetResolverDirective, decorators: [{
|
|
353
|
+
type: Directive,
|
|
354
|
+
args: [{
|
|
355
|
+
selector: '[wsResolverWidget]',
|
|
356
|
+
}]
|
|
357
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: WidgetResolverService }, { type: i2$1.LoggerService }]; }, propDecorators: { wsResolverWidget: [{
|
|
358
|
+
type: Input
|
|
359
|
+
}] } });
|
|
377
360
|
|
|
378
361
|
class WidgetResolverModule {
|
|
379
362
|
static forRoot(config) {
|
|
@@ -405,85 +388,37 @@ class WidgetResolverModule {
|
|
|
405
388
|
};
|
|
406
389
|
}
|
|
407
390
|
}
|
|
408
|
-
WidgetResolverModule
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
function IPermissions() { }
|
|
441
|
-
NsWidgetResolver.IPermissions = IPermissions;
|
|
442
|
-
if (false) {
|
|
443
|
-
IPermissions.prototype.enabled;
|
|
444
|
-
IPermissions.prototype.available;
|
|
445
|
-
IPermissions.prototype.roles;
|
|
446
|
-
IPermissions.prototype.features;
|
|
447
|
-
IPermissions.prototype.groups;
|
|
448
|
-
}
|
|
449
|
-
function IBaseConfig() { }
|
|
450
|
-
NsWidgetResolver.IBaseConfig = IBaseConfig;
|
|
451
|
-
if (false) {
|
|
452
|
-
IBaseConfig.prototype.widgetType;
|
|
453
|
-
IBaseConfig.prototype.widgetSubType;
|
|
454
|
-
}
|
|
455
|
-
function IRegistrationConfig() { }
|
|
456
|
-
NsWidgetResolver.IRegistrationConfig = IRegistrationConfig;
|
|
457
|
-
if (false) {
|
|
458
|
-
IRegistrationConfig.prototype.component;
|
|
459
|
-
}
|
|
460
|
-
function IRegistrationsPermissionConfig() { }
|
|
461
|
-
NsWidgetResolver.IRegistrationsPermissionConfig = IRegistrationsPermissionConfig;
|
|
462
|
-
if (false) {
|
|
463
|
-
IRegistrationsPermissionConfig.prototype.widgetPermission;
|
|
464
|
-
}
|
|
465
|
-
function IRenderConfigWithTypedData() { }
|
|
466
|
-
NsWidgetResolver.IRenderConfigWithTypedData = IRenderConfigWithTypedData;
|
|
467
|
-
if (false) {
|
|
468
|
-
IRenderConfigWithTypedData.prototype.widgetData;
|
|
469
|
-
IRenderConfigWithTypedData.prototype.widgetInstanceId;
|
|
470
|
-
IRenderConfigWithTypedData.prototype.widgetHostClass;
|
|
471
|
-
IRenderConfigWithTypedData.prototype.widgetHostStyle;
|
|
472
|
-
}
|
|
473
|
-
function IWidgetData() { }
|
|
474
|
-
NsWidgetResolver.IWidgetData = IWidgetData;
|
|
475
|
-
if (false) {
|
|
476
|
-
IWidgetData.prototype.widgetSafeStyle;
|
|
477
|
-
IWidgetData.prototype.updateBaseComponent;
|
|
478
|
-
}
|
|
479
|
-
function ITitle() { }
|
|
480
|
-
NsWidgetResolver.ITitle = ITitle;
|
|
481
|
-
if (false) {
|
|
482
|
-
ITitle.prototype.title;
|
|
483
|
-
ITitle.prototype.url;
|
|
484
|
-
ITitle.prototype.icon;
|
|
485
|
-
}
|
|
486
|
-
})(NsWidgetResolver || (NsWidgetResolver = {}));
|
|
391
|
+
WidgetResolverModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetResolverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
392
|
+
WidgetResolverModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetResolverModule, declarations: [WidgetBaseComponent,
|
|
393
|
+
WidgetResolverDirective,
|
|
394
|
+
RestrictedComponent,
|
|
395
|
+
InvalidRegistrationComponent,
|
|
396
|
+
InvalidPermissionComponent,
|
|
397
|
+
UnresolvedComponent], imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule], exports: [WidgetResolverDirective, WidgetBaseComponent] });
|
|
398
|
+
WidgetResolverModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetResolverModule, providers: [ConfigurationsService], imports: [[CommonModule, MatButtonModule, MatIconModule, MatCardModule]] });
|
|
399
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WidgetResolverModule, decorators: [{
|
|
400
|
+
type: NgModule,
|
|
401
|
+
args: [{
|
|
402
|
+
declarations: [
|
|
403
|
+
WidgetBaseComponent,
|
|
404
|
+
WidgetResolverDirective,
|
|
405
|
+
RestrictedComponent,
|
|
406
|
+
InvalidRegistrationComponent,
|
|
407
|
+
InvalidPermissionComponent,
|
|
408
|
+
UnresolvedComponent,
|
|
409
|
+
],
|
|
410
|
+
imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule],
|
|
411
|
+
exports: [WidgetResolverDirective, WidgetBaseComponent],
|
|
412
|
+
entryComponents: [
|
|
413
|
+
RestrictedComponent,
|
|
414
|
+
InvalidRegistrationComponent,
|
|
415
|
+
InvalidPermissionComponent,
|
|
416
|
+
UnresolvedComponent,
|
|
417
|
+
WidgetBaseComponent,
|
|
418
|
+
],
|
|
419
|
+
providers: [ConfigurationsService],
|
|
420
|
+
}]
|
|
421
|
+
}] });
|
|
487
422
|
|
|
488
|
-
export { WidgetBaseComponent, WidgetResolverModule, WidgetResolverService, hasPermissions, hasUnitPermission
|
|
423
|
+
export { WidgetBaseComponent, WidgetResolverDirective, WidgetResolverModule, WidgetResolverService, hasPermissions, hasUnitPermission };
|
|
489
424
|
//# sourceMappingURL=sunbird-cb-resolver.js.map
|