@yelon/acl 12.0.16 → 13.0.0-beta.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acl.mjs","sources":["../../../../packages/acl/src/acl.config.ts","../../../../packages/acl/src/acl.service.ts","../../../../packages/acl/src/acl-if.directive.ts","../../../../packages/acl/src/acl.directive.ts","../../../../packages/acl/src/acl-guard.ts","../../../../packages/acl/src/acl.module.ts","../../../../packages/acl/acl.ts"],"sourcesContent":["import { YunzaiACLConfig } from '@yelon/util/config';\n\nexport const ACL_DEFAULT_CONFIG: YunzaiACLConfig = {\n guard_url: `/403`\n};\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\n\nimport { YunzaiACLConfig, YunzaiConfigService } from '@yelon/util/config';\n\nimport { ACL_DEFAULT_CONFIG } from './acl.config';\nimport { ACLCanType, ACLType } from './acl.type';\n\n/**\n * ACL 控制服务,[在线文档](https://ng.yunzainfo.com/acl)\n *\n * 务必在根目录注册 `YelonACLModule.forRoot()` 才能使用服务\n */\n@Injectable()\nexport class ACLService {\n private options: YunzaiACLConfig;\n private roles: string[] = [];\n private abilities: Array<number | string> = [];\n private full = false;\n private aclChange = new BehaviorSubject<ACLType | boolean | null>(null);\n\n /** ACL变更通知 */\n get change(): Observable<ACLType | boolean | null> {\n return this.aclChange.asObservable();\n }\n\n /** 获取所有数据 */\n get data(): { full: boolean; roles: string[]; abilities: Array<string | number> } {\n return {\n full: this.full,\n roles: this.roles,\n abilities: this.abilities\n };\n }\n\n get guard_url(): string {\n return this.options.guard_url!;\n }\n\n constructor(configSrv: YunzaiConfigService) {\n this.options = configSrv.merge('acl', ACL_DEFAULT_CONFIG)!;\n }\n\n private parseACLType(val: string | string[] | number | number[] | ACLType | null): ACLType {\n let t: ACLType;\n if (typeof val === 'number') {\n t = { ability: [val] };\n } else if (Array.isArray(val) && val.length > 0 && typeof val[0] === 'number') {\n t = { ability: val };\n } else if (typeof val === 'object' && !Array.isArray(val)) {\n t = { ...val };\n } else if (Array.isArray(val)) {\n t = { role: val as string[] };\n } else {\n t = { role: val == null ? [] : [val] };\n }\n\n return { except: false, ...t };\n }\n\n /**\n * 设置当前用户角色或权限能力(会先清除所有)\n */\n set(value: ACLType): void {\n this.full = false;\n this.abilities = [];\n this.roles = [];\n this.add(value);\n this.aclChange.next(value);\n }\n\n /**\n * 标识当前用户为全量,即不受限\n */\n setFull(val: boolean): void {\n this.full = val;\n this.aclChange.next(val);\n }\n\n /**\n * 设置当前用户权限能力(会先清除所有)\n */\n setAbility(abilities: Array<number | string>): void {\n this.set({ ability: abilities } as ACLType);\n }\n\n /**\n * 设置当前用户角色(会先清除所有)\n */\n setRole(roles: string[]): void {\n this.set({ role: roles } as ACLType);\n }\n\n /**\n * 为当前用户增加角色或权限能力\n */\n add(value: ACLType): void {\n if (value.role && value.role.length > 0) {\n this.roles.push(...value.role);\n }\n if (value.ability && value.ability.length > 0) {\n this.abilities.push(...value.ability);\n }\n }\n\n /**\n * 为当前用户附加角色\n */\n attachRole(roles: string[]): void {\n for (const val of roles) {\n if (!this.roles.includes(val)) {\n this.roles.push(val);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 为当前用户附加权限\n */\n attachAbility(abilities: Array<number | string>): void {\n for (const val of abilities) {\n if (!this.abilities.includes(val)) {\n this.abilities.push(val);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 为当前用户移除角色\n */\n removeRole(roles: string[]): void {\n for (const val of roles) {\n const idx = this.roles.indexOf(val);\n if (idx !== -1) {\n this.roles.splice(idx, 1);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 为当前用户移除权限\n */\n removeAbility(abilities: Array<number | string>): void {\n for (const val of abilities) {\n const idx = this.abilities.indexOf(val);\n if (idx !== -1) {\n this.abilities.splice(idx, 1);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 当前用户是否有对应角色,其实 `number` 表示Ability\n *\n * - 当 `full: true` 或参数 `null` 时返回 `true`\n * - 若使用 `ACLType` 参数,可以指定 `mode` 校验模式\n */\n can(roleOrAbility: ACLCanType | null): boolean {\n const { preCan } = this.options;\n if (preCan) {\n roleOrAbility = preCan(roleOrAbility!);\n }\n\n const t = this.parseACLType(roleOrAbility);\n let result = false;\n if (this.full === true || !roleOrAbility) {\n result = true;\n } else {\n if (t.role && t.role.length > 0) {\n if (t.mode === 'allOf') {\n result = t.role.every(v => this.roles.includes(v));\n } else {\n result = t.role.some(v => this.roles.includes(v));\n }\n }\n if (t.ability && t.ability.length > 0) {\n if (t.mode === 'allOf') {\n result = (t.ability as Array<number | string>).every(v => this.abilities.includes(v));\n } else {\n result = (t.ability as Array<number | string>).some(v => this.abilities.includes(v));\n }\n }\n }\n\n return t.except === true ? !result : result;\n }\n\n /** @inner */\n parseAbility(value: ACLCanType): ACLCanType {\n if (typeof value === 'number' || typeof value === 'string' || Array.isArray(value)) {\n value = { ability: Array.isArray(value) ? value : [value] } as ACLType;\n }\n delete value.role;\n return value;\n }\n\n /**\n * 当前用户是否有对应权限点\n */\n canAbility(value: ACLCanType): boolean {\n return this.can(this.parseAbility(value));\n }\n}\n","import { Directive, EmbeddedViewRef, Input, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { ACLService } from './acl.service';\nimport { ACLCanType } from './acl.type';\n\n@Directive({\n selector: '[aclIf]',\n exportAs: 'aclIf'\n})\nexport class ACLIfDirective implements OnDestroy {\n static ngAcceptInputType_except: boolean | string | undefined | null;\n\n private _value!: ACLCanType;\n private _change$: Subscription;\n private _thenTemplateRef: TemplateRef<void> | null = null;\n private _elseTemplateRef: TemplateRef<void> | null = null;\n private _thenViewRef: EmbeddedViewRef<void> | null = null;\n private _elseViewRef: EmbeddedViewRef<void> | null = null;\n private _except = false;\n\n constructor(templateRef: TemplateRef<void>, private srv: ACLService, private _viewContainer: ViewContainerRef) {\n this._change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this._updateView());\n this._thenTemplateRef = templateRef;\n }\n\n @Input()\n set aclIf(value: ACLCanType) {\n this._value = value;\n this._updateView();\n }\n\n @Input()\n set aclIfThen(templateRef: TemplateRef<void> | null) {\n this._thenTemplateRef = templateRef;\n this._thenViewRef = null;\n this._updateView();\n }\n\n @Input()\n set aclIfElse(templateRef: TemplateRef<void> | null) {\n this._elseTemplateRef = templateRef;\n this._elseViewRef = null;\n this._updateView();\n }\n\n @Input()\n set except(value: boolean) {\n this._except = value != null && `${value}` !== 'false';\n }\n get except(): boolean {\n return this._except;\n }\n\n protected _updateView(): void {\n const res = this.srv.can(this._value);\n if ((res && !this.except) || (!res && this.except)) {\n if (!this._thenViewRef) {\n this._viewContainer.clear();\n this._elseViewRef = null;\n if (this._thenTemplateRef) {\n this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef);\n }\n }\n } else {\n if (!this._elseViewRef) {\n this._viewContainer.clear();\n this._thenViewRef = null;\n if (this._elseTemplateRef) {\n this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef);\n }\n }\n }\n }\n\n ngOnDestroy(): void {\n this._change$.unsubscribe();\n }\n}\n","import { Directive, ElementRef, Input, OnDestroy, Renderer2 } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { ACLService } from './acl.service';\nimport { ACLCanType } from './acl.type';\n\n@Directive({\n selector: '[acl]',\n exportAs: 'acl'\n})\nexport class ACLDirective implements OnDestroy {\n private _value!: ACLCanType;\n private change$: Subscription;\n\n @Input('acl')\n set acl(value: ACLCanType) {\n this.set(value);\n }\n\n @Input('acl-ability')\n set ability(value: ACLCanType) {\n this.set(this.srv.parseAbility(value));\n }\n\n private set(value: ACLCanType): void {\n this._value = value;\n const CLS = 'acl__hide';\n const el = this.el.nativeElement;\n if (this.srv.can(this._value)) {\n this.renderer.removeClass(el, CLS);\n } else {\n this.renderer.addClass(el, CLS);\n }\n }\n\n constructor(private el: ElementRef, private renderer: Renderer2, protected srv: ACLService) {\n this.change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this.set(this._value));\n }\n\n ngOnDestroy(): void {\n this.change$.unsubscribe();\n }\n}\n","import { Injectable, Injector } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n CanActivateChild,\n CanLoad,\n Data,\n Route,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { map, tap } from 'rxjs/operators';\n\nimport { ACLService } from './acl.service';\nimport { ACLCanType, ACLGuardType } from './acl.type';\n\n/**\n * Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).\n *\n * ```ts\n * data: {\n * path: 'home',\n * canActivate: [ ACLGuard ],\n * data: { guard: 'user1' }\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class ACLGuard implements CanActivate, CanActivateChild, CanLoad {\n constructor(private srv: ACLService, private router: Router, private injector: Injector) {}\n\n private process(data: Data): Observable<boolean> {\n data = {\n guard: null,\n guard_url: this.srv.guard_url,\n ...data\n };\n let guard: ACLGuardType = data.guard;\n if (typeof guard === 'function') guard = guard(this.srv, this.injector);\n return (guard && guard instanceof Observable ? guard : of(guard != null ? (guard as ACLCanType) : null)).pipe(\n map(v => this.srv.can(v)),\n tap(v => {\n if (v) return;\n this.router.navigateByUrl(data.guard_url);\n })\n );\n }\n\n // lazy loading\n canLoad(route: Route): Observable<boolean> {\n return this.process(route.data!);\n }\n // all children route\n canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {\n return this.canActivate(childRoute, state);\n }\n // route\n canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean> {\n return this.process(route.data);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { ACLIfDirective } from './acl-if.directive';\nimport { ACLDirective } from './acl.directive';\nimport { ACLService } from './acl.service';\n\nconst COMPONENTS = [ACLDirective, ACLIfDirective];\n\n@NgModule({\n imports: [CommonModule],\n declarations: COMPONENTS,\n exports: COMPONENTS\n})\nexport class YelonACLModule {\n static forRoot(): ModuleWithProviders<YelonACLModule> {\n return {\n ngModule: YelonACLModule,\n providers: [ACLService]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAEa,kBAAkB,GAAoB;IACjD,SAAS,EAAE,MAAM;;;ACKnB;;;;;MAMa,UAAU;IAyBrB,YAAY,SAA8B;QAvBlC,UAAK,GAAa,EAAE,CAAC;QACrB,cAAS,GAA2B,EAAE,CAAC;QACvC,SAAI,GAAG,KAAK,CAAC;QACb,cAAS,GAAG,IAAI,eAAe,CAA2B,IAAI,CAAC,CAAC;QAqBtE,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,kBAAkB,CAAE,CAAC;KAC5D;;IAnBD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;KACtC;;IAGD,IAAI,IAAI;QACN,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;KACH;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,SAAU,CAAC;KAChC;IAMO,YAAY,CAAC,GAA2D;QAC9E,IAAI,CAAU,CAAC;QACf,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;SACxB;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,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E,UAAU;iBACpB;;;ACbD;;;;;;"}
@@ -0,0 +1,406 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Directive, Input, NgModule } from '@angular/core';
3
+ import { BehaviorSubject, Observable, of } from 'rxjs';
4
+ import * as i1 from '@yelon/util/config';
5
+ import { filter, map, tap } from 'rxjs/operators';
6
+ import * as i2 from '@angular/router';
7
+ import { CommonModule } from '@angular/common';
8
+
9
+ const ACL_DEFAULT_CONFIG = {
10
+ guard_url: `/403`
11
+ };
12
+
13
+ /**
14
+ * ACL 控制服务,[在线文档](https://ng.yunzainfo.com/acl)
15
+ *
16
+ * 务必在根目录注册 `YelonACLModule.forRoot()` 才能使用服务
17
+ */
18
+ class ACLService {
19
+ constructor(configSrv) {
20
+ this.roles = [];
21
+ this.abilities = [];
22
+ this.full = false;
23
+ this.aclChange = new BehaviorSubject(null);
24
+ this.options = configSrv.merge('acl', ACL_DEFAULT_CONFIG);
25
+ }
26
+ /** ACL变更通知 */
27
+ get change() {
28
+ return this.aclChange.asObservable();
29
+ }
30
+ /** 获取所有数据 */
31
+ get data() {
32
+ return {
33
+ full: this.full,
34
+ roles: this.roles,
35
+ abilities: this.abilities
36
+ };
37
+ }
38
+ get guard_url() {
39
+ return this.options.guard_url;
40
+ }
41
+ parseACLType(val) {
42
+ let t;
43
+ if (typeof val === 'number') {
44
+ t = { ability: [val] };
45
+ }
46
+ else if (Array.isArray(val) && val.length > 0 && typeof val[0] === 'number') {
47
+ t = { ability: val };
48
+ }
49
+ else if (typeof val === 'object' && !Array.isArray(val)) {
50
+ t = { ...val };
51
+ }
52
+ else if (Array.isArray(val)) {
53
+ t = { role: val };
54
+ }
55
+ else {
56
+ t = { role: val == null ? [] : [val] };
57
+ }
58
+ return { except: false, ...t };
59
+ }
60
+ /**
61
+ * 设置当前用户角色或权限能力(会先清除所有)
62
+ */
63
+ set(value) {
64
+ this.full = false;
65
+ this.abilities = [];
66
+ this.roles = [];
67
+ this.add(value);
68
+ this.aclChange.next(value);
69
+ }
70
+ /**
71
+ * 标识当前用户为全量,即不受限
72
+ */
73
+ setFull(val) {
74
+ this.full = val;
75
+ this.aclChange.next(val);
76
+ }
77
+ /**
78
+ * 设置当前用户权限能力(会先清除所有)
79
+ */
80
+ setAbility(abilities) {
81
+ this.set({ ability: abilities });
82
+ }
83
+ /**
84
+ * 设置当前用户角色(会先清除所有)
85
+ */
86
+ setRole(roles) {
87
+ this.set({ role: roles });
88
+ }
89
+ /**
90
+ * 为当前用户增加角色或权限能力
91
+ */
92
+ add(value) {
93
+ if (value.role && value.role.length > 0) {
94
+ this.roles.push(...value.role);
95
+ }
96
+ if (value.ability && value.ability.length > 0) {
97
+ this.abilities.push(...value.ability);
98
+ }
99
+ }
100
+ /**
101
+ * 为当前用户附加角色
102
+ */
103
+ attachRole(roles) {
104
+ for (const val of roles) {
105
+ if (!this.roles.includes(val)) {
106
+ this.roles.push(val);
107
+ }
108
+ }
109
+ this.aclChange.next(this.data);
110
+ }
111
+ /**
112
+ * 为当前用户附加权限
113
+ */
114
+ attachAbility(abilities) {
115
+ for (const val of abilities) {
116
+ if (!this.abilities.includes(val)) {
117
+ this.abilities.push(val);
118
+ }
119
+ }
120
+ this.aclChange.next(this.data);
121
+ }
122
+ /**
123
+ * 为当前用户移除角色
124
+ */
125
+ removeRole(roles) {
126
+ for (const val of roles) {
127
+ const idx = this.roles.indexOf(val);
128
+ if (idx !== -1) {
129
+ this.roles.splice(idx, 1);
130
+ }
131
+ }
132
+ this.aclChange.next(this.data);
133
+ }
134
+ /**
135
+ * 为当前用户移除权限
136
+ */
137
+ removeAbility(abilities) {
138
+ for (const val of abilities) {
139
+ const idx = this.abilities.indexOf(val);
140
+ if (idx !== -1) {
141
+ this.abilities.splice(idx, 1);
142
+ }
143
+ }
144
+ this.aclChange.next(this.data);
145
+ }
146
+ /**
147
+ * 当前用户是否有对应角色,其实 `number` 表示Ability
148
+ *
149
+ * - 当 `full: true` 或参数 `null` 时返回 `true`
150
+ * - 若使用 `ACLType` 参数,可以指定 `mode` 校验模式
151
+ */
152
+ can(roleOrAbility) {
153
+ const { preCan } = this.options;
154
+ if (preCan) {
155
+ roleOrAbility = preCan(roleOrAbility);
156
+ }
157
+ const t = this.parseACLType(roleOrAbility);
158
+ let result = false;
159
+ if (this.full === true || !roleOrAbility) {
160
+ result = true;
161
+ }
162
+ else {
163
+ if (t.role && t.role.length > 0) {
164
+ if (t.mode === 'allOf') {
165
+ result = t.role.every(v => this.roles.includes(v));
166
+ }
167
+ else {
168
+ result = t.role.some(v => this.roles.includes(v));
169
+ }
170
+ }
171
+ if (t.ability && t.ability.length > 0) {
172
+ if (t.mode === 'allOf') {
173
+ result = t.ability.every(v => this.abilities.includes(v));
174
+ }
175
+ else {
176
+ result = t.ability.some(v => this.abilities.includes(v));
177
+ }
178
+ }
179
+ }
180
+ return t.except === true ? !result : result;
181
+ }
182
+ /** @inner */
183
+ parseAbility(value) {
184
+ if (typeof value === 'number' || typeof value === 'string' || Array.isArray(value)) {
185
+ value = { ability: Array.isArray(value) ? value : [value] };
186
+ }
187
+ delete value.role;
188
+ return value;
189
+ }
190
+ /**
191
+ * 当前用户是否有对应权限点
192
+ */
193
+ canAbility(value) {
194
+ return this.can(this.parseAbility(value));
195
+ }
196
+ }
197
+ ACLService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLService, deps: [{ token: i1.YunzaiConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
198
+ ACLService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLService });
199
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLService, decorators: [{
200
+ type: Injectable
201
+ }], ctorParameters: function () { return [{ type: i1.YunzaiConfigService }]; } });
202
+
203
+ class ACLIfDirective {
204
+ constructor(templateRef, srv, _viewContainer) {
205
+ this.srv = srv;
206
+ this._viewContainer = _viewContainer;
207
+ this._thenTemplateRef = null;
208
+ this._elseTemplateRef = null;
209
+ this._thenViewRef = null;
210
+ this._elseViewRef = null;
211
+ this._except = false;
212
+ this._change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this._updateView());
213
+ this._thenTemplateRef = templateRef;
214
+ }
215
+ set aclIf(value) {
216
+ this._value = value;
217
+ this._updateView();
218
+ }
219
+ set aclIfThen(templateRef) {
220
+ this._thenTemplateRef = templateRef;
221
+ this._thenViewRef = null;
222
+ this._updateView();
223
+ }
224
+ set aclIfElse(templateRef) {
225
+ this._elseTemplateRef = templateRef;
226
+ this._elseViewRef = null;
227
+ this._updateView();
228
+ }
229
+ set except(value) {
230
+ this._except = value != null && `${value}` !== 'false';
231
+ }
232
+ get except() {
233
+ return this._except;
234
+ }
235
+ _updateView() {
236
+ const res = this.srv.can(this._value);
237
+ if ((res && !this.except) || (!res && this.except)) {
238
+ if (!this._thenViewRef) {
239
+ this._viewContainer.clear();
240
+ this._elseViewRef = null;
241
+ if (this._thenTemplateRef) {
242
+ this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef);
243
+ }
244
+ }
245
+ }
246
+ else {
247
+ if (!this._elseViewRef) {
248
+ this._viewContainer.clear();
249
+ this._thenViewRef = null;
250
+ if (this._elseTemplateRef) {
251
+ this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef);
252
+ }
253
+ }
254
+ }
255
+ }
256
+ ngOnDestroy() {
257
+ this._change$.unsubscribe();
258
+ }
259
+ }
260
+ ACLIfDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLIfDirective, deps: [{ token: i0.TemplateRef }, { token: ACLService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
261
+ ACLIfDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: ACLIfDirective, selector: "[aclIf]", inputs: { aclIf: "aclIf", aclIfThen: "aclIfThen", aclIfElse: "aclIfElse", except: "except" }, exportAs: ["aclIf"], ngImport: i0 });
262
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLIfDirective, decorators: [{
263
+ type: Directive,
264
+ args: [{
265
+ selector: '[aclIf]',
266
+ exportAs: 'aclIf'
267
+ }]
268
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: ACLService }, { type: i0.ViewContainerRef }]; }, propDecorators: { aclIf: [{
269
+ type: Input
270
+ }], aclIfThen: [{
271
+ type: Input
272
+ }], aclIfElse: [{
273
+ type: Input
274
+ }], except: [{
275
+ type: Input
276
+ }] } });
277
+
278
+ class ACLDirective {
279
+ constructor(el, renderer, srv) {
280
+ this.el = el;
281
+ this.renderer = renderer;
282
+ this.srv = srv;
283
+ this.change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this.set(this._value));
284
+ }
285
+ set acl(value) {
286
+ this.set(value);
287
+ }
288
+ set ability(value) {
289
+ this.set(this.srv.parseAbility(value));
290
+ }
291
+ set(value) {
292
+ this._value = value;
293
+ const CLS = 'acl__hide';
294
+ const el = this.el.nativeElement;
295
+ if (this.srv.can(this._value)) {
296
+ this.renderer.removeClass(el, CLS);
297
+ }
298
+ else {
299
+ this.renderer.addClass(el, CLS);
300
+ }
301
+ }
302
+ ngOnDestroy() {
303
+ this.change$.unsubscribe();
304
+ }
305
+ }
306
+ ACLDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: ACLService }], target: i0.ɵɵFactoryTarget.Directive });
307
+ ACLDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: ACLDirective, selector: "[acl]", inputs: { acl: "acl", ability: ["acl-ability", "ability"] }, exportAs: ["acl"], ngImport: i0 });
308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLDirective, decorators: [{
309
+ type: Directive,
310
+ args: [{
311
+ selector: '[acl]',
312
+ exportAs: 'acl'
313
+ }]
314
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: ACLService }]; }, propDecorators: { acl: [{
315
+ type: Input,
316
+ args: ['acl']
317
+ }], ability: [{
318
+ type: Input,
319
+ args: ['acl-ability']
320
+ }] } });
321
+
322
+ /**
323
+ * NOTE:`ACLType` 类型可能会被其他类库所引用,为了减少类库间彼此的依赖性,其他类库会以复制的形式存在
324
+ * 当这里有变化时,请务必同步更新,涉及:`MenuService.acl`、`util.YunzaiACLType`
325
+ * TODO: 尝试增加 `@yelon/core` 类库用于处理这种通用型
326
+ */
327
+
328
+ /**
329
+ * Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).
330
+ *
331
+ * ```ts
332
+ * data: {
333
+ * path: 'home',
334
+ * canActivate: [ ACLGuard ],
335
+ * data: { guard: 'user1' }
336
+ * }
337
+ * ```
338
+ */
339
+ class ACLGuard {
340
+ constructor(srv, router, injector) {
341
+ this.srv = srv;
342
+ this.router = router;
343
+ this.injector = injector;
344
+ }
345
+ process(data) {
346
+ data = {
347
+ guard: null,
348
+ guard_url: this.srv.guard_url,
349
+ ...data
350
+ };
351
+ let guard = data.guard;
352
+ if (typeof guard === 'function')
353
+ guard = guard(this.srv, this.injector);
354
+ return (guard && guard instanceof Observable ? guard : of(guard != null ? guard : null)).pipe(map(v => this.srv.can(v)), tap(v => {
355
+ if (v)
356
+ return;
357
+ this.router.navigateByUrl(data.guard_url);
358
+ }));
359
+ }
360
+ // lazy loading
361
+ canLoad(route) {
362
+ return this.process(route.data);
363
+ }
364
+ // all children route
365
+ canActivateChild(childRoute, state) {
366
+ return this.canActivate(childRoute, state);
367
+ }
368
+ // route
369
+ canActivate(route, _state) {
370
+ return this.process(route.data);
371
+ }
372
+ }
373
+ ACLGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLGuard, deps: [{ token: ACLService }, { token: i2.Router }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
374
+ ACLGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLGuard, providedIn: 'root' });
375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ACLGuard, decorators: [{
376
+ type: Injectable,
377
+ args: [{ providedIn: 'root' }]
378
+ }], ctorParameters: function () { return [{ type: ACLService }, { type: i2.Router }, { type: i0.Injector }]; } });
379
+
380
+ const COMPONENTS = [ACLDirective, ACLIfDirective];
381
+ class YelonACLModule {
382
+ static forRoot() {
383
+ return {
384
+ ngModule: YelonACLModule,
385
+ providers: [ACLService]
386
+ };
387
+ }
388
+ }
389
+ YelonACLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YelonACLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
390
+ YelonACLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YelonACLModule, declarations: [ACLDirective, ACLIfDirective], imports: [CommonModule], exports: [ACLDirective, ACLIfDirective] });
391
+ YelonACLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YelonACLModule, imports: [[CommonModule]] });
392
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YelonACLModule, decorators: [{
393
+ type: NgModule,
394
+ args: [{
395
+ imports: [CommonModule],
396
+ declarations: COMPONENTS,
397
+ exports: COMPONENTS
398
+ }]
399
+ }] });
400
+
401
+ /**
402
+ * Generated bundle index. Do not edit.
403
+ */
404
+
405
+ export { ACLDirective, ACLGuard, ACLIfDirective, ACLService, ACL_DEFAULT_CONFIG, YelonACLModule };
406
+ //# sourceMappingURL=acl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acl.mjs","sources":["../../../../packages/acl/src/acl.config.ts","../../../../packages/acl/src/acl.service.ts","../../../../packages/acl/src/acl-if.directive.ts","../../../../packages/acl/src/acl.directive.ts","../../../../packages/acl/src/acl.type.ts","../../../../packages/acl/src/acl-guard.ts","../../../../packages/acl/src/acl.module.ts","../../../../packages/acl/acl.ts"],"sourcesContent":["import { YunzaiACLConfig } from '@yelon/util/config';\n\nexport const ACL_DEFAULT_CONFIG: YunzaiACLConfig = {\n guard_url: `/403`\n};\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\n\nimport { YunzaiACLConfig, YunzaiConfigService } from '@yelon/util/config';\n\nimport { ACL_DEFAULT_CONFIG } from './acl.config';\nimport { ACLCanType, ACLType } from './acl.type';\n\n/**\n * ACL 控制服务,[在线文档](https://ng.yunzainfo.com/acl)\n *\n * 务必在根目录注册 `YelonACLModule.forRoot()` 才能使用服务\n */\n@Injectable()\nexport class ACLService {\n private options: YunzaiACLConfig;\n private roles: string[] = [];\n private abilities: Array<number | string> = [];\n private full = false;\n private aclChange = new BehaviorSubject<ACLType | boolean | null>(null);\n\n /** ACL变更通知 */\n get change(): Observable<ACLType | boolean | null> {\n return this.aclChange.asObservable();\n }\n\n /** 获取所有数据 */\n get data(): { full: boolean; roles: string[]; abilities: Array<string | number> } {\n return {\n full: this.full,\n roles: this.roles,\n abilities: this.abilities\n };\n }\n\n get guard_url(): string {\n return this.options.guard_url!;\n }\n\n constructor(configSrv: YunzaiConfigService) {\n this.options = configSrv.merge('acl', ACL_DEFAULT_CONFIG)!;\n }\n\n private parseACLType(val: string | string[] | number | number[] | ACLType | null): ACLType {\n let t: ACLType;\n if (typeof val === 'number') {\n t = { ability: [val] };\n } else if (Array.isArray(val) && val.length > 0 && typeof val[0] === 'number') {\n t = { ability: val };\n } else if (typeof val === 'object' && !Array.isArray(val)) {\n t = { ...val };\n } else if (Array.isArray(val)) {\n t = { role: val as string[] };\n } else {\n t = { role: val == null ? [] : [val] };\n }\n\n return { except: false, ...t };\n }\n\n /**\n * 设置当前用户角色或权限能力(会先清除所有)\n */\n set(value: ACLType): void {\n this.full = false;\n this.abilities = [];\n this.roles = [];\n this.add(value);\n this.aclChange.next(value);\n }\n\n /**\n * 标识当前用户为全量,即不受限\n */\n setFull(val: boolean): void {\n this.full = val;\n this.aclChange.next(val);\n }\n\n /**\n * 设置当前用户权限能力(会先清除所有)\n */\n setAbility(abilities: Array<number | string>): void {\n this.set({ ability: abilities } as ACLType);\n }\n\n /**\n * 设置当前用户角色(会先清除所有)\n */\n setRole(roles: string[]): void {\n this.set({ role: roles } as ACLType);\n }\n\n /**\n * 为当前用户增加角色或权限能力\n */\n add(value: ACLType): void {\n if (value.role && value.role.length > 0) {\n this.roles.push(...value.role);\n }\n if (value.ability && value.ability.length > 0) {\n this.abilities.push(...value.ability);\n }\n }\n\n /**\n * 为当前用户附加角色\n */\n attachRole(roles: string[]): void {\n for (const val of roles) {\n if (!this.roles.includes(val)) {\n this.roles.push(val);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 为当前用户附加权限\n */\n attachAbility(abilities: Array<number | string>): void {\n for (const val of abilities) {\n if (!this.abilities.includes(val)) {\n this.abilities.push(val);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 为当前用户移除角色\n */\n removeRole(roles: string[]): void {\n for (const val of roles) {\n const idx = this.roles.indexOf(val);\n if (idx !== -1) {\n this.roles.splice(idx, 1);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 为当前用户移除权限\n */\n removeAbility(abilities: Array<number | string>): void {\n for (const val of abilities) {\n const idx = this.abilities.indexOf(val);\n if (idx !== -1) {\n this.abilities.splice(idx, 1);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 当前用户是否有对应角色,其实 `number` 表示Ability\n *\n * - 当 `full: true` 或参数 `null` 时返回 `true`\n * - 若使用 `ACLType` 参数,可以指定 `mode` 校验模式\n */\n can(roleOrAbility: ACLCanType | null): boolean {\n const { preCan } = this.options;\n if (preCan) {\n roleOrAbility = preCan(roleOrAbility!);\n }\n\n const t = this.parseACLType(roleOrAbility);\n let result = false;\n if (this.full === true || !roleOrAbility) {\n result = true;\n } else {\n if (t.role && t.role.length > 0) {\n if (t.mode === 'allOf') {\n result = t.role.every(v => this.roles.includes(v));\n } else {\n result = t.role.some(v => this.roles.includes(v));\n }\n }\n if (t.ability && t.ability.length > 0) {\n if (t.mode === 'allOf') {\n result = (t.ability as Array<number | string>).every(v => this.abilities.includes(v));\n } else {\n result = (t.ability as Array<number | string>).some(v => this.abilities.includes(v));\n }\n }\n }\n\n return t.except === true ? !result : result;\n }\n\n /** @inner */\n parseAbility(value: ACLCanType): ACLCanType {\n if (typeof value === 'number' || typeof value === 'string' || Array.isArray(value)) {\n value = { ability: Array.isArray(value) ? value : [value] } as ACLType;\n }\n delete value.role;\n return value;\n }\n\n /**\n * 当前用户是否有对应权限点\n */\n canAbility(value: ACLCanType): boolean {\n return this.can(this.parseAbility(value));\n }\n}\n","import { Directive, EmbeddedViewRef, Input, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { ACLService } from './acl.service';\nimport { ACLCanType } from './acl.type';\n\n@Directive({\n selector: '[aclIf]',\n exportAs: 'aclIf'\n})\nexport class ACLIfDirective implements OnDestroy {\n static ngAcceptInputType_except: boolean | string | undefined | null;\n\n private _value!: ACLCanType;\n private _change$: Subscription;\n private _thenTemplateRef: TemplateRef<void> | null = null;\n private _elseTemplateRef: TemplateRef<void> | null = null;\n private _thenViewRef: EmbeddedViewRef<void> | null = null;\n private _elseViewRef: EmbeddedViewRef<void> | null = null;\n private _except = false;\n\n constructor(templateRef: TemplateRef<void>, private srv: ACLService, private _viewContainer: ViewContainerRef) {\n this._change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this._updateView());\n this._thenTemplateRef = templateRef;\n }\n\n @Input()\n set aclIf(value: ACLCanType) {\n this._value = value;\n this._updateView();\n }\n\n @Input()\n set aclIfThen(templateRef: TemplateRef<void> | null) {\n this._thenTemplateRef = templateRef;\n this._thenViewRef = null;\n this._updateView();\n }\n\n @Input()\n set aclIfElse(templateRef: TemplateRef<void> | null) {\n this._elseTemplateRef = templateRef;\n this._elseViewRef = null;\n this._updateView();\n }\n\n @Input()\n set except(value: boolean) {\n this._except = value != null && `${value}` !== 'false';\n }\n get except(): boolean {\n return this._except;\n }\n\n protected _updateView(): void {\n const res = this.srv.can(this._value);\n if ((res && !this.except) || (!res && this.except)) {\n if (!this._thenViewRef) {\n this._viewContainer.clear();\n this._elseViewRef = null;\n if (this._thenTemplateRef) {\n this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef);\n }\n }\n } else {\n if (!this._elseViewRef) {\n this._viewContainer.clear();\n this._thenViewRef = null;\n if (this._elseTemplateRef) {\n this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef);\n }\n }\n }\n }\n\n ngOnDestroy(): void {\n this._change$.unsubscribe();\n }\n}\n","import { Directive, ElementRef, Input, OnDestroy, Renderer2 } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { ACLService } from './acl.service';\nimport { ACLCanType } from './acl.type';\n\n@Directive({\n selector: '[acl]',\n exportAs: 'acl'\n})\nexport class ACLDirective implements OnDestroy {\n private _value!: ACLCanType;\n private change$: Subscription;\n\n @Input('acl')\n set acl(value: ACLCanType) {\n this.set(value);\n }\n\n @Input('acl-ability')\n set ability(value: ACLCanType) {\n this.set(this.srv.parseAbility(value));\n }\n\n private set(value: ACLCanType): void {\n this._value = value;\n const CLS = 'acl__hide';\n const el = this.el.nativeElement;\n if (this.srv.can(this._value)) {\n this.renderer.removeClass(el, CLS);\n } else {\n this.renderer.addClass(el, CLS);\n }\n }\n\n constructor(private el: ElementRef, private renderer: Renderer2, protected srv: ACLService) {\n this.change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this.set(this._value));\n }\n\n ngOnDestroy(): void {\n this.change$.unsubscribe();\n }\n}\n","/**\n * NOTE:`ACLType` 类型可能会被其他类库所引用,为了减少类库间彼此的依赖性,其他类库会以复制的形式存在\n * 当这里有变化时,请务必同步更新,涉及:`MenuService.acl`、`util.YunzaiACLType`\n * TODO: 尝试增加 `@yelon/core` 类库用于处理这种通用型\n */\n\nimport { Injector } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nimport { ACLService } from './acl.service';\n\nexport interface ACLType {\n /**\n * 角色\n */\n role?: string[];\n /**\n * 权限点\n */\n ability?: number[] | string[];\n\n /**\n * Validated against, default: `oneOf`\n * - `allOf` the value validates against all the roles or abilities\n * - `oneOf` the value validates against exactly one of the roles or abilities\n */\n mode?: 'allOf' | 'oneOf';\n\n /**\n * 是否取反,即结果为 `true` 时表示未授权\n */\n except?: boolean;\n\n [key: string]: NzSafeAny;\n}\n\nexport type ACLCanType = number | number[] | string | string[] | ACLType;\nexport type ACLGuardFunctionType = (srv: ACLService, injector: Injector) => Observable<ACLCanType>;\nexport type ACLGuardType = ACLCanType | Observable<ACLCanType> | ACLGuardFunctionType;\n","import { Injectable, Injector } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n CanActivateChild,\n CanLoad,\n Data,\n Route,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { map, tap } from 'rxjs/operators';\n\nimport { ACLService } from './acl.service';\nimport { ACLCanType, ACLGuardType } from './acl.type';\n\n/**\n * Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).\n *\n * ```ts\n * data: {\n * path: 'home',\n * canActivate: [ ACLGuard ],\n * data: { guard: 'user1' }\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class ACLGuard implements CanActivate, CanActivateChild, CanLoad {\n constructor(private srv: ACLService, private router: Router, private injector: Injector) {}\n\n private process(data: Data): Observable<boolean> {\n data = {\n guard: null,\n guard_url: this.srv.guard_url,\n ...data\n };\n let guard: ACLGuardType = data.guard;\n if (typeof guard === 'function') guard = guard(this.srv, this.injector);\n return (guard && guard instanceof Observable ? guard : of(guard != null ? (guard as ACLCanType) : null)).pipe(\n map(v => this.srv.can(v)),\n tap(v => {\n if (v) return;\n this.router.navigateByUrl(data.guard_url);\n })\n );\n }\n\n // lazy loading\n canLoad(route: Route): Observable<boolean> {\n return this.process(route.data!);\n }\n // all children route\n canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {\n return this.canActivate(childRoute, state);\n }\n // route\n canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean> {\n return this.process(route.data);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { ACLIfDirective } from './acl-if.directive';\nimport { ACLDirective } from './acl.directive';\nimport { ACLService } from './acl.service';\n\nconst COMPONENTS = [ACLDirective, ACLIfDirective];\n\n@NgModule({\n imports: [CommonModule],\n declarations: COMPONENTS,\n exports: COMPONENTS\n})\nexport class YelonACLModule {\n static forRoot(): ModuleWithProviders<YelonACLModule> {\n return {\n ngModule: YelonACLModule,\n providers: [ACLService]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAEa,kBAAkB,GAAoB;IACjD,SAAS,EAAE,MAAM;;;ACKnB;;;;;MAMa,UAAU;IAyBrB,YAAY,SAA8B;QAvBlC,UAAK,GAAa,EAAE,CAAC;QACrB,cAAS,GAA2B,EAAE,CAAC;QACvC,SAAI,GAAG,KAAK,CAAC;QACb,cAAS,GAAG,IAAI,eAAe,CAA2B,IAAI,CAAC,CAAC;QAqBt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E,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;KAC5C;;IAED,WAAW,CAAC,KAA6B,EAAE,MAAkC;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACjC;;qGA/BU,QAAQ;yGAAR,QAAQ,cADK,MAAM;2FACnB,QAAQ;kBADpB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACrBlC,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;MAOrC,cAAc;IACzB,OAAO,OAAO;QACZ,OAAO;YACL,QAAQ,EAAE,cAAc;YACxB,SAAS,EAAE,CAAC,UAAU,CAAC;SACxB,CAAC;KACH;;2GANU,cAAc;4GAAd,cAAc,iBAPP,YAAY,EAAE,cAAc,aAGpC,YAAY,aAHJ,YAAY,EAAE,cAAc;4GAOnC,cAAc,YAJhB,CAAC,YAAY,CAAC;2FAIZ,cAAc;kBAL1B,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,YAAY,EAAE,UAAU;oBACxB,OAAO,EAAE,UAAU;iBACpB;;;ACbD;;;;;;"}
package/package.json CHANGED
@@ -1,18 +1,30 @@
1
1
  {
2
2
  "name": "@yelon/acl",
3
- "version": "12.0.16",
3
+ "version": "13.0.0-beta.1",
4
4
  "author": "devcui<devcui@outlook.com>",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
- "@yelon/util": "^12.0.16",
8
- "tslib": "^2.2.0"
7
+ "@yelon/util": "^13.0.0-beta.1",
8
+ "tslib": "^2.3.0"
9
9
  },
10
- "main": "bundles/acl.umd.js",
11
- "module": "fesm2015/acl.js",
12
- "es2015": "fesm2015/acl.js",
13
- "esm2015": "esm2015/acl.js",
14
- "fesm2015": "fesm2015/acl.js",
10
+ "module": "fesm2015/acl.mjs",
11
+ "es2020": "fesm2020/acl.mjs",
12
+ "esm2020": "esm2020/acl.mjs",
13
+ "fesm2020": "fesm2020/acl.mjs",
14
+ "fesm2015": "fesm2015/acl.mjs",
15
15
  "typings": "acl.d.ts",
16
- "metadata": "acl.metadata.json",
16
+ "exports": {
17
+ "./package.json": {
18
+ "default": "./package.json"
19
+ },
20
+ ".": {
21
+ "types": "./acl.d.ts",
22
+ "esm2020": "./esm2020/acl.mjs",
23
+ "es2020": "./fesm2020/acl.mjs",
24
+ "es2015": "./fesm2015/acl.mjs",
25
+ "node": "./fesm2015/acl.mjs",
26
+ "default": "./fesm2020/acl.mjs"
27
+ }
28
+ },
17
29
  "sideEffects": false
18
30
  }
@@ -2,6 +2,7 @@ import { Injector } from '@angular/core';
2
2
  import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, CanLoad, Route, Router, RouterStateSnapshot } from '@angular/router';
3
3
  import { Observable } from 'rxjs';
4
4
  import { ACLService } from './acl.service';
5
+ import * as i0 from "@angular/core";
5
6
  /**
6
7
  * Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).
7
8
  *
@@ -22,4 +23,6 @@ export declare class ACLGuard implements CanActivate, CanActivateChild, CanLoad
22
23
  canLoad(route: Route): Observable<boolean>;
23
24
  canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>;
24
25
  canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean>;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<ACLGuard, never>;
27
+ static ɵprov: i0.ɵɵInjectableDeclaration<ACLGuard>;
25
28
  }
@@ -1,6 +1,7 @@
1
1
  import { OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
2
2
  import { ACLService } from './acl.service';
3
3
  import { ACLCanType } from './acl.type';
4
+ import * as i0 from "@angular/core";
4
5
  export declare class ACLIfDirective implements OnDestroy {
5
6
  private srv;
6
7
  private _viewContainer;
@@ -20,4 +21,6 @@ export declare class ACLIfDirective implements OnDestroy {
20
21
  get except(): boolean;
21
22
  protected _updateView(): void;
22
23
  ngOnDestroy(): void;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<ACLIfDirective, never>;
25
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ACLIfDirective, "[aclIf]", ["aclIf"], { "aclIf": "aclIf"; "aclIfThen": "aclIfThen"; "aclIfElse": "aclIfElse"; "except": "except"; }, {}, never>;
23
26
  }
@@ -1,6 +1,7 @@
1
1
  import { ElementRef, OnDestroy, Renderer2 } from '@angular/core';
2
2
  import { ACLService } from './acl.service';
3
3
  import { ACLCanType } from './acl.type';
4
+ import * as i0 from "@angular/core";
4
5
  export declare class ACLDirective implements OnDestroy {
5
6
  private el;
6
7
  private renderer;
@@ -12,4 +13,6 @@ export declare class ACLDirective implements OnDestroy {
12
13
  private set;
13
14
  constructor(el: ElementRef, renderer: Renderer2, srv: ACLService);
14
15
  ngOnDestroy(): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<ACLDirective, never>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ACLDirective, "[acl]", ["acl"], { "acl": "acl"; "ability": "acl-ability"; }, {}, never>;
15
18
  }
@@ -1,4 +1,11 @@
1
1
  import { ModuleWithProviders } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "./acl.directive";
4
+ import * as i2 from "./acl-if.directive";
5
+ import * as i3 from "@angular/common";
2
6
  export declare class YelonACLModule {
3
7
  static forRoot(): ModuleWithProviders<YelonACLModule>;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<YelonACLModule, never>;
9
+ static ɵmod: i0.ɵɵNgModuleDeclaration<YelonACLModule, [typeof i1.ACLDirective, typeof i2.ACLIfDirective], [typeof i3.CommonModule], [typeof i1.ACLDirective, typeof i2.ACLIfDirective]>;
10
+ static ɵinj: i0.ɵɵInjectorDeclaration<YelonACLModule>;
4
11
  }
@@ -1,6 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { YunzaiConfigService } from '@yelon/util/config';
3
3
  import { ACLCanType, ACLType } from './acl.type';
4
+ import * as i0 from "@angular/core";
4
5
  /**
5
6
  * ACL 控制服务,[在线文档](https://ng.yunzainfo.com/acl)
6
7
  *
@@ -72,4 +73,6 @@ export declare class ACLService {
72
73
  * 当前用户是否有对应权限点
73
74
  */
74
75
  canAbility(value: ACLCanType): boolean;
76
+ static ɵfac: i0.ɵɵFactoryDeclaration<ACLService, never>;
77
+ static ɵprov: i0.ɵɵInjectableDeclaration<ACLService>;
75
78
  }
package/acl.metadata.json DELETED
@@ -1 +0,0 @@
1
- {"__symbolic":"module","version":4,"metadata":{"ACLService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":13,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@yelon/util/config","name":"YunzaiConfigService","line":39,"character":25}]}],"parseACLType":[{"__symbolic":"method"}],"set":[{"__symbolic":"method"}],"setFull":[{"__symbolic":"method"}],"setAbility":[{"__symbolic":"method"}],"setRole":[{"__symbolic":"method"}],"add":[{"__symbolic":"method"}],"attachRole":[{"__symbolic":"method"}],"attachAbility":[{"__symbolic":"method"}],"removeRole":[{"__symbolic":"method"}],"removeAbility":[{"__symbolic":"method"}],"can":[{"__symbolic":"method"}],"parseAbility":[{"__symbolic":"method"}],"canAbility":[{"__symbolic":"method"}]}},"ACLIfDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":7,"character":1},"arguments":[{"selector":"[aclIf]","exportAs":"aclIf"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"TemplateRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":22,"character":39,"module":"./src/acl-if.directive"}]},{"__symbolic":"reference","name":"ACLService"},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":22,"character":95}]}],"aclIf":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":3}}]}],"aclIfThen":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"aclIfElse":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"except":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":47,"character":3}}]}],"_updateView":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"ACLDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":7,"character":1},"arguments":[{"selector":"[acl]","exportAs":"acl"}]}],"members":{"acl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3},"arguments":["acl"]}]}],"ability":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":20,"character":3},"arguments":["acl-ability"]}]}],"set":[{"__symbolic":"method"}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":36,"character":26},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":36,"character":56},{"__symbolic":"reference","name":"ACLService"}]}],"ngOnDestroy":[{"__symbolic":"method"}]}},"ACL_DEFAULT_CONFIG":{"guard_url":"/403"},"ACLType":{"__symbolic":"interface"},"ACLCanType":{"__symbolic":"interface"},"ACLGuardFunctionType":{"__symbolic":"interface"},"ACLGuardType":{"__symbolic":"interface"},"ACLGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":28,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ACLService"},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":30,"character":55},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":30,"character":81}]}],"process":[{"__symbolic":"method"}],"canLoad":[{"__symbolic":"method"}],"canActivateChild":[{"__symbolic":"method"}],"canActivate":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"YelonACLModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":9,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":10,"character":12}],"declarations":[{"__symbolic":"reference","name":"ACLDirective"},{"__symbolic":"reference","name":"ACLIfDirective"}],"exports":[{"__symbolic":"reference","name":"ACLDirective"},{"__symbolic":"reference","name":"ACLIfDirective"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"YelonACLModule"},"providers":[{"__symbolic":"reference","name":"ACLService"}]}}}}},"origins":{"ACLService":"./src/acl.service","ACLIfDirective":"./src/acl-if.directive","ACLDirective":"./src/acl.directive","ACL_DEFAULT_CONFIG":"./src/acl.config","ACLType":"./src/acl.type","ACLCanType":"./src/acl.type","ACLGuardFunctionType":"./src/acl.type","ACLGuardType":"./src/acl.type","ACLGuard":"./src/acl-guard","YelonACLModule":"./src/acl.module"},"importAs":"@yelon/acl"}