@ng-atomic/common 19.51.0 → 19.80.0
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/ng-atomic-common-directives-active-control.mjs +51 -60
- package/fesm2022/ng-atomic-common-directives-active-control.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-directives-ios-safari-scroll-buggyfill.mjs +0 -3
- package/fesm2022/ng-atomic-common-directives-ios-safari-scroll-buggyfill.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-directives-prevent-browser-zoom.mjs +0 -3
- package/fesm2022/ng-atomic-common-directives-prevent-browser-zoom.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-interceptors-authorization.mjs +0 -1
- package/fesm2022/ng-atomic-common-interceptors-authorization.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-pipes-columns.mjs +0 -1
- package/fesm2022/ng-atomic-common-pipes-columns.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-pipes-domain.mjs +0 -9
- package/fesm2022/ng-atomic-common-pipes-domain.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-pipes-smart-field.mjs +0 -3
- package/fesm2022/ng-atomic-common-pipes-smart-field.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-app.mjs +1 -3
- package/fesm2022/ng-atomic-common-services-app.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-auth.mjs +14 -25
- package/fesm2022/ng-atomic-common-services-auth.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-editing.mjs +0 -16
- package/fesm2022/ng-atomic-common-services-editing.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-form-_index.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-form-json-schema.mjs +1 -25
- package/fesm2022/ng-atomic-common-services-form-json-schema.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-form.mjs +0 -5
- package/fesm2022/ng-atomic-common-services-form.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-query-resolver.mjs +0 -2
- package/fesm2022/ng-atomic-common-services-query-resolver.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-sheets-actions.mjs +0 -1
- package/fesm2022/ng-atomic-common-services-sheets-actions.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-side-app.mjs +0 -1
- package/fesm2022/ng-atomic-common-services-side-app.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-side-nav-mode.mjs +0 -1
- package/fesm2022/ng-atomic-common-services-side-nav-mode.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-spreadsheet.mjs +2 -39
- package/fesm2022/ng-atomic-common-services-spreadsheet.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-services-ui.mjs +0 -2
- package/fesm2022/ng-atomic-common-services-ui.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-stores-entities.mjs +0 -18
- package/fesm2022/ng-atomic-common-stores-entities.mjs.map +1 -1
- package/fesm2022/ng-atomic-common-utils.mjs +2 -34
- package/fesm2022/ng-atomic-common-utils.mjs.map +1 -1
- package/fesm2022/ng-atomic-common.mjs +56 -121
- package/fesm2022/ng-atomic-common.mjs.map +1 -1
- package/package.json +3 -3
- package/types/ng-atomic-common-directives-active-control.d.ts +2 -27
- package/types/ng-atomic-common-directives-active-control.d.ts.map +1 -1
- package/types/ng-atomic-common-directives-prevent-browser-zoom.d.ts +0 -3
- package/types/ng-atomic-common-directives-prevent-browser-zoom.d.ts.map +1 -1
- package/types/ng-atomic-common-interceptors-authorization.d.ts +0 -1
- package/types/ng-atomic-common-interceptors-authorization.d.ts.map +1 -1
- package/types/ng-atomic-common-pipes-columns.d.ts +0 -1
- package/types/ng-atomic-common-pipes-columns.d.ts.map +1 -1
- package/types/ng-atomic-common-pipes-domain.d.ts +0 -9
- package/types/ng-atomic-common-pipes-domain.d.ts.map +1 -1
- package/types/ng-atomic-common-pipes-smart-field.d.ts +0 -3
- package/types/ng-atomic-common-pipes-smart-field.d.ts.map +1 -1
- package/types/ng-atomic-common-services-auth.d.ts +4 -2
- package/types/ng-atomic-common-services-auth.d.ts.map +1 -1
- package/types/ng-atomic-common-services-editing.d.ts +0 -16
- package/types/ng-atomic-common-services-editing.d.ts.map +1 -1
- package/types/ng-atomic-common-services-form.d.ts +0 -5
- package/types/ng-atomic-common-services-form.d.ts.map +1 -1
- package/types/ng-atomic-common-services-side-nav-mode.d.ts +0 -1
- package/types/ng-atomic-common-services-side-nav-mode.d.ts.map +1 -1
- package/types/ng-atomic-common-services-spreadsheet.d.ts +0 -4
- package/types/ng-atomic-common-services-spreadsheet.d.ts.map +1 -1
- package/types/ng-atomic-common-stores-entities.d.ts +0 -3
- package/types/ng-atomic-common-stores-entities.d.ts.map +1 -1
- package/types/ng-atomic-common-utils.d.ts +0 -24
- package/types/ng-atomic-common-utils.d.ts.map +1 -1
- package/types/ng-atomic-common.d.ts +2 -77
- package/types/ng-atomic-common.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-atomic-common-pipes-smart-field.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/pipes/smart-field/smart-field.pipe.ts","../../../../../packages/@ng-atomic/common/src/lib/pipes/smart-field/ng-atomic-common-pipes-smart-field.ts"],"sourcesContent":["import { InjectionToken, Pipe, PipeTransform, Signal, inject } from '@angular/core';\nimport { Action } from '@ng-atomic/core';\nimport { SignalOrValue } from '@ng-atomic/common/pipes/signal';\nimport { get } from 'lodash-es';\n\n\nexport interface Option<T> {\n name: string;\n value: T;\n}\n\ninterface BaseField {\n placeholder?: string;\n hint?: SignalOrValue<string>;\n actions?: Action[] | Signal<Action[]>;\n}\n\ninterface TextField extends BaseField {\n type: 'text';\n autoComplete?: SignalOrValue<string[]>;\n}\n\ninterface PasswordField extends BaseField {\n type: 'password';\n}\n\ninterface NumberField extends BaseField {\n type: 'number';\n}\n\ninterface TextareaField extends BaseField {\n type: 'textarea';\n rows?: number;\n}\n\ninterface DateInputField extends BaseField {\n type: 'date';\n}\n\ninterface DateRangeInputField extends BaseField {\n type: 'date-range';\n}\n\ninterface SelectField<T> extends BaseField {\n type: 'select';\n options: Option<T>[] | Signal<Option<T>[]>;\n multiple?: boolean;\n}\n\ninterface TimeRangeField extends BaseField {\n type: 'time-range';\n}\n\n
|
|
1
|
+
{"version":3,"file":"ng-atomic-common-pipes-smart-field.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/pipes/smart-field/smart-field.pipe.ts","../../../../../packages/@ng-atomic/common/src/lib/pipes/smart-field/ng-atomic-common-pipes-smart-field.ts"],"sourcesContent":["import { InjectionToken, Pipe, PipeTransform, Signal, inject } from '@angular/core';\nimport { Action } from '@ng-atomic/core';\nimport { SignalOrValue } from '@ng-atomic/common/pipes/signal';\nimport { get } from 'lodash-es';\n\n\nexport interface Option<T> {\n name: string;\n value: T;\n}\n\ninterface BaseField {\n placeholder?: string;\n hint?: SignalOrValue<string>;\n actions?: Action[] | Signal<Action[]>;\n}\n\ninterface TextField extends BaseField {\n type: 'text';\n autoComplete?: SignalOrValue<string[]>;\n}\n\ninterface PasswordField extends BaseField {\n type: 'password';\n}\n\ninterface NumberField extends BaseField {\n type: 'number';\n}\n\ninterface TextareaField extends BaseField {\n type: 'textarea';\n rows?: number;\n}\n\ninterface DateInputField extends BaseField {\n type: 'date';\n}\n\ninterface DateRangeInputField extends BaseField {\n type: 'date-range';\n}\n\ninterface SelectField<T> extends BaseField {\n type: 'select';\n options: Option<T>[] | Signal<Option<T>[]>;\n multiple?: boolean;\n}\n\ninterface TimeRangeField extends BaseField {\n type: 'time-range';\n}\n\n\ninterface MultiSelectField<T> extends BaseField {\n type: 'multi-select';\n options: Option<T>[] | Signal<Option<T>[]>;\n}\n\ninterface FileField extends BaseField {\n type: 'file';\n progress?: Signal<number | null>;\n}\n\ninterface ActionField extends BaseField {\n type: 'action';\n actions: Action[] | Signal<Action[]>;\n buttonType?: 'flat' | 'raised' | 'stroked' | 'icon';\n disabled?: boolean;\n}\n\ninterface AgreementField {\n type: 'agreement';\n labelTemp: null | any;\n}\n\ninterface SliderField extends BaseField {\n type: 'slider';\n slider: {\n min?: number;\n max?: number;\n step?: number;\n }\n}\n\ninterface HiddenField {\n type: 'hidden';\n}\n\ninterface PreviewField extends BaseField {\n type: 'preview';\n}\n\ninterface PreviewImageField extends BaseField {\n type: 'preview:image';\n}\n\nexport type FormField<V = any> = \n | TextField\n | PasswordField\n | TextareaField\n | DateInputField\n | DateRangeInputField\n | SelectField<V>\n | TimeRangeField\n | MultiSelectField<V>\n | FileField\n | ActionField\n | HiddenField\n | NumberField\n | PreviewField\n | AgreementField\n | SliderField\n | PreviewImageField;\n\nexport interface FormFieldMap {\n [key: string]: FormField<any> | FormFieldMap;\n}\n\n\nexport const FORM_FIELD_MAP = new InjectionToken<FormFieldMap>('[@ng-atomic] Smart Form Field');\n\n\nexport function provideFormFieldMap(useFactory: () => FormFieldMap) {\n return { provide: FORM_FIELD_MAP, useFactory };\n}\n\ntype Enum<T> = Record<string, T>;\n\nexport function buildOptions<T>(_enum: Enum<T> | any[]): Option<T>[] {\n if (Array.isArray(_enum)) {\n return _enum.map(value => ({value, name: value}) as Option<T>);\n }\n return Object.values(_enum).map(value => ({value, name: value}) as Option<T>);\n}\n\nexport function buildEnumOptions<T>(_enum: Enum<T>): Option<T>[] {\n return Object.entries(_enum).map(([key, value]) => ({value, name: key}) as Option<T>);\n}\n\n\n@Pipe({name: 'smartField', standalone: true, pure: true})\nexport class SmartFieldPipe implements PipeTransform {\n protected map = inject(FORM_FIELD_MAP, {optional: true}) ?? {\n createdAt: { type: 'date' },\n updatedAt: { type: 'date' },\n deletedAt: { type: 'date' },\n };\n\n transform(key: string, map: FormFieldMap = this.map): FormField<any> {\n return (get(map, key) ?? {type: 'text'}) as FormField<any>;\n }\n}\n\nexport function resolveFormField(fieldMap: FormFieldMap, name: string) {\n if (get(fieldMap, name)) return get(fieldMap, name);\n for (const key of Object.keys(fieldMap ?? {})) {\n if (new RegExp(key).test(name)) return get(fieldMap, key);\n }\n return {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AG,EAAE,GAAG,CAAC,IAAI,EAAC,IAAI,EAAE,MAAM,EAAC;IACzC;8GATW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;4GAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,IAAI;mBAAC,EAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC;;AAalD,SAAU,gBAAgB,CAAC,QAAsB,EAAE,IAAY,EAAA;AACnE,IAAA,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC;AAAE,QAAA,OAAO,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC;AACnD,IAAA,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE;QAC7C,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AAAE,YAAA,OAAO,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC;IAC3D;AACA,IAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAe;AACtC;;AChKA;;AAEG;;;;"}
|
|
@@ -17,7 +17,7 @@ class HistoryInjectorService {
|
|
|
17
17
|
this.isInitialNavigation = true;
|
|
18
18
|
this.router.events.subscribe((event) => {
|
|
19
19
|
if (event instanceof NavigationStart && this.isInitialNavigation) {
|
|
20
|
-
this.isInitialNavigation = false;
|
|
20
|
+
this.isInitialNavigation = false;
|
|
21
21
|
this.injectParentRoutes(event.url);
|
|
22
22
|
}
|
|
23
23
|
});
|
|
@@ -32,13 +32,11 @@ class HistoryInjectorService {
|
|
|
32
32
|
console.debug('[HistoryInjector] Adding parent URL to history:', parentUrl);
|
|
33
33
|
await this.router.navigateByUrl(parentUrl);
|
|
34
34
|
}
|
|
35
|
-
// 最終的に元のURLに遷移
|
|
36
35
|
await this.router.navigateByUrl(currentUrl);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
getFilteredSegments(urlTree) {
|
|
40
39
|
const segments = urlTree.root.children['primary']?.segments || [];
|
|
41
|
-
// `skip=true`のマトリクスパラメーターが含まれるセグメントを除外
|
|
42
40
|
return segments.filter(segment => {
|
|
43
41
|
const skip = segment.parameterMap.get('skip');
|
|
44
42
|
return skip !== 'true';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-atomic-common-services-app.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/app/app.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/app/ng-atomic-common-services-app.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { NavigationStart, Router, UrlSegment, UrlTree } from '@angular/router';\nimport { LoadingService } from '@ng-atomic/common/services/loading';\nimport { SideAppService } from '@ng-atomic/common/services/side-app';\nimport { SideNavModeService } from '@ng-atomic/common/services/side-nav-mode';\nimport { FabService } from '@ng-atomic/common/services/fab';\nimport { SnackBarService } from '@ng-atomic/common/services/snack-bar';\nimport { Clipboard } from '@angular/cdk/clipboard';\nimport { MatDialog } from '@angular/material/dialog';\nimport { SheetService } from '@ng-atomic/common/services/sheets';\n\n\n@Injectable({\n providedIn: 'root',\n})\nexport class HistoryInjectorService {\n private isInitialNavigation = true;\n\n constructor(private router: Router) {\n this.router.events.subscribe((event) => {\n if (event instanceof NavigationStart && this.isInitialNavigation) {\n this.isInitialNavigation = false;
|
|
1
|
+
{"version":3,"file":"ng-atomic-common-services-app.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/app/app.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/app/ng-atomic-common-services-app.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { NavigationStart, Router, UrlSegment, UrlTree } from '@angular/router';\nimport { LoadingService } from '@ng-atomic/common/services/loading';\nimport { SideAppService } from '@ng-atomic/common/services/side-app';\nimport { SideNavModeService } from '@ng-atomic/common/services/side-nav-mode';\nimport { FabService } from '@ng-atomic/common/services/fab';\nimport { SnackBarService } from '@ng-atomic/common/services/snack-bar';\nimport { Clipboard } from '@angular/cdk/clipboard';\nimport { MatDialog } from '@angular/material/dialog';\nimport { SheetService } from '@ng-atomic/common/services/sheets';\n\n\n@Injectable({\n providedIn: 'root',\n})\nexport class HistoryInjectorService {\n private isInitialNavigation = true;\n\n constructor(private router: Router) {\n this.router.events.subscribe((event) => {\n if (event instanceof NavigationStart && this.isInitialNavigation) {\n this.isInitialNavigation = false; \n this.injectParentRoutes(event.url);\n }\n });\n }\n\n private async injectParentRoutes(currentUrl: string): Promise<void> {\n const urlTree: UrlTree = this.router.parseUrl(currentUrl);\n const segments = this.getFilteredSegments(urlTree);\n\n console.debug('[HistoryInjector] Filtered segments:', segments);\n\n if (segments.length > 1) {\n for (let i = 1; i < segments.length; i++) {\n const parentUrl = '/' + segments.slice(0, i).map(segment => segment.path).join('/');\n console.debug('[HistoryInjector] Adding parent URL to history:', parentUrl);\n await this.router.navigateByUrl(parentUrl);\n }\n\n \n await this.router.navigateByUrl(currentUrl);\n }\n }\n\n private getFilteredSegments(urlTree: UrlTree): UrlSegment[] {\n const segments = urlTree.root.children['primary']?.segments || [];\n\n \n return segments.filter(segment => {\n const skip = segment.parameterMap.get('skip');\n return skip !== 'true';\n });\n }\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AppService {\n readonly dialog = inject(MatDialog);\n readonly loading = inject(LoadingService);\n readonly sheet = inject(SheetService);\n readonly sideApp = inject(SideAppService);\n readonly sideNavMode = inject(SideNavModeService);\n readonly sideNav = inject(SideNavModeService);\n readonly router = inject(Router);\n readonly fab = inject(FabService);\n readonly snackBar = inject(SnackBarService);\n readonly clipboard = inject(Clipboard);\n readonly navigationInterceptor = inject(HistoryInjectorService);\n \n}\n","/**\n * Generated bundle index. Do not ed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,CAAC,kBAAkB,CAAC;AACpC,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC;AACxB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,eAAe,CAAC;AAClC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,QAAA,IAAA,CAAA,qBAAqB,GAAG,MAAM,CAAC,sBAAsB,CAAC;AAEhE,IAAA;8GAbY,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAV,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;AC1DD;;AAEG;;;;"}
|
|
@@ -1,44 +1,39 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
3
|
import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
-
import { Auth, authState, TwitterAuthProvider, signInWithPopup, GoogleAuthProvider, onAuthStateChanged, signInWithEmailAndPassword, createUserWithEmailAndPassword, signInWithCustomToken, signOut } from '@angular/fire/auth';
|
|
4
|
+
import { Auth, authState, getRedirectResult, TwitterAuthProvider, signInWithPopup, GoogleAuthProvider, signInWithRedirect, onAuthStateChanged, signInWithEmailAndPassword, createUserWithEmailAndPassword, signInWithCustomToken, signOut } from '@angular/fire/auth';
|
|
5
5
|
import { get } from 'lodash-es';
|
|
6
|
-
import { switchMap, of, distinctUntilChanged, shareReplay, map } from 'rxjs';
|
|
6
|
+
import { ReplaySubject, switchMap, of, distinctUntilChanged, shareReplay, map } from 'rxjs';
|
|
7
7
|
|
|
8
|
+
const redirectError$ = new ReplaySubject(1);
|
|
8
9
|
class AuthService {
|
|
10
|
+
#auth;
|
|
9
11
|
constructor() {
|
|
10
12
|
this.#auth = inject(Auth);
|
|
13
|
+
this.redirectError$ = redirectError$;
|
|
11
14
|
this.auth$ = authState(this.#auth);
|
|
12
15
|
this.auth = toSignal(this.auth$);
|
|
13
16
|
this.accessToken$ = this.auth$.pipe(switchMap(auth => auth ? auth.getIdToken() : of(null)), distinctUntilChanged(), shareReplay(1), takeUntilDestroyed());
|
|
14
17
|
this.accessToken = toSignal(this.accessToken$);
|
|
15
18
|
this.userId$ = this.auth$.pipe(map(auth => auth?.uid ?? null), distinctUntilChanged(), shareReplay(1), takeUntilDestroyed());
|
|
16
19
|
this.customClaims$ = this.auth$.pipe(switchMap(auth => auth ? auth.getIdTokenResult() : of(null)), map(token => token?.claims ?? {}), distinctUntilChanged(), shareReplay(1), takeUntilDestroyed());
|
|
20
|
+
if (typeof window !== 'undefined' && window.self !== window.top) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
getRedirectResult(this.#auth).catch(error => {
|
|
24
|
+
console.warn('[AuthService] getRedirectResult error:', error);
|
|
25
|
+
redirectError$.next(error);
|
|
26
|
+
});
|
|
17
27
|
}
|
|
18
|
-
#auth;
|
|
19
28
|
signInWithTwitter() {
|
|
20
29
|
const provider = new TwitterAuthProvider();
|
|
21
30
|
return signInWithPopup(this.#auth, provider);
|
|
22
31
|
}
|
|
23
|
-
// signInWithGoogle() {
|
|
24
|
-
// const provider = new GoogleAuthProvider();
|
|
25
|
-
// return signInWithPopup(this.#auth, provider);
|
|
26
|
-
// }
|
|
27
32
|
async signInWithGoogle(scopes = []) {
|
|
28
33
|
const provider = new GoogleAuthProvider();
|
|
29
34
|
for (const scope of scopes)
|
|
30
35
|
provider.addScope(scope);
|
|
31
|
-
return
|
|
32
|
-
if (error.code === 'auth/popup-closed-by-user') {
|
|
33
|
-
const user = await this.#waitForAuthState();
|
|
34
|
-
if (user)
|
|
35
|
-
return { user };
|
|
36
|
-
}
|
|
37
|
-
if (error.code === 'auth/account-exists-with-different-credential') {
|
|
38
|
-
this.onFailedForAccountExistsWithDifferentCredential(error);
|
|
39
|
-
}
|
|
40
|
-
throw error;
|
|
41
|
-
});
|
|
36
|
+
return signInWithRedirect(this.#auth, provider);
|
|
42
37
|
}
|
|
43
38
|
#waitForAuthState(timeoutMs = 3000) {
|
|
44
39
|
return new Promise(resolve => {
|
|
@@ -69,13 +64,7 @@ class AuthService {
|
|
|
69
64
|
}
|
|
70
65
|
onFailedForAccountExistsWithDifferentCredential(error) {
|
|
71
66
|
const credential = error.customData._tokenResponse;
|
|
72
|
-
// const pending = FacebookAuthProvider.credential(credential.oauthAccessToken);
|
|
73
67
|
const providerId = error.customData._tokenResponse.providerId;
|
|
74
|
-
// this.pends.update(pends => [...pends, {
|
|
75
|
-
// credential: pending,
|
|
76
|
-
// providerId: providerId,
|
|
77
|
-
// email: credential.email,
|
|
78
|
-
// }]);
|
|
79
68
|
}
|
|
80
69
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
81
70
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AuthService, providedIn: 'root' }); }
|
|
@@ -85,7 +74,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImpor
|
|
|
85
74
|
args: [{
|
|
86
75
|
providedIn: 'root'
|
|
87
76
|
}]
|
|
88
|
-
}] });
|
|
77
|
+
}], ctorParameters: () => [] });
|
|
89
78
|
function injectAuthState$() {
|
|
90
79
|
return inject(AuthService).auth$;
|
|
91
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-atomic-common-services-auth.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/auth/auth.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/auth/ng-atomic-common-services-auth.ts"],"sourcesContent":["import { Injectable, Signal, inject } from '@angular/core';\nimport { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Auth, authState, signInWithCustomToken, GoogleAuthProvider, TwitterAuthProvider, signInWithPopup, signOut, UserCredential, signInWithEmailAndPassword, createUserWithEmailAndPassword, User, onAuthStateChanged } from '@angular/fire/auth';\nimport { get } from 'lodash-es';\nimport { Observable, distinctUntilChanged, map, of, shareReplay, switchMap } from 'rxjs';\n\nexport interface TwitterCredential {\n context: string;\n displayName: string;\n email: string;\n emailVerified: boolean;\n expiresIn: string;\n federatedId: string;\n fullName: string;\n idToken: string;\n kind: 'identitytoolkit#VerifyAssertionResponse';\n localId: string;\n oauthAccessToken: string;\n oauthTokenSecret: string;\n photoUrl: string;\n providerId: 'twitter.com';\n rawUserInfo: string;\n refreshToken: string;\n screenName: string;\n}\n\nexport type Result = UserCredential & {_tokenResponse: TwitterCredential};\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthService {\n readonly #auth = inject(Auth);\n readonly auth$: Observable<User | null> = authState(this.#auth);\n readonly auth: Signal<User | null | undefined> = toSignal(this.auth$);\n readonly accessToken$ = this.auth$.pipe(\n switchMap(auth => auth ? auth.getIdToken() : of(null)),\n distinctUntilChanged(),\n shareReplay(1),\n takeUntilDestroyed(),\n );\n readonly accessToken = toSignal(this.accessToken$);\n\n userId$ = this.auth$.pipe(\n map(auth => auth?.uid ?? null),\n distinctUntilChanged(),\n shareReplay(1),\n takeUntilDestroyed(),\n );\n\n readonly customClaims$: Observable<Record<string, unknown>> = this.auth$.pipe(\n switchMap(auth => auth ? auth.getIdTokenResult() : of(null)),\n map(token => token?.claims ?? {}),\n distinctUntilChanged(),\n shareReplay(1),\n takeUntilDestroyed(),\n );\n\n signInWithTwitter(): Promise<Result> {\n const provider = new TwitterAuthProvider();\n return signInWithPopup(this.#auth, provider) as Promise<Result>\n }\n\n
|
|
1
|
+
{"version":3,"file":"ng-atomic-common-services-auth.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/auth/auth.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/auth/ng-atomic-common-services-auth.ts"],"sourcesContent":["import { Injectable, Signal, inject } from '@angular/core';\nimport { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Auth, authState, signInWithCustomToken, GoogleAuthProvider, TwitterAuthProvider, signInWithPopup, signInWithRedirect, getRedirectResult, signOut, UserCredential, signInWithEmailAndPassword, createUserWithEmailAndPassword, User, onAuthStateChanged } from '@angular/fire/auth';\nimport { get } from 'lodash-es';\nimport { Observable, ReplaySubject, distinctUntilChanged, map, of, shareReplay, switchMap } from 'rxjs';\n\nexport interface TwitterCredential {\n context: string;\n displayName: string;\n email: string;\n emailVerified: boolean;\n expiresIn: string;\n federatedId: string;\n fullName: string;\n idToken: string;\n kind: 'identitytoolkit#VerifyAssertionResponse';\n localId: string;\n oauthAccessToken: string;\n oauthTokenSecret: string;\n photoUrl: string;\n providerId: 'twitter.com';\n rawUserInfo: string;\n refreshToken: string;\n screenName: string;\n}\n\nexport type Result = UserCredential & {_tokenResponse: TwitterCredential};\n\n\nconst redirectError$ = new ReplaySubject<unknown>(1);\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthService {\n readonly #auth = inject(Auth);\n\n readonly redirectError$ = redirectError$;\n\n constructor() {\n \n \n \n \n \n if (typeof window !== 'undefined' && window.self !== window.top) {\n return;\n }\n \n \n \n getRedirectResult(this.#auth).catch(error => {\n \n console.warn('[AuthService] getRedirectResult error:', error);\n \n redirectError$.next(error);\n });\n }\n\n readonly auth$: Observable<User | null> = authState(this.#auth);\n readonly auth: Signal<User | null | undefined> = toSignal(this.auth$);\n readonly accessToken$ = this.auth$.pipe(\n switchMap(auth => auth ? auth.getIdToken() : of(null)),\n distinctUntilChanged(),\n shareReplay(1),\n takeUntilDestroyed(),\n );\n readonly accessToken = toSignal(this.accessToken$);\n\n userId$ = this.auth$.pipe(\n map(auth => auth?.uid ?? null),\n distinctUntilChanged(),\n shareReplay(1),\n takeUntilDestroyed(),\n );\n\n readonly customClaims$: Observable<Record<string, unknown>> = this.auth$.pipe(\n switchMap(auth => auth ? auth.getIdTokenResult() : of(null)),\n map(token => token?.claims ?? {}),\n distinctUntilChanged(),\n shareReplay(1),\n takeUntilDestroyed(),\n );\n\n signInWithTwitter(): Promise<Result> {\n const provider = new TwitterAuthProvider();\n return signInWithPopup(this.#auth, provider) as Promise<Result>\n }\n\n \n \n \n \n\n async signInWithGoogle(scopes: string[] = []) {\n const provider = new GoogleAuthProvider();\n for (const scope of scopes) provider.addScope(scope);\n \n \n \n return signInWithRedirect(this.#auth, provider);\n }\n\n #waitForAuthState(timeoutMs = 3000): Promise<User | null> {\n return new Promise(resolve => {\n let skip = true;\n const timer = setTimeout(() => { unsub(); resolve(null); }, timeoutMs);\n const unsub = onAuthStateChanged(this.#auth, user => {\n if (skip) { skip = false; return; }\n clearTimeout(timer); unsub(); resolve(user);\n });\n });\n }\n\n signInWithEmailAndPassword(email: string, password: string) {\n return signInWithEmailAndPassword(this.#auth, email, password);\n }\n\n createUserWithEmailAndPassword(email: string, password: string) {\n return createUserWithEmailAndPassword(this.#auth, email, password);\n }\n\n signInWithCustomToken(customToken: string): Promise<Result> {\n return signInWithCustomToken(this.#auth, customToken) as Promise<Result>;\n }\n\n signOut() {\n return signOut(this.#auth);\n }\n\n private onFailedForAccountExistsWithDifferentCredential(error: any) {\n const credential = error.customData._tokenResponse;\n \n const providerId = error.customData._tokenResponse.providerId;\n \n \n \n \n \n }\n}\n\nexport function injectAuthState$(): Observable<User | null> {\n return inject(AuthService).auth$;\n}\n\nexport function injectAuthState(): Signal<User | null | undefined> {\n return toSignal(injectAuthState$());\n}\n\nexport function injectUserId$(): Observable<string | null> {\n return inject(AuthService).userId$.pipe(\n distinctUntilChanged(),\n shareReplay(1),\n takeUntilDestroyed(),\n );\n}\n\nexport function injectUserId(): Signal<string | null> {\n return toSignal(injectUserId$()) as Signal<string | null>;\n}\n\nexport function injectTwitterId$() {\n return inject(AuthService).auth$.pipe(\n map(auth => auth?.providerData?.[0]?.uid ?? null),\n distinctUntilChanged(),\n shareReplay(1),\n takeUntilDestroyed(),\n );\n}\n\nexport function injectClaim$<T = string>(claim: string): Observable<T> {\n return inject(AuthService).customClaims$.pipe(\n map(token => claim ? get(token, claim) : token),\n distinctUntilChanged(),\n shareReplay(1),\n takeUntilDestroyed(),\n ) as any;\n}\n\nexport function injectClaim<T = string>(claim: string): Signal<T> {\n return toSignal(injectClaim$<T>(claim)) as Signal<T>;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA6BA,MAAM,cAAc,GAAG,IAAI,aAAa,CAAU,CAAC,CAAC;MAKvC,WAAW,CAAA;AACb,IAAA,KAAK;AAId,IAAA,WAAA,GAAA;AAJS,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;QAEpB,IAAA,CAAA,cAAc,GAAG,cAAc;AAsB/B,QAAA,IAAA,CAAA,KAAK,GAA4B,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;AACtD,QAAA,IAAA,CAAA,IAAI,GAAoC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;AAC5D,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CACrC,SAAS,CAAC,IAAI,IAAI,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EACtD,oBAAoB,EAAE,EACtB,WAAW,CAAC,CAAC,CAAC,EACd,kBAAkB,EAAE,CACrB;AACQ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K,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,EAC/C,oBAAoB,EAAE,EACtB,WAAW,CAAC,CAAC,CAAC,EACd,kBAAkB,EAAE,CACd;AACV;AAEM,SAAU,WAAW,CAAa,KAAa,EAAA;AACnD,IAAA,OAAO,QAAQ,CAAC,YAAY,CAAI,KAAK,CAAC,CAAc;AACtD;;ACtLA;;AAEG;;;;"}
|
|
@@ -2,23 +2,12 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { signal, computed, Injectable } from '@angular/core';
|
|
3
3
|
import { toObservable } from '@angular/core/rxjs-interop';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* EditingStateManager Service
|
|
7
|
-
*
|
|
8
|
-
* Manages global editing state for preventing data updates during cell editing.
|
|
9
|
-
* Uses Angular Signals for reactive state management.
|
|
10
|
-
*/
|
|
11
5
|
class EditingStateManager {
|
|
12
6
|
constructor() {
|
|
13
7
|
this.editingCells = signal([], ...(ngDevMode ? [{ debugName: "editingCells" }] : []));
|
|
14
8
|
this.isEditing = computed(() => this.editingCells().length > 0, ...(ngDevMode ? [{ debugName: "isEditing" }] : []));
|
|
15
9
|
this.isEditing$ = toObservable(this.isEditing);
|
|
16
10
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Start editing a cell
|
|
19
|
-
* @param rowId Row identifier
|
|
20
|
-
* @param columnId Column identifier
|
|
21
|
-
*/
|
|
22
11
|
startEditing(rowId, columnId) {
|
|
23
12
|
const cellKey = `${rowId}-${columnId}`;
|
|
24
13
|
this.editingCells.update(cells => {
|
|
@@ -27,11 +16,6 @@ class EditingStateManager {
|
|
|
27
16
|
return [...newCells];
|
|
28
17
|
});
|
|
29
18
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Stop editing a cell
|
|
32
|
-
* @param rowId Row identifier
|
|
33
|
-
* @param columnId Column identifier
|
|
34
|
-
*/
|
|
35
19
|
stopEditing(rowId, columnId) {
|
|
36
20
|
const cellKey = `${rowId}-${columnId}`;
|
|
37
21
|
this.editingCells.update(cells => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-atomic-common-services-editing.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/editing/editing-state-manager.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/editing/ng-atomic-common-services-editing.ts"],"sourcesContent":["import { Injectable, signal, computed } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { Observable } from 'rxjs';\n\n
|
|
1
|
+
{"version":3,"file":"ng-atomic-common-services-editing.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/editing/editing-state-manager.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/editing/ng-atomic-common-services-editing.ts"],"sourcesContent":["import { Injectable, signal, computed } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { Observable } from 'rxjs';\n\n\n@Injectable({ providedIn: 'root' })\nexport class EditingStateManager {\n private readonly editingCells = signal<string[]>([]);\n readonly isEditing = computed(() => this.editingCells().length > 0);\n readonly isEditing$: Observable<boolean> = toObservable(this.isEditing);\n \n \n startEditing(rowId: string | number, columnId: string): void {\n const cellKey = `${rowId}-${columnId}`;\n this.editingCells.update(cells => {\n const newCells = new Set(cells);\n newCells.add(cellKey);\n return [...newCells];\n });\n }\n \n \n stopEditing(rowId: string | number, columnId: string): void {\n const cellKey = `${rowId}-${columnId}`;\n this.editingCells.update(cells => {\n const newCells = new Set(cells);\n newCells.delete(cellKey);\n return [...newCells];\n });\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAMa,mBAAmB,CAAA;AADhC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAW,EAAE,wDAAC;AAC3C,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC,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U,EAAE,MAAM,EAAE;;;ACLlC;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-atomic-common-services-form-_index.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/form/_index/index.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/form/_index/ng-atomic-common-services-form-_index.ts"],"sourcesContent":["import { Injectable, inject } from \"@angular/core\";\nimport { FormBuilder } from \"@angular/forms\";\nimport { PaginationFormValue, PaginationService } from \"@ng-atomic/common/services/form/pagination\";\nimport { SortFormValue, SortService } from \"@ng-atomic/common/services/form/sort\";\nimport { injectProps } from \"@ng-atomic/common/pipes/domain\";\nimport { ColumnsFormBuilder, buildColumns, ColumnsFormValue } from \"@ng-atomic/common/services/form/columns\";\nimport { omitBy } from \"lodash-es\";\nexport { buildColumns }; \n\n@Injectable({ providedIn: 'root' })\nexport class IndexFormBuilder {\n readonly columns = inject(ColumnsFormBuilder);\n readonly sort = inject(SortService);\n readonly pagination = inject(PaginationService)\n readonly fb = inject(FormBuilder);\n\n build({\n query = undefined,\n sort = {},\n page,\n columns = buildColumns(['__checkbox', ...injectProps()(), '__actions'])\n }: {\n query?: string,\n page?: Partial<PaginationFormValue>,\n sort?: Partial<SortFormValue>,\n columns?: ColumnsFormValue,\n } = {}) {\n const omit = <T extends object>(obj: T) => omitBy(obj, value => value === undefined) as T;\n return this.fb.group(omit({\n query: typeof query !== 'undefined' ? this.fb.control(query) : undefined,\n page: page ? this.pagination.build(page) : undefined,\n sort: this.sort.build(sort),\n columns: this.columns.build(columns),\n }));\n }\n}\n\n\nexport function injectIndexFormBuilder() {\n return inject(IndexFormBuilder);\n}\n\nexport function injectIndexForm({\n columns = undefined,\n sort = undefined,\n query = undefined,\n page = undefined\n}: {\n columns?: ColumnsFormValue,\n sort?: Partial<SortFormValue>,\n query?: string,\n page?: Partial<PaginationFormValue>,\n} = {}) {\n return injectIndexFormBuilder().build({\n columns,\n sort,\n query,\n page,\n });\n}\n\nexport {\n
|
|
1
|
+
{"version":3,"file":"ng-atomic-common-services-form-_index.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/form/_index/index.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/form/_index/ng-atomic-common-services-form-_index.ts"],"sourcesContent":["import { Injectable, inject } from \"@angular/core\";\nimport { FormBuilder } from \"@angular/forms\";\nimport { PaginationFormValue, PaginationService } from \"@ng-atomic/common/services/form/pagination\";\nimport { SortFormValue, SortService } from \"@ng-atomic/common/services/form/sort\";\nimport { injectProps } from \"@ng-atomic/common/pipes/domain\";\nimport { ColumnsFormBuilder, buildColumns, ColumnsFormValue } from \"@ng-atomic/common/services/form/columns\";\nimport { omitBy } from \"lodash-es\";\nexport { buildColumns }; \n\n@Injectable({ providedIn: 'root' })\nexport class IndexFormBuilder {\n readonly columns = inject(ColumnsFormBuilder);\n readonly sort = inject(SortService);\n readonly pagination = inject(PaginationService)\n readonly fb = inject(FormBuilder);\n\n build({\n query = undefined,\n sort = {},\n page,\n columns = buildColumns(['__checkbox', ...injectProps()(), '__actions'])\n }: {\n query?: string,\n page?: Partial<PaginationFormValue>,\n sort?: Partial<SortFormValue>,\n columns?: ColumnsFormValue,\n } = {}) {\n const omit = <T extends object>(obj: T) => omitBy(obj, value => value === undefined) as T;\n return this.fb.group(omit({\n query: typeof query !== 'undefined' ? this.fb.control(query) : undefined,\n page: page ? this.pagination.build(page) : undefined,\n sort: this.sort.build(sort),\n columns: this.columns.build(columns),\n }));\n }\n}\n\n\nexport function injectIndexFormBuilder() {\n return inject(IndexFormBuilder);\n}\n\nexport function injectIndexForm({\n columns = undefined,\n sort = undefined,\n query = undefined,\n page = undefined\n}: {\n columns?: ColumnsFormValue,\n sort?: Partial<SortFormValue>,\n query?: string,\n page?: Partial<PaginationFormValue>,\n} = {}) {\n return injectIndexFormBuilder().build({\n columns,\n sort,\n query,\n page,\n });\n}\n\nexport {\n \n IndexFormBuilder as IndexTemplateFormBuilder,\n \n injectIndexForm as injectIndexTemplateForm,\n \n injectIndexFormBuilder as injectIndexTemplateFormBuilder,\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;MAUa,gBAAgB,CAAA;AAD7B,IAAA,WAAA,GAAA;AAEW,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACpC,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;AAC1B,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,iBAAiB,CAAC;AACtC,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC;AAqBlC,IAAA;AAnBC,IAAA,KAAK,CAAC,EACJ,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,EAAE,EACT,IAAI,EACJ,OAAO,GAAG,YAAY,CAAC,CAAC,YAAY,EAAE,GAAG,WAAW,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,EAAA,GAMrE,EAAE,EAAA;AACJ,QAAA,MAAM,IAAI,GAAG,CAAmB,GAAM,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI,KAAK,KAAK,SAAS,CAAM;AACzF,QAAA,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;AACxB,YAAA,KAAK,EAAE,OAAO,KAAK,KAAK,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS;AACxE,YAAA,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS;YACpD,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;AACrC,SAAA,CAAC,CAAC;IACL;8GAxBW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA,CAAA;;2FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;SA6BlB,sBAAsB,GAAA;AACpC,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAC;AACjC;AAEM,SAAU,eAAe,CAAC,EAC9B,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,SAAS,EAChB,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,SAAS,KAMd,EAAE,EAAA;AACJ,IAAA,OAAO,sBAAsB,EAAE,CAAC,KAAK,CAAC;QACpC,OAAO;QACP,IAAI;QACJ,KAAK;QACL,IAAI;AACL,KAAA,CAAC;AACJ;;AC3DA;;AAEG;;;;"}
|
|
@@ -39,7 +39,7 @@ const additionalConverters = {
|
|
|
39
39
|
isDayjs: (meta) => {
|
|
40
40
|
return {
|
|
41
41
|
type: 'string',
|
|
42
|
-
format: 'date-time',
|
|
42
|
+
format: 'date-time',
|
|
43
43
|
};
|
|
44
44
|
},
|
|
45
45
|
};
|
|
@@ -71,7 +71,6 @@ class JsonSchemaFormUtils {
|
|
|
71
71
|
}
|
|
72
72
|
static buildFormGroupByJsonSchema(schema, { fb = inject(FormBuilder).nonNullable, value = {}, } = {}) {
|
|
73
73
|
console.debug('[buildFormGroupByJsonSchema] schema:', schema);
|
|
74
|
-
// oneOf/discriminatedUnionを解決
|
|
75
74
|
const resolvedSchema = this.resolveOneOf(schema);
|
|
76
75
|
if (!resolvedSchema || !resolvedSchema?.properties) {
|
|
77
76
|
return fb.group({});
|
|
@@ -83,14 +82,11 @@ class JsonSchemaFormUtils {
|
|
|
83
82
|
if (resolvedSchema.required && resolvedSchema.required.includes(key) && !property.nullable) {
|
|
84
83
|
validators.push(Validators.required);
|
|
85
84
|
}
|
|
86
|
-
// allOfを解決
|
|
87
85
|
const resolvedProperty = this.resolveAllOf(property);
|
|
88
86
|
group[key] = this.buildFormByJsonSchemaProperty(resolvedProperty, { fb, value: value?.[key], validators });
|
|
89
|
-
// MEMO(@NozomuMiyamoto): オブジェクト型Arrayなら追加用のダミーコントロールを追加する
|
|
90
87
|
if (resolvedProperty.type === 'array') {
|
|
91
88
|
const itemType = resolvedProperty.items?.type;
|
|
92
89
|
if (itemType !== 'string' && itemType !== 'number' && itemType !== 'boolean') {
|
|
93
|
-
// オブジェクト型配列の場合のみ __add_action を追加
|
|
94
90
|
group[`${key}__add_action`] = fb.control(resolvedProperty);
|
|
95
91
|
}
|
|
96
92
|
}
|
|
@@ -102,25 +98,20 @@ class JsonSchemaFormUtils {
|
|
|
102
98
|
return fb.array([]);
|
|
103
99
|
}
|
|
104
100
|
console.debug('[buildFormArrayByJsonSchema] schema:', schema);
|
|
105
|
-
// items.typeがプリミティブ型(string, number, boolean)の場合は空の配列
|
|
106
101
|
const itemType = schema.items.type;
|
|
107
102
|
if (itemType === 'string' || itemType === 'number' || itemType === 'boolean') {
|
|
108
|
-
// 既存値があればそれを使用、なければ空配列
|
|
109
103
|
const arrayValue = Array.isArray(value) ? value.map(v => fb.control(v)) : [];
|
|
110
104
|
return fb.array(arrayValue);
|
|
111
105
|
}
|
|
112
|
-
// オブジェクト型の場合は従来通り(ダミーフォームグループを1つ追加)
|
|
113
106
|
const formArray = fb.array([
|
|
114
107
|
this.buildFormGroupByJsonSchema(schema.items, { fb }),
|
|
115
108
|
]);
|
|
116
109
|
return formArray;
|
|
117
110
|
}
|
|
118
111
|
static resolveAllOf(property) {
|
|
119
|
-
// allOfがある場合、スキーマをマージ
|
|
120
112
|
if (property.allOf && Array.isArray(property.allOf)) {
|
|
121
113
|
const merged = { ...property };
|
|
122
114
|
delete merged.allOf;
|
|
123
|
-
// allOf内の各スキーマをマージ
|
|
124
115
|
for (const schema of property.allOf) {
|
|
125
116
|
if (schema.properties) {
|
|
126
117
|
merged.properties = { ...merged.properties, ...schema.properties };
|
|
@@ -128,7 +119,6 @@ class JsonSchemaFormUtils {
|
|
|
128
119
|
if (schema.required) {
|
|
129
120
|
merged.required = [...(merged.required || []), ...schema.required];
|
|
130
121
|
}
|
|
131
|
-
// typeが未設定の場合は設定
|
|
132
122
|
if (!merged.type && schema.type) {
|
|
133
123
|
merged.type = schema.type;
|
|
134
124
|
}
|
|
@@ -138,7 +128,6 @@ class JsonSchemaFormUtils {
|
|
|
138
128
|
return property;
|
|
139
129
|
}
|
|
140
130
|
static resolveOneOf(property) {
|
|
141
|
-
// oneOfがある場合、全スキーマのプロパティをマージ(discriminated union対応)
|
|
142
131
|
if (property.oneOf && Array.isArray(property.oneOf)) {
|
|
143
132
|
console.debug('[resolveOneOf] oneOf detected, merging schemas...');
|
|
144
133
|
const merged = { ...property };
|
|
@@ -146,21 +135,16 @@ class JsonSchemaFormUtils {
|
|
|
146
135
|
merged.type = 'object';
|
|
147
136
|
merged.properties = {};
|
|
148
137
|
merged.required = [];
|
|
149
|
-
// oneOf内の各スキーマからプロパティを収集
|
|
150
138
|
for (const schema of property.oneOf) {
|
|
151
139
|
if (schema.properties) {
|
|
152
|
-
// 全プロパティをマージ(discriminatorフィールドを含む)
|
|
153
140
|
for (const key in schema.properties) {
|
|
154
141
|
const sourceProp = schema.properties[key];
|
|
155
142
|
if (!merged.properties[key]) {
|
|
156
|
-
// 新しいプロパティはそのまま追加
|
|
157
143
|
merged.properties[key] = sourceProp;
|
|
158
144
|
}
|
|
159
145
|
else {
|
|
160
|
-
// 既存のプロパティがある場合、ネストされたオブジェクトならマージ
|
|
161
146
|
const existingProp = merged.properties[key];
|
|
162
147
|
if (sourceProp.type === 'object' && existingProp.type === 'object') {
|
|
163
|
-
// オブジェクト型の場合、propertiesをマージ
|
|
164
148
|
if (sourceProp.properties && existingProp.properties) {
|
|
165
149
|
merged.properties[key] = {
|
|
166
150
|
...existingProp,
|
|
@@ -171,12 +155,10 @@ class JsonSchemaFormUtils {
|
|
|
171
155
|
};
|
|
172
156
|
}
|
|
173
157
|
}
|
|
174
|
-
// enumフィールドの場合は最初のものを維持
|
|
175
158
|
}
|
|
176
159
|
}
|
|
177
160
|
}
|
|
178
161
|
if (schema.required) {
|
|
179
|
-
// 共通のrequiredフィールドのみマージ
|
|
180
162
|
for (const req of schema.required) {
|
|
181
163
|
if (!merged.required.includes(req)) {
|
|
182
164
|
merged.required.push(req);
|
|
@@ -214,16 +196,13 @@ class JsonSchemaFormUtils {
|
|
|
214
196
|
case 'object':
|
|
215
197
|
return this.buildFormGroupByJsonSchema(property, { fb, value: value });
|
|
216
198
|
case 'array': {
|
|
217
|
-
// プリミティブ型配列の場合は FormControl で配列値を保持
|
|
218
199
|
const itemType = property.items?.type;
|
|
219
200
|
if (itemType === 'string' || itemType === 'number' || itemType === 'boolean') {
|
|
220
201
|
return fb.control(value ?? property.default ?? [], { nonNullable: !property.nullable, validators });
|
|
221
202
|
}
|
|
222
|
-
// オブジェクト型配列の場合は FormArray
|
|
223
203
|
return this.buildFormArrayByJsonSchema(property, { fb, value: value });
|
|
224
204
|
}
|
|
225
205
|
default:
|
|
226
|
-
// allOfがある場合の処理
|
|
227
206
|
const resolved = this.resolveAllOf(property);
|
|
228
207
|
if (resolved !== property) {
|
|
229
208
|
return this.buildFormByJsonSchemaProperty(resolved, { fb, value, validators });
|
|
@@ -260,7 +239,6 @@ class JsonSchemaFormUtils {
|
|
|
260
239
|
}
|
|
261
240
|
}
|
|
262
241
|
static buildFormFieldMapByJsonSchema(schema, options = {}) {
|
|
263
|
-
// oneOf/discriminatedUnionを解決
|
|
264
242
|
const resolvedSchema = this.resolveOneOf(schema);
|
|
265
243
|
if (!resolvedSchema || !resolvedSchema.properties) {
|
|
266
244
|
return {
|
|
@@ -270,7 +248,6 @@ class JsonSchemaFormUtils {
|
|
|
270
248
|
const fieldMap = {};
|
|
271
249
|
for (const key in resolvedSchema.properties) {
|
|
272
250
|
const property = resolvedSchema.properties[key];
|
|
273
|
-
// allOfを解決
|
|
274
251
|
const resolvedProperty = this.resolveAllOf(property);
|
|
275
252
|
switch (resolvedProperty.type) {
|
|
276
253
|
case 'object': {
|
|
@@ -283,7 +260,6 @@ class JsonSchemaFormUtils {
|
|
|
283
260
|
case 'array': {
|
|
284
261
|
const childFieldMap = this.buildFormFieldMapByJsonSchema(resolvedProperty.items, options);
|
|
285
262
|
for (const childKey in childFieldMap) {
|
|
286
|
-
// TODO: 正規表現でパスマッチを判定できるようにする。
|
|
287
263
|
fieldMap[`${key}.\\d+.${childKey}`] = childFieldMap[childKey];
|
|
288
264
|
}
|
|
289
265
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-atomic-common-services-form-json-schema.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/form/json-schema/json-schema.ts","../../../../../packages/@ng-atomic/common/src/lib/services/form/json-schema/json-schema.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/form/json-schema/ng-atomic-common-services-form-json-schema.ts"],"sourcesContent":["import { ValidationTypes } from \"class-validator\"\nimport { targetConstructorToSchema as _targetConstructorToSchema } from \"class-validator-jsonschema\"\nimport { IOptions } from \"class-validator-jsonschema/build/options\";\nimport { JSONSchema7 } from 'json-schema';\n// TODO(@NozomuMiyamoto): fix\n// @ts-ignore\n// const { defaultMetadataStorage } = require('class-transformer/cjs/storage');\nimport { defaultMetadataStorage } from 'class-transformer/esm5/storage';\n\nfunction getPropType(target: object, property: string) {\n return Reflect.getMetadata('design:type', target, property)\n}\n\nfunction targetToSchema(\n type: any,\n options: any\n): any {\n if (typeof type === 'function') {\n if (\n type.prototype === String.prototype ||\n type.prototype === Symbol.prototype\n ) {\n return { type: 'string' }\n } else if (type.prototype === Number.prototype) {\n return { type: 'number' }\n } else if (type.prototype === Boolean.prototype) {\n return { type: 'boolean' }\n }\n\n return targetConstructorToSchema(type, options)\n }\n}\n\nconst additionalConverters= {\n [ValidationTypes.NESTED_VALIDATION]: (meta: any, options: any) => {\n if (typeof meta.target === 'function') {\n const typeMeta = options.classTransformerMetadataStorage\n ? options.classTransformerMetadataStorage.findTypeMetadata(\n meta.target,\n meta.propertyName\n )\n : null\n const childType = typeMeta\n ? typeMeta.typeFunction()\n : getPropType(meta.target.prototype, meta.propertyName)\n return targetToSchema(childType, options)\n }\n },\n isDayjs: (meta: any): JSONSchema7 => {\n return {\n type: 'string',\n format: 'date-time', // JSON Schemaで日付型を指定\n };\n },\n};\n\nexport function targetConstructorToSchema(target: Function, options: Partial<IOptions> = {}): JSONSchema7 {\n return _targetConstructorToSchema(target, {\n ...options,\n additionalConverters,\n classTransformerMetadataStorage: defaultMetadataStorage,\n }) as JSONSchema7;\n}\n","import { Injectable, inject } from \"@angular/core\";\nimport { FormBuilder, FormGroup, NonNullableFormBuilder, Validators } from \"@angular/forms\";\nimport { JsonSchema } from \"json-schema-library\";\nimport { targetConstructorToSchema } from './json-schema';\nimport { merge } from \"lodash-es\";\nimport { FormFieldMap } from \"@ng-atomic/common/pipes/smart-field\";\n\nexport class JsonSchemaFormUtils {\n static removeObjectPercent<T extends object>(value: T): any {\n return Object.entries(value).reduce<Record<string, unknown>>((acc, [key, value]) => {\n if (typeof value === 'string' && value.startsWith('%') && value.endsWith('%')) {\n acc[key] = value.slice(1, -1);\n } else if (typeof value === 'string' && value.startsWith('%')) {\n acc[key] = value.slice(1);\n } else if (typeof value === 'string' && value.endsWith('%')) {\n acc[key] = value.slice(0, -1);\n } else {\n acc[key] = value;\n }\n return acc;\n }, {});\n }\n\n static buildFormGroupByJsonSchema(schema: JsonSchema, {\n fb = inject(FormBuilder).nonNullable,\n value = {},\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n } = {}): FormGroup {\n console.debug('[buildFormGroupByJsonSchema] schema:', schema);\n\n // oneOf/discriminatedUnionを解決\n const resolvedSchema = this.resolveOneOf(schema);\n\n if (!resolvedSchema || !resolvedSchema?.properties) {\n return fb.group({});\n }\n const group: any = {};\n\n for (const key in resolvedSchema.properties) {\n const property = resolvedSchema.properties[key];\n const validators = [];\n\n if (resolvedSchema.required && resolvedSchema.required.includes(key) && !property.nullable) {\n validators.push(Validators.required);\n }\n\n // allOfを解決\n const resolvedProperty = this.resolveAllOf(property);\n\n group[key] = this.buildFormByJsonSchemaProperty(resolvedProperty, {fb, value: (value as Record<string, unknown>)?.[key] as object, validators});\n // MEMO(@NozomuMiyamoto): オブジェクト型Arrayなら追加用のダミーコントロールを追加する\n if (resolvedProperty.type === 'array') {\n const itemType = resolvedProperty.items?.type;\n if (itemType !== 'string' && itemType !== 'number' && itemType !== 'boolean') {\n // オブジェクト型配列の場合のみ __add_action を追加\n group[`${key}__add_action`] = fb.control(resolvedProperty);\n }\n }\n }\n return fb.group(group);\n }\n \n static buildFormArrayByJsonSchema(schema: JsonSchema, {\n fb = inject(FormBuilder).nonNullable,\n value = [],\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: any[],\n } = {}): any {\n if (!schema || !schema.items) {\n return fb.array([]);\n }\n console.debug('[buildFormArrayByJsonSchema] schema:', schema);\n\n // items.typeがプリミティブ型(string, number, boolean)の場合は空の配列\n const itemType = schema.items.type;\n if (itemType === 'string' || itemType === 'number' || itemType === 'boolean') {\n // 既存値があればそれを使用、なければ空配列\n const arrayValue = Array.isArray(value) ? value.map(v => fb.control(v)) : [];\n return fb.array(arrayValue);\n }\n\n // オブジェクト型の場合は従来通り(ダミーフォームグループを1つ追加)\n const formArray = fb.array([\n this.buildFormGroupByJsonSchema(schema.items, {fb}),\n ]);\n return formArray;\n }\n \n static resolveAllOf(property: JsonSchema): JsonSchema {\n // allOfがある場合、スキーマをマージ\n if (property.allOf && Array.isArray(property.allOf)) {\n const merged: any = { ...property };\n delete merged.allOf;\n\n // allOf内の各スキーマをマージ\n for (const schema of property.allOf) {\n if (schema.properties) {\n merged.properties = { ...merged.properties, ...schema.properties };\n }\n if (schema.required) {\n merged.required = [...(merged.required || []), ...schema.required];\n }\n // typeが未設定の場合は設定\n if (!merged.type && schema.type) {\n merged.type = schema.type;\n }\n }\n\n return merged;\n }\n return property;\n }\n\n static resolveOneOf(property: JsonSchema): JsonSchema {\n // oneOfがある場合、全スキーマのプロパティをマージ(discriminated union対応)\n if (property.oneOf && Array.isArray(property.oneOf)) {\n console.debug('[resolveOneOf] oneOf detected, merging schemas...');\n const merged: any = { ...property };\n delete merged.oneOf;\n merged.type = 'object';\n merged.properties = {};\n merged.required = [];\n\n // oneOf内の各スキーマからプロパティを収集\n for (const schema of property.oneOf) {\n if (schema.properties) {\n // 全プロパティをマージ(discriminatorフィールドを含む)\n for (const key in schema.properties) {\n const sourceProp = schema.properties[key];\n\n if (!merged.properties[key]) {\n // 新しいプロパティはそのまま追加\n merged.properties[key] = sourceProp;\n } else {\n // 既存のプロパティがある場合、ネストされたオブジェクトならマージ\n const existingProp = merged.properties[key];\n\n if (sourceProp.type === 'object' && existingProp.type === 'object') {\n // オブジェクト型の場合、propertiesをマージ\n if (sourceProp.properties && existingProp.properties) {\n merged.properties[key] = {\n ...existingProp,\n properties: {\n ...existingProp.properties,\n ...sourceProp.properties\n }\n };\n }\n }\n // enumフィールドの場合は最初のものを維持\n }\n }\n }\n if (schema.required) {\n // 共通のrequiredフィールドのみマージ\n for (const req of schema.required) {\n if (!merged.required.includes(req)) {\n merged.required.push(req);\n }\n }\n }\n }\n\n console.debug('[resolveOneOf] Merged properties:', Object.keys(merged.properties));\n return merged;\n }\n return property;\n }\n \n static buildFormByJsonSchemaProperty(property: JsonSchema, {\n fb = inject(FormBuilder).nonNullable,\n value = null as object | object[] | null,\n validators = [],\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object | object[] | null,\n validators?: any[],\n } = {}): any {\n switch (property.type) {\n case 'string': switch (property.format) {\n case 'date':\n case 'date-time':\n return fb.control(value ?? property.default ?? null, { nonNullable: !property.nullable, validators });\n case 'binary':\n return fb.control(value ?? property.default ?? null, { nonNullable: !property.nullable, validators });\n case 'email':\n return fb.control(value ?? property.default ?? '', {\n nonNullable: !property.nullable,\n validators: [...validators, Validators.email],\n });\n default:\n return fb.control(value ?? property.default ?? '', { nonNullable: !property.nullable, validators });\n }\n case 'boolean':\n return fb.control(value ?? property.default ?? false, {nonNullable: !property.nullable, validators});\n case 'integer':\n return fb.control(value ?? property.default ?? 0, {nonNullable: !property.nullable, validators});\n case 'number':\n return fb.control(value ?? property.default ?? 0, {nonNullable: !property.nullable, validators});\n case 'object':\n return this.buildFormGroupByJsonSchema(property, {fb, value: value as object});\n case 'array': {\n // プリミティブ型配列の場合は FormControl で配列値を保持\n const itemType = property.items?.type;\n if (itemType === 'string' || itemType === 'number' || itemType === 'boolean') {\n return fb.control(value ?? property.default ?? [], { nonNullable: !property.nullable, validators });\n }\n // オブジェクト型配列の場合は FormArray\n return this.buildFormArrayByJsonSchema(property, {fb, value: value as any[]});\n }\n default:\n // allOfがある場合の処理\n const resolved = this.resolveAllOf(property);\n if (resolved !== property) {\n return this.buildFormByJsonSchemaProperty(resolved, {fb, value, validators});\n }\n return null;\n }\n }\n \n\n static buildFormByJsonSchema(schema: JsonSchema, {\n fb = inject(FormBuilder).nonNullable,\n value = {},\n fieldMap = {},\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n fieldMap?: object,\n } = {}): any {\n return {\n form: this.buildFormGroupByJsonSchema(schema, {fb, value}),\n fieldMap: this.buildFormFieldMapByJsonSchema(schema, {merge: fieldMap}),\n };\n }\n\n static buildFormFieldByProperty(property: JsonSchema['properties']) {\n switch (property.type) {\n case 'string': {\n if (property.enum) {\n return { type: 'select', options: property.enum.map((v: string) => ({ value: v, name: v })) };\n } else if (['date-time', 'date'].includes(property.format)) {\n return { type: 'date' };\n } else if (property.format === 'binary') {\n return { type: 'file' };\n } else {\n return { type: 'text' };\n }\n }\n case 'boolean': return { type: 'select', options: [{ value: true, name: 'はい' }, { value: false, name: 'いいえ' }] };\n case 'integer': return { type: 'number' };\n case 'number': return { type: 'number' };\n default: return { type: property.type };\n }\n }\n\n static buildFormFieldMapByJsonSchema(\n schema: JsonSchema,\n options: {\n merge?: { [key: string]: any },\n } = {},\n ): any {\n // oneOf/discriminatedUnionを解決\n const resolvedSchema = this.resolveOneOf(schema);\n\n if (!resolvedSchema || !resolvedSchema.properties) {\n return {\n id: { type: 'hidden' },\n };\n }\n const fieldMap: any = {};\n\n for (const key in resolvedSchema.properties) {\n const property = resolvedSchema.properties[key];\n // allOfを解決\n const resolvedProperty = this.resolveAllOf(property);\n switch (resolvedProperty.type) {\n case 'object': {\n const childFieldMap = this.buildFormFieldMapByJsonSchema(resolvedProperty, options);\n for (const childKey in childFieldMap) {\n fieldMap[`${key}.${childKey}`] = childFieldMap[childKey];\n }\n break;\n }\n case 'array': {\n const childFieldMap = this.buildFormFieldMapByJsonSchema(resolvedProperty.items, options);\n for (const childKey in childFieldMap) {\n // TODO: 正規表現でパスマッチを判定できるようにする。\n fieldMap[`${key}.\\\\d+.${childKey}`] = childFieldMap[childKey];\n }\n break;\n }\n default: {\n fieldMap[key] = this.buildFormFieldByProperty(resolvedProperty);\n }\n }\n }\n \n console.debug('[buildFormFieldMapByJsonSchema] fieldMap:', fieldMap);\n console.debug('[buildFormFieldMapByJsonSchema] options.merge:', options.merge);\n \n return {...fieldMap, ...options.merge};\n }\n}\n\nexport function buildFormGroup(klass: new() => any, {\n fb = inject(FormBuilder).nonNullable,\n value,\n}: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n}): FormGroup {\n const schema = targetConstructorToSchema(klass);\n return JsonSchemaFormUtils.buildFormGroupByJsonSchema(schema, {fb, value});\n}\n\n\nexport function buildFormFieldMap(klass: new() => any, options: {\n merge?: { [key: string]: any },\n}): any {\n const schema = targetConstructorToSchema(klass);\n const map = JsonSchemaFormUtils.buildFormFieldMapByJsonSchema(schema, options);\n return merge(map, options.merge);\n}\n\nexport function buildForm(klass: new() => any, {\n fb = inject(FormBuilder).nonNullable,\n value = {},\n fieldMap = {},\n}: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n fieldMap?: FormFieldMap,\n} = {}): { form: FormGroup, fieldMap: FormFieldMap } {\n const schema = targetConstructorToSchema(klass);\n return {\n form: JsonSchemaFormUtils.buildFormGroupByJsonSchema(schema, {fb, value}),\n fieldMap: JsonSchemaFormUtils.buildFormFieldMapByJsonSchema(schema, {merge: fieldMap}),\n };\n}\n\n\n@Injectable({ providedIn: 'root' })\nexport class JsonSchemaFormService {\n private fb = inject(FormBuilder);\n\n build(schema: JsonSchema, {\n fb = this.fb,\n value = {},\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n } = {}): FormGroup {\n return JsonSchemaFormUtils.buildFormGroupByJsonSchema(schema, {fb, value});\n }\n\n buildFieldMap(\n schema: JsonSchema,\n options: {\n merge?: { [key: string]: any },\n } = {},\n ): any {\n return JsonSchemaFormUtils.buildFormFieldMapByJsonSchema(schema, options);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["_targetConstructorToSchema"],"mappings":";;;;;;;;AASA,SAAS,WAAW,CAAC,MAAc,EAAE,QAAgB,EAAA;IACnD,OAAO,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,CAAC;AAC7D;AAEA,SAAS,cAAc,CACrB,IAAS,EACT,OAAY,EAAA;AAEZ,IAAA,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;AAC9B,QAAA,IACE,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS;AACnC,YAAA,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS,EACnC;AACA,YAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B;aAAO,IAAI,IAAI,CAAC,SAAS,KAAK,MAAM,C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QAEN,OAAO,mBAAmB,CAAC,6BAA6B,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3E;8GApBW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cADR,MAAM,EAAA,CAAA,CAAA;;2FACnB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACzVlC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-atomic-common-services-form-json-schema.mjs","sources":["../../../../../packages/@ng-atomic/common/src/lib/services/form/json-schema/json-schema.ts","../../../../../packages/@ng-atomic/common/src/lib/services/form/json-schema/json-schema.service.ts","../../../../../packages/@ng-atomic/common/src/lib/services/form/json-schema/ng-atomic-common-services-form-json-schema.ts"],"sourcesContent":["import { ValidationTypes } from \"class-validator\"\nimport { targetConstructorToSchema as _targetConstructorToSchema } from \"class-validator-jsonschema\"\nimport { IOptions } from \"class-validator-jsonschema/build/options\";\nimport { JSONSchema7 } from 'json-schema';\n\n// @ts-ignore\n\nimport { defaultMetadataStorage } from 'class-transformer/esm5/storage';\n\nfunction getPropType(target: object, property: string) {\n return Reflect.getMetadata('design:type', target, property)\n}\n\nfunction targetToSchema(\n type: any,\n options: any\n): any {\n if (typeof type === 'function') {\n if (\n type.prototype === String.prototype ||\n type.prototype === Symbol.prototype\n ) {\n return { type: 'string' }\n } else if (type.prototype === Number.prototype) {\n return { type: 'number' }\n } else if (type.prototype === Boolean.prototype) {\n return { type: 'boolean' }\n }\n\n return targetConstructorToSchema(type, options)\n }\n}\n\nconst additionalConverters= {\n [ValidationTypes.NESTED_VALIDATION]: (meta: any, options: any) => {\n if (typeof meta.target === 'function') {\n const typeMeta = options.classTransformerMetadataStorage\n ? options.classTransformerMetadataStorage.findTypeMetadata(\n meta.target,\n meta.propertyName\n )\n : null\n const childType = typeMeta\n ? typeMeta.typeFunction()\n : getPropType(meta.target.prototype, meta.propertyName)\n return targetToSchema(childType, options)\n }\n },\n isDayjs: (meta: any): JSONSchema7 => {\n return {\n type: 'string',\n format: 'date-time', \n };\n },\n};\n\nexport function targetConstructorToSchema(target: Function, options: Partial<IOptions> = {}): JSONSchema7 {\n return _targetConstructorToSchema(target, {\n ...options,\n additionalConverters,\n classTransformerMetadataStorage: defaultMetadataStorage,\n }) as JSONSchema7;\n}\n","import { Injectable, inject } from \"@angular/core\";\nimport { FormBuilder, FormGroup, NonNullableFormBuilder, Validators } from \"@angular/forms\";\nimport { JsonSchema } from \"json-schema-library\";\nimport { targetConstructorToSchema } from './json-schema';\nimport { merge } from \"lodash-es\";\nimport { FormFieldMap } from \"@ng-atomic/common/pipes/smart-field\";\n\nexport class JsonSchemaFormUtils {\n static removeObjectPercent<T extends object>(value: T): any {\n return Object.entries(value).reduce<Record<string, unknown>>((acc, [key, value]) => {\n if (typeof value === 'string' && value.startsWith('%') && value.endsWith('%')) {\n acc[key] = value.slice(1, -1);\n } else if (typeof value === 'string' && value.startsWith('%')) {\n acc[key] = value.slice(1);\n } else if (typeof value === 'string' && value.endsWith('%')) {\n acc[key] = value.slice(0, -1);\n } else {\n acc[key] = value;\n }\n return acc;\n }, {});\n }\n\n static buildFormGroupByJsonSchema(schema: JsonSchema, {\n fb = inject(FormBuilder).nonNullable,\n value = {},\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n } = {}): FormGroup {\n console.debug('[buildFormGroupByJsonSchema] schema:', schema);\n\n \n const resolvedSchema = this.resolveOneOf(schema);\n\n if (!resolvedSchema || !resolvedSchema?.properties) {\n return fb.group({});\n }\n const group: any = {};\n\n for (const key in resolvedSchema.properties) {\n const property = resolvedSchema.properties[key];\n const validators = [];\n\n if (resolvedSchema.required && resolvedSchema.required.includes(key) && !property.nullable) {\n validators.push(Validators.required);\n }\n\n \n const resolvedProperty = this.resolveAllOf(property);\n\n group[key] = this.buildFormByJsonSchemaProperty(resolvedProperty, {fb, value: (value as Record<string, unknown>)?.[key] as object, validators});\n \n if (resolvedProperty.type === 'array') {\n const itemType = resolvedProperty.items?.type;\n if (itemType !== 'string' && itemType !== 'number' && itemType !== 'boolean') {\n \n group[`${key}__add_action`] = fb.control(resolvedProperty);\n }\n }\n }\n return fb.group(group);\n }\n \n static buildFormArrayByJsonSchema(schema: JsonSchema, {\n fb = inject(FormBuilder).nonNullable,\n value = [],\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: any[],\n } = {}): any {\n if (!schema || !schema.items) {\n return fb.array([]);\n }\n console.debug('[buildFormArrayByJsonSchema] schema:', schema);\n\n \n const itemType = schema.items.type;\n if (itemType === 'string' || itemType === 'number' || itemType === 'boolean') {\n \n const arrayValue = Array.isArray(value) ? value.map(v => fb.control(v)) : [];\n return fb.array(arrayValue);\n }\n\n \n const formArray = fb.array([\n this.buildFormGroupByJsonSchema(schema.items, {fb}),\n ]);\n return formArray;\n }\n \n static resolveAllOf(property: JsonSchema): JsonSchema {\n \n if (property.allOf && Array.isArray(property.allOf)) {\n const merged: any = { ...property };\n delete merged.allOf;\n\n \n for (const schema of property.allOf) {\n if (schema.properties) {\n merged.properties = { ...merged.properties, ...schema.properties };\n }\n if (schema.required) {\n merged.required = [...(merged.required || []), ...schema.required];\n }\n \n if (!merged.type && schema.type) {\n merged.type = schema.type;\n }\n }\n\n return merged;\n }\n return property;\n }\n\n static resolveOneOf(property: JsonSchema): JsonSchema {\n \n if (property.oneOf && Array.isArray(property.oneOf)) {\n console.debug('[resolveOneOf] oneOf detected, merging schemas...');\n const merged: any = { ...property };\n delete merged.oneOf;\n merged.type = 'object';\n merged.properties = {};\n merged.required = [];\n\n \n for (const schema of property.oneOf) {\n if (schema.properties) {\n \n for (const key in schema.properties) {\n const sourceProp = schema.properties[key];\n\n if (!merged.properties[key]) {\n \n merged.properties[key] = sourceProp;\n } else {\n \n const existingProp = merged.properties[key];\n\n if (sourceProp.type === 'object' && existingProp.type === 'object') {\n \n if (sourceProp.properties && existingProp.properties) {\n merged.properties[key] = {\n ...existingProp,\n properties: {\n ...existingProp.properties,\n ...sourceProp.properties\n }\n };\n }\n }\n \n }\n }\n }\n if (schema.required) {\n \n for (const req of schema.required) {\n if (!merged.required.includes(req)) {\n merged.required.push(req);\n }\n }\n }\n }\n\n console.debug('[resolveOneOf] Merged properties:', Object.keys(merged.properties));\n return merged;\n }\n return property;\n }\n \n static buildFormByJsonSchemaProperty(property: JsonSchema, {\n fb = inject(FormBuilder).nonNullable,\n value = null as object | object[] | null,\n validators = [],\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object | object[] | null,\n validators?: any[],\n } = {}): any {\n switch (property.type) {\n case 'string': switch (property.format) {\n case 'date':\n case 'date-time':\n return fb.control(value ?? property.default ?? null, { nonNullable: !property.nullable, validators });\n case 'binary':\n return fb.control(value ?? property.default ?? null, { nonNullable: !property.nullable, validators });\n case 'email':\n return fb.control(value ?? property.default ?? '', {\n nonNullable: !property.nullable,\n validators: [...validators, Validators.email],\n });\n default:\n return fb.control(value ?? property.default ?? '', { nonNullable: !property.nullable, validators });\n }\n case 'boolean':\n return fb.control(value ?? property.default ?? false, {nonNullable: !property.nullable, validators});\n case 'integer':\n return fb.control(value ?? property.default ?? 0, {nonNullable: !property.nullable, validators});\n case 'number':\n return fb.control(value ?? property.default ?? 0, {nonNullable: !property.nullable, validators});\n case 'object':\n return this.buildFormGroupByJsonSchema(property, {fb, value: value as object});\n case 'array': {\n \n const itemType = property.items?.type;\n if (itemType === 'string' || itemType === 'number' || itemType === 'boolean') {\n return fb.control(value ?? property.default ?? [], { nonNullable: !property.nullable, validators });\n }\n \n return this.buildFormArrayByJsonSchema(property, {fb, value: value as any[]});\n }\n default:\n \n const resolved = this.resolveAllOf(property);\n if (resolved !== property) {\n return this.buildFormByJsonSchemaProperty(resolved, {fb, value, validators});\n }\n return null;\n }\n }\n \n\n static buildFormByJsonSchema(schema: JsonSchema, {\n fb = inject(FormBuilder).nonNullable,\n value = {},\n fieldMap = {},\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n fieldMap?: object,\n } = {}): any {\n return {\n form: this.buildFormGroupByJsonSchema(schema, {fb, value}),\n fieldMap: this.buildFormFieldMapByJsonSchema(schema, {merge: fieldMap}),\n };\n }\n\n static buildFormFieldByProperty(property: JsonSchema['properties']) {\n switch (property.type) {\n case 'string': {\n if (property.enum) {\n return { type: 'select', options: property.enum.map((v: string) => ({ value: v, name: v })) };\n } else if (['date-time', 'date'].includes(property.format)) {\n return { type: 'date' };\n } else if (property.format === 'binary') {\n return { type: 'file' };\n } else {\n return { type: 'text' };\n }\n }\n case 'boolean': return { type: 'select', options: [{ value: true, name: 'はい' }, { value: false, name: 'いいえ' }] };\n case 'integer': return { type: 'number' };\n case 'number': return { type: 'number' };\n default: return { type: property.type };\n }\n }\n\n static buildFormFieldMapByJsonSchema(\n schema: JsonSchema,\n options: {\n merge?: { [key: string]: any },\n } = {},\n ): any {\n \n const resolvedSchema = this.resolveOneOf(schema);\n\n if (!resolvedSchema || !resolvedSchema.properties) {\n return {\n id: { type: 'hidden' },\n };\n }\n const fieldMap: any = {};\n\n for (const key in resolvedSchema.properties) {\n const property = resolvedSchema.properties[key];\n \n const resolvedProperty = this.resolveAllOf(property);\n switch (resolvedProperty.type) {\n case 'object': {\n const childFieldMap = this.buildFormFieldMapByJsonSchema(resolvedProperty, options);\n for (const childKey in childFieldMap) {\n fieldMap[`${key}.${childKey}`] = childFieldMap[childKey];\n }\n break;\n }\n case 'array': {\n const childFieldMap = this.buildFormFieldMapByJsonSchema(resolvedProperty.items, options);\n for (const childKey in childFieldMap) {\n \n fieldMap[`${key}.\\\\d+.${childKey}`] = childFieldMap[childKey];\n }\n break;\n }\n default: {\n fieldMap[key] = this.buildFormFieldByProperty(resolvedProperty);\n }\n }\n }\n \n console.debug('[buildFormFieldMapByJsonSchema] fieldMap:', fieldMap);\n console.debug('[buildFormFieldMapByJsonSchema] options.merge:', options.merge);\n \n return {...fieldMap, ...options.merge};\n }\n}\n\nexport function buildFormGroup(klass: new() => any, {\n fb = inject(FormBuilder).nonNullable,\n value,\n}: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n}): FormGroup {\n const schema = targetConstructorToSchema(klass);\n return JsonSchemaFormUtils.buildFormGroupByJsonSchema(schema, {fb, value});\n}\n\n\nexport function buildFormFieldMap(klass: new() => any, options: {\n merge?: { [key: string]: any },\n}): any {\n const schema = targetConstructorToSchema(klass);\n const map = JsonSchemaFormUtils.buildFormFieldMapByJsonSchema(schema, options);\n return merge(map, options.merge);\n}\n\nexport function buildForm(klass: new() => any, {\n fb = inject(FormBuilder).nonNullable,\n value = {},\n fieldMap = {},\n}: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n fieldMap?: FormFieldMap,\n} = {}): { form: FormGroup, fieldMap: FormFieldMap } {\n const schema = targetConstructorToSchema(klass);\n return {\n form: JsonSchemaFormUtils.buildFormGroupByJsonSchema(schema, {fb, value}),\n fieldMap: JsonSchemaFormUtils.buildFormFieldMapByJsonSchema(schema, {merge: fieldMap}),\n };\n}\n\n\n@Injectable({ providedIn: 'root' })\nexport class JsonSchemaFormService {\n private fb = inject(FormBuilder);\n\n build(schema: JsonSchema, {\n fb = this.fb,\n value = {},\n }: {\n fb?: FormBuilder | NonNullableFormBuilder,\n value?: object,\n } = {}): FormGroup {\n return JsonSchemaFormUtils.buildFormGroupByJsonSchema(schema, {fb, value});\n }\n\n buildFieldMap(\n schema: JsonSchema,\n options: {\n merge?: { [key: string]: any },\n } = {},\n ): any {\n return JsonSchemaFormUtils.buildFormFieldMapByJsonSchema(schema, options);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport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6B,CAAC,MAAM,EAAE,EAAC,KAAK,EAAE,QAAQ,EAAC,CAAC;KACvF;AACH;MAIa,qBAAqB,CAAA;AADlC,IAAA,WAAA,GAAA;AAEU,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC;AAoBjC,IAAA;AAlBC,IAAA,KAAK,CAAC,MAAkB,EAAE,EACxB,EAAE,GAAG,IAAI,CAAC,EAAE,EACZ,KAAK,GAAG,EAAE,MAIR,EAAE,EAAA;AACJ,QAAA,OAAO,mBAAmB,CAAC,0BAA0B,CAAC,MAAM,EAAE,EAAC,EAAE,EAAE,KAAK,EAAC,CAAC;IAC5E;AAEA,IAAA,aAAa,CACX,MAAkB,EAClB,OAAA,GAEI,EAAE,EAAA;QAEN,OAAO,mBAAmB,CAAC,6BAA6B,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3E;8GApBW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cADR,MAAM,EAAA,CAAA,CAAA;;2FACnB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACzVlC;;AAEG;;;;"}
|
|
@@ -61,11 +61,6 @@ function createSetupFormControl(setupFn) {
|
|
|
61
61
|
return { control, value, field: setupFn({ control, value }) };
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* 指定されたフィールドをdisableにする
|
|
66
|
-
* @param control フォームコントロールのSignal
|
|
67
|
-
* @param fields disableにするフィールドのパス配列
|
|
68
|
-
*/
|
|
69
64
|
function disableControls(control, fields) {
|
|
70
65
|
fields.forEach(field => {
|
|
71
66
|
control.get([field])?.disable();
|