quang 20.3.1 → 20.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/quang-auth-mobile.mjs.map +1 -1
- package/fesm2022/quang-auth.mjs +25 -25
- package/fesm2022/quang-auth.mjs.map +1 -1
- package/fesm2022/quang-components-autocomplete.mjs +27 -27
- package/fesm2022/quang-components-autocomplete.mjs.map +1 -1
- package/fesm2022/quang-components-checkbox.mjs +7 -7
- package/fesm2022/quang-components-checkbox.mjs.map +1 -1
- package/fesm2022/quang-components-date.mjs +36 -36
- package/fesm2022/quang-components-date.mjs.map +1 -1
- package/fesm2022/quang-components-input.mjs +15 -15
- package/fesm2022/quang-components-input.mjs.map +1 -1
- package/fesm2022/quang-components-paginator.mjs +28 -28
- package/fesm2022/quang-components-paginator.mjs.map +1 -1
- package/fesm2022/quang-components-select.mjs +15 -15
- package/fesm2022/quang-components-select.mjs.map +1 -1
- package/fesm2022/quang-components-shared.mjs +55 -52
- package/fesm2022/quang-components-shared.mjs.map +1 -1
- package/fesm2022/quang-components-table.mjs +16 -16
- package/fesm2022/quang-components-table.mjs.map +1 -1
- package/fesm2022/quang-components-wysiwyg.mjs +32 -32
- package/fesm2022/quang-components-wysiwyg.mjs.map +1 -1
- package/fesm2022/quang-data-handling.mjs.map +1 -1
- package/fesm2022/quang-device.mjs +3 -3
- package/fesm2022/quang-device.mjs.map +1 -1
- package/fesm2022/quang-forms.mjs.map +1 -1
- package/fesm2022/quang-loader.mjs +8 -8
- package/fesm2022/quang-loader.mjs.map +1 -1
- package/fesm2022/quang-overlay-modal.mjs +21 -21
- package/fesm2022/quang-overlay-modal.mjs.map +1 -1
- package/fesm2022/quang-overlay-popover.mjs +12 -12
- package/fesm2022/quang-overlay-popover.mjs.map +1 -1
- package/fesm2022/quang-overlay-shared.mjs +33 -33
- package/fesm2022/quang-overlay-shared.mjs.map +1 -1
- package/fesm2022/quang-overlay-toast.mjs +11 -11
- package/fesm2022/quang-overlay-toast.mjs.map +1 -1
- package/fesm2022/quang-overlay-tooltip.mjs +13 -13
- package/fesm2022/quang-overlay-tooltip.mjs.map +1 -1
- package/fesm2022/quang-shared.mjs.map +1 -1
- package/fesm2022/quang-translation.mjs +6 -6
- package/fesm2022/quang-translation.mjs.map +1 -1
- package/fesm2022/quang.mjs.map +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quang-auth-mobile.mjs","sources":["../../../projects/quang/auth/mobile/mobile-auth-feature.ts","../../../projects/quang/auth/mobile/quang-auth-mobile.ts"],"sourcesContent":["import { EnvironmentProviders, NgZone, Provider, inject, provideAppInitializer } from '@angular/core'\n\nimport { App, URLOpenListenerEvent } from '@capacitor/app'\nimport { Browser } from '@capacitor/browser'\nimport { Capacitor } from '@capacitor/core'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, QuangAuthService, provideOpenURI, quangAuthFeature } from 'quang/auth'\n\nexport function withMobileAuth(\n toolbarColor = '#000000',\n presentationStyle: 'popover' | 'fullscreen' = 'popover'\n): QuangAuthFeature<QuangAuthFeatureKind.MobileAuthFeature> {\n const providers: (Provider | EnvironmentProviders)[] = [\n provideOpenURI((url: string) => {\n if (Capacitor.isNativePlatform()) {\n if (Capacitor.getPlatform() === 'ios')\n Browser.addListener('browserFinished', () => {\n window.location.reload()\n })\n Browser.open({ url, presentationStyle, toolbarColor })\n } else location.href = url\n }),\n provideAppInitializer(() => {\n if (!Capacitor.isNativePlatform()) return\n\n const ngZone: NgZone = inject(NgZone)\n const authService: QuangAuthService = inject(QuangAuthService)\n App.addListener('appUrlOpen', (event: URLOpenListenerEvent) => {\n ngZone.run(() => {\n Browser.removeAllListeners()\n Browser.close()\n const [, queryParams] = event.url.split('?')\n\n location.href = `/?${queryParams}`\n })\n })\n App.addListener('resume', () => {\n ngZone.run(() => {\n authService.init()\n })\n })\n }),\n ]\n return quangAuthFeature(QuangAuthFeatureKind.MobileAuthFeature, providers)\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQM,SAAU,cAAc,CAC5B,YAAY,GAAG,SAAS,EACxB,oBAA8C,SAAS,EAAA;AAEvD,IAAA,MAAM,SAAS,GAAwC;AACrD,QAAA,cAAc,CAAC,CAAC,GAAW,KAAI;AAC7B,YAAA,IAAI,SAAS,CAAC,gBAAgB,EAAE,EAAE;AAChC,gBAAA,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,KAAK;AACnC,oBAAA,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,MAAK;AAC1C,wBAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;AAC1B,
|
|
1
|
+
{"version":3,"file":"quang-auth-mobile.mjs","sources":["../../../projects/quang/auth/mobile/mobile-auth-feature.ts","../../../projects/quang/auth/mobile/quang-auth-mobile.ts"],"sourcesContent":["import { EnvironmentProviders, NgZone, Provider, inject, provideAppInitializer } from '@angular/core'\n\nimport { App, URLOpenListenerEvent } from '@capacitor/app'\nimport { Browser } from '@capacitor/browser'\nimport { Capacitor } from '@capacitor/core'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, QuangAuthService, provideOpenURI, quangAuthFeature } from 'quang/auth'\n\nexport function withMobileAuth(\n toolbarColor = '#000000',\n presentationStyle: 'popover' | 'fullscreen' = 'popover'\n): QuangAuthFeature<QuangAuthFeatureKind.MobileAuthFeature> {\n const providers: (Provider | EnvironmentProviders)[] = [\n provideOpenURI((url: string) => {\n if (Capacitor.isNativePlatform()) {\n if (Capacitor.getPlatform() === 'ios')\n Browser.addListener('browserFinished', () => {\n window.location.reload()\n })\n Browser.open({ url, presentationStyle, toolbarColor })\n } else location.href = url\n }),\n provideAppInitializer(() => {\n if (!Capacitor.isNativePlatform()) return\n\n const ngZone: NgZone = inject(NgZone)\n const authService: QuangAuthService = inject(QuangAuthService)\n App.addListener('appUrlOpen', (event: URLOpenListenerEvent) => {\n ngZone.run(() => {\n Browser.removeAllListeners()\n Browser.close()\n const [, queryParams] = event.url.split('?')\n\n location.href = `/?${queryParams}`\n })\n })\n App.addListener('resume', () => {\n ngZone.run(() => {\n authService.init()\n })\n })\n }),\n ]\n return quangAuthFeature(QuangAuthFeatureKind.MobileAuthFeature, providers)\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQM,SAAU,cAAc,CAC5B,YAAY,GAAG,SAAS,EACxB,oBAA8C,SAAS,EAAA;AAEvD,IAAA,MAAM,SAAS,GAAwC;AACrD,QAAA,cAAc,CAAC,CAAC,GAAW,KAAI;AAC7B,YAAA,IAAI,SAAS,CAAC,gBAAgB,EAAE,EAAE;AAChC,gBAAA,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,KAAK;AACnC,oBAAA,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,MAAK;AAC1C,wBAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;AAC1B,oBAAA,CAAC,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC;YACxD;;AAAO,gBAAA,QAAQ,CAAC,IAAI,GAAG,GAAG;AAC5B,QAAA,CAAC,CAAC;QACF,qBAAqB,CAAC,MAAK;AACzB,YAAA,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE;gBAAE;AAEnC,YAAA,MAAM,MAAM,GAAW,MAAM,CAAC,MAAM,CAAC;AACrC,YAAA,MAAM,WAAW,GAAqB,MAAM,CAAC,gBAAgB,CAAC;YAC9D,GAAG,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,KAA2B,KAAI;AAC5D,gBAAA,MAAM,CAAC,GAAG,CAAC,MAAK;oBACd,OAAO,CAAC,kBAAkB,EAAE;oBAC5B,OAAO,CAAC,KAAK,EAAE;AACf,oBAAA,MAAM,GAAG,WAAW,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;AAE5C,oBAAA,QAAQ,CAAC,IAAI,GAAG,CAAA,EAAA,EAAK,WAAW,EAAE;AACpC,gBAAA,CAAC,CAAC;AACJ,YAAA,CAAC,CAAC;AACF,YAAA,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAK;AAC7B,gBAAA,MAAM,CAAC,GAAG,CAAC,MAAK;oBACd,WAAW,CAAC,IAAI,EAAE;AACpB,gBAAA,CAAC,CAAC;AACJ,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;KACH;AACD,IAAA,OAAO,gBAAgB,CAAA,CAAA,+CAAyC,SAAS,CAAC;AAC5E;;AC5CA;;AAEG;;;;"}
|
package/fesm2022/quang-auth.mjs
CHANGED
|
@@ -44,7 +44,7 @@ class QuangAuthService {
|
|
|
44
44
|
this.oAuthService = inject(OAuthService, { optional: true });
|
|
45
45
|
this.state = signalState(initialState);
|
|
46
46
|
this.loginChecked = this.state.loginStatus.checked;
|
|
47
|
-
this.isAuthenticated = computed(() => !!this.state.tokenStatus.accessToken());
|
|
47
|
+
this.isAuthenticated = computed(() => !!this.state.tokenStatus.accessToken(), ...(ngDevMode ? [{ debugName: "isAuthenticated" }] : []));
|
|
48
48
|
this.authenticationError = this.state.loginStatus.authenticationError;
|
|
49
49
|
this.tokenStatus = this.state.tokenStatus;
|
|
50
50
|
this.roles = this.state.roles;
|
|
@@ -173,10 +173,10 @@ class QuangAuthService {
|
|
|
173
173
|
hasAtLeastOneRole(roles) {
|
|
174
174
|
return roles.some((role) => this.roles().has(role));
|
|
175
175
|
}
|
|
176
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
177
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
176
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangAuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
177
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangAuthService, providedIn: 'root' }); }
|
|
178
178
|
}
|
|
179
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangAuthService, decorators: [{
|
|
180
180
|
type: Injectable,
|
|
181
181
|
args: [{
|
|
182
182
|
providedIn: 'root',
|
|
@@ -225,7 +225,7 @@ function quangAuthFeature(kind, providers) {
|
|
|
225
225
|
class QuangHasAtLeastOneRoleDirective {
|
|
226
226
|
constructor() {
|
|
227
227
|
this.logLevel = inject(QUANG_LOGGING_BEHAVIOR, { optional: true });
|
|
228
|
-
this.targetRoles = input.required({ alias: 'quangHasAtLeastOneRole' });
|
|
228
|
+
this.targetRoles = input.required(...(ngDevMode ? [{ debugName: "targetRoles", alias: 'quangHasAtLeastOneRole' }] : [{ alias: 'quangHasAtLeastOneRole' }]));
|
|
229
229
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
230
230
|
this.embeddedViewRef = null;
|
|
231
231
|
this.templateRef = inject(TemplateRef);
|
|
@@ -245,12 +245,12 @@ class QuangHasAtLeastOneRoleDirective {
|
|
|
245
245
|
this.embeddedViewRef = null;
|
|
246
246
|
}
|
|
247
247
|
this.changeDetectorRef.markForCheck();
|
|
248
|
-
});
|
|
248
|
+
}, ...(ngDevMode ? [{ debugName: "hideViewIfNotAllowed" }] : []));
|
|
249
249
|
}
|
|
250
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
251
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.
|
|
250
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangHasAtLeastOneRoleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
251
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.1", type: QuangHasAtLeastOneRoleDirective, isStandalone: true, selector: "[quangHasAtLeastOneRole]", inputs: { targetRoles: { classPropertyName: "targetRoles", publicName: "quangHasAtLeastOneRole", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
252
252
|
}
|
|
253
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangHasAtLeastOneRoleDirective, decorators: [{
|
|
254
254
|
type: Directive,
|
|
255
255
|
args: [{
|
|
256
256
|
selector: '[quangHasAtLeastOneRole]',
|
|
@@ -270,7 +270,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
|
|
|
270
270
|
class QuangHasEveryRoleDirective {
|
|
271
271
|
constructor() {
|
|
272
272
|
this.logLevel = inject(QUANG_LOGGING_BEHAVIOR, { optional: true });
|
|
273
|
-
this.targetRoles = input.required({ alias: 'quangHasEveryRole' });
|
|
273
|
+
this.targetRoles = input.required(...(ngDevMode ? [{ debugName: "targetRoles", alias: 'quangHasEveryRole' }] : [{ alias: 'quangHasEveryRole' }]));
|
|
274
274
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
275
275
|
this.embeddedViewRef = null;
|
|
276
276
|
this.templateRef = inject(TemplateRef);
|
|
@@ -290,12 +290,12 @@ class QuangHasEveryRoleDirective {
|
|
|
290
290
|
this.embeddedViewRef = null;
|
|
291
291
|
}
|
|
292
292
|
this.changeDetectorRef.markForCheck();
|
|
293
|
-
});
|
|
293
|
+
}, ...(ngDevMode ? [{ debugName: "hideViewIfNotAllowed" }] : []));
|
|
294
294
|
}
|
|
295
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
296
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.
|
|
295
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangHasEveryRoleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
296
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.1", type: QuangHasEveryRoleDirective, isStandalone: true, selector: "[quangHasEveryRole]", inputs: { targetRoles: { classPropertyName: "targetRoles", publicName: "quangHasEveryRole", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
297
297
|
}
|
|
298
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
298
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangHasEveryRoleDirective, decorators: [{
|
|
299
299
|
type: Directive,
|
|
300
300
|
args: [{
|
|
301
301
|
selector: '[quangHasEveryRole]',
|
|
@@ -320,12 +320,12 @@ class QuangIsAuthenticatedDirective {
|
|
|
320
320
|
this.embeddedViewRef = null;
|
|
321
321
|
}
|
|
322
322
|
this.changeDetectorRef.markForCheck();
|
|
323
|
-
});
|
|
323
|
+
}, ...(ngDevMode ? [{ debugName: "hideViewIfNotAuthenticated" }] : []));
|
|
324
324
|
}
|
|
325
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
326
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.
|
|
325
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangIsAuthenticatedDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
326
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: QuangIsAuthenticatedDirective, isStandalone: true, selector: "[quangIsAuthenticated]", ngImport: i0 }); }
|
|
327
327
|
}
|
|
328
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangIsAuthenticatedDirective, decorators: [{
|
|
329
329
|
type: Directive,
|
|
330
330
|
args: [{
|
|
331
331
|
selector: '[quangIsAuthenticated]',
|
|
@@ -349,12 +349,12 @@ class QuangIsNotAuthenticatedDirective {
|
|
|
349
349
|
this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef);
|
|
350
350
|
}
|
|
351
351
|
this.changeDetectorRef.markForCheck();
|
|
352
|
-
});
|
|
352
|
+
}, ...(ngDevMode ? [{ debugName: "showViewIfNotAuthenticated" }] : []));
|
|
353
353
|
}
|
|
354
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
355
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.
|
|
354
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangIsNotAuthenticatedDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
355
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: QuangIsNotAuthenticatedDirective, isStandalone: true, selector: "[quangIsNotAuthenticated]", ngImport: i0 }); }
|
|
356
356
|
}
|
|
357
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
357
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangIsNotAuthenticatedDirective, decorators: [{
|
|
358
358
|
type: Directive,
|
|
359
359
|
args: [{
|
|
360
360
|
selector: '[quangIsNotAuthenticated]',
|
|
@@ -439,10 +439,10 @@ class MemoryStorage {
|
|
|
439
439
|
setItem(key, data) {
|
|
440
440
|
this.data.set(key, data);
|
|
441
441
|
}
|
|
442
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
443
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
442
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: MemoryStorage, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
443
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: MemoryStorage }); }
|
|
444
444
|
}
|
|
445
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
445
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: MemoryStorage, decorators: [{
|
|
446
446
|
type: Injectable
|
|
447
447
|
}] });
|
|
448
448
|
function withMemoryStorage() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quang-auth.mjs","sources":["../../../projects/quang/auth/auth.service.ts","../../../projects/quang/auth/auth-providers.ts","../../../projects/quang/auth/directives/has-at-least-one-role.directive.ts","../../../projects/quang/auth/directives/has-every-role.directive.ts","../../../projects/quang/auth/directives/is-authenticated.directive.ts","../../../projects/quang/auth/directives/is-not-authenticated.directive.ts","../../../projects/quang/auth/guards/is-allowed.guard.ts","../../../projects/quang/auth/guards/is-authenticated.guard.ts","../../../projects/quang/auth/logout-on-error.interceptor.ts","../../../projects/quang/auth/token-storage/local-storage-feature.ts","../../../projects/quang/auth/token-storage/memory-storage-feature.ts","../../../projects/quang/auth/token-storage/session-storage-feature.ts","../../../projects/quang/auth/quang-auth.ts"],"sourcesContent":["import {\n EnvironmentProviders,\n Injectable,\n InjectionToken,\n computed,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core'\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'\n\nimport { patchState, signalState } from '@ngrx/signals'\n\nimport { AuthConfig, OAuthErrorEvent, OAuthEvent, OAuthService } from 'angular-oauth2-oidc'\nimport { QUANG_LOGGING_BEHAVIOR } from 'quang'\nimport { filter, firstValueFrom } from 'rxjs'\n\nexport const AUTH_CONFIG = new InjectionToken<QuangAuthConfig | undefined>('AUTH_CONFIG')\n\nexport interface QuangAuthConfig extends AuthConfig {\n autoLogin: boolean\n sendAccessToken: boolean\n urlsToSendToken: string[]\n revokeTokensOnLogout?: boolean\n getUserProfileOnLoginSuccess?: boolean\n useSilentRefresh: boolean\n}\n\nexport function provideQuangAuthConfig(authConfig?: QuangAuthConfig): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: AUTH_CONFIG, useValue: authConfig }])\n}\n\nexport const OPEN_URI = new InjectionToken<(uri: string) => void | undefined>('OPEN_URI')\n\nexport function provideOpenURI(openURI: (uri: string) => void | undefined): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: OPEN_URI, deps: [], useFactory: openURI }])\n}\n\ninterface LoginStatus {\n checked: boolean\n authenticationError: boolean\n}\n\ninterface TokenStatus {\n accessToken: string | null\n accessTokenExpiresAt: number | null\n idToken: string | null\n idTokenExpiresAt: number | null\n refreshToken: string | null\n}\n\ninterface AuthState {\n loginStatus: LoginStatus\n tokenStatus: TokenStatus\n roles: Set<string>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n user: Record<string, any> | null\n}\n\nconst initialState: AuthState = {\n loginStatus: {\n checked: false,\n authenticationError: false,\n },\n tokenStatus: {\n accessToken: null,\n accessTokenExpiresAt: null,\n idToken: null,\n idTokenExpiresAt: null,\n refreshToken: null,\n },\n roles: new Set<string>(),\n user: null,\n}\n\n// Subset of situations from https://openid.net/specs/openid-connect-core-1_0.html#AuthError\n// Only the ones where it's reasonably sure that sending the user to the IdServer will help.\nconst errorResponsesRequiringUserInteraction = [\n 'interaction_required',\n 'login_required',\n 'account_selection_required',\n 'consent_required',\n]\n\n@Injectable({\n providedIn: 'root',\n})\nexport class QuangAuthService {\n private config: QuangAuthConfig\n\n logLevel = inject(QUANG_LOGGING_BEHAVIOR, { optional: true })\n\n private oAuthService = inject(OAuthService, { optional: true })\n\n private state = signalState<AuthState>(initialState)\n\n loginChecked = this.state.loginStatus.checked\n\n isAuthenticated = computed(() => !!this.state.tokenStatus.accessToken())\n\n authenticationError = this.state.loginStatus.authenticationError\n\n tokenStatus = this.state.tokenStatus\n\n roles = this.state.roles\n\n user = this.state.user\n\n constructor() {\n const authConfig = inject(AUTH_CONFIG)\n if (!authConfig) throw new Error('Missing auth config')\n\n const openUri = inject(OPEN_URI, { optional: true })\n if (openUri) authConfig.openUri = openUri\n\n this.config = authConfig\n\n this.oAuthService?.events.pipe(takeUntilDestroyed()).subscribe((event: OAuthEvent) => {\n if (this.logLevel === 'verbose') console.debug('Auth service event', event)\n if (event instanceof OAuthErrorEvent && this.loginChecked()) this.loginError()\n if (event.type === 'token_received') this.setTokens()\n })\n this.oAuthService?.configure(this.config)\n }\n\n public async init() {\n this.oAuthService?.setupAutomaticSilentRefresh()\n\n await this.oAuthService?.loadDiscoveryDocumentAndTryLogin()\n\n await this.checkForAuthentication()\n\n if (this.config.autoLogin && !this.isAuthenticated()) this.login()\n }\n\n public async checkForAuthentication(forceRefresh = false) {\n let hasValidToken = this.oAuthService?.hasValidAccessToken()\n\n try {\n if (forceRefresh) hasValidToken = await this.refreshAuth()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const reason = error?.reason\n if (this.config.autoLogin && reason && errorResponsesRequiringUserInteraction.includes(reason)) this.login()\n hasValidToken = false\n }\n\n this.setTokens()\n patchState(this.state, {\n loginStatus: {\n ...this.state().loginStatus,\n checked: true,\n },\n })\n\n if (hasValidToken && this.config.getUserProfileOnLoginSuccess) await this.getUserProfile()\n\n return hasValidToken\n }\n\n private async refreshAuth() {\n if (this.config.responseType === 'code') await this.oAuthService?.refreshToken()\n else await this.oAuthService?.silentRefresh()\n return this.oAuthService?.hasValidAccessToken()\n }\n\n public login() {\n this.oAuthService?.initLoginFlow()\n }\n\n public async logout() {\n if (!this.isAuthenticated()) return\n if (this.config.revokeTokensOnLogout) await this.oAuthService?.revokeTokenAndLogout()\n else this.oAuthService?.logOut()\n patchState(this.state, { ...initialState })\n }\n\n private loginError() {\n patchState(this.state, {\n loginStatus: {\n ...this.state().loginStatus,\n authenticationError: true,\n },\n })\n this.logout()\n }\n\n public async getUserProfile() {\n const user = await this.oAuthService?.loadUserProfile()\n if (user) patchState(this.state, { user })\n }\n\n private setTokens() {\n const tokenStatus = {\n accessToken: this.oAuthService?.getAccessToken() ?? null,\n accessTokenExpiresAt: this.oAuthService?.getAccessTokenExpiration() ?? null,\n idToken: this.oAuthService?.getIdToken() ?? null,\n idTokenExpiresAt: this.oAuthService?.getIdTokenExpiration() ?? null,\n refreshToken: this.oAuthService?.getRefreshToken() ?? null,\n }\n if (this.logLevel === 'verbose') {\n const now = new Date()\n const accessTokenDate = new Date(tokenStatus.accessTokenExpiresAt ?? '')\n const idTokenDate = new Date(tokenStatus.idTokenExpiresAt ?? '')\n console.table(tokenStatus)\n console.debug(\n `Id token expires at ${idTokenDate} in ${Math.abs(idTokenDate.valueOf() - now.valueOf()) / 1000 / 60} minutes`\n )\n console.debug(\n `Access token expires at ${accessTokenDate} in ${Math.abs(accessTokenDate.valueOf() - now.valueOf()) / 1000 / 60} minutes`\n )\n }\n patchState(this.state, {\n tokenStatus,\n })\n }\n\n async waitForLoginCheck(): Promise<void> {\n await firstValueFrom(toObservable(this.loginChecked).pipe(filter((checked) => checked)))\n }\n\n async getAuthResult(): Promise<boolean> {\n await this.waitForLoginCheck()\n return this.isAuthenticated()\n }\n\n addRoles(rolesToAdd: string[]) {\n patchState(this.state, { roles: new Set([...this.state.roles().values(), ...rolesToAdd]) })\n }\n\n removeRoles(rolesToRemove: string[]) {\n const newRoles = new Set(this.roles().values())\n for (const roleToRemove of rolesToRemove) {\n newRoles.delete(roleToRemove)\n }\n patchState(this.state, { roles: newRoles })\n }\n\n hasEveryRole(roles: string[]) {\n return roles.every((role) => this.roles().has(role))\n }\n\n hasAtLeastOneRole(roles: string[]) {\n return roles.some((role) => this.roles().has(role))\n }\n}\n","import { EnvironmentProviders, Provider, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core'\n\nimport { provideOAuthClient } from 'angular-oauth2-oidc'\nimport { type QuangFeature, QuangFeatureKind, quangFeature } from 'quang'\n\nimport { type QuangAuthConfig, QuangAuthService, provideQuangAuthConfig } from './auth.service'\n\nfunction initializeAuthService(authService: QuangAuthService) {\n return () => authService.init()\n}\n\nexport function provideAuth(authConfig?: QuangAuthConfig, ...features: QuangAuthFeatures[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideQuangAuthConfig(authConfig),\n provideOAuthClient({\n resourceServer: {\n sendAccessToken: authConfig?.sendAccessToken ?? true,\n allowedUrls: authConfig?.urlsToSendToken ?? [],\n },\n }),\n ...features.map((feature) => feature.ɵproviders),\n provideAppInitializer(() => {\n const initializerFn = initializeAuthService(inject(QuangAuthService))\n return initializerFn()\n }),\n ])\n}\n\nexport function withAuth(\n authConfig?: QuangAuthConfig,\n ...features: QuangAuthFeatures[]\n): QuangFeature<QuangFeatureKind.LoaderFeature> {\n return quangFeature(QuangFeatureKind.LoaderFeature, [provideAuth(authConfig, ...features)])\n}\n\n/**\n * Helper type to represent a QuangAuth feature.\n *\n * @publicApi\n */\nexport interface QuangAuthFeature<FeatureKind extends QuangAuthFeatureKind> {\n ɵkind: FeatureKind\n ɵproviders: (Provider | EnvironmentProviders)[]\n}\n\n/**\n * Helper function to create an object that represents a QuangAuth feature.\n */\nexport function quangAuthFeature<FeatureKind extends QuangAuthFeatureKind>(\n kind: FeatureKind,\n providers: (Provider | EnvironmentProviders)[]\n): QuangAuthFeature<FeatureKind> {\n return { ɵkind: kind, ɵproviders: providers }\n}\n\n/**\n * A type alias that represents all QuangAuth features available for use with `provideAuth`.\n * Features can be enabled by adding special functions to the `provideAuth` call.\n * See documentation for each symbol to find corresponding function name. See also `provideAuth`\n * documentation on how to use those functions.\n *\n * @see {@link provideAuth}\n *\n * @publicApi\n */\nexport type QuangAuthFeatures = QuangAuthFeature<QuangAuthFeatureKind>\n\n/**\n * The list of features as an enum to uniquely type each feature.\n */\nexport const enum QuangAuthFeatureKind {\n MobileAuthFeature,\n SessionStorageFeature,\n LocalStorageFeature,\n MemoryStorageFeature,\n LogoutOnErrorFeature,\n}\n","import {\n ChangeDetectorRef,\n Directive,\n EmbeddedViewRef,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n input,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QUANG_LOGGING_BEHAVIOR } from 'quang'\n\nimport { QuangAuthService } from '../auth.service'\n\n/**\n * This directive conditionally renders the associated template if the authenticated user\n * has at least one of the specified roles. By using the `QuangAuthService.hasAtLeastOneRole()` method it checks the user's roles against\n * the required roles provided through the `quangHasAtLeastOneRole` directive.\n *\n * @example\n * <div *quangHasAtLeastOneRole=\"['admin', 'editor']\">\n * This content will only be visible to users with 'admin' or 'editor' roles.\n * </div>\n */\n@Directive({\n selector: '[quangHasAtLeastOneRole]',\n})\nexport class QuangHasAtLeastOneRoleDirective {\n logLevel = inject(QUANG_LOGGING_BEHAVIOR, { optional: true })\n\n targetRoles = input.required<string[]>({ alias: 'quangHasAtLeastOneRole' })\n\n viewContainerRef = inject(ViewContainerRef)\n\n embeddedViewRef: EmbeddedViewRef<unknown> | null = null\n\n templateRef = inject(TemplateRef)\n\n authService = inject(QuangAuthService)\n\n takeUntilDestroyed = takeUntilDestroyed()\n\n changeDetectorRef = inject(ChangeDetectorRef)\n\n hideViewIfNotAllowed = effect(() => {\n if (this.logLevel === 'verbose')\n console.debug({ userRoles: this.authService.roles(), rolesToCheck: this.targetRoles() })\n const isAllowed = this.authService.hasAtLeastOneRole(this.targetRoles())\n if (isAllowed) {\n if (!this.embeddedViewRef) this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef)\n } else {\n this.viewContainerRef.clear()\n this.embeddedViewRef = null\n }\n this.changeDetectorRef.markForCheck()\n })\n}\n","import {\n ChangeDetectorRef,\n Directive,\n EmbeddedViewRef,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n input,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QUANG_LOGGING_BEHAVIOR } from 'quang'\n\nimport { QuangAuthService } from '../auth.service'\n\n/**\n * This directive conditionally renders the associated template if the authenticated user\n * has every of the specified roles. By using the `QuangAuthService.hasEveryRole()` method it checks the user's roles against\n * the required roles provided through the `quangHasEveryRole` required input.\n *\n * @example\n * <div *quangHasEveryRole=\"['admin', 'editor']\">\n * This content will only be visible to users with 'admin' and 'editor' roles.\n * </div>\n */\n@Directive({\n selector: '[quangHasEveryRole]',\n})\nexport class QuangHasEveryRoleDirective {\n logLevel = inject(QUANG_LOGGING_BEHAVIOR, { optional: true })\n\n targetRoles = input.required<string[]>({ alias: 'quangHasEveryRole' })\n\n viewContainerRef = inject(ViewContainerRef)\n\n embeddedViewRef: EmbeddedViewRef<unknown> | null = null\n\n templateRef = inject(TemplateRef)\n\n authService = inject(QuangAuthService)\n\n takeUntilDestroyed = takeUntilDestroyed()\n\n changeDetectorRef = inject(ChangeDetectorRef)\n\n hideViewIfNotAllowed = effect(() => {\n if (this.logLevel === 'verbose')\n console.debug({ userRoles: this.authService.roles(), rolesToCheck: this.targetRoles() })\n const isAllowed = this.authService.hasEveryRole(this.targetRoles())\n if (isAllowed) {\n if (!this.embeddedViewRef) this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef)\n } else {\n this.viewContainerRef.clear()\n this.embeddedViewRef = null\n }\n this.changeDetectorRef.markForCheck()\n })\n}\n","import {\n ChangeDetectorRef,\n Directive,\n EmbeddedViewRef,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QuangAuthService } from '../auth.service'\n\n@Directive({\n selector: '[quangIsAuthenticated]',\n})\nexport class QuangIsAuthenticatedDirective {\n viewContainerRef = inject(ViewContainerRef)\n\n templateRef = inject(TemplateRef)\n\n embeddedViewRef: EmbeddedViewRef<any> | null = null\n\n authService = inject(QuangAuthService)\n\n takeUntilDestroyed = takeUntilDestroyed()\n\n changeDetectorRef = inject(ChangeDetectorRef)\n\n hideViewIfNotAuthenticated = effect(() => {\n if (this.authService.isAuthenticated()) {\n if (!this.embeddedViewRef) this.viewContainerRef.createEmbeddedView(this.templateRef)\n } else {\n this.viewContainerRef.clear()\n this.embeddedViewRef = null\n }\n this.changeDetectorRef.markForCheck()\n })\n}\n","import {\n ChangeDetectorRef,\n Directive,\n EmbeddedViewRef,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QuangAuthService } from '../auth.service'\n\n@Directive({\n selector: '[quangIsNotAuthenticated]',\n})\nexport class QuangIsNotAuthenticatedDirective {\n viewContainerRef = inject(ViewContainerRef)\n\n templateRef = inject(TemplateRef)\n\n embeddedViewRef: EmbeddedViewRef<any> | null = null\n\n authService = inject(QuangAuthService)\n\n takeUntilDestroyed = takeUntilDestroyed()\n\n changeDetectorRef = inject(ChangeDetectorRef)\n\n showViewIfNotAuthenticated = effect(() => {\n if (this.authService.isAuthenticated()) {\n this.viewContainerRef.clear()\n this.embeddedViewRef = null\n } else if (!this.embeddedViewRef) {\n this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef)\n }\n this.changeDetectorRef.markForCheck()\n })\n}\n","import { inject } from '@angular/core'\nimport type { CanActivateFn } from '@angular/router'\n\nimport { QuangAuthService } from '../auth.service'\n\nexport const quangIsAllowedGuardFactory =\n (roles: string[], behavior: 'every' | 'atLeastOne'): CanActivateFn =>\n async () => {\n const authService = inject(QuangAuthService)\n const isAuthenticated = await authService.getAuthResult()\n if (!isAuthenticated) return false\n const isAllowedFunction = behavior === 'every' ? authService.hasEveryRole : authService.hasAtLeastOneRole\n return isAllowedFunction.call(authService, roles)\n }\n","import { inject } from '@angular/core'\nimport type { CanActivateFn } from '@angular/router'\n\nimport { QuangAuthService } from '../auth.service'\n\nexport const quangIsAuthenticatedGuard: CanActivateFn = async () => {\n const authService = inject(QuangAuthService)\n return authService.getAuthResult()\n}\n","import { HttpErrorResponse, HttpInterceptorFn } from '@angular/common/http'\nimport { InjectionToken, Provider, inject } from '@angular/core'\n\nimport { UrlData, getExcludedUrlsByMethod, isHttpMethod } from 'quang/shared'\nimport { catchError, from, retry, switchMap, tap, throwError } from 'rxjs'\n\nimport { QuangAuthService } from './auth.service'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, quangAuthFeature } from './auth-providers'\n\nexport const LOGOUT_RETRIES = new InjectionToken<number>('LOGOUT_RETRIES')\nexport const LOGOUT_STATUSES = new InjectionToken<number[]>('LOGOUT_STATUSES')\nexport const LOGOUT_EXCLUDED_URLS = new InjectionToken<UrlData[]>('LOGOUT_EXCLUDED_URLS')\n\nexport const logoutOnErrorInterceptor: HttpInterceptorFn = (request, next) => {\n const quangAuthService = inject(QuangAuthService)\n const logoutStatuses = inject(LOGOUT_STATUSES, { optional: true }) ?? [401]\n const excludedUrlsByMethod = getExcludedUrlsByMethod(inject(LOGOUT_EXCLUDED_URLS, { optional: true }) ?? [])\n const retries = inject(LOGOUT_RETRIES, { optional: true }) ?? 4\n\n if (!isHttpMethod(request.method)) {\n return next(request)\n }\n\n if (\n Array.from(excludedUrlsByMethod.get(request.method) ?? []).some((excludedUrl) =>\n request.url.match(excludedUrl.replace(/\\//g, '\\\\/'))\n )\n ) {\n return next(request)\n }\n\n return next(request).pipe(\n retry({ count: retries, delay: 300 }),\n catchError((error: HttpErrorResponse) => {\n if (logoutStatuses.includes(error?.status))\n return from(quangAuthService.checkForAuthentication(true)).pipe(\n tap((isAuthenticated) => {\n if (!isAuthenticated) quangAuthService.logout()\n }),\n switchMap(() => throwError(() => error))\n )\n return throwError(() => error)\n }),\n retry({ count: 1, delay: 500 })\n )\n}\n\nexport function withLogoutOnError(\n excludedUrls: UrlData[] = [],\n statuses = [401],\n retries = 4\n): QuangAuthFeature<QuangAuthFeatureKind.LogoutOnErrorFeature> {\n const providers: Provider[] = [\n {\n provide: LOGOUT_STATUSES,\n useValue: statuses,\n },\n {\n provide: LOGOUT_EXCLUDED_URLS,\n useValue: excludedUrls,\n },\n {\n provide: LOGOUT_RETRIES,\n useValue: retries,\n },\n ]\n return quangAuthFeature(QuangAuthFeatureKind.LogoutOnErrorFeature, providers)\n}\n","import { Provider } from '@angular/core'\n\nimport { OAuthStorage } from 'angular-oauth2-oidc'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, quangAuthFeature } from '../auth-providers'\n\nexport function withLocalStorage(): QuangAuthFeature<QuangAuthFeatureKind.LocalStorageFeature> {\n const providers: Provider[] = [\n {\n provide: OAuthStorage,\n useValue: localStorage,\n },\n ]\n return quangAuthFeature(QuangAuthFeatureKind.LocalStorageFeature, providers)\n}\n","import { Injectable, Provider } from '@angular/core'\n\nimport { OAuthStorage } from 'angular-oauth2-oidc'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, quangAuthFeature } from '../auth-providers'\n\n@Injectable()\nexport class MemoryStorage implements OAuthStorage {\n private data = new Map<string, string>()\n\n getItem(key: string): string {\n return this.data.get(key) ?? ''\n }\n\n removeItem(key: string): void {\n this.data.delete(key)\n }\n\n setItem(key: string, data: string): void {\n this.data.set(key, data)\n }\n}\n\nexport function withMemoryStorage(): QuangAuthFeature<QuangAuthFeatureKind.MemoryStorageFeature> {\n const providers: Provider[] = [\n {\n provide: OAuthStorage,\n useFactory: () => new MemoryStorage(),\n },\n ]\n return quangAuthFeature(QuangAuthFeatureKind.MemoryStorageFeature, providers)\n}\n","import { Provider } from '@angular/core'\n\nimport { OAuthStorage } from 'angular-oauth2-oidc'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, quangAuthFeature } from '../auth-providers'\n\nexport function withSessionStorage(): QuangAuthFeature<QuangAuthFeatureKind.SessionStorageFeature> {\n const providers: Provider[] = [\n {\n provide: OAuthStorage,\n useValue: sessionStorage,\n },\n ]\n return quangAuthFeature(QuangAuthFeatureKind.SessionStorageFeature, providers)\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAgBa,WAAW,GAAG,IAAI,cAAc,CAA8B,aAAa;AAWlF,SAAU,sBAAsB,CAAC,UAA4B,EAAA;AACjE,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;AACnF;MAEa,QAAQ,GAAG,IAAI,cAAc,CAAoC,UAAU;AAElF,SAAU,cAAc,CAAC,OAA0C,EAAA;AACvE,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;AACzF;AAuBA,MAAM,YAAY,GAAc;AAC9B,IAAA,WAAW,EAAE;AACX,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,mBAAmB,EAAE,KAAK;AAC3B,KAAA;AACD,IAAA,WAAW,EAAE;AACX,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,oBAAoB,EAAE,IAAI;AAC1B,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,gBAAgB,EAAE,IAAI;AACtB,QAAA,YAAY,EAAE,IAAI;AACnB,KAAA;IACD,KAAK,EAAE,IAAI,GAAG,EAAU;AACxB,IAAA,IAAI,EAAE,IAAI;CACX;AAED;AACA;AACA,MAAM,sCAAsC,GAAG;IAC7C,sBAAsB;IACtB,gB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AC/E;;SCzBgB,kBAAkB,GAAA;AAChC,IAAA,MAAM,SAAS,GAAe;AAC5B,QAAA;AACE,YAAA,OAAO,EAAE,YAAY;AACrB,YAAA,QAAQ,EAAE,cAAc;AACzB,SAAA;KACF;AACD,IAAA,OAAO,gBAAgB,CAAA,CAAA,mDAA6C,SAAS,CAAC;AAChF;;ACdA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"quang-auth.mjs","sources":["../../../projects/quang/auth/auth.service.ts","../../../projects/quang/auth/auth-providers.ts","../../../projects/quang/auth/directives/has-at-least-one-role.directive.ts","../../../projects/quang/auth/directives/has-every-role.directive.ts","../../../projects/quang/auth/directives/is-authenticated.directive.ts","../../../projects/quang/auth/directives/is-not-authenticated.directive.ts","../../../projects/quang/auth/guards/is-allowed.guard.ts","../../../projects/quang/auth/guards/is-authenticated.guard.ts","../../../projects/quang/auth/logout-on-error.interceptor.ts","../../../projects/quang/auth/token-storage/local-storage-feature.ts","../../../projects/quang/auth/token-storage/memory-storage-feature.ts","../../../projects/quang/auth/token-storage/session-storage-feature.ts","../../../projects/quang/auth/quang-auth.ts"],"sourcesContent":["import {\n EnvironmentProviders,\n Injectable,\n InjectionToken,\n computed,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core'\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'\n\nimport { patchState, signalState } from '@ngrx/signals'\n\nimport { AuthConfig, OAuthErrorEvent, OAuthEvent, OAuthService } from 'angular-oauth2-oidc'\nimport { QUANG_LOGGING_BEHAVIOR } from 'quang'\nimport { filter, firstValueFrom } from 'rxjs'\n\nexport const AUTH_CONFIG = new InjectionToken<QuangAuthConfig | undefined>('AUTH_CONFIG')\n\nexport interface QuangAuthConfig extends AuthConfig {\n autoLogin: boolean\n sendAccessToken: boolean\n urlsToSendToken: string[]\n revokeTokensOnLogout?: boolean\n getUserProfileOnLoginSuccess?: boolean\n useSilentRefresh: boolean\n}\n\nexport function provideQuangAuthConfig(authConfig?: QuangAuthConfig): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: AUTH_CONFIG, useValue: authConfig }])\n}\n\nexport const OPEN_URI = new InjectionToken<(uri: string) => void | undefined>('OPEN_URI')\n\nexport function provideOpenURI(openURI: (uri: string) => void | undefined): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: OPEN_URI, deps: [], useFactory: openURI }])\n}\n\ninterface LoginStatus {\n checked: boolean\n authenticationError: boolean\n}\n\ninterface TokenStatus {\n accessToken: string | null\n accessTokenExpiresAt: number | null\n idToken: string | null\n idTokenExpiresAt: number | null\n refreshToken: string | null\n}\n\ninterface AuthState {\n loginStatus: LoginStatus\n tokenStatus: TokenStatus\n roles: Set<string>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n user: Record<string, any> | null\n}\n\nconst initialState: AuthState = {\n loginStatus: {\n checked: false,\n authenticationError: false,\n },\n tokenStatus: {\n accessToken: null,\n accessTokenExpiresAt: null,\n idToken: null,\n idTokenExpiresAt: null,\n refreshToken: null,\n },\n roles: new Set<string>(),\n user: null,\n}\n\n// Subset of situations from https://openid.net/specs/openid-connect-core-1_0.html#AuthError\n// Only the ones where it's reasonably sure that sending the user to the IdServer will help.\nconst errorResponsesRequiringUserInteraction = [\n 'interaction_required',\n 'login_required',\n 'account_selection_required',\n 'consent_required',\n]\n\n@Injectable({\n providedIn: 'root',\n})\nexport class QuangAuthService {\n private config: QuangAuthConfig\n\n logLevel = inject(QUANG_LOGGING_BEHAVIOR, { optional: true })\n\n private oAuthService = inject(OAuthService, { optional: true })\n\n private state = signalState<AuthState>(initialState)\n\n loginChecked = this.state.loginStatus.checked\n\n isAuthenticated = computed(() => !!this.state.tokenStatus.accessToken())\n\n authenticationError = this.state.loginStatus.authenticationError\n\n tokenStatus = this.state.tokenStatus\n\n roles = this.state.roles\n\n user = this.state.user\n\n constructor() {\n const authConfig = inject(AUTH_CONFIG)\n if (!authConfig) throw new Error('Missing auth config')\n\n const openUri = inject(OPEN_URI, { optional: true })\n if (openUri) authConfig.openUri = openUri\n\n this.config = authConfig\n\n this.oAuthService?.events.pipe(takeUntilDestroyed()).subscribe((event: OAuthEvent) => {\n if (this.logLevel === 'verbose') console.debug('Auth service event', event)\n if (event instanceof OAuthErrorEvent && this.loginChecked()) this.loginError()\n if (event.type === 'token_received') this.setTokens()\n })\n this.oAuthService?.configure(this.config)\n }\n\n public async init() {\n this.oAuthService?.setupAutomaticSilentRefresh()\n\n await this.oAuthService?.loadDiscoveryDocumentAndTryLogin()\n\n await this.checkForAuthentication()\n\n if (this.config.autoLogin && !this.isAuthenticated()) this.login()\n }\n\n public async checkForAuthentication(forceRefresh = false) {\n let hasValidToken = this.oAuthService?.hasValidAccessToken()\n\n try {\n if (forceRefresh) hasValidToken = await this.refreshAuth()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const reason = error?.reason\n if (this.config.autoLogin && reason && errorResponsesRequiringUserInteraction.includes(reason)) this.login()\n hasValidToken = false\n }\n\n this.setTokens()\n patchState(this.state, {\n loginStatus: {\n ...this.state().loginStatus,\n checked: true,\n },\n })\n\n if (hasValidToken && this.config.getUserProfileOnLoginSuccess) await this.getUserProfile()\n\n return hasValidToken\n }\n\n private async refreshAuth() {\n if (this.config.responseType === 'code') await this.oAuthService?.refreshToken()\n else await this.oAuthService?.silentRefresh()\n return this.oAuthService?.hasValidAccessToken()\n }\n\n public login() {\n this.oAuthService?.initLoginFlow()\n }\n\n public async logout() {\n if (!this.isAuthenticated()) return\n if (this.config.revokeTokensOnLogout) await this.oAuthService?.revokeTokenAndLogout()\n else this.oAuthService?.logOut()\n patchState(this.state, { ...initialState })\n }\n\n private loginError() {\n patchState(this.state, {\n loginStatus: {\n ...this.state().loginStatus,\n authenticationError: true,\n },\n })\n this.logout()\n }\n\n public async getUserProfile() {\n const user = await this.oAuthService?.loadUserProfile()\n if (user) patchState(this.state, { user })\n }\n\n private setTokens() {\n const tokenStatus = {\n accessToken: this.oAuthService?.getAccessToken() ?? null,\n accessTokenExpiresAt: this.oAuthService?.getAccessTokenExpiration() ?? null,\n idToken: this.oAuthService?.getIdToken() ?? null,\n idTokenExpiresAt: this.oAuthService?.getIdTokenExpiration() ?? null,\n refreshToken: this.oAuthService?.getRefreshToken() ?? null,\n }\n if (this.logLevel === 'verbose') {\n const now = new Date()\n const accessTokenDate = new Date(tokenStatus.accessTokenExpiresAt ?? '')\n const idTokenDate = new Date(tokenStatus.idTokenExpiresAt ?? '')\n console.table(tokenStatus)\n console.debug(\n `Id token expires at ${idTokenDate} in ${Math.abs(idTokenDate.valueOf() - now.valueOf()) / 1000 / 60} minutes`\n )\n console.debug(\n `Access token expires at ${accessTokenDate} in ${Math.abs(accessTokenDate.valueOf() - now.valueOf()) / 1000 / 60} minutes`\n )\n }\n patchState(this.state, {\n tokenStatus,\n })\n }\n\n async waitForLoginCheck(): Promise<void> {\n await firstValueFrom(toObservable(this.loginChecked).pipe(filter((checked) => checked)))\n }\n\n async getAuthResult(): Promise<boolean> {\n await this.waitForLoginCheck()\n return this.isAuthenticated()\n }\n\n addRoles(rolesToAdd: string[]) {\n patchState(this.state, { roles: new Set([...this.state.roles().values(), ...rolesToAdd]) })\n }\n\n removeRoles(rolesToRemove: string[]) {\n const newRoles = new Set(this.roles().values())\n for (const roleToRemove of rolesToRemove) {\n newRoles.delete(roleToRemove)\n }\n patchState(this.state, { roles: newRoles })\n }\n\n hasEveryRole(roles: string[]) {\n return roles.every((role) => this.roles().has(role))\n }\n\n hasAtLeastOneRole(roles: string[]) {\n return roles.some((role) => this.roles().has(role))\n }\n}\n","import { EnvironmentProviders, Provider, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core'\n\nimport { provideOAuthClient } from 'angular-oauth2-oidc'\nimport { type QuangFeature, QuangFeatureKind, quangFeature } from 'quang'\n\nimport { type QuangAuthConfig, QuangAuthService, provideQuangAuthConfig } from './auth.service'\n\nfunction initializeAuthService(authService: QuangAuthService) {\n return () => authService.init()\n}\n\nexport function provideAuth(authConfig?: QuangAuthConfig, ...features: QuangAuthFeatures[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideQuangAuthConfig(authConfig),\n provideOAuthClient({\n resourceServer: {\n sendAccessToken: authConfig?.sendAccessToken ?? true,\n allowedUrls: authConfig?.urlsToSendToken ?? [],\n },\n }),\n ...features.map((feature) => feature.ɵproviders),\n provideAppInitializer(() => {\n const initializerFn = initializeAuthService(inject(QuangAuthService))\n return initializerFn()\n }),\n ])\n}\n\nexport function withAuth(\n authConfig?: QuangAuthConfig,\n ...features: QuangAuthFeatures[]\n): QuangFeature<QuangFeatureKind.LoaderFeature> {\n return quangFeature(QuangFeatureKind.LoaderFeature, [provideAuth(authConfig, ...features)])\n}\n\n/**\n * Helper type to represent a QuangAuth feature.\n *\n * @publicApi\n */\nexport interface QuangAuthFeature<FeatureKind extends QuangAuthFeatureKind> {\n ɵkind: FeatureKind\n ɵproviders: (Provider | EnvironmentProviders)[]\n}\n\n/**\n * Helper function to create an object that represents a QuangAuth feature.\n */\nexport function quangAuthFeature<FeatureKind extends QuangAuthFeatureKind>(\n kind: FeatureKind,\n providers: (Provider | EnvironmentProviders)[]\n): QuangAuthFeature<FeatureKind> {\n return { ɵkind: kind, ɵproviders: providers }\n}\n\n/**\n * A type alias that represents all QuangAuth features available for use with `provideAuth`.\n * Features can be enabled by adding special functions to the `provideAuth` call.\n * See documentation for each symbol to find corresponding function name. See also `provideAuth`\n * documentation on how to use those functions.\n *\n * @see {@link provideAuth}\n *\n * @publicApi\n */\nexport type QuangAuthFeatures = QuangAuthFeature<QuangAuthFeatureKind>\n\n/**\n * The list of features as an enum to uniquely type each feature.\n */\nexport const enum QuangAuthFeatureKind {\n MobileAuthFeature,\n SessionStorageFeature,\n LocalStorageFeature,\n MemoryStorageFeature,\n LogoutOnErrorFeature,\n}\n","import {\n ChangeDetectorRef,\n Directive,\n EmbeddedViewRef,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n input,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QUANG_LOGGING_BEHAVIOR } from 'quang'\n\nimport { QuangAuthService } from '../auth.service'\n\n/**\n * This directive conditionally renders the associated template if the authenticated user\n * has at least one of the specified roles. By using the `QuangAuthService.hasAtLeastOneRole()` method it checks the user's roles against\n * the required roles provided through the `quangHasAtLeastOneRole` directive.\n *\n * @example\n * <div *quangHasAtLeastOneRole=\"['admin', 'editor']\">\n * This content will only be visible to users with 'admin' or 'editor' roles.\n * </div>\n */\n@Directive({\n selector: '[quangHasAtLeastOneRole]',\n})\nexport class QuangHasAtLeastOneRoleDirective {\n logLevel = inject(QUANG_LOGGING_BEHAVIOR, { optional: true })\n\n targetRoles = input.required<string[]>({ alias: 'quangHasAtLeastOneRole' })\n\n viewContainerRef = inject(ViewContainerRef)\n\n embeddedViewRef: EmbeddedViewRef<unknown> | null = null\n\n templateRef = inject(TemplateRef)\n\n authService = inject(QuangAuthService)\n\n takeUntilDestroyed = takeUntilDestroyed()\n\n changeDetectorRef = inject(ChangeDetectorRef)\n\n hideViewIfNotAllowed = effect(() => {\n if (this.logLevel === 'verbose')\n console.debug({ userRoles: this.authService.roles(), rolesToCheck: this.targetRoles() })\n const isAllowed = this.authService.hasAtLeastOneRole(this.targetRoles())\n if (isAllowed) {\n if (!this.embeddedViewRef) this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef)\n } else {\n this.viewContainerRef.clear()\n this.embeddedViewRef = null\n }\n this.changeDetectorRef.markForCheck()\n })\n}\n","import {\n ChangeDetectorRef,\n Directive,\n EmbeddedViewRef,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n input,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QUANG_LOGGING_BEHAVIOR } from 'quang'\n\nimport { QuangAuthService } from '../auth.service'\n\n/**\n * This directive conditionally renders the associated template if the authenticated user\n * has every of the specified roles. By using the `QuangAuthService.hasEveryRole()` method it checks the user's roles against\n * the required roles provided through the `quangHasEveryRole` required input.\n *\n * @example\n * <div *quangHasEveryRole=\"['admin', 'editor']\">\n * This content will only be visible to users with 'admin' and 'editor' roles.\n * </div>\n */\n@Directive({\n selector: '[quangHasEveryRole]',\n})\nexport class QuangHasEveryRoleDirective {\n logLevel = inject(QUANG_LOGGING_BEHAVIOR, { optional: true })\n\n targetRoles = input.required<string[]>({ alias: 'quangHasEveryRole' })\n\n viewContainerRef = inject(ViewContainerRef)\n\n embeddedViewRef: EmbeddedViewRef<unknown> | null = null\n\n templateRef = inject(TemplateRef)\n\n authService = inject(QuangAuthService)\n\n takeUntilDestroyed = takeUntilDestroyed()\n\n changeDetectorRef = inject(ChangeDetectorRef)\n\n hideViewIfNotAllowed = effect(() => {\n if (this.logLevel === 'verbose')\n console.debug({ userRoles: this.authService.roles(), rolesToCheck: this.targetRoles() })\n const isAllowed = this.authService.hasEveryRole(this.targetRoles())\n if (isAllowed) {\n if (!this.embeddedViewRef) this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef)\n } else {\n this.viewContainerRef.clear()\n this.embeddedViewRef = null\n }\n this.changeDetectorRef.markForCheck()\n })\n}\n","import {\n ChangeDetectorRef,\n Directive,\n EmbeddedViewRef,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QuangAuthService } from '../auth.service'\n\n@Directive({\n selector: '[quangIsAuthenticated]',\n})\nexport class QuangIsAuthenticatedDirective {\n viewContainerRef = inject(ViewContainerRef)\n\n templateRef = inject(TemplateRef)\n\n embeddedViewRef: EmbeddedViewRef<any> | null = null\n\n authService = inject(QuangAuthService)\n\n takeUntilDestroyed = takeUntilDestroyed()\n\n changeDetectorRef = inject(ChangeDetectorRef)\n\n hideViewIfNotAuthenticated = effect(() => {\n if (this.authService.isAuthenticated()) {\n if (!this.embeddedViewRef) this.viewContainerRef.createEmbeddedView(this.templateRef)\n } else {\n this.viewContainerRef.clear()\n this.embeddedViewRef = null\n }\n this.changeDetectorRef.markForCheck()\n })\n}\n","import {\n ChangeDetectorRef,\n Directive,\n EmbeddedViewRef,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QuangAuthService } from '../auth.service'\n\n@Directive({\n selector: '[quangIsNotAuthenticated]',\n})\nexport class QuangIsNotAuthenticatedDirective {\n viewContainerRef = inject(ViewContainerRef)\n\n templateRef = inject(TemplateRef)\n\n embeddedViewRef: EmbeddedViewRef<any> | null = null\n\n authService = inject(QuangAuthService)\n\n takeUntilDestroyed = takeUntilDestroyed()\n\n changeDetectorRef = inject(ChangeDetectorRef)\n\n showViewIfNotAuthenticated = effect(() => {\n if (this.authService.isAuthenticated()) {\n this.viewContainerRef.clear()\n this.embeddedViewRef = null\n } else if (!this.embeddedViewRef) {\n this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef)\n }\n this.changeDetectorRef.markForCheck()\n })\n}\n","import { inject } from '@angular/core'\nimport type { CanActivateFn } from '@angular/router'\n\nimport { QuangAuthService } from '../auth.service'\n\nexport const quangIsAllowedGuardFactory =\n (roles: string[], behavior: 'every' | 'atLeastOne'): CanActivateFn =>\n async () => {\n const authService = inject(QuangAuthService)\n const isAuthenticated = await authService.getAuthResult()\n if (!isAuthenticated) return false\n const isAllowedFunction = behavior === 'every' ? authService.hasEveryRole : authService.hasAtLeastOneRole\n return isAllowedFunction.call(authService, roles)\n }\n","import { inject } from '@angular/core'\nimport type { CanActivateFn } from '@angular/router'\n\nimport { QuangAuthService } from '../auth.service'\n\nexport const quangIsAuthenticatedGuard: CanActivateFn = async () => {\n const authService = inject(QuangAuthService)\n return authService.getAuthResult()\n}\n","import { HttpErrorResponse, HttpInterceptorFn } from '@angular/common/http'\nimport { InjectionToken, Provider, inject } from '@angular/core'\n\nimport { UrlData, getExcludedUrlsByMethod, isHttpMethod } from 'quang/shared'\nimport { catchError, from, retry, switchMap, tap, throwError } from 'rxjs'\n\nimport { QuangAuthService } from './auth.service'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, quangAuthFeature } from './auth-providers'\n\nexport const LOGOUT_RETRIES = new InjectionToken<number>('LOGOUT_RETRIES')\nexport const LOGOUT_STATUSES = new InjectionToken<number[]>('LOGOUT_STATUSES')\nexport const LOGOUT_EXCLUDED_URLS = new InjectionToken<UrlData[]>('LOGOUT_EXCLUDED_URLS')\n\nexport const logoutOnErrorInterceptor: HttpInterceptorFn = (request, next) => {\n const quangAuthService = inject(QuangAuthService)\n const logoutStatuses = inject(LOGOUT_STATUSES, { optional: true }) ?? [401]\n const excludedUrlsByMethod = getExcludedUrlsByMethod(inject(LOGOUT_EXCLUDED_URLS, { optional: true }) ?? [])\n const retries = inject(LOGOUT_RETRIES, { optional: true }) ?? 4\n\n if (!isHttpMethod(request.method)) {\n return next(request)\n }\n\n if (\n Array.from(excludedUrlsByMethod.get(request.method) ?? []).some((excludedUrl) =>\n request.url.match(excludedUrl.replace(/\\//g, '\\\\/'))\n )\n ) {\n return next(request)\n }\n\n return next(request).pipe(\n retry({ count: retries, delay: 300 }),\n catchError((error: HttpErrorResponse) => {\n if (logoutStatuses.includes(error?.status))\n return from(quangAuthService.checkForAuthentication(true)).pipe(\n tap((isAuthenticated) => {\n if (!isAuthenticated) quangAuthService.logout()\n }),\n switchMap(() => throwError(() => error))\n )\n return throwError(() => error)\n }),\n retry({ count: 1, delay: 500 })\n )\n}\n\nexport function withLogoutOnError(\n excludedUrls: UrlData[] = [],\n statuses = [401],\n retries = 4\n): QuangAuthFeature<QuangAuthFeatureKind.LogoutOnErrorFeature> {\n const providers: Provider[] = [\n {\n provide: LOGOUT_STATUSES,\n useValue: statuses,\n },\n {\n provide: LOGOUT_EXCLUDED_URLS,\n useValue: excludedUrls,\n },\n {\n provide: LOGOUT_RETRIES,\n useValue: retries,\n },\n ]\n return quangAuthFeature(QuangAuthFeatureKind.LogoutOnErrorFeature, providers)\n}\n","import { Provider } from '@angular/core'\n\nimport { OAuthStorage } from 'angular-oauth2-oidc'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, quangAuthFeature } from '../auth-providers'\n\nexport function withLocalStorage(): QuangAuthFeature<QuangAuthFeatureKind.LocalStorageFeature> {\n const providers: Provider[] = [\n {\n provide: OAuthStorage,\n useValue: localStorage,\n },\n ]\n return quangAuthFeature(QuangAuthFeatureKind.LocalStorageFeature, providers)\n}\n","import { Injectable, Provider } from '@angular/core'\n\nimport { OAuthStorage } from 'angular-oauth2-oidc'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, quangAuthFeature } from '../auth-providers'\n\n@Injectable()\nexport class MemoryStorage implements OAuthStorage {\n private data = new Map<string, string>()\n\n getItem(key: string): string {\n return this.data.get(key) ?? ''\n }\n\n removeItem(key: string): void {\n this.data.delete(key)\n }\n\n setItem(key: string, data: string): void {\n this.data.set(key, data)\n }\n}\n\nexport function withMemoryStorage(): QuangAuthFeature<QuangAuthFeatureKind.MemoryStorageFeature> {\n const providers: Provider[] = [\n {\n provide: OAuthStorage,\n useFactory: () => new MemoryStorage(),\n },\n ]\n return quangAuthFeature(QuangAuthFeatureKind.MemoryStorageFeature, providers)\n}\n","import { Provider } from '@angular/core'\n\nimport { OAuthStorage } from 'angular-oauth2-oidc'\n\nimport { QuangAuthFeature, QuangAuthFeatureKind, quangAuthFeature } from '../auth-providers'\n\nexport function withSessionStorage(): QuangAuthFeature<QuangAuthFeatureKind.SessionStorageFeature> {\n const providers: Provider[] = [\n {\n provide: OAuthStorage,\n useValue: sessionStorage,\n },\n ]\n return quangAuthFeature(QuangAuthFeatureKind.SessionStorageFeature, providers)\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAgBa,WAAW,GAAG,IAAI,cAAc,CAA8B,aAAa;AAWlF,SAAU,sBAAsB,CAAC,UAA4B,EAAA;AACjE,IAAA,OAAO,wBAAwB,CAAC,CA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BAAgB,CAAA,CAAA,mDAA6C,SAAS,CAAC;AAChF;;ACdA;;AAEG;;;;"}
|
|
@@ -21,27 +21,27 @@ class QuangAutocompleteComponent extends QuangBaseComponent {
|
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
23
23
|
// the form can't be a random text but must be one of the options if this is false
|
|
24
|
-
this.syncFormWithText = input(false);
|
|
25
|
-
this.optionListMaxHeight = input('200px');
|
|
26
|
-
this.selectOptions = input.required();
|
|
27
|
-
this.translateValue = input(true);
|
|
28
|
-
this.scrollBehaviorOnOpen = input('smooth');
|
|
24
|
+
this.syncFormWithText = input(false, ...(ngDevMode ? [{ debugName: "syncFormWithText" }] : []));
|
|
25
|
+
this.optionListMaxHeight = input('200px', ...(ngDevMode ? [{ debugName: "optionListMaxHeight" }] : []));
|
|
26
|
+
this.selectOptions = input.required(...(ngDevMode ? [{ debugName: "selectOptions" }] : []));
|
|
27
|
+
this.translateValue = input(true, ...(ngDevMode ? [{ debugName: "translateValue" }] : []));
|
|
28
|
+
this.scrollBehaviorOnOpen = input('smooth', ...(ngDevMode ? [{ debugName: "scrollBehaviorOnOpen" }] : []));
|
|
29
29
|
/**
|
|
30
30
|
* Only emits the value without saving it in ngControl
|
|
31
31
|
*/
|
|
32
|
-
this.emitOnly = input(false);
|
|
33
|
-
this.multiple = input(false);
|
|
32
|
+
this.emitOnly = input(false, ...(ngDevMode ? [{ debugName: "emitOnly" }] : []));
|
|
33
|
+
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
34
34
|
/**
|
|
35
35
|
* Set the maximum length in characters of the single chip.
|
|
36
36
|
*/
|
|
37
|
-
this.chipMaxLength = input(0);
|
|
38
|
-
this.multiSelectDisplayMode = input('vertical');
|
|
39
|
-
this.optionList = viewChild('optionList');
|
|
40
|
-
this._showOptions = signal(null);
|
|
41
|
-
this._inputValue = signal('');
|
|
42
|
-
this._optionHideTimeout = signal(undefined);
|
|
43
|
-
this._chipList = signal([]);
|
|
44
|
-
this._selectedOptions = signal([]);
|
|
37
|
+
this.chipMaxLength = input(0, ...(ngDevMode ? [{ debugName: "chipMaxLength" }] : []));
|
|
38
|
+
this.multiSelectDisplayMode = input('vertical', ...(ngDevMode ? [{ debugName: "multiSelectDisplayMode" }] : []));
|
|
39
|
+
this.optionList = viewChild('optionList', ...(ngDevMode ? [{ debugName: "optionList" }] : []));
|
|
40
|
+
this._showOptions = signal(null, ...(ngDevMode ? [{ debugName: "_showOptions" }] : []));
|
|
41
|
+
this._inputValue = signal('', ...(ngDevMode ? [{ debugName: "_inputValue" }] : []));
|
|
42
|
+
this._optionHideTimeout = signal(undefined, ...(ngDevMode ? [{ debugName: "_optionHideTimeout" }] : []));
|
|
43
|
+
this._chipList = signal([], ...(ngDevMode ? [{ debugName: "_chipList" }] : []));
|
|
44
|
+
this._selectedOptions = signal([], ...(ngDevMode ? [{ debugName: "_selectedOptions" }] : []));
|
|
45
45
|
this.inputValue$ = new Subject();
|
|
46
46
|
this.selectOptionsChange = toObservable(this.selectOptions)
|
|
47
47
|
.pipe(takeUntilDestroyed())
|
|
@@ -64,17 +64,17 @@ class QuangAutocompleteComponent extends QuangBaseComponent {
|
|
|
64
64
|
else {
|
|
65
65
|
return text?.length ? this.filterOptions(text) : this.selectOptions();
|
|
66
66
|
}
|
|
67
|
-
});
|
|
67
|
+
}, ...(ngDevMode ? [{ debugName: "_filteredOptions" }] : []));
|
|
68
68
|
this.selectedOption = output();
|
|
69
69
|
this.searchTextChange = output();
|
|
70
|
-
this.searchTextDebounce = input(300);
|
|
71
|
-
this.internalFilterOptions = input(true);
|
|
70
|
+
this.searchTextDebounce = input(300, ...(ngDevMode ? [{ debugName: "searchTextDebounce" }] : []));
|
|
71
|
+
this.internalFilterOptions = input(true, ...(ngDevMode ? [{ debugName: "internalFilterOptions" }] : []));
|
|
72
72
|
this.ParentType = OptionListParentType.AUTOCOMPLETE;
|
|
73
73
|
this.formValueChange$ = undefined;
|
|
74
|
-
this.selectInput = viewChild('selectInput');
|
|
75
|
-
this.chipContainer = viewChild('chipContainer');
|
|
76
|
-
this.autocompleteContainer = viewChild('autocompleteContainer');
|
|
77
|
-
this.inputHeight = signal(0);
|
|
74
|
+
this.selectInput = viewChild('selectInput', ...(ngDevMode ? [{ debugName: "selectInput" }] : []));
|
|
75
|
+
this.chipContainer = viewChild('chipContainer', ...(ngDevMode ? [{ debugName: "chipContainer" }] : []));
|
|
76
|
+
this.autocompleteContainer = viewChild('autocompleteContainer', ...(ngDevMode ? [{ debugName: "autocompleteContainer" }] : []));
|
|
77
|
+
this.inputHeight = signal(0, ...(ngDevMode ? [{ debugName: "inputHeight" }] : []));
|
|
78
78
|
this.onChangeSelectInput = effect(() => {
|
|
79
79
|
const selectInput = this.selectInput();
|
|
80
80
|
if (selectInput) {
|
|
@@ -104,7 +104,7 @@ class QuangAutocompleteComponent extends QuangBaseComponent {
|
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
});
|
|
107
|
+
}, ...(ngDevMode ? [{ debugName: "onChangeSelectInput" }] : []));
|
|
108
108
|
this.inputValue$
|
|
109
109
|
.pipe(takeUntilDestroyed(), debounceTime(this.searchTextDebounce()), distinctUntilChanged())
|
|
110
110
|
.subscribe((value) => {
|
|
@@ -263,8 +263,8 @@ class QuangAutocompleteComponent extends QuangBaseComponent {
|
|
|
263
263
|
this._chipList.update((list) => [...list, chip.value]);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
267
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.
|
|
266
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
267
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: QuangAutocompleteComponent, isStandalone: true, selector: "quang-autocomplete", inputs: { syncFormWithText: { classPropertyName: "syncFormWithText", publicName: "syncFormWithText", isSignal: true, isRequired: false, transformFunction: null }, optionListMaxHeight: { classPropertyName: "optionListMaxHeight", publicName: "optionListMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, selectOptions: { classPropertyName: "selectOptions", publicName: "selectOptions", isSignal: true, isRequired: true, transformFunction: null }, translateValue: { classPropertyName: "translateValue", publicName: "translateValue", isSignal: true, isRequired: false, transformFunction: null }, scrollBehaviorOnOpen: { classPropertyName: "scrollBehaviorOnOpen", publicName: "scrollBehaviorOnOpen", isSignal: true, isRequired: false, transformFunction: null }, emitOnly: { classPropertyName: "emitOnly", publicName: "emitOnly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, chipMaxLength: { classPropertyName: "chipMaxLength", publicName: "chipMaxLength", isSignal: true, isRequired: false, transformFunction: null }, multiSelectDisplayMode: { classPropertyName: "multiSelectDisplayMode", publicName: "multiSelectDisplayMode", isSignal: true, isRequired: false, transformFunction: null }, searchTextDebounce: { classPropertyName: "searchTextDebounce", publicName: "searchTextDebounce", isSignal: true, isRequired: false, transformFunction: null }, internalFilterOptions: { classPropertyName: "internalFilterOptions", publicName: "internalFilterOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedOption: "selectedOption", searchTextChange: "searchTextChange" }, providers: [
|
|
268
268
|
{
|
|
269
269
|
provide: NG_VALUE_ACCESSOR,
|
|
270
270
|
useExisting: forwardRef(() => QuangAutocompleteComponent),
|
|
@@ -274,9 +274,9 @@ class QuangAutocompleteComponent extends QuangBaseComponent {
|
|
|
274
274
|
provide: QuangOptionListComponent,
|
|
275
275
|
multi: false,
|
|
276
276
|
},
|
|
277
|
-
], viewQueries: [{ propertyName: "optionList", first: true, predicate: ["optionList"], descendants: true, isSignal: true }, { propertyName: "selectInput", first: true, predicate: ["selectInput"], descendants: true, isSignal: true }, { propertyName: "chipContainer", first: true, predicate: ["chipContainer"], descendants: true, isSignal: true }, { propertyName: "autocompleteContainer", first: true, predicate: ["autocompleteContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n [ngStyle]=\"{ '--chip-max-length': chipMaxLength() ? chipMaxLength() + 'ch' : 'none' }\"\n #autocompleteContainer\n class=\"autocomplete-container\"\n>\n @if (componentLabel()) {\n <label\n [htmlFor]=\"componentId()\"\n class=\"form-label d-flex gap-2\"\n >\n <div>\n <span>{{ componentLabel() | transloco }}</span>\n <span [hidden]=\"!_isRequired()\">*</span>\n </div>\n @if (helpMessage() && helpMessageTooltip()) {\n <div [quangTooltip]=\"helpMessage() | transloco\">\n <ng-content select=\"[help-icon]\" />\n </div>\n }\n </label>\n }\n <div\n [ngClass]=\"multiSelectDisplayMode() === 'horizontal' ? 'horizontal form-control' : ''\"\n #chipContainer\n class=\"container-wrap\"\n >\n @if (multiple() && _chipList().length > 0) {\n @for (chip of _chipList(); track $index) {\n @if (getDescription(chip)) {\n <div\n [quangTooltip]=\"chipMaxLength() ? getDescription(chip) : ''\"\n class=\"chip chip-hover\"\n >\n <p [ngClass]=\"{ 'm-0': isReadonly() || _isDisabled() }\">\n {{ getDescription(chip) }}\n </p>\n @if (!isReadonly() && !_isDisabled()) {\n <button\n [tabIndex]=\"$index + 1\"\n (click)=\"deleteChip(chip)\"\n class=\"btn btn-chip\"\n type=\"button\"\n >\n <svg\n class=\"ionicon\"\n fill=\"currentColor\"\n height=\"24\"\n viewBox=\"0 0 512 512\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M368 368L144 144M368 144L144 368\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"32\"\n />\n </svg>\n </button>\n }\n </div>\n }\n }\n }\n\n <input\n [attr.required]=\"getIsRequiredControl()\"\n [class.form-control]=\"multiSelectDisplayMode() !== 'horizontal'\"\n [class.is-invalid]=\"_showErrors()\"\n [class.is-valid]=\"_showSuccess()\"\n [disabled]=\"_isDisabled() || isReadonly()\"\n [id]=\"componentId()\"\n [ngClass]=\"componentClass()\"\n [placeholder]=\"componentPlaceholder() | transloco\"\n [tabIndex]=\"componentTabIndex()\"\n [value]=\"_inputValue()\"\n (blur)=\"onBlurInput($event)\"\n (input)=\"onChangeInput($event)\"\n (mousedown)=\"showOptionVisibility()\"\n #selectInput\n autocomplete=\"off\"\n type=\"text\"\n />\n </div>\n @if (_showOptions()) {\n <quang-option-list\n [_isDisabled]=\"_isDisabled()\"\n [_value]=\"_value()\"\n [componentClass]=\"componentClass()\"\n [componentLabel]=\"componentLabel()\"\n [componentTabIndex]=\"componentTabIndex()\"\n [nullOption]=\"false\"\n [optionListMaxHeight]=\"optionListMaxHeight()\"\n [parentID]=\"componentId()\"\n [parentType]=\"ParentType\"\n [scrollBehaviorOnOpen]=\"scrollBehaviorOnOpen()\"\n [selectButtonRef]=\"autocompleteContainer\"\n [selectOptions]=\"_filteredOptions()\"\n [translateValue]=\"translateValue()\"\n (blurHandler)=\"onBlurOptionList($event)\"\n (changedHandler)=\"onValueChange($event)\"\n #optionList\n selectionMode=\"single\"\n />\n }\n <div class=\"valid-feedback\">\n {{ successMessage() | transloco }}\n </div>\n <div class=\"invalid-feedback\">\n {{ _currentErrorMessage() | transloco: _currentErrorMessageExtraData() }}\n </div>\n @if (helpMessage() && !helpMessageTooltip()) {\n <small\n [hidden]=\"_showSuccess() || _showErrors()\"\n aria-live=\"assertive\"\n class=\"form-text text-muted\"\n >\n {{ helpMessage() | transloco }}\n </small>\n }\n</div>\n", styles: [":host{display:block;--chip-max-length: none}.autocomplete-container{margin-bottom:1rem;position:relative}.chip:has(.btn-chip:disabled):hover{filter:unset;cursor:unset}.container-wrap{display:flex;flex-wrap:wrap;gap:.5rem}.container-wrap.horizontal{display:flex}.container-wrap.horizontal .chip-container{max-width:70%;margin-bottom:0;margin-left:.5rem;flex-wrap:nowrap;white-space:nowrap;overflow-x:auto;position:absolute;align-items:center}.container-wrap.horizontal .chip-container .chip{white-space:nowrap}.container-wrap.horizontal input{min-width:30%;flex:1 1 0;width:auto;border:none}.container-wrap.horizontal input:focus-visible{outline:none}.chip{display:flex;justify-content:space-between;align-items:center;padding:.25rem .5rem;border-radius:16px;color:var(--bs-btn-color);background-color:rgba(var(--bs-primary-rgb),.1);border-width:1px;border-style:solid;border-color:var(--bs-primary-border-subtle);height:2rem}.chip p{margin:0;max-width:var(--chip-max-length);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.chip .btn-chip{text-align:end;padding:0;min-width:unset}.chip .btn-chip:hover{opacity:80%}.chip .btn-chip:active{border-color:transparent}.chip .btn-chip svg{color:var(--bs-primary);vertical-align:sub}.chip:has(.btn-chip:focus-visible){border-width:2px;filter:brightness(80%)}\n"], dependencies: [{ kind: "
|
|
277
|
+
], viewQueries: [{ propertyName: "optionList", first: true, predicate: ["optionList"], descendants: true, isSignal: true }, { propertyName: "selectInput", first: true, predicate: ["selectInput"], descendants: true, isSignal: true }, { propertyName: "chipContainer", first: true, predicate: ["chipContainer"], descendants: true, isSignal: true }, { propertyName: "autocompleteContainer", first: true, predicate: ["autocompleteContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n [ngStyle]=\"{ '--chip-max-length': chipMaxLength() ? chipMaxLength() + 'ch' : 'none' }\"\n #autocompleteContainer\n class=\"autocomplete-container\"\n>\n @if (componentLabel()) {\n <label\n [htmlFor]=\"componentId()\"\n class=\"form-label d-flex gap-2\"\n >\n <div>\n <span>{{ componentLabel() | transloco }}</span>\n <span [hidden]=\"!_isRequired()\">*</span>\n </div>\n @if (helpMessage() && helpMessageTooltip()) {\n <div [quangTooltip]=\"helpMessage() | transloco\">\n <ng-content select=\"[help-icon]\" />\n </div>\n }\n </label>\n }\n <div\n [ngClass]=\"multiSelectDisplayMode() === 'horizontal' ? 'horizontal form-control' : ''\"\n #chipContainer\n class=\"container-wrap\"\n >\n @if (multiple() && _chipList().length > 0) {\n @for (chip of _chipList(); track $index) {\n @if (getDescription(chip)) {\n <div\n [quangTooltip]=\"chipMaxLength() ? getDescription(chip) : ''\"\n class=\"chip chip-hover\"\n >\n <p [ngClass]=\"{ 'm-0': isReadonly() || _isDisabled() }\">\n {{ getDescription(chip) }}\n </p>\n @if (!isReadonly() && !_isDisabled()) {\n <button\n [tabIndex]=\"$index + 1\"\n (click)=\"deleteChip(chip)\"\n class=\"btn btn-chip\"\n type=\"button\"\n >\n <svg\n class=\"ionicon\"\n fill=\"currentColor\"\n height=\"24\"\n viewBox=\"0 0 512 512\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M368 368L144 144M368 144L144 368\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"32\"\n />\n </svg>\n </button>\n }\n </div>\n }\n }\n }\n\n <input\n [attr.required]=\"getIsRequiredControl()\"\n [class.form-control]=\"multiSelectDisplayMode() !== 'horizontal'\"\n [class.is-invalid]=\"_showErrors()\"\n [class.is-valid]=\"_showSuccess()\"\n [disabled]=\"_isDisabled() || isReadonly()\"\n [id]=\"componentId()\"\n [ngClass]=\"componentClass()\"\n [placeholder]=\"componentPlaceholder() | transloco\"\n [tabIndex]=\"componentTabIndex()\"\n [value]=\"_inputValue()\"\n (blur)=\"onBlurInput($event)\"\n (input)=\"onChangeInput($event)\"\n (mousedown)=\"showOptionVisibility()\"\n #selectInput\n autocomplete=\"off\"\n type=\"text\"\n />\n </div>\n @if (_showOptions()) {\n <quang-option-list\n [_isDisabled]=\"_isDisabled()\"\n [_value]=\"_value()\"\n [componentClass]=\"componentClass()\"\n [componentLabel]=\"componentLabel()\"\n [componentTabIndex]=\"componentTabIndex()\"\n [nullOption]=\"false\"\n [optionListMaxHeight]=\"optionListMaxHeight()\"\n [parentID]=\"componentId()\"\n [parentType]=\"ParentType\"\n [scrollBehaviorOnOpen]=\"scrollBehaviorOnOpen()\"\n [selectButtonRef]=\"autocompleteContainer\"\n [selectOptions]=\"_filteredOptions()\"\n [translateValue]=\"translateValue()\"\n (blurHandler)=\"onBlurOptionList($event)\"\n (changedHandler)=\"onValueChange($event)\"\n #optionList\n selectionMode=\"single\"\n />\n }\n <div class=\"valid-feedback\">\n {{ successMessage() | transloco }}\n </div>\n <div class=\"invalid-feedback\">\n {{ _currentErrorMessage() | transloco: _currentErrorMessageExtraData() }}\n </div>\n @if (helpMessage() && !helpMessageTooltip()) {\n <small\n [hidden]=\"_showSuccess() || _showErrors()\"\n aria-live=\"assertive\"\n class=\"form-text text-muted\"\n >\n {{ helpMessage() | transloco }}\n </small>\n }\n</div>\n", styles: [":host{display:block;--chip-max-length: none}.autocomplete-container{margin-bottom:1rem;position:relative}.chip:has(.btn-chip:disabled):hover{filter:unset;cursor:unset}.container-wrap{display:flex;flex-wrap:wrap;gap:.5rem}.container-wrap.horizontal{display:flex}.container-wrap.horizontal .chip-container{max-width:70%;margin-bottom:0;margin-left:.5rem;flex-wrap:nowrap;white-space:nowrap;overflow-x:auto;position:absolute;align-items:center}.container-wrap.horizontal .chip-container .chip{white-space:nowrap}.container-wrap.horizontal input{min-width:30%;flex:1 1 0;width:auto;border:none}.container-wrap.horizontal input:focus-visible{outline:none}.chip{display:flex;justify-content:space-between;align-items:center;padding:.25rem .5rem;border-radius:16px;color:var(--bs-btn-color);background-color:rgba(var(--bs-primary-rgb),.1);border-width:1px;border-style:solid;border-color:var(--bs-primary-border-subtle);height:2rem}.chip p{margin:0;max-width:var(--chip-max-length);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.chip .btn-chip{text-align:end;padding:0;min-width:unset}.chip .btn-chip:hover{opacity:80%}.chip .btn-chip:active{border-color:transparent}.chip .btn-chip svg{color:var(--bs-primary);vertical-align:sub}.chip:has(.btn-chip:focus-visible){border-width:2px;filter:brightness(80%)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: QuangOptionListComponent, selector: "quang-option-list", inputs: ["selectionMode", "optionListMaxHeight", "selectOptions", "selectButtonRef", "_value", "_isDisabled", "componentClass", "componentLabel", "componentTabIndex", "translateValue", "nullOption", "scrollBehaviorOnOpen", "parentType", "parentID"], outputs: ["changedHandler", "blurHandler"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: QuangTooltipDirective, selector: "[quangTooltip]", inputs: ["quangTooltip", "showMethod"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
278
278
|
}
|
|
279
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: QuangAutocompleteComponent, decorators: [{
|
|
280
280
|
type: Component,
|
|
281
281
|
args: [{ selector: 'quang-autocomplete', imports: [TranslocoPipe, NgClass, QuangOptionListComponent, NgStyle, QuangTooltipDirective], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
282
282
|
{
|