@ajf/material 15.3.13 → 16.0.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/{esm2020 → esm2022}/barcode/barcode-module.mjs +19 -19
- package/{esm2020 → esm2022}/barcode/barcode.mjs +4 -4
- package/{esm2020 → esm2022}/calendar/calendar-module.mjs +5 -5
- package/{esm2020 → esm2022}/calendar/calendar.mjs +4 -4
- package/{esm2020 → esm2022}/checkbox-group/checkbox-group-item.mjs +4 -4
- package/{esm2020 → esm2022}/checkbox-group/checkbox-group-module.mjs +5 -5
- package/esm2022/form-builder/branch-line.mjs +69 -0
- package/{esm2020 → esm2022}/form-builder/choices-origin-editor-dialog.mjs +7 -7
- package/{esm2020 → esm2022}/form-builder/choices-origin-editor.mjs +5 -5
- package/{esm2020 → esm2022}/form-builder/condition-editor-dialog.mjs +7 -7
- package/{esm2020 → esm2022}/form-builder/condition-editor.mjs +9 -9
- package/{esm2020 → esm2022}/form-builder/form-builder-module.mjs +64 -64
- package/esm2022/form-builder/form-builder-service.mjs +923 -0
- package/esm2022/form-builder/form-builder.mjs +183 -0
- package/esm2022/form-builder/node-entry.mjs +267 -0
- package/{esm2020 → esm2022}/form-builder/node-properties-name-validator.mjs +4 -4
- package/esm2022/form-builder/node-properties.mjs +1030 -0
- package/{esm2020 → esm2022}/form-builder/node-type-entry.mjs +7 -7
- package/{esm2020 → esm2022}/form-builder/string-identifier-dialog.mjs +4 -4
- package/{esm2020 → esm2022}/form-builder/validation-condition-editor-dialog.mjs +7 -7
- package/{esm2020 → esm2022}/form-builder/warning-condition-editor-dialog.mjs +7 -7
- package/{esm2020 → esm2022}/forms/barcode-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/boolean-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/date-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/date-input-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/empty-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/field-service.mjs +4 -4
- package/{esm2020 → esm2022}/forms/field-warning-dialog.mjs +4 -4
- package/{esm2020 → esm2022}/forms/field.mjs +4 -4
- package/esm2022/forms/form.mjs +58 -0
- package/{esm2020 → esm2022}/forms/forms-module.mjs +81 -81
- package/{esm2020 → esm2022}/forms/geolocation-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/input-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/multiple-choice-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/range-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/signature-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/single-choice-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/table-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/text-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/time-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/video-url-field.mjs +4 -4
- package/{esm2020 → esm2022}/forms/warning-alert-service.mjs +4 -4
- package/{esm2020 → esm2022}/geolocation/geolocation-module.mjs +15 -15
- package/{esm2020 → esm2022}/geolocation/geolocation.mjs +4 -4
- package/{esm2020 → esm2022}/image/image-module.mjs +5 -5
- package/{esm2020 → esm2022}/image/image.mjs +4 -4
- package/{esm2020 → esm2022}/node-icon/node-icon-module.mjs +5 -5
- package/{esm2020 → esm2022}/node-icon/node-icon.mjs +4 -4
- package/{esm2020 → esm2022}/page-slider/page-slider-module.mjs +5 -5
- package/{esm2020 → esm2022}/page-slider/page-slider.mjs +4 -4
- package/{esm2020 → esm2022}/reports/chart-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/filter-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/formula-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/graph-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/heat-map-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/image-container-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/image-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/map-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/page-break-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/report.mjs +4 -4
- package/{esm2020 → esm2022}/reports/reports-module.mjs +50 -50
- package/{esm2020 → esm2022}/reports/table-widget.mjs +4 -4
- package/{esm2020 → esm2022}/reports/text-widget.mjs +4 -4
- package/esm2022/reports/widget.mjs +368 -0
- package/{esm2020 → esm2022}/signature/signature-module.mjs +15 -15
- package/{esm2020 → esm2022}/signature/signature.mjs +4 -4
- package/{esm2020 → esm2022}/time/time-module.mjs +5 -5
- package/{esm2020 → esm2022}/time/time.mjs +4 -4
- package/{fesm2020 → fesm2022}/ajf-material-barcode.mjs +21 -21
- package/{fesm2020 → fesm2022}/ajf-material-barcode.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ajf-material-calendar.mjs +7 -7
- package/{fesm2015 → fesm2022}/ajf-material-calendar.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ajf-material-checkbox-group.mjs +7 -7
- package/{fesm2015 → fesm2022}/ajf-material-checkbox-group.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ajf-material-form-builder.mjs +284 -284
- package/fesm2022/ajf-material-form-builder.mjs.map +1 -0
- package/fesm2022/ajf-material-forms.mjs +1102 -0
- package/fesm2022/ajf-material-forms.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/ajf-material-geolocation.mjs +17 -17
- package/{fesm2015 → fesm2022}/ajf-material-geolocation.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/ajf-material-image.mjs +7 -7
- package/{fesm2020 → fesm2022}/ajf-material-image.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/ajf-material-node-icon.mjs +7 -7
- package/{fesm2020 → fesm2022}/ajf-material-node-icon.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ajf-material-page-slider.mjs +7 -7
- package/{fesm2015 → fesm2022}/ajf-material-page-slider.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ajf-material-reports.mjs +135 -135
- package/{fesm2015 → fesm2022}/ajf-material-reports.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ajf-material-signature.mjs +17 -17
- package/{fesm2020 → fesm2022}/ajf-material-signature.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/ajf-material-time.mjs +7 -7
- package/{fesm2020 → fesm2022}/ajf-material-time.mjs.map +1 -1
- package/form-builder/branch-line.d.ts +1 -1
- package/form-builder/choices-origin-data-source.d.ts +1 -1
- package/form-builder/choices-origin-editor.d.ts +1 -1
- package/form-builder/condition-editor.d.ts +1 -1
- package/form-builder/form-builder-service.d.ts +2 -2
- package/form-builder/form-builder.d.ts +1 -1
- package/form-builder/node-entry.d.ts +1 -1
- package/form-builder/node-type-entry.d.ts +1 -1
- package/forms/form.d.ts +1 -1
- package/package.json +49 -79
- package/esm2020/form-builder/branch-line.mjs +0 -69
- package/esm2020/form-builder/form-builder-service.mjs +0 -923
- package/esm2020/form-builder/form-builder.mjs +0 -183
- package/esm2020/form-builder/node-entry.mjs +0 -267
- package/esm2020/form-builder/node-properties.mjs +0 -1030
- package/esm2020/forms/form.mjs +0 -58
- package/esm2020/reports/widget.mjs +0 -368
- package/fesm2015/ajf-material-barcode.mjs +0 -170
- package/fesm2015/ajf-material-barcode.mjs.map +0 -1
- package/fesm2015/ajf-material-calendar.mjs +0 -116
- package/fesm2015/ajf-material-checkbox-group.mjs +0 -120
- package/fesm2015/ajf-material-form-builder.mjs +0 -3120
- package/fesm2015/ajf-material-form-builder.mjs.map +0 -1
- package/fesm2015/ajf-material-forms.mjs +0 -1134
- package/fesm2015/ajf-material-forms.mjs.map +0 -1
- package/fesm2015/ajf-material-image.mjs.map +0 -1
- package/fesm2015/ajf-material-node-icon.mjs.map +0 -1
- package/fesm2015/ajf-material-page-slider.mjs +0 -109
- package/fesm2015/ajf-material-reports.mjs +0 -943
- package/fesm2015/ajf-material-signature.mjs +0 -164
- package/fesm2015/ajf-material-signature.mjs.map +0 -1
- package/fesm2015/ajf-material-time.mjs.map +0 -1
- package/fesm2020/ajf-material-calendar.mjs.map +0 -1
- package/fesm2020/ajf-material-checkbox-group.mjs.map +0 -1
- package/fesm2020/ajf-material-form-builder.mjs.map +0 -1
- package/fesm2020/ajf-material-forms.mjs +0 -1102
- package/fesm2020/ajf-material-forms.mjs.map +0 -1
- package/fesm2020/ajf-material-geolocation.mjs +0 -136
- package/fesm2020/ajf-material-geolocation.mjs.map +0 -1
- package/fesm2020/ajf-material-image.mjs +0 -105
- package/fesm2020/ajf-material-node-icon.mjs +0 -149
- package/fesm2020/ajf-material-page-slider.mjs.map +0 -1
- package/fesm2020/ajf-material-reports.mjs.map +0 -1
- package/fesm2020/ajf-material-time.mjs +0 -111
- package/fesm2020/ajf-material.mjs +0 -28
- package/fesm2020/ajf-material.mjs.map +0 -1
- /package/{esm2020 → esm2022}/ajf-material.mjs +0 -0
- /package/{esm2020 → esm2022}/barcode/ajf-material-barcode.mjs +0 -0
- /package/{esm2020 → esm2022}/barcode/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/calendar/ajf-material-calendar.mjs +0 -0
- /package/{esm2020 → esm2022}/calendar/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/checkbox-group/ajf-material-checkbox-group.mjs +0 -0
- /package/{esm2020 → esm2022}/checkbox-group/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/form-builder/ajf-material-form-builder.mjs +0 -0
- /package/{esm2020 → esm2022}/form-builder/choices-origin-data-source.mjs +0 -0
- /package/{esm2020 → esm2022}/form-builder/form-builder-utils.mjs +0 -0
- /package/{esm2020 → esm2022}/form-builder/operations.mjs +0 -0
- /package/{esm2020 → esm2022}/form-builder/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/forms/ajf-material-forms.mjs +0 -0
- /package/{esm2020 → esm2022}/forms/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/geolocation/ajf-material-geolocation.mjs +0 -0
- /package/{esm2020 → esm2022}/geolocation/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/image/ajf-material-image.mjs +0 -0
- /package/{esm2020 → esm2022}/image/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/node-icon/ajf-material-node-icon.mjs +0 -0
- /package/{esm2020 → esm2022}/node-icon/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/page-slider/ajf-material-page-slider.mjs +0 -0
- /package/{esm2020 → esm2022}/page-slider/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/reports/ajf-material-reports.mjs +0 -0
- /package/{esm2020 → esm2022}/reports/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/signature/ajf-material-signature.mjs +0 -0
- /package/{esm2020 → esm2022}/signature/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/time/ajf-material-time.mjs +0 -0
- /package/{esm2020 → esm2022}/time/public_api.mjs +0 -0
- /package/{fesm2015 → fesm2022}/ajf-material.mjs +0 -0
- /package/{fesm2015 → fesm2022}/ajf-material.mjs.map +0 -0
|
@@ -1,3120 +0,0 @@
|
|
|
1
|
-
import { AjfTranslocoModule } from '@ajf/core/transloco';
|
|
2
|
-
import * as i2$1 from '@ajf/material/node-icon';
|
|
3
|
-
import { AjfNodeIconModule } from '@ajf/material/node-icon';
|
|
4
|
-
import * as i4$1 from '@angular/cdk/drag-drop';
|
|
5
|
-
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
6
|
-
import * as i3 from '@angular/common';
|
|
7
|
-
import { CommonModule } from '@angular/common';
|
|
8
|
-
import * as i0 from '@angular/core';
|
|
9
|
-
import { Component, ViewEncapsulation, ChangeDetectionStrategy, Input, EventEmitter, Injectable, ViewChild, ElementRef, ViewChildren, NgModule } from '@angular/core';
|
|
10
|
-
import * as i3$1 from '@angular/forms';
|
|
11
|
-
import { FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
12
|
-
import * as i4 from '@angular/material/autocomplete';
|
|
13
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
14
|
-
import * as i5 from '@angular/material/button';
|
|
15
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
16
|
-
import * as i6$2 from '@angular/material/card';
|
|
17
|
-
import { MatCardModule } from '@angular/material/card';
|
|
18
|
-
import * as i8$2 from '@angular/material/checkbox';
|
|
19
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
20
|
-
import * as i7$2 from '@angular/material/chips';
|
|
21
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
22
|
-
import * as i2 from '@angular/material/dialog';
|
|
23
|
-
import { MatDialogModule } from '@angular/material/dialog';
|
|
24
|
-
import * as i8$1 from '@angular/material/expansion';
|
|
25
|
-
import { MatExpansionModule } from '@angular/material/expansion';
|
|
26
|
-
import * as i9 from '@angular/material/form-field';
|
|
27
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
28
|
-
import * as i10 from '@angular/material/icon';
|
|
29
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
30
|
-
import * as i6 from '@angular/material/input';
|
|
31
|
-
import { MatInputModule } from '@angular/material/input';
|
|
32
|
-
import * as i7$1 from '@angular/material/list';
|
|
33
|
-
import { MatListModule } from '@angular/material/list';
|
|
34
|
-
import * as i7$3 from '@angular/material/menu';
|
|
35
|
-
import { MatMenuModule } from '@angular/material/menu';
|
|
36
|
-
import * as i12 from '@angular/material/select';
|
|
37
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
38
|
-
import * as i8$3 from '@angular/material/sidenav';
|
|
39
|
-
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
40
|
-
import * as i11 from '@angular/material/slide-toggle';
|
|
41
|
-
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
42
|
-
import * as i13 from '@angular/material/slider';
|
|
43
|
-
import { MatSliderModule } from '@angular/material/slider';
|
|
44
|
-
import * as i7 from '@angular/material/table';
|
|
45
|
-
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
46
|
-
import * as i9$1 from '@angular/material/toolbar';
|
|
47
|
-
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
48
|
-
import * as i8 from '@angular/material/tooltip';
|
|
49
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
50
|
-
import * as i1 from '@ajf/core/forms';
|
|
51
|
-
import { isChoicesFixedOrigin, isContainerNode, AjfFieldType, AjfNodeType, createField, createContainerNode, createForm, createChoicesFixedOrigin, isSlidesNode, isFieldWithChoices, isRepeatingContainerNode, isField, createValidationGroup, notEmptyValidation, minValidation, maxValidation, minDigitsValidation, maxDigitsValidation, createValidation, createWarningGroup, notEmptyWarning, createWarning, isRangeField, isTableField, isNumberField } from '@ajf/core/forms';
|
|
52
|
-
import { DataSource } from '@angular/cdk/collections';
|
|
53
|
-
import { BehaviorSubject, of, Subject, Subscription, combineLatest } from 'rxjs';
|
|
54
|
-
import * as i6$1 from '@ngneat/transloco';
|
|
55
|
-
import { filter, map, scan, shareReplay, withLatestFrom, debounceTime, finalize, take, distinctUntilChanged, sample } from 'rxjs/operators';
|
|
56
|
-
import { createCondition, alwaysCondition, createFormula, neverCondition } from '@ajf/core/models';
|
|
57
|
-
import { deepCopy } from '@ajf/core/utils';
|
|
58
|
-
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
59
|
-
import * as i5$1 from '@angular/material/core';
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @license
|
|
63
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
64
|
-
*
|
|
65
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
66
|
-
*
|
|
67
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
68
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
69
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
70
|
-
* or (at your option) any later version.
|
|
71
|
-
*
|
|
72
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
73
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
74
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
75
|
-
* General Public License for more details.
|
|
76
|
-
*
|
|
77
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
78
|
-
* along with Advanced JSON forms (ajf).
|
|
79
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
80
|
-
*
|
|
81
|
-
*/
|
|
82
|
-
class AjfFbBranchLine {
|
|
83
|
-
constructor(_el, _renderer) {
|
|
84
|
-
this._el = _el;
|
|
85
|
-
this._renderer = _renderer;
|
|
86
|
-
this._offset = 0;
|
|
87
|
-
this._color = '';
|
|
88
|
-
this._height = 0;
|
|
89
|
-
}
|
|
90
|
-
set offset(offset) {
|
|
91
|
-
this._offset = offset;
|
|
92
|
-
this._updateOffset();
|
|
93
|
-
}
|
|
94
|
-
set color(color) {
|
|
95
|
-
this._color = color;
|
|
96
|
-
this._updateColor();
|
|
97
|
-
}
|
|
98
|
-
set height(height) {
|
|
99
|
-
this._height = height;
|
|
100
|
-
this._updateHeight();
|
|
101
|
-
}
|
|
102
|
-
_updateHeight() {
|
|
103
|
-
const height = `${Math.max(0, this._height - 25)}px`;
|
|
104
|
-
this._renderer.setStyle(this._el.nativeElement, 'height', height);
|
|
105
|
-
}
|
|
106
|
-
_updateOffset() {
|
|
107
|
-
const margin = `${this._offset * 4}px`;
|
|
108
|
-
this._renderer.setStyle(this._el.nativeElement, 'margin-top', margin);
|
|
109
|
-
this._renderer.setStyle(this._el.nativeElement, 'margin-left', margin);
|
|
110
|
-
}
|
|
111
|
-
_updateColor() {
|
|
112
|
-
this._renderer.setStyle(this._el.nativeElement, 'border-color', this._color);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
AjfFbBranchLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbBranchLine, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
116
|
-
AjfFbBranchLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbBranchLine, selector: "ajf-fb-branch-line", inputs: { offset: "offset", color: "color", height: "height" }, ngImport: i0, template: "", styles: ["ajf-fb-branch-line{display:block;position:absolute;top:25px;left:25px;width:25px;border-top:2px solid;border-left:2px solid;border-top-left-radius:6px;transition:height .5s ease-in-out}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
117
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbBranchLine, decorators: [{
|
|
118
|
-
type: Component,
|
|
119
|
-
args: [{ selector: 'ajf-fb-branch-line', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "", styles: ["ajf-fb-branch-line{display:block;position:absolute;top:25px;left:25px;width:25px;border-top:2px solid;border-left:2px solid;border-top-left-radius:6px;transition:height .5s ease-in-out}\n"] }]
|
|
120
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { offset: [{
|
|
121
|
-
type: Input
|
|
122
|
-
}], color: [{
|
|
123
|
-
type: Input
|
|
124
|
-
}], height: [{
|
|
125
|
-
type: Input
|
|
126
|
-
}] } });
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @license
|
|
130
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
131
|
-
*
|
|
132
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
133
|
-
*
|
|
134
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
135
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
136
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
137
|
-
* or (at your option) any later version.
|
|
138
|
-
*
|
|
139
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
140
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
141
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
142
|
-
* General Public License for more details.
|
|
143
|
-
*
|
|
144
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
145
|
-
* along with Advanced JSON forms (ajf).
|
|
146
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
class ChoicesOriginDataSource extends DataSource {
|
|
150
|
-
constructor() {
|
|
151
|
-
super();
|
|
152
|
-
this._choices = new BehaviorSubject([]);
|
|
153
|
-
this._choicesObs = this._choices;
|
|
154
|
-
}
|
|
155
|
-
connect() {
|
|
156
|
-
return this._choicesObs;
|
|
157
|
-
}
|
|
158
|
-
disconnect() { }
|
|
159
|
-
updateChoices(choices) {
|
|
160
|
-
this._choices.next(choices);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @license
|
|
166
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
167
|
-
*
|
|
168
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
169
|
-
*
|
|
170
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
171
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
172
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
173
|
-
* or (at your option) any later version.
|
|
174
|
-
*
|
|
175
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
176
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
177
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
178
|
-
* General Public License for more details.
|
|
179
|
-
*
|
|
180
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
181
|
-
* along with Advanced JSON forms (ajf).
|
|
182
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
183
|
-
*
|
|
184
|
-
*/
|
|
185
|
-
class AjfFbChoicesOriginEditor {
|
|
186
|
-
constructor() {
|
|
187
|
-
this._displayedColumns = ['label', 'value', 'delete'];
|
|
188
|
-
this.editing = {};
|
|
189
|
-
this.name = '';
|
|
190
|
-
this.label = '';
|
|
191
|
-
this.canEditChoices = false;
|
|
192
|
-
this._choices = new ChoicesOriginDataSource();
|
|
193
|
-
this._choicesArr = [];
|
|
194
|
-
}
|
|
195
|
-
get displayedColumns() {
|
|
196
|
-
return this._displayedColumns;
|
|
197
|
-
}
|
|
198
|
-
get choicesOrigin() {
|
|
199
|
-
return this._choicesOrigin;
|
|
200
|
-
}
|
|
201
|
-
set choicesOrigin(choicesOrigin) {
|
|
202
|
-
this._choicesOrigin = choicesOrigin;
|
|
203
|
-
if (choicesOrigin != null) {
|
|
204
|
-
this.name = choicesOrigin.name;
|
|
205
|
-
this.label = choicesOrigin.label;
|
|
206
|
-
this.canEditChoices = isChoicesFixedOrigin(choicesOrigin);
|
|
207
|
-
this._choicesArr = choicesOrigin.choices;
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
this.name = '';
|
|
211
|
-
this.label = '';
|
|
212
|
-
this.canEditChoices = false;
|
|
213
|
-
this._choicesArr = [];
|
|
214
|
-
}
|
|
215
|
-
this._choices.updateChoices(this._choicesArr);
|
|
216
|
-
}
|
|
217
|
-
get choices() {
|
|
218
|
-
return this._choices;
|
|
219
|
-
}
|
|
220
|
-
get choicesArr() {
|
|
221
|
-
return this._choicesArr;
|
|
222
|
-
}
|
|
223
|
-
updateValue(evt, cell, _value, rowIdx) {
|
|
224
|
-
this.editing[rowIdx + '-' + cell] = false;
|
|
225
|
-
this._choicesArr[rowIdx][cell] = evt.target.value;
|
|
226
|
-
this._choices.updateChoices(this._choicesArr);
|
|
227
|
-
}
|
|
228
|
-
deleteRow(rowIdx) {
|
|
229
|
-
this._choicesArr.splice(rowIdx, 1);
|
|
230
|
-
this._choices.updateChoices(this._choicesArr);
|
|
231
|
-
}
|
|
232
|
-
addRow() {
|
|
233
|
-
this._choicesArr.push({ label: '', value: '' });
|
|
234
|
-
this._choices.updateChoices(this._choicesArr);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
AjfFbChoicesOriginEditor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbChoicesOriginEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
238
|
-
AjfFbChoicesOriginEditor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbChoicesOriginEditor, selector: "ajf-fb-choices-origin-editor", inputs: { choicesOrigin: "choicesOrigin" }, ngImport: i0, template: "<div>\n <mat-form-field>\n <input matInput [(ngModel)]=\"name\" [placeholder]=\"'Name' | transloco\" />\n </mat-form-field>\n <mat-form-field>\n <input matInput [(ngModel)]=\"label\" [placeholder]=\"'Label' | transloco\" />\n </mat-form-field>\n <ng-template [ngIf]=\"canEditChoices\">\n <button (click)=\"addRow()\" mat-button>\n <mat-icon>add</mat-icon>\n <span>{{'Add value'|transloco}}</span>\n </button>\n <mat-table [dataSource]=\"choices\">\n <ng-container matColumnDef=\"label\">\n <mat-header-cell *matHeaderCellDef\n >{{'Label'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <input matInput [(ngModel)]=\"row.label\" type=\"text\" />\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"value\">\n <mat-header-cell *matHeaderCellDef\n >{{'Value'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <input matInput [(ngModel)]=\"row.value\" type=\"text\" />\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"delete\">\n <mat-header-cell *matHeaderCellDef\n >{{'Delete'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-icon (click)=\"deleteRow(idx)\">delete</mat-icon>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns;\"></mat-row>\n </mat-table>\n </ng-template>\n</div>\n", styles: ["ajf-fb-choices-origin-editor mat-form-field+mat-form-field{margin-left:1em}ajf-fb-choices-origin-editor mat-table{max-height:300px}ajf-fb-choices-origin-editor mat-table mat-icon{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i10.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i7.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i7.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i7.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i7.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i7.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i7.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i7.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i7.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i7.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i7.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "pipe", type: i6$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
239
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbChoicesOriginEditor, decorators: [{
|
|
240
|
-
type: Component,
|
|
241
|
-
args: [{ selector: 'ajf-fb-choices-origin-editor', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <mat-form-field>\n <input matInput [(ngModel)]=\"name\" [placeholder]=\"'Name' | transloco\" />\n </mat-form-field>\n <mat-form-field>\n <input matInput [(ngModel)]=\"label\" [placeholder]=\"'Label' | transloco\" />\n </mat-form-field>\n <ng-template [ngIf]=\"canEditChoices\">\n <button (click)=\"addRow()\" mat-button>\n <mat-icon>add</mat-icon>\n <span>{{'Add value'|transloco}}</span>\n </button>\n <mat-table [dataSource]=\"choices\">\n <ng-container matColumnDef=\"label\">\n <mat-header-cell *matHeaderCellDef\n >{{'Label'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <input matInput [(ngModel)]=\"row.label\" type=\"text\" />\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"value\">\n <mat-header-cell *matHeaderCellDef\n >{{'Value'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <input matInput [(ngModel)]=\"row.value\" type=\"text\" />\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"delete\">\n <mat-header-cell *matHeaderCellDef\n >{{'Delete'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-icon (click)=\"deleteRow(idx)\">delete</mat-icon>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns;\"></mat-row>\n </mat-table>\n </ng-template>\n</div>\n", styles: ["ajf-fb-choices-origin-editor mat-form-field+mat-form-field{margin-left:1em}ajf-fb-choices-origin-editor mat-table{max-height:300px}ajf-fb-choices-origin-editor mat-table mat-icon{cursor:pointer}\n"] }]
|
|
242
|
-
}], propDecorators: { choicesOrigin: [{
|
|
243
|
-
type: Input
|
|
244
|
-
}] } });
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* @license
|
|
248
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
249
|
-
*
|
|
250
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
251
|
-
*
|
|
252
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
253
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
254
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
255
|
-
* or (at your option) any later version.
|
|
256
|
-
*
|
|
257
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
258
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
259
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
260
|
-
* General Public License for more details.
|
|
261
|
-
*
|
|
262
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
263
|
-
* along with Advanced JSON forms (ajf).
|
|
264
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
265
|
-
*
|
|
266
|
-
*/
|
|
267
|
-
function getNodeContainer(c, node) {
|
|
268
|
-
if (c.nodes.indexOf(node) > -1 || c.nodes.map(n => n.id).indexOf(node === null || node === void 0 ? void 0 : node.id) > -1) {
|
|
269
|
-
return c;
|
|
270
|
-
}
|
|
271
|
-
const cns = c.nodes.filter(n => isContainerNode(n));
|
|
272
|
-
const len = cns.length;
|
|
273
|
-
for (let i = 0; i < len; i++) {
|
|
274
|
-
const cn = getNodeContainer(cns[i], node);
|
|
275
|
-
if (cn != null) {
|
|
276
|
-
return cn;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
function getDefaultValue(value, node) {
|
|
282
|
-
let defaultValue = value && value.trim() != '' ? value : null;
|
|
283
|
-
if (defaultValue) {
|
|
284
|
-
switch (node.fieldType) {
|
|
285
|
-
case AjfFieldType.Boolean:
|
|
286
|
-
return defaultValue === 'true' || defaultValue === '1';
|
|
287
|
-
case AjfFieldType.MultipleChoice:
|
|
288
|
-
return [defaultValue];
|
|
289
|
-
case AjfFieldType.Number:
|
|
290
|
-
const v = +defaultValue;
|
|
291
|
-
return isNaN(v) ? 0 : v;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return defaultValue;
|
|
295
|
-
}
|
|
296
|
-
function buildFormBuilderNodesSubtree(nodes, parent, ignoreConditionalBranches = false) {
|
|
297
|
-
const entries = nodes
|
|
298
|
-
.filter(n => n.parent === parent.id)
|
|
299
|
-
.sort((n1, n2) => n1.parentNode - n2.parentNode)
|
|
300
|
-
.map(n => {
|
|
301
|
-
const children = buildFormBuilderNodesSubtree(nodes, n);
|
|
302
|
-
if (children.length === 0) {
|
|
303
|
-
children.push({ parent: n, parentNode: 0 });
|
|
304
|
-
}
|
|
305
|
-
return {
|
|
306
|
-
node: n,
|
|
307
|
-
children,
|
|
308
|
-
content: buildFormBuilderNodesContent(nodes, n),
|
|
309
|
-
};
|
|
310
|
-
});
|
|
311
|
-
if (!ignoreConditionalBranches) {
|
|
312
|
-
const entriesNum = entries.length;
|
|
313
|
-
const cbs = parent.conditionalBranches.length;
|
|
314
|
-
for (let i = entriesNum; i < cbs; i++) {
|
|
315
|
-
entries.push({ parent: parent, parentNode: i });
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return entries;
|
|
319
|
-
}
|
|
320
|
-
function buildFormBuilderNodesContent(_nodes, node) {
|
|
321
|
-
if (isContainerNode(node)) {
|
|
322
|
-
return buildFormBuilderNodesSubtree(node.nodes, node, true);
|
|
323
|
-
}
|
|
324
|
-
return [];
|
|
325
|
-
}
|
|
326
|
-
function flattenNodes(nodes) {
|
|
327
|
-
let flatNodes = [];
|
|
328
|
-
nodes.forEach((node) => {
|
|
329
|
-
if (isContainerNode(node)) {
|
|
330
|
-
flatNodes = flatNodes.concat(flattenNodes(node.nodes));
|
|
331
|
-
}
|
|
332
|
-
flatNodes.push(node);
|
|
333
|
-
});
|
|
334
|
-
return flatNodes;
|
|
335
|
-
}
|
|
336
|
-
function getDescendants(flatNodes, parentNode, branch = null) {
|
|
337
|
-
return branch != null
|
|
338
|
-
? flatNodes.filter(n => n.parent === parentNode.id && n.parentNode === branch)
|
|
339
|
-
: flatNodes.filter(n => n.parent === parentNode.id);
|
|
340
|
-
}
|
|
341
|
-
function removeNodes(nodes, ids) {
|
|
342
|
-
const len = nodes.length;
|
|
343
|
-
for (let i = 0; i < len; i++) {
|
|
344
|
-
const node = nodes[i];
|
|
345
|
-
if (isContainerNode(node)) {
|
|
346
|
-
const container = node;
|
|
347
|
-
container.nodes = removeNodes(container.nodes, ids);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return nodes.filter(n => ids.indexOf(n.id) === -1);
|
|
351
|
-
}
|
|
352
|
-
function deleteNodeSubtree(nodes, parentNode, branch = null) {
|
|
353
|
-
const flatNodes = flattenNodes(nodes);
|
|
354
|
-
let delNodes = [];
|
|
355
|
-
let descendants = getDescendants(flatNodes, parentNode, branch);
|
|
356
|
-
const len = descendants.length;
|
|
357
|
-
for (let i = 0; i < len; i++) {
|
|
358
|
-
delNodes = delNodes.concat(getDescendants(flatNodes, descendants[i]));
|
|
359
|
-
}
|
|
360
|
-
delNodes = delNodes.concat(descendants);
|
|
361
|
-
return removeNodes(nodes, delNodes.map(n => n.id));
|
|
362
|
-
}
|
|
363
|
-
let nodeUniqueId = 0;
|
|
364
|
-
class AjfFormBuilderService {
|
|
365
|
-
constructor() {
|
|
366
|
-
this._availableNodeTypes = [
|
|
367
|
-
{
|
|
368
|
-
label: 'Slide',
|
|
369
|
-
nodeType: { node: AjfNodeType.AjfSlide },
|
|
370
|
-
isSlide: true,
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
label: 'Repeating slide',
|
|
374
|
-
nodeType: { node: AjfNodeType.AjfRepeatingSlide },
|
|
375
|
-
isSlide: true,
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
label: 'String',
|
|
379
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.String },
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
label: 'Text',
|
|
383
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Text },
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
label: 'Number',
|
|
387
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Number },
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
label: 'Boolean',
|
|
391
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Boolean },
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
label: 'Single choice',
|
|
395
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.SingleChoice },
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
label: 'Multiple choice',
|
|
399
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.MultipleChoice },
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
label: 'Formula',
|
|
403
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Formula },
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
label: 'Date',
|
|
407
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Date },
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
label: 'Date input',
|
|
411
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.DateInput },
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
label: 'Time',
|
|
415
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Time },
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
label: 'Table',
|
|
419
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Table },
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
label: 'Geolocation',
|
|
423
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Geolocation },
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
label: 'Barcode',
|
|
427
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Barcode },
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
label: 'Signature',
|
|
431
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Signature },
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
label: 'File',
|
|
435
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.File },
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
label: 'Image',
|
|
439
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Image },
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
label: 'Range',
|
|
443
|
-
nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Range },
|
|
444
|
-
},
|
|
445
|
-
];
|
|
446
|
-
this._form = new BehaviorSubject(null);
|
|
447
|
-
this._formObs = this._form;
|
|
448
|
-
this._attachmentsOrigins = of([]);
|
|
449
|
-
this._choicesOrigins = of([]);
|
|
450
|
-
this._stringIdentifier = of([]);
|
|
451
|
-
this._nodesWithoutChoiceOrigins = of([]);
|
|
452
|
-
this._nodes = of([]);
|
|
453
|
-
this._flatFields = of([]);
|
|
454
|
-
this._nodeEntriesTree = of([]);
|
|
455
|
-
/**
|
|
456
|
-
* A list of the ids of the dropLists connected to the source list.
|
|
457
|
-
*/
|
|
458
|
-
this._connectedDropLists = new BehaviorSubject([]);
|
|
459
|
-
/**
|
|
460
|
-
* A dictionary of the 'expanded' status of all nodeEntries in the tree {node.name: boolean}
|
|
461
|
-
*/
|
|
462
|
-
this._nodeEntriesTreeExpandedStatus = new BehaviorSubject({});
|
|
463
|
-
/**
|
|
464
|
-
* Determines the default expanded state of nodeEntries when the FormBuilder loads
|
|
465
|
-
*/
|
|
466
|
-
this._defaultExpanded = false;
|
|
467
|
-
this._editedNodeEntry = new BehaviorSubject(null);
|
|
468
|
-
this._editedNodeEntryObs = this
|
|
469
|
-
._editedNodeEntry;
|
|
470
|
-
this._editedCondition = new BehaviorSubject(null);
|
|
471
|
-
this._editedConditionObs = this
|
|
472
|
-
._editedCondition;
|
|
473
|
-
this._editedChoicesOrigin = new BehaviorSubject(null);
|
|
474
|
-
this._editedChoicesOriginObs = this
|
|
475
|
-
._editedChoicesOrigin;
|
|
476
|
-
this._beforeNodesUpdate = new EventEmitter();
|
|
477
|
-
this._beforeNodesUpdateObs = this._beforeNodesUpdate;
|
|
478
|
-
this._afterNodeUpdate = new EventEmitter();
|
|
479
|
-
this._afterNodeUpdateObs = this._afterNodeUpdate;
|
|
480
|
-
this._nodesUpdates = new Subject();
|
|
481
|
-
this._attachmentsOriginsUpdates = new Subject();
|
|
482
|
-
this._choicesOriginsUpdates = new Subject();
|
|
483
|
-
this._stringIdentifierUpdates = new Subject();
|
|
484
|
-
this._saveNodeEntryEvent = new EventEmitter();
|
|
485
|
-
this._deleteNodeEntryEvent = new EventEmitter();
|
|
486
|
-
/**
|
|
487
|
-
* Event fired when the position of a node in a tree changes.
|
|
488
|
-
*/
|
|
489
|
-
this._moveNodeEntryEvent = new EventEmitter();
|
|
490
|
-
/**
|
|
491
|
-
* Subscribes to the moveNodeEntryEvent event emitter;
|
|
492
|
-
*/
|
|
493
|
-
this._moveNodeSub = Subscription.EMPTY;
|
|
494
|
-
/**
|
|
495
|
-
* Counters for default name assigned to inserted fields/slides
|
|
496
|
-
*/
|
|
497
|
-
this._emptyFieldCounter = 1;
|
|
498
|
-
this._emptySlideCounter = 1;
|
|
499
|
-
this._initChoicesOriginsStreams();
|
|
500
|
-
this._initAttachmentsOriginsStreams();
|
|
501
|
-
this._initStringIdentifierStreams();
|
|
502
|
-
this._initNodesStreams();
|
|
503
|
-
this._initFormStreams();
|
|
504
|
-
this._initSaveNode();
|
|
505
|
-
this._initMoveNode();
|
|
506
|
-
this._initDeleteNode();
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* Available node types
|
|
510
|
-
*
|
|
511
|
-
* @readonly
|
|
512
|
-
* @memberOf AjfFormBuilderService
|
|
513
|
-
*/
|
|
514
|
-
get availableNodeTypes() {
|
|
515
|
-
return this._availableNodeTypes;
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Current edited form stream
|
|
519
|
-
*
|
|
520
|
-
* @readonly
|
|
521
|
-
* @memberOf AjfFormBuilderService
|
|
522
|
-
*/
|
|
523
|
-
get form() {
|
|
524
|
-
return this._formObs;
|
|
525
|
-
}
|
|
526
|
-
get attachmentsOrigins() {
|
|
527
|
-
return this._attachmentsOrigins;
|
|
528
|
-
}
|
|
529
|
-
get choicesOrigins() {
|
|
530
|
-
return this._choicesOrigins;
|
|
531
|
-
}
|
|
532
|
-
get stringIdentifier() {
|
|
533
|
-
return this._stringIdentifier;
|
|
534
|
-
}
|
|
535
|
-
get nodes() {
|
|
536
|
-
return this._nodes;
|
|
537
|
-
}
|
|
538
|
-
get flatNodes() {
|
|
539
|
-
return this._flatNodes;
|
|
540
|
-
}
|
|
541
|
-
get flatFields() {
|
|
542
|
-
return this._flatFields;
|
|
543
|
-
}
|
|
544
|
-
get nodeEntriesTree() {
|
|
545
|
-
return this._nodeEntriesTree;
|
|
546
|
-
}
|
|
547
|
-
get connectedDropLists() {
|
|
548
|
-
return this._connectedDropLists;
|
|
549
|
-
}
|
|
550
|
-
get nodeEntriesTreeExpandedStatus() {
|
|
551
|
-
return this._nodeEntriesTreeExpandedStatus;
|
|
552
|
-
}
|
|
553
|
-
get editedNodeEntry() {
|
|
554
|
-
return this._editedNodeEntryObs;
|
|
555
|
-
}
|
|
556
|
-
get editedCondition() {
|
|
557
|
-
return this._editedConditionObs;
|
|
558
|
-
}
|
|
559
|
-
get editedChoicesOrigin() {
|
|
560
|
-
return this._editedChoicesOriginObs;
|
|
561
|
-
}
|
|
562
|
-
get beforeNodesUpdate() {
|
|
563
|
-
return this._beforeNodesUpdateObs;
|
|
564
|
-
}
|
|
565
|
-
get afterNodeUpdate() {
|
|
566
|
-
return this._afterNodeUpdateObs;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Sets the current edited form
|
|
570
|
-
*
|
|
571
|
-
* @param form
|
|
572
|
-
*
|
|
573
|
-
* @memberOf AjfFormBuilderService
|
|
574
|
-
*/
|
|
575
|
-
setForm(form) {
|
|
576
|
-
if (form !== this._form.getValue()) {
|
|
577
|
-
this._form.next(form);
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
editNodeEntry(nodeEntry) {
|
|
581
|
-
this._editedNodeEntry.next(nodeEntry);
|
|
582
|
-
}
|
|
583
|
-
editCondition(condition) {
|
|
584
|
-
this._editedCondition.next(condition);
|
|
585
|
-
}
|
|
586
|
-
saveCurrentCondition(condition) {
|
|
587
|
-
let c = this._editedCondition.getValue();
|
|
588
|
-
if (c == null) {
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
c.condition = condition;
|
|
592
|
-
this._editedCondition.next(null);
|
|
593
|
-
}
|
|
594
|
-
cancelConditionEdit() {
|
|
595
|
-
this._editedChoicesOrigin.next(null);
|
|
596
|
-
}
|
|
597
|
-
assignListId(node, empty = false) {
|
|
598
|
-
if (node.nodeType === AjfNodeType.AjfSlide || node.nodeType === AjfNodeType.AjfRepeatingSlide) {
|
|
599
|
-
const listId = empty ? `empty_fields_list_${node.id}` : `fields_list_${node.id}`;
|
|
600
|
-
if (this._connectedDropLists.value.indexOf(listId) == -1) {
|
|
601
|
-
this._connectDropList(listId);
|
|
602
|
-
}
|
|
603
|
-
return listId;
|
|
604
|
-
}
|
|
605
|
-
return '';
|
|
606
|
-
}
|
|
607
|
-
insertNode(nodeType, parent, parentNode, inContent = false, insertInIndex = 0) {
|
|
608
|
-
var _a;
|
|
609
|
-
let node;
|
|
610
|
-
const id = ++nodeUniqueId;
|
|
611
|
-
const isFieldNode = ((_a = nodeType.nodeType) === null || _a === void 0 ? void 0 : _a.field) != null;
|
|
612
|
-
if (isFieldNode) {
|
|
613
|
-
node = createField({
|
|
614
|
-
id,
|
|
615
|
-
nodeType: AjfNodeType.AjfField,
|
|
616
|
-
fieldType: nodeType.nodeType.field,
|
|
617
|
-
parent: parent.id,
|
|
618
|
-
parentNode,
|
|
619
|
-
name: `new_field_${this._emptyFieldCounter}`,
|
|
620
|
-
label: `New ${AjfFieldType[nodeType.nodeType.field]} field ${this._emptyFieldCounter}`,
|
|
621
|
-
});
|
|
622
|
-
this._emptyFieldCounter++;
|
|
623
|
-
}
|
|
624
|
-
else {
|
|
625
|
-
node = createContainerNode({
|
|
626
|
-
id,
|
|
627
|
-
nodeType: nodeType.nodeType.node,
|
|
628
|
-
parent: 0,
|
|
629
|
-
parentNode,
|
|
630
|
-
name: `new_slide_${this._emptySlideCounter}`,
|
|
631
|
-
label: `New Slide ${this._emptySlideCounter}`,
|
|
632
|
-
nodes: [],
|
|
633
|
-
});
|
|
634
|
-
this._emptySlideCounter++;
|
|
635
|
-
}
|
|
636
|
-
this._beforeNodesUpdate.emit();
|
|
637
|
-
this._nodesUpdates.next((nodes) => {
|
|
638
|
-
const cn = isContainerNode(parent) && inContent
|
|
639
|
-
? parent
|
|
640
|
-
: getNodeContainer({ nodes }, parent);
|
|
641
|
-
if (!isFieldNode) {
|
|
642
|
-
let newNodes = nodes.slice(0);
|
|
643
|
-
newNodes.splice(insertInIndex, 0, node);
|
|
644
|
-
newNodes = this._updateNodesList(0, newNodes);
|
|
645
|
-
return newNodes;
|
|
646
|
-
}
|
|
647
|
-
else {
|
|
648
|
-
let newNodes = cn.nodes.slice(0);
|
|
649
|
-
newNodes.splice(insertInIndex, 0, node);
|
|
650
|
-
newNodes = this._updateNodesList(cn.id, newNodes);
|
|
651
|
-
cn.nodes = newNodes;
|
|
652
|
-
}
|
|
653
|
-
return nodes;
|
|
654
|
-
});
|
|
655
|
-
this.cancelNodeEntryEdit();
|
|
656
|
-
}
|
|
657
|
-
saveNodeEntry(properties) {
|
|
658
|
-
this._saveNodeEntryEvent.emit(properties);
|
|
659
|
-
}
|
|
660
|
-
cancelNodeEntryEdit() {
|
|
661
|
-
this._editedNodeEntry.next(null);
|
|
662
|
-
}
|
|
663
|
-
deleteNodeEntry(nodeEntry) {
|
|
664
|
-
this._deleteNodeEntryEvent.next(nodeEntry);
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Triggers the moveNode event when a node is moved in the formbuilder.
|
|
668
|
-
* @param nodeEntry The node to be moved.
|
|
669
|
-
*/
|
|
670
|
-
moveNodeEntry(nodeEntry, from, to) {
|
|
671
|
-
const moveEvent = { nodeEntry: nodeEntry, fromIndex: from, toIndex: to };
|
|
672
|
-
this._moveNodeEntryEvent.next(moveEvent);
|
|
673
|
-
this.cancelNodeEntryEdit();
|
|
674
|
-
}
|
|
675
|
-
getCurrentForm() {
|
|
676
|
-
return combineLatest([
|
|
677
|
-
this.form,
|
|
678
|
-
this._nodesWithoutChoiceOrigins,
|
|
679
|
-
this.attachmentsOrigins,
|
|
680
|
-
this.choicesOrigins,
|
|
681
|
-
this.stringIdentifier,
|
|
682
|
-
]).pipe(filter(([form]) => form != null), map(([form, nodes, attachmentsOrigins, choicesOrigins, stringIdentifier]) => {
|
|
683
|
-
const supplementaryInformations = (form || {}).supplementaryInformations;
|
|
684
|
-
return createForm({
|
|
685
|
-
choicesOrigins: [...choicesOrigins],
|
|
686
|
-
attachmentsOrigins: [...attachmentsOrigins],
|
|
687
|
-
stringIdentifier: [...(stringIdentifier || [])],
|
|
688
|
-
nodes: [...nodes],
|
|
689
|
-
supplementaryInformations,
|
|
690
|
-
});
|
|
691
|
-
}));
|
|
692
|
-
}
|
|
693
|
-
editChoicesOrigin(choicesOrigin) {
|
|
694
|
-
this._editedChoicesOrigin.next(choicesOrigin);
|
|
695
|
-
}
|
|
696
|
-
createChoicesOrigin() {
|
|
697
|
-
this._editedChoicesOrigin.next(createChoicesFixedOrigin({ name: '' }));
|
|
698
|
-
}
|
|
699
|
-
cancelChoicesOriginEdit() {
|
|
700
|
-
this._editedChoicesOrigin.next(null);
|
|
701
|
-
}
|
|
702
|
-
saveChoicesOrigin(params) {
|
|
703
|
-
const choicesOrigin = this._editedChoicesOrigin.getValue();
|
|
704
|
-
const choicesOriginPreviousName = choicesOrigin === null || choicesOrigin === void 0 ? void 0 : choicesOrigin.name;
|
|
705
|
-
if (choicesOrigin != null) {
|
|
706
|
-
choicesOrigin.label = params.label;
|
|
707
|
-
choicesOrigin.name = params.name;
|
|
708
|
-
if (isChoicesFixedOrigin(choicesOrigin)) {
|
|
709
|
-
choicesOrigin.choices = params.choices;
|
|
710
|
-
}
|
|
711
|
-
this._updateChoicesOriginRefInNodes(choicesOriginPreviousName, params.name);
|
|
712
|
-
this._choicesOriginsUpdates.next(choicesOrigins => {
|
|
713
|
-
const idx = choicesOrigins.indexOf(choicesOrigin);
|
|
714
|
-
if (idx > -1) {
|
|
715
|
-
choicesOrigins = [
|
|
716
|
-
...choicesOrigins.slice(0, idx),
|
|
717
|
-
choicesOrigin,
|
|
718
|
-
...choicesOrigins.slice(idx + 1),
|
|
719
|
-
];
|
|
720
|
-
}
|
|
721
|
-
else {
|
|
722
|
-
choicesOrigins = [...choicesOrigins, choicesOrigin];
|
|
723
|
-
}
|
|
724
|
-
return choicesOrigins;
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
this._editedChoicesOrigin.next(null);
|
|
728
|
-
}
|
|
729
|
-
saveStringIdentifier(identifier) {
|
|
730
|
-
this._stringIdentifierUpdates.next(() => [...identifier]);
|
|
731
|
-
}
|
|
732
|
-
/**
|
|
733
|
-
* Resets the nodeEntriesTreeExpandedStatus dictionary to an empty object.
|
|
734
|
-
*/
|
|
735
|
-
resetNodeEntriesTreeExpandedStatus() {
|
|
736
|
-
this._nodeEntriesTreeExpandedStatus.next({});
|
|
737
|
-
}
|
|
738
|
-
/**
|
|
739
|
-
* Gets the expanded status of an entry in the nodeEntriesTreeExpandedStatus dictionary
|
|
740
|
-
* @param nodeName The unique name of the nodeEntry
|
|
741
|
-
*/
|
|
742
|
-
getExpandedStatus(nodeName) {
|
|
743
|
-
return this._nodeEntriesTreeExpandedStatus.pipe(map(tree => {
|
|
744
|
-
if (nodeName in tree) {
|
|
745
|
-
return tree[nodeName];
|
|
746
|
-
}
|
|
747
|
-
return this._defaultExpanded;
|
|
748
|
-
}));
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Upserts an entry in the nodeEntriesTreeExpandedStatus dictionary
|
|
752
|
-
* @param nodeName The unique name of the nodeEntry
|
|
753
|
-
* @param expanded True if the nodeEntry is expanded
|
|
754
|
-
*/
|
|
755
|
-
updateExpandedStatus(nodeName, expanded) {
|
|
756
|
-
if (!nodeName)
|
|
757
|
-
return;
|
|
758
|
-
const dictValue = this._nodeEntriesTreeExpandedStatus.value;
|
|
759
|
-
this._nodeEntriesTreeExpandedStatus.next(Object.assign(Object.assign({}, dictValue), { [nodeName]: expanded }));
|
|
760
|
-
}
|
|
761
|
-
/**
|
|
762
|
-
* Removes an entry from the nodeEntriesTreeExpandedStatus dictionary
|
|
763
|
-
* @param nodeName The unique name of the nodeEntry
|
|
764
|
-
*/
|
|
765
|
-
removeExpandedStatus(nodeName) {
|
|
766
|
-
const dictValue = this._nodeEntriesTreeExpandedStatus.value;
|
|
767
|
-
delete dictValue[nodeName];
|
|
768
|
-
this._nodeEntriesTreeExpandedStatus.next(dictValue);
|
|
769
|
-
}
|
|
770
|
-
/**
|
|
771
|
-
* Sets expanded to true for each entry in the nodeEntriesTreeExpandedStatus dictionary
|
|
772
|
-
*/
|
|
773
|
-
expandAll() {
|
|
774
|
-
const dictValue = this._nodeEntriesTreeExpandedStatus.value;
|
|
775
|
-
for (let nodeName in dictValue) {
|
|
776
|
-
dictValue[nodeName] = true;
|
|
777
|
-
}
|
|
778
|
-
this._defaultExpanded = true;
|
|
779
|
-
this._nodeEntriesTreeExpandedStatus.next(dictValue);
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Sets expanded to false for each entry in the nodeEntriesTreeExpandedStatus dictionary
|
|
783
|
-
*/
|
|
784
|
-
collapseAll() {
|
|
785
|
-
const dictValue = this._nodeEntriesTreeExpandedStatus.value;
|
|
786
|
-
for (let nodeName in dictValue) {
|
|
787
|
-
dictValue[nodeName] = false;
|
|
788
|
-
}
|
|
789
|
-
this._defaultExpanded = false;
|
|
790
|
-
this._nodeEntriesTreeExpandedStatus.next(dictValue);
|
|
791
|
-
}
|
|
792
|
-
/**
|
|
793
|
-
* Resets the empty fields/slides counters
|
|
794
|
-
*/
|
|
795
|
-
resetEmptyCounters() {
|
|
796
|
-
this._emptyFieldCounter = 1;
|
|
797
|
-
this._emptySlideCounter = 1;
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Searches the form nodes for field nodes with choicesOriginRef corresponding
|
|
801
|
-
* to an edited choicesOrigin and updates it with the new name.
|
|
802
|
-
* @param previous_name The choicesOrigin previous name
|
|
803
|
-
* @param new_name The choicesOrigin new name
|
|
804
|
-
*/
|
|
805
|
-
_updateChoicesOriginRefInNodes(previous_name, new_name) {
|
|
806
|
-
if (!previous_name || !new_name)
|
|
807
|
-
return;
|
|
808
|
-
const currentForm = this._form.value;
|
|
809
|
-
if (!currentForm)
|
|
810
|
-
return;
|
|
811
|
-
const updatedNodes = [];
|
|
812
|
-
const currentSlides = currentForm.nodes;
|
|
813
|
-
for (let slide of currentSlides) {
|
|
814
|
-
if (!slide.nodes || !slide.nodes.length)
|
|
815
|
-
continue;
|
|
816
|
-
for (let node of slide.nodes) {
|
|
817
|
-
const nodeObj = node;
|
|
818
|
-
if (nodeObj['choicesOriginRef'] && nodeObj['choicesOriginRef'] === previous_name) {
|
|
819
|
-
nodeObj['choicesOriginRef'] = new_name;
|
|
820
|
-
updatedNodes.push(nodeObj);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
this._nodesUpdates.next((_nodes) => {
|
|
825
|
-
return currentForm.nodes.slice(0);
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
_buildFormBuilderNodesTree(nodes) {
|
|
829
|
-
this._updateNodesList(0, nodes);
|
|
830
|
-
const rootNodes = nodes.filter(n => n.nodeType == AjfNodeType.AjfSlide || n.nodeType == AjfNodeType.AjfRepeatingSlide);
|
|
831
|
-
if (rootNodes.length === 0) {
|
|
832
|
-
return [null];
|
|
833
|
-
}
|
|
834
|
-
const rootNode = rootNodes[0];
|
|
835
|
-
if (isSlidesNode(rootNode)) {
|
|
836
|
-
const tree = [];
|
|
837
|
-
tree.push({
|
|
838
|
-
node: rootNode,
|
|
839
|
-
container: null,
|
|
840
|
-
children: buildFormBuilderNodesSubtree(nodes, rootNode),
|
|
841
|
-
content: buildFormBuilderNodesContent(nodes, rootNode),
|
|
842
|
-
});
|
|
843
|
-
return tree;
|
|
844
|
-
}
|
|
845
|
-
throw new Error('Invalid form definition');
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Adds the id of a dropList to be connected with the FormBuilder source list.
|
|
849
|
-
* @param listId The id of the list to connect.
|
|
850
|
-
*/
|
|
851
|
-
_connectDropList(listId) {
|
|
852
|
-
let connectedLists = this._connectedDropLists.value.slice(0);
|
|
853
|
-
this._connectedDropLists.next([...connectedLists, listId]);
|
|
854
|
-
}
|
|
855
|
-
_findMaxNodeId(nodes, _curMaxId = 0) {
|
|
856
|
-
let maxId = 0;
|
|
857
|
-
nodes.forEach(n => {
|
|
858
|
-
maxId = Math.max(maxId, n.id);
|
|
859
|
-
if (isContainerNode(n)) {
|
|
860
|
-
maxId = Math.max(maxId, this._findMaxNodeId(n.nodes));
|
|
861
|
-
}
|
|
862
|
-
});
|
|
863
|
-
return maxId;
|
|
864
|
-
}
|
|
865
|
-
_initFormStreams() {
|
|
866
|
-
this._form.subscribe((form) => {
|
|
867
|
-
nodeUniqueId = 0;
|
|
868
|
-
if (form != null && form.nodes != null && form.nodes.length > 0) {
|
|
869
|
-
nodeUniqueId = this._findMaxNodeId(form.nodes);
|
|
870
|
-
}
|
|
871
|
-
this._nodesUpdates.next((_nodes) => {
|
|
872
|
-
return form != null && form.nodes != null ? form.nodes.slice(0) : [];
|
|
873
|
-
});
|
|
874
|
-
this._attachmentsOriginsUpdates.next((_attachmentsOrigins) => {
|
|
875
|
-
return form != null && form.attachmentsOrigins != null
|
|
876
|
-
? form.attachmentsOrigins.slice(0)
|
|
877
|
-
: [];
|
|
878
|
-
});
|
|
879
|
-
this._choicesOriginsUpdates.next((_choicesOrigins) => {
|
|
880
|
-
return form != null && form.choicesOrigins != null ? form.choicesOrigins.slice(0) : [];
|
|
881
|
-
});
|
|
882
|
-
this._stringIdentifierUpdates.next((_) => {
|
|
883
|
-
return form != null && form.stringIdentifier != null
|
|
884
|
-
? form.stringIdentifier.slice(0)
|
|
885
|
-
: [];
|
|
886
|
-
});
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
_initChoicesOriginsStreams() {
|
|
890
|
-
this._choicesOrigins = (this._choicesOriginsUpdates).pipe(scan((choicesOrigins, op) => {
|
|
891
|
-
return op(choicesOrigins);
|
|
892
|
-
}, []), shareReplay(1));
|
|
893
|
-
}
|
|
894
|
-
_initAttachmentsOriginsStreams() {
|
|
895
|
-
this._attachmentsOrigins = this._attachmentsOriginsUpdates.pipe(scan((attachmentsOrigins, op) => {
|
|
896
|
-
return op(attachmentsOrigins);
|
|
897
|
-
}, []), shareReplay(1));
|
|
898
|
-
}
|
|
899
|
-
_initStringIdentifierStreams() {
|
|
900
|
-
this._stringIdentifier = this._stringIdentifierUpdates.pipe(scan((stringIdentifier, op) => {
|
|
901
|
-
return op(stringIdentifier);
|
|
902
|
-
}, []), shareReplay(1));
|
|
903
|
-
}
|
|
904
|
-
_initNodesStreams() {
|
|
905
|
-
this._nodes = this._nodesUpdates.pipe(scan((nodes, op) => {
|
|
906
|
-
return op(nodes);
|
|
907
|
-
}, []), shareReplay(1));
|
|
908
|
-
this._nodesWithoutChoiceOrigins = this._nodes.pipe(map(slides => slides.map(slide => {
|
|
909
|
-
slide.nodes = slide.nodes.map((node) => {
|
|
910
|
-
if (isFieldWithChoices(node)) {
|
|
911
|
-
const fwc = deepCopy(node);
|
|
912
|
-
if (fwc && fwc.choices) {
|
|
913
|
-
delete fwc.choices;
|
|
914
|
-
}
|
|
915
|
-
if (fwc && fwc.choicesOrigin) {
|
|
916
|
-
delete fwc.choicesOrigin;
|
|
917
|
-
}
|
|
918
|
-
return fwc;
|
|
919
|
-
}
|
|
920
|
-
return node;
|
|
921
|
-
});
|
|
922
|
-
return slide;
|
|
923
|
-
})));
|
|
924
|
-
this._flatNodes = this._nodes.pipe(map((nodes) => flattenNodes(nodes)), shareReplay(1));
|
|
925
|
-
this._flatFields = this._flatNodes.pipe(map((nodes) => nodes.filter(n => !isContainerNode(n))), shareReplay(1));
|
|
926
|
-
this._nodeEntriesTree = this._nodes.pipe(map(nodes => this._buildFormBuilderNodesTree(nodes)), shareReplay(1));
|
|
927
|
-
}
|
|
928
|
-
_initSaveNode() {
|
|
929
|
-
this._saveNodeEntryEvent
|
|
930
|
-
.pipe(withLatestFrom(this.editedNodeEntry, this.choicesOrigins, this.attachmentsOrigins), filter(([_, nodeEntry]) => nodeEntry != null), map(([properties, ne]) => {
|
|
931
|
-
this._beforeNodesUpdate.emit();
|
|
932
|
-
const nodeEntry = ne;
|
|
933
|
-
const origNode = nodeEntry.node;
|
|
934
|
-
const node = deepCopy(origNode);
|
|
935
|
-
node.id = nodeEntry.node.id;
|
|
936
|
-
node.name = properties.name;
|
|
937
|
-
node.label = properties.label;
|
|
938
|
-
node.visibility =
|
|
939
|
-
properties.visibility != null
|
|
940
|
-
? createCondition({ condition: properties.visibility })
|
|
941
|
-
: null;
|
|
942
|
-
const oldConditionalBranches = node.conditionalBranches.length;
|
|
943
|
-
node.conditionalBranches =
|
|
944
|
-
properties.conditionalBranches != null
|
|
945
|
-
? properties.conditionalBranches.map((condition) => createCondition({ condition }))
|
|
946
|
-
: [alwaysCondition()];
|
|
947
|
-
const newConditionalBranches = node.conditionalBranches.length;
|
|
948
|
-
if (isRepeatingContainerNode(node)) {
|
|
949
|
-
node.formulaReps =
|
|
950
|
-
properties.formulaReps != null
|
|
951
|
-
? createFormula({ formula: properties.formulaReps })
|
|
952
|
-
: undefined;
|
|
953
|
-
node.minReps = properties.minReps;
|
|
954
|
-
node.maxReps = properties.maxReps;
|
|
955
|
-
}
|
|
956
|
-
if (isField(node)) {
|
|
957
|
-
node.hint = properties.hint;
|
|
958
|
-
node.editable = !properties.readonlyField;
|
|
959
|
-
node.description = properties.description;
|
|
960
|
-
node.defaultValue = getDefaultValue(properties.defaultValue, node);
|
|
961
|
-
node.formula =
|
|
962
|
-
properties.formula != null ? createFormula({ formula: properties.formula }) : undefined;
|
|
963
|
-
const forceValue = properties.value;
|
|
964
|
-
const notEmpty = properties.notEmpty;
|
|
965
|
-
const validationConditions = properties.validationConditions;
|
|
966
|
-
let minValue = parseInt(properties.minValue, 10);
|
|
967
|
-
let maxValue = parseInt(properties.maxValue, 10);
|
|
968
|
-
let minDigits = parseInt(properties.minDigits, 10);
|
|
969
|
-
let maxDigits = parseInt(properties.maxDigits, 10);
|
|
970
|
-
if (isNaN(minValue)) {
|
|
971
|
-
minValue = null;
|
|
972
|
-
}
|
|
973
|
-
if (isNaN(maxValue)) {
|
|
974
|
-
maxValue = null;
|
|
975
|
-
}
|
|
976
|
-
if (isNaN(minDigits)) {
|
|
977
|
-
minDigits = null;
|
|
978
|
-
}
|
|
979
|
-
if (isNaN(maxDigits)) {
|
|
980
|
-
maxDigits = null;
|
|
981
|
-
}
|
|
982
|
-
if (forceValue != null ||
|
|
983
|
-
notEmpty != null ||
|
|
984
|
-
(validationConditions != null && validationConditions.length > 0) ||
|
|
985
|
-
minValue != null ||
|
|
986
|
-
maxValue != null ||
|
|
987
|
-
minDigits != null ||
|
|
988
|
-
maxDigits != null) {
|
|
989
|
-
const validation = node.validation || createValidationGroup({});
|
|
990
|
-
validation.forceValue = forceValue;
|
|
991
|
-
validation.notEmpty = notEmpty ? notEmptyValidation() : undefined;
|
|
992
|
-
validation.minValue = minValue != null ? minValidation(minValue) : undefined;
|
|
993
|
-
validation.maxValue = maxValue != null ? maxValidation(maxValue) : undefined;
|
|
994
|
-
validation.minDigits = minDigits != null ? minDigitsValidation(minDigits) : undefined;
|
|
995
|
-
validation.maxDigits = maxDigits != null ? maxDigitsValidation(maxDigits) : undefined;
|
|
996
|
-
validation.conditions = (validationConditions || []).map((c) => createValidation({
|
|
997
|
-
condition: c.condition,
|
|
998
|
-
errorMessage: c.errorMessage,
|
|
999
|
-
}));
|
|
1000
|
-
node.validation = validation;
|
|
1001
|
-
}
|
|
1002
|
-
else {
|
|
1003
|
-
node.validation = undefined;
|
|
1004
|
-
}
|
|
1005
|
-
const notEmptyWarn = properties.notEmptyWarning;
|
|
1006
|
-
const warningConditions = properties.warningConditions;
|
|
1007
|
-
if (notEmptyWarn != null ||
|
|
1008
|
-
(warningConditions != null && warningConditions.length > 0)) {
|
|
1009
|
-
const warning = node.warning || createWarningGroup({});
|
|
1010
|
-
warning.notEmpty = notEmptyWarn ? notEmptyWarning() : undefined;
|
|
1011
|
-
warning.conditions = (warningConditions || []).map((w) => createWarning({
|
|
1012
|
-
condition: w.condition,
|
|
1013
|
-
warningMessage: w.warningMessage,
|
|
1014
|
-
}));
|
|
1015
|
-
node.warning = warning;
|
|
1016
|
-
}
|
|
1017
|
-
else {
|
|
1018
|
-
node.warning = undefined;
|
|
1019
|
-
}
|
|
1020
|
-
node.nextSlideCondition =
|
|
1021
|
-
properties.nextSlideCondition != null
|
|
1022
|
-
? createCondition({ condition: properties.nextSlideCondition })
|
|
1023
|
-
: undefined;
|
|
1024
|
-
node.size = properties.size;
|
|
1025
|
-
if (isFieldWithChoices(node)) {
|
|
1026
|
-
node.choicesOriginRef = properties.choicesOriginRef;
|
|
1027
|
-
node.forceExpanded = properties.forceExpanded;
|
|
1028
|
-
node.forceNarrow = properties.forceNarrow;
|
|
1029
|
-
node.triggerConditions = (properties.triggerConditions || []).map((t) => createCondition({ condition: t }));
|
|
1030
|
-
}
|
|
1031
|
-
if (isRangeField(node)) {
|
|
1032
|
-
node.start = properties.start;
|
|
1033
|
-
node.end = properties.end;
|
|
1034
|
-
node.step = properties.step;
|
|
1035
|
-
}
|
|
1036
|
-
if (isTableField(node)) {
|
|
1037
|
-
let { columnTypes, rows, columnLabels, rowLabels } = JSON.parse(properties.tableDef);
|
|
1038
|
-
node.columnTypes = columnTypes || [];
|
|
1039
|
-
node.rows = rows || [];
|
|
1040
|
-
node.columnLabels = columnLabels || [];
|
|
1041
|
-
node.rowLabels = rowLabels || [];
|
|
1042
|
-
node.hideEmptyRows = properties.hideEmptyRows;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
this._editedNodeEntry.next(null);
|
|
1046
|
-
return (nodes) => {
|
|
1047
|
-
let cn = getNodeContainer({ nodes }, origNode);
|
|
1048
|
-
if (cn != null) {
|
|
1049
|
-
// TODO: @trik check this, was always true?
|
|
1050
|
-
// if (cn instanceof AjfNode) {
|
|
1051
|
-
const replaceNodes = cn.nodes === nodes;
|
|
1052
|
-
const idx = cn.nodes.map(n => n.id).indexOf(origNode.id);
|
|
1053
|
-
let newNodes = cn.nodes.slice(0, idx);
|
|
1054
|
-
newNodes.push(node);
|
|
1055
|
-
newNodes = newNodes.concat(cn.nodes.slice(idx + 1));
|
|
1056
|
-
cn.nodes = newNodes;
|
|
1057
|
-
if (replaceNodes) {
|
|
1058
|
-
nodes = newNodes;
|
|
1059
|
-
}
|
|
1060
|
-
else {
|
|
1061
|
-
nodes = nodes.slice(0);
|
|
1062
|
-
}
|
|
1063
|
-
// } else {
|
|
1064
|
-
// const idx = nodes.indexOf(origNode);
|
|
1065
|
-
// nodes = nodes.slice(0, idx).concat([node]).concat(nodes.slice(idx + 1));
|
|
1066
|
-
// }
|
|
1067
|
-
if (newConditionalBranches < oldConditionalBranches) {
|
|
1068
|
-
for (let i = newConditionalBranches; i < oldConditionalBranches; i++) {
|
|
1069
|
-
nodes = deleteNodeSubtree(nodes, node, i);
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
return nodes;
|
|
1074
|
-
};
|
|
1075
|
-
}))
|
|
1076
|
-
.subscribe(this._nodesUpdates);
|
|
1077
|
-
}
|
|
1078
|
-
_initDeleteNode() {
|
|
1079
|
-
this._deleteNodeEntryEvent
|
|
1080
|
-
.pipe(map((nodeEntry) => {
|
|
1081
|
-
this._beforeNodesUpdate.emit();
|
|
1082
|
-
this.removeExpandedStatus(nodeEntry.node.name);
|
|
1083
|
-
return (nodes) => {
|
|
1084
|
-
const node = nodeEntry.node;
|
|
1085
|
-
let cn = getNodeContainer({ nodes }, node);
|
|
1086
|
-
if (cn != null) {
|
|
1087
|
-
const replaceNodes = cn.nodes === nodes;
|
|
1088
|
-
const idx = cn.nodes.map(n => n.id).indexOf(node.id);
|
|
1089
|
-
let newNodes = cn.nodes.slice(0, idx);
|
|
1090
|
-
newNodes = newNodes.concat(cn.nodes.slice(idx + 1));
|
|
1091
|
-
cn.nodes = newNodes;
|
|
1092
|
-
if (replaceNodes) {
|
|
1093
|
-
nodes = newNodes;
|
|
1094
|
-
}
|
|
1095
|
-
else {
|
|
1096
|
-
nodes = nodes.slice(0);
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
return nodes;
|
|
1100
|
-
};
|
|
1101
|
-
}))
|
|
1102
|
-
.subscribe(this._nodesUpdates);
|
|
1103
|
-
}
|
|
1104
|
-
/**
|
|
1105
|
-
* Initializes the subscription to the moveNodeEntryEvent.
|
|
1106
|
-
*/
|
|
1107
|
-
_initMoveNode() {
|
|
1108
|
-
this._moveNodeSub.unsubscribe();
|
|
1109
|
-
this._moveNodeSub = this._moveNodeEntryEvent
|
|
1110
|
-
.pipe(map((moveEvent) => {
|
|
1111
|
-
this._beforeNodesUpdate.emit();
|
|
1112
|
-
return (nodes) => {
|
|
1113
|
-
const nodeEntry = moveEvent.nodeEntry;
|
|
1114
|
-
const node = nodeEntry.node;
|
|
1115
|
-
let cn = getNodeContainer({ nodes }, node);
|
|
1116
|
-
let newNodes = nodes;
|
|
1117
|
-
if (cn != null) {
|
|
1118
|
-
const replaceNodes = cn.nodes === nodes;
|
|
1119
|
-
newNodes = cn.nodes;
|
|
1120
|
-
moveItemInArray(newNodes, moveEvent.fromIndex, moveEvent.toIndex);
|
|
1121
|
-
newNodes = this._updateNodesList(cn.id, newNodes);
|
|
1122
|
-
cn.nodes = newNodes;
|
|
1123
|
-
if (replaceNodes) {
|
|
1124
|
-
nodes = newNodes;
|
|
1125
|
-
}
|
|
1126
|
-
else {
|
|
1127
|
-
nodes = nodes.slice(0);
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
return nodes;
|
|
1131
|
-
};
|
|
1132
|
-
}))
|
|
1133
|
-
.subscribe(this._nodesUpdates);
|
|
1134
|
-
}
|
|
1135
|
-
/**
|
|
1136
|
-
* Updates the "id" and "parent" fields of a modified or rearranged list of nodes.
|
|
1137
|
-
* @param containerId The id of the parent container of the list.
|
|
1138
|
-
* @param nodesList The list of nodes to be updated.
|
|
1139
|
-
*/
|
|
1140
|
-
_updateNodesList(containerId, nodesList) {
|
|
1141
|
-
if (!nodesList.length) {
|
|
1142
|
-
return [];
|
|
1143
|
-
}
|
|
1144
|
-
const contId = containerId != undefined ? containerId : 0;
|
|
1145
|
-
for (let idx = 0; idx < nodesList.length; idx++) {
|
|
1146
|
-
let currentNode = nodesList[idx];
|
|
1147
|
-
currentNode.id = contId * 1000 + idx + 1;
|
|
1148
|
-
currentNode.parent = idx == 0 ? contId : contId * 1000 + idx;
|
|
1149
|
-
if (isSlidesNode(currentNode)) {
|
|
1150
|
-
this._updateNodesList(currentNode.id, currentNode.nodes);
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
return nodesList;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
AjfFormBuilderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFormBuilderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1157
|
-
AjfFormBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFormBuilderService });
|
|
1158
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFormBuilderService, decorators: [{
|
|
1159
|
-
type: Injectable
|
|
1160
|
-
}], ctorParameters: function () { return []; } });
|
|
1161
|
-
|
|
1162
|
-
class AjfFbChoicesOriginEditorDialog {
|
|
1163
|
-
constructor(_service) {
|
|
1164
|
-
this._service = _service;
|
|
1165
|
-
this._choicesOrigin = this._service.editedChoicesOrigin.pipe(filter(c => c != null), map(c => c));
|
|
1166
|
-
}
|
|
1167
|
-
get choicesOrigin() {
|
|
1168
|
-
return this._choicesOrigin;
|
|
1169
|
-
}
|
|
1170
|
-
saveChoicesOrigin() {
|
|
1171
|
-
this._service.saveChoicesOrigin({
|
|
1172
|
-
label: this.editor.label,
|
|
1173
|
-
name: this.editor.name,
|
|
1174
|
-
choices: this.editor.choicesArr,
|
|
1175
|
-
});
|
|
1176
|
-
}
|
|
1177
|
-
cancelChoicesOriginEdit() {
|
|
1178
|
-
this._service.cancelChoicesOriginEdit();
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
AjfFbChoicesOriginEditorDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbChoicesOriginEditorDialog, deps: [{ token: AjfFormBuilderService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1182
|
-
AjfFbChoicesOriginEditorDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbChoicesOriginEditorDialog, selector: "ajf-fb-choices-origin-editor-dialog", viewQueries: [{ propertyName: "editor", first: true, predicate: AjfFbChoicesOriginEditor, descendants: true }], ngImport: i0, template: "<h3 matDialogTitle>{{'Edit choices origin'|transloco}}</h3>\n<mat-dialog-content>\n <ajf-fb-choices-origin-editor\n *ngIf=\"choicesOrigin|async as co\"\n [choicesOrigin]=\"co!\"\n ></ajf-fb-choices-origin-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveChoicesOrigin()\">{{'Save'|transloco}}</button>\n <button mat-button (click)=\"cancelChoicesOriginEdit()\">\n {{'Close'|transloco}}\n </button>\n</mat-dialog-actions>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: AjfFbChoicesOriginEditor, selector: "ajf-fb-choices-origin-editor", inputs: ["choicesOrigin"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbChoicesOriginEditorDialog, decorators: [{
|
|
1184
|
-
type: Component,
|
|
1185
|
-
args: [{ selector: 'ajf-fb-choices-origin-editor-dialog', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<h3 matDialogTitle>{{'Edit choices origin'|transloco}}</h3>\n<mat-dialog-content>\n <ajf-fb-choices-origin-editor\n *ngIf=\"choicesOrigin|async as co\"\n [choicesOrigin]=\"co!\"\n ></ajf-fb-choices-origin-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveChoicesOrigin()\">{{'Save'|transloco}}</button>\n <button mat-button (click)=\"cancelChoicesOriginEdit()\">\n {{'Close'|transloco}}\n </button>\n</mat-dialog-actions>\n" }]
|
|
1186
|
-
}], ctorParameters: function () { return [{ type: AjfFormBuilderService }]; }, propDecorators: { editor: [{
|
|
1187
|
-
type: ViewChild,
|
|
1188
|
-
args: [AjfFbChoicesOriginEditor, { static: false }]
|
|
1189
|
-
}] } });
|
|
1190
|
-
|
|
1191
|
-
class AjfFbConditionEditor {
|
|
1192
|
-
constructor(_) {
|
|
1193
|
-
this._fields = [];
|
|
1194
|
-
this.condition = '';
|
|
1195
|
-
this.formulaEditorControl = new FormControl(this.condition);
|
|
1196
|
-
}
|
|
1197
|
-
get fields() {
|
|
1198
|
-
return this._fields;
|
|
1199
|
-
}
|
|
1200
|
-
set fields(fields) {
|
|
1201
|
-
this._fields = fields;
|
|
1202
|
-
}
|
|
1203
|
-
ngAfterViewInit() {
|
|
1204
|
-
this.formulaEditorControl.setValue(this.condition);
|
|
1205
|
-
}
|
|
1206
|
-
insertVariable(variable) {
|
|
1207
|
-
const currValue = this.formulaEditorControl.value != null ? this.formulaEditorControl.value : '';
|
|
1208
|
-
const newValue = currValue + variable;
|
|
1209
|
-
this.formulaEditorControl.setValue(newValue);
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
AjfFbConditionEditor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbConditionEditor, deps: [{ token: i1.AjfValidationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1213
|
-
AjfFbConditionEditor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbConditionEditor, selector: "ajf-condition-editor", inputs: { fields: "fields", condition: "condition" }, ngImport: i0, template: "<div class=\"ajf-editor\">\n <mat-form-field class=\"ajf-formula-editor\">\n <code><input matInput type=\"text\" [formControl]=\"formulaEditorControl\" /></code>\n </mat-form-field>\n</div>\n<div class=\"ajf-editor-panel\">\n <ng-container *ngIf=\"fields as curFields\">\n <mat-nav-list dense *ngIf=\"curFields!.length > 0\">\n <a\n mat-list-item\n (click)=\"insertVariable(field.name)\"\n [matTooltip]=\"field.label\"\n *ngFor=\"let field of curFields!\"\n >\n <ajf-node-icon [node]=\"field\"></ajf-node-icon>\n {{ field.name }}\n </a>\n </mat-nav-list>\n </ng-container>\n</div>\n", styles: ["ajf-condition-editor{display:flex;flex-direction:row;align-items:stretch;max-height:512px}ajf-condition-editor .ajf-editor{flex:.75 0 auto;display:flex;flex-direction:row;align-items:stretch}ajf-condition-editor .ajf-editor-panel{flex:.25 0 auto;overflow-y:auto}ajf-condition-editor .ajf-editor-panel .mat-mdc-nav-list{max-height:30vh;overflow-y:auto}ajf-condition-editor .ajf-formula-editor{min-width:40vw}\n"], dependencies: [{ kind: "component", type: i2$1.AjfNodeIcon, selector: "ajf-node-icon" }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i7$1.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: i7$1.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: i8.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1214
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbConditionEditor, decorators: [{
|
|
1215
|
-
type: Component,
|
|
1216
|
-
args: [{ selector: 'ajf-condition-editor', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div class=\"ajf-editor\">\n <mat-form-field class=\"ajf-formula-editor\">\n <code><input matInput type=\"text\" [formControl]=\"formulaEditorControl\" /></code>\n </mat-form-field>\n</div>\n<div class=\"ajf-editor-panel\">\n <ng-container *ngIf=\"fields as curFields\">\n <mat-nav-list dense *ngIf=\"curFields!.length > 0\">\n <a\n mat-list-item\n (click)=\"insertVariable(field.name)\"\n [matTooltip]=\"field.label\"\n *ngFor=\"let field of curFields!\"\n >\n <ajf-node-icon [node]=\"field\"></ajf-node-icon>\n {{ field.name }}\n </a>\n </mat-nav-list>\n </ng-container>\n</div>\n", styles: ["ajf-condition-editor{display:flex;flex-direction:row;align-items:stretch;max-height:512px}ajf-condition-editor .ajf-editor{flex:.75 0 auto;display:flex;flex-direction:row;align-items:stretch}ajf-condition-editor .ajf-editor-panel{flex:.25 0 auto;overflow-y:auto}ajf-condition-editor .ajf-editor-panel .mat-mdc-nav-list{max-height:30vh;overflow-y:auto}ajf-condition-editor .ajf-formula-editor{min-width:40vw}\n"] }]
|
|
1217
|
-
}], ctorParameters: function () { return [{ type: i1.AjfValidationService }]; }, propDecorators: { fields: [{
|
|
1218
|
-
type: Input
|
|
1219
|
-
}], condition: [{
|
|
1220
|
-
type: Input
|
|
1221
|
-
}] } });
|
|
1222
|
-
|
|
1223
|
-
class AjfFbConditionEditorDialog {
|
|
1224
|
-
constructor(service, dialogRef) {
|
|
1225
|
-
this.dialogRef = dialogRef;
|
|
1226
|
-
this.condition = '';
|
|
1227
|
-
this._fields = service.flatFields.pipe(map((fields) => fields.sort((f1, f2) => f1.name.localeCompare(f2.name))));
|
|
1228
|
-
}
|
|
1229
|
-
get fields() {
|
|
1230
|
-
return this._fields;
|
|
1231
|
-
}
|
|
1232
|
-
saveCondition() {
|
|
1233
|
-
if (this.editor == null) {
|
|
1234
|
-
return;
|
|
1235
|
-
}
|
|
1236
|
-
const newValue = this.editor.formulaEditorControl.value;
|
|
1237
|
-
this.dialogRef.close(newValue);
|
|
1238
|
-
}
|
|
1239
|
-
closeDialog() {
|
|
1240
|
-
this.dialogRef.close(this.editor.formulaEditorControl.value);
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
AjfFbConditionEditorDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbConditionEditorDialog, deps: [{ token: AjfFormBuilderService }, { token: i2.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1244
|
-
AjfFbConditionEditorDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbConditionEditorDialog, selector: "ajf-condition-editor-dialog", viewQueries: [{ propertyName: "editor", first: true, predicate: AjfFbConditionEditor, descendants: true }], ngImport: i0, template: "<h3 matDialogTitle>{{'Edit condition'|transloco}}</h3>\n<mat-dialog-content>\n <ajf-condition-editor\n *ngIf=\"fields|async as curFields\"\n [fields]=\"curFields!\"\n [condition]=\"condition\"\n ></ajf-condition-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveCondition()\">{{'Save'|transloco}}</button>\n <button mat-button (click)=\"closeDialog()\">{{'Close'|transloco}}</button>\n</mat-dialog-actions>\n", styles: ["ajf-condition-editor-dialog .mat-mdc-dialog-content{overflow:visible}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: AjfFbConditionEditor, selector: "ajf-condition-editor", inputs: ["fields", "condition"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1245
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbConditionEditorDialog, decorators: [{
|
|
1246
|
-
type: Component,
|
|
1247
|
-
args: [{ selector: 'ajf-condition-editor-dialog', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<h3 matDialogTitle>{{'Edit condition'|transloco}}</h3>\n<mat-dialog-content>\n <ajf-condition-editor\n *ngIf=\"fields|async as curFields\"\n [fields]=\"curFields!\"\n [condition]=\"condition\"\n ></ajf-condition-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveCondition()\">{{'Save'|transloco}}</button>\n <button mat-button (click)=\"closeDialog()\">{{'Close'|transloco}}</button>\n</mat-dialog-actions>\n", styles: ["ajf-condition-editor-dialog .mat-mdc-dialog-content{overflow:visible}\n"] }]
|
|
1248
|
-
}], ctorParameters: function () { return [{ type: AjfFormBuilderService }, { type: i2.MatDialogRef }]; }, propDecorators: { editor: [{
|
|
1249
|
-
type: ViewChild,
|
|
1250
|
-
args: [AjfFbConditionEditor, { static: false }]
|
|
1251
|
-
}] } });
|
|
1252
|
-
|
|
1253
|
-
/**
|
|
1254
|
-
* @license
|
|
1255
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
1256
|
-
*
|
|
1257
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
1258
|
-
*
|
|
1259
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
1260
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
1261
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
1262
|
-
* or (at your option) any later version.
|
|
1263
|
-
*
|
|
1264
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
1265
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1266
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
1267
|
-
* General Public License for more details.
|
|
1268
|
-
*
|
|
1269
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
1270
|
-
* along with Advanced JSON forms (ajf).
|
|
1271
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
1272
|
-
*
|
|
1273
|
-
*/
|
|
1274
|
-
/**
|
|
1275
|
-
* Triggers when a field or slide node is moved or inserted by drag&dropping in the formbuilder.
|
|
1276
|
-
* @param event The drop event.
|
|
1277
|
-
* @param fbService The AjfFormBuilderService.
|
|
1278
|
-
* @param nodeEntry The current nodeEntry, if present.
|
|
1279
|
-
* @param content True if the current nodeEntry contains other nodeEntries.
|
|
1280
|
-
*/
|
|
1281
|
-
function onDropProcess(event, fbService, nodeEntry, content = false) {
|
|
1282
|
-
const itemData = event.item.data;
|
|
1283
|
-
const containerId = event.container.id;
|
|
1284
|
-
if (!itemData.node) {
|
|
1285
|
-
if (nodeEntry == null && containerId === 'slides-list') {
|
|
1286
|
-
fbService.insertNode(itemData, null, 0, content, event.currentIndex);
|
|
1287
|
-
return;
|
|
1288
|
-
}
|
|
1289
|
-
const emptySlot = content
|
|
1290
|
-
? { parent: nodeEntry.node, parentNode: 0 }
|
|
1291
|
-
: nodeEntry;
|
|
1292
|
-
fbService.insertNode(itemData, emptySlot.parent, emptySlot.parentNode, content, event.currentIndex);
|
|
1293
|
-
return;
|
|
1294
|
-
}
|
|
1295
|
-
const previousIndex = event.previousIndex;
|
|
1296
|
-
const currentIndex = event.currentIndex;
|
|
1297
|
-
fbService.moveNodeEntry(event.item.data, previousIndex, currentIndex);
|
|
1298
|
-
}
|
|
1299
|
-
/**
|
|
1300
|
-
* Disables the drag&drop of Slide items.
|
|
1301
|
-
* @param item The dragged item.
|
|
1302
|
-
*/
|
|
1303
|
-
function disableSlideDropPredicate(item) {
|
|
1304
|
-
return !item.data.isSlide;
|
|
1305
|
-
}
|
|
1306
|
-
/**
|
|
1307
|
-
* Disables the drag&drop of Field items.
|
|
1308
|
-
* @param item The dragged item.
|
|
1309
|
-
*/
|
|
1310
|
-
function disableFieldDropPredicate(item) {
|
|
1311
|
-
if (!item.data.isSlide) {
|
|
1312
|
-
return false;
|
|
1313
|
-
}
|
|
1314
|
-
return true;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
class AjfFbStringIdentifierDialogComponent {
|
|
1318
|
-
constructor(_service, _cdr) {
|
|
1319
|
-
this._service = _service;
|
|
1320
|
-
this._cdr = _cdr;
|
|
1321
|
-
this.dataSource = new MatTableDataSource();
|
|
1322
|
-
this.displayedColumns = ['label', 'value', 'show', 'delete'];
|
|
1323
|
-
this.separatorKeysCodes = [ENTER, COMMA];
|
|
1324
|
-
this._stringIdentifierSub = Subscription.EMPTY;
|
|
1325
|
-
this._stringIdentifierSub = _service.stringIdentifier.subscribe(identifier => {
|
|
1326
|
-
this.dataSource.data = [...identifier];
|
|
1327
|
-
});
|
|
1328
|
-
this.fields$ = _service.flatFields.pipe(map(fields => fields
|
|
1329
|
-
.sort((f1, f2) => f1.name.localeCompare(f2.name))
|
|
1330
|
-
.map(f => f.name)
|
|
1331
|
-
.filter(f => f.length > 0)), shareReplay(1));
|
|
1332
|
-
}
|
|
1333
|
-
addRow() {
|
|
1334
|
-
this.dataSource.data = [...this.dataSource.data, { label: '', value: [], show: undefined }];
|
|
1335
|
-
}
|
|
1336
|
-
deleteRow(rowIdx) {
|
|
1337
|
-
this.dataSource.data = [
|
|
1338
|
-
...this.dataSource.data.slice(0, rowIdx),
|
|
1339
|
-
...this.dataSource.data.slice(rowIdx + 1),
|
|
1340
|
-
];
|
|
1341
|
-
}
|
|
1342
|
-
addValue(row, evt, valueInput) {
|
|
1343
|
-
if (evt.value.length === 0) {
|
|
1344
|
-
return;
|
|
1345
|
-
}
|
|
1346
|
-
row.value = [...row.value, evt.value];
|
|
1347
|
-
valueInput.value = '';
|
|
1348
|
-
this._cdr.markForCheck();
|
|
1349
|
-
}
|
|
1350
|
-
removeValue(row, value) {
|
|
1351
|
-
const idx = row.value.indexOf(value);
|
|
1352
|
-
if (idx > -1) {
|
|
1353
|
-
row.value = [...row.value.slice(0, idx), ...row.value.slice(idx + 1)];
|
|
1354
|
-
this._cdr.markForCheck();
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
ngOnDestroy() {
|
|
1358
|
-
this._stringIdentifierSub.unsubscribe();
|
|
1359
|
-
}
|
|
1360
|
-
saveStringIdentifier() {
|
|
1361
|
-
this._service.saveStringIdentifier(this.dataSource.data);
|
|
1362
|
-
}
|
|
1363
|
-
selected(row, evt) {
|
|
1364
|
-
row.value = [...row.value, evt.option.value];
|
|
1365
|
-
this._cdr.markForCheck();
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
AjfFbStringIdentifierDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbStringIdentifierDialogComponent, deps: [{ token: AjfFormBuilderService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1369
|
-
AjfFbStringIdentifierDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbStringIdentifierDialogComponent, selector: "ajf-fb-string-identifier-dialog", ngImport: i0, template: "<h3 matDialogTitle>{{'Edit identifier'|transloco}}</h3>\n<mat-dialog-content>\n <button (click)=\"addRow()\" mat-button>\n <mat-icon>add</mat-icon>\n <span>{{'Add value'|transloco}}</span>\n </button>\n <mat-table [dataSource]=\"dataSource\">\n <ng-container matColumnDef=\"label\">\n <mat-header-cell *matHeaderCellDef>{{'Label'|transloco}}</mat-header-cell>\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-form-field>\n <input\n matInput\n [placeholder]=\"'Label'|transloco\"\n autofocus\n [(ngModel)]=\"row.label\"\n />\n </mat-form-field>\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"value\">\n <mat-header-cell *matHeaderCellDef>{{'Value'|transloco}}</mat-header-cell>\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-form-field>\n <mat-chip-grid #chipList>\n <mat-chip-row\n *ngFor=\"let field of row.value\"\n (removed)=\"removeValue(row, field)\"\n >\n {{ field }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip-row>\n </mat-chip-grid>\n <input\n #valueInput\n [ngModel]=\"row.value\"\n [matAutocomplete]=\"valueAc\"\n [matChipInputFor]=\"chipList\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addValue(row, $event, valueInput)\"\n [placeholder]=\"'Value'|transloco\"\n />\n <mat-autocomplete\n #valueAc=\"matAutocomplete\"\n (optionSelected)=\"selected(row, $event)\"\n >\n <mat-option *ngFor=\"let field of fields$ | async\" [value]=\"field\"\n >{{field}}</mat-option\n >\n </mat-autocomplete>\n </mat-form-field>\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"show\">\n <mat-header-cell *matHeaderCellDef>{{'Show'|transloco}}</mat-header-cell>\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-form-field>\n <mat-select matNativeControl [(ngModel)]=\"row.show\">\n <mat-option value=\"all\">{{'All'|transloco}}</mat-option>\n <mat-option value=\"first\">{{'First'|transloco}}</mat-option>\n <mat-option value=\"last\">{{'Last'|transloco}}</mat-option>\n </mat-select>\n </mat-form-field>\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"delete\">\n <mat-header-cell *matHeaderCellDef\n >{{'Delete'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-icon (click)=\"deleteRow(idx)\">delete</mat-icon>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns;\"></mat-row>\n </mat-table>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button matDialogClose (click)=\"saveStringIdentifier()\">\n {{'Save'|transloco}}\n </button>\n</mat-dialog-actions>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7$2.MatChipGrid, selector: "mat-chip-grid", inputs: ["tabIndex", "disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i7$2.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i7$2.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i7$2.MatChipRow, selector: "mat-chip-row, mat-basic-chip-row", inputs: ["color", "disabled", "disableRipple", "tabIndex", "editable"], outputs: ["edited"] }, { kind: "directive", type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i10.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i12.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i7.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i7.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i7.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i7.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i7.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i7.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i7.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i7.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i7.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i7.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1370
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbStringIdentifierDialogComponent, decorators: [{
|
|
1371
|
-
type: Component,
|
|
1372
|
-
args: [{ selector: 'ajf-fb-string-identifier-dialog', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<h3 matDialogTitle>{{'Edit identifier'|transloco}}</h3>\n<mat-dialog-content>\n <button (click)=\"addRow()\" mat-button>\n <mat-icon>add</mat-icon>\n <span>{{'Add value'|transloco}}</span>\n </button>\n <mat-table [dataSource]=\"dataSource\">\n <ng-container matColumnDef=\"label\">\n <mat-header-cell *matHeaderCellDef>{{'Label'|transloco}}</mat-header-cell>\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-form-field>\n <input\n matInput\n [placeholder]=\"'Label'|transloco\"\n autofocus\n [(ngModel)]=\"row.label\"\n />\n </mat-form-field>\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"value\">\n <mat-header-cell *matHeaderCellDef>{{'Value'|transloco}}</mat-header-cell>\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-form-field>\n <mat-chip-grid #chipList>\n <mat-chip-row\n *ngFor=\"let field of row.value\"\n (removed)=\"removeValue(row, field)\"\n >\n {{ field }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip-row>\n </mat-chip-grid>\n <input\n #valueInput\n [ngModel]=\"row.value\"\n [matAutocomplete]=\"valueAc\"\n [matChipInputFor]=\"chipList\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addValue(row, $event, valueInput)\"\n [placeholder]=\"'Value'|transloco\"\n />\n <mat-autocomplete\n #valueAc=\"matAutocomplete\"\n (optionSelected)=\"selected(row, $event)\"\n >\n <mat-option *ngFor=\"let field of fields$ | async\" [value]=\"field\"\n >{{field}}</mat-option\n >\n </mat-autocomplete>\n </mat-form-field>\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"show\">\n <mat-header-cell *matHeaderCellDef>{{'Show'|transloco}}</mat-header-cell>\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-form-field>\n <mat-select matNativeControl [(ngModel)]=\"row.show\">\n <mat-option value=\"all\">{{'All'|transloco}}</mat-option>\n <mat-option value=\"first\">{{'First'|transloco}}</mat-option>\n <mat-option value=\"last\">{{'Last'|transloco}}</mat-option>\n </mat-select>\n </mat-form-field>\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"delete\">\n <mat-header-cell *matHeaderCellDef\n >{{'Delete'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-icon (click)=\"deleteRow(idx)\">delete</mat-icon>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns;\"></mat-row>\n </mat-table>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button matDialogClose (click)=\"saveStringIdentifier()\">\n {{'Save'|transloco}}\n </button>\n</mat-dialog-actions>\n" }]
|
|
1373
|
-
}], ctorParameters: function () { return [{ type: AjfFormBuilderService }, { type: i0.ChangeDetectorRef }]; } });
|
|
1374
|
-
|
|
1375
|
-
/**
|
|
1376
|
-
* @license
|
|
1377
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
1378
|
-
*
|
|
1379
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
1380
|
-
*
|
|
1381
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
1382
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
1383
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
1384
|
-
* or (at your option) any later version.
|
|
1385
|
-
*
|
|
1386
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
1387
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1388
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
1389
|
-
* General Public License for more details.
|
|
1390
|
-
*
|
|
1391
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
1392
|
-
* along with Advanced JSON forms (ajf).
|
|
1393
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
1394
|
-
*
|
|
1395
|
-
*/
|
|
1396
|
-
const branchColors = [
|
|
1397
|
-
'#F44336',
|
|
1398
|
-
'#4CAF50',
|
|
1399
|
-
'#3F51B5',
|
|
1400
|
-
'#FFC107',
|
|
1401
|
-
'#795548', // BROWN
|
|
1402
|
-
];
|
|
1403
|
-
class AjfFbNodeEntry {
|
|
1404
|
-
constructor(_service) {
|
|
1405
|
-
this._service = _service;
|
|
1406
|
-
this._hasContent = false;
|
|
1407
|
-
this._isFirst = false;
|
|
1408
|
-
this._isNodeEntry = false;
|
|
1409
|
-
this._level = 0;
|
|
1410
|
-
this._isDraggable = true;
|
|
1411
|
-
this._branchColors = branchColors.slice(0);
|
|
1412
|
-
this._dropZones = ['fbdz-node'];
|
|
1413
|
-
this._slideDropZones = ['fbdz-slide'];
|
|
1414
|
-
this._originOffset = 0;
|
|
1415
|
-
this._originLeftMargin = '0';
|
|
1416
|
-
this._firstBranchColor = branchColors[0];
|
|
1417
|
-
this._branchLinesSubscription = Subscription.EMPTY;
|
|
1418
|
-
this._childEntriesSubscription = Subscription.EMPTY;
|
|
1419
|
-
this._currentEditedNode = this._service.editedNodeEntry;
|
|
1420
|
-
}
|
|
1421
|
-
get hasContent() {
|
|
1422
|
-
return this._hasContent;
|
|
1423
|
-
}
|
|
1424
|
-
get isFirst() {
|
|
1425
|
-
return this._isFirst;
|
|
1426
|
-
}
|
|
1427
|
-
set isFirst(isFirst) {
|
|
1428
|
-
this._isFirst = isFirst;
|
|
1429
|
-
}
|
|
1430
|
-
get isNodeEntry() {
|
|
1431
|
-
return this._isNodeEntry;
|
|
1432
|
-
}
|
|
1433
|
-
get nodeEntry() {
|
|
1434
|
-
return this._nodeEntry;
|
|
1435
|
-
}
|
|
1436
|
-
set nodeEntry(nodeEntry) {
|
|
1437
|
-
this._nodeEntry = nodeEntry;
|
|
1438
|
-
if (nodeEntry != null && nodeEntry.node !== void 0) {
|
|
1439
|
-
const ne = nodeEntry;
|
|
1440
|
-
this._isNodeEntry = true;
|
|
1441
|
-
const node = ne.node;
|
|
1442
|
-
this._hasContent = node != null && isContainerNode(node);
|
|
1443
|
-
}
|
|
1444
|
-
else {
|
|
1445
|
-
this._isNodeEntry = false;
|
|
1446
|
-
this._hasContent = false;
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
get level() {
|
|
1450
|
-
return this._level;
|
|
1451
|
-
}
|
|
1452
|
-
set level(value) {
|
|
1453
|
-
this._level = value;
|
|
1454
|
-
}
|
|
1455
|
-
get isDraggable() {
|
|
1456
|
-
return this._isDraggable;
|
|
1457
|
-
}
|
|
1458
|
-
set isDraggable(draggable) {
|
|
1459
|
-
this._isDraggable = draggable;
|
|
1460
|
-
}
|
|
1461
|
-
get realNodeEntry() {
|
|
1462
|
-
return this._nodeEntry;
|
|
1463
|
-
}
|
|
1464
|
-
get branchColors() {
|
|
1465
|
-
return this._branchColors;
|
|
1466
|
-
}
|
|
1467
|
-
get dropZones() {
|
|
1468
|
-
return this._dropZones;
|
|
1469
|
-
}
|
|
1470
|
-
get slideDropZones() {
|
|
1471
|
-
return this._slideDropZones;
|
|
1472
|
-
}
|
|
1473
|
-
get originOffset() {
|
|
1474
|
-
return this._originOffset;
|
|
1475
|
-
}
|
|
1476
|
-
set originOffset(originOffset) {
|
|
1477
|
-
this._originOffset = originOffset;
|
|
1478
|
-
this._originLeftMargin = `${this._originOffset * 4}px`;
|
|
1479
|
-
}
|
|
1480
|
-
get originLeftMargin() {
|
|
1481
|
-
return this._originLeftMargin;
|
|
1482
|
-
}
|
|
1483
|
-
get firstBranchColor() {
|
|
1484
|
-
return this._firstBranchColor;
|
|
1485
|
-
}
|
|
1486
|
-
set firstBranchColor(firstBranchColor) {
|
|
1487
|
-
const idx = branchColors.indexOf(firstBranchColor);
|
|
1488
|
-
if (idx > 0) {
|
|
1489
|
-
this._firstBranchColor = firstBranchColor;
|
|
1490
|
-
this._branchColors = branchColors.slice(idx).concat(branchColors.slice(0, idx));
|
|
1491
|
-
}
|
|
1492
|
-
else {
|
|
1493
|
-
this._firstBranchColor = branchColors[0];
|
|
1494
|
-
this._branchColors = branchColors.slice(0);
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
get currentEditedNode() {
|
|
1498
|
-
return this._currentEditedNode;
|
|
1499
|
-
}
|
|
1500
|
-
onResize() { }
|
|
1501
|
-
edit(evt) {
|
|
1502
|
-
evt.stopPropagation();
|
|
1503
|
-
if (this.nodeEntry == null || !this.isNodeEntry) {
|
|
1504
|
-
return;
|
|
1505
|
-
}
|
|
1506
|
-
this._service.editNodeEntry(this.nodeEntry);
|
|
1507
|
-
}
|
|
1508
|
-
delete(evt) {
|
|
1509
|
-
evt.stopPropagation();
|
|
1510
|
-
if (this.nodeEntry == null || !this.isNodeEntry) {
|
|
1511
|
-
return;
|
|
1512
|
-
}
|
|
1513
|
-
this._service.cancelNodeEntryEdit();
|
|
1514
|
-
this._service.deleteNodeEntry(this.nodeEntry);
|
|
1515
|
-
}
|
|
1516
|
-
isLastNode() {
|
|
1517
|
-
if (!this.realNodeEntry || !this.realNodeEntry.children) {
|
|
1518
|
-
return false;
|
|
1519
|
-
}
|
|
1520
|
-
return !this.realNodeEntry.children[0].children;
|
|
1521
|
-
}
|
|
1522
|
-
isSlide(node) {
|
|
1523
|
-
return isSlidesNode(node);
|
|
1524
|
-
}
|
|
1525
|
-
isExpanded() {
|
|
1526
|
-
if (this._nodeEntry && 'node' in this._nodeEntry) {
|
|
1527
|
-
return this._service.getExpandedStatus(this._nodeEntry.node.name);
|
|
1528
|
-
}
|
|
1529
|
-
return of(false);
|
|
1530
|
-
}
|
|
1531
|
-
ngAfterViewInit() {
|
|
1532
|
-
this.updateBranchHeights();
|
|
1533
|
-
this._childEntriesSubscription = this.childEntries.changes.subscribe(() => {
|
|
1534
|
-
this.updateBranchHeights();
|
|
1535
|
-
});
|
|
1536
|
-
}
|
|
1537
|
-
ngOnDestroy() {
|
|
1538
|
-
this._branchLinesSubscription.unsubscribe();
|
|
1539
|
-
this._childEntriesSubscription.unsubscribe();
|
|
1540
|
-
}
|
|
1541
|
-
/**
|
|
1542
|
-
* Triggers when a field or slide node is moved or inserted by drag&dropping in the formbuilder.
|
|
1543
|
-
* @param event The drop event.
|
|
1544
|
-
* @param content True if the current nodeEntry contains other nodeEntries.
|
|
1545
|
-
*/
|
|
1546
|
-
onDrop(event, content = false) {
|
|
1547
|
-
if (this._nodeEntry == null) {
|
|
1548
|
-
return;
|
|
1549
|
-
}
|
|
1550
|
-
onDropProcess(event, this._service, this._nodeEntry, content);
|
|
1551
|
-
}
|
|
1552
|
-
/**
|
|
1553
|
-
* Assigns a progressive id to the dropList, to connect it to the FormBuilder source list.
|
|
1554
|
-
* @param empty True if the list is marked as empty.
|
|
1555
|
-
*/
|
|
1556
|
-
assignId(empty = false) {
|
|
1557
|
-
return this._service.assignListId(this.realNodeEntry.node, empty);
|
|
1558
|
-
}
|
|
1559
|
-
disableSlideDrop(item) {
|
|
1560
|
-
return disableSlideDropPredicate(item);
|
|
1561
|
-
}
|
|
1562
|
-
disableFieldDrop(item) {
|
|
1563
|
-
return disableFieldDropPredicate(item);
|
|
1564
|
-
}
|
|
1565
|
-
emptyAreaDropPredicate() {
|
|
1566
|
-
return (item, _drop) => {
|
|
1567
|
-
if (this._level > 0) {
|
|
1568
|
-
return !item.data.isSlide;
|
|
1569
|
-
}
|
|
1570
|
-
return item.data.isSlide || false;
|
|
1571
|
-
};
|
|
1572
|
-
}
|
|
1573
|
-
updateBranchHeights(delay = 0) {
|
|
1574
|
-
setTimeout(() => {
|
|
1575
|
-
if (this.nodeEntry == null ||
|
|
1576
|
-
!this.isNodeEntry ||
|
|
1577
|
-
this.branchLines == null ||
|
|
1578
|
-
this.childEntries == null) {
|
|
1579
|
-
return;
|
|
1580
|
-
}
|
|
1581
|
-
const nodeEntry = this.nodeEntry;
|
|
1582
|
-
const branchLines = this.branchLines.toArray();
|
|
1583
|
-
const sliceIdx = nodeEntry.content != null ? nodeEntry.content.length : 0;
|
|
1584
|
-
const childEntries = this.childEntries.toArray().slice(sliceIdx);
|
|
1585
|
-
if (branchLines.length != childEntries.length) {
|
|
1586
|
-
return;
|
|
1587
|
-
}
|
|
1588
|
-
branchLines.forEach((bl, idx) => {
|
|
1589
|
-
const ce = childEntries[idx];
|
|
1590
|
-
bl.height = ce.nativeElement.offsetTop;
|
|
1591
|
-
});
|
|
1592
|
-
}, delay);
|
|
1593
|
-
}
|
|
1594
|
-
updateExpandedStatus(expanded) {
|
|
1595
|
-
if (this._nodeEntry && 'node' in this._nodeEntry) {
|
|
1596
|
-
this._service.updateExpandedStatus(this._nodeEntry.node.name, expanded);
|
|
1597
|
-
this.updateBranchHeights(400);
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
AjfFbNodeEntry.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbNodeEntry, deps: [{ token: AjfFormBuilderService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1602
|
-
AjfFbNodeEntry.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbNodeEntry, selector: "ajf-fb-node-entry", inputs: { isFirst: "isFirst", nodeEntry: "nodeEntry", level: "level", isDraggable: "isDraggable", originOffset: "originOffset", firstBranchColor: "firstBranchColor" }, host: { listeners: { "window.resize": "onResize()" } }, viewQueries: [{ propertyName: "branchLines", predicate: AjfFbBranchLine, descendants: true }, { propertyName: "childEntries", predicate: AjfFbNodeEntry, descendants: true, read: ElementRef }], ngImport: i0, template: "<ng-container *ngIf=\"nodeEntry; else rootEmpty\">\n <ng-template [ngIf]=\"isNodeEntry && !isLastNode()\">\n <ajf-fb-branch-line\n *ngFor=\"let childNodeEntry of realNodeEntry.children; let idx = index\"\n [offset]=\"idx\"\n [color]=\"branchColors[idx]\"\n ></ajf-fb-branch-line>\n </ng-template>\n\n <div\n class=\"mat-card-container\"\n [class.ajf-highlighted-formbuilder-node]=\"(currentEditedNode|async) === nodeEntry\"\n >\n <div\n *ngIf=\"!isFirst\"\n class=\"ajf-origin-line\"\n [style.margin-left]=\"originLeftMargin\"\n [style.border-color]=\"firstBranchColor\"\n ></div>\n <ng-template [ngIf]=\"isNodeEntry\">\n <ng-container *ngIf=\"!isDraggable; else draggable\">\n <mat-card appearance=\"outlined\">\n <ng-container *ngTemplateOutlet=\"cardTitle\"></ng-container>\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n </mat-card>\n </ng-container>\n\n <ng-template #draggable>\n <mat-card\n appearance=\"outlined\"\n cdkDrag\n [cdkDragData]=\"realNodeEntry\"\n class=\"ajf-draggable-box\"\n >\n <ng-container *ngIf=\"isSlide(realNodeEntry.node); else fieldPanel\">\n <ng-container *ngTemplateOutlet=\"slidePanel\"></ng-container>\n </ng-container>\n </mat-card>\n </ng-template>\n\n <ng-template #slidePanel>\n <mat-expansion-panel\n [expanded]=\"isExpanded()|async\"\n (opened)=\"updateExpandedStatus(true)\"\n (closed)=\"updateExpandedStatus(false)\"\n class=\"mat-elevation-z\"\n >\n <mat-expansion-panel-header>\n <ng-container *ngTemplateOutlet=\"cardTitle\"></ng-container>\n </mat-expansion-panel-header>\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n </mat-expansion-panel>\n </ng-template>\n\n <ng-template #fieldPanel>\n <ng-container *ngTemplateOutlet=\"cardTitle\"></ng-container>\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n </ng-template>\n\n <ng-template #cardTitle>\n <div class=\"ajf-title-row\">\n <ajf-node-icon [node]=\"realNodeEntry.node\"></ajf-node-icon>\n \n <span\n class=\"ajf-title\"\n [innerHTML]=\"(realNodeEntry.node.label || realNodeEntry.node.name) | transloco\"\n ></span>\n <span\n *ngIf=\"realNodeEntry.node.visibility && realNodeEntry.node.visibility?.condition !== 'true'\"\n class=\"ajf-visibility-condition\"\n [innerHTML]=\"'Condition: (' + realNodeEntry.node.visibility.condition + ')'\"\n >\n </span>\n <span class=\"ajf-actions\">\n <button\n [disabled]=\"(currentEditedNode|async) === nodeEntry\"\n (click)=\"edit($event)\"\n mat-icon-button\n >\n <mat-icon>edit</mat-icon>\n </button>\n <button (click)=\"delete($event)\" mat-icon-button>\n <mat-icon>delete</mat-icon>\n </button>\n </span>\n </div>\n </ng-template>\n\n <ng-template #cardContent>\n <div *ngIf=\"hasContent\">\n <ajf-fb-node-entry\n cdkDropList\n class=\"ajf-fields-list\"\n *ngFor=\"let contentEntry of realNodeEntry.content; let isFirstChild = first; let idx = index\"\n [id]=\"assignId()\"\n [level]=\"level + 1\"\n [isFirst]=\"isFirstChild\"\n [firstBranchColor]=\"branchColors[idx]\"\n [nodeEntry]=\"contentEntry\"\n [cdkDropListEnterPredicate]=\"disableSlideDrop\"\n (cdkDropListDropped)=\"onDrop($event, true)\"\n ></ajf-fb-node-entry>\n <mat-card\n appearance=\"outlined\"\n class=\"ajf-empty\"\n *ngIf=\"realNodeEntry.content.length === 0\"\n cdkDropList\n [id]=\"assignId(true)\"\n [cdkDropListEnterPredicate]=\"disableSlideDrop\"\n (cdkDropListDropped)=\"onDrop($event, true)\"\n ><mat-card-title>Drop your fields here</mat-card-title></mat-card\n >\n </div>\n </ng-template>\n </ng-template>\n </div>\n\n <ng-template [ngIf]=\"isNodeEntry\">\n <ng-container *ngFor=\"let childNodeEntry of realNodeEntry.children; let idx = index\">\n <ajf-fb-node-entry\n *ngIf=\"!isLastNode()\"\n [level]=\"level\"\n [originOffset]=\"idx\"\n [firstBranchColor]=\"branchColors[idx]\"\n [nodeEntry]=\"childNodeEntry\"\n ></ajf-fb-node-entry>\n </ng-container>\n </ng-template>\n</ng-container>\n\n<ng-template #rootEmpty>\n <div class=\"mat-card-container\">\n <mat-card\n appearance=\"outlined\"\n class=\"ajf-empty\"\n cdkDropList\n [cdkDropListEnterPredicate]=\"emptyAreaDropPredicate()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n ><mat-card-title>Drop your slides here</mat-card-title>\n </mat-card>\n </div>\n</ng-template>\n", styles: ["ajf-fb-node-entry{display:block;position:relative}ajf-fb-node-entry .mat-card-container{position:relative}ajf-fb-node-entry .mat-card-container .ajf-origin-line{position:absolute;top:0;left:25px;width:25px;height:25px;border-bottom:2px solid;border-left:2px solid;border-bottom-left-radius:.5em}ajf-fb-node-entry .mat-card-container .mat-mdc-card{margin-left:50px;padding:.5em 1em;background-color:#fff}ajf-fb-node-entry .mat-card-container .mat-mdc-card .ajf-title-row{display:flex;flex:1 1 auto;flex-direction:row wrap;align-items:center}ajf-fb-node-entry .mat-card-container .mat-mdc-card .ajf-title-row>.ajf-title{flex:1 1 auto;max-width:25vw;margin-right:10px}ajf-fb-node-entry .mat-card-container .mat-mdc-card .ajf-title-row>.ajf-visibility-condition{flex:1 1 auto;font-size:10px;color:#999;max-height:100px;max-width:25vw;overflow:hidden;text-overflow:ellipsis}ajf-fb-node-entry .mat-card-container .mat-mdc-card .ajf-title-row>.ajf-actions{flex:1 1 auto;display:flex;justify-content:flex-end;white-space:nowrap;justify-self:flex-end}ajf-fb-node-entry .mat-card-container .mat-mdc-card.ajf-empty{line-height:36px;border:2px dashed;box-shadow:none;box-sizing:border-box;text-align:center;color:#ccc}ajf-fb-node-entry .mat-card-container .mat-mdc-card.ajf-draggable-box{padding:5px;border-bottom:solid 1px #ccc;border-right:solid 1px #ccc;color:#000000de;box-sizing:border-box;cursor:move;background:white;font-size:14px}ajf-fb-node-entry .mat-card-container.ajf-highlighted-formbuilder-node>mat-card{background-color:#fff9c4!important}ajf-fb-node-entry .ajf-highlighted-formbuilder-node .mat-mdc-card .mat-expansion-panel .mat-expansion-panel-header{background-color:#fff9c4!important}ajf-fb-node-entry.ajf-fields-list{max-width:80%;min-height:60px;display:block;background:white;border-radius:4px;overflow:hidden}ajf-fb-node-entry .cdk-drag-placeholder{opacity:.4;min-height:60px;margin-left:50px;border:1px solid #ccc;border-radius:4px;background-color:#fff9c4}ajf-fb-node-entry .ajf-fields-list.cdk-drop-list-dragging .ajf-draggable-box:not(.cdk-drag-placeholder),ajf-fb-node-entry .cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], dependencies: [{ kind: "component", type: i2$1.AjfNodeIcon, selector: "ajf-node-icon" }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i4$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6$2.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i6$2.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "component", type: i10.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8$1.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i8$1.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "component", type: AjfFbBranchLine, selector: "ajf-fb-branch-line", inputs: ["offset", "color", "height"] }, { kind: "component", type: AjfFbNodeEntry, selector: "ajf-fb-node-entry", inputs: ["isFirst", "nodeEntry", "level", "isDraggable", "originOffset", "firstBranchColor"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1603
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbNodeEntry, decorators: [{
|
|
1604
|
-
type: Component,
|
|
1605
|
-
args: [{ selector: 'ajf-fb-node-entry', host: { '(window.resize)': 'onResize()' }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"nodeEntry; else rootEmpty\">\n <ng-template [ngIf]=\"isNodeEntry && !isLastNode()\">\n <ajf-fb-branch-line\n *ngFor=\"let childNodeEntry of realNodeEntry.children; let idx = index\"\n [offset]=\"idx\"\n [color]=\"branchColors[idx]\"\n ></ajf-fb-branch-line>\n </ng-template>\n\n <div\n class=\"mat-card-container\"\n [class.ajf-highlighted-formbuilder-node]=\"(currentEditedNode|async) === nodeEntry\"\n >\n <div\n *ngIf=\"!isFirst\"\n class=\"ajf-origin-line\"\n [style.margin-left]=\"originLeftMargin\"\n [style.border-color]=\"firstBranchColor\"\n ></div>\n <ng-template [ngIf]=\"isNodeEntry\">\n <ng-container *ngIf=\"!isDraggable; else draggable\">\n <mat-card appearance=\"outlined\">\n <ng-container *ngTemplateOutlet=\"cardTitle\"></ng-container>\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n </mat-card>\n </ng-container>\n\n <ng-template #draggable>\n <mat-card\n appearance=\"outlined\"\n cdkDrag\n [cdkDragData]=\"realNodeEntry\"\n class=\"ajf-draggable-box\"\n >\n <ng-container *ngIf=\"isSlide(realNodeEntry.node); else fieldPanel\">\n <ng-container *ngTemplateOutlet=\"slidePanel\"></ng-container>\n </ng-container>\n </mat-card>\n </ng-template>\n\n <ng-template #slidePanel>\n <mat-expansion-panel\n [expanded]=\"isExpanded()|async\"\n (opened)=\"updateExpandedStatus(true)\"\n (closed)=\"updateExpandedStatus(false)\"\n class=\"mat-elevation-z\"\n >\n <mat-expansion-panel-header>\n <ng-container *ngTemplateOutlet=\"cardTitle\"></ng-container>\n </mat-expansion-panel-header>\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n </mat-expansion-panel>\n </ng-template>\n\n <ng-template #fieldPanel>\n <ng-container *ngTemplateOutlet=\"cardTitle\"></ng-container>\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n </ng-template>\n\n <ng-template #cardTitle>\n <div class=\"ajf-title-row\">\n <ajf-node-icon [node]=\"realNodeEntry.node\"></ajf-node-icon>\n \n <span\n class=\"ajf-title\"\n [innerHTML]=\"(realNodeEntry.node.label || realNodeEntry.node.name) | transloco\"\n ></span>\n <span\n *ngIf=\"realNodeEntry.node.visibility && realNodeEntry.node.visibility?.condition !== 'true'\"\n class=\"ajf-visibility-condition\"\n [innerHTML]=\"'Condition: (' + realNodeEntry.node.visibility.condition + ')'\"\n >\n </span>\n <span class=\"ajf-actions\">\n <button\n [disabled]=\"(currentEditedNode|async) === nodeEntry\"\n (click)=\"edit($event)\"\n mat-icon-button\n >\n <mat-icon>edit</mat-icon>\n </button>\n <button (click)=\"delete($event)\" mat-icon-button>\n <mat-icon>delete</mat-icon>\n </button>\n </span>\n </div>\n </ng-template>\n\n <ng-template #cardContent>\n <div *ngIf=\"hasContent\">\n <ajf-fb-node-entry\n cdkDropList\n class=\"ajf-fields-list\"\n *ngFor=\"let contentEntry of realNodeEntry.content; let isFirstChild = first; let idx = index\"\n [id]=\"assignId()\"\n [level]=\"level + 1\"\n [isFirst]=\"isFirstChild\"\n [firstBranchColor]=\"branchColors[idx]\"\n [nodeEntry]=\"contentEntry\"\n [cdkDropListEnterPredicate]=\"disableSlideDrop\"\n (cdkDropListDropped)=\"onDrop($event, true)\"\n ></ajf-fb-node-entry>\n <mat-card\n appearance=\"outlined\"\n class=\"ajf-empty\"\n *ngIf=\"realNodeEntry.content.length === 0\"\n cdkDropList\n [id]=\"assignId(true)\"\n [cdkDropListEnterPredicate]=\"disableSlideDrop\"\n (cdkDropListDropped)=\"onDrop($event, true)\"\n ><mat-card-title>Drop your fields here</mat-card-title></mat-card\n >\n </div>\n </ng-template>\n </ng-template>\n </div>\n\n <ng-template [ngIf]=\"isNodeEntry\">\n <ng-container *ngFor=\"let childNodeEntry of realNodeEntry.children; let idx = index\">\n <ajf-fb-node-entry\n *ngIf=\"!isLastNode()\"\n [level]=\"level\"\n [originOffset]=\"idx\"\n [firstBranchColor]=\"branchColors[idx]\"\n [nodeEntry]=\"childNodeEntry\"\n ></ajf-fb-node-entry>\n </ng-container>\n </ng-template>\n</ng-container>\n\n<ng-template #rootEmpty>\n <div class=\"mat-card-container\">\n <mat-card\n appearance=\"outlined\"\n class=\"ajf-empty\"\n cdkDropList\n [cdkDropListEnterPredicate]=\"emptyAreaDropPredicate()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n ><mat-card-title>Drop your slides here</mat-card-title>\n </mat-card>\n </div>\n</ng-template>\n", styles: ["ajf-fb-node-entry{display:block;position:relative}ajf-fb-node-entry .mat-card-container{position:relative}ajf-fb-node-entry .mat-card-container .ajf-origin-line{position:absolute;top:0;left:25px;width:25px;height:25px;border-bottom:2px solid;border-left:2px solid;border-bottom-left-radius:.5em}ajf-fb-node-entry .mat-card-container .mat-mdc-card{margin-left:50px;padding:.5em 1em;background-color:#fff}ajf-fb-node-entry .mat-card-container .mat-mdc-card .ajf-title-row{display:flex;flex:1 1 auto;flex-direction:row wrap;align-items:center}ajf-fb-node-entry .mat-card-container .mat-mdc-card .ajf-title-row>.ajf-title{flex:1 1 auto;max-width:25vw;margin-right:10px}ajf-fb-node-entry .mat-card-container .mat-mdc-card .ajf-title-row>.ajf-visibility-condition{flex:1 1 auto;font-size:10px;color:#999;max-height:100px;max-width:25vw;overflow:hidden;text-overflow:ellipsis}ajf-fb-node-entry .mat-card-container .mat-mdc-card .ajf-title-row>.ajf-actions{flex:1 1 auto;display:flex;justify-content:flex-end;white-space:nowrap;justify-self:flex-end}ajf-fb-node-entry .mat-card-container .mat-mdc-card.ajf-empty{line-height:36px;border:2px dashed;box-shadow:none;box-sizing:border-box;text-align:center;color:#ccc}ajf-fb-node-entry .mat-card-container .mat-mdc-card.ajf-draggable-box{padding:5px;border-bottom:solid 1px #ccc;border-right:solid 1px #ccc;color:#000000de;box-sizing:border-box;cursor:move;background:white;font-size:14px}ajf-fb-node-entry .mat-card-container.ajf-highlighted-formbuilder-node>mat-card{background-color:#fff9c4!important}ajf-fb-node-entry .ajf-highlighted-formbuilder-node .mat-mdc-card .mat-expansion-panel .mat-expansion-panel-header{background-color:#fff9c4!important}ajf-fb-node-entry.ajf-fields-list{max-width:80%;min-height:60px;display:block;background:white;border-radius:4px;overflow:hidden}ajf-fb-node-entry .cdk-drag-placeholder{opacity:.4;min-height:60px;margin-left:50px;border:1px solid #ccc;border-radius:4px;background-color:#fff9c4}ajf-fb-node-entry .ajf-fields-list.cdk-drop-list-dragging .ajf-draggable-box:not(.cdk-drag-placeholder),ajf-fb-node-entry .cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}\n"] }]
|
|
1606
|
-
}], ctorParameters: function () { return [{ type: AjfFormBuilderService }]; }, propDecorators: { branchLines: [{
|
|
1607
|
-
type: ViewChildren,
|
|
1608
|
-
args: [AjfFbBranchLine]
|
|
1609
|
-
}], childEntries: [{
|
|
1610
|
-
type: ViewChildren,
|
|
1611
|
-
args: [AjfFbNodeEntry, { read: ElementRef }]
|
|
1612
|
-
}], isFirst: [{
|
|
1613
|
-
type: Input
|
|
1614
|
-
}], nodeEntry: [{
|
|
1615
|
-
type: Input
|
|
1616
|
-
}], level: [{
|
|
1617
|
-
type: Input
|
|
1618
|
-
}], isDraggable: [{
|
|
1619
|
-
type: Input
|
|
1620
|
-
}], originOffset: [{
|
|
1621
|
-
type: Input
|
|
1622
|
-
}], firstBranchColor: [{
|
|
1623
|
-
type: Input
|
|
1624
|
-
}] } });
|
|
1625
|
-
|
|
1626
|
-
class AjfFbValidationConditionEditorDialog {
|
|
1627
|
-
constructor(service, dialogRef) {
|
|
1628
|
-
this.dialogRef = dialogRef;
|
|
1629
|
-
this.condition = '';
|
|
1630
|
-
this.errorMessage = '';
|
|
1631
|
-
this._fields = service.flatFields.pipe(map((fields) => fields.sort((f1, f2) => f1.name.localeCompare(f2.name))));
|
|
1632
|
-
}
|
|
1633
|
-
get fields() {
|
|
1634
|
-
return this._fields;
|
|
1635
|
-
}
|
|
1636
|
-
saveCondition() {
|
|
1637
|
-
if (this.editor == null) {
|
|
1638
|
-
return;
|
|
1639
|
-
}
|
|
1640
|
-
const newValue = this.editor.formulaEditorControl.value;
|
|
1641
|
-
this.dialogRef.close({ condition: newValue, errorMessage: this.errorMessage });
|
|
1642
|
-
}
|
|
1643
|
-
closeDialog() {
|
|
1644
|
-
this.dialogRef.close(this.editor.formulaEditorControl.value);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
AjfFbValidationConditionEditorDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbValidationConditionEditorDialog, deps: [{ token: AjfFormBuilderService }, { token: i2.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1648
|
-
AjfFbValidationConditionEditorDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbValidationConditionEditorDialog, selector: "ajf-fb-validation-condition-editor-dialog", viewQueries: [{ propertyName: "editor", first: true, predicate: AjfFbConditionEditor, descendants: true }], ngImport: i0, template: "<h3 matDialogTitle>{{'Edit condition'|transloco}}</h3>\n<mat-dialog-content>\n <mat-form-field>\n <input\n matInput\n [(ngModel)]=\"errorMessage\"\n [placeholder]=\"'Error message'|transloco\"\n />\n </mat-form-field>\n <ajf-condition-editor\n *ngIf=\"fields|async as curFields\"\n [fields]=\"curFields!\"\n [condition]=\"condition\"\n ></ajf-condition-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveCondition()\">{{'Save'|transloco}}</button>\n <button mat-button (click)=\"closeDialog()\">{{'Close'|transloco}}</button>\n</mat-dialog-actions>\n", styles: ["ajf-fb-validation-condition-editor-dialog .mat-mdc-dialog-content{overflow:visible}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: AjfFbConditionEditor, selector: "ajf-condition-editor", inputs: ["fields", "condition"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1649
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbValidationConditionEditorDialog, decorators: [{
|
|
1650
|
-
type: Component,
|
|
1651
|
-
args: [{ selector: 'ajf-fb-validation-condition-editor-dialog', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<h3 matDialogTitle>{{'Edit condition'|transloco}}</h3>\n<mat-dialog-content>\n <mat-form-field>\n <input\n matInput\n [(ngModel)]=\"errorMessage\"\n [placeholder]=\"'Error message'|transloco\"\n />\n </mat-form-field>\n <ajf-condition-editor\n *ngIf=\"fields|async as curFields\"\n [fields]=\"curFields!\"\n [condition]=\"condition\"\n ></ajf-condition-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveCondition()\">{{'Save'|transloco}}</button>\n <button mat-button (click)=\"closeDialog()\">{{'Close'|transloco}}</button>\n</mat-dialog-actions>\n", styles: ["ajf-fb-validation-condition-editor-dialog .mat-mdc-dialog-content{overflow:visible}\n"] }]
|
|
1652
|
-
}], ctorParameters: function () { return [{ type: AjfFormBuilderService }, { type: i2.MatDialogRef }]; }, propDecorators: { editor: [{
|
|
1653
|
-
type: ViewChild,
|
|
1654
|
-
args: [AjfFbConditionEditor, { static: false }]
|
|
1655
|
-
}] } });
|
|
1656
|
-
|
|
1657
|
-
class AjfFbWarningConditionEditorDialog {
|
|
1658
|
-
constructor(service, dialogRef) {
|
|
1659
|
-
this.dialogRef = dialogRef;
|
|
1660
|
-
this.condition = '';
|
|
1661
|
-
this.warningMessage = '';
|
|
1662
|
-
this._fields = service.flatFields.pipe(map((fields) => fields.sort((f1, f2) => f1.name.localeCompare(f2.name))));
|
|
1663
|
-
}
|
|
1664
|
-
get fields() {
|
|
1665
|
-
return this._fields;
|
|
1666
|
-
}
|
|
1667
|
-
saveCondition() {
|
|
1668
|
-
if (this.editor == null) {
|
|
1669
|
-
return;
|
|
1670
|
-
}
|
|
1671
|
-
const newValue = this.editor.formulaEditorControl.value;
|
|
1672
|
-
this.dialogRef.close({ condition: newValue, warningMessage: this.warningMessage });
|
|
1673
|
-
}
|
|
1674
|
-
closeDialog() {
|
|
1675
|
-
this.dialogRef.close(this.editor.formulaEditorControl.value);
|
|
1676
|
-
}
|
|
1677
|
-
}
|
|
1678
|
-
AjfFbWarningConditionEditorDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbWarningConditionEditorDialog, deps: [{ token: AjfFormBuilderService }, { token: i2.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1679
|
-
AjfFbWarningConditionEditorDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbWarningConditionEditorDialog, selector: "ajf-fb-warning-condition-editor-dialog", viewQueries: [{ propertyName: "editor", first: true, predicate: AjfFbConditionEditor, descendants: true }], ngImport: i0, template: "<h3 matDialogTitle>{{'Edit condition'|transloco}}</h3>\n<mat-dialog-content>\n <mat-form-field>\n <input\n matInput\n [(ngModel)]=\"warningMessage\"\n [placeholder]=\"'Warning message' | transloco\"\n />\n </mat-form-field>\n <ajf-condition-editor\n *ngIf=\"fields|async as curFields\"\n [fields]=\"curFields!\"\n [condition]=\"condition\"\n ></ajf-condition-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveCondition()\">{{'Save'|transloco}}</button>\n <button mat-button (click)=\"closeDialog()\">{{'Close'|transloco}}</button>\n</mat-dialog-actions>\n", styles: ["ajf-fb-warning-condition-editor-dialog .mat-mdc-dialog-content{overflow:visible}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: AjfFbConditionEditor, selector: "ajf-condition-editor", inputs: ["fields", "condition"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1680
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbWarningConditionEditorDialog, decorators: [{
|
|
1681
|
-
type: Component,
|
|
1682
|
-
args: [{ selector: 'ajf-fb-warning-condition-editor-dialog', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<h3 matDialogTitle>{{'Edit condition'|transloco}}</h3>\n<mat-dialog-content>\n <mat-form-field>\n <input\n matInput\n [(ngModel)]=\"warningMessage\"\n [placeholder]=\"'Warning message' | transloco\"\n />\n </mat-form-field>\n <ajf-condition-editor\n *ngIf=\"fields|async as curFields\"\n [fields]=\"curFields!\"\n [condition]=\"condition\"\n ></ajf-condition-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveCondition()\">{{'Save'|transloco}}</button>\n <button mat-button (click)=\"closeDialog()\">{{'Close'|transloco}}</button>\n</mat-dialog-actions>\n", styles: ["ajf-fb-warning-condition-editor-dialog .mat-mdc-dialog-content{overflow:visible}\n"] }]
|
|
1683
|
-
}], ctorParameters: function () { return [{ type: AjfFormBuilderService }, { type: i2.MatDialogRef }]; }, propDecorators: { editor: [{
|
|
1684
|
-
type: ViewChild,
|
|
1685
|
-
args: [AjfFbConditionEditor, { static: false }]
|
|
1686
|
-
}] } });
|
|
1687
|
-
|
|
1688
|
-
/**
|
|
1689
|
-
* @license
|
|
1690
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
1691
|
-
*
|
|
1692
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
1693
|
-
*
|
|
1694
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
1695
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
1696
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
1697
|
-
* or (at your option) any later version.
|
|
1698
|
-
*
|
|
1699
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
1700
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1701
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
1702
|
-
* General Public License for more details.
|
|
1703
|
-
*
|
|
1704
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
1705
|
-
* along with Advanced JSON forms (ajf).
|
|
1706
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
1707
|
-
*
|
|
1708
|
-
*/
|
|
1709
|
-
/**
|
|
1710
|
-
* Custom validator service that checks for an already existing
|
|
1711
|
-
* Node with the given name.
|
|
1712
|
-
*/
|
|
1713
|
-
class AjfNodePropertiesNameMatchValidator {
|
|
1714
|
-
constructor(_fbs) {
|
|
1715
|
-
this._fbs = _fbs;
|
|
1716
|
-
}
|
|
1717
|
-
/**
|
|
1718
|
-
* Custom async validator method.
|
|
1719
|
-
* Checks if a Node with the same Name exists, in order to
|
|
1720
|
-
* validate the Node Entry properties form.
|
|
1721
|
-
* @param cdr The editor changeDetectionRef
|
|
1722
|
-
* @param currentId The current node entry id
|
|
1723
|
-
*/
|
|
1724
|
-
sameValueCheck(cdr, currentId) {
|
|
1725
|
-
return (control) => {
|
|
1726
|
-
if (!this._fbs.flatNodes)
|
|
1727
|
-
return of(null);
|
|
1728
|
-
return this._fbs.flatNodes.pipe(debounceTime(300), map(nodes => {
|
|
1729
|
-
const sameNameNode = nodes.find(n => n.name.toLowerCase() === control.value.toLowerCase() && n.id != currentId);
|
|
1730
|
-
if (sameNameNode) {
|
|
1731
|
-
return { 'name_exists': true };
|
|
1732
|
-
}
|
|
1733
|
-
return null;
|
|
1734
|
-
}), finalize(() => {
|
|
1735
|
-
control.markAsTouched();
|
|
1736
|
-
cdr.detectChanges();
|
|
1737
|
-
}), take(1));
|
|
1738
|
-
};
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
AjfNodePropertiesNameMatchValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfNodePropertiesNameMatchValidator, deps: [{ token: AjfFormBuilderService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1742
|
-
AjfNodePropertiesNameMatchValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfNodePropertiesNameMatchValidator });
|
|
1743
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfNodePropertiesNameMatchValidator, decorators: [{
|
|
1744
|
-
type: Injectable
|
|
1745
|
-
}], ctorParameters: function () { return [{ type: AjfFormBuilderService }]; } });
|
|
1746
|
-
|
|
1747
|
-
/**
|
|
1748
|
-
* @license
|
|
1749
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
1750
|
-
*
|
|
1751
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
1752
|
-
*
|
|
1753
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
1754
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
1755
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
1756
|
-
* or (at your option) any later version.
|
|
1757
|
-
*
|
|
1758
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
1759
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1760
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
1761
|
-
* General Public License for more details.
|
|
1762
|
-
*
|
|
1763
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
1764
|
-
* along with Advanced JSON forms (ajf).
|
|
1765
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
1766
|
-
*
|
|
1767
|
-
*/
|
|
1768
|
-
function checkRepsValidity(c) {
|
|
1769
|
-
const minReps = c.value.minReps;
|
|
1770
|
-
const maxReps = c.value.maxReps;
|
|
1771
|
-
if (minReps != null && maxReps != null && minReps > maxReps) {
|
|
1772
|
-
return { reps: 'Min repetions cannot be greater than max repetitions' };
|
|
1773
|
-
}
|
|
1774
|
-
return null;
|
|
1775
|
-
}
|
|
1776
|
-
function checkValueLimitsValidity(c) {
|
|
1777
|
-
const minValue = c.value.minValue;
|
|
1778
|
-
const maxValue = c.value.maxValue;
|
|
1779
|
-
if (minValue != null && maxValue != null && minValue > maxValue) {
|
|
1780
|
-
return { valueLimit: 'Min value cannot be greater than max value' };
|
|
1781
|
-
}
|
|
1782
|
-
return null;
|
|
1783
|
-
}
|
|
1784
|
-
function checkDigitsValidity(c) {
|
|
1785
|
-
const minDigits = c.value.minDigits;
|
|
1786
|
-
const maxDigits = c.value.maxDigits;
|
|
1787
|
-
if (minDigits != null && maxDigits != null && minDigits > maxDigits) {
|
|
1788
|
-
return { digits: 'Min digits cannot be greater than max digits' };
|
|
1789
|
-
}
|
|
1790
|
-
return null;
|
|
1791
|
-
}
|
|
1792
|
-
function checkRangeValidity(c) {
|
|
1793
|
-
const { start, end } = c.value;
|
|
1794
|
-
if (start != null && end != null && start > end) {
|
|
1795
|
-
return { range: 'End must be greater than start' };
|
|
1796
|
-
}
|
|
1797
|
-
return null;
|
|
1798
|
-
}
|
|
1799
|
-
class AjfFbNodeProperties {
|
|
1800
|
-
constructor(_cdr, _service, _dialog, _fb, _nodeNameValidator) {
|
|
1801
|
-
this._cdr = _cdr;
|
|
1802
|
-
this._service = _service;
|
|
1803
|
-
this._dialog = _dialog;
|
|
1804
|
-
this._fb = _fb;
|
|
1805
|
-
this._nodeNameValidator = _nodeNameValidator;
|
|
1806
|
-
this._fieldSizes = [
|
|
1807
|
-
{ label: 'Normal', value: 'normal' },
|
|
1808
|
-
{ label: 'Small', value: 'small' },
|
|
1809
|
-
{ label: 'Smaller', value: 'smaller' },
|
|
1810
|
-
{ label: 'Tiny', value: 'tiny' },
|
|
1811
|
-
{ label: 'Mini', value: 'mini' },
|
|
1812
|
-
];
|
|
1813
|
-
this._choicesOrigins = [];
|
|
1814
|
-
this._curVisibility = null;
|
|
1815
|
-
this._curFormulaReps = null;
|
|
1816
|
-
this._curChoicesFilter = null;
|
|
1817
|
-
this._curForceValue = null;
|
|
1818
|
-
this._curFormula = null;
|
|
1819
|
-
this._conditionalBranches = [];
|
|
1820
|
-
this._validationConditions = [];
|
|
1821
|
-
this._warningConditions = [];
|
|
1822
|
-
this._triggerConditions = [];
|
|
1823
|
-
this.isRepeatingContainerNode = nodeEntry => {
|
|
1824
|
-
return nodeEntry != null && isRepeatingContainerNode(nodeEntry.node);
|
|
1825
|
-
};
|
|
1826
|
-
this._visibilityOptSub = Subscription.EMPTY;
|
|
1827
|
-
this._visibilitySub = Subscription.EMPTY;
|
|
1828
|
-
this._conditionalBranchesSub = Subscription.EMPTY;
|
|
1829
|
-
this._formulaRepsSub = Subscription.EMPTY;
|
|
1830
|
-
this._choicesFilterSub = Subscription.EMPTY;
|
|
1831
|
-
this._formulaSub = Subscription.EMPTY;
|
|
1832
|
-
this._forceValueSub = Subscription.EMPTY;
|
|
1833
|
-
this._validationConditionsSub = Subscription.EMPTY;
|
|
1834
|
-
this._warningConditionsSub = Subscription.EMPTY;
|
|
1835
|
-
this._nextSlideConditionSub = Subscription.EMPTY;
|
|
1836
|
-
this._choicesOriginsSub = Subscription.EMPTY;
|
|
1837
|
-
this._triggerConditionsSub = Subscription.EMPTY;
|
|
1838
|
-
this._editConditionDialog = null;
|
|
1839
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
1840
|
-
this._editValidationConditionDialog = null;
|
|
1841
|
-
this._editValidationConditionDialogSub = Subscription.EMPTY;
|
|
1842
|
-
this._editWarningConditionDialog = null;
|
|
1843
|
-
this._editWarningConditionDialogSub = Subscription.EMPTY;
|
|
1844
|
-
this._editVisibilityEvt = new EventEmitter();
|
|
1845
|
-
this._editVisibilitySub = Subscription.EMPTY;
|
|
1846
|
-
this._editConditionalBranchEvt = new EventEmitter();
|
|
1847
|
-
this._editConditionalBranchSub = Subscription.EMPTY;
|
|
1848
|
-
this._editFormulaRepsEvt = new EventEmitter();
|
|
1849
|
-
this._editFormulaRepsSub = Subscription.EMPTY;
|
|
1850
|
-
this._editChoicesFilterEvt = new EventEmitter();
|
|
1851
|
-
this._editChoicesFilterSub = Subscription.EMPTY;
|
|
1852
|
-
this._editFormulaEvt = new EventEmitter();
|
|
1853
|
-
this._editFormulaSub = Subscription.EMPTY;
|
|
1854
|
-
this._editForceValueEvt = new EventEmitter();
|
|
1855
|
-
this._editForceValueSub = Subscription.EMPTY;
|
|
1856
|
-
this._editValidationConditionEvt = new EventEmitter();
|
|
1857
|
-
this._editValidationConditionSub = Subscription.EMPTY;
|
|
1858
|
-
this._addValidationConditionEvt = new EventEmitter();
|
|
1859
|
-
this._addValidationConditionSub = Subscription.EMPTY;
|
|
1860
|
-
this._removeValidationConditionEvt = new EventEmitter();
|
|
1861
|
-
this._removeValidationConditionSub = Subscription.EMPTY;
|
|
1862
|
-
this._editWarningConditionEvt = new EventEmitter();
|
|
1863
|
-
this._editWarningConditionSub = Subscription.EMPTY;
|
|
1864
|
-
this._addWarningConditionEvt = new EventEmitter();
|
|
1865
|
-
this._addWarningConditionSub = Subscription.EMPTY;
|
|
1866
|
-
this._removeWarningConditionEvt = new EventEmitter();
|
|
1867
|
-
this._removeWarningConditionSub = Subscription.EMPTY;
|
|
1868
|
-
this._editNextSlideConditionEvt = new EventEmitter();
|
|
1869
|
-
this._editNextSlideConditionSub = Subscription.EMPTY;
|
|
1870
|
-
this._editTriggerConditionEvt = new EventEmitter();
|
|
1871
|
-
this._editTriggerConditionSub = Subscription.EMPTY;
|
|
1872
|
-
this._addTriggerConditionEvt = new EventEmitter();
|
|
1873
|
-
this._addTriggerConditionSub = Subscription.EMPTY;
|
|
1874
|
-
this._removeTriggerConditionEvt = new EventEmitter();
|
|
1875
|
-
this._removeTriggerConditionSub = Subscription.EMPTY;
|
|
1876
|
-
this._saveEvt = new EventEmitter();
|
|
1877
|
-
this._saveSub = Subscription.EMPTY;
|
|
1878
|
-
this._nodeEntry = _service.editedNodeEntry;
|
|
1879
|
-
this._choicesOriginsSub = _service.choicesOrigins.subscribe(c => (this._choicesOrigins = c || []));
|
|
1880
|
-
this._enabled = this._nodeEntry.pipe(map(n => n != null));
|
|
1881
|
-
this._initForm();
|
|
1882
|
-
this._initVisibilityEdit();
|
|
1883
|
-
this._initConditionalBranchEdit();
|
|
1884
|
-
this._initFormulaRepsEdit();
|
|
1885
|
-
this._initChoicesFilterEdit();
|
|
1886
|
-
this._initFormulaEdit();
|
|
1887
|
-
this._initForceValueEdit();
|
|
1888
|
-
this._initValidationConditionEdit();
|
|
1889
|
-
this._initAddValidationCondition();
|
|
1890
|
-
this._initRemoveValidationCondition();
|
|
1891
|
-
this._initWarningConditionEdit();
|
|
1892
|
-
this._initAddWarningCondition();
|
|
1893
|
-
this._initRemoveWarningCondition();
|
|
1894
|
-
this._initNextSlideConditionEdit();
|
|
1895
|
-
this._initTriggerConditionEdit();
|
|
1896
|
-
this._initAddTriggerCondition();
|
|
1897
|
-
this._initRemoveTriggerCondition();
|
|
1898
|
-
this._initSave();
|
|
1899
|
-
}
|
|
1900
|
-
get fieldSizes() {
|
|
1901
|
-
return this._fieldSizes;
|
|
1902
|
-
}
|
|
1903
|
-
get nodeEntry() {
|
|
1904
|
-
return this._nodeEntry;
|
|
1905
|
-
}
|
|
1906
|
-
get choicesOrigins() {
|
|
1907
|
-
return this._choicesOrigins;
|
|
1908
|
-
}
|
|
1909
|
-
get enabled() {
|
|
1910
|
-
return this._enabled;
|
|
1911
|
-
}
|
|
1912
|
-
get propertiesForm() {
|
|
1913
|
-
return this._propertiesForm;
|
|
1914
|
-
}
|
|
1915
|
-
get hasChoices() {
|
|
1916
|
-
return this._hasChoices;
|
|
1917
|
-
}
|
|
1918
|
-
get curVisibility() {
|
|
1919
|
-
return this._curVisibility;
|
|
1920
|
-
}
|
|
1921
|
-
get curFormulaReps() {
|
|
1922
|
-
return this._curFormulaReps;
|
|
1923
|
-
}
|
|
1924
|
-
get curChoicesFilter() {
|
|
1925
|
-
return this._curChoicesFilter;
|
|
1926
|
-
}
|
|
1927
|
-
get curForceValue() {
|
|
1928
|
-
return this._curForceValue;
|
|
1929
|
-
}
|
|
1930
|
-
get curFormula() {
|
|
1931
|
-
return this._curFormula;
|
|
1932
|
-
}
|
|
1933
|
-
get conditionalBranches() {
|
|
1934
|
-
return this._conditionalBranches;
|
|
1935
|
-
}
|
|
1936
|
-
get validationConditions() {
|
|
1937
|
-
return this._validationConditions;
|
|
1938
|
-
}
|
|
1939
|
-
get warningConditions() {
|
|
1940
|
-
return this._warningConditions;
|
|
1941
|
-
}
|
|
1942
|
-
get nextSlideCondition() {
|
|
1943
|
-
return this._nextSlideCondition;
|
|
1944
|
-
}
|
|
1945
|
-
get triggerConditions() {
|
|
1946
|
-
return this._triggerConditions;
|
|
1947
|
-
}
|
|
1948
|
-
editVisibility() {
|
|
1949
|
-
this._editVisibilityEvt.emit();
|
|
1950
|
-
}
|
|
1951
|
-
editConditionalBranch(idx) {
|
|
1952
|
-
if (idx < 0 || idx >= this._conditionalBranches.length) {
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
this._editConditionalBranchEvt.emit(idx);
|
|
1956
|
-
}
|
|
1957
|
-
editFormulaReps() {
|
|
1958
|
-
this._editFormulaRepsEvt.emit();
|
|
1959
|
-
}
|
|
1960
|
-
editChoicesFilter() {
|
|
1961
|
-
this._editChoicesFilterEvt.emit();
|
|
1962
|
-
}
|
|
1963
|
-
editFormula() {
|
|
1964
|
-
this._editFormulaEvt.emit();
|
|
1965
|
-
}
|
|
1966
|
-
editForceValue() {
|
|
1967
|
-
this._editForceValueEvt.emit();
|
|
1968
|
-
}
|
|
1969
|
-
editValidationCondition(idx) {
|
|
1970
|
-
if (idx < 0 || idx >= this._validationConditions.length) {
|
|
1971
|
-
return;
|
|
1972
|
-
}
|
|
1973
|
-
this._editValidationConditionEvt.emit(idx);
|
|
1974
|
-
}
|
|
1975
|
-
addValidationCondition() {
|
|
1976
|
-
this._addValidationConditionEvt.emit();
|
|
1977
|
-
}
|
|
1978
|
-
removeValidationCondition(idx) {
|
|
1979
|
-
if (idx < 0 || idx >= this._validationConditions.length) {
|
|
1980
|
-
return;
|
|
1981
|
-
}
|
|
1982
|
-
this._removeValidationConditionEvt.emit(idx);
|
|
1983
|
-
}
|
|
1984
|
-
editWarningCondition(idx) {
|
|
1985
|
-
if (idx < 0 || idx >= this._warningConditions.length) {
|
|
1986
|
-
return;
|
|
1987
|
-
}
|
|
1988
|
-
this._editWarningConditionEvt.emit(idx);
|
|
1989
|
-
}
|
|
1990
|
-
addWarningCondition() {
|
|
1991
|
-
this._addWarningConditionEvt.emit();
|
|
1992
|
-
}
|
|
1993
|
-
removeWarningCondition(idx) {
|
|
1994
|
-
if (idx < 0 || idx >= this._warningConditions.length) {
|
|
1995
|
-
return;
|
|
1996
|
-
}
|
|
1997
|
-
this._removeWarningConditionEvt.emit(idx);
|
|
1998
|
-
}
|
|
1999
|
-
editNextSlideCondition() {
|
|
2000
|
-
this._editNextSlideConditionEvt.emit();
|
|
2001
|
-
}
|
|
2002
|
-
editTriggerCondition(idx) {
|
|
2003
|
-
if (idx < 0 || idx >= this._triggerConditions.length) {
|
|
2004
|
-
return;
|
|
2005
|
-
}
|
|
2006
|
-
this._editTriggerConditionEvt.emit(idx);
|
|
2007
|
-
}
|
|
2008
|
-
addTriggerCondition() {
|
|
2009
|
-
this._addTriggerConditionEvt.emit();
|
|
2010
|
-
}
|
|
2011
|
-
removeTriggerCondition(idx) {
|
|
2012
|
-
if (idx < 0 || idx >= this._triggerConditions.length) {
|
|
2013
|
-
return;
|
|
2014
|
-
}
|
|
2015
|
-
this._removeTriggerConditionEvt.emit(idx);
|
|
2016
|
-
}
|
|
2017
|
-
isField(nodeEntry) {
|
|
2018
|
-
return nodeEntry != null && isField(nodeEntry.node);
|
|
2019
|
-
}
|
|
2020
|
-
isNumericField(node) {
|
|
2021
|
-
return isField(node) && isNumberField(node);
|
|
2022
|
-
}
|
|
2023
|
-
isFieldWithChoices(node) {
|
|
2024
|
-
return isField(node) && isFieldWithChoices(node);
|
|
2025
|
-
}
|
|
2026
|
-
hasChoicesOriginRef() {
|
|
2027
|
-
return this._propertiesForm.pipe(map(fg => {
|
|
2028
|
-
var _a;
|
|
2029
|
-
const value = ((_a = fg.get('choicesOriginRef')) === null || _a === void 0 ? void 0 : _a.value) != null;
|
|
2030
|
-
return value;
|
|
2031
|
-
}), take(1));
|
|
2032
|
-
}
|
|
2033
|
-
isRangeField(node) {
|
|
2034
|
-
return isField(node) && isRangeField(node);
|
|
2035
|
-
}
|
|
2036
|
-
isTableField(node) {
|
|
2037
|
-
return isField(node) && isTableField(node);
|
|
2038
|
-
}
|
|
2039
|
-
forceCheckbox(checked, checkbox) {
|
|
2040
|
-
if (!checked || !checkbox) {
|
|
2041
|
-
return;
|
|
2042
|
-
}
|
|
2043
|
-
if (checkbox.checked) {
|
|
2044
|
-
checkbox.toggle();
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
save() {
|
|
2048
|
-
this._saveEvt.emit();
|
|
2049
|
-
}
|
|
2050
|
-
cancel() {
|
|
2051
|
-
this._service.cancelNodeEntryEdit();
|
|
2052
|
-
}
|
|
2053
|
-
fieldErrorMessage(formControl, fieldName) {
|
|
2054
|
-
if (!formControl || !fieldName)
|
|
2055
|
-
return null;
|
|
2056
|
-
if (formControl.hasError('required')) {
|
|
2057
|
-
return `You must enter a value for ${fieldName}`;
|
|
2058
|
-
}
|
|
2059
|
-
if (formControl.hasError('name_exists')) {
|
|
2060
|
-
return `This ${fieldName} has already been used`;
|
|
2061
|
-
}
|
|
2062
|
-
return null;
|
|
2063
|
-
}
|
|
2064
|
-
ngOnDestroy() {
|
|
2065
|
-
this.cancel();
|
|
2066
|
-
this._choicesOriginsSub.unsubscribe();
|
|
2067
|
-
this._visibilityOptSub.unsubscribe();
|
|
2068
|
-
this._visibilitySub.unsubscribe();
|
|
2069
|
-
this._formulaRepsSub.unsubscribe();
|
|
2070
|
-
this._choicesFilterSub.unsubscribe();
|
|
2071
|
-
this._formulaSub.unsubscribe();
|
|
2072
|
-
this._forceValueSub.unsubscribe();
|
|
2073
|
-
this._validationConditionsSub.unsubscribe();
|
|
2074
|
-
this._warningConditionsSub.unsubscribe();
|
|
2075
|
-
this._triggerConditionsSub.unsubscribe();
|
|
2076
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2077
|
-
this._editValidationConditionDialogSub.unsubscribe();
|
|
2078
|
-
this._editWarningConditionDialogSub.unsubscribe();
|
|
2079
|
-
this._editChoicesFilterSub.unsubscribe();
|
|
2080
|
-
this._editConditionalBranchSub.unsubscribe();
|
|
2081
|
-
this._editVisibilitySub.unsubscribe();
|
|
2082
|
-
this._editFormulaRepsSub.unsubscribe();
|
|
2083
|
-
this._editFormulaSub.unsubscribe();
|
|
2084
|
-
this._editForceValueSub.unsubscribe();
|
|
2085
|
-
this._editValidationConditionSub.unsubscribe();
|
|
2086
|
-
this._editWarningConditionSub.unsubscribe();
|
|
2087
|
-
this._nextSlideConditionSub.unsubscribe();
|
|
2088
|
-
this._addTriggerConditionSub.unsubscribe();
|
|
2089
|
-
this._addValidationConditionSub.unsubscribe();
|
|
2090
|
-
this._addWarningConditionSub.unsubscribe();
|
|
2091
|
-
this._editNextSlideConditionSub.unsubscribe();
|
|
2092
|
-
this._editTriggerConditionSub.unsubscribe();
|
|
2093
|
-
this._removeTriggerConditionSub.unsubscribe();
|
|
2094
|
-
this._removeValidationConditionSub.unsubscribe();
|
|
2095
|
-
this._removeWarningConditionSub.unsubscribe();
|
|
2096
|
-
this._saveSub.unsubscribe();
|
|
2097
|
-
}
|
|
2098
|
-
_initSave() {
|
|
2099
|
-
this._saveSub = this._saveEvt
|
|
2100
|
-
.pipe(withLatestFrom(this.propertiesForm))
|
|
2101
|
-
.subscribe(([_, formGroup]) => {
|
|
2102
|
-
const fg = formGroup;
|
|
2103
|
-
const val = Object.assign(Object.assign({}, fg.value), { conditionalBranches: this._conditionalBranches });
|
|
2104
|
-
this._service.saveNodeEntry(val);
|
|
2105
|
-
});
|
|
2106
|
-
}
|
|
2107
|
-
_initForm() {
|
|
2108
|
-
this._propertiesForm = this._nodeEntry.pipe(filter(n => n != null), map(n => {
|
|
2109
|
-
if (this._visibilityOptSub != null) {
|
|
2110
|
-
this._visibilityOptSub.unsubscribe();
|
|
2111
|
-
}
|
|
2112
|
-
if (this._visibilitySub != null) {
|
|
2113
|
-
this._visibilitySub.unsubscribe();
|
|
2114
|
-
}
|
|
2115
|
-
if (this._conditionalBranchesSub != null) {
|
|
2116
|
-
this._conditionalBranchesSub.unsubscribe();
|
|
2117
|
-
}
|
|
2118
|
-
if (n == null) {
|
|
2119
|
-
return this._fb.group({});
|
|
2120
|
-
}
|
|
2121
|
-
const visibility = n.node.visibility != null ? n.node.visibility.condition : null;
|
|
2122
|
-
const visibilityOpt = n.node.visibility != null ? this._guessVisibilityOpt(n.node.visibility) : null;
|
|
2123
|
-
let controls = {
|
|
2124
|
-
name: [
|
|
2125
|
-
n.node.name,
|
|
2126
|
-
Validators.required,
|
|
2127
|
-
this._nodeNameValidator.sameValueCheck(this._cdr, n.node.id),
|
|
2128
|
-
],
|
|
2129
|
-
label: [n.node.label, Validators.required],
|
|
2130
|
-
visibilityOpt: [visibilityOpt, Validators.required],
|
|
2131
|
-
visibility: [visibility, Validators.required],
|
|
2132
|
-
conditionalBranchesNum: n.node.conditionalBranches.length,
|
|
2133
|
-
};
|
|
2134
|
-
const validators = [];
|
|
2135
|
-
if (isRepeatingContainerNode(n.node)) {
|
|
2136
|
-
const rn = n.node;
|
|
2137
|
-
const formulaReps = rn.formulaReps != null ? rn.formulaReps.formula : null;
|
|
2138
|
-
controls.formulaReps = [formulaReps, Validators.required];
|
|
2139
|
-
controls.minReps = rn.minReps;
|
|
2140
|
-
controls.maxReps = rn.maxReps;
|
|
2141
|
-
this._curFormulaReps = formulaReps;
|
|
2142
|
-
validators.push(checkRepsValidity);
|
|
2143
|
-
}
|
|
2144
|
-
const { node } = n;
|
|
2145
|
-
if (isField(node)) {
|
|
2146
|
-
let forceValue = null;
|
|
2147
|
-
let notEmpty = false;
|
|
2148
|
-
let validationConditions = [];
|
|
2149
|
-
if (node.validation != null) {
|
|
2150
|
-
if (node.validation.forceValue != null) {
|
|
2151
|
-
forceValue = node.validation.forceValue.condition;
|
|
2152
|
-
}
|
|
2153
|
-
notEmpty = node.validation.notEmpty != null;
|
|
2154
|
-
validationConditions = (node.validation.conditions || []).map(c => {
|
|
2155
|
-
return { condition: c.condition, errorMessage: c.errorMessage };
|
|
2156
|
-
});
|
|
2157
|
-
}
|
|
2158
|
-
let notEmptyW = false;
|
|
2159
|
-
let warningConditions = [];
|
|
2160
|
-
if (node.warning != null) {
|
|
2161
|
-
notEmptyW = node.warning.notEmpty != null;
|
|
2162
|
-
warningConditions = (node.warning.conditions || []).map(w => {
|
|
2163
|
-
return { condition: w.condition, warningMessage: w.warningMessage };
|
|
2164
|
-
});
|
|
2165
|
-
}
|
|
2166
|
-
const formula = node.formula != null ? node.formula.formula : null;
|
|
2167
|
-
controls.description = node.description;
|
|
2168
|
-
controls.defaultValue = node.defaultValue;
|
|
2169
|
-
controls.hint = node.hint;
|
|
2170
|
-
controls.size = node.size;
|
|
2171
|
-
controls.formula = formula;
|
|
2172
|
-
controls.forceValue = forceValue;
|
|
2173
|
-
controls.notEmpty = notEmpty;
|
|
2174
|
-
controls.validationConditions = [validationConditions, []];
|
|
2175
|
-
controls.notEmptyWarning = notEmptyW;
|
|
2176
|
-
controls.readonlyField = node.editable != null ? !node.editable : false;
|
|
2177
|
-
controls.warningConditions = [warningConditions, []];
|
|
2178
|
-
controls.nextSlideCondition = [node.nextSlideCondition];
|
|
2179
|
-
this._curForceValue = forceValue;
|
|
2180
|
-
this._curFormula = formula;
|
|
2181
|
-
this._validationConditions = validationConditions;
|
|
2182
|
-
this._warningConditions = warningConditions;
|
|
2183
|
-
}
|
|
2184
|
-
if (this.isNumericField(node)) {
|
|
2185
|
-
let minValue;
|
|
2186
|
-
let maxValue;
|
|
2187
|
-
let minDigits;
|
|
2188
|
-
let maxDigits;
|
|
2189
|
-
if (node.validation != null) {
|
|
2190
|
-
if (node.validation.minValue != null) {
|
|
2191
|
-
minValue = (node.validation.minValue.condition || '').replace('$value >= ', '');
|
|
2192
|
-
}
|
|
2193
|
-
if (node.validation.maxValue != null) {
|
|
2194
|
-
maxValue = (node.validation.maxValue.condition || '').replace('$value <= ', '');
|
|
2195
|
-
}
|
|
2196
|
-
if (node.validation.minDigits != null) {
|
|
2197
|
-
minDigits = (node.validation.minDigits.condition || '').replace('$value.toString().length >= ', '');
|
|
2198
|
-
}
|
|
2199
|
-
if (node.validation.maxDigits != null) {
|
|
2200
|
-
maxDigits = (node.validation.maxDigits.condition || '').replace('$value.toString().length <= ', '');
|
|
2201
|
-
}
|
|
2202
|
-
}
|
|
2203
|
-
controls.minValue = minValue;
|
|
2204
|
-
controls.maxValue = maxValue;
|
|
2205
|
-
controls.minDigits = minDigits;
|
|
2206
|
-
controls.maxDigits = maxDigits;
|
|
2207
|
-
validators.push(checkValueLimitsValidity);
|
|
2208
|
-
validators.push(checkDigitsValidity);
|
|
2209
|
-
}
|
|
2210
|
-
if (this.isRangeField(node)) {
|
|
2211
|
-
const { start, end, step } = node;
|
|
2212
|
-
controls.start = start;
|
|
2213
|
-
controls.end = end;
|
|
2214
|
-
controls.step = step;
|
|
2215
|
-
validators.push(checkRangeValidity);
|
|
2216
|
-
}
|
|
2217
|
-
if (this.isFieldWithChoices(node)) {
|
|
2218
|
-
let triggerConditions = (node.triggerConditions || []).map(c => c.condition);
|
|
2219
|
-
controls.choicesOriginRef = node.choicesOriginRef;
|
|
2220
|
-
controls.choicesFilter = node.choicesFilter != null ? node.choicesFilter.formula : null;
|
|
2221
|
-
controls.forceExpanded = node.forceExpanded;
|
|
2222
|
-
controls.forceNarrow = node.forceNarrow;
|
|
2223
|
-
controls.triggerConditions = triggerConditions;
|
|
2224
|
-
this._triggerConditions = triggerConditions;
|
|
2225
|
-
}
|
|
2226
|
-
if (this.isTableField(node)) {
|
|
2227
|
-
const { columnTypes, rows, columnLabels, rowLabels } = node;
|
|
2228
|
-
const tableDef = { columnTypes, rows, columnLabels, rowLabels };
|
|
2229
|
-
controls.tableDef = JSON.stringify(tableDef, undefined, 2);
|
|
2230
|
-
controls.hideEmptyRows = node.hideEmptyRows;
|
|
2231
|
-
}
|
|
2232
|
-
const fg = this._fb.group(controls);
|
|
2233
|
-
fg.setValidators(validators);
|
|
2234
|
-
this._conditionalBranches = n.node.conditionalBranches.map(c => c.condition);
|
|
2235
|
-
this._curVisibility = n.node.visibility != null ? n.node.visibility.condition : null;
|
|
2236
|
-
this._handleConditionalBranchesChange(fg);
|
|
2237
|
-
this._handleVisibilityChange(fg);
|
|
2238
|
-
this._handleFormulaRepsChange(fg);
|
|
2239
|
-
this._handleChoicesFilterChange(fg);
|
|
2240
|
-
this._handleFormulaChange(fg);
|
|
2241
|
-
this._handleForceValueChange(fg);
|
|
2242
|
-
this._handleValidationCondtionsChange(fg);
|
|
2243
|
-
this._handleWarningCondtionsChange(fg);
|
|
2244
|
-
this._handleNextSlideConditionChange(fg);
|
|
2245
|
-
this._handleTriggerCondtionsChange(fg);
|
|
2246
|
-
return fg;
|
|
2247
|
-
}), shareReplay(1));
|
|
2248
|
-
}
|
|
2249
|
-
_destroyConditionDialog() {
|
|
2250
|
-
if (this._editConditionDialogSub != null) {
|
|
2251
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2252
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2253
|
-
}
|
|
2254
|
-
if (this._editConditionDialog != null) {
|
|
2255
|
-
this._editConditionDialog.close();
|
|
2256
|
-
this._editConditionDialog = null;
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
_destroyValidationConditionDialog() {
|
|
2260
|
-
if (this._editValidationConditionDialogSub != null) {
|
|
2261
|
-
this._editValidationConditionDialogSub.unsubscribe();
|
|
2262
|
-
this._editValidationConditionDialogSub = Subscription.EMPTY;
|
|
2263
|
-
}
|
|
2264
|
-
if (this._editValidationConditionDialog != null) {
|
|
2265
|
-
this._editValidationConditionDialog.close();
|
|
2266
|
-
this._editValidationConditionDialog = null;
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
_destroyWarningConditionDialog() {
|
|
2270
|
-
if (this._editWarningConditionDialogSub != null) {
|
|
2271
|
-
this._editWarningConditionDialogSub.unsubscribe();
|
|
2272
|
-
this._editWarningConditionDialogSub = Subscription.EMPTY;
|
|
2273
|
-
}
|
|
2274
|
-
if (this._editWarningConditionDialog != null) {
|
|
2275
|
-
this._editWarningConditionDialog.close();
|
|
2276
|
-
this._editWarningConditionDialog = null;
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
_initRemoveTriggerCondition() {
|
|
2280
|
-
this._removeTriggerConditionSub = this._removeTriggerConditionEvt
|
|
2281
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2282
|
-
.subscribe(([vcIdx, formGroup]) => {
|
|
2283
|
-
if (formGroup == null) {
|
|
2284
|
-
return;
|
|
2285
|
-
}
|
|
2286
|
-
const fg = formGroup;
|
|
2287
|
-
const ctrl = fg.controls['triggerConditions'];
|
|
2288
|
-
let vcs = (ctrl.value || []).slice(0);
|
|
2289
|
-
if (vcIdx < 0 || vcIdx >= vcs.length) {
|
|
2290
|
-
return;
|
|
2291
|
-
}
|
|
2292
|
-
vcs.splice(vcIdx, 1);
|
|
2293
|
-
ctrl.setValue(vcs);
|
|
2294
|
-
});
|
|
2295
|
-
}
|
|
2296
|
-
_initAddTriggerCondition() {
|
|
2297
|
-
this._addTriggerConditionSub = this._addTriggerConditionEvt
|
|
2298
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2299
|
-
.subscribe(([_, formGroup]) => {
|
|
2300
|
-
if (formGroup == null) {
|
|
2301
|
-
return;
|
|
2302
|
-
}
|
|
2303
|
-
const fg = formGroup;
|
|
2304
|
-
const ctrl = fg.controls['triggerConditions'];
|
|
2305
|
-
let vcs = (ctrl.value || []).slice(0);
|
|
2306
|
-
vcs.push('');
|
|
2307
|
-
ctrl.setValue(vcs);
|
|
2308
|
-
});
|
|
2309
|
-
}
|
|
2310
|
-
_initTriggerConditionEdit() {
|
|
2311
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2312
|
-
this._cdr.markForCheck();
|
|
2313
|
-
this._editTriggerConditionSub = this._editTriggerConditionEvt
|
|
2314
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2315
|
-
.subscribe(([vcIdx, fg]) => {
|
|
2316
|
-
this._destroyConditionDialog();
|
|
2317
|
-
if (vcIdx < 0 || vcIdx >= this._triggerConditions.length || fg == null) {
|
|
2318
|
-
return;
|
|
2319
|
-
}
|
|
2320
|
-
this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
|
|
2321
|
-
const cmp = this._editConditionDialog.componentInstance;
|
|
2322
|
-
cmp.condition = this._triggerConditions[vcIdx];
|
|
2323
|
-
this._editConditionDialogSub = this._editConditionDialog
|
|
2324
|
-
.afterClosed()
|
|
2325
|
-
.subscribe((cond) => {
|
|
2326
|
-
if (cond !== void 0) {
|
|
2327
|
-
this._triggerConditions[vcIdx] = cond;
|
|
2328
|
-
}
|
|
2329
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2330
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2331
|
-
this._cdr.markForCheck();
|
|
2332
|
-
});
|
|
2333
|
-
});
|
|
2334
|
-
}
|
|
2335
|
-
_initRemoveWarningCondition() {
|
|
2336
|
-
this._removeWarningConditionSub = this._removeWarningConditionEvt
|
|
2337
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2338
|
-
.subscribe(([vcIdx, formGroup]) => {
|
|
2339
|
-
if (formGroup == null) {
|
|
2340
|
-
return;
|
|
2341
|
-
}
|
|
2342
|
-
const fg = formGroup;
|
|
2343
|
-
const ctrl = fg.controls['warningConditions'];
|
|
2344
|
-
let vcs = (ctrl.value || []).slice(0);
|
|
2345
|
-
if (vcIdx < 0 || vcIdx >= vcs.length) {
|
|
2346
|
-
return;
|
|
2347
|
-
}
|
|
2348
|
-
vcs.splice(vcIdx, 1);
|
|
2349
|
-
ctrl.setValue(vcs);
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
|
-
_initAddWarningCondition() {
|
|
2353
|
-
this._addWarningConditionSub = this._addWarningConditionEvt
|
|
2354
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2355
|
-
.subscribe(([_, formGroup]) => {
|
|
2356
|
-
if (formGroup == null) {
|
|
2357
|
-
return;
|
|
2358
|
-
}
|
|
2359
|
-
const fg = formGroup;
|
|
2360
|
-
const ctrl = fg.controls['warningConditions'];
|
|
2361
|
-
let vcs = (ctrl.value || []).slice(0);
|
|
2362
|
-
vcs.push({ condition: '', errorMessage: '' });
|
|
2363
|
-
ctrl.setValue(vcs);
|
|
2364
|
-
});
|
|
2365
|
-
}
|
|
2366
|
-
_initWarningConditionEdit() {
|
|
2367
|
-
this._editWarningConditionSub = this._editWarningConditionEvt
|
|
2368
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2369
|
-
.subscribe(([vcIdx, fg]) => {
|
|
2370
|
-
this._destroyWarningConditionDialog();
|
|
2371
|
-
if (vcIdx < 0 || vcIdx >= this._warningConditions.length || fg == null) {
|
|
2372
|
-
return;
|
|
2373
|
-
}
|
|
2374
|
-
this._editWarningConditionDialog = this._dialog.open(AjfFbWarningConditionEditorDialog);
|
|
2375
|
-
const cmp = this._editWarningConditionDialog.componentInstance;
|
|
2376
|
-
const w = this._warningConditions[vcIdx];
|
|
2377
|
-
cmp.condition = w.condition;
|
|
2378
|
-
cmp.warningMessage = w.warningMessage;
|
|
2379
|
-
this._editWarningConditionDialogSub = this._editWarningConditionDialog
|
|
2380
|
-
.afterClosed()
|
|
2381
|
-
.subscribe((cond) => {
|
|
2382
|
-
if (cond !== void 0) {
|
|
2383
|
-
this._warningConditions[vcIdx] = cond;
|
|
2384
|
-
}
|
|
2385
|
-
this._editWarningConditionDialogSub.unsubscribe();
|
|
2386
|
-
this._editWarningConditionDialogSub = Subscription.EMPTY;
|
|
2387
|
-
this._cdr.markForCheck();
|
|
2388
|
-
});
|
|
2389
|
-
});
|
|
2390
|
-
}
|
|
2391
|
-
_initRemoveValidationCondition() {
|
|
2392
|
-
this._removeValidationConditionSub = this._removeValidationConditionEvt
|
|
2393
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2394
|
-
.subscribe(([vcIdx, formGroup]) => {
|
|
2395
|
-
if (formGroup == null) {
|
|
2396
|
-
return;
|
|
2397
|
-
}
|
|
2398
|
-
const fg = formGroup;
|
|
2399
|
-
const ctrl = fg.controls['validationConditions'];
|
|
2400
|
-
let vcs = (ctrl.value || []).slice(0);
|
|
2401
|
-
if (vcIdx < 0 || vcIdx >= vcs.length) {
|
|
2402
|
-
return;
|
|
2403
|
-
}
|
|
2404
|
-
vcs.splice(vcIdx, 1);
|
|
2405
|
-
ctrl.setValue(vcs);
|
|
2406
|
-
});
|
|
2407
|
-
}
|
|
2408
|
-
_initAddValidationCondition() {
|
|
2409
|
-
this._addValidationConditionSub = this._addValidationConditionEvt
|
|
2410
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2411
|
-
.subscribe(([_, formGroup]) => {
|
|
2412
|
-
if (formGroup == null) {
|
|
2413
|
-
return;
|
|
2414
|
-
}
|
|
2415
|
-
const fg = formGroup;
|
|
2416
|
-
const ctrl = fg.controls['validationConditions'];
|
|
2417
|
-
let vcs = (ctrl.value || []).slice(0);
|
|
2418
|
-
vcs.push({ condition: '', errorMessage: '' });
|
|
2419
|
-
ctrl.setValue(vcs);
|
|
2420
|
-
});
|
|
2421
|
-
}
|
|
2422
|
-
_initValidationConditionEdit() {
|
|
2423
|
-
this._editValidationConditionSub = this._editValidationConditionEvt
|
|
2424
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2425
|
-
.subscribe(([vcIdx, fg]) => {
|
|
2426
|
-
this._destroyValidationConditionDialog();
|
|
2427
|
-
if (vcIdx < 0 || vcIdx >= this._validationConditions.length || fg == null) {
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
this._editValidationConditionDialog = this._dialog.open(AjfFbValidationConditionEditorDialog);
|
|
2431
|
-
const cmp = this._editValidationConditionDialog.componentInstance;
|
|
2432
|
-
const v = this._validationConditions[vcIdx];
|
|
2433
|
-
cmp.condition = v.condition;
|
|
2434
|
-
cmp.errorMessage = v.errorMessage;
|
|
2435
|
-
this._editValidationConditionDialogSub = this._editValidationConditionDialog
|
|
2436
|
-
.afterClosed()
|
|
2437
|
-
.subscribe((cond) => {
|
|
2438
|
-
if (cond !== void 0) {
|
|
2439
|
-
this._validationConditions[vcIdx] = cond;
|
|
2440
|
-
}
|
|
2441
|
-
this._editValidationConditionDialogSub.unsubscribe();
|
|
2442
|
-
this._editValidationConditionDialogSub = Subscription.EMPTY;
|
|
2443
|
-
this._cdr.markForCheck();
|
|
2444
|
-
});
|
|
2445
|
-
});
|
|
2446
|
-
}
|
|
2447
|
-
_initForceValueEdit() {
|
|
2448
|
-
this._editForceValueSub = this._editForceValueEvt
|
|
2449
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2450
|
-
.subscribe(([_, formGroup]) => {
|
|
2451
|
-
this._destroyConditionDialog();
|
|
2452
|
-
if (formGroup == null) {
|
|
2453
|
-
return;
|
|
2454
|
-
}
|
|
2455
|
-
const fg = formGroup;
|
|
2456
|
-
const ctrl = fg.controls['forceValue'];
|
|
2457
|
-
this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
|
|
2458
|
-
this._editConditionDialog.componentInstance.condition = ctrl.value;
|
|
2459
|
-
this._editConditionDialogSub = this._editConditionDialog
|
|
2460
|
-
.afterClosed()
|
|
2461
|
-
.subscribe((cond) => {
|
|
2462
|
-
if (cond !== void 0) {
|
|
2463
|
-
ctrl.setValue(cond);
|
|
2464
|
-
}
|
|
2465
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2466
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2467
|
-
this._cdr.markForCheck();
|
|
2468
|
-
});
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
_initNextSlideConditionEdit() {
|
|
2472
|
-
this._editNextSlideConditionSub = this._editNextSlideConditionEvt
|
|
2473
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2474
|
-
.subscribe(([_, formGroup]) => {
|
|
2475
|
-
this._destroyConditionDialog();
|
|
2476
|
-
if (formGroup == null) {
|
|
2477
|
-
return;
|
|
2478
|
-
}
|
|
2479
|
-
const fg = formGroup;
|
|
2480
|
-
const ctrl = fg.controls['nextSlideCondition'];
|
|
2481
|
-
this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
|
|
2482
|
-
this._editConditionDialog.componentInstance.condition = ctrl.value;
|
|
2483
|
-
this._editConditionDialogSub = this._editConditionDialog
|
|
2484
|
-
.afterClosed()
|
|
2485
|
-
.subscribe((cond) => {
|
|
2486
|
-
if (cond !== void 0) {
|
|
2487
|
-
ctrl.setValue(cond);
|
|
2488
|
-
}
|
|
2489
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2490
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2491
|
-
this._cdr.markForCheck();
|
|
2492
|
-
});
|
|
2493
|
-
});
|
|
2494
|
-
}
|
|
2495
|
-
_initFormulaEdit() {
|
|
2496
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2497
|
-
this._cdr.markForCheck();
|
|
2498
|
-
this._editFormulaSub = this._editFormulaEvt
|
|
2499
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2500
|
-
.subscribe(([_, formGroup]) => {
|
|
2501
|
-
this._destroyConditionDialog();
|
|
2502
|
-
if (formGroup == null) {
|
|
2503
|
-
return;
|
|
2504
|
-
}
|
|
2505
|
-
const fg = formGroup;
|
|
2506
|
-
const ctrl = fg.controls['formula'];
|
|
2507
|
-
this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
|
|
2508
|
-
this._editConditionDialog.componentInstance.condition = ctrl.value;
|
|
2509
|
-
this._editConditionDialogSub = this._editConditionDialog
|
|
2510
|
-
.afterClosed()
|
|
2511
|
-
.subscribe((cond) => {
|
|
2512
|
-
if (cond !== void 0) {
|
|
2513
|
-
ctrl.setValue(cond);
|
|
2514
|
-
}
|
|
2515
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2516
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2517
|
-
this._cdr.markForCheck();
|
|
2518
|
-
});
|
|
2519
|
-
});
|
|
2520
|
-
}
|
|
2521
|
-
_initFormulaRepsEdit() {
|
|
2522
|
-
this._editFormulaRepsSub = this._editFormulaRepsEvt
|
|
2523
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2524
|
-
.subscribe(([_, formGroup]) => {
|
|
2525
|
-
this._destroyConditionDialog();
|
|
2526
|
-
if (formGroup == null) {
|
|
2527
|
-
return;
|
|
2528
|
-
}
|
|
2529
|
-
const fg = formGroup;
|
|
2530
|
-
const ctrl = fg.controls['formulaReps'];
|
|
2531
|
-
this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
|
|
2532
|
-
this._editConditionDialog.componentInstance.condition = ctrl.value;
|
|
2533
|
-
this._editConditionDialogSub = this._editConditionDialog
|
|
2534
|
-
.afterClosed()
|
|
2535
|
-
.subscribe((cond) => {
|
|
2536
|
-
if (cond !== void 0) {
|
|
2537
|
-
ctrl.setValue(cond);
|
|
2538
|
-
}
|
|
2539
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2540
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2541
|
-
this._cdr.markForCheck();
|
|
2542
|
-
});
|
|
2543
|
-
});
|
|
2544
|
-
}
|
|
2545
|
-
_initChoicesFilterEdit() {
|
|
2546
|
-
this._editChoicesFilterSub = this._editChoicesFilterEvt
|
|
2547
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2548
|
-
.subscribe(([_, formGroup]) => {
|
|
2549
|
-
this._destroyConditionDialog();
|
|
2550
|
-
if (formGroup == null) {
|
|
2551
|
-
return;
|
|
2552
|
-
}
|
|
2553
|
-
const fg = formGroup;
|
|
2554
|
-
const ctrl = fg.controls['choicesFilter'];
|
|
2555
|
-
this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
|
|
2556
|
-
this._editConditionDialog.componentInstance.condition = ctrl.value;
|
|
2557
|
-
this._editConditionDialogSub = this._editConditionDialog
|
|
2558
|
-
.afterClosed()
|
|
2559
|
-
.subscribe((cond) => {
|
|
2560
|
-
if (cond !== void 0) {
|
|
2561
|
-
ctrl.setValue(cond);
|
|
2562
|
-
}
|
|
2563
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2564
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2565
|
-
this._cdr.markForCheck();
|
|
2566
|
-
});
|
|
2567
|
-
});
|
|
2568
|
-
}
|
|
2569
|
-
_initConditionalBranchEdit() {
|
|
2570
|
-
this._editConditionalBranchSub = this._editConditionalBranchEvt
|
|
2571
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2572
|
-
.subscribe(([cbIdx, fg]) => {
|
|
2573
|
-
this._destroyConditionDialog();
|
|
2574
|
-
if (cbIdx < 0 || cbIdx >= this._conditionalBranches.length || fg == null) {
|
|
2575
|
-
return;
|
|
2576
|
-
}
|
|
2577
|
-
this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
|
|
2578
|
-
this._editConditionDialog.componentInstance.condition = this._conditionalBranches[cbIdx];
|
|
2579
|
-
this._editConditionDialogSub = this._editConditionDialog
|
|
2580
|
-
.afterClosed()
|
|
2581
|
-
.subscribe((cond) => {
|
|
2582
|
-
if (cond !== void 0) {
|
|
2583
|
-
this._conditionalBranches[cbIdx] = cond;
|
|
2584
|
-
}
|
|
2585
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2586
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2587
|
-
this._cdr.markForCheck();
|
|
2588
|
-
});
|
|
2589
|
-
});
|
|
2590
|
-
}
|
|
2591
|
-
_initVisibilityEdit() {
|
|
2592
|
-
this._editVisibilitySub = this._editVisibilityEvt
|
|
2593
|
-
.pipe(withLatestFrom(this._propertiesForm))
|
|
2594
|
-
.subscribe(([_, formGroup]) => {
|
|
2595
|
-
this._destroyConditionDialog();
|
|
2596
|
-
if (formGroup == null) {
|
|
2597
|
-
return;
|
|
2598
|
-
}
|
|
2599
|
-
const fg = formGroup;
|
|
2600
|
-
const ctrl = fg.controls['visibility'];
|
|
2601
|
-
const condition = ctrl.value;
|
|
2602
|
-
this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
|
|
2603
|
-
this._editConditionDialog.componentInstance.condition = condition;
|
|
2604
|
-
this._editConditionDialogSub = this._editConditionDialog
|
|
2605
|
-
.afterClosed()
|
|
2606
|
-
.subscribe((cond) => {
|
|
2607
|
-
if (cond !== void 0) {
|
|
2608
|
-
ctrl.setValue(cond);
|
|
2609
|
-
}
|
|
2610
|
-
this._editConditionDialogSub.unsubscribe();
|
|
2611
|
-
this._editConditionDialogSub = Subscription.EMPTY;
|
|
2612
|
-
this._cdr.markForCheck();
|
|
2613
|
-
});
|
|
2614
|
-
});
|
|
2615
|
-
}
|
|
2616
|
-
_handleTriggerCondtionsChange(fg) {
|
|
2617
|
-
this._triggerConditionsSub = fg.valueChanges
|
|
2618
|
-
.pipe(distinctUntilChanged((v1, v2) => JSON.stringify(v1.triggerConditions) === JSON.stringify(v2.triggerConditions)))
|
|
2619
|
-
.subscribe((v) => {
|
|
2620
|
-
this._triggerConditions = v.triggerConditions;
|
|
2621
|
-
this._cdr.markForCheck();
|
|
2622
|
-
});
|
|
2623
|
-
}
|
|
2624
|
-
_handleWarningCondtionsChange(fg) {
|
|
2625
|
-
this._warningConditionsSub = fg.valueChanges
|
|
2626
|
-
.pipe(distinctUntilChanged((v1, v2) => JSON.stringify(v1.warningConditions) === JSON.stringify(v2.warningConditions)))
|
|
2627
|
-
.subscribe((v) => {
|
|
2628
|
-
this._warningConditions = v.warningConditions;
|
|
2629
|
-
this._cdr.markForCheck();
|
|
2630
|
-
});
|
|
2631
|
-
}
|
|
2632
|
-
_handleValidationCondtionsChange(fg) {
|
|
2633
|
-
this._validationConditionsSub = fg.valueChanges
|
|
2634
|
-
.pipe(distinctUntilChanged((v1, v2) => JSON.stringify(v1.validationConditions) === JSON.stringify(v2.validationConditions)))
|
|
2635
|
-
.subscribe((v) => {
|
|
2636
|
-
this._validationConditions = v.validationConditions;
|
|
2637
|
-
this._cdr.markForCheck();
|
|
2638
|
-
});
|
|
2639
|
-
}
|
|
2640
|
-
_handleForceValueChange(fg) {
|
|
2641
|
-
this._forceValueSub = fg.valueChanges
|
|
2642
|
-
.pipe(distinctUntilChanged((v1, v2) => v1.forceValue === v2.forceValue))
|
|
2643
|
-
.subscribe((v) => {
|
|
2644
|
-
this._curForceValue = v.forceValue;
|
|
2645
|
-
this._cdr.markForCheck();
|
|
2646
|
-
});
|
|
2647
|
-
}
|
|
2648
|
-
_handleNextSlideConditionChange(fg) {
|
|
2649
|
-
this._formulaSub = fg.valueChanges
|
|
2650
|
-
.pipe(distinctUntilChanged((v1, v2) => v1.nextSlideCondition === v2.nextSlideCondition))
|
|
2651
|
-
.subscribe((v) => {
|
|
2652
|
-
this._nextSlideCondition = v.nextSlideCondition;
|
|
2653
|
-
this._cdr.markForCheck();
|
|
2654
|
-
});
|
|
2655
|
-
this._formulaSub = fg.valueChanges
|
|
2656
|
-
.pipe(distinctUntilChanged((v1, v2) => v1.nextSlideCondition === v2.nextSlideCondition))
|
|
2657
|
-
.subscribe((v) => {
|
|
2658
|
-
this._nextSlideCondition = v.nextSlideCondition;
|
|
2659
|
-
this._cdr.markForCheck();
|
|
2660
|
-
});
|
|
2661
|
-
}
|
|
2662
|
-
_handleFormulaChange(fg) {
|
|
2663
|
-
this._formulaSub = fg.valueChanges
|
|
2664
|
-
.pipe(distinctUntilChanged((v1, v2) => v1.formula === v2.formula))
|
|
2665
|
-
.subscribe((v) => {
|
|
2666
|
-
this._curFormula = v.formula;
|
|
2667
|
-
this._cdr.markForCheck();
|
|
2668
|
-
});
|
|
2669
|
-
}
|
|
2670
|
-
_handleFormulaRepsChange(fg) {
|
|
2671
|
-
this._formulaRepsSub = fg.valueChanges
|
|
2672
|
-
.pipe(distinctUntilChanged((v1, v2) => v1.formulaReps === v2.formulaReps))
|
|
2673
|
-
.subscribe((v) => {
|
|
2674
|
-
this._curFormulaReps = v.formulaReps;
|
|
2675
|
-
this._cdr.markForCheck();
|
|
2676
|
-
});
|
|
2677
|
-
}
|
|
2678
|
-
_handleChoicesFilterChange(fg) {
|
|
2679
|
-
this._choicesFilterSub = fg.valueChanges
|
|
2680
|
-
.pipe(distinctUntilChanged((v1, v2) => v1.choicesFilter === v2.choicesFilter))
|
|
2681
|
-
.subscribe((v) => {
|
|
2682
|
-
this._curChoicesFilter = v.choicesFilter;
|
|
2683
|
-
this._cdr.markForCheck();
|
|
2684
|
-
});
|
|
2685
|
-
}
|
|
2686
|
-
_handleConditionalBranchesChange(fg) {
|
|
2687
|
-
this._conditionalBranchesSub = fg.valueChanges
|
|
2688
|
-
.pipe(distinctUntilChanged((v1, v2) => v1.conditionalBranchesNum === v2.conditionalBranchesNum))
|
|
2689
|
-
.subscribe((v) => {
|
|
2690
|
-
const cbNum = v.conditionalBranchesNum;
|
|
2691
|
-
const curCbNum = this._conditionalBranches.length;
|
|
2692
|
-
if (curCbNum < cbNum) {
|
|
2693
|
-
let newCbs = [];
|
|
2694
|
-
for (let i = curCbNum; i < cbNum; i++) {
|
|
2695
|
-
newCbs.push(alwaysCondition().condition);
|
|
2696
|
-
}
|
|
2697
|
-
this._conditionalBranches = this._conditionalBranches.concat(newCbs);
|
|
2698
|
-
}
|
|
2699
|
-
else if (curCbNum > cbNum) {
|
|
2700
|
-
this._conditionalBranches.splice(0, curCbNum - cbNum);
|
|
2701
|
-
}
|
|
2702
|
-
this._cdr.markForCheck();
|
|
2703
|
-
});
|
|
2704
|
-
}
|
|
2705
|
-
_handleVisibilityChange(fg) {
|
|
2706
|
-
this._visibilitySub = fg.valueChanges
|
|
2707
|
-
.pipe(distinctUntilChanged((v1, v2) => v1.visibilityOpt === v2.visibilityOpt))
|
|
2708
|
-
.subscribe(v => {
|
|
2709
|
-
const visibilityOpt = v.visibilityOpt;
|
|
2710
|
-
const visibility = v.visibility;
|
|
2711
|
-
let newCondition;
|
|
2712
|
-
switch (visibilityOpt) {
|
|
2713
|
-
case 'always':
|
|
2714
|
-
newCondition = alwaysCondition().condition;
|
|
2715
|
-
break;
|
|
2716
|
-
case 'never':
|
|
2717
|
-
newCondition = neverCondition().condition;
|
|
2718
|
-
break;
|
|
2719
|
-
case 'condition':
|
|
2720
|
-
newCondition = visibility && visibility.length ? visibility : null;
|
|
2721
|
-
break;
|
|
2722
|
-
default:
|
|
2723
|
-
newCondition = null;
|
|
2724
|
-
}
|
|
2725
|
-
this._curVisibility = newCondition;
|
|
2726
|
-
fg.controls['visibility'].setValue(newCondition);
|
|
2727
|
-
this._cdr.markForCheck();
|
|
2728
|
-
});
|
|
2729
|
-
this._visibilitySub = fg.valueChanges
|
|
2730
|
-
.pipe(filter(v => v.visibilityOpt === 'condition'), distinctUntilChanged((v1, v2) => v1.visibility === v2.visibility))
|
|
2731
|
-
.subscribe(v => {
|
|
2732
|
-
this._curVisibility = v.visibility;
|
|
2733
|
-
this._cdr.markForCheck();
|
|
2734
|
-
});
|
|
2735
|
-
}
|
|
2736
|
-
_guessVisibilityOpt(condition) {
|
|
2737
|
-
if (condition.condition.localeCompare(alwaysCondition().condition) === 0) {
|
|
2738
|
-
return 'always';
|
|
2739
|
-
}
|
|
2740
|
-
if (condition.condition.localeCompare(neverCondition().condition) === 0) {
|
|
2741
|
-
return 'never';
|
|
2742
|
-
}
|
|
2743
|
-
return 'condition';
|
|
2744
|
-
}
|
|
2745
|
-
}
|
|
2746
|
-
AjfFbNodeProperties.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbNodeProperties, deps: [{ token: i0.ChangeDetectorRef }, { token: AjfFormBuilderService }, { token: i2.MatDialog }, { token: i3$1.UntypedFormBuilder }, { token: AjfNodePropertiesNameMatchValidator }], target: i0.ɵɵFactoryTarget.Component });
|
|
2747
|
-
AjfFbNodeProperties.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbNodeProperties, selector: "ajf-fb-node-properties", ngImport: i0, template: "<div [style.display]=\"(enabled|async) ? 'none' : 'block'\" class=\"ajf-disabled-overlay\"></div>\n<ng-container *ngIf=\"nodeEntry|async as ne\">\n <ng-container *ngIf=\"propertiesForm|async as pf\">\n <div class=\"ajf-header\">\n <h3>{{'Properties'|transloco}}</h3>\n <button\n *ngIf=\"isFieldWithChoices(ne.node) && (hasChoicesOriginRef()|async) === false; else readysavebtn\"\n mat-icon-button\n color=\"warn\"\n [matTooltip]=\"'Please select a Choice Origin for this field'\"\n >\n <mat-icon>save</mat-icon>\n </button>\n <ng-template #readysavebtn>\n <button\n mat-icon-button\n [disabled]=\"pf.get('name')?.invalid || pf.get('label')?.invalid\"\n (click)=\"save()\"\n >\n <mat-icon>save</mat-icon>\n </button></ng-template\n >\n <button mat-icon-button (click)=\"cancel()\">\n <mat-icon>cancel</mat-icon>\n </button>\n </div>\n <form [formGroup]=\"pf!\" novalidate>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"name\" [placeholder]=\"'Name' | transloco\" />\n <mat-error *ngIf=\"pf.get('name')?.invalid\">\n {{fieldErrorMessage(pf.get('name'), 'Name')}}\n </mat-error>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"label\" [placeholder]=\"'Label' | transloco\" />\n <mat-error *ngIf=\"pf.get('label')?.invalid\">\n {{fieldErrorMessage(pf.get('label'), 'Label')}}\n </mat-error>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <mat-label>{{'Visibility'|transloco}}</mat-label>\n <mat-select formControlName=\"visibilityOpt\" [placeholder]=\"'Visible' | transloco\">\n <mat-option value=\"always\">{{'Always'|transloco}}</mat-option>\n <mat-option value=\"never\">{{'Never'|transloco}}</mat-option>\n <mat-option value=\"condition\">{{'Condition...'|transloco}}</mat-option>\n </mat-select>\n </mat-form-field>\n <button\n (click)=\"editVisibility()\"\n [disabled]=\"pf!.value.visibilityOpt !== 'condition'\"\n mat-raised-button\n [matTooltip]=\"curVisibility || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ curVisibility }}</code></span>\n </div>\n </button>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Branches'|transloco}}</label></div>\n <div>\n <mat-slider discrete min=\"1\" max=\"5\" step=\"1\"\n ><input matSliderThumb formControlName=\"conditionalBranchesNum\"\n /></mat-slider>\n </div>\n <div *ngFor=\"let branch of conditionalBranches; let idx = index\">\n <button (click)=\"editConditionalBranch(idx)\" mat-raised-button [matTooltip]=\"branch\">\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ branch }}</code></span>\n </div>\n </button>\n </div>\n </div>\n <ng-template [ngIf]=\"isRepeatingContainerNode(ne)\">\n <div class=\"ajf-prop\">\n <div><label>{{'Repetitions'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editFormulaReps()\"\n mat-raised-button\n [matTooltip]=\"curFormulaReps || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ curFormulaReps }}</code></span>\n </div>\n </button>\n </div>\n <div><label>{{'Min repetitions'|transloco}}</label></div>\n <div>\n <mat-slider formControlName=\"minReps\" discrete min=\"1\" max=\"5\" step=\"1\"\n ><input matSliderThumb\n /></mat-slider>\n </div>\n <div><label>{{'Max repetitions'|transloco}}</label></div>\n <div>\n <mat-slider formControlName=\"maxReps\" discrete min=\"1\" max=\"5\" step=\"1\"\n ><input matSliderThumb\n /></mat-slider>\n </div>\n </div>\n </ng-template>\n <ng-template [ngIf]=\"isField(ne)\">\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"readonlyField\">{{'Readonly'|transloco}}</mat-checkbox>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <mat-label>{{'Field size'|transloco}}</mat-label>\n <mat-select formControlName=\"size\" [placeholder]=\"'Size' | transloco\">\n <mat-option *ngFor=\"let fieldSize of fieldSizes\" [value]=\"fieldSize.value\">\n {{ fieldSize.label|transloco }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"hint\" [placeholder]=\"'Hint' | transloco\" />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <textarea\n matInput\n formControlName=\"description\"\n [placeholder]=\"'Description' | transloco\"\n ></textarea>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"defaultValue\"\n [placeholder]=\"'Default value' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Formula'|transloco}}</label></div>\n <div>\n <button (click)=\"editFormula()\" mat-raised-button [matTooltip]=\"curFormula || ''\">\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ curFormula }}</code></span>\n </div>\n </button>\n </div>\n </div>\n <!-- <div class=\"ajf-prop\">\n <div><label>{{'Force value'|translco}}</label></div>\n <div>\n <button (click)=\"editForceValue()\" mat-raised-button [matTooltip]=\"curForceValue\">\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ curForceValue }}</span>\n </div>\n </button>\n </div>\n </div> -->\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"notEmpty\">{{'Not empty'|transloco}}</mat-checkbox>\n </div>\n <ng-template [ngIf]=\"isNumericField(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"minValue\" [placeholder]=\"'Min value' | transloco\" />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"maxValue\" [placeholder]=\"'Max value' | transloco\" />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"minDigits\"\n [placeholder]=\"'Min digits' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"maxDigits\"\n [placeholder]=\"'Max digits' | transloco\"\n />\n </mat-form-field>\n </div>\n </ng-template>\n <ng-template [ngIf]=\"isRangeField(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n type=\"number\"\n formControlName=\"start\"\n [placeholder]=\"'Start' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n type=\"number\"\n formControlName=\"end\"\n [placeholder]=\"'End' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n type=\"number\"\n formControlName=\"step\"\n [placeholder]=\"'Step' | transloco\"\n />\n </mat-form-field>\n </div>\n </ng-template>\n <div class=\"ajf-prop\">\n <div class=\"ajf-header\">\n <label>{{ 'Validation' | transloco }}</label>\n <mat-icon class=\"ajf-pointer\" (click)=\"addValidationCondition()\"\n >add_circle_outline</mat-icon\n >\n </div>\n <div *ngIf=\"validationConditions.length === 0\" class=\"ajf-validation-row ajf-emph\">\n {{'No conditions'|transloco}}\n </div>\n <div\n class=\"ajf-validation-row\"\n *ngFor=\"let validationCondition of validationConditions; let idx = index\"\n >\n <button\n (click)=\"editValidationCondition(idx)\"\n mat-raised-button\n [matTooltip]=\"validationCondition.condition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ validationCondition.condition }}</code></span>\n </div>\n </button>\n <mat-icon class=\"ajf-pointer\" (click)=\"removeValidationCondition(idx)\"\n >remove_circle_outline</mat-icon\n >\n </div>\n </div>\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"notEmptyWarning\"\n >{{'Not empty warning'|transloco}}</mat-checkbox\n >\n </div>\n <div class=\"ajf-prop\">\n <div class=\"ajf-header\">\n <label>{{'Warnings'|transloco}}</label>\n <mat-icon class=\"ajf-pointer\" (click)=\"addWarningCondition()\"\n >add_circle_outline</mat-icon\n >\n </div>\n <div *ngIf=\"warningConditions.length === 0\" class=\"ajf-validation-row ajf-emph\">\n {{'No warnings'|transloco}}\n </div>\n <div\n class=\"ajf-validation-row\"\n *ngFor=\"let warningCondition of warningConditions; let idx = index\"\n >\n <button\n (click)=\"editWarningCondition(idx)\"\n mat-raised-button\n [matTooltip]=\"warningCondition.condition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ warningCondition.condition }}</code></span>\n </div>\n </button>\n <mat-icon class=\"ajf-pointer\" (click)=\"removeWarningCondition(idx)\"\n >remove_circle_outline</mat-icon\n >\n </div>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Go to next slide condition'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editNextSlideCondition()\"\n mat-raised-button\n [matTooltip]=\"nextSlideCondition || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ nextSlideCondition }}</code></span>\n </div>\n </button>\n </div>\n </div>\n <ng-template [ngIf]=\"isFieldWithChoices(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-form-field>\n <mat-label>{{'Choices origins'|transloco}}</mat-label>\n <mat-select formControlName=\"choicesOriginRef\" [placeholder]=\"'Choices' | transloco\">\n <mat-option\n *ngFor=\"let choicesOrigin of choicesOrigins\"\n [value]=\"choicesOrigin.name\"\n >\n {{ (choicesOrigin.label || choicesOrigin.name)|transloco }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Choices filter'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editChoicesFilter()\"\n mat-raised-button\n [matTooltip]=\"curChoicesFilter || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ curChoicesFilter }}</code></span>\n </div>\n </button>\n </div>\n </div>\n <div class=\"ajf-prop\">\n <mat-checkbox\n formControlName=\"forceExpanded\"\n #forceExpanded\n (change)=\"forceCheckbox($event.checked, forceNarrow)\"\n >{{'Force expanded selection'|transloco}}</mat-checkbox\n >\n </div>\n <div class=\"ajf-prop\">\n <mat-checkbox\n formControlName=\"forceNarrow\"\n #forceNarrow\n (change)=\"forceCheckbox($event.checked, forceExpanded)\"\n >{{'Force narrow selection'|transloco}}</mat-checkbox\n >\n </div>\n <div class=\"ajf-prop\">\n <div class=\"ajf-header\">\n <label>{{'Trigger selection'|transloco}}</label>\n <mat-icon class=\"ajf-pointer\" (click)=\"addTriggerCondition()\"\n >add_circle_outline</mat-icon\n >\n </div>\n <div\n *ngIf=\"!triggerConditions || triggerConditions.length === 0\"\n class=\"ajf-validation-row ajf-emph\"\n >\n {{'No trigger condition'|transloco}}\n </div>\n <div\n class=\"ajf-validation-row\"\n *ngFor=\"let triggerCondition of triggerConditions; let idx = index\"\n >\n <button\n (click)=\"editTriggerCondition(idx)\"\n mat-raised-button\n [matTooltip]=\"triggerCondition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ triggerCondition }}</code></span>\n </div>\n </button>\n <mat-icon class=\"pointer\" (click)=\"removeTriggerCondition(idx)\"\n >remove_circle_outline</mat-icon\n >\n </div>\n </div>\n </ng-template>\n <ng-container *ngIf=\"isTableField(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"hideEmptyRows\"\n >{{'Hide empty rows'|transloco}}</mat-checkbox\n >\n <mat-form-field>\n <textarea\n matInput\n type=\"number\"\n formControlName=\"tableDef\"\n [placeholder]=\"'Table definition' | transloco\"\n ></textarea>\n </mat-form-field>\n </div>\n </ng-container>\n </ng-template>\n </form>\n </ng-container>\n</ng-container>\n", styles: ["ajf-fb-node-properties{display:block;padding:2px 2px 2px 5px;position:relative}ajf-fb-node-properties mat-icon{cursor:pointer}ajf-fb-node-properties .ajf-header{display:flex;flex-direction:row;align-items:center;flex-wrap:nowrap}ajf-fb-node-properties .ajf-header>h3,ajf-fb-node-properties .ajf-header>label{flex:1 0 auto;margin-right:.5em}ajf-fb-node-properties .ajf-header>mat-icon{flex:0 0 auto;margin-left:.5em}ajf-fb-node-properties .ajf-disabled-overlay{position:absolute;inset:0;opacity:.4;background-color:#fff}ajf-fb-node-properties .ajf-emph{font-style:italic}ajf-fb-node-properties [mat-raised-button]{margin:.5em 0}ajf-fb-node-properties [mat-raised-button].ajf-pointer{cursor:pointer}ajf-fb-node-properties [mat-raised-button] .ajf-icon-cont{display:flex;flex-direction:row;align-items:center;position:relative}ajf-fb-node-properties [mat-raised-button] .ajf-icon-cont span{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;display:block;margin:auto;position:relative;max-height:30px;max-width:100%}ajf-fb-node-properties .ajf-validation-row{margin:.5em 0;display:flex;flex-direction:row;align-items:center}ajf-fb-node-properties .ajf-validation-row button{flex:1 1 auto}ajf-fb-node-properties .ajf-validation-row mat-icon{flex:0 0 auto}ajf-fb-node-properties .ajf-prop{margin:.5em 0}ajf-fb-node-properties .ajf-prop .mdc-button__label{max-width:100%}ajf-fb-node-properties mat-form-field,ajf-fb-node-properties mat-slider,ajf-fb-node-properties [mat-raised-button]{width:100%}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "component", type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i8$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i10.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i12.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i13.MatSlider, selector: "mat-slider", inputs: ["color", "disableRipple", "disabled", "discrete", "showTickMarks", "min", "max", "step", "displayWith"], exportAs: ["matSlider"] }, { kind: "directive", type: i13.MatSliderThumb, selector: "input[matSliderThumb]", inputs: ["value"], outputs: ["valueChange", "dragStart", "dragEnd"], exportAs: ["matSliderThumb"] }, { kind: "directive", type: i8.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "directive", type: i3$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2748
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbNodeProperties, decorators: [{
|
|
2749
|
-
type: Component,
|
|
2750
|
-
args: [{ selector: 'ajf-fb-node-properties', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.display]=\"(enabled|async) ? 'none' : 'block'\" class=\"ajf-disabled-overlay\"></div>\n<ng-container *ngIf=\"nodeEntry|async as ne\">\n <ng-container *ngIf=\"propertiesForm|async as pf\">\n <div class=\"ajf-header\">\n <h3>{{'Properties'|transloco}}</h3>\n <button\n *ngIf=\"isFieldWithChoices(ne.node) && (hasChoicesOriginRef()|async) === false; else readysavebtn\"\n mat-icon-button\n color=\"warn\"\n [matTooltip]=\"'Please select a Choice Origin for this field'\"\n >\n <mat-icon>save</mat-icon>\n </button>\n <ng-template #readysavebtn>\n <button\n mat-icon-button\n [disabled]=\"pf.get('name')?.invalid || pf.get('label')?.invalid\"\n (click)=\"save()\"\n >\n <mat-icon>save</mat-icon>\n </button></ng-template\n >\n <button mat-icon-button (click)=\"cancel()\">\n <mat-icon>cancel</mat-icon>\n </button>\n </div>\n <form [formGroup]=\"pf!\" novalidate>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"name\" [placeholder]=\"'Name' | transloco\" />\n <mat-error *ngIf=\"pf.get('name')?.invalid\">\n {{fieldErrorMessage(pf.get('name'), 'Name')}}\n </mat-error>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"label\" [placeholder]=\"'Label' | transloco\" />\n <mat-error *ngIf=\"pf.get('label')?.invalid\">\n {{fieldErrorMessage(pf.get('label'), 'Label')}}\n </mat-error>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <mat-label>{{'Visibility'|transloco}}</mat-label>\n <mat-select formControlName=\"visibilityOpt\" [placeholder]=\"'Visible' | transloco\">\n <mat-option value=\"always\">{{'Always'|transloco}}</mat-option>\n <mat-option value=\"never\">{{'Never'|transloco}}</mat-option>\n <mat-option value=\"condition\">{{'Condition...'|transloco}}</mat-option>\n </mat-select>\n </mat-form-field>\n <button\n (click)=\"editVisibility()\"\n [disabled]=\"pf!.value.visibilityOpt !== 'condition'\"\n mat-raised-button\n [matTooltip]=\"curVisibility || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ curVisibility }}</code></span>\n </div>\n </button>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Branches'|transloco}}</label></div>\n <div>\n <mat-slider discrete min=\"1\" max=\"5\" step=\"1\"\n ><input matSliderThumb formControlName=\"conditionalBranchesNum\"\n /></mat-slider>\n </div>\n <div *ngFor=\"let branch of conditionalBranches; let idx = index\">\n <button (click)=\"editConditionalBranch(idx)\" mat-raised-button [matTooltip]=\"branch\">\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ branch }}</code></span>\n </div>\n </button>\n </div>\n </div>\n <ng-template [ngIf]=\"isRepeatingContainerNode(ne)\">\n <div class=\"ajf-prop\">\n <div><label>{{'Repetitions'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editFormulaReps()\"\n mat-raised-button\n [matTooltip]=\"curFormulaReps || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ curFormulaReps }}</code></span>\n </div>\n </button>\n </div>\n <div><label>{{'Min repetitions'|transloco}}</label></div>\n <div>\n <mat-slider formControlName=\"minReps\" discrete min=\"1\" max=\"5\" step=\"1\"\n ><input matSliderThumb\n /></mat-slider>\n </div>\n <div><label>{{'Max repetitions'|transloco}}</label></div>\n <div>\n <mat-slider formControlName=\"maxReps\" discrete min=\"1\" max=\"5\" step=\"1\"\n ><input matSliderThumb\n /></mat-slider>\n </div>\n </div>\n </ng-template>\n <ng-template [ngIf]=\"isField(ne)\">\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"readonlyField\">{{'Readonly'|transloco}}</mat-checkbox>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <mat-label>{{'Field size'|transloco}}</mat-label>\n <mat-select formControlName=\"size\" [placeholder]=\"'Size' | transloco\">\n <mat-option *ngFor=\"let fieldSize of fieldSizes\" [value]=\"fieldSize.value\">\n {{ fieldSize.label|transloco }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"hint\" [placeholder]=\"'Hint' | transloco\" />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <textarea\n matInput\n formControlName=\"description\"\n [placeholder]=\"'Description' | transloco\"\n ></textarea>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"defaultValue\"\n [placeholder]=\"'Default value' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Formula'|transloco}}</label></div>\n <div>\n <button (click)=\"editFormula()\" mat-raised-button [matTooltip]=\"curFormula || ''\">\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ curFormula }}</code></span>\n </div>\n </button>\n </div>\n </div>\n <!-- <div class=\"ajf-prop\">\n <div><label>{{'Force value'|translco}}</label></div>\n <div>\n <button (click)=\"editForceValue()\" mat-raised-button [matTooltip]=\"curForceValue\">\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ curForceValue }}</span>\n </div>\n </button>\n </div>\n </div> -->\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"notEmpty\">{{'Not empty'|transloco}}</mat-checkbox>\n </div>\n <ng-template [ngIf]=\"isNumericField(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"minValue\" [placeholder]=\"'Min value' | transloco\" />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input matInput formControlName=\"maxValue\" [placeholder]=\"'Max value' | transloco\" />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"minDigits\"\n [placeholder]=\"'Min digits' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"maxDigits\"\n [placeholder]=\"'Max digits' | transloco\"\n />\n </mat-form-field>\n </div>\n </ng-template>\n <ng-template [ngIf]=\"isRangeField(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n type=\"number\"\n formControlName=\"start\"\n [placeholder]=\"'Start' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n type=\"number\"\n formControlName=\"end\"\n [placeholder]=\"'End' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n type=\"number\"\n formControlName=\"step\"\n [placeholder]=\"'Step' | transloco\"\n />\n </mat-form-field>\n </div>\n </ng-template>\n <div class=\"ajf-prop\">\n <div class=\"ajf-header\">\n <label>{{ 'Validation' | transloco }}</label>\n <mat-icon class=\"ajf-pointer\" (click)=\"addValidationCondition()\"\n >add_circle_outline</mat-icon\n >\n </div>\n <div *ngIf=\"validationConditions.length === 0\" class=\"ajf-validation-row ajf-emph\">\n {{'No conditions'|transloco}}\n </div>\n <div\n class=\"ajf-validation-row\"\n *ngFor=\"let validationCondition of validationConditions; let idx = index\"\n >\n <button\n (click)=\"editValidationCondition(idx)\"\n mat-raised-button\n [matTooltip]=\"validationCondition.condition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ validationCondition.condition }}</code></span>\n </div>\n </button>\n <mat-icon class=\"ajf-pointer\" (click)=\"removeValidationCondition(idx)\"\n >remove_circle_outline</mat-icon\n >\n </div>\n </div>\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"notEmptyWarning\"\n >{{'Not empty warning'|transloco}}</mat-checkbox\n >\n </div>\n <div class=\"ajf-prop\">\n <div class=\"ajf-header\">\n <label>{{'Warnings'|transloco}}</label>\n <mat-icon class=\"ajf-pointer\" (click)=\"addWarningCondition()\"\n >add_circle_outline</mat-icon\n >\n </div>\n <div *ngIf=\"warningConditions.length === 0\" class=\"ajf-validation-row ajf-emph\">\n {{'No warnings'|transloco}}\n </div>\n <div\n class=\"ajf-validation-row\"\n *ngFor=\"let warningCondition of warningConditions; let idx = index\"\n >\n <button\n (click)=\"editWarningCondition(idx)\"\n mat-raised-button\n [matTooltip]=\"warningCondition.condition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ warningCondition.condition }}</code></span>\n </div>\n </button>\n <mat-icon class=\"ajf-pointer\" (click)=\"removeWarningCondition(idx)\"\n >remove_circle_outline</mat-icon\n >\n </div>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Go to next slide condition'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editNextSlideCondition()\"\n mat-raised-button\n [matTooltip]=\"nextSlideCondition || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ nextSlideCondition }}</code></span>\n </div>\n </button>\n </div>\n </div>\n <ng-template [ngIf]=\"isFieldWithChoices(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-form-field>\n <mat-label>{{'Choices origins'|transloco}}</mat-label>\n <mat-select formControlName=\"choicesOriginRef\" [placeholder]=\"'Choices' | transloco\">\n <mat-option\n *ngFor=\"let choicesOrigin of choicesOrigins\"\n [value]=\"choicesOrigin.name\"\n >\n {{ (choicesOrigin.label || choicesOrigin.name)|transloco }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Choices filter'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editChoicesFilter()\"\n mat-raised-button\n [matTooltip]=\"curChoicesFilter || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ curChoicesFilter }}</code></span>\n </div>\n </button>\n </div>\n </div>\n <div class=\"ajf-prop\">\n <mat-checkbox\n formControlName=\"forceExpanded\"\n #forceExpanded\n (change)=\"forceCheckbox($event.checked, forceNarrow)\"\n >{{'Force expanded selection'|transloco}}</mat-checkbox\n >\n </div>\n <div class=\"ajf-prop\">\n <mat-checkbox\n formControlName=\"forceNarrow\"\n #forceNarrow\n (change)=\"forceCheckbox($event.checked, forceExpanded)\"\n >{{'Force narrow selection'|transloco}}</mat-checkbox\n >\n </div>\n <div class=\"ajf-prop\">\n <div class=\"ajf-header\">\n <label>{{'Trigger selection'|transloco}}</label>\n <mat-icon class=\"ajf-pointer\" (click)=\"addTriggerCondition()\"\n >add_circle_outline</mat-icon\n >\n </div>\n <div\n *ngIf=\"!triggerConditions || triggerConditions.length === 0\"\n class=\"ajf-validation-row ajf-emph\"\n >\n {{'No trigger condition'|transloco}}\n </div>\n <div\n class=\"ajf-validation-row\"\n *ngFor=\"let triggerCondition of triggerConditions; let idx = index\"\n >\n <button\n (click)=\"editTriggerCondition(idx)\"\n mat-raised-button\n [matTooltip]=\"triggerCondition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span><code>{{ triggerCondition }}</code></span>\n </div>\n </button>\n <mat-icon class=\"pointer\" (click)=\"removeTriggerCondition(idx)\"\n >remove_circle_outline</mat-icon\n >\n </div>\n </div>\n </ng-template>\n <ng-container *ngIf=\"isTableField(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"hideEmptyRows\"\n >{{'Hide empty rows'|transloco}}</mat-checkbox\n >\n <mat-form-field>\n <textarea\n matInput\n type=\"number\"\n formControlName=\"tableDef\"\n [placeholder]=\"'Table definition' | transloco\"\n ></textarea>\n </mat-form-field>\n </div>\n </ng-container>\n </ng-template>\n </form>\n </ng-container>\n</ng-container>\n", styles: ["ajf-fb-node-properties{display:block;padding:2px 2px 2px 5px;position:relative}ajf-fb-node-properties mat-icon{cursor:pointer}ajf-fb-node-properties .ajf-header{display:flex;flex-direction:row;align-items:center;flex-wrap:nowrap}ajf-fb-node-properties .ajf-header>h3,ajf-fb-node-properties .ajf-header>label{flex:1 0 auto;margin-right:.5em}ajf-fb-node-properties .ajf-header>mat-icon{flex:0 0 auto;margin-left:.5em}ajf-fb-node-properties .ajf-disabled-overlay{position:absolute;inset:0;opacity:.4;background-color:#fff}ajf-fb-node-properties .ajf-emph{font-style:italic}ajf-fb-node-properties [mat-raised-button]{margin:.5em 0}ajf-fb-node-properties [mat-raised-button].ajf-pointer{cursor:pointer}ajf-fb-node-properties [mat-raised-button] .ajf-icon-cont{display:flex;flex-direction:row;align-items:center;position:relative}ajf-fb-node-properties [mat-raised-button] .ajf-icon-cont span{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;display:block;margin:auto;position:relative;max-height:30px;max-width:100%}ajf-fb-node-properties .ajf-validation-row{margin:.5em 0;display:flex;flex-direction:row;align-items:center}ajf-fb-node-properties .ajf-validation-row button{flex:1 1 auto}ajf-fb-node-properties .ajf-validation-row mat-icon{flex:0 0 auto}ajf-fb-node-properties .ajf-prop{margin:.5em 0}ajf-fb-node-properties .ajf-prop .mdc-button__label{max-width:100%}ajf-fb-node-properties mat-form-field,ajf-fb-node-properties mat-slider,ajf-fb-node-properties [mat-raised-button]{width:100%}\n"] }]
|
|
2751
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: AjfFormBuilderService }, { type: i2.MatDialog }, { type: i3$1.UntypedFormBuilder }, { type: AjfNodePropertiesNameMatchValidator }]; } });
|
|
2752
|
-
|
|
2753
|
-
/**
|
|
2754
|
-
* @license
|
|
2755
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
2756
|
-
*
|
|
2757
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
2758
|
-
*
|
|
2759
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
2760
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
2761
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
2762
|
-
* or (at your option) any later version.
|
|
2763
|
-
*
|
|
2764
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
2765
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
2766
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
2767
|
-
* General Public License for more details.
|
|
2768
|
-
*
|
|
2769
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
2770
|
-
* along with Advanced JSON forms (ajf).
|
|
2771
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
2772
|
-
*
|
|
2773
|
-
*/
|
|
2774
|
-
class AjfFbNodeTypeEntry {
|
|
2775
|
-
constructor(_cdr) {
|
|
2776
|
-
this._cdr = _cdr;
|
|
2777
|
-
}
|
|
2778
|
-
get nodeType() {
|
|
2779
|
-
return this._nodeType;
|
|
2780
|
-
}
|
|
2781
|
-
set nodeType(nodeType) {
|
|
2782
|
-
this._nodeType = nodeType;
|
|
2783
|
-
this._cdr.markForCheck();
|
|
2784
|
-
}
|
|
2785
|
-
get node() {
|
|
2786
|
-
var _a, _b;
|
|
2787
|
-
return { nodeType: (_a = this.nodeType) === null || _a === void 0 ? void 0 : _a.nodeType.node, fieldType: (_b = this.nodeType) === null || _b === void 0 ? void 0 : _b.nodeType.field };
|
|
2788
|
-
}
|
|
2789
|
-
}
|
|
2790
|
-
AjfFbNodeTypeEntry.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbNodeTypeEntry, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2791
|
-
AjfFbNodeTypeEntry.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFbNodeTypeEntry, selector: "ajf-fb-node-type-entry", inputs: { nodeType: "nodeType" }, ngImport: i0, template: "<ng-container *ngIf=\"nodeType\">\n <ajf-node-icon [node]=\"node\"></ajf-node-icon> {{nodeType.label}}\n</ng-container>\n", styles: ["ajf-fb-node-type-entry{display:block;padding:1em 1.5em}ajf-fb-node-type-entry mat-icon{vertical-align:middle}\n"], dependencies: [{ kind: "component", type: i2$1.AjfNodeIcon, selector: "ajf-node-icon" }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2792
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFbNodeTypeEntry, decorators: [{
|
|
2793
|
-
type: Component,
|
|
2794
|
-
args: [{ selector: 'ajf-fb-node-type-entry', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"nodeType\">\n <ajf-node-icon [node]=\"node\"></ajf-node-icon> {{nodeType.label}}\n</ng-container>\n", styles: ["ajf-fb-node-type-entry{display:block;padding:1em 1.5em}ajf-fb-node-type-entry mat-icon{vertical-align:middle}\n"] }]
|
|
2795
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { nodeType: [{
|
|
2796
|
-
type: Input
|
|
2797
|
-
}] } });
|
|
2798
|
-
|
|
2799
|
-
class AjfFormBuilder {
|
|
2800
|
-
constructor(_service, _dialog) {
|
|
2801
|
-
this._service = _service;
|
|
2802
|
-
this._dialog = _dialog;
|
|
2803
|
-
/**
|
|
2804
|
-
* The list of the ids of all the dropLists connected to the formbuilder source list.
|
|
2805
|
-
*/
|
|
2806
|
-
this._connectedDropLists = this._service.connectedDropLists;
|
|
2807
|
-
this._vc = new EventEmitter();
|
|
2808
|
-
this._init = false;
|
|
2809
|
-
this._editConditionSub = Subscription.EMPTY;
|
|
2810
|
-
this._editConditionDialog = null;
|
|
2811
|
-
this._beforeNodesUpdateSub = Subscription.EMPTY;
|
|
2812
|
-
this._editChoicesOriginSub = Subscription.EMPTY;
|
|
2813
|
-
this._editChoicesOriginDialog = null;
|
|
2814
|
-
this._stringIdentifierDialog = null;
|
|
2815
|
-
this._stringIdentifierSub = Subscription.EMPTY;
|
|
2816
|
-
this._lastScrollTop = 0;
|
|
2817
|
-
this._nodeTypes = _service.availableNodeTypes;
|
|
2818
|
-
this._nodeEntriesTree = _service.nodeEntriesTree;
|
|
2819
|
-
this._choicesOrigins = _service.choicesOrigins;
|
|
2820
|
-
this._editConditionSub = this._service.editedCondition.subscribe((condition) => {
|
|
2821
|
-
if (this._editConditionDialog != null) {
|
|
2822
|
-
this._editConditionDialog.close();
|
|
2823
|
-
this._editConditionDialog = null;
|
|
2824
|
-
}
|
|
2825
|
-
if (condition != null) {
|
|
2826
|
-
this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog, {
|
|
2827
|
-
disableClose: true,
|
|
2828
|
-
});
|
|
2829
|
-
}
|
|
2830
|
-
});
|
|
2831
|
-
this._editChoicesOriginSub = this._service.editedChoicesOrigin.subscribe((choicesOrigin) => {
|
|
2832
|
-
if (this._editChoicesOriginDialog != null) {
|
|
2833
|
-
this._editChoicesOriginDialog.close();
|
|
2834
|
-
this._editChoicesOriginDialog = null;
|
|
2835
|
-
}
|
|
2836
|
-
if (choicesOrigin != null) {
|
|
2837
|
-
this._editChoicesOriginDialog = this._dialog.open(AjfFbChoicesOriginEditorDialog, {
|
|
2838
|
-
disableClose: true,
|
|
2839
|
-
});
|
|
2840
|
-
}
|
|
2841
|
-
});
|
|
2842
|
-
this._beforeNodesUpdateSub = this._service.beforeNodesUpdate.subscribe(() => {
|
|
2843
|
-
if (this.designerCont == null) {
|
|
2844
|
-
return;
|
|
2845
|
-
}
|
|
2846
|
-
this._lastScrollTop = this.designerCont.nativeElement.scrollTop;
|
|
2847
|
-
});
|
|
2848
|
-
this.nodeEntriesTree.pipe(sample(this._vc)).subscribe(() => {
|
|
2849
|
-
if (this.designerCont == null) {
|
|
2850
|
-
return;
|
|
2851
|
-
}
|
|
2852
|
-
this.designerCont.nativeElement.scrollTop = this._lastScrollTop;
|
|
2853
|
-
});
|
|
2854
|
-
this._stringIdentifierSub = this._service.stringIdentifier.subscribe(() => { });
|
|
2855
|
-
}
|
|
2856
|
-
get form() {
|
|
2857
|
-
return this._form;
|
|
2858
|
-
}
|
|
2859
|
-
set form(form) {
|
|
2860
|
-
if (this._form !== form) {
|
|
2861
|
-
this._form = form;
|
|
2862
|
-
if (this._init) {
|
|
2863
|
-
this._setCurrentForm();
|
|
2864
|
-
}
|
|
2865
|
-
}
|
|
2866
|
-
}
|
|
2867
|
-
get nodeTypes() {
|
|
2868
|
-
return this._nodeTypes;
|
|
2869
|
-
}
|
|
2870
|
-
get nodeEntriesTree() {
|
|
2871
|
-
return this._nodeEntriesTree;
|
|
2872
|
-
}
|
|
2873
|
-
get choicesOrigins() {
|
|
2874
|
-
return this._choicesOrigins;
|
|
2875
|
-
}
|
|
2876
|
-
get connectedDropLists() {
|
|
2877
|
-
return this._connectedDropLists;
|
|
2878
|
-
}
|
|
2879
|
-
ngAfterViewChecked() {
|
|
2880
|
-
this._vc.emit();
|
|
2881
|
-
}
|
|
2882
|
-
ngAfterContentInit() {
|
|
2883
|
-
this._setCurrentForm();
|
|
2884
|
-
this._init = true;
|
|
2885
|
-
}
|
|
2886
|
-
ngOnDestroy() {
|
|
2887
|
-
this._editConditionSub.unsubscribe();
|
|
2888
|
-
this._beforeNodesUpdateSub.unsubscribe();
|
|
2889
|
-
this._editChoicesOriginSub.unsubscribe();
|
|
2890
|
-
this._stringIdentifierSub.unsubscribe();
|
|
2891
|
-
this._service.setForm(null);
|
|
2892
|
-
this._service.resetNodeEntriesTreeExpandedStatus();
|
|
2893
|
-
this._service.resetEmptyCounters();
|
|
2894
|
-
}
|
|
2895
|
-
createChoicesOrigin() {
|
|
2896
|
-
this._service.createChoicesOrigin();
|
|
2897
|
-
}
|
|
2898
|
-
disableDrop() {
|
|
2899
|
-
return false;
|
|
2900
|
-
}
|
|
2901
|
-
disableFieldDrop(item) {
|
|
2902
|
-
return disableFieldDropPredicate(item);
|
|
2903
|
-
}
|
|
2904
|
-
/**
|
|
2905
|
-
* Triggers when a field or slide node is moved or inserted by drag&dropping in the formbuilder.
|
|
2906
|
-
* @param event The drop event.
|
|
2907
|
-
* @param content True if the current nodeEntry contains other nodeEntries.
|
|
2908
|
-
*/
|
|
2909
|
-
onDrop(event, content = false) {
|
|
2910
|
-
onDropProcess(event, this._service, null, content);
|
|
2911
|
-
}
|
|
2912
|
-
editChoicesOrigin(choicesOrigin) {
|
|
2913
|
-
this._service.editChoicesOrigin(choicesOrigin);
|
|
2914
|
-
}
|
|
2915
|
-
editStringIdentifier() {
|
|
2916
|
-
if (this._stringIdentifierDialog != null) {
|
|
2917
|
-
this._stringIdentifierDialog.close();
|
|
2918
|
-
this._stringIdentifierDialog = null;
|
|
2919
|
-
}
|
|
2920
|
-
this._stringIdentifierDialog = this._dialog.open(AjfFbStringIdentifierDialogComponent, {
|
|
2921
|
-
disableClose: true,
|
|
2922
|
-
width: '60%',
|
|
2923
|
-
height: '60%',
|
|
2924
|
-
});
|
|
2925
|
-
}
|
|
2926
|
-
expandAll() {
|
|
2927
|
-
this._service.expandAll();
|
|
2928
|
-
}
|
|
2929
|
-
collapseAll() {
|
|
2930
|
-
this._service.collapseAll();
|
|
2931
|
-
}
|
|
2932
|
-
expandToggle(evt) {
|
|
2933
|
-
if (evt.checked) {
|
|
2934
|
-
this.expandAll();
|
|
2935
|
-
}
|
|
2936
|
-
else {
|
|
2937
|
-
this.collapseAll();
|
|
2938
|
-
}
|
|
2939
|
-
}
|
|
2940
|
-
_setCurrentForm() {
|
|
2941
|
-
if (this._form == null) {
|
|
2942
|
-
return;
|
|
2943
|
-
}
|
|
2944
|
-
this._service.setForm(this._form);
|
|
2945
|
-
}
|
|
2946
|
-
}
|
|
2947
|
-
AjfFormBuilder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFormBuilder, deps: [{ token: AjfFormBuilderService }, { token: i2.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
2948
|
-
AjfFormBuilder.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AjfFormBuilder, selector: "ajf-form-builder", inputs: { form: "form" }, viewQueries: [{ propertyName: "designerCont", first: true, predicate: ["designer"], descendants: true, static: true }], ngImport: i0, template: "<mat-toolbar class=\"ajf-formbuilder-toolbar\">\n <button mat-icon-button (click)=\"leftSidenav.toggle()\">\n <mat-icon>add_box</mat-icon>\n </button>\n <button mat-button [matMenuTriggerFor]=\"choicesMenu\">{{'Choices'|transloco}}</button>\n <button mat-button (click)=\"editStringIdentifier()\">{{'Identifier'|transloco}}</button>\n <button mat-icon-button aria-label=\"Collapsed\" matTooltip=\"Keep slides collapsed\">\n <mat-icon>unfold_less</mat-icon>\n </button>\n <mat-slide-toggle color=\"primary\" (change)=\"expandToggle($event)\"></mat-slide-toggle>\n <button mat-icon-button aria-label=\"Expanded\" matTooltip=\"Keep slides expanded\">\n <mat-icon>unfold_more</mat-icon>\n </button>\n <mat-menu #choicesMenu>\n <button (click)=\"createChoicesOrigin()\" mat-menu-item>{{'New..'|transloco}}</button>\n <ng-container *ngIf=\"choicesOrigins|async as cos\">\n <button\n *ngFor=\"let choicesOrigin of cos\"\n (click)=\"editChoicesOrigin(choicesOrigin)\"\n mat-menu-item\n >\n {{ (choicesOrigin.label || choicesOrigin.name)| transloco }}\n </button>\n </ng-container>\n </mat-menu>\n <span class=\"ajf-spacer\"></span>\n</mat-toolbar>\n<div class=\"ajf-formtree-container\">\n <mat-drawer-container cdkDropListGroup class=\"ajf-formtree-drawer-container\">\n <mat-drawer #leftSidenav position=\"start\" mode=\"over\">\n <div\n #sourceDropList\n cdkDropList\n [cdkDropListConnectedTo]=\"(connectedDropLists|async)!\"\n [cdkDropListEnterPredicate]=\"disableDrop\"\n [cdkDropListData]=\"nodeTypes\"\n >\n <ajf-fb-node-type-entry\n *ngFor=\"let nodeType of nodeTypes\"\n cdkDrag\n [cdkDragData]=\"nodeType\"\n (cdkDragStarted)=\"leftSidenav.close()\"\n [nodeType]=\"nodeType\"\n ></ajf-fb-node-type-entry>\n </div>\n </mat-drawer>\n <div #designer class=\"ajf-designer\">\n <ajf-fb-node-entry\n id=\"slides-list\"\n cdkDropList\n (cdkDropListDropped)=\"onDrop($event)\"\n [cdkDropListEnterPredicate]=\"disableFieldDrop\"\n *ngFor=\"let nodeEntry of (nodeEntriesTree|async); let isFirst = first\"\n [isFirst]=\"isFirst\"\n [nodeEntry]=\"nodeEntry\"\n ></ajf-fb-node-entry>\n </div>\n </mat-drawer-container>\n <div class=\"ajf-formtree-properties\" #rightSidenav position=\"end\" mode=\"side\">\n <ajf-fb-node-properties></ajf-fb-node-properties>\n </div>\n</div>\n", styles: ["ajf-form-builder{display:flex;position:relative;min-height:300px;flex-direction:column;align-items:stretch}ajf-form-builder mat-toolbar.ajf-formbuilder-toolbar{position:sticky;top:0;z-index:2;padding:2px 0}ajf-form-builder mat-toolbar.ajf-formbuilder-toolbar mat-menu div[mat-menu-item]>button[mat-button]{flex:1 0 auto}ajf-form-builder mat-toolbar.ajf-formbuilder-toolbar mat-menu div[mat-menu-item]>button[mat-icon-button]{flex:0 0 auto}ajf-form-builder .ajf-formtree-container{display:flex;flex-flow:row;align-items:start;justify-content:space-between}ajf-form-builder .ajf-formtree-container mat-drawer-container.ajf-formtree-drawer-container{flex:1 0 auto;min-height:50vh}ajf-form-builder .ajf-formtree-container mat-drawer-container.ajf-formtree-drawer-container mat-drawer{max-width:20%}ajf-form-builder .ajf-formtree-container mat-drawer-container.ajf-formtree-drawer-container .ajf-designer{padding:2}ajf-form-builder .ajf-formtree-container mat-drawer-container.ajf-formtree-drawer-container .mat-expansion-panel-body{padding:10px}ajf-form-builder .ajf-formtree-container .ajf-formtree-properties{flex:0 1 auto;max-width:20%;max-height:60vh;overflow-y:auto;position:sticky;top:32px}ajf-form-builder mat-toolbar .ajf-spacer{flex:1 1 auto}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i4$1.CdkDropListGroup, selector: "[cdkDropListGroup]", inputs: ["cdkDropListGroupDisabled"], exportAs: ["cdkDropListGroup"] }, { kind: "directive", type: i4$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i10.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7$3.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i7$3.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i7$3.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "component", type: i8$3.MatDrawer, selector: "mat-drawer", inputs: ["position", "mode", "disableClose", "autoFocus", "opened"], outputs: ["openedChange", "opened", "openedStart", "closed", "closedStart", "positionChanged"], exportAs: ["matDrawer"] }, { kind: "component", type: i8$3.MatDrawerContainer, selector: "mat-drawer-container", inputs: ["autosize", "hasBackdrop"], outputs: ["backdropClick"], exportAs: ["matDrawerContainer"] }, { kind: "component", type: i9$1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: i8.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i11.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matSlideToggle"] }, { kind: "component", type: AjfFbNodeEntry, selector: "ajf-fb-node-entry", inputs: ["isFirst", "nodeEntry", "level", "isDraggable", "originOffset", "firstBranchColor"] }, { kind: "component", type: AjfFbNodeProperties, selector: "ajf-fb-node-properties" }, { kind: "component", type: AjfFbNodeTypeEntry, selector: "ajf-fb-node-type-entry", inputs: ["nodeType"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2949
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFormBuilder, decorators: [{
|
|
2950
|
-
type: Component,
|
|
2951
|
-
args: [{ selector: 'ajf-form-builder', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<mat-toolbar class=\"ajf-formbuilder-toolbar\">\n <button mat-icon-button (click)=\"leftSidenav.toggle()\">\n <mat-icon>add_box</mat-icon>\n </button>\n <button mat-button [matMenuTriggerFor]=\"choicesMenu\">{{'Choices'|transloco}}</button>\n <button mat-button (click)=\"editStringIdentifier()\">{{'Identifier'|transloco}}</button>\n <button mat-icon-button aria-label=\"Collapsed\" matTooltip=\"Keep slides collapsed\">\n <mat-icon>unfold_less</mat-icon>\n </button>\n <mat-slide-toggle color=\"primary\" (change)=\"expandToggle($event)\"></mat-slide-toggle>\n <button mat-icon-button aria-label=\"Expanded\" matTooltip=\"Keep slides expanded\">\n <mat-icon>unfold_more</mat-icon>\n </button>\n <mat-menu #choicesMenu>\n <button (click)=\"createChoicesOrigin()\" mat-menu-item>{{'New..'|transloco}}</button>\n <ng-container *ngIf=\"choicesOrigins|async as cos\">\n <button\n *ngFor=\"let choicesOrigin of cos\"\n (click)=\"editChoicesOrigin(choicesOrigin)\"\n mat-menu-item\n >\n {{ (choicesOrigin.label || choicesOrigin.name)| transloco }}\n </button>\n </ng-container>\n </mat-menu>\n <span class=\"ajf-spacer\"></span>\n</mat-toolbar>\n<div class=\"ajf-formtree-container\">\n <mat-drawer-container cdkDropListGroup class=\"ajf-formtree-drawer-container\">\n <mat-drawer #leftSidenav position=\"start\" mode=\"over\">\n <div\n #sourceDropList\n cdkDropList\n [cdkDropListConnectedTo]=\"(connectedDropLists|async)!\"\n [cdkDropListEnterPredicate]=\"disableDrop\"\n [cdkDropListData]=\"nodeTypes\"\n >\n <ajf-fb-node-type-entry\n *ngFor=\"let nodeType of nodeTypes\"\n cdkDrag\n [cdkDragData]=\"nodeType\"\n (cdkDragStarted)=\"leftSidenav.close()\"\n [nodeType]=\"nodeType\"\n ></ajf-fb-node-type-entry>\n </div>\n </mat-drawer>\n <div #designer class=\"ajf-designer\">\n <ajf-fb-node-entry\n id=\"slides-list\"\n cdkDropList\n (cdkDropListDropped)=\"onDrop($event)\"\n [cdkDropListEnterPredicate]=\"disableFieldDrop\"\n *ngFor=\"let nodeEntry of (nodeEntriesTree|async); let isFirst = first\"\n [isFirst]=\"isFirst\"\n [nodeEntry]=\"nodeEntry\"\n ></ajf-fb-node-entry>\n </div>\n </mat-drawer-container>\n <div class=\"ajf-formtree-properties\" #rightSidenav position=\"end\" mode=\"side\">\n <ajf-fb-node-properties></ajf-fb-node-properties>\n </div>\n</div>\n", styles: ["ajf-form-builder{display:flex;position:relative;min-height:300px;flex-direction:column;align-items:stretch}ajf-form-builder mat-toolbar.ajf-formbuilder-toolbar{position:sticky;top:0;z-index:2;padding:2px 0}ajf-form-builder mat-toolbar.ajf-formbuilder-toolbar mat-menu div[mat-menu-item]>button[mat-button]{flex:1 0 auto}ajf-form-builder mat-toolbar.ajf-formbuilder-toolbar mat-menu div[mat-menu-item]>button[mat-icon-button]{flex:0 0 auto}ajf-form-builder .ajf-formtree-container{display:flex;flex-flow:row;align-items:start;justify-content:space-between}ajf-form-builder .ajf-formtree-container mat-drawer-container.ajf-formtree-drawer-container{flex:1 0 auto;min-height:50vh}ajf-form-builder .ajf-formtree-container mat-drawer-container.ajf-formtree-drawer-container mat-drawer{max-width:20%}ajf-form-builder .ajf-formtree-container mat-drawer-container.ajf-formtree-drawer-container .ajf-designer{padding:2}ajf-form-builder .ajf-formtree-container mat-drawer-container.ajf-formtree-drawer-container .mat-expansion-panel-body{padding:10px}ajf-form-builder .ajf-formtree-container .ajf-formtree-properties{flex:0 1 auto;max-width:20%;max-height:60vh;overflow-y:auto;position:sticky;top:32px}ajf-form-builder mat-toolbar .ajf-spacer{flex:1 1 auto}\n"] }]
|
|
2952
|
-
}], ctorParameters: function () { return [{ type: AjfFormBuilderService }, { type: i2.MatDialog }]; }, propDecorators: { designerCont: [{
|
|
2953
|
-
type: ViewChild,
|
|
2954
|
-
args: ['designer', { static: true }]
|
|
2955
|
-
}], form: [{
|
|
2956
|
-
type: Input
|
|
2957
|
-
}] } });
|
|
2958
|
-
|
|
2959
|
-
/**
|
|
2960
|
-
* @license
|
|
2961
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
2962
|
-
*
|
|
2963
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
2964
|
-
*
|
|
2965
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
2966
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
2967
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
2968
|
-
* or (at your option) any later version.
|
|
2969
|
-
*
|
|
2970
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
2971
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
2972
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
2973
|
-
* General Public License for more details.
|
|
2974
|
-
*
|
|
2975
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
2976
|
-
* along with Advanced JSON forms (ajf).
|
|
2977
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
2978
|
-
*
|
|
2979
|
-
*/
|
|
2980
|
-
class AjfFormBuilderModule {
|
|
2981
|
-
}
|
|
2982
|
-
AjfFormBuilderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFormBuilderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2983
|
-
AjfFormBuilderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: AjfFormBuilderModule, declarations: [AjfFbBranchLine,
|
|
2984
|
-
AjfFbChoicesOriginEditor,
|
|
2985
|
-
AjfFbChoicesOriginEditorDialog,
|
|
2986
|
-
AjfFbConditionEditor,
|
|
2987
|
-
AjfFbConditionEditorDialog,
|
|
2988
|
-
AjfFbNodeEntry,
|
|
2989
|
-
AjfFbNodeProperties,
|
|
2990
|
-
AjfFbNodeTypeEntry,
|
|
2991
|
-
AjfFbStringIdentifierDialogComponent,
|
|
2992
|
-
AjfFbValidationConditionEditorDialog,
|
|
2993
|
-
AjfFbWarningConditionEditorDialog,
|
|
2994
|
-
AjfFormBuilder], imports: [AjfNodeIconModule,
|
|
2995
|
-
CommonModule,
|
|
2996
|
-
DragDropModule,
|
|
2997
|
-
FormsModule,
|
|
2998
|
-
MatAutocompleteModule,
|
|
2999
|
-
MatButtonModule,
|
|
3000
|
-
MatCardModule,
|
|
3001
|
-
MatCheckboxModule,
|
|
3002
|
-
MatChipsModule,
|
|
3003
|
-
MatDialogModule,
|
|
3004
|
-
MatFormFieldModule,
|
|
3005
|
-
MatIconModule,
|
|
3006
|
-
MatInputModule,
|
|
3007
|
-
MatListModule,
|
|
3008
|
-
MatMenuModule,
|
|
3009
|
-
MatSelectModule,
|
|
3010
|
-
MatSidenavModule,
|
|
3011
|
-
MatSliderModule,
|
|
3012
|
-
MatTableModule,
|
|
3013
|
-
MatToolbarModule,
|
|
3014
|
-
MatTooltipModule,
|
|
3015
|
-
ReactiveFormsModule,
|
|
3016
|
-
AjfTranslocoModule,
|
|
3017
|
-
MatExpansionModule,
|
|
3018
|
-
MatSlideToggleModule], exports: [AjfFormBuilder] });
|
|
3019
|
-
AjfFormBuilderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFormBuilderModule, providers: [AjfFormBuilderService, AjfNodePropertiesNameMatchValidator], imports: [AjfNodeIconModule,
|
|
3020
|
-
CommonModule,
|
|
3021
|
-
DragDropModule,
|
|
3022
|
-
FormsModule,
|
|
3023
|
-
MatAutocompleteModule,
|
|
3024
|
-
MatButtonModule,
|
|
3025
|
-
MatCardModule,
|
|
3026
|
-
MatCheckboxModule,
|
|
3027
|
-
MatChipsModule,
|
|
3028
|
-
MatDialogModule,
|
|
3029
|
-
MatFormFieldModule,
|
|
3030
|
-
MatIconModule,
|
|
3031
|
-
MatInputModule,
|
|
3032
|
-
MatListModule,
|
|
3033
|
-
MatMenuModule,
|
|
3034
|
-
MatSelectModule,
|
|
3035
|
-
MatSidenavModule,
|
|
3036
|
-
MatSliderModule,
|
|
3037
|
-
MatTableModule,
|
|
3038
|
-
MatToolbarModule,
|
|
3039
|
-
MatTooltipModule,
|
|
3040
|
-
ReactiveFormsModule,
|
|
3041
|
-
AjfTranslocoModule,
|
|
3042
|
-
MatExpansionModule,
|
|
3043
|
-
MatSlideToggleModule] });
|
|
3044
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AjfFormBuilderModule, decorators: [{
|
|
3045
|
-
type: NgModule,
|
|
3046
|
-
args: [{
|
|
3047
|
-
imports: [
|
|
3048
|
-
AjfNodeIconModule,
|
|
3049
|
-
CommonModule,
|
|
3050
|
-
DragDropModule,
|
|
3051
|
-
FormsModule,
|
|
3052
|
-
MatAutocompleteModule,
|
|
3053
|
-
MatButtonModule,
|
|
3054
|
-
MatCardModule,
|
|
3055
|
-
MatCheckboxModule,
|
|
3056
|
-
MatChipsModule,
|
|
3057
|
-
MatDialogModule,
|
|
3058
|
-
MatFormFieldModule,
|
|
3059
|
-
MatIconModule,
|
|
3060
|
-
MatInputModule,
|
|
3061
|
-
MatListModule,
|
|
3062
|
-
MatMenuModule,
|
|
3063
|
-
MatSelectModule,
|
|
3064
|
-
MatSidenavModule,
|
|
3065
|
-
MatSliderModule,
|
|
3066
|
-
MatTableModule,
|
|
3067
|
-
MatToolbarModule,
|
|
3068
|
-
MatTooltipModule,
|
|
3069
|
-
ReactiveFormsModule,
|
|
3070
|
-
AjfTranslocoModule,
|
|
3071
|
-
MatExpansionModule,
|
|
3072
|
-
MatSlideToggleModule,
|
|
3073
|
-
],
|
|
3074
|
-
declarations: [
|
|
3075
|
-
AjfFbBranchLine,
|
|
3076
|
-
AjfFbChoicesOriginEditor,
|
|
3077
|
-
AjfFbChoicesOriginEditorDialog,
|
|
3078
|
-
AjfFbConditionEditor,
|
|
3079
|
-
AjfFbConditionEditorDialog,
|
|
3080
|
-
AjfFbNodeEntry,
|
|
3081
|
-
AjfFbNodeProperties,
|
|
3082
|
-
AjfFbNodeTypeEntry,
|
|
3083
|
-
AjfFbStringIdentifierDialogComponent,
|
|
3084
|
-
AjfFbValidationConditionEditorDialog,
|
|
3085
|
-
AjfFbWarningConditionEditorDialog,
|
|
3086
|
-
AjfFormBuilder,
|
|
3087
|
-
],
|
|
3088
|
-
exports: [AjfFormBuilder],
|
|
3089
|
-
providers: [AjfFormBuilderService, AjfNodePropertiesNameMatchValidator],
|
|
3090
|
-
}]
|
|
3091
|
-
}] });
|
|
3092
|
-
|
|
3093
|
-
/**
|
|
3094
|
-
* @license
|
|
3095
|
-
* Copyright (C) Gnucoop soc. coop.
|
|
3096
|
-
*
|
|
3097
|
-
* This file is part of the Advanced JSON forms (ajf).
|
|
3098
|
-
*
|
|
3099
|
-
* Advanced JSON forms (ajf) is free software: you can redistribute it and/or
|
|
3100
|
-
* modify it under the terms of the GNU Affero General Public License as
|
|
3101
|
-
* published by the Free Software Foundation, either version 3 of the License,
|
|
3102
|
-
* or (at your option) any later version.
|
|
3103
|
-
*
|
|
3104
|
-
* Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
|
|
3105
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
3106
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
3107
|
-
* General Public License for more details.
|
|
3108
|
-
*
|
|
3109
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
3110
|
-
* along with Advanced JSON forms (ajf).
|
|
3111
|
-
* If not, see http://www.gnu.org/licenses/.
|
|
3112
|
-
*
|
|
3113
|
-
*/
|
|
3114
|
-
|
|
3115
|
-
/**
|
|
3116
|
-
* Generated bundle index. Do not edit.
|
|
3117
|
-
*/
|
|
3118
|
-
|
|
3119
|
-
export { AjfFormBuilder, AjfFormBuilderModule, AjfFormBuilderService, disableFieldDropPredicate, disableSlideDropPredicate, flattenNodes, onDropProcess };
|
|
3120
|
-
//# sourceMappingURL=ajf-material-form-builder.mjs.map
|