@ajf/material 18.0.1 → 18.0.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.
@@ -30,6 +30,7 @@ export declare class AjfFbChoicesOriginEditorDialog {
30
30
  private _choicesOrigin;
31
31
  get choicesOrigin(): Observable<AjfChoicesOrigin<any>>;
32
32
  constructor(_service: AjfFormBuilderService);
33
+ disableSave(): boolean;
33
34
  saveChoicesOrigin(): void;
34
35
  cancelChoicesOriginEdit(): void;
35
36
  static ɵfac: i0.ɵɵFactoryDeclaration<AjfFbChoicesOriginEditorDialog, never>;
@@ -37,6 +37,15 @@ export interface AjfFormBuilderNodeEntry {
37
37
  children: AjfFormBuilderNodeEntry[];
38
38
  content: AjfFormBuilderNodeEntry[];
39
39
  }
40
+ export interface FormBuilderFieldValidation {
41
+ isValid: boolean;
42
+ errors: {
43
+ [key: string]: any;
44
+ } | null;
45
+ }
46
+ export interface AjfFormBuilderValidation {
47
+ [key: string]: FormBuilderFieldValidation | null;
48
+ }
40
49
  export interface AjfFormBuilderEmptySlot {
41
50
  parent: AjfNode;
42
51
  parentNode: number;
@@ -113,12 +122,19 @@ export declare class AjfFormBuilderService {
113
122
  private _editedNodeEntry;
114
123
  private _editedNodeEntryObs;
115
124
  get editedNodeEntry(): Observable<AjfFormBuilderNodeEntry | null>;
125
+ /**
126
+ * New field or node just added in tree
127
+ */
128
+ private _newNodeEntry;
116
129
  private _editedCondition;
117
130
  private _editedConditionObs;
118
131
  get editedCondition(): Observable<AjfCondition | null>;
119
132
  private _editedChoicesOrigin;
120
133
  private _editedChoicesOriginObs;
121
134
  get editedChoicesOrigin(): Observable<AjfChoicesOrigin<any> | null>;
135
+ private _editedNodesValidation;
136
+ private _editedNodesValidationObs;
137
+ get editedNodesValidation(): Observable<AjfFormBuilderValidation | null>;
122
138
  private _beforeNodesUpdate;
123
139
  private _beforeNodesUpdateObs;
124
140
  get beforeNodesUpdate(): Observable<void>;
@@ -154,6 +170,21 @@ export declare class AjfFormBuilderService {
154
170
  */
155
171
  setForm(form: AjfForm | null): void;
156
172
  editNodeEntry(nodeEntry: AjfFormBuilderNodeEntry): void;
173
+ /**
174
+ * Add a node validation entry
175
+ * @param fbNodeValidation
176
+ */
177
+ editNodeValidation(fbNodeValidation: AjfFormBuilderValidation): void;
178
+ /**
179
+ * Return if a node is valid
180
+ * @param nodeName
181
+ */
182
+ isNodeValid(nodeName: string): boolean;
183
+ /**
184
+ * Clean node validation entries when a node is deleted
185
+ * @param fbNodeValidation the deleted node
186
+ */
187
+ cleanNodeValidation(fbNodeName: string): void;
157
188
  editCondition(condition: AjfCondition): void;
158
189
  saveCurrentCondition(condition: string): void;
159
190
  cancelConditionEdit(): void;
@@ -217,6 +248,13 @@ export declare class AjfFormBuilderService {
217
248
  */
218
249
  private _updateChoicesOriginRefInNodes;
219
250
  private _buildFormBuilderNodesTree;
251
+ /**
252
+ * Find an ajfNode in AjfFormBuilderNodeEntry tree, by node name
253
+ * @param tree
254
+ * @param node
255
+ * @returns the AjfFormBuilderNodeEntry node
256
+ */
257
+ private _findNodeInTree;
220
258
  /**
221
259
  * Adds the id of a dropList to be connected with the FormBuilder source list.
222
260
  * @param listId The id of the list to connect.
@@ -25,7 +25,7 @@ import { AfterContentInit, AfterViewChecked, ElementRef, OnDestroy } from '@angu
25
25
  import { MatDialog } from '@angular/material/dialog';
26
26
  import { MatSlideToggleChange } from '@angular/material/slide-toggle';
27
27
  import { Observable } from 'rxjs';
28
- import { AjfFormBuilderNodeEntry, AjfFormBuilderNodeTypeEntry, AjfFormBuilderService } from './form-builder-service';
28
+ import { AjfFormBuilderNodeEntry, AjfFormBuilderNodeTypeEntry, AjfFormBuilderService, AjfFormBuilderValidation } from './form-builder-service';
29
29
  import * as i0 from "@angular/core";
30
30
  export declare class AjfFormBuilder implements AfterViewChecked, AfterContentInit, OnDestroy {
31
31
  private _service;
@@ -34,6 +34,11 @@ export declare class AjfFormBuilder implements AfterViewChecked, AfterContentIni
34
34
  private _form;
35
35
  get form(): AjfForm | undefined;
36
36
  set form(form: AjfForm | undefined);
37
+ /**
38
+ * Called to set form builder validation errors
39
+ */
40
+ private _formBuilderValidation;
41
+ readonly formBuilderValidation: Observable<AjfFormBuilderValidation>;
37
42
  private _nodeTypes;
38
43
  get nodeTypes(): AjfFormBuilderNodeTypeEntry[];
39
44
  private _nodeEntriesTree;
@@ -51,6 +56,7 @@ export declare class AjfFormBuilder implements AfterViewChecked, AfterContentIni
51
56
  private _editConditionDialog;
52
57
  private _beforeNodesUpdateSub;
53
58
  private _editChoicesOriginSub;
59
+ private _editNodesValidationSub;
54
60
  private _editChoicesOriginDialog;
55
61
  private _stringIdentifierDialog;
56
62
  private _stringIdentifierSub;
@@ -75,5 +81,5 @@ export declare class AjfFormBuilder implements AfterViewChecked, AfterContentIni
75
81
  expandToggle(evt: MatSlideToggleChange): void;
76
82
  private _setCurrentForm;
77
83
  static ɵfac: i0.ɵɵFactoryDeclaration<AjfFormBuilder, never>;
78
- static ɵcmp: i0.ɵɵComponentDeclaration<AjfFormBuilder, "ajf-form-builder", never, { "form": { "alias": "form"; "required": false; }; }, {}, never, never, false, never>;
84
+ static ɵcmp: i0.ɵɵComponentDeclaration<AjfFormBuilder, "ajf-form-builder", never, { "form": { "alias": "form"; "required": false; }; }, { "formBuilderValidation": "formBuilderValidation"; }, never, never, false, never>;
79
85
  }
@@ -69,6 +69,7 @@ export declare class AjfFbNodeEntry implements AfterViewInit, OnDestroy {
69
69
  onResize(): void;
70
70
  edit(evt: Event): void;
71
71
  delete(evt: Event): void;
72
+ isInvalid(node: AjfNode): boolean;
72
73
  isLastNode(): boolean;
73
74
  isSlide(node: AjfNode): boolean;
74
75
  isExpanded(): Observable<boolean>;
@@ -20,7 +20,7 @@
20
20
  *
21
21
  */
22
22
  import { AjfChoicesOrigin, AjfFieldWithChoices, AjfNode, AjfNumberField, AjfRangeField, AjfTableField } from '@ajf/core/forms';
23
- import { ChangeDetectorRef, OnDestroy } from '@angular/core';
23
+ import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
24
24
  import { AbstractControl, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
25
25
  import { MatDialog } from '@angular/material/dialog';
26
26
  import { Observable } from 'rxjs';
@@ -36,7 +36,7 @@ export interface WarningCondition {
36
36
  condition: string;
37
37
  warningMessage: string;
38
38
  }
39
- export declare class AjfFbNodeProperties implements OnDestroy {
39
+ export declare class AjfFbNodeProperties implements OnDestroy, OnInit {
40
40
  private _cdr;
41
41
  private _service;
42
42
  private _dialog;
@@ -130,7 +130,10 @@ export declare class AjfFbNodeProperties implements OnDestroy {
130
130
  private _removeTriggerConditionSub;
131
131
  private _saveEvt;
132
132
  private _saveSub;
133
+ private _isNodeValidSub;
134
+ private _nodeNameChangedSub;
133
135
  constructor(_cdr: ChangeDetectorRef, _service: AjfFormBuilderService, _dialog: MatDialog, _fb: UntypedFormBuilder, _nodeNameValidator: AjfNodePropertiesNameMatchValidator);
136
+ ngOnInit(): void;
134
137
  editVisibility(): void;
135
138
  editConditionalBranch(idx: number): void;
136
139
  editFormulaReps(): void;
@@ -156,7 +159,19 @@ export declare class AjfFbNodeProperties implements OnDestroy {
156
159
  forceCheckbox(checked: boolean, checkbox: MatCheckbox): void;
157
160
  save(): void;
158
161
  cancel(): void;
162
+ /**
163
+ * Return error message for the form control
164
+ * @param formControl
165
+ * @param fieldName
166
+ * @returns
167
+ */
159
168
  fieldErrorMessage(formControl: AbstractControl | null, fieldName: string): string | null;
169
+ /**
170
+ * Return all form error messages
171
+ * @param formGroup
172
+ * @returns
173
+ */
174
+ allErrorMessages(formGroup: UntypedFormGroup | null): string | null;
160
175
  ngOnDestroy(): void;
161
176
  private _initSave;
162
177
  private _initForm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ajf/material",
3
- "version": "18.0.1",
3
+ "version": "18.0.3",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "homepage": "https://github.com/gnucoop/ajf#readme",
15
15
  "peerDependencies": {
16
- "@ajf/core": "18.0.1",
16
+ "@ajf/core": "18.0.3",
17
17
  "@angular/animations": "^18.2.13",
18
18
  "@angular/cdk": "^18.2.14",
19
19
  "@angular/common": "^18.2.13",