@suntelecoms/ngx-dynamic-form 1.7.7 → 1.7.10
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 +64 -1
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs +82 -17
- package/fesm2022/suntelecoms-ngx-dynamic-form.mjs.map +1 -1
- package/lib/components/dynamic-field/dynamic-field.component.d.ts +4 -0
- package/lib/components/form-builder/form-builder.component.d.ts +5 -0
- package/lib/components/mes-formulaires/mes-formulaires.component.d.ts +2 -0
- package/lib/models/form-field.model.d.ts +6 -0
- package/lib/services/condition-evaluator.service.d.ts +6 -0
- package/package.json +1 -1
|
@@ -22,6 +22,7 @@ export declare class DynamicFieldComponent implements OnInit {
|
|
|
22
22
|
private dataApiUrl;
|
|
23
23
|
private globalDateLocale;
|
|
24
24
|
private dateAdapter;
|
|
25
|
+
private cdr;
|
|
25
26
|
resolvedOptions: SelectOption[];
|
|
26
27
|
loadingOptions: boolean;
|
|
27
28
|
lookupLoading: boolean;
|
|
@@ -65,6 +66,9 @@ export declare class DynamicFieldComponent implements OnInit {
|
|
|
65
66
|
* tant que l'utilisateur ne tape pas, contrairement à `resolveOptions()`. */
|
|
66
67
|
private setupRemoteSearch;
|
|
67
68
|
private fetchRemoteSearch;
|
|
69
|
+
/** Applique field.optionsFilter (ex: ne garder que status === 'ACTIF') aux items bruts
|
|
70
|
+
* reçus de l'API, avant leur mapping en {label, value}. No-op si non configuré. */
|
|
71
|
+
private filterItems;
|
|
68
72
|
/** @param cacheRaw Conserve la réponse brute dans `rawRemoteItems` pour un filtrage local ultérieur, au lieu de la mapper directement dans `resolvedOptions`. */
|
|
69
73
|
private loadRemoteOptions;
|
|
70
74
|
/**
|
|
@@ -95,6 +95,11 @@ export declare class FormBuilderComponent {
|
|
|
95
95
|
addCondition(): void;
|
|
96
96
|
removeCondition(index: number): void;
|
|
97
97
|
updateCondition(index: number, key: keyof FieldCondition, value: any): void;
|
|
98
|
+
getOptionsFilterConditions(): FieldCondition[];
|
|
99
|
+
setOptionsFilterLogic(logic: 'AND' | 'OR'): void;
|
|
100
|
+
addOptionsFilterCondition(): void;
|
|
101
|
+
removeOptionsFilterCondition(index: number): void;
|
|
102
|
+
updateOptionsFilterCondition(index: number, key: keyof FieldCondition, value: any): void;
|
|
98
103
|
toggleUniqueCheck(enabled: boolean): void;
|
|
99
104
|
setUniqueCheckProp(key: 'url' | 'message', value: string): void;
|
|
100
105
|
toggleLookup(enabled: boolean): void;
|
|
@@ -12,6 +12,8 @@ export declare class MesFormulairesComponent {
|
|
|
12
12
|
private snack;
|
|
13
13
|
readonly savedForms: import("@angular/core").Signal<SavedFormSchema[]>;
|
|
14
14
|
readonly loadError: import("@angular/core").WritableSignal<string | null>;
|
|
15
|
+
searchTerm: import("@angular/core").WritableSignal<string>;
|
|
16
|
+
filteredForms: import("@angular/core").Signal<SavedFormSchema[]>;
|
|
15
17
|
selectedId: import("@angular/core").WritableSignal<string | null>;
|
|
16
18
|
submitted: import("@angular/core").WritableSignal<boolean>;
|
|
17
19
|
submitData: import("@angular/core").WritableSignal<Record<string, unknown>>;
|
|
@@ -100,6 +100,12 @@ export interface DynamicFormField {
|
|
|
100
100
|
lookup?: FieldLookup;
|
|
101
101
|
/** type: 'select' only — remote-search typeahead instead of eager-loading `url`. */
|
|
102
102
|
remoteSearch?: RemoteSearchConfig;
|
|
103
|
+
/** Filtre les items reçus de `url` avant leur mapping en {label, value} (ex: ne garder que
|
|
104
|
+
* status === 'ACTIF'). Même forme que showWhen, mais évalué contre les propriétés BRUTES
|
|
105
|
+
* de chaque item API (ex: item.status) — pas les valeurs d'un autre champ du formulaire. */
|
|
106
|
+
optionsFilter?: FieldCondition | FieldCondition[];
|
|
107
|
+
/** Logique entre les conditions de optionsFilter (indépendante de conditionLogic, qui régit showWhen/requiredWhen). @default 'AND' */
|
|
108
|
+
optionsFilterLogic?: 'AND' | 'OR';
|
|
103
109
|
col?: 1 | 2 | 3 | 4 | 6 | 8 | 9 | 12;
|
|
104
110
|
cssClass?: string;
|
|
105
111
|
showWhen?: FieldCondition | FieldCondition[];
|
|
@@ -4,6 +4,12 @@ import * as i0 from "@angular/core";
|
|
|
4
4
|
export declare class ConditionEvaluatorService {
|
|
5
5
|
isVisible(field: DynamicFormField, form: FormGroup): boolean;
|
|
6
6
|
evaluate(condition: FieldCondition, form: FormGroup): boolean;
|
|
7
|
+
/** Comme evaluate(), mais contre les propriétés d'un objet brut (ex: un item de réponse API)
|
|
8
|
+
* plutôt que les valeurs d'un FormGroup — utilisé par optionsFilter. */
|
|
9
|
+
evaluateItem(condition: FieldCondition, item: Record<string, any>): boolean;
|
|
10
|
+
/** condition(s) + logique ET/OU, contre un item brut — voir optionsFilter sur DynamicFormField. */
|
|
11
|
+
matchesItem(conditions: FieldCondition | FieldCondition[], logic: 'AND' | 'OR' | undefined, item: Record<string, any>): boolean;
|
|
12
|
+
private compare;
|
|
7
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<ConditionEvaluatorService, never>;
|
|
8
14
|
static ɵprov: i0.ɵɵInjectableDeclaration<ConditionEvaluatorService>;
|
|
9
15
|
}
|
package/package.json
CHANGED