@suntelecoms/ngx-dynamic-form 1.6.6 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -1
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs +73 -17
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs.map +1 -1
- package/lib/components/form-builder/form-builder.component.d.ts +5 -1
- package/lib/components/form-loader/form-loader.component.d.ts +1 -0
- package/lib/providers.d.ts +7 -0
- package/lib/services/form-config.service.d.ts +13 -0
- package/lib/storage/http-storage.adapter.d.ts +6 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DynamicFormConfig, DynamicFormField, FieldCondition, FieldType, FieldValidation, SelectOption, StepGuard, StepperFormConfig } from '../../models/form-field.model';
|
|
2
|
+
import type { SavedFormSchema } from '../../models/saved-form.model';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
4
|
interface FieldTypeDef {
|
|
4
5
|
type: FieldType;
|
|
@@ -22,6 +23,8 @@ export declare class FormBuilderComponent {
|
|
|
22
23
|
backRoute: string;
|
|
23
24
|
private formService;
|
|
24
25
|
private snack;
|
|
26
|
+
private route;
|
|
27
|
+
constructor();
|
|
25
28
|
isStepperMode: import("@angular/core").WritableSignal<boolean>;
|
|
26
29
|
private flatFields;
|
|
27
30
|
steps: import("@angular/core").WritableSignal<BuilderStep[]>;
|
|
@@ -43,7 +46,7 @@ export declare class FormBuilderComponent {
|
|
|
43
46
|
currentId: import("@angular/core").WritableSignal<string | null>;
|
|
44
47
|
showExport: import("@angular/core").WritableSignal<boolean>;
|
|
45
48
|
exportContent: import("@angular/core").WritableSignal<string>;
|
|
46
|
-
savedSchemas: import("@angular/core").Signal<
|
|
49
|
+
savedSchemas: import("@angular/core").Signal<SavedFormSchema[]>;
|
|
47
50
|
readonly groups: readonly ["Saisie", "Choix", "Mise en page"];
|
|
48
51
|
readonly fieldTypes: FieldTypeDef[];
|
|
49
52
|
readonly colOptions: readonly [1, 2, 3, 4, 6, 8, 9, 12];
|
|
@@ -129,6 +132,7 @@ export declare class FormBuilderComponent {
|
|
|
129
132
|
cancelRename(): void;
|
|
130
133
|
save(): void;
|
|
131
134
|
loadSchema(id: string): void;
|
|
135
|
+
private applySchema;
|
|
132
136
|
deleteSchema(id: string, e: Event): void;
|
|
133
137
|
newForm(): void;
|
|
134
138
|
exportJSON(): void;
|
|
@@ -19,6 +19,7 @@ export declare class FormLoaderComponent implements OnInit {
|
|
|
19
19
|
submitted: import("@angular/core").WritableSignal<boolean>;
|
|
20
20
|
submitData: import("@angular/core").WritableSignal<Record<string, unknown>>;
|
|
21
21
|
notFound: import("@angular/core").WritableSignal<boolean>;
|
|
22
|
+
loading: import("@angular/core").WritableSignal<boolean>;
|
|
22
23
|
ngOnInit(): void;
|
|
23
24
|
onSubmit(event: DynamicFormSubmitEvent): void;
|
|
24
25
|
reset(): void;
|
package/lib/providers.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EnvironmentProviders, InjectionToken } from '@angular/core';
|
|
2
2
|
import { HttpInterceptorFn } from '@angular/common/http';
|
|
3
|
+
import { NGX_FORMS_LIST_PAGE_SIZE } from './storage/http-storage.adapter';
|
|
3
4
|
import { NgxFormsAuthService, NgxFormsAuthOptions, NGX_FORMS_AUTH } from './auth/ngx-forms-auth.service';
|
|
4
5
|
export { NgxFormsAuthService, NgxFormsAuthOptions, NGX_FORMS_AUTH };
|
|
5
6
|
/**
|
|
@@ -7,6 +8,7 @@ export { NgxFormsAuthService, NgxFormsAuthOptions, NGX_FORMS_AUTH };
|
|
|
7
8
|
* via la propriété `url` d'un DynamicFormField.
|
|
8
9
|
*/
|
|
9
10
|
export declare const NGX_DATA_API_URL: InjectionToken<string>;
|
|
11
|
+
export { NGX_FORMS_LIST_PAGE_SIZE };
|
|
10
12
|
/**
|
|
11
13
|
* Intercepteur HTTP fonctionnel — ajoute `Authorization: Bearer <token>` si
|
|
12
14
|
* NgxFormsAuthService est fourni (via `auth` dans provideNgxForms).
|
|
@@ -30,6 +32,11 @@ export interface NgxFormsHttpOptions {
|
|
|
30
32
|
dataUrl?: string;
|
|
31
33
|
/** Configuration d'authentification par token (optionnel) */
|
|
32
34
|
auth?: NgxFormsAuthOptions;
|
|
35
|
+
/**
|
|
36
|
+
* Taille de page pour charger le catalogue de formulaires sauvegardés
|
|
37
|
+
* (`GET {apiUrl}?page=0&size=...`). @default 1000
|
|
38
|
+
*/
|
|
39
|
+
listPageSize?: number;
|
|
33
40
|
}
|
|
34
41
|
export type NgxFormsOptions = NgxFormsLocalOptions | NgxFormsHttpOptions;
|
|
35
42
|
export declare function provideNgxForms(options: NgxFormsOptions): EnvironmentProviders;
|
|
@@ -11,6 +11,19 @@ export declare class FormConfigService {
|
|
|
11
11
|
private _load;
|
|
12
12
|
get(id: string): SavedFormSchema | null;
|
|
13
13
|
getByCode(code: string): SavedFormSchema | null;
|
|
14
|
+
/**
|
|
15
|
+
* Charge un seul formulaire directement depuis l'API (GET {apiUrl}/{id}),
|
|
16
|
+
* sans dépendre de la liste complète chargée en mémoire — à utiliser à la
|
|
17
|
+
* place de `get()` dès qu'on n'a besoin que d'un seul formulaire (au-delà
|
|
18
|
+
* d'une poignée de dizaines de formulaires, tout charger pour n'en lire
|
|
19
|
+
* qu'un devient inutilement coûteux). Met aussi à jour le cache local
|
|
20
|
+
* (`schemas()`) au passage, pour que les lectures synchrones ultérieures
|
|
21
|
+
* en bénéficient également.
|
|
22
|
+
*/
|
|
23
|
+
fetchById(id: string): Observable<SavedFormSchema | null>;
|
|
24
|
+
/** Équivalent de `fetchById`, mais par `code` (GET {apiUrl}/code/{code}). */
|
|
25
|
+
fetchByCode(code: string): Observable<SavedFormSchema | null>;
|
|
26
|
+
private cacheOne;
|
|
14
27
|
create(code: string, title: string, config: AnyFormConfig): Observable<SavedFormSchema>;
|
|
15
28
|
update(schema: SavedFormSchema, title: string, config: AnyFormConfig): Observable<SavedFormSchema>;
|
|
16
29
|
delete(id: string): Observable<void>;
|
|
@@ -4,9 +4,15 @@ import { FormStorageAdapter } from './form-storage.adapter';
|
|
|
4
4
|
import type { SavedFormSchema } from '../models/saved-form.model';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare const FORM_API_URL: InjectionToken<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Taille de page pour `list()` (`GET {apiUrl}?page=0&size=...`).
|
|
9
|
+
* Configurable via `listPageSize` dans `provideNgxForms()` — @default 1000.
|
|
10
|
+
*/
|
|
11
|
+
export declare const NGX_FORMS_LIST_PAGE_SIZE: InjectionToken<number>;
|
|
7
12
|
export declare class HttpStorageAdapter extends FormStorageAdapter {
|
|
8
13
|
private http;
|
|
9
14
|
private apiUrl;
|
|
15
|
+
private pageSize;
|
|
10
16
|
/** Mappe le format API vers SavedFormSchema */
|
|
11
17
|
private toSchema;
|
|
12
18
|
list(): Observable<SavedFormSchema[]>;
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { FormConfigService } from './lib/services/form-config.service';
|
|
|
10
10
|
export { UniquenessValidatorService } from './lib/services/uniqueness-validator.service';
|
|
11
11
|
export { FormStorageAdapter } from './lib/storage/form-storage.adapter';
|
|
12
12
|
export { LocalStorageAdapter } from './lib/storage/local-storage.adapter';
|
|
13
|
-
export { HttpStorageAdapter, FORM_API_URL } from './lib/storage/http-storage.adapter';
|
|
13
|
+
export { HttpStorageAdapter, FORM_API_URL, NGX_FORMS_LIST_PAGE_SIZE } from './lib/storage/http-storage.adapter';
|
|
14
14
|
export { provideNgxForms, NGX_DATA_API_URL, ngxFormsAuthInterceptor } from './lib/providers';
|
|
15
15
|
export type { NgxFormsOptions, NgxFormsLocalOptions, NgxFormsHttpOptions } from './lib/providers';
|
|
16
16
|
export { NgxFormsAuthService, NGX_FORMS_AUTH } from './lib/auth/ngx-forms-auth.service';
|