@sunbird-cb/resolver 0.0.3 → 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/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 +33 -30
- package/esm2015/lib/invalid-registration/invalid-registration.component.js +27 -24
- package/esm2015/lib/restricted/restricted.component.js +27 -24
- package/esm2015/lib/unresolved/unresolved.component.js +34 -33
- package/esm2015/lib/widget-base.component.js +60 -51
- package/esm2015/lib/widget-resolver.constant.js +4 -4
- package/esm2015/lib/widget-resolver.directive.js +35 -43
- package/esm2015/lib/widget-resolver.model.js +2 -57
- package/esm2015/lib/widget-resolver.module.js +77 -65
- package/esm2015/lib/widget-resolver.permissions.js +74 -74
- package/esm2015/lib/widget-resolver.service.js +96 -114
- package/esm2015/public-api.js +7 -6
- package/esm2015/sunbird-cb-resolver.js +2 -8
- package/fesm2015/sunbird-cb-resolver.js +402 -467
- package/fesm2015/sunbird-cb-resolver.js.map +1 -1
- package/lib/invalid-permission/invalid-permission.component.d.ts +14 -11
- package/lib/invalid-registration/invalid-registration.component.d.ts +11 -8
- package/lib/restricted/restricted.component.d.ts +11 -8
- package/lib/unresolved/unresolved.component.d.ts +13 -10
- package/lib/widget-base.component.d.ts +18 -15
- package/lib/widget-resolver.constant.d.ts +4 -4
- package/lib/widget-resolver.directive.d.ts +15 -12
- package/lib/widget-resolver.model.d.ts +48 -48
- package/lib/widget-resolver.module.d.ts +20 -6
- package/lib/widget-resolver.permissions.d.ts +3 -3
- package/lib/widget-resolver.service.d.ts +23 -22
- package/package.json +17 -20
- package/public-api.d.ts +6 -5
- package/sunbird-cb-resolver.d.ts +2 -8
- 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,750 +1,963 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/material/card'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/platform-browser'), require('@sunbird-cb/utils')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@sunbird-cb/resolver', ['exports', '@angular/core', '@angular/common', '@angular/material/card', '@angular/material/icon', '@angular/material/button', '@angular/platform-browser', '@sunbird-cb/utils'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["sunbird-cb"] = global["sunbird-cb"] || {}, global["sunbird-cb"].resolver = {}), global.ng.core, global.ng.common, global.ng.material.card, global.ng.material.icon, global.ng.material.button, global.ng.platformBrowser, global["@sunbird-cb/utils"]));
|
|
5
|
+
})(this, (function (exports, i0, i4, i1, i2, i3, i1$1, i2$1) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
***************************************************************************** */
|
|
21
|
-
/* global Reflect, Promise */
|
|
22
|
-
|
|
23
|
-
var extendStatics = function(d, b) {
|
|
24
|
-
extendStatics = Object.setPrototypeOf ||
|
|
25
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
26
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
27
|
-
return extendStatics(d, b);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function __extends(d, b) {
|
|
31
|
-
extendStatics(d, b);
|
|
32
|
-
function __() { this.constructor = d; }
|
|
33
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var __assign = function() {
|
|
37
|
-
__assign = Object.assign || function __assign(t) {
|
|
38
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
39
|
-
s = arguments[i];
|
|
40
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
41
|
-
}
|
|
42
|
-
return t;
|
|
43
|
-
};
|
|
44
|
-
return __assign.apply(this, arguments);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
function __rest(s, e) {
|
|
48
|
-
var t = {};
|
|
49
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
-
t[p] = s[p];
|
|
51
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
-
t[p[i]] = s[p[i]];
|
|
55
|
-
}
|
|
56
|
-
return t;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function __decorate(decorators, target, key, desc) {
|
|
60
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
61
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
62
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
63
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function __param(paramIndex, decorator) {
|
|
67
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function __metadata(metadataKey, metadataValue) {
|
|
71
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
75
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
76
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
77
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
78
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
79
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
80
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function __generator(thisArg, body) {
|
|
85
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
86
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
87
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
88
|
-
function step(op) {
|
|
89
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
90
|
-
while (_) try {
|
|
91
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
92
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
93
|
-
switch (op[0]) {
|
|
94
|
-
case 0: case 1: t = op; break;
|
|
95
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
96
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
97
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
98
|
-
default:
|
|
99
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
100
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
101
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
102
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
103
|
-
if (t[2]) _.ops.pop();
|
|
104
|
-
_.trys.pop(); continue;
|
|
105
|
-
}
|
|
106
|
-
op = body.call(thisArg, _);
|
|
107
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
108
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function __createBinding(o, m, k, k2) {
|
|
113
|
-
if (k2 === undefined) k2 = k;
|
|
114
|
-
o[k2] = m[k];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function __exportStar(m, exports) {
|
|
118
|
-
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function __values(o) {
|
|
122
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
123
|
-
if (m) return m.call(o);
|
|
124
|
-
if (o && typeof o.length === "number") return {
|
|
125
|
-
next: function () {
|
|
126
|
-
if (o && i >= o.length) o = void 0;
|
|
127
|
-
return { value: o && o[i++], done: !o };
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function __read(o, n) {
|
|
134
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
135
|
-
if (!m) return o;
|
|
136
|
-
var i = m.call(o), r, ar = [], e;
|
|
137
|
-
try {
|
|
138
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
139
|
-
}
|
|
140
|
-
catch (error) { e = { error: error }; }
|
|
141
|
-
finally {
|
|
142
|
-
try {
|
|
143
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
144
|
-
}
|
|
145
|
-
finally { if (e) throw e.error; }
|
|
146
|
-
}
|
|
147
|
-
return ar;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function __spread() {
|
|
151
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
152
|
-
ar = ar.concat(__read(arguments[i]));
|
|
153
|
-
return ar;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function __spreadArrays() {
|
|
157
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
158
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
159
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
160
|
-
r[k] = a[j];
|
|
161
|
-
return r;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
function __await(v) {
|
|
165
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
169
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
170
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
171
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
172
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
173
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
174
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
175
|
-
function fulfill(value) { resume("next", value); }
|
|
176
|
-
function reject(value) { resume("throw", value); }
|
|
177
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function __asyncDelegator(o) {
|
|
181
|
-
var i, p;
|
|
182
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
183
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function __asyncValues(o) {
|
|
187
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
188
|
-
var m = o[Symbol.asyncIterator], i;
|
|
189
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
190
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
191
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function __makeTemplateObject(cooked, raw) {
|
|
195
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
196
|
-
return cooked;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
function __importStar(mod) {
|
|
200
|
-
if (mod && mod.__esModule) return mod;
|
|
201
|
-
var result = {};
|
|
202
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
203
|
-
result.default = mod;
|
|
204
|
-
return result;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function __importDefault(mod) {
|
|
208
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function __classPrivateFieldGet(receiver, privateMap) {
|
|
212
|
-
if (!privateMap.has(receiver)) {
|
|
213
|
-
throw new TypeError("attempted to get private field on non-instance");
|
|
214
|
-
}
|
|
215
|
-
return privateMap.get(receiver);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function __classPrivateFieldSet(receiver, privateMap, value) {
|
|
219
|
-
if (!privateMap.has(receiver)) {
|
|
220
|
-
throw new TypeError("attempted to set private field on non-instance");
|
|
221
|
-
}
|
|
222
|
-
privateMap.set(receiver, value);
|
|
223
|
-
return value;
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
224
20
|
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
225
24
|
|
|
226
|
-
|
|
227
|
-
|
|
25
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
+
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
|
27
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
28
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
29
|
+
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
|
30
|
+
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
31
|
+
var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
|
|
228
32
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
function isCheckRequired(requiredPermission) {
|
|
233
|
-
if (requiredPermission === undefined ||
|
|
234
|
-
requiredPermission === null ||
|
|
235
|
-
requiredPermission === '' ||
|
|
236
|
-
(Array.isArray(requiredPermission) && requiredPermission.length === 0)) {
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
239
|
-
return true;
|
|
240
|
-
}
|
|
241
|
-
function flipBoolean(value, flip) {
|
|
242
|
-
if (flip === void 0) { flip = false; }
|
|
243
|
-
return flip ? !value : value;
|
|
244
|
-
}
|
|
245
|
-
function permissionTest(testFor, requiredPermission, matchAgainst, isRestrictive) {
|
|
246
|
-
if (isRestrictive === void 0) { isRestrictive = false; }
|
|
247
|
-
if (!isCheckRequired(requiredPermission)) {
|
|
248
|
-
return true;
|
|
249
|
-
}
|
|
250
|
-
if (typeof requiredPermission === 'string') {
|
|
251
|
-
switch (testFor) {
|
|
252
|
-
case 'all':
|
|
253
|
-
case 'some':
|
|
254
|
-
return flipBoolean(matchAgainst.has(requiredPermission), isRestrictive);
|
|
255
|
-
case 'none':
|
|
256
|
-
return flipBoolean(!matchAgainst.has(requiredPermission), isRestrictive);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (Array.isArray(requiredPermission)) {
|
|
260
|
-
var matcher = (function (u) {
|
|
261
|
-
return typeof u === 'string' && flipBoolean(matchAgainst.has(u), isRestrictive);
|
|
262
|
-
});
|
|
263
|
-
switch (testFor) {
|
|
264
|
-
case 'all':
|
|
265
|
-
return requiredPermission.every(matcher);
|
|
266
|
-
case 'some':
|
|
267
|
-
return requiredPermission.some(matcher);
|
|
268
|
-
case 'none':
|
|
269
|
-
return !requiredPermission.every(matcher);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return false;
|
|
273
|
-
}
|
|
274
|
-
function hasUnitPermission(requiredPermission, matchAgainst, isRestrictive) {
|
|
275
|
-
if (isRestrictive === void 0) { isRestrictive = false; }
|
|
276
|
-
if (!isCheckRequired(requiredPermission)) {
|
|
277
|
-
return true;
|
|
278
|
-
}
|
|
279
|
-
var accessValues = matchAgainst instanceof Set
|
|
280
|
-
? matchAgainst
|
|
281
|
-
: Array.isArray(matchAgainst) && isStringArray(matchAgainst)
|
|
282
|
-
? new Set(matchAgainst)
|
|
283
|
-
: typeof matchAgainst === 'string'
|
|
284
|
-
? new Set([matchAgainst])
|
|
285
|
-
: new Set();
|
|
286
|
-
if (typeof requiredPermission === 'object' && requiredPermission !== null) {
|
|
287
|
-
if (Array.isArray(requiredPermission)) {
|
|
288
|
-
return permissionTest('all', requiredPermission, accessValues, isRestrictive);
|
|
289
|
-
}
|
|
290
|
-
return (permissionTest('all', 'all' in requiredPermission ? requiredPermission.all : null, accessValues, isRestrictive) &&
|
|
291
|
-
permissionTest('some', 'some' in requiredPermission ? requiredPermission.some : null, accessValues, isRestrictive) &&
|
|
292
|
-
permissionTest('none', 'none' in requiredPermission ? requiredPermission.none : null, accessValues, isRestrictive));
|
|
293
|
-
}
|
|
294
|
-
return false;
|
|
295
|
-
}
|
|
296
|
-
function hasPermissions(requiredPermission, availableRoles, availableGroups, restrictedFeatures) {
|
|
297
|
-
if (!requiredPermission) {
|
|
298
|
-
return true;
|
|
299
|
-
}
|
|
300
|
-
if (!requiredPermission.available || !requiredPermission.enabled) {
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
return (hasUnitPermission(requiredPermission.groups, availableGroups) &&
|
|
304
|
-
hasUnitPermission(requiredPermission.roles, availableRoles) &&
|
|
305
|
-
hasUnitPermission(requiredPermission.features, restrictedFeatures, true));
|
|
306
|
-
}
|
|
33
|
+
/******************************************************************************
|
|
34
|
+
Copyright (c) Microsoft Corporation.
|
|
307
35
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
this.widgetType = '';
|
|
311
|
-
this.widgetSubType = '';
|
|
312
|
-
}
|
|
313
|
-
WidgetBaseComponent.prototype.updateBaseComponent = function (widgetType, widgetSubType, widgetInstanceId, widgetHostClass, widgetSafeStyle) {
|
|
314
|
-
this.widgetType = widgetType;
|
|
315
|
-
this.widgetSubType = widgetSubType;
|
|
316
|
-
this.widgetInstanceId = widgetInstanceId;
|
|
317
|
-
this.widgetHostClass = widgetHostClass;
|
|
318
|
-
this.widgetSafeStyle = widgetSafeStyle;
|
|
319
|
-
if (this.widgetHostClass) {
|
|
320
|
-
this.className = this.className + " " + this.widgetHostClass;
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
WidgetBaseComponent.prototype.ngAfterViewInit = function () {
|
|
324
|
-
var _this = this;
|
|
325
|
-
var hash = window.location.hash ? window.location.hash.split('#')[1] : '';
|
|
326
|
-
if (hash && !isNaN(hash) && hash === this.widgetInstanceId) {
|
|
327
|
-
setTimeout((function () {
|
|
328
|
-
var element = document.getElementById(_this.widgetInstanceId || '');
|
|
329
|
-
if (element) {
|
|
330
|
-
element.scrollIntoView();
|
|
331
|
-
}
|
|
332
|
-
}), 200);
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
WidgetBaseComponent.decorators = [
|
|
336
|
-
{ type: core.Component, args: [{
|
|
337
|
-
selector: 'ws-resolver-base',
|
|
338
|
-
template: 'Base Component'
|
|
339
|
-
}] }
|
|
340
|
-
];
|
|
341
|
-
WidgetBaseComponent.propDecorators = {
|
|
342
|
-
widgetType: [{ type: core.Input }],
|
|
343
|
-
widgetSubType: [{ type: core.Input }],
|
|
344
|
-
widgetHostClass: [{ type: core.Input }],
|
|
345
|
-
widgetInstanceId: [{ type: core.Input }, { type: core.HostBinding, args: ['id',] }],
|
|
346
|
-
widgetSafeStyle: [{ type: core.Input }, { type: core.HostBinding, args: ['style',] }],
|
|
347
|
-
className: [{ type: core.Input }, { type: core.HostBinding, args: ['class',] }]
|
|
348
|
-
};
|
|
349
|
-
return WidgetBaseComponent;
|
|
350
|
-
}());
|
|
351
|
-
if (false) {
|
|
352
|
-
WidgetBaseComponent.prototype.widgetType;
|
|
353
|
-
WidgetBaseComponent.prototype.widgetSubType;
|
|
354
|
-
WidgetBaseComponent.prototype.widgetHostClass;
|
|
355
|
-
WidgetBaseComponent.prototype.widgetInstanceId;
|
|
356
|
-
WidgetBaseComponent.prototype.widgetSafeStyle;
|
|
357
|
-
WidgetBaseComponent.prototype.className;
|
|
358
|
-
}
|
|
36
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
37
|
+
purpose with or without fee is hereby granted.
|
|
359
38
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
40
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
41
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
42
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
43
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
44
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
45
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
46
|
+
***************************************************************************** */
|
|
47
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
48
|
+
var extendStatics = function (d, b) {
|
|
49
|
+
extendStatics = Object.setPrototypeOf ||
|
|
50
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
51
|
+
function (d, b) { for (var p in b)
|
|
52
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
53
|
+
d[p] = b[p]; };
|
|
54
|
+
return extendStatics(d, b);
|
|
55
|
+
};
|
|
56
|
+
function __extends(d, b) {
|
|
57
|
+
if (typeof b !== "function" && b !== null)
|
|
58
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
59
|
+
extendStatics(d, b);
|
|
60
|
+
function __() { this.constructor = d; }
|
|
61
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
62
|
+
}
|
|
63
|
+
var __assign = function () {
|
|
64
|
+
__assign = Object.assign || function __assign(t) {
|
|
65
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
66
|
+
s = arguments[i];
|
|
67
|
+
for (var p in s)
|
|
68
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
69
|
+
t[p] = s[p];
|
|
70
|
+
}
|
|
71
|
+
return t;
|
|
72
|
+
};
|
|
73
|
+
return __assign.apply(this, arguments);
|
|
74
|
+
};
|
|
75
|
+
function __rest(s, e) {
|
|
76
|
+
var t = {};
|
|
77
|
+
for (var p in s)
|
|
78
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
79
|
+
t[p] = s[p];
|
|
80
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
81
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
82
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
83
|
+
t[p[i]] = s[p[i]];
|
|
84
|
+
}
|
|
85
|
+
return t;
|
|
86
|
+
}
|
|
87
|
+
function __decorate(decorators, target, key, desc) {
|
|
88
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
89
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
90
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
91
|
+
else
|
|
92
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
93
|
+
if (d = decorators[i])
|
|
94
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
95
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
96
|
+
}
|
|
97
|
+
function __param(paramIndex, decorator) {
|
|
98
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
99
|
+
}
|
|
100
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
101
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function")
|
|
102
|
+
throw new TypeError("Function expected"); return f; }
|
|
103
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
104
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
105
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
106
|
+
var _, done = false;
|
|
107
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
108
|
+
var context = {};
|
|
109
|
+
for (var p in contextIn)
|
|
110
|
+
context[p] = p === "access" ? {} : contextIn[p];
|
|
111
|
+
for (var p in contextIn.access)
|
|
112
|
+
context.access[p] = contextIn.access[p];
|
|
113
|
+
context.addInitializer = function (f) { if (done)
|
|
114
|
+
throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
115
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
116
|
+
if (kind === "accessor") {
|
|
117
|
+
if (result === void 0)
|
|
118
|
+
continue;
|
|
119
|
+
if (result === null || typeof result !== "object")
|
|
120
|
+
throw new TypeError("Object expected");
|
|
121
|
+
if (_ = accept(result.get))
|
|
122
|
+
descriptor.get = _;
|
|
123
|
+
if (_ = accept(result.set))
|
|
124
|
+
descriptor.set = _;
|
|
125
|
+
if (_ = accept(result.init))
|
|
126
|
+
initializers.unshift(_);
|
|
127
|
+
}
|
|
128
|
+
else if (_ = accept(result)) {
|
|
129
|
+
if (kind === "field")
|
|
130
|
+
initializers.unshift(_);
|
|
131
|
+
else
|
|
132
|
+
descriptor[key] = _;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (target)
|
|
136
|
+
Object.defineProperty(target, contextIn.name, descriptor);
|
|
137
|
+
done = true;
|
|
138
|
+
}
|
|
139
|
+
;
|
|
140
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
141
|
+
var useValue = arguments.length > 2;
|
|
142
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
143
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
144
|
+
}
|
|
145
|
+
return useValue ? value : void 0;
|
|
146
|
+
}
|
|
147
|
+
;
|
|
148
|
+
function __propKey(x) {
|
|
149
|
+
return typeof x === "symbol" ? x : "".concat(x);
|
|
150
|
+
}
|
|
151
|
+
;
|
|
152
|
+
function __setFunctionName(f, name, prefix) {
|
|
153
|
+
if (typeof name === "symbol")
|
|
154
|
+
name = name.description ? "[".concat(name.description, "]") : "";
|
|
155
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
156
|
+
}
|
|
157
|
+
;
|
|
158
|
+
function __metadata(metadataKey, metadataValue) {
|
|
159
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
160
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
161
|
+
}
|
|
162
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
163
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
164
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
165
|
+
function fulfilled(value) { try {
|
|
166
|
+
step(generator.next(value));
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
reject(e);
|
|
170
|
+
} }
|
|
171
|
+
function rejected(value) { try {
|
|
172
|
+
step(generator["throw"](value));
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
reject(e);
|
|
176
|
+
} }
|
|
177
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
178
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function __generator(thisArg, body) {
|
|
182
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
183
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
184
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
185
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
186
|
+
function step(op) {
|
|
187
|
+
if (f)
|
|
188
|
+
throw new TypeError("Generator is already executing.");
|
|
189
|
+
while (g && (g = 0, op[0] && (_ = 0)), _)
|
|
190
|
+
try {
|
|
191
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
192
|
+
return t;
|
|
193
|
+
if (y = 0, t)
|
|
194
|
+
op = [op[0] & 2, t.value];
|
|
195
|
+
switch (op[0]) {
|
|
196
|
+
case 0:
|
|
197
|
+
case 1:
|
|
198
|
+
t = op;
|
|
199
|
+
break;
|
|
200
|
+
case 4:
|
|
201
|
+
_.label++;
|
|
202
|
+
return { value: op[1], done: false };
|
|
203
|
+
case 5:
|
|
204
|
+
_.label++;
|
|
205
|
+
y = op[1];
|
|
206
|
+
op = [0];
|
|
207
|
+
continue;
|
|
208
|
+
case 7:
|
|
209
|
+
op = _.ops.pop();
|
|
210
|
+
_.trys.pop();
|
|
211
|
+
continue;
|
|
212
|
+
default:
|
|
213
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
214
|
+
_ = 0;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
218
|
+
_.label = op[1];
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
222
|
+
_.label = t[1];
|
|
223
|
+
t = op;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
if (t && _.label < t[2]) {
|
|
227
|
+
_.label = t[2];
|
|
228
|
+
_.ops.push(op);
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
if (t[2])
|
|
232
|
+
_.ops.pop();
|
|
233
|
+
_.trys.pop();
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
op = body.call(thisArg, _);
|
|
237
|
+
}
|
|
238
|
+
catch (e) {
|
|
239
|
+
op = [6, e];
|
|
240
|
+
y = 0;
|
|
241
|
+
}
|
|
242
|
+
finally {
|
|
243
|
+
f = t = 0;
|
|
244
|
+
}
|
|
245
|
+
if (op[0] & 5)
|
|
246
|
+
throw op[1];
|
|
247
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
251
|
+
if (k2 === undefined)
|
|
252
|
+
k2 = k;
|
|
253
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
254
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
255
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
|
256
|
+
}
|
|
257
|
+
Object.defineProperty(o, k2, desc);
|
|
258
|
+
}) : (function (o, m, k, k2) {
|
|
259
|
+
if (k2 === undefined)
|
|
260
|
+
k2 = k;
|
|
261
|
+
o[k2] = m[k];
|
|
262
|
+
});
|
|
263
|
+
function __exportStar(m, o) {
|
|
264
|
+
for (var p in m)
|
|
265
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
266
|
+
__createBinding(o, m, p);
|
|
267
|
+
}
|
|
268
|
+
function __values(o) {
|
|
269
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
270
|
+
if (m)
|
|
271
|
+
return m.call(o);
|
|
272
|
+
if (o && typeof o.length === "number")
|
|
273
|
+
return {
|
|
274
|
+
next: function () {
|
|
275
|
+
if (o && i >= o.length)
|
|
276
|
+
o = void 0;
|
|
277
|
+
return { value: o && o[i++], done: !o };
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
281
|
+
}
|
|
282
|
+
function __read(o, n) {
|
|
283
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
284
|
+
if (!m)
|
|
285
|
+
return o;
|
|
286
|
+
var i = m.call(o), r, ar = [], e;
|
|
287
|
+
try {
|
|
288
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
289
|
+
ar.push(r.value);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
e = { error: error };
|
|
293
|
+
}
|
|
294
|
+
finally {
|
|
295
|
+
try {
|
|
296
|
+
if (r && !r.done && (m = i["return"]))
|
|
297
|
+
m.call(i);
|
|
298
|
+
}
|
|
299
|
+
finally {
|
|
300
|
+
if (e)
|
|
301
|
+
throw e.error;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return ar;
|
|
305
|
+
}
|
|
306
|
+
/** @deprecated */
|
|
307
|
+
function __spread() {
|
|
308
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
309
|
+
ar = ar.concat(__read(arguments[i]));
|
|
310
|
+
return ar;
|
|
311
|
+
}
|
|
312
|
+
/** @deprecated */
|
|
313
|
+
function __spreadArrays() {
|
|
314
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
315
|
+
s += arguments[i].length;
|
|
316
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
317
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
318
|
+
r[k] = a[j];
|
|
319
|
+
return r;
|
|
320
|
+
}
|
|
321
|
+
function __spreadArray(to, from, pack) {
|
|
322
|
+
if (pack || arguments.length === 2)
|
|
323
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
324
|
+
if (ar || !(i in from)) {
|
|
325
|
+
if (!ar)
|
|
326
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
327
|
+
ar[i] = from[i];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
331
|
+
}
|
|
332
|
+
function __await(v) {
|
|
333
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
334
|
+
}
|
|
335
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
336
|
+
if (!Symbol.asyncIterator)
|
|
337
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
338
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
339
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
340
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
341
|
+
function verb(n, f) { if (g[n]) {
|
|
342
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };
|
|
343
|
+
if (f)
|
|
344
|
+
i[n] = f(i[n]);
|
|
345
|
+
} }
|
|
346
|
+
function resume(n, v) { try {
|
|
347
|
+
step(g[n](v));
|
|
348
|
+
}
|
|
349
|
+
catch (e) {
|
|
350
|
+
settle(q[0][3], e);
|
|
351
|
+
} }
|
|
352
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
353
|
+
function fulfill(value) { resume("next", value); }
|
|
354
|
+
function reject(value) { resume("throw", value); }
|
|
355
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
356
|
+
resume(q[0][0], q[0][1]); }
|
|
357
|
+
}
|
|
358
|
+
function __asyncDelegator(o) {
|
|
359
|
+
var i, p;
|
|
360
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
361
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
362
|
+
}
|
|
363
|
+
function __asyncValues(o) {
|
|
364
|
+
if (!Symbol.asyncIterator)
|
|
365
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
366
|
+
var m = o[Symbol.asyncIterator], i;
|
|
367
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
368
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
369
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
370
|
+
}
|
|
371
|
+
function __makeTemplateObject(cooked, raw) {
|
|
372
|
+
if (Object.defineProperty) {
|
|
373
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
cooked.raw = raw;
|
|
377
|
+
}
|
|
378
|
+
return cooked;
|
|
379
|
+
}
|
|
380
|
+
;
|
|
381
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
382
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
383
|
+
}) : function (o, v) {
|
|
384
|
+
o["default"] = v;
|
|
385
|
+
};
|
|
386
|
+
function __importStar(mod) {
|
|
387
|
+
if (mod && mod.__esModule)
|
|
388
|
+
return mod;
|
|
389
|
+
var result = {};
|
|
390
|
+
if (mod != null)
|
|
391
|
+
for (var k in mod)
|
|
392
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
393
|
+
__createBinding(result, mod, k);
|
|
394
|
+
__setModuleDefault(result, mod);
|
|
395
|
+
return result;
|
|
396
|
+
}
|
|
397
|
+
function __importDefault(mod) {
|
|
398
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
399
|
+
}
|
|
400
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
401
|
+
if (kind === "a" && !f)
|
|
402
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
403
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
404
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
405
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
406
|
+
}
|
|
407
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
408
|
+
if (kind === "m")
|
|
409
|
+
throw new TypeError("Private method is not writable");
|
|
410
|
+
if (kind === "a" && !f)
|
|
411
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
412
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
413
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
414
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
415
|
+
}
|
|
416
|
+
function __classPrivateFieldIn(state, receiver) {
|
|
417
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
|
|
418
|
+
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
419
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
420
|
+
}
|
|
421
|
+
function __addDisposableResource(env, value, async) {
|
|
422
|
+
if (value !== null && value !== void 0) {
|
|
423
|
+
if (typeof value !== "object" && typeof value !== "function")
|
|
424
|
+
throw new TypeError("Object expected.");
|
|
425
|
+
var dispose, inner;
|
|
426
|
+
if (async) {
|
|
427
|
+
if (!Symbol.asyncDispose)
|
|
428
|
+
throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
429
|
+
dispose = value[Symbol.asyncDispose];
|
|
430
|
+
}
|
|
431
|
+
if (dispose === void 0) {
|
|
432
|
+
if (!Symbol.dispose)
|
|
433
|
+
throw new TypeError("Symbol.dispose is not defined.");
|
|
434
|
+
dispose = value[Symbol.dispose];
|
|
435
|
+
if (async)
|
|
436
|
+
inner = dispose;
|
|
437
|
+
}
|
|
438
|
+
if (typeof dispose !== "function")
|
|
439
|
+
throw new TypeError("Object not disposable.");
|
|
440
|
+
if (inner)
|
|
441
|
+
dispose = function () { try {
|
|
442
|
+
inner.call(this);
|
|
443
|
+
}
|
|
444
|
+
catch (e) {
|
|
445
|
+
return Promise.reject(e);
|
|
446
|
+
} };
|
|
447
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
448
|
+
}
|
|
449
|
+
else if (async) {
|
|
450
|
+
env.stack.push({ async: true });
|
|
451
|
+
}
|
|
452
|
+
return value;
|
|
453
|
+
}
|
|
454
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
455
|
+
var e = new Error(message);
|
|
456
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
457
|
+
};
|
|
458
|
+
function __disposeResources(env) {
|
|
459
|
+
function fail(e) {
|
|
460
|
+
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
461
|
+
env.hasError = true;
|
|
462
|
+
}
|
|
463
|
+
var r, s = 0;
|
|
464
|
+
function next() {
|
|
465
|
+
while (r = env.stack.pop()) {
|
|
466
|
+
try {
|
|
467
|
+
if (!r.async && s === 1)
|
|
468
|
+
return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
469
|
+
if (r.dispose) {
|
|
470
|
+
var result = r.dispose.call(r.value);
|
|
471
|
+
if (r.async)
|
|
472
|
+
return s |= 2, Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
|
|
473
|
+
}
|
|
474
|
+
else
|
|
475
|
+
s |= 1;
|
|
476
|
+
}
|
|
477
|
+
catch (e) {
|
|
478
|
+
fail(e);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if (s === 1)
|
|
482
|
+
return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
483
|
+
if (env.hasError)
|
|
484
|
+
throw env.error;
|
|
485
|
+
}
|
|
486
|
+
return next();
|
|
487
|
+
}
|
|
488
|
+
var tslib_es6 = {
|
|
489
|
+
__extends: __extends,
|
|
490
|
+
__assign: __assign,
|
|
491
|
+
__rest: __rest,
|
|
492
|
+
__decorate: __decorate,
|
|
493
|
+
__param: __param,
|
|
494
|
+
__metadata: __metadata,
|
|
495
|
+
__awaiter: __awaiter,
|
|
496
|
+
__generator: __generator,
|
|
497
|
+
__createBinding: __createBinding,
|
|
498
|
+
__exportStar: __exportStar,
|
|
499
|
+
__values: __values,
|
|
500
|
+
__read: __read,
|
|
501
|
+
__spread: __spread,
|
|
502
|
+
__spreadArrays: __spreadArrays,
|
|
503
|
+
__spreadArray: __spreadArray,
|
|
504
|
+
__await: __await,
|
|
505
|
+
__asyncGenerator: __asyncGenerator,
|
|
506
|
+
__asyncDelegator: __asyncDelegator,
|
|
507
|
+
__asyncValues: __asyncValues,
|
|
508
|
+
__makeTemplateObject: __makeTemplateObject,
|
|
509
|
+
__importStar: __importStar,
|
|
510
|
+
__importDefault: __importDefault,
|
|
511
|
+
__classPrivateFieldGet: __classPrivateFieldGet,
|
|
512
|
+
__classPrivateFieldSet: __classPrivateFieldSet,
|
|
513
|
+
__classPrivateFieldIn: __classPrivateFieldIn,
|
|
514
|
+
__addDisposableResource: __addDisposableResource,
|
|
515
|
+
__disposeResources: __disposeResources,
|
|
516
|
+
};
|
|
384
517
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
function InvalidRegistrationComponent() {
|
|
388
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
389
|
-
_this.showData = true;
|
|
390
|
-
return _this;
|
|
391
|
-
}
|
|
392
|
-
InvalidRegistrationComponent.prototype.ngOnInit = function () { };
|
|
393
|
-
InvalidRegistrationComponent.decorators = [
|
|
394
|
-
{ type: core.Component, args: [{
|
|
395
|
-
selector: 'ws-resolver-invalid-registration',
|
|
396
|
-
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>",
|
|
397
|
-
styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}"]
|
|
398
|
-
}] }
|
|
399
|
-
];
|
|
400
|
-
InvalidRegistrationComponent.propDecorators = {
|
|
401
|
-
widgetData: [{ type: core.Input }]
|
|
402
|
-
};
|
|
403
|
-
return InvalidRegistrationComponent;
|
|
404
|
-
}(WidgetBaseComponent));
|
|
405
|
-
if (false) {
|
|
406
|
-
InvalidRegistrationComponent.prototype.widgetData;
|
|
407
|
-
InvalidRegistrationComponent.prototype.showData;
|
|
408
|
-
}
|
|
518
|
+
var WIDGET_RESOLVER_GLOBAL_CONFIG = new i0.InjectionToken('Global Registration Configuration for Widget Resolvers');
|
|
519
|
+
var WIDGET_RESOLVER_SCOPED_CONFIG = new i0.InjectionToken('Scoped Registration Configuration for Widget Resolvers');
|
|
409
520
|
|
|
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
|
-
|
|
521
|
+
function isStringArray(strArr) {
|
|
522
|
+
return Array.isArray(strArr) && strArr.every(function (u) { return typeof u === 'string'; });
|
|
523
|
+
}
|
|
524
|
+
function isCheckRequired(requiredPermission) {
|
|
525
|
+
if (requiredPermission === undefined ||
|
|
526
|
+
requiredPermission === null ||
|
|
527
|
+
requiredPermission === '' ||
|
|
528
|
+
(Array.isArray(requiredPermission) && requiredPermission.length === 0)) {
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
533
|
+
function flipBoolean(value, flip) {
|
|
534
|
+
if (flip === void 0) { flip = false; }
|
|
535
|
+
return flip ? !value : value;
|
|
536
|
+
}
|
|
537
|
+
function permissionTest(testFor, requiredPermission, matchAgainst, isRestrictive) {
|
|
538
|
+
if (isRestrictive === void 0) { isRestrictive = false; }
|
|
539
|
+
if (!isCheckRequired(requiredPermission)) {
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
if (typeof requiredPermission === 'string') {
|
|
543
|
+
switch (testFor) {
|
|
544
|
+
case 'all':
|
|
545
|
+
case 'some':
|
|
546
|
+
return flipBoolean(matchAgainst.has(requiredPermission), isRestrictive);
|
|
547
|
+
case 'none':
|
|
548
|
+
return flipBoolean(!matchAgainst.has(requiredPermission), isRestrictive);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (Array.isArray(requiredPermission)) {
|
|
552
|
+
var matcher = function (u) { return typeof u === 'string' && flipBoolean(matchAgainst.has(u), isRestrictive); };
|
|
553
|
+
switch (testFor) {
|
|
554
|
+
case 'all':
|
|
555
|
+
return requiredPermission.every(matcher);
|
|
556
|
+
case 'some':
|
|
557
|
+
return requiredPermission.some(matcher);
|
|
558
|
+
case 'none':
|
|
559
|
+
return !requiredPermission.every(matcher);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
function hasUnitPermission(requiredPermission, matchAgainst, isRestrictive) {
|
|
565
|
+
if (isRestrictive === void 0) { isRestrictive = false; }
|
|
566
|
+
if (!isCheckRequired(requiredPermission)) {
|
|
567
|
+
return true;
|
|
568
|
+
}
|
|
569
|
+
var accessValues = matchAgainst instanceof Set
|
|
570
|
+
? matchAgainst
|
|
571
|
+
: Array.isArray(matchAgainst) && isStringArray(matchAgainst)
|
|
572
|
+
? new Set(matchAgainst)
|
|
573
|
+
: typeof matchAgainst === 'string'
|
|
574
|
+
? new Set([matchAgainst])
|
|
575
|
+
: new Set();
|
|
576
|
+
if (typeof requiredPermission === 'object' && requiredPermission !== null) {
|
|
577
|
+
if (Array.isArray(requiredPermission)) {
|
|
578
|
+
return permissionTest('all', requiredPermission, accessValues, isRestrictive);
|
|
579
|
+
}
|
|
580
|
+
return (permissionTest('all', 'all' in requiredPermission ? requiredPermission.all : null, accessValues, isRestrictive) &&
|
|
581
|
+
permissionTest('some', 'some' in requiredPermission ? requiredPermission.some : null, accessValues, isRestrictive) &&
|
|
582
|
+
permissionTest('none', 'none' in requiredPermission ? requiredPermission.none : null, accessValues, isRestrictive));
|
|
583
|
+
}
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
function hasPermissions(requiredPermission, availableRoles, availableGroups, restrictedFeatures) {
|
|
587
|
+
if (!requiredPermission) {
|
|
588
|
+
return true;
|
|
589
|
+
}
|
|
590
|
+
if (!requiredPermission.available || !requiredPermission.enabled) {
|
|
591
|
+
return false;
|
|
592
|
+
}
|
|
593
|
+
return (hasUnitPermission(requiredPermission.groups, availableGroups) &&
|
|
594
|
+
hasUnitPermission(requiredPermission.roles, availableRoles) &&
|
|
595
|
+
hasUnitPermission(requiredPermission.features, restrictedFeatures, true));
|
|
596
|
+
}
|
|
440
597
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
598
|
+
var WidgetBaseComponent = /** @class */ (function () {
|
|
599
|
+
function WidgetBaseComponent() {
|
|
600
|
+
this.widgetType = '';
|
|
601
|
+
this.widgetSubType = '';
|
|
602
|
+
}
|
|
603
|
+
WidgetBaseComponent.prototype.updateBaseComponent = function (widgetType, widgetSubType, widgetInstanceId, widgetHostClass, widgetSafeStyle) {
|
|
604
|
+
this.widgetType = widgetType;
|
|
605
|
+
this.widgetSubType = widgetSubType;
|
|
606
|
+
this.widgetInstanceId = widgetInstanceId;
|
|
607
|
+
this.widgetHostClass = widgetHostClass;
|
|
608
|
+
this.widgetSafeStyle = widgetSafeStyle;
|
|
609
|
+
if (this.widgetHostClass) {
|
|
610
|
+
this.className = this.className + " " + this.widgetHostClass;
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
WidgetBaseComponent.prototype.ngAfterViewInit = function () {
|
|
614
|
+
var _this = this;
|
|
615
|
+
var hash = window.location.hash ? window.location.hash.split('#')[1] : '';
|
|
616
|
+
if (hash && !isNaN(hash) && hash === this.widgetInstanceId) {
|
|
617
|
+
setTimeout(function () {
|
|
618
|
+
var element = document.getElementById(_this.widgetInstanceId || '');
|
|
619
|
+
if (element) {
|
|
620
|
+
element.scrollIntoView();
|
|
621
|
+
}
|
|
622
|
+
}, 200);
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
return WidgetBaseComponent;
|
|
626
|
+
}());
|
|
627
|
+
WidgetBaseComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetBaseComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
628
|
+
WidgetBaseComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: 'Base Component', isInline: true });
|
|
629
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetBaseComponent, decorators: [{
|
|
630
|
+
type: i0.Component,
|
|
631
|
+
args: [{
|
|
632
|
+
selector: 'ws-resolver-base',
|
|
633
|
+
template: 'Base Component',
|
|
634
|
+
}]
|
|
635
|
+
}], propDecorators: { widgetType: [{
|
|
636
|
+
type: i0.Input
|
|
637
|
+
}], widgetSubType: [{
|
|
638
|
+
type: i0.Input
|
|
639
|
+
}], widgetHostClass: [{
|
|
640
|
+
type: i0.Input
|
|
641
|
+
}], widgetInstanceId: [{
|
|
642
|
+
type: i0.Input
|
|
643
|
+
}, {
|
|
644
|
+
type: i0.HostBinding,
|
|
645
|
+
args: ['id']
|
|
646
|
+
}], widgetSafeStyle: [{
|
|
647
|
+
type: i0.Input
|
|
648
|
+
}, {
|
|
649
|
+
type: i0.HostBinding,
|
|
650
|
+
args: ['style']
|
|
651
|
+
}], className: [{
|
|
652
|
+
type: i0.Input
|
|
653
|
+
}, {
|
|
654
|
+
type: i0.HostBinding,
|
|
655
|
+
args: ['class']
|
|
656
|
+
}] } });
|
|
474
657
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
? restrictedWidgetKeys
|
|
498
|
-
: new Set();
|
|
499
|
-
var registrationConfig = new Map();
|
|
500
|
-
var allWidgetsConfigurations = [];
|
|
501
|
-
if (this.globalConfig && Array.isArray(this.globalConfig)) {
|
|
502
|
-
allWidgetsConfigurations.push.apply(allWidgetsConfigurations, __spread(this.globalConfig));
|
|
503
|
-
}
|
|
504
|
-
if (this.scopedConfig && Array.isArray(this.scopedConfig)) {
|
|
505
|
-
allWidgetsConfigurations.push.apply(allWidgetsConfigurations, __spread(this.scopedConfig));
|
|
506
|
-
}
|
|
507
|
-
allWidgetsConfigurations.forEach((function (u) {
|
|
508
|
-
var key = WidgetResolverService.getWidgetKey(u);
|
|
509
|
-
if (!restrictedWidgetKeysSet.has(key)) {
|
|
510
|
-
registrationConfig.set(key, u);
|
|
511
|
-
}
|
|
512
|
-
}));
|
|
513
|
-
this.restrictedWidgetKeys = restrictedWidgetKeysSet;
|
|
514
|
-
this.availableRegisteredWidgets = registrationConfig;
|
|
515
|
-
this.isInitialized = true;
|
|
516
|
-
this.loggerSvc.log("Widget Configurations", this.globalConfig, this.scopedConfig, this.availableRegisteredWidgets);
|
|
517
|
-
};
|
|
518
|
-
WidgetResolverService.prototype.resolveWidget = function (receivedConfig, containerRef) {
|
|
519
|
-
var key = WidgetResolverService.getWidgetKey(receivedConfig);
|
|
520
|
-
if (this.restrictedWidgetKeys && this.restrictedWidgetKeys.has(key)) {
|
|
521
|
-
return this.widgetResolved(containerRef, receivedConfig, RestrictedComponent);
|
|
522
|
-
}
|
|
523
|
-
if (this.availableRegisteredWidgets && this.availableRegisteredWidgets.has(key)) {
|
|
524
|
-
if (hasPermissions(receivedConfig.widgetPermission, this.roles, this.groups, this.restrictedFeatures)) {
|
|
525
|
-
var config = this.availableRegisteredWidgets.get(key);
|
|
526
|
-
if (config && config.component) {
|
|
527
|
-
return this.widgetResolved(containerRef, receivedConfig, config.component);
|
|
528
|
-
}
|
|
529
|
-
return this.widgetResolved(containerRef, receivedConfig, InvalidRegistrationComponent);
|
|
530
|
-
}
|
|
531
|
-
return this.widgetResolved(containerRef, receivedConfig, InvalidPermissionComponent);
|
|
532
|
-
}
|
|
533
|
-
return this.widgetResolved(containerRef, receivedConfig, UnresolvedComponent);
|
|
534
|
-
};
|
|
535
|
-
WidgetResolverService.prototype.widgetResolved = function (containerRef, compData, component) {
|
|
536
|
-
var factory = this.componentFactoryResolver.resolveComponentFactory(component);
|
|
537
|
-
containerRef.clear();
|
|
538
|
-
var compRef = containerRef.createComponent(factory);
|
|
539
|
-
compRef.instance.widgetData = compData.widgetData;
|
|
540
|
-
if (compRef.instance.updateBaseComponent) {
|
|
541
|
-
var widgetSafeStyle = compData.widgetHostStyle
|
|
542
|
-
? this.domSanitizer.bypassSecurityTrustStyle(Object.entries(compData.widgetHostStyle).reduce((function (s, _a) {
|
|
543
|
-
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
|
544
|
-
return "" + s + k + ":" + v + ";";
|
|
545
|
-
}), ''))
|
|
546
|
-
: undefined;
|
|
547
|
-
compRef.instance.updateBaseComponent(compData.widgetType, compData.widgetSubType, compData.widgetInstanceId, compData.widgetHostClass, widgetSafeStyle);
|
|
548
|
-
}
|
|
549
|
-
return compRef;
|
|
550
|
-
};
|
|
551
|
-
WidgetResolverService.decorators = [
|
|
552
|
-
{ type: core.Injectable, args: [{
|
|
553
|
-
providedIn: 'root',
|
|
554
|
-
},] }
|
|
555
|
-
];
|
|
556
|
-
WidgetResolverService.ctorParameters = function () { return [
|
|
557
|
-
{ type: platformBrowser.DomSanitizer },
|
|
558
|
-
{ type: core.ComponentFactoryResolver },
|
|
559
|
-
{ type: utils.LoggerService },
|
|
560
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [WIDGET_RESOLVER_GLOBAL_CONFIG,] }] },
|
|
561
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [WIDGET_RESOLVER_SCOPED_CONFIG,] }] }
|
|
562
|
-
]; };
|
|
563
|
-
/** @nocollapse */ WidgetResolverService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function WidgetResolverService_Factory() { return new WidgetResolverService(core.ɵɵinject(platformBrowser.DomSanitizer), core.ɵɵinject(core.ComponentFactoryResolver), core.ɵɵinject(utils.LoggerService), core.ɵɵinject(WIDGET_RESOLVER_GLOBAL_CONFIG), core.ɵɵinject(WIDGET_RESOLVER_SCOPED_CONFIG)); }, token: WidgetResolverService, providedIn: "root" });
|
|
564
|
-
return WidgetResolverService;
|
|
565
|
-
}());
|
|
566
|
-
if (false) {
|
|
567
|
-
WidgetResolverService.prototype.roles;
|
|
568
|
-
WidgetResolverService.prototype.groups;
|
|
569
|
-
WidgetResolverService.prototype.restrictedFeatures;
|
|
570
|
-
WidgetResolverService.prototype.isInitialized;
|
|
571
|
-
WidgetResolverService.prototype.availableRegisteredWidgets;
|
|
572
|
-
WidgetResolverService.prototype.restrictedWidgetKeys;
|
|
573
|
-
WidgetResolverService.prototype.domSanitizer;
|
|
574
|
-
WidgetResolverService.prototype.componentFactoryResolver;
|
|
575
|
-
WidgetResolverService.prototype.loggerSvc;
|
|
576
|
-
WidgetResolverService.prototype.globalConfig;
|
|
577
|
-
WidgetResolverService.prototype.scopedConfig;
|
|
578
|
-
}
|
|
658
|
+
var RestrictedComponent = /** @class */ (function (_super) {
|
|
659
|
+
__extends(RestrictedComponent, _super);
|
|
660
|
+
function RestrictedComponent() {
|
|
661
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
662
|
+
_this.showData = true;
|
|
663
|
+
return _this;
|
|
664
|
+
}
|
|
665
|
+
RestrictedComponent.prototype.ngOnInit = function () { };
|
|
666
|
+
return RestrictedComponent;
|
|
667
|
+
}(WidgetBaseComponent));
|
|
668
|
+
RestrictedComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RestrictedComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
669
|
+
RestrictedComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RestrictedComponent, selector: "ws-resolver-restricted", inputs: { widgetData: "widgetData" }, usesInheritance: true, ngImport: i0__namespace, 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__namespace.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i1__namespace.MatCardHeader, selector: "mat-card-header" }, { type: i2__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3__namespace.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__namespace.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { type: i1__namespace.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "json": i4__namespace.JsonPipe } });
|
|
670
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RestrictedComponent, decorators: [{
|
|
671
|
+
type: i0.Component,
|
|
672
|
+
args: [{
|
|
673
|
+
selector: 'ws-resolver-restricted',
|
|
674
|
+
templateUrl: './restricted.component.html',
|
|
675
|
+
styleUrls: ['./restricted.component.scss'],
|
|
676
|
+
}]
|
|
677
|
+
}], propDecorators: { widgetData: [{
|
|
678
|
+
type: i0.Input
|
|
679
|
+
}] } });
|
|
579
680
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
681
|
+
var InvalidRegistrationComponent = /** @class */ (function (_super) {
|
|
682
|
+
__extends(InvalidRegistrationComponent, _super);
|
|
683
|
+
function InvalidRegistrationComponent() {
|
|
684
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
685
|
+
_this.showData = true;
|
|
686
|
+
return _this;
|
|
687
|
+
}
|
|
688
|
+
InvalidRegistrationComponent.prototype.ngOnInit = function () { };
|
|
689
|
+
return InvalidRegistrationComponent;
|
|
690
|
+
}(WidgetBaseComponent));
|
|
691
|
+
InvalidRegistrationComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: InvalidRegistrationComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
692
|
+
InvalidRegistrationComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: InvalidRegistrationComponent, selector: "ws-resolver-invalid-registration", inputs: { widgetData: "widgetData" }, usesInheritance: true, ngImport: i0__namespace, 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__namespace.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i1__namespace.MatCardHeader, selector: "mat-card-header" }, { type: i2__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3__namespace.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__namespace.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { type: i1__namespace.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "json": i4__namespace.JsonPipe } });
|
|
693
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: InvalidRegistrationComponent, decorators: [{
|
|
694
|
+
type: i0.Component,
|
|
695
|
+
args: [{
|
|
696
|
+
selector: 'ws-resolver-invalid-registration',
|
|
697
|
+
templateUrl: './invalid-registration.component.html',
|
|
698
|
+
styleUrls: ['./invalid-registration.component.scss'],
|
|
699
|
+
}]
|
|
700
|
+
}], propDecorators: { widgetData: [{
|
|
701
|
+
type: i0.Input
|
|
702
|
+
}] } });
|
|
703
|
+
|
|
704
|
+
var InvalidPermissionComponent = /** @class */ (function (_super) {
|
|
705
|
+
__extends(InvalidPermissionComponent, _super);
|
|
706
|
+
function InvalidPermissionComponent() {
|
|
707
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
708
|
+
_this.showData = true;
|
|
709
|
+
return _this;
|
|
710
|
+
}
|
|
711
|
+
InvalidPermissionComponent.prototype.ngOnInit = function () { };
|
|
712
|
+
return InvalidPermissionComponent;
|
|
713
|
+
}(WidgetBaseComponent));
|
|
714
|
+
InvalidPermissionComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: InvalidPermissionComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
715
|
+
InvalidPermissionComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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__namespace.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i1__namespace.MatCardHeader, selector: "mat-card-header" }, { type: i2__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3__namespace.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__namespace.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { type: i1__namespace.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "json": i4__namespace.JsonPipe } });
|
|
716
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: InvalidPermissionComponent, decorators: [{
|
|
717
|
+
type: i0.Component,
|
|
718
|
+
args: [{
|
|
719
|
+
selector: 'ws-resolver-invalid-permission',
|
|
720
|
+
templateUrl: './invalid-permission.component.html',
|
|
721
|
+
styleUrls: ['./invalid-permission.component.scss'],
|
|
722
|
+
}]
|
|
723
|
+
}], propDecorators: { widgetType: [{
|
|
724
|
+
type: i0.Input
|
|
725
|
+
}], widgetSubType: [{
|
|
726
|
+
type: i0.Input
|
|
727
|
+
}], widgetInstanceId: [{
|
|
728
|
+
type: i0.Input
|
|
729
|
+
}], widgetData: [{
|
|
730
|
+
type: i0.Input
|
|
731
|
+
}] } });
|
|
732
|
+
|
|
733
|
+
var UnresolvedComponent = /** @class */ (function (_super) {
|
|
734
|
+
__extends(UnresolvedComponent, _super);
|
|
735
|
+
function UnresolvedComponent() {
|
|
736
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
737
|
+
_this.showData = true;
|
|
738
|
+
_this.previewMode = false;
|
|
739
|
+
_this.searchArray = ['preview', 'channel'];
|
|
740
|
+
return _this;
|
|
741
|
+
}
|
|
742
|
+
UnresolvedComponent.prototype.ngOnInit = function () {
|
|
743
|
+
var url = window.location.href;
|
|
744
|
+
this.previewMode = this.searchArray.some(function (word) {
|
|
745
|
+
return url.indexOf(word) > -1;
|
|
746
|
+
});
|
|
747
|
+
};
|
|
748
|
+
return UnresolvedComponent;
|
|
749
|
+
}(WidgetBaseComponent));
|
|
750
|
+
UnresolvedComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: UnresolvedComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
751
|
+
UnresolvedComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: UnresolvedComponent, selector: "ws-resolver-unresolved", inputs: { widgetData: "widgetData" }, usesInheritance: true, ngImport: i0__namespace, 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__namespace.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i1__namespace.MatCardHeader, selector: "mat-card-header" }, { type: i2__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3__namespace.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__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1__namespace.MatCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { type: i1__namespace.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }], pipes: { "json": i4__namespace.JsonPipe } });
|
|
752
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: UnresolvedComponent, decorators: [{
|
|
753
|
+
type: i0.Component,
|
|
754
|
+
args: [{
|
|
755
|
+
selector: 'ws-resolver-unresolved',
|
|
756
|
+
templateUrl: './unresolved.component.html',
|
|
757
|
+
styleUrls: ['./unresolved.component.scss'],
|
|
758
|
+
}]
|
|
759
|
+
}], propDecorators: { widgetData: [{
|
|
760
|
+
type: i0.Input
|
|
761
|
+
}] } });
|
|
762
|
+
|
|
763
|
+
var WidgetResolverService = /** @class */ (function () {
|
|
764
|
+
function WidgetResolverService(domSanitizer, componentFactoryResolver, globalConfig, scopedConfig) {
|
|
765
|
+
this.domSanitizer = domSanitizer;
|
|
766
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
767
|
+
this.globalConfig = globalConfig;
|
|
768
|
+
this.scopedConfig = scopedConfig;
|
|
769
|
+
this.roles = null;
|
|
770
|
+
this.groups = null;
|
|
771
|
+
this.restrictedFeatures = null;
|
|
772
|
+
this.isInitialized = false;
|
|
773
|
+
this.availableRegisteredWidgets = null;
|
|
774
|
+
this.restrictedWidgetKeys = null;
|
|
775
|
+
}
|
|
776
|
+
WidgetResolverService.getWidgetKey = function (config) {
|
|
777
|
+
return "widget:" + config.widgetType + "::" + config.widgetSubType;
|
|
778
|
+
};
|
|
779
|
+
WidgetResolverService.prototype.initialize = function (restrictedWidgetKeys, roles, groups, restrictedFeatures) {
|
|
780
|
+
this.roles = roles;
|
|
781
|
+
this.groups = groups;
|
|
782
|
+
this.restrictedFeatures = restrictedFeatures;
|
|
783
|
+
var restrictedWidgetKeysSet = restrictedWidgetKeys
|
|
784
|
+
? restrictedWidgetKeys
|
|
785
|
+
: new Set();
|
|
786
|
+
var registrationConfig = new Map();
|
|
787
|
+
var allWidgetsConfigurations = [];
|
|
788
|
+
if (this.globalConfig && Array.isArray(this.globalConfig)) {
|
|
789
|
+
allWidgetsConfigurations.push.apply(allWidgetsConfigurations, __spreadArray([], __read(this.globalConfig)));
|
|
790
|
+
}
|
|
791
|
+
if (this.scopedConfig && Array.isArray(this.scopedConfig)) {
|
|
792
|
+
allWidgetsConfigurations.push.apply(allWidgetsConfigurations, __spreadArray([], __read(this.scopedConfig)));
|
|
793
|
+
}
|
|
794
|
+
allWidgetsConfigurations.forEach(function (u) {
|
|
795
|
+
var key = WidgetResolverService.getWidgetKey(u);
|
|
796
|
+
if (!restrictedWidgetKeysSet.has(key)) {
|
|
797
|
+
registrationConfig.set(key, u);
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
this.restrictedWidgetKeys = restrictedWidgetKeysSet;
|
|
801
|
+
this.availableRegisteredWidgets = registrationConfig;
|
|
802
|
+
this.isInitialized = true;
|
|
803
|
+
};
|
|
804
|
+
WidgetResolverService.prototype.resolveWidget = function (receivedConfig, containerRef) {
|
|
805
|
+
var key = WidgetResolverService.getWidgetKey(receivedConfig);
|
|
806
|
+
if (this.restrictedWidgetKeys && this.restrictedWidgetKeys.has(key)) {
|
|
807
|
+
return this.widgetResolved(containerRef, receivedConfig, RestrictedComponent);
|
|
808
|
+
}
|
|
809
|
+
if (this.availableRegisteredWidgets && this.availableRegisteredWidgets.has(key)) {
|
|
810
|
+
if (hasPermissions(receivedConfig.widgetPermission, this.roles, this.groups, this.restrictedFeatures)) {
|
|
811
|
+
var config = this.availableRegisteredWidgets.get(key);
|
|
812
|
+
if (config && config.component) {
|
|
813
|
+
return this.widgetResolved(containerRef, receivedConfig, config.component);
|
|
814
|
+
}
|
|
815
|
+
return this.widgetResolved(containerRef, receivedConfig, InvalidRegistrationComponent);
|
|
816
|
+
}
|
|
817
|
+
return this.widgetResolved(containerRef, receivedConfig, InvalidPermissionComponent);
|
|
818
|
+
}
|
|
819
|
+
return this.widgetResolved(containerRef, receivedConfig, UnresolvedComponent);
|
|
820
|
+
};
|
|
821
|
+
WidgetResolverService.prototype.widgetResolved = function (containerRef, compData, component) {
|
|
822
|
+
var factory = this.componentFactoryResolver.resolveComponentFactory(component);
|
|
823
|
+
containerRef.clear();
|
|
824
|
+
var compRef = containerRef.createComponent(factory);
|
|
825
|
+
compRef.instance.widgetData = compData.widgetData;
|
|
826
|
+
if (compRef.instance.updateBaseComponent) {
|
|
827
|
+
var widgetSafeStyle = compData.widgetHostStyle
|
|
828
|
+
? this.domSanitizer.bypassSecurityTrustStyle(Object.entries(compData.widgetHostStyle).reduce(function (s, _a) {
|
|
829
|
+
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
|
830
|
+
return "" + s + k + ":" + v + ";";
|
|
831
|
+
}, ''))
|
|
832
|
+
: undefined;
|
|
833
|
+
compRef.instance.updateBaseComponent(compData.widgetType, compData.widgetSubType, compData.widgetInstanceId, compData.widgetHostClass, widgetSafeStyle);
|
|
834
|
+
}
|
|
835
|
+
return compRef;
|
|
836
|
+
};
|
|
837
|
+
return WidgetResolverService;
|
|
838
|
+
}());
|
|
839
|
+
WidgetResolverService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetResolverService, deps: [{ token: i1__namespace$1.DomSanitizer }, { token: i0__namespace.ComponentFactoryResolver }, { token: WIDGET_RESOLVER_GLOBAL_CONFIG }, { token: WIDGET_RESOLVER_SCOPED_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
840
|
+
WidgetResolverService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetResolverService, providedIn: 'root' });
|
|
841
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetResolverService, decorators: [{
|
|
842
|
+
type: i0.Injectable,
|
|
843
|
+
args: [{
|
|
844
|
+
providedIn: 'root',
|
|
845
|
+
}]
|
|
846
|
+
}], ctorParameters: function () {
|
|
847
|
+
return [{ type: i1__namespace$1.DomSanitizer }, { type: i0__namespace.ComponentFactoryResolver }, { type: undefined, decorators: [{
|
|
848
|
+
type: i0.Inject,
|
|
849
|
+
args: [WIDGET_RESOLVER_GLOBAL_CONFIG]
|
|
850
|
+
}] }, { type: undefined, decorators: [{
|
|
851
|
+
type: i0.Inject,
|
|
852
|
+
args: [WIDGET_RESOLVER_SCOPED_CONFIG]
|
|
853
|
+
}] }];
|
|
854
|
+
} });
|
|
620
855
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
WidgetResolverModule.decorators = [
|
|
653
|
-
{ type: core.NgModule, args: [{
|
|
654
|
-
declarations: [
|
|
655
|
-
WidgetBaseComponent,
|
|
656
|
-
WidgetResolverDirective,
|
|
657
|
-
RestrictedComponent,
|
|
658
|
-
InvalidRegistrationComponent,
|
|
659
|
-
InvalidPermissionComponent,
|
|
660
|
-
UnresolvedComponent,
|
|
661
|
-
],
|
|
662
|
-
imports: [common.CommonModule, material.MatButtonModule, material.MatIconModule, material.MatCardModule],
|
|
663
|
-
exports: [WidgetResolverDirective, WidgetBaseComponent],
|
|
664
|
-
entryComponents: [
|
|
665
|
-
RestrictedComponent,
|
|
666
|
-
InvalidRegistrationComponent,
|
|
667
|
-
InvalidPermissionComponent,
|
|
668
|
-
UnresolvedComponent,
|
|
669
|
-
WidgetBaseComponent,
|
|
670
|
-
],
|
|
671
|
-
providers: [utils.ConfigurationsService],
|
|
672
|
-
},] }
|
|
673
|
-
];
|
|
674
|
-
return WidgetResolverModule;
|
|
675
|
-
}());
|
|
856
|
+
var WidgetResolverDirective = /** @class */ (function () {
|
|
857
|
+
function WidgetResolverDirective(viewContainerRef, widgetResolverSvc, logger) {
|
|
858
|
+
this.viewContainerRef = viewContainerRef;
|
|
859
|
+
this.widgetResolverSvc = widgetResolverSvc;
|
|
860
|
+
this.logger = logger;
|
|
861
|
+
this.wsResolverWidget = null;
|
|
862
|
+
}
|
|
863
|
+
WidgetResolverDirective.prototype.ngOnChanges = function () {
|
|
864
|
+
if (!this.widgetResolverSvc.isInitialized) {
|
|
865
|
+
this.logger.error('Widgets Registration Not Done. Used Before Initialization.', this.wsResolverWidget);
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
if (this.wsResolverWidget) {
|
|
869
|
+
var compRef = this.widgetResolverSvc.resolveWidget(this.wsResolverWidget, this.viewContainerRef);
|
|
870
|
+
if (compRef) {
|
|
871
|
+
compRef.changeDetectorRef.detectChanges();
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
return WidgetResolverDirective;
|
|
876
|
+
}());
|
|
877
|
+
WidgetResolverDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetResolverDirective, deps: [{ token: i0__namespace.ViewContainerRef }, { token: WidgetResolverService }, { token: i2__namespace$1.LoggerService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
878
|
+
WidgetResolverDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: WidgetResolverDirective, selector: "[wsResolverWidget]", inputs: { wsResolverWidget: "wsResolverWidget" }, usesOnChanges: true, ngImport: i0__namespace });
|
|
879
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetResolverDirective, decorators: [{
|
|
880
|
+
type: i0.Directive,
|
|
881
|
+
args: [{
|
|
882
|
+
selector: '[wsResolverWidget]',
|
|
883
|
+
}]
|
|
884
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ViewContainerRef }, { type: WidgetResolverService }, { type: i2__namespace$1.LoggerService }]; }, propDecorators: { wsResolverWidget: [{
|
|
885
|
+
type: i0.Input
|
|
886
|
+
}] } });
|
|
676
887
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
888
|
+
var WidgetResolverModule = /** @class */ (function () {
|
|
889
|
+
function WidgetResolverModule() {
|
|
890
|
+
}
|
|
891
|
+
WidgetResolverModule.forRoot = function (config) {
|
|
892
|
+
return {
|
|
893
|
+
ngModule: WidgetResolverModule,
|
|
894
|
+
providers: [
|
|
895
|
+
WidgetResolverService,
|
|
896
|
+
{
|
|
897
|
+
provide: WIDGET_RESOLVER_GLOBAL_CONFIG,
|
|
898
|
+
useValue: config,
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
provide: WIDGET_RESOLVER_SCOPED_CONFIG,
|
|
902
|
+
useValue: [],
|
|
903
|
+
},
|
|
904
|
+
],
|
|
905
|
+
};
|
|
906
|
+
};
|
|
907
|
+
WidgetResolverModule.forChild = function (config) {
|
|
908
|
+
return {
|
|
909
|
+
ngModule: WidgetResolverModule,
|
|
910
|
+
providers: [
|
|
911
|
+
WidgetResolverService,
|
|
912
|
+
{
|
|
913
|
+
provide: WIDGET_RESOLVER_SCOPED_CONFIG,
|
|
914
|
+
useValue: config,
|
|
915
|
+
},
|
|
916
|
+
],
|
|
917
|
+
};
|
|
918
|
+
};
|
|
919
|
+
return WidgetResolverModule;
|
|
920
|
+
}());
|
|
921
|
+
WidgetResolverModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetResolverModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
922
|
+
WidgetResolverModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetResolverModule, declarations: [WidgetBaseComponent,
|
|
923
|
+
WidgetResolverDirective,
|
|
924
|
+
RestrictedComponent,
|
|
925
|
+
InvalidRegistrationComponent,
|
|
926
|
+
InvalidPermissionComponent,
|
|
927
|
+
UnresolvedComponent], imports: [i4.CommonModule, i3.MatButtonModule, i2.MatIconModule, i1.MatCardModule], exports: [WidgetResolverDirective, WidgetBaseComponent] });
|
|
928
|
+
WidgetResolverModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetResolverModule, providers: [i2$1.ConfigurationsService], imports: [[i4.CommonModule, i3.MatButtonModule, i2.MatIconModule, i1.MatCardModule]] });
|
|
929
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WidgetResolverModule, decorators: [{
|
|
930
|
+
type: i0.NgModule,
|
|
931
|
+
args: [{
|
|
932
|
+
declarations: [
|
|
933
|
+
WidgetBaseComponent,
|
|
934
|
+
WidgetResolverDirective,
|
|
935
|
+
RestrictedComponent,
|
|
936
|
+
InvalidRegistrationComponent,
|
|
937
|
+
InvalidPermissionComponent,
|
|
938
|
+
UnresolvedComponent,
|
|
939
|
+
],
|
|
940
|
+
imports: [i4.CommonModule, i3.MatButtonModule, i2.MatIconModule, i1.MatCardModule],
|
|
941
|
+
exports: [WidgetResolverDirective, WidgetBaseComponent],
|
|
942
|
+
entryComponents: [
|
|
943
|
+
RestrictedComponent,
|
|
944
|
+
InvalidRegistrationComponent,
|
|
945
|
+
InvalidPermissionComponent,
|
|
946
|
+
UnresolvedComponent,
|
|
947
|
+
WidgetBaseComponent,
|
|
948
|
+
],
|
|
949
|
+
providers: [i2$1.ConfigurationsService],
|
|
950
|
+
}]
|
|
951
|
+
}] });
|
|
733
952
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
exports.ɵb = WIDGET_RESOLVER_GLOBAL_CONFIG;
|
|
741
|
-
exports.ɵc = WIDGET_RESOLVER_SCOPED_CONFIG;
|
|
742
|
-
exports.ɵe = RestrictedComponent;
|
|
743
|
-
exports.ɵf = InvalidRegistrationComponent;
|
|
744
|
-
exports.ɵg = InvalidPermissionComponent;
|
|
745
|
-
exports.ɵh = UnresolvedComponent;
|
|
953
|
+
exports.WidgetBaseComponent = WidgetBaseComponent;
|
|
954
|
+
exports.WidgetResolverDirective = WidgetResolverDirective;
|
|
955
|
+
exports.WidgetResolverModule = WidgetResolverModule;
|
|
956
|
+
exports.WidgetResolverService = WidgetResolverService;
|
|
957
|
+
exports.hasPermissions = hasPermissions;
|
|
958
|
+
exports.hasUnitPermission = hasUnitPermission;
|
|
746
959
|
|
|
747
|
-
|
|
960
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
748
961
|
|
|
749
|
-
}))
|
|
962
|
+
}));
|
|
750
963
|
//# sourceMappingURL=sunbird-cb-resolver.umd.js.map
|