@ajf/material 15.3.4 → 15.3.5
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/esm2020/form-builder/form-builder-module.mjs +4 -3
- package/esm2020/form-builder/form-builder-service.mjs +93 -3
- package/esm2020/form-builder/form-builder.mjs +7 -9
- package/esm2020/form-builder/node-entry.mjs +38 -33
- package/esm2020/form-builder/node-properties-name-validator.mjs +64 -0
- package/esm2020/form-builder/node-properties.mjs +44 -18
- package/fesm2015/ajf-material-form-builder.mjs +245 -68
- package/fesm2015/ajf-material-form-builder.mjs.map +1 -1
- package/fesm2020/ajf-material-form-builder.mjs +245 -68
- package/fesm2020/ajf-material-form-builder.mjs.map +1 -1
- package/form-builder/form-builder-service.d.ts +48 -0
- package/form-builder/form-builder.d.ts +0 -2
- package/form-builder/node-entry.d.ts +4 -5
- package/form-builder/node-properties-name-validator.d.ts +43 -0
- package/form-builder/node-properties.d.ts +7 -2
- package/package.json +2 -2
|
@@ -99,6 +99,17 @@ export declare class AjfFormBuilderService {
|
|
|
99
99
|
*/
|
|
100
100
|
private _connectedDropLists;
|
|
101
101
|
get connectedDropLists(): BehaviorSubject<string[]>;
|
|
102
|
+
/**
|
|
103
|
+
* A dictionary of the 'expanded' status of all nodeEntries in the tree {node.name: boolean}
|
|
104
|
+
*/
|
|
105
|
+
private _nodeEntriesTreeExpandedStatus;
|
|
106
|
+
get nodeEntriesTreeExpandedStatus(): BehaviorSubject<{
|
|
107
|
+
[name: string]: boolean;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Determines the default expanded state of nodeEntries when the FormBuilder loads
|
|
111
|
+
*/
|
|
112
|
+
private _defaultExpanded;
|
|
102
113
|
private _editedNodeEntry;
|
|
103
114
|
private _editedNodeEntryObs;
|
|
104
115
|
get editedNodeEntry(): Observable<AjfFormBuilderNodeEntry | null>;
|
|
@@ -128,6 +139,11 @@ export declare class AjfFormBuilderService {
|
|
|
128
139
|
* Subscribes to the moveNodeEntryEvent event emitter;
|
|
129
140
|
*/
|
|
130
141
|
private _moveNodeSub;
|
|
142
|
+
/**
|
|
143
|
+
* Counters for default name assigned to inserted fields/slides
|
|
144
|
+
*/
|
|
145
|
+
private _emptyFieldCounter;
|
|
146
|
+
private _emptySlideCounter;
|
|
131
147
|
constructor();
|
|
132
148
|
/**
|
|
133
149
|
* Sets the current edited form
|
|
@@ -161,6 +177,38 @@ export declare class AjfFormBuilderService {
|
|
|
161
177
|
choices: any[];
|
|
162
178
|
}): void;
|
|
163
179
|
saveStringIdentifier(identifier: AjfFormStringIdentifier[]): void;
|
|
180
|
+
/**
|
|
181
|
+
* Resets the nodeEntriesTreeExpandedStatus dictionary to an empty object.
|
|
182
|
+
*/
|
|
183
|
+
resetNodeEntriesTreeExpandedStatus(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Gets the expanded status of an entry in the nodeEntriesTreeExpandedStatus dictionary
|
|
186
|
+
* @param nodeName The unique name of the nodeEntry
|
|
187
|
+
*/
|
|
188
|
+
getExpandedStatus(nodeName: string): Observable<boolean>;
|
|
189
|
+
/**
|
|
190
|
+
* Upserts an entry in the nodeEntriesTreeExpandedStatus dictionary
|
|
191
|
+
* @param nodeName The unique name of the nodeEntry
|
|
192
|
+
* @param expanded True if the nodeEntry is expanded
|
|
193
|
+
*/
|
|
194
|
+
updateExpandedStatus(nodeName: string, expanded: boolean): void;
|
|
195
|
+
/**
|
|
196
|
+
* Removes an entry from the nodeEntriesTreeExpandedStatus dictionary
|
|
197
|
+
* @param nodeName The unique name of the nodeEntry
|
|
198
|
+
*/
|
|
199
|
+
removeExpandedStatus(nodeName: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* Sets expanded to true for each entry in the nodeEntriesTreeExpandedStatus dictionary
|
|
202
|
+
*/
|
|
203
|
+
expandAll(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Sets expanded to false for each entry in the nodeEntriesTreeExpandedStatus dictionary
|
|
206
|
+
*/
|
|
207
|
+
collapseAll(): void;
|
|
208
|
+
/**
|
|
209
|
+
* Resets the empty fields/slides counters
|
|
210
|
+
*/
|
|
211
|
+
resetEmptyCounters(): void;
|
|
164
212
|
/**
|
|
165
213
|
* Searches the form nodes for field nodes with choicesOriginRef corresponding
|
|
166
214
|
* to an edited choicesOrigin and updates it with the new name.
|
|
@@ -40,8 +40,6 @@ export declare class AjfFormBuilder implements AfterViewChecked, AfterContentIni
|
|
|
40
40
|
get nodeEntriesTree(): Observable<AjfFormBuilderNodeEntry[]>;
|
|
41
41
|
private _choicesOrigins;
|
|
42
42
|
get choicesOrigins(): Observable<AjfChoicesOrigin<any>[]>;
|
|
43
|
-
private _globalExpanded;
|
|
44
|
-
get isGlobalExpanded(): boolean;
|
|
45
43
|
/**
|
|
46
44
|
* The list of the ids of all the dropLists connected to the formbuilder source list.
|
|
47
45
|
*/
|
|
@@ -37,9 +37,6 @@ export declare class AjfFbNodeEntry implements AfterViewInit, OnDestroy {
|
|
|
37
37
|
set isFirst(isFirst: boolean);
|
|
38
38
|
private _isNodeEntry;
|
|
39
39
|
get isNodeEntry(): boolean;
|
|
40
|
-
private _isExpanded;
|
|
41
|
-
get isExpanded(): boolean;
|
|
42
|
-
set isExpanded(exp: boolean);
|
|
43
40
|
private _nodeEntry;
|
|
44
41
|
get nodeEntry(): AjfFormBuilderNode | undefined;
|
|
45
42
|
set nodeEntry(nodeEntry: AjfFormBuilderNode | undefined);
|
|
@@ -74,6 +71,7 @@ export declare class AjfFbNodeEntry implements AfterViewInit, OnDestroy {
|
|
|
74
71
|
delete(evt: Event): void;
|
|
75
72
|
isLastNode(): boolean;
|
|
76
73
|
isSlide(node: AjfNode): boolean;
|
|
74
|
+
isExpanded(): Observable<boolean>;
|
|
77
75
|
ngAfterViewInit(): void;
|
|
78
76
|
ngOnDestroy(): void;
|
|
79
77
|
/**
|
|
@@ -90,7 +88,8 @@ export declare class AjfFbNodeEntry implements AfterViewInit, OnDestroy {
|
|
|
90
88
|
disableSlideDrop(item: CdkDrag<AjfFormBuilderNodeTypeEntry>): boolean;
|
|
91
89
|
disableFieldDrop(item: CdkDrag<AjfFormBuilderNodeTypeEntry>): boolean;
|
|
92
90
|
emptyAreaDropPredicate(): (item: CdkDrag, _drop: CdkDropList) => boolean;
|
|
93
|
-
|
|
91
|
+
updateBranchHeights(delay?: number): void;
|
|
92
|
+
updateExpandedStatus(expanded: boolean): void;
|
|
94
93
|
static ɵfac: i0.ɵɵFactoryDeclaration<AjfFbNodeEntry, never>;
|
|
95
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AjfFbNodeEntry, "ajf-fb-node-entry", never, { "isFirst": "isFirst"; "
|
|
94
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AjfFbNodeEntry, "ajf-fb-node-entry", never, { "isFirst": "isFirst"; "nodeEntry": "nodeEntry"; "level": "level"; "isDraggable": "isDraggable"; "originOffset": "originOffset"; "firstBranchColor": "firstBranchColor"; }, {}, never, never, false, never>;
|
|
96
95
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (C) Gnucoop soc. coop.
|
|
4
|
+
*
|
|
5
|
+
* This file is part of the Advanced JSON forms (ajf).
|
|
6
|
+
*
|
|
7
|
+
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
8
|
+
* modify it under the terms of the GNU Affero General Public License as
|
|
9
|
+
* published by the Free Software Foundation, either version 3 of the License,
|
|
10
|
+
* or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
15
|
+
* General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
18
|
+
* along with Advanced JSON forms (ajf).
|
|
19
|
+
* If not, see http://www.gnu.org/licenses/.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
import { ChangeDetectorRef } from '@angular/core';
|
|
23
|
+
import { AsyncValidatorFn } from '@angular/forms';
|
|
24
|
+
import { AjfFormBuilderService } from './form-builder-service';
|
|
25
|
+
import * as i0 from "@angular/core";
|
|
26
|
+
/**
|
|
27
|
+
* Custom validator service that checks for an already existing
|
|
28
|
+
* Node with the given name.
|
|
29
|
+
*/
|
|
30
|
+
export declare class AjfNodePropertiesNameMatchValidator {
|
|
31
|
+
private _fbs;
|
|
32
|
+
constructor(_fbs: AjfFormBuilderService);
|
|
33
|
+
/**
|
|
34
|
+
* Custom async validator method.
|
|
35
|
+
* Checks if a Node with the same Name exists, in order to
|
|
36
|
+
* validate the Node Entry properties form.
|
|
37
|
+
* @param cdr The editor changeDetectionRef
|
|
38
|
+
* @param currentId The current node entry id
|
|
39
|
+
*/
|
|
40
|
+
sameValueCheck(cdr: ChangeDetectorRef, currentId: number): AsyncValidatorFn;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AjfNodePropertiesNameMatchValidator, never>;
|
|
42
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AjfNodePropertiesNameMatchValidator>;
|
|
43
|
+
}
|
|
@@ -21,10 +21,12 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { AjfChoicesOrigin, AjfFieldWithChoices, AjfNode, AjfNumberField, AjfRangeField, AjfTableField } from '@ajf/core/forms';
|
|
23
23
|
import { ChangeDetectorRef, OnDestroy } from '@angular/core';
|
|
24
|
-
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
|
24
|
+
import { AbstractControl, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
|
25
25
|
import { MatDialog } from '@angular/material/dialog';
|
|
26
26
|
import { Observable } from 'rxjs';
|
|
27
27
|
import { AjfFormBuilderNodeEntry, AjfFormBuilderService } from './form-builder-service';
|
|
28
|
+
import { MatCheckbox } from '@angular/material/checkbox';
|
|
29
|
+
import { AjfNodePropertiesNameMatchValidator } from './node-properties-name-validator';
|
|
28
30
|
import * as i0 from "@angular/core";
|
|
29
31
|
export interface ValidationCondition {
|
|
30
32
|
condition: string;
|
|
@@ -39,6 +41,7 @@ export declare class AjfFbNodeProperties implements OnDestroy {
|
|
|
39
41
|
private _service;
|
|
40
42
|
private _dialog;
|
|
41
43
|
private _fb;
|
|
44
|
+
private _nodeNameValidator;
|
|
42
45
|
private _fieldSizes;
|
|
43
46
|
get fieldSizes(): {
|
|
44
47
|
label: string;
|
|
@@ -127,7 +130,7 @@ export declare class AjfFbNodeProperties implements OnDestroy {
|
|
|
127
130
|
private _removeTriggerConditionSub;
|
|
128
131
|
private _saveEvt;
|
|
129
132
|
private _saveSub;
|
|
130
|
-
constructor(_cdr: ChangeDetectorRef, _service: AjfFormBuilderService, _dialog: MatDialog, _fb: UntypedFormBuilder);
|
|
133
|
+
constructor(_cdr: ChangeDetectorRef, _service: AjfFormBuilderService, _dialog: MatDialog, _fb: UntypedFormBuilder, _nodeNameValidator: AjfNodePropertiesNameMatchValidator);
|
|
131
134
|
editVisibility(): void;
|
|
132
135
|
editConditionalBranch(idx: number): void;
|
|
133
136
|
editFormulaReps(): void;
|
|
@@ -150,8 +153,10 @@ export declare class AjfFbNodeProperties implements OnDestroy {
|
|
|
150
153
|
hasChoicesOriginRef(): Observable<boolean>;
|
|
151
154
|
isRangeField(node: AjfNode): node is AjfRangeField;
|
|
152
155
|
isTableField(node: AjfNode): node is AjfTableField;
|
|
156
|
+
forceCheckbox(checked: boolean, checkbox: MatCheckbox): void;
|
|
153
157
|
save(): void;
|
|
154
158
|
cancel(): void;
|
|
159
|
+
fieldErrorMessage(formControl: AbstractControl | null, fieldName: string): string | null;
|
|
155
160
|
ngOnDestroy(): void;
|
|
156
161
|
private _initSave;
|
|
157
162
|
private _initForm;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ajf/material",
|
|
3
|
-
"version": "15.3.
|
|
3
|
+
"version": "15.3.5",
|
|
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": "15.3.
|
|
16
|
+
"@ajf/core": "15.3.5",
|
|
17
17
|
"@angular/animations": "^15.0.4",
|
|
18
18
|
"@angular/cdk": "^15.0.3",
|
|
19
19
|
"@angular/common": "^15.0.4",
|