@abp/ng.permission-management 5.0.1 → 5.0.2

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.
Files changed (38) hide show
  1. package/README.md +3 -3
  2. package/abp-ng.permission-management.d.ts +5 -5
  3. package/bundles/abp-ng.permission-management-proxy.umd.js +28 -28
  4. package/bundles/abp-ng.permission-management-proxy.umd.js.map +1 -1
  5. package/bundles/abp-ng.permission-management.umd.js +569 -569
  6. package/bundles/abp-ng.permission-management.umd.js.map +1 -1
  7. package/esm2015/abp-ng.permission-management.js +4 -4
  8. package/esm2015/lib/components/index.js +2 -2
  9. package/esm2015/lib/components/permission-management.component.js +231 -231
  10. package/esm2015/lib/enums/components.js +2 -2
  11. package/esm2015/lib/models/index.js +2 -2
  12. package/esm2015/lib/models/permission-management.js +2 -2
  13. package/esm2015/lib/permission-management.module.js +19 -19
  14. package/esm2015/proxy/abp-ng.permission-management-proxy.js +4 -4
  15. package/esm2015/proxy/lib/index.js +2 -2
  16. package/esm2015/proxy/lib/proxy/index.js +3 -3
  17. package/esm2015/proxy/lib/proxy/models.js +2 -2
  18. package/esm2015/proxy/lib/proxy/permissions.service.js +30 -30
  19. package/esm2015/proxy/public-api.js +2 -2
  20. package/esm2015/public-api.js +5 -5
  21. package/fesm2015/abp-ng.permission-management-proxy.js +26 -26
  22. package/fesm2015/abp-ng.permission-management-proxy.js.map +1 -1
  23. package/fesm2015/abp-ng.permission-management.js +232 -232
  24. package/fesm2015/abp-ng.permission-management.js.map +1 -1
  25. package/lib/components/index.d.ts +1 -1
  26. package/lib/components/permission-management.component.d.ts +49 -49
  27. package/lib/enums/components.d.ts +3 -3
  28. package/lib/models/index.d.ts +1 -1
  29. package/lib/models/permission-management.d.ts +16 -16
  30. package/lib/permission-management.module.d.ts +9 -9
  31. package/package.json +3 -3
  32. package/proxy/abp-ng.permission-management-proxy.d.ts +5 -5
  33. package/proxy/lib/index.d.ts +1 -1
  34. package/proxy/lib/proxy/index.d.ts +2 -2
  35. package/proxy/lib/proxy/models.d.ts +28 -28
  36. package/proxy/lib/proxy/permissions.service.d.ts +12 -12
  37. package/proxy/public-api.d.ts +1 -1
  38. package/public-api.d.ts +4 -4
@@ -29,581 +29,581 @@
29
29
  var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
30
30
  var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
31
31
 
32
- /*! *****************************************************************************
33
- Copyright (c) Microsoft Corporation.
34
-
35
- Permission to use, copy, modify, and/or distribute this software for any
36
- purpose with or without fee is hereby granted.
37
-
38
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
- PERFORMANCE OF THIS SOFTWARE.
45
- ***************************************************************************** */
46
- /* global Reflect, Promise */
47
- var extendStatics = function (d, b) {
48
- extendStatics = Object.setPrototypeOf ||
49
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
50
- function (d, b) { for (var p in b)
51
- if (Object.prototype.hasOwnProperty.call(b, p))
52
- d[p] = b[p]; };
53
- return extendStatics(d, b);
54
- };
55
- function __extends(d, b) {
56
- if (typeof b !== "function" && b !== null)
57
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
58
- extendStatics(d, b);
59
- function __() { this.constructor = d; }
60
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
61
- }
62
- var __assign = function () {
63
- __assign = Object.assign || function __assign(t) {
64
- for (var s, i = 1, n = arguments.length; i < n; i++) {
65
- s = arguments[i];
66
- for (var p in s)
67
- if (Object.prototype.hasOwnProperty.call(s, p))
68
- t[p] = s[p];
69
- }
70
- return t;
71
- };
72
- return __assign.apply(this, arguments);
73
- };
74
- function __rest(s, e) {
75
- var t = {};
76
- for (var p in s)
77
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
78
- t[p] = s[p];
79
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
80
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
81
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
82
- t[p[i]] = s[p[i]];
83
- }
84
- return t;
85
- }
86
- function __decorate(decorators, target, key, desc) {
87
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
88
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
89
- r = Reflect.decorate(decorators, target, key, desc);
90
- else
91
- for (var i = decorators.length - 1; i >= 0; i--)
92
- if (d = decorators[i])
93
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
94
- return c > 3 && r && Object.defineProperty(target, key, r), r;
95
- }
96
- function __param(paramIndex, decorator) {
97
- return function (target, key) { decorator(target, key, paramIndex); };
98
- }
99
- function __metadata(metadataKey, metadataValue) {
100
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
101
- return Reflect.metadata(metadataKey, metadataValue);
102
- }
103
- function __awaiter(thisArg, _arguments, P, generator) {
104
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
105
- return new (P || (P = Promise))(function (resolve, reject) {
106
- function fulfilled(value) { try {
107
- step(generator.next(value));
108
- }
109
- catch (e) {
110
- reject(e);
111
- } }
112
- function rejected(value) { try {
113
- step(generator["throw"](value));
114
- }
115
- catch (e) {
116
- reject(e);
117
- } }
118
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
119
- step((generator = generator.apply(thisArg, _arguments || [])).next());
120
- });
121
- }
122
- function __generator(thisArg, body) {
123
- var _ = { label: 0, sent: function () { if (t[0] & 1)
124
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
125
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
126
- function verb(n) { return function (v) { return step([n, v]); }; }
127
- function step(op) {
128
- if (f)
129
- throw new TypeError("Generator is already executing.");
130
- while (_)
131
- try {
132
- 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)
133
- return t;
134
- if (y = 0, t)
135
- op = [op[0] & 2, t.value];
136
- switch (op[0]) {
137
- case 0:
138
- case 1:
139
- t = op;
140
- break;
141
- case 4:
142
- _.label++;
143
- return { value: op[1], done: false };
144
- case 5:
145
- _.label++;
146
- y = op[1];
147
- op = [0];
148
- continue;
149
- case 7:
150
- op = _.ops.pop();
151
- _.trys.pop();
152
- continue;
153
- default:
154
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
155
- _ = 0;
156
- continue;
157
- }
158
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
159
- _.label = op[1];
160
- break;
161
- }
162
- if (op[0] === 6 && _.label < t[1]) {
163
- _.label = t[1];
164
- t = op;
165
- break;
166
- }
167
- if (t && _.label < t[2]) {
168
- _.label = t[2];
169
- _.ops.push(op);
170
- break;
171
- }
172
- if (t[2])
173
- _.ops.pop();
174
- _.trys.pop();
175
- continue;
176
- }
177
- op = body.call(thisArg, _);
178
- }
179
- catch (e) {
180
- op = [6, e];
181
- y = 0;
182
- }
183
- finally {
184
- f = t = 0;
185
- }
186
- if (op[0] & 5)
187
- throw op[1];
188
- return { value: op[0] ? op[1] : void 0, done: true };
189
- }
190
- }
191
- var __createBinding = Object.create ? (function (o, m, k, k2) {
192
- if (k2 === undefined)
193
- k2 = k;
194
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
195
- }) : (function (o, m, k, k2) {
196
- if (k2 === undefined)
197
- k2 = k;
198
- o[k2] = m[k];
199
- });
200
- function __exportStar(m, o) {
201
- for (var p in m)
202
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
203
- __createBinding(o, m, p);
204
- }
205
- function __values(o) {
206
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
207
- if (m)
208
- return m.call(o);
209
- if (o && typeof o.length === "number")
210
- return {
211
- next: function () {
212
- if (o && i >= o.length)
213
- o = void 0;
214
- return { value: o && o[i++], done: !o };
215
- }
216
- };
217
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
218
- }
219
- function __read(o, n) {
220
- var m = typeof Symbol === "function" && o[Symbol.iterator];
221
- if (!m)
222
- return o;
223
- var i = m.call(o), r, ar = [], e;
224
- try {
225
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
226
- ar.push(r.value);
227
- }
228
- catch (error) {
229
- e = { error: error };
230
- }
231
- finally {
232
- try {
233
- if (r && !r.done && (m = i["return"]))
234
- m.call(i);
235
- }
236
- finally {
237
- if (e)
238
- throw e.error;
239
- }
240
- }
241
- return ar;
242
- }
243
- /** @deprecated */
244
- function __spread() {
245
- for (var ar = [], i = 0; i < arguments.length; i++)
246
- ar = ar.concat(__read(arguments[i]));
247
- return ar;
248
- }
249
- /** @deprecated */
250
- function __spreadArrays() {
251
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
252
- s += arguments[i].length;
253
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
254
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
255
- r[k] = a[j];
256
- return r;
257
- }
258
- function __spreadArray(to, from, pack) {
259
- if (pack || arguments.length === 2)
260
- for (var i = 0, l = from.length, ar; i < l; i++) {
261
- if (ar || !(i in from)) {
262
- if (!ar)
263
- ar = Array.prototype.slice.call(from, 0, i);
264
- ar[i] = from[i];
265
- }
266
- }
267
- return to.concat(ar || Array.prototype.slice.call(from));
268
- }
269
- function __await(v) {
270
- return this instanceof __await ? (this.v = v, this) : new __await(v);
271
- }
272
- function __asyncGenerator(thisArg, _arguments, generator) {
273
- if (!Symbol.asyncIterator)
274
- throw new TypeError("Symbol.asyncIterator is not defined.");
275
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
276
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
277
- function verb(n) { if (g[n])
278
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
279
- function resume(n, v) { try {
280
- step(g[n](v));
281
- }
282
- catch (e) {
283
- settle(q[0][3], e);
284
- } }
285
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
286
- function fulfill(value) { resume("next", value); }
287
- function reject(value) { resume("throw", value); }
288
- function settle(f, v) { if (f(v), q.shift(), q.length)
289
- resume(q[0][0], q[0][1]); }
290
- }
291
- function __asyncDelegator(o) {
292
- var i, p;
293
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
294
- 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; }
295
- }
296
- function __asyncValues(o) {
297
- if (!Symbol.asyncIterator)
298
- throw new TypeError("Symbol.asyncIterator is not defined.");
299
- var m = o[Symbol.asyncIterator], i;
300
- 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);
301
- 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); }); }; }
302
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
303
- }
304
- function __makeTemplateObject(cooked, raw) {
305
- if (Object.defineProperty) {
306
- Object.defineProperty(cooked, "raw", { value: raw });
307
- }
308
- else {
309
- cooked.raw = raw;
310
- }
311
- return cooked;
312
- }
313
- ;
314
- var __setModuleDefault = Object.create ? (function (o, v) {
315
- Object.defineProperty(o, "default", { enumerable: true, value: v });
316
- }) : function (o, v) {
317
- o["default"] = v;
318
- };
319
- function __importStar(mod) {
320
- if (mod && mod.__esModule)
321
- return mod;
322
- var result = {};
323
- if (mod != null)
324
- for (var k in mod)
325
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
326
- __createBinding(result, mod, k);
327
- __setModuleDefault(result, mod);
328
- return result;
329
- }
330
- function __importDefault(mod) {
331
- return (mod && mod.__esModule) ? mod : { default: mod };
332
- }
333
- function __classPrivateFieldGet(receiver, state, kind, f) {
334
- if (kind === "a" && !f)
335
- throw new TypeError("Private accessor was defined without a getter");
336
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
337
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
338
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
339
- }
340
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
341
- if (kind === "m")
342
- throw new TypeError("Private method is not writable");
343
- if (kind === "a" && !f)
344
- throw new TypeError("Private accessor was defined without a setter");
345
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
346
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
347
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
32
+ /*! *****************************************************************************
33
+ Copyright (c) Microsoft Corporation.
34
+
35
+ Permission to use, copy, modify, and/or distribute this software for any
36
+ purpose with or without fee is hereby granted.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
+ PERFORMANCE OF THIS SOFTWARE.
45
+ ***************************************************************************** */
46
+ /* global Reflect, Promise */
47
+ var extendStatics = function (d, b) {
48
+ extendStatics = Object.setPrototypeOf ||
49
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
50
+ function (d, b) { for (var p in b)
51
+ if (Object.prototype.hasOwnProperty.call(b, p))
52
+ d[p] = b[p]; };
53
+ return extendStatics(d, b);
54
+ };
55
+ function __extends(d, b) {
56
+ if (typeof b !== "function" && b !== null)
57
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
58
+ extendStatics(d, b);
59
+ function __() { this.constructor = d; }
60
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
61
+ }
62
+ var __assign = function () {
63
+ __assign = Object.assign || function __assign(t) {
64
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
65
+ s = arguments[i];
66
+ for (var p in s)
67
+ if (Object.prototype.hasOwnProperty.call(s, p))
68
+ t[p] = s[p];
69
+ }
70
+ return t;
71
+ };
72
+ return __assign.apply(this, arguments);
73
+ };
74
+ function __rest(s, e) {
75
+ var t = {};
76
+ for (var p in s)
77
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
78
+ t[p] = s[p];
79
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
80
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
81
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
82
+ t[p[i]] = s[p[i]];
83
+ }
84
+ return t;
85
+ }
86
+ function __decorate(decorators, target, key, desc) {
87
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
88
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
89
+ r = Reflect.decorate(decorators, target, key, desc);
90
+ else
91
+ for (var i = decorators.length - 1; i >= 0; i--)
92
+ if (d = decorators[i])
93
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
94
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
95
+ }
96
+ function __param(paramIndex, decorator) {
97
+ return function (target, key) { decorator(target, key, paramIndex); };
98
+ }
99
+ function __metadata(metadataKey, metadataValue) {
100
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
101
+ return Reflect.metadata(metadataKey, metadataValue);
102
+ }
103
+ function __awaiter(thisArg, _arguments, P, generator) {
104
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
105
+ return new (P || (P = Promise))(function (resolve, reject) {
106
+ function fulfilled(value) { try {
107
+ step(generator.next(value));
108
+ }
109
+ catch (e) {
110
+ reject(e);
111
+ } }
112
+ function rejected(value) { try {
113
+ step(generator["throw"](value));
114
+ }
115
+ catch (e) {
116
+ reject(e);
117
+ } }
118
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
119
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
120
+ });
121
+ }
122
+ function __generator(thisArg, body) {
123
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
124
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
125
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
126
+ function verb(n) { return function (v) { return step([n, v]); }; }
127
+ function step(op) {
128
+ if (f)
129
+ throw new TypeError("Generator is already executing.");
130
+ while (_)
131
+ try {
132
+ 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)
133
+ return t;
134
+ if (y = 0, t)
135
+ op = [op[0] & 2, t.value];
136
+ switch (op[0]) {
137
+ case 0:
138
+ case 1:
139
+ t = op;
140
+ break;
141
+ case 4:
142
+ _.label++;
143
+ return { value: op[1], done: false };
144
+ case 5:
145
+ _.label++;
146
+ y = op[1];
147
+ op = [0];
148
+ continue;
149
+ case 7:
150
+ op = _.ops.pop();
151
+ _.trys.pop();
152
+ continue;
153
+ default:
154
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
155
+ _ = 0;
156
+ continue;
157
+ }
158
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
159
+ _.label = op[1];
160
+ break;
161
+ }
162
+ if (op[0] === 6 && _.label < t[1]) {
163
+ _.label = t[1];
164
+ t = op;
165
+ break;
166
+ }
167
+ if (t && _.label < t[2]) {
168
+ _.label = t[2];
169
+ _.ops.push(op);
170
+ break;
171
+ }
172
+ if (t[2])
173
+ _.ops.pop();
174
+ _.trys.pop();
175
+ continue;
176
+ }
177
+ op = body.call(thisArg, _);
178
+ }
179
+ catch (e) {
180
+ op = [6, e];
181
+ y = 0;
182
+ }
183
+ finally {
184
+ f = t = 0;
185
+ }
186
+ if (op[0] & 5)
187
+ throw op[1];
188
+ return { value: op[0] ? op[1] : void 0, done: true };
189
+ }
190
+ }
191
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
192
+ if (k2 === undefined)
193
+ k2 = k;
194
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
195
+ }) : (function (o, m, k, k2) {
196
+ if (k2 === undefined)
197
+ k2 = k;
198
+ o[k2] = m[k];
199
+ });
200
+ function __exportStar(m, o) {
201
+ for (var p in m)
202
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
203
+ __createBinding(o, m, p);
204
+ }
205
+ function __values(o) {
206
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
207
+ if (m)
208
+ return m.call(o);
209
+ if (o && typeof o.length === "number")
210
+ return {
211
+ next: function () {
212
+ if (o && i >= o.length)
213
+ o = void 0;
214
+ return { value: o && o[i++], done: !o };
215
+ }
216
+ };
217
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
218
+ }
219
+ function __read(o, n) {
220
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
221
+ if (!m)
222
+ return o;
223
+ var i = m.call(o), r, ar = [], e;
224
+ try {
225
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
226
+ ar.push(r.value);
227
+ }
228
+ catch (error) {
229
+ e = { error: error };
230
+ }
231
+ finally {
232
+ try {
233
+ if (r && !r.done && (m = i["return"]))
234
+ m.call(i);
235
+ }
236
+ finally {
237
+ if (e)
238
+ throw e.error;
239
+ }
240
+ }
241
+ return ar;
242
+ }
243
+ /** @deprecated */
244
+ function __spread() {
245
+ for (var ar = [], i = 0; i < arguments.length; i++)
246
+ ar = ar.concat(__read(arguments[i]));
247
+ return ar;
248
+ }
249
+ /** @deprecated */
250
+ function __spreadArrays() {
251
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
252
+ s += arguments[i].length;
253
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
254
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
255
+ r[k] = a[j];
256
+ return r;
257
+ }
258
+ function __spreadArray(to, from, pack) {
259
+ if (pack || arguments.length === 2)
260
+ for (var i = 0, l = from.length, ar; i < l; i++) {
261
+ if (ar || !(i in from)) {
262
+ if (!ar)
263
+ ar = Array.prototype.slice.call(from, 0, i);
264
+ ar[i] = from[i];
265
+ }
266
+ }
267
+ return to.concat(ar || Array.prototype.slice.call(from));
268
+ }
269
+ function __await(v) {
270
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
271
+ }
272
+ function __asyncGenerator(thisArg, _arguments, generator) {
273
+ if (!Symbol.asyncIterator)
274
+ throw new TypeError("Symbol.asyncIterator is not defined.");
275
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
276
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
277
+ function verb(n) { if (g[n])
278
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
279
+ function resume(n, v) { try {
280
+ step(g[n](v));
281
+ }
282
+ catch (e) {
283
+ settle(q[0][3], e);
284
+ } }
285
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
286
+ function fulfill(value) { resume("next", value); }
287
+ function reject(value) { resume("throw", value); }
288
+ function settle(f, v) { if (f(v), q.shift(), q.length)
289
+ resume(q[0][0], q[0][1]); }
290
+ }
291
+ function __asyncDelegator(o) {
292
+ var i, p;
293
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
294
+ 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; }
295
+ }
296
+ function __asyncValues(o) {
297
+ if (!Symbol.asyncIterator)
298
+ throw new TypeError("Symbol.asyncIterator is not defined.");
299
+ var m = o[Symbol.asyncIterator], i;
300
+ 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);
301
+ 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); }); }; }
302
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
303
+ }
304
+ function __makeTemplateObject(cooked, raw) {
305
+ if (Object.defineProperty) {
306
+ Object.defineProperty(cooked, "raw", { value: raw });
307
+ }
308
+ else {
309
+ cooked.raw = raw;
310
+ }
311
+ return cooked;
312
+ }
313
+ ;
314
+ var __setModuleDefault = Object.create ? (function (o, v) {
315
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
316
+ }) : function (o, v) {
317
+ o["default"] = v;
318
+ };
319
+ function __importStar(mod) {
320
+ if (mod && mod.__esModule)
321
+ return mod;
322
+ var result = {};
323
+ if (mod != null)
324
+ for (var k in mod)
325
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
326
+ __createBinding(result, mod, k);
327
+ __setModuleDefault(result, mod);
328
+ return result;
329
+ }
330
+ function __importDefault(mod) {
331
+ return (mod && mod.__esModule) ? mod : { default: mod };
332
+ }
333
+ function __classPrivateFieldGet(receiver, state, kind, f) {
334
+ if (kind === "a" && !f)
335
+ throw new TypeError("Private accessor was defined without a getter");
336
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
337
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
338
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
339
+ }
340
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
341
+ if (kind === "m")
342
+ throw new TypeError("Private method is not writable");
343
+ if (kind === "a" && !f)
344
+ throw new TypeError("Private accessor was defined without a setter");
345
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
346
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
347
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
348
348
  }
349
349
 
350
- var PermissionManagementComponent = /** @class */ (function () {
351
- function PermissionManagementComponent(service, configState) {
352
- this.service = service;
353
- this.configState = configState;
354
- this.hideBadges = false;
355
- this._visible = false;
356
- this.visibleChange = new i0.EventEmitter();
357
- this.data = { groups: [], entityDisplayName: null };
358
- this.permissions = [];
359
- this.selectThisTab = false;
360
- this.selectAllTab = false;
361
- this.modalBusy = false;
362
- this.trackByFn = function (_, item) { return item.name; };
363
- }
364
- Object.defineProperty(PermissionManagementComponent.prototype, "visible", {
365
- get: function () {
366
- return this._visible;
367
- },
368
- set: function (value) {
369
- var _this = this;
370
- if (value === this._visible)
371
- return;
372
- if (value) {
373
- this.openModal().subscribe(function () {
374
- _this._visible = true;
375
- _this.visibleChange.emit(true);
376
- rxjs.concat(_this.selectAllInAllTabsRef.changes, _this.selectAllInThisTabsRef.changes)
377
- .pipe(operators.take(1))
378
- .subscribe(function () {
379
- _this.initModal();
380
- });
381
- });
382
- }
383
- else {
384
- this.selectedGroup = null;
385
- this._visible = false;
386
- this.visibleChange.emit(false);
387
- }
388
- },
389
- enumerable: false,
390
- configurable: true
391
- });
392
- Object.defineProperty(PermissionManagementComponent.prototype, "selectedGroupPermissions", {
393
- get: function () {
394
- var _this = this;
395
- if (!this.selectedGroup)
396
- return [];
397
- var margin = "margin-" + (document.body.dir === 'rtl' ? 'right' : 'left') + ".px";
398
- var permissions = this.data.groups.find(function (group) { return group.name === _this.selectedGroup.name; }).permissions;
399
- return permissions.map(function (permission) {
400
- var _a;
401
- return (Object.assign(Object.assign({}, permission), { style: (_a = {}, _a[margin] = findMargin(permissions, permission), _a), isGranted: _this.permissions.find(function (per) { return per.name === permission.name; }).isGranted }));
402
- });
403
- },
404
- enumerable: false,
405
- configurable: true
406
- });
407
- PermissionManagementComponent.prototype.getChecked = function (name) {
408
- return (this.permissions.find(function (per) { return per.name === name; }) || { isGranted: false }).isGranted;
409
- };
410
- PermissionManagementComponent.prototype.isGrantedByOtherProviderName = function (grantedProviders) {
411
- var _this = this;
412
- if (grantedProviders.length) {
413
- return grantedProviders.findIndex(function (p) { return p.providerName !== _this.providerName; }) > -1;
414
- }
415
- return false;
416
- };
417
- PermissionManagementComponent.prototype.onClickCheckbox = function (clickedPermission, value) {
418
- var _this = this;
419
- if (clickedPermission.isGranted &&
420
- this.isGrantedByOtherProviderName(clickedPermission.grantedProviders))
421
- return;
422
- setTimeout(function () {
423
- _this.permissions = _this.permissions.map(function (per) {
424
- if (clickedPermission.name === per.name) {
425
- return Object.assign(Object.assign({}, per), { isGranted: !per.isGranted });
426
- }
427
- else if (clickedPermission.name === per.parentName && clickedPermission.isGranted) {
428
- return Object.assign(Object.assign({}, per), { isGranted: false });
429
- }
430
- else if (clickedPermission.parentName === per.name && !clickedPermission.isGranted) {
431
- return Object.assign(Object.assign({}, per), { isGranted: true });
432
- }
433
- return per;
434
- });
435
- _this.setTabCheckboxState();
436
- _this.setGrantCheckboxState();
437
- }, 0);
438
- };
439
- PermissionManagementComponent.prototype.setTabCheckboxState = function () {
440
- var selectedPermissions = this.selectedGroupPermissions.filter(function (per) { return per.isGranted; });
441
- var element = document.querySelector('#select-all-in-this-tabs');
442
- if (selectedPermissions.length === this.selectedGroupPermissions.length) {
443
- element.indeterminate = false;
444
- this.selectThisTab = true;
445
- }
446
- else if (selectedPermissions.length === 0) {
447
- element.indeterminate = false;
448
- this.selectThisTab = false;
449
- }
450
- else {
451
- element.indeterminate = true;
452
- }
453
- };
454
- PermissionManagementComponent.prototype.setGrantCheckboxState = function () {
455
- var selectedAllPermissions = this.permissions.filter(function (per) { return per.isGranted; });
456
- var checkboxElement = document.querySelector('#select-all-in-all-tabs');
457
- if (selectedAllPermissions.length === this.permissions.length) {
458
- checkboxElement.indeterminate = false;
459
- this.selectAllTab = true;
460
- }
461
- else if (selectedAllPermissions.length === 0) {
462
- checkboxElement.indeterminate = false;
463
- this.selectAllTab = false;
464
- }
465
- else {
466
- checkboxElement.indeterminate = true;
467
- }
468
- };
469
- PermissionManagementComponent.prototype.onClickSelectThisTab = function () {
470
- var _this = this;
471
- this.selectedGroupPermissions.forEach(function (permission) {
472
- if (permission.isGranted && _this.isGrantedByOtherProviderName(permission.grantedProviders))
473
- return;
474
- var index = _this.permissions.findIndex(function (per) { return per.name === permission.name; });
475
- _this.permissions = __spreadArray(__spreadArray(__spreadArray([], __read(_this.permissions.slice(0, index))), [
476
- Object.assign(Object.assign({}, _this.permissions[index]), { isGranted: !_this.selectThisTab })
477
- ]), __read(_this.permissions.slice(index + 1)));
478
- });
479
- this.setGrantCheckboxState();
480
- };
481
- PermissionManagementComponent.prototype.onClickSelectAll = function () {
482
- var _this = this;
483
- this.permissions = this.permissions.map(function (permission) { return (Object.assign(Object.assign({}, permission), { isGranted: _this.isGrantedByOtherProviderName(permission.grantedProviders) || !_this.selectAllTab })); });
484
- this.selectThisTab = !this.selectAllTab;
485
- };
486
- PermissionManagementComponent.prototype.onChangeGroup = function (group) {
487
- this.selectedGroup = group;
488
- this.setTabCheckboxState();
489
- };
490
- PermissionManagementComponent.prototype.submit = function () {
491
- var _this = this;
492
- var unchangedPermissions = getPermissions(this.data.groups);
493
- var changedPermissions = this.permissions
494
- .filter(function (per) { return unchangedPermissions.find(function (unchanged) { return unchanged.name === per.name; }).isGranted ===
495
- per.isGranted
496
- ? false
497
- : true; })
498
- .map(function (_a) {
499
- var name = _a.name, isGranted = _a.isGranted;
500
- return ({ name: name, isGranted: isGranted });
501
- });
502
- if (!changedPermissions.length) {
503
- this.visible = false;
504
- return;
505
- }
506
- this.modalBusy = true;
507
- this.service
508
- .update(this.providerName, this.providerKey, { permissions: changedPermissions })
509
- .pipe(operators.switchMap(function () { return _this.shouldFetchAppConfig() ? _this.configState.refreshAppState() : rxjs.of(null); }), operators.finalize(function () { return (_this.modalBusy = false); }))
510
- .subscribe(function () {
511
- _this.visible = false;
512
- });
513
- };
514
- PermissionManagementComponent.prototype.openModal = function () {
515
- var _this = this;
516
- if (!this.providerKey || !this.providerName) {
517
- throw new Error('Provider Key and Provider Name are required.');
518
- }
519
- return this.service.get(this.providerName, this.providerKey).pipe(operators.tap(function (permissionRes) {
520
- _this.data = permissionRes;
521
- _this.selectedGroup = permissionRes.groups[0];
522
- _this.permissions = getPermissions(permissionRes.groups);
523
- }));
524
- };
525
- PermissionManagementComponent.prototype.initModal = function () {
526
- var _this = this;
527
- // TODO: Refactor
528
- setTimeout(function () {
529
- _this.setTabCheckboxState();
530
- _this.setGrantCheckboxState();
531
- });
532
- };
533
- PermissionManagementComponent.prototype.getAssignedCount = function (groupName) {
534
- return this.permissions.reduce(function (acc, val) { return (val.groupName === groupName && val.isGranted ? acc + 1 : acc); }, 0);
535
- };
536
- PermissionManagementComponent.prototype.shouldFetchAppConfig = function () {
537
- var _this = this;
538
- var currentUser = this.configState.getOne('currentUser');
539
- if (this.providerName === 'R')
540
- return currentUser.roles.some(function (role) { return role === _this.providerKey; });
541
- if (this.providerName === 'U')
542
- return currentUser.id === this.providerKey;
543
- return false;
544
- };
545
- return PermissionManagementComponent;
546
- }());
547
- PermissionManagementComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementComponent, deps: [{ token: i1__namespace.PermissionsService }, { token: i2__namespace.ConfigStateService }], target: i0__namespace.ɵɵFactoryTarget.Component });
548
- PermissionManagementComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: PermissionManagementComponent, selector: "abp-permission-management", inputs: { providerName: "providerName", providerKey: "providerKey", hideBadges: "hideBadges", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, viewQueries: [{ propertyName: "selectAllInThisTabsRef", predicate: ["selectAllInThisTabsRef"], descendants: true }, { propertyName: "selectAllInAllTabsRef", predicate: ["selectAllInAllTabsRef"], descendants: true }], exportAs: ["abpPermissionManagement"], ngImport: i0__namespace, template: "<abp-modal [(visible)]=\"visible\" [busy]=\"modalBusy\" [options]=\"{ size: 'lg' }\">\r\n <ng-container *ngIf=\"data.entityDisplayName\">\r\n <ng-template #abpHeader>\r\n <h4>\r\n {{ 'AbpPermissionManagement::Permissions' | abpLocalization }} -\r\n {{ data.entityDisplayName }}\r\n </h4>\r\n </ng-template>\r\n <ng-template #abpBody>\r\n <div class=\"form-check mb-2\">\r\n <input\r\n #selectAllInAllTabsRef\r\n type=\"checkbox\"\r\n id=\"select-all-in-all-tabs\"\r\n name=\"select-all-in-all-tabs\"\r\n class=\"form-check-input\"\r\n [(ngModel)]=\"selectAllTab\"\r\n (click)=\"onClickSelectAll()\"\r\n />\r\n <label class=\"form-check-label\" for=\"select-all-in-all-tabs\">{{\r\n 'AbpPermissionManagement::SelectAllInAllTabs' | abpLocalization\r\n }}</label>\r\n </div>\r\n\r\n <hr class=\"mt-2 mb-2\" />\r\n <div class=\"row\">\r\n <div class=\"overflow-scroll col-md-4\">\r\n <ul class=\"nav nav-pills flex-column\">\r\n <li *ngFor=\"let group of data.groups; trackBy: trackByFn\" class=\"nav-item\">\r\n <a\r\n *ngIf=\"{ assignedCount: getAssignedCount(group.name) } as count\"\r\n class=\"nav-link pointer\"\r\n [class.active]=\"selectedGroup?.name === group?.name\"\r\n (click)=\"onChangeGroup(group)\"\r\n >\r\n <div [class.font-weight-bold]=\"count.assignedCount\">\r\n {{ group?.displayName }}\r\n <span>({{ count.assignedCount }})</span>\r\n </div>\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n <div class=\"col-md-8 overflow-scroll\">\r\n <h4>{{ selectedGroup?.displayName }}</h4>\r\n <hr class=\"mt-2 mb-3\" />\r\n <div class=\"ps-1 pt-1\">\r\n <div class=\"form-check mb-2\">\r\n <input\r\n #selectAllInThisTabsRef\r\n type=\"checkbox\"\r\n id=\"select-all-in-this-tabs\"\r\n name=\"select-all-in-this-tabs\"\r\n class=\"form-check-input\"\r\n [(ngModel)]=\"selectThisTab\"\r\n (click)=\"onClickSelectThisTab()\"\r\n />\r\n <label class=\"form-check-label\" for=\"select-all-in-this-tabs\">{{\r\n 'AbpPermissionManagement::SelectAllInThisTab' | abpLocalization\r\n }}</label>\r\n </div>\r\n <hr class=\"mb-3\" />\r\n <div\r\n *ngFor=\"let permission of selectedGroupPermissions; let i = index; trackBy: trackByFn\"\r\n [ngStyle]=\"permission.style\"\r\n class=\"form-check mb-2\"\r\n >\r\n <input\r\n #permissionCheckbox\r\n type=\"checkbox\"\r\n [checked]=\"getChecked(permission.name)\"\r\n [value]=\"getChecked(permission.name)\"\r\n [attr.id]=\"permission.name\"\r\n class=\"form-check-input\"\r\n [disabled]=\"isGrantedByOtherProviderName(permission.grantedProviders)\"\r\n (click)=\"onClickCheckbox(permission, permissionCheckbox.value)\"\r\n />\r\n <label class=\"form-check-label\" [attr.for]=\"permission.name\"\r\n >{{ permission.displayName }}\r\n <ng-container *ngIf=\"!hideBadges\">\r\n <span\r\n *ngFor=\"let provider of permission.grantedProviders\"\r\n class=\"badge bg-light text-dark\"\r\n >{{ provider.providerName }}: {{ provider.providerKey }}</span\r\n >\r\n </ng-container>\r\n </label>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template #abpFooter>\r\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>\r\n {{ 'AbpIdentity::Cancel' | abpLocalization }}\r\n </button>\r\n <abp-button iconClass=\"fa fa-check\" (click)=\"submit()\">{{\r\n 'AbpIdentity::Save' | abpLocalization\r\n }}</abp-button>\r\n </ng-template>\r\n </ng-container>\r\n</abp-modal>\r\n", styles: ["\n .overflow-scroll {\n max-height: 70vh;\n overflow-y: scroll;\n }\n "], components: [{ type: i3__namespace.ModalComponent, selector: "abp-modal", inputs: ["visible", "busy", "options", "suppressUnsavedChangesWarning"], outputs: ["visibleChange", "init", "appear", "disappear"] }, { type: i3__namespace.ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }], directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i5__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3__namespace.ModalCloseDirective, selector: "[abpClose]" }], pipes: { "abpLocalization": i2__namespace.LocalizationPipe } });
549
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementComponent, decorators: [{
550
- type: i0.Component,
551
- args: [{
552
- selector: 'abp-permission-management',
553
- templateUrl: './permission-management.component.html',
554
- exportAs: 'abpPermissionManagement',
555
- styles: [
556
- "\n .overflow-scroll {\n max-height: 70vh;\n overflow-y: scroll;\n }\n ",
557
- ],
558
- }]
559
- }], ctorParameters: function () { return [{ type: i1__namespace.PermissionsService }, { type: i2__namespace.ConfigStateService }]; }, propDecorators: { providerName: [{
560
- type: i0.Input
561
- }], providerKey: [{
562
- type: i0.Input
563
- }], hideBadges: [{
564
- type: i0.Input
565
- }], visible: [{
566
- type: i0.Input
567
- }], visibleChange: [{
568
- type: i0.Output
569
- }], selectAllInThisTabsRef: [{
570
- type: i0.ViewChildren,
571
- args: ['selectAllInThisTabsRef']
572
- }], selectAllInAllTabsRef: [{
573
- type: i0.ViewChildren,
574
- args: ['selectAllInAllTabsRef']
575
- }] } });
576
- function findMargin(permissions, permission) {
577
- var parentPermission = permissions.find(function (per) { return per.name === permission.parentName; });
578
- if (parentPermission && parentPermission.parentName) {
579
- var margin = 20;
580
- return (margin += findMargin(permissions, parentPermission));
581
- }
582
- return parentPermission ? 20 : 0;
583
- }
584
- function getPermissions(groups) {
585
- return groups.reduce(function (acc, val) { return __spreadArray(__spreadArray([], __read(acc)), __read(val.permissions.map(function (p) { return (Object.assign(Object.assign({}, p), { groupName: val.name })); }))); }, []);
350
+ var PermissionManagementComponent = /** @class */ (function () {
351
+ function PermissionManagementComponent(service, configState) {
352
+ this.service = service;
353
+ this.configState = configState;
354
+ this.hideBadges = false;
355
+ this._visible = false;
356
+ this.visibleChange = new i0.EventEmitter();
357
+ this.data = { groups: [], entityDisplayName: null };
358
+ this.permissions = [];
359
+ this.selectThisTab = false;
360
+ this.selectAllTab = false;
361
+ this.modalBusy = false;
362
+ this.trackByFn = function (_, item) { return item.name; };
363
+ }
364
+ Object.defineProperty(PermissionManagementComponent.prototype, "visible", {
365
+ get: function () {
366
+ return this._visible;
367
+ },
368
+ set: function (value) {
369
+ var _this = this;
370
+ if (value === this._visible)
371
+ return;
372
+ if (value) {
373
+ this.openModal().subscribe(function () {
374
+ _this._visible = true;
375
+ _this.visibleChange.emit(true);
376
+ rxjs.concat(_this.selectAllInAllTabsRef.changes, _this.selectAllInThisTabsRef.changes)
377
+ .pipe(operators.take(1))
378
+ .subscribe(function () {
379
+ _this.initModal();
380
+ });
381
+ });
382
+ }
383
+ else {
384
+ this.selectedGroup = null;
385
+ this._visible = false;
386
+ this.visibleChange.emit(false);
387
+ }
388
+ },
389
+ enumerable: false,
390
+ configurable: true
391
+ });
392
+ Object.defineProperty(PermissionManagementComponent.prototype, "selectedGroupPermissions", {
393
+ get: function () {
394
+ var _this = this;
395
+ if (!this.selectedGroup)
396
+ return [];
397
+ var margin = "margin-" + (document.body.dir === 'rtl' ? 'right' : 'left') + ".px";
398
+ var permissions = this.data.groups.find(function (group) { return group.name === _this.selectedGroup.name; }).permissions;
399
+ return permissions.map(function (permission) {
400
+ var _a;
401
+ return (Object.assign(Object.assign({}, permission), { style: (_a = {}, _a[margin] = findMargin(permissions, permission), _a), isGranted: _this.permissions.find(function (per) { return per.name === permission.name; }).isGranted }));
402
+ });
403
+ },
404
+ enumerable: false,
405
+ configurable: true
406
+ });
407
+ PermissionManagementComponent.prototype.getChecked = function (name) {
408
+ return (this.permissions.find(function (per) { return per.name === name; }) || { isGranted: false }).isGranted;
409
+ };
410
+ PermissionManagementComponent.prototype.isGrantedByOtherProviderName = function (grantedProviders) {
411
+ var _this = this;
412
+ if (grantedProviders.length) {
413
+ return grantedProviders.findIndex(function (p) { return p.providerName !== _this.providerName; }) > -1;
414
+ }
415
+ return false;
416
+ };
417
+ PermissionManagementComponent.prototype.onClickCheckbox = function (clickedPermission, value) {
418
+ var _this = this;
419
+ if (clickedPermission.isGranted &&
420
+ this.isGrantedByOtherProviderName(clickedPermission.grantedProviders))
421
+ return;
422
+ setTimeout(function () {
423
+ _this.permissions = _this.permissions.map(function (per) {
424
+ if (clickedPermission.name === per.name) {
425
+ return Object.assign(Object.assign({}, per), { isGranted: !per.isGranted });
426
+ }
427
+ else if (clickedPermission.name === per.parentName && clickedPermission.isGranted) {
428
+ return Object.assign(Object.assign({}, per), { isGranted: false });
429
+ }
430
+ else if (clickedPermission.parentName === per.name && !clickedPermission.isGranted) {
431
+ return Object.assign(Object.assign({}, per), { isGranted: true });
432
+ }
433
+ return per;
434
+ });
435
+ _this.setTabCheckboxState();
436
+ _this.setGrantCheckboxState();
437
+ }, 0);
438
+ };
439
+ PermissionManagementComponent.prototype.setTabCheckboxState = function () {
440
+ var selectedPermissions = this.selectedGroupPermissions.filter(function (per) { return per.isGranted; });
441
+ var element = document.querySelector('#select-all-in-this-tabs');
442
+ if (selectedPermissions.length === this.selectedGroupPermissions.length) {
443
+ element.indeterminate = false;
444
+ this.selectThisTab = true;
445
+ }
446
+ else if (selectedPermissions.length === 0) {
447
+ element.indeterminate = false;
448
+ this.selectThisTab = false;
449
+ }
450
+ else {
451
+ element.indeterminate = true;
452
+ }
453
+ };
454
+ PermissionManagementComponent.prototype.setGrantCheckboxState = function () {
455
+ var selectedAllPermissions = this.permissions.filter(function (per) { return per.isGranted; });
456
+ var checkboxElement = document.querySelector('#select-all-in-all-tabs');
457
+ if (selectedAllPermissions.length === this.permissions.length) {
458
+ checkboxElement.indeterminate = false;
459
+ this.selectAllTab = true;
460
+ }
461
+ else if (selectedAllPermissions.length === 0) {
462
+ checkboxElement.indeterminate = false;
463
+ this.selectAllTab = false;
464
+ }
465
+ else {
466
+ checkboxElement.indeterminate = true;
467
+ }
468
+ };
469
+ PermissionManagementComponent.prototype.onClickSelectThisTab = function () {
470
+ var _this = this;
471
+ this.selectedGroupPermissions.forEach(function (permission) {
472
+ if (permission.isGranted && _this.isGrantedByOtherProviderName(permission.grantedProviders))
473
+ return;
474
+ var index = _this.permissions.findIndex(function (per) { return per.name === permission.name; });
475
+ _this.permissions = __spreadArray(__spreadArray(__spreadArray([], __read(_this.permissions.slice(0, index))), [
476
+ Object.assign(Object.assign({}, _this.permissions[index]), { isGranted: !_this.selectThisTab })
477
+ ]), __read(_this.permissions.slice(index + 1)));
478
+ });
479
+ this.setGrantCheckboxState();
480
+ };
481
+ PermissionManagementComponent.prototype.onClickSelectAll = function () {
482
+ var _this = this;
483
+ this.permissions = this.permissions.map(function (permission) { return (Object.assign(Object.assign({}, permission), { isGranted: _this.isGrantedByOtherProviderName(permission.grantedProviders) || !_this.selectAllTab })); });
484
+ this.selectThisTab = !this.selectAllTab;
485
+ };
486
+ PermissionManagementComponent.prototype.onChangeGroup = function (group) {
487
+ this.selectedGroup = group;
488
+ this.setTabCheckboxState();
489
+ };
490
+ PermissionManagementComponent.prototype.submit = function () {
491
+ var _this = this;
492
+ var unchangedPermissions = getPermissions(this.data.groups);
493
+ var changedPermissions = this.permissions
494
+ .filter(function (per) { return unchangedPermissions.find(function (unchanged) { return unchanged.name === per.name; }).isGranted ===
495
+ per.isGranted
496
+ ? false
497
+ : true; })
498
+ .map(function (_a) {
499
+ var name = _a.name, isGranted = _a.isGranted;
500
+ return ({ name: name, isGranted: isGranted });
501
+ });
502
+ if (!changedPermissions.length) {
503
+ this.visible = false;
504
+ return;
505
+ }
506
+ this.modalBusy = true;
507
+ this.service
508
+ .update(this.providerName, this.providerKey, { permissions: changedPermissions })
509
+ .pipe(operators.switchMap(function () { return _this.shouldFetchAppConfig() ? _this.configState.refreshAppState() : rxjs.of(null); }), operators.finalize(function () { return (_this.modalBusy = false); }))
510
+ .subscribe(function () {
511
+ _this.visible = false;
512
+ });
513
+ };
514
+ PermissionManagementComponent.prototype.openModal = function () {
515
+ var _this = this;
516
+ if (!this.providerKey || !this.providerName) {
517
+ throw new Error('Provider Key and Provider Name are required.');
518
+ }
519
+ return this.service.get(this.providerName, this.providerKey).pipe(operators.tap(function (permissionRes) {
520
+ _this.data = permissionRes;
521
+ _this.selectedGroup = permissionRes.groups[0];
522
+ _this.permissions = getPermissions(permissionRes.groups);
523
+ }));
524
+ };
525
+ PermissionManagementComponent.prototype.initModal = function () {
526
+ var _this = this;
527
+ // TODO: Refactor
528
+ setTimeout(function () {
529
+ _this.setTabCheckboxState();
530
+ _this.setGrantCheckboxState();
531
+ });
532
+ };
533
+ PermissionManagementComponent.prototype.getAssignedCount = function (groupName) {
534
+ return this.permissions.reduce(function (acc, val) { return (val.groupName === groupName && val.isGranted ? acc + 1 : acc); }, 0);
535
+ };
536
+ PermissionManagementComponent.prototype.shouldFetchAppConfig = function () {
537
+ var _this = this;
538
+ var currentUser = this.configState.getOne('currentUser');
539
+ if (this.providerName === 'R')
540
+ return currentUser.roles.some(function (role) { return role === _this.providerKey; });
541
+ if (this.providerName === 'U')
542
+ return currentUser.id === this.providerKey;
543
+ return false;
544
+ };
545
+ return PermissionManagementComponent;
546
+ }());
547
+ PermissionManagementComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementComponent, deps: [{ token: i1__namespace.PermissionsService }, { token: i2__namespace.ConfigStateService }], target: i0__namespace.ɵɵFactoryTarget.Component });
548
+ PermissionManagementComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: PermissionManagementComponent, selector: "abp-permission-management", inputs: { providerName: "providerName", providerKey: "providerKey", hideBadges: "hideBadges", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, viewQueries: [{ propertyName: "selectAllInThisTabsRef", predicate: ["selectAllInThisTabsRef"], descendants: true }, { propertyName: "selectAllInAllTabsRef", predicate: ["selectAllInAllTabsRef"], descendants: true }], exportAs: ["abpPermissionManagement"], ngImport: i0__namespace, template: "<abp-modal [(visible)]=\"visible\" [busy]=\"modalBusy\" [options]=\"{ size: 'lg' }\">\n <ng-container *ngIf=\"data.entityDisplayName\">\n <ng-template #abpHeader>\n <h4>\n {{ 'AbpPermissionManagement::Permissions' | abpLocalization }} -\n {{ data.entityDisplayName }}\n </h4>\n </ng-template>\n <ng-template #abpBody>\n <div class=\"form-check mb-2\">\n <input\n #selectAllInAllTabsRef\n type=\"checkbox\"\n id=\"select-all-in-all-tabs\"\n name=\"select-all-in-all-tabs\"\n class=\"form-check-input\"\n [(ngModel)]=\"selectAllTab\"\n (click)=\"onClickSelectAll()\"\n />\n <label class=\"form-check-label\" for=\"select-all-in-all-tabs\">{{\n 'AbpPermissionManagement::SelectAllInAllTabs' | abpLocalization\n }}</label>\n </div>\n\n <hr class=\"mt-2 mb-2\" />\n <div class=\"row\">\n <div class=\"overflow-scroll col-md-4\">\n <ul class=\"nav nav-pills flex-column\">\n <li *ngFor=\"let group of data.groups; trackBy: trackByFn\" class=\"nav-item\">\n <a\n *ngIf=\"{ assignedCount: getAssignedCount(group.name) } as count\"\n class=\"nav-link pointer\"\n [class.active]=\"selectedGroup?.name === group?.name\"\n (click)=\"onChangeGroup(group)\"\n >\n <div [class.font-weight-bold]=\"count.assignedCount\">\n {{ group?.displayName }}\n <span>({{ count.assignedCount }})</span>\n </div>\n </a>\n </li>\n </ul>\n </div>\n <div class=\"col-md-8 overflow-scroll\">\n <h4>{{ selectedGroup?.displayName }}</h4>\n <hr class=\"mt-2 mb-3\" />\n <div class=\"ps-1 pt-1\">\n <div class=\"form-check mb-2\">\n <input\n #selectAllInThisTabsRef\n type=\"checkbox\"\n id=\"select-all-in-this-tabs\"\n name=\"select-all-in-this-tabs\"\n class=\"form-check-input\"\n [(ngModel)]=\"selectThisTab\"\n (click)=\"onClickSelectThisTab()\"\n />\n <label class=\"form-check-label\" for=\"select-all-in-this-tabs\">{{\n 'AbpPermissionManagement::SelectAllInThisTab' | abpLocalization\n }}</label>\n </div>\n <hr class=\"mb-3\" />\n <div\n *ngFor=\"let permission of selectedGroupPermissions; let i = index; trackBy: trackByFn\"\n [ngStyle]=\"permission.style\"\n class=\"form-check mb-2\"\n >\n <input\n #permissionCheckbox\n type=\"checkbox\"\n [checked]=\"getChecked(permission.name)\"\n [value]=\"getChecked(permission.name)\"\n [attr.id]=\"permission.name\"\n class=\"form-check-input\"\n [disabled]=\"isGrantedByOtherProviderName(permission.grantedProviders)\"\n (click)=\"onClickCheckbox(permission, permissionCheckbox.value)\"\n />\n <label class=\"form-check-label\" [attr.for]=\"permission.name\"\n >{{ permission.displayName }}\n <ng-container *ngIf=\"!hideBadges\">\n <span\n *ngFor=\"let provider of permission.grantedProviders\"\n class=\"badge bg-light text-dark\"\n >{{ provider.providerName }}: {{ provider.providerKey }}</span\n >\n </ng-container>\n </label>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>\n {{ 'AbpIdentity::Cancel' | abpLocalization }}\n </button>\n <abp-button iconClass=\"fa fa-check\" (click)=\"submit()\">{{\n 'AbpIdentity::Save' | abpLocalization\n }}</abp-button>\n </ng-template>\n </ng-container>\n</abp-modal>\n", styles: ["\n .overflow-scroll {\n max-height: 70vh;\n overflow-y: scroll;\n }\n "], components: [{ type: i3__namespace.ModalComponent, selector: "abp-modal", inputs: ["visible", "busy", "options", "suppressUnsavedChangesWarning"], outputs: ["visibleChange", "init", "appear", "disappear"] }, { type: i3__namespace.ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }], directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i5__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3__namespace.ModalCloseDirective, selector: "[abpClose]" }], pipes: { "abpLocalization": i2__namespace.LocalizationPipe } });
549
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementComponent, decorators: [{
550
+ type: i0.Component,
551
+ args: [{
552
+ selector: 'abp-permission-management',
553
+ templateUrl: './permission-management.component.html',
554
+ exportAs: 'abpPermissionManagement',
555
+ styles: [
556
+ "\n .overflow-scroll {\n max-height: 70vh;\n overflow-y: scroll;\n }\n ",
557
+ ],
558
+ }]
559
+ }], ctorParameters: function () { return [{ type: i1__namespace.PermissionsService }, { type: i2__namespace.ConfigStateService }]; }, propDecorators: { providerName: [{
560
+ type: i0.Input
561
+ }], providerKey: [{
562
+ type: i0.Input
563
+ }], hideBadges: [{
564
+ type: i0.Input
565
+ }], visible: [{
566
+ type: i0.Input
567
+ }], visibleChange: [{
568
+ type: i0.Output
569
+ }], selectAllInThisTabsRef: [{
570
+ type: i0.ViewChildren,
571
+ args: ['selectAllInThisTabsRef']
572
+ }], selectAllInAllTabsRef: [{
573
+ type: i0.ViewChildren,
574
+ args: ['selectAllInAllTabsRef']
575
+ }] } });
576
+ function findMargin(permissions, permission) {
577
+ var parentPermission = permissions.find(function (per) { return per.name === permission.parentName; });
578
+ if (parentPermission && parentPermission.parentName) {
579
+ var margin = 20;
580
+ return (margin += findMargin(permissions, parentPermission));
581
+ }
582
+ return parentPermission ? 20 : 0;
583
+ }
584
+ function getPermissions(groups) {
585
+ return groups.reduce(function (acc, val) { return __spreadArray(__spreadArray([], __read(acc)), __read(val.permissions.map(function (p) { return (Object.assign(Object.assign({}, p), { groupName: val.name })); }))); }, []);
586
586
  }
587
587
 
588
- var PermissionManagementModule = /** @class */ (function () {
589
- function PermissionManagementModule() {
590
- }
591
- return PermissionManagementModule;
592
- }());
593
- PermissionManagementModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
594
- PermissionManagementModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementModule, declarations: [PermissionManagementComponent], imports: [i2.CoreModule, i3.ThemeSharedModule], exports: [PermissionManagementComponent] });
595
- PermissionManagementModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementModule, imports: [[i2.CoreModule, i3.ThemeSharedModule]] });
596
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementModule, decorators: [{
597
- type: i0.NgModule,
598
- args: [{
599
- declarations: [PermissionManagementComponent],
600
- imports: [i2.CoreModule, i3.ThemeSharedModule],
601
- exports: [PermissionManagementComponent],
602
- }]
588
+ var PermissionManagementModule = /** @class */ (function () {
589
+ function PermissionManagementModule() {
590
+ }
591
+ return PermissionManagementModule;
592
+ }());
593
+ PermissionManagementModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
594
+ PermissionManagementModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementModule, declarations: [PermissionManagementComponent], imports: [i2.CoreModule, i3.ThemeSharedModule], exports: [PermissionManagementComponent] });
595
+ PermissionManagementModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementModule, imports: [[i2.CoreModule, i3.ThemeSharedModule]] });
596
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: PermissionManagementModule, decorators: [{
597
+ type: i0.NgModule,
598
+ args: [{
599
+ declarations: [PermissionManagementComponent],
600
+ imports: [i2.CoreModule, i3.ThemeSharedModule],
601
+ exports: [PermissionManagementComponent],
602
+ }]
603
603
  }] });
604
604
 
605
- /**
606
- * Generated bundle index. Do not edit.
605
+ /**
606
+ * Generated bundle index. Do not edit.
607
607
  */
608
608
 
609
609
  exports.PermissionManagementComponent = PermissionManagementComponent;