@gravitee/ui-particles-angular 13.2.0 → 13.3.0-gio-el-editor-2-ab540cd

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.
Files changed (47) hide show
  1. package/esm2022/gio-el/gio-el-editor/gio-el-editor-condition-group/gio-el-editor-condition-group.component.mjs +128 -0
  2. package/esm2022/gio-el/gio-el-editor/gio-el-editor-condition-group/gio-el-editor-condition-group.harness.mjs +158 -0
  3. package/esm2022/gio-el/gio-el-editor/gio-el-editor.component.mjs +128 -0
  4. package/esm2022/gio-el/gio-el-editor/gio-el-editor.harness.mjs +25 -0
  5. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-boolean/gio-el-editor-type-boolean.component.mjs +58 -0
  6. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-boolean/gio-el-editor-type-boolean.harness.mjs +31 -0
  7. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-date/gio-el-editor-type-date.component.mjs +75 -0
  8. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-date/gio-el-editor-type-date.harness.mjs +29 -0
  9. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-number/gio-el-editor-type-number.component.mjs +71 -0
  10. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-number/gio-el-editor-type-number.harness.mjs +29 -0
  11. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-string/gio-el-editor-type-string.component.mjs +74 -0
  12. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-string/gio-el-editor-type-string.harness.mjs +29 -0
  13. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type.harness.mjs +38 -0
  14. package/esm2022/gio-el/gravitee-ui-particles-angular-gio-el.mjs +5 -0
  15. package/esm2022/gio-el/models/Condition.mjs +9 -0
  16. package/esm2022/gio-el/models/ConditionGroup.mjs +7 -0
  17. package/esm2022/gio-el/models/ConditionModel.mjs +2 -0
  18. package/esm2022/gio-el/models/ConditionsModel.mjs +4 -0
  19. package/esm2022/gio-el/models/ExpressionLanguageBuilder.mjs +84 -0
  20. package/esm2022/gio-el/models/Operator.mjs +2 -0
  21. package/esm2022/gio-el/models/public-api.mjs +21 -0
  22. package/esm2022/gio-el/public-api.mjs +19 -0
  23. package/fesm2022/gravitee-ui-particles-angular-gio-el.mjs +925 -0
  24. package/fesm2022/gravitee-ui-particles-angular-gio-el.mjs.map +1 -0
  25. package/gio-el/gio-el-editor/gio-el-editor-condition-group/gio-el-editor-condition-group.component.d.ts +25 -0
  26. package/gio-el/gio-el-editor/gio-el-editor-condition-group/gio-el-editor-condition-group.harness.d.ts +32 -0
  27. package/gio-el/gio-el-editor/gio-el-editor.component.d.ts +26 -0
  28. package/gio-el/gio-el-editor/gio-el-editor.harness.d.ts +6 -0
  29. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-boolean/gio-el-editor-type-boolean.component.d.ts +15 -0
  30. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-boolean/gio-el-editor-type-boolean.harness.d.ts +6 -0
  31. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-date/gio-el-editor-type-date.component.d.ts +17 -0
  32. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-date/gio-el-editor-type-date.harness.d.ts +6 -0
  33. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-number/gio-el-editor-type-number.component.d.ts +17 -0
  34. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-number/gio-el-editor-type-number.harness.d.ts +6 -0
  35. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-string/gio-el-editor-type-string.component.d.ts +18 -0
  36. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-string/gio-el-editor-type-string.harness.d.ts +6 -0
  37. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type.harness.d.ts +10 -0
  38. package/gio-el/index.d.ts +5 -0
  39. package/gio-el/models/Condition.d.ts +10 -0
  40. package/gio-el/models/ConditionGroup.d.ts +6 -0
  41. package/gio-el/models/ConditionModel.d.ts +15 -0
  42. package/gio-el/models/ConditionsModel.d.ts +8 -0
  43. package/gio-el/models/ExpressionLanguageBuilder.d.ts +11 -0
  44. package/gio-el/models/Operator.d.ts +1 -0
  45. package/gio-el/models/public-api.d.ts +5 -0
  46. package/gio-el/public-api.d.ts +3 -0
  47. package/package.json +7 -1
@@ -0,0 +1,925 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, DestroyRef, Component, Input, EventEmitter, HostBinding, Output, ChangeDetectionStrategy } from '@angular/core';
3
+ import * as i7$1 from '@angular/material/button-toggle';
4
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
5
+ import * as i6 from '@angular/forms';
6
+ import { FormControl, ReactiveFormsModule, FormGroup, Validators, FormArray } from '@angular/forms';
7
+ import * as i6$2 from '@angular/material/button';
8
+ import { MatButtonModule } from '@angular/material/button';
9
+ import * as i8 from '@angular/material/menu';
10
+ import { MatMenuModule } from '@angular/material/menu';
11
+ import * as i1$1 from '@angular/material/form-field';
12
+ import { MatFormFieldModule } from '@angular/material/form-field';
13
+ import * as i5 from '@angular/material/input';
14
+ import { MatInputModule } from '@angular/material/input';
15
+ import * as i1 from '@angular/common';
16
+ import { CommonModule } from '@angular/common';
17
+ import * as i3 from '@angular/material/select';
18
+ import { MatSelectModule } from '@angular/material/select';
19
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
20
+ import { startWith, map } from 'rxjs/operators';
21
+ import { isEmpty, toString, isDate, isNil, has } from 'lodash';
22
+ import { GioIconsModule } from '@gravitee/ui-particles-angular';
23
+ import * as i7 from '@angular/material/autocomplete';
24
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
25
+ import { Observable } from 'rxjs';
26
+ import * as i4 from '@angular/material/core';
27
+ import { MatSlideToggle } from '@angular/material/slide-toggle';
28
+ import * as i6$1 from '@angular/material/datepicker';
29
+ import { MatDatepickerModule } from '@angular/material/datepicker';
30
+ import * as i9 from '@angular/material/icon';
31
+ import { ComponentHarness, parallel, HarnessPredicate } from '@angular/cdk/testing';
32
+ import { MatMenuHarness } from '@angular/material/menu/testing';
33
+ import { MatSelectHarness } from '@angular/material/select/testing';
34
+ import { MatButtonToggleGroupHarness } from '@angular/material/button-toggle/testing';
35
+ import { DivHarness } from '@gravitee/ui-particles-angular/testing';
36
+ import { MatSlideToggleHarness } from '@angular/material/slide-toggle/testing';
37
+ import { MatInputHarness } from '@angular/material/input/testing';
38
+ import { MatDatepickerInputHarness } from '@angular/material/datepicker/testing';
39
+
40
+ const isConditionModel = (conditions) => {
41
+ return 'field' in conditions && 'label' in conditions && 'type' in conditions;
42
+ };
43
+
44
+ class ConditionGroup {
45
+ constructor(condition, conditions) {
46
+ this.condition = condition;
47
+ this.conditions = conditions;
48
+ }
49
+ }
50
+
51
+ /*
52
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
53
+ *
54
+ * Licensed under the Apache License, Version 2.0 (the "License");
55
+ * you may not use this file except in compliance with the License.
56
+ * You may obtain a copy of the License at
57
+ *
58
+ * http://www.apache.org/licenses/LICENSE-2.0
59
+ *
60
+ * Unless required by applicable law or agreed to in writing, software
61
+ * distributed under the License is distributed on an "AS IS" BASIS,
62
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
63
+ * See the License for the specific language governing permissions and
64
+ * limitations under the License.
65
+ */
66
+ class ExpressionLanguageBuilder {
67
+ static { this.CONDITION_MAP = {
68
+ OR: '||',
69
+ AND: '&&',
70
+ }; }
71
+ static { this.OPERATOR_MAP = {
72
+ EQUALS: (field, value) => `#${field} == ${value}`,
73
+ NOT_EQUALS: (field, value) => `#${field} != ${value}`,
74
+ LESS_THAN: (field, value) => `#${field} < ${value}`,
75
+ LESS_THAN_OR_EQUALS: (field, value) => `#${field} <= ${value}`,
76
+ GREATER_THAN: (field, value) => `#${field} > ${value}`,
77
+ GREATER_THAN_OR_EQUALS: (field, value) => `#${field} >= ${value}`,
78
+ CONTAINS: (field, value) => `#${field} matches "${value}"`,
79
+ NOT_CONTAINS: (field, value) => `!#${field} matches "${value}"`,
80
+ STARTS_WITH: (field, value) => `#${field} matches "^${value}"`,
81
+ ENDS_WITH: (field, value) => `#${field} matches "${value}$"`,
82
+ }; }
83
+ static buildConditionGroup(conditionGroup) {
84
+ let el = '';
85
+ for (const condition of conditionGroup.conditions) {
86
+ if (condition instanceof ConditionGroup) {
87
+ const hasMultipleConditions = condition.conditions.length > 1;
88
+ if (hasMultipleConditions) {
89
+ el += '( ';
90
+ }
91
+ el += ExpressionLanguageBuilder.buildConditionGroup(condition);
92
+ if (hasMultipleConditions) {
93
+ el += ' )';
94
+ }
95
+ }
96
+ else {
97
+ el += ExpressionLanguageBuilder.buildCondition(condition);
98
+ }
99
+ if (condition !== conditionGroup.conditions[conditionGroup.conditions.length - 1]) {
100
+ el += ` ${ExpressionLanguageBuilder.CONDITION_MAP[conditionGroup.condition]} `;
101
+ }
102
+ }
103
+ if (el === '') {
104
+ return '';
105
+ }
106
+ return el;
107
+ }
108
+ static buildCondition(condition) {
109
+ const operator = ExpressionLanguageBuilder.OPERATOR_MAP[condition.operator];
110
+ return operator(condition.field, ExpressionLanguageBuilder.valueToString(condition.type, condition.value));
111
+ }
112
+ static valueToString(type, value) {
113
+ if (!type) {
114
+ return '';
115
+ }
116
+ switch (type) {
117
+ case 'string':
118
+ return `"${value}"`;
119
+ case 'date':
120
+ return `${value.getTime()}l`;
121
+ default:
122
+ return `${value}`;
123
+ }
124
+ }
125
+ constructor(conditionGroup) {
126
+ this.conditionGroup = conditionGroup;
127
+ }
128
+ build() {
129
+ const el = ExpressionLanguageBuilder.buildConditionGroup(this.conditionGroup);
130
+ return `{ ${el} }`;
131
+ }
132
+ }
133
+
134
+ class Condition {
135
+ constructor(field, type, operator, value) {
136
+ this.field = field;
137
+ this.type = type;
138
+ this.operator = operator;
139
+ this.value = value;
140
+ }
141
+ }
142
+
143
+ /*
144
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
145
+ *
146
+ * Licensed under the Apache License, Version 2.0 (the "License");
147
+ * you may not use this file except in compliance with the License.
148
+ * You may obtain a copy of the License at
149
+ *
150
+ * http://www.apache.org/licenses/LICENSE-2.0
151
+ *
152
+ * Unless required by applicable law or agreed to in writing, software
153
+ * distributed under the License is distributed on an "AS IS" BASIS,
154
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
155
+ * See the License for the specific language governing permissions and
156
+ * limitations under the License.
157
+ */
158
+ class GioElEditorTypeStringComponent {
159
+ constructor() {
160
+ this.destroyRef = inject(DestroyRef);
161
+ this.operators = [
162
+ { label: 'Equals', value: 'EQUALS' },
163
+ { label: 'Not equals', value: 'NOT_EQUALS' },
164
+ ];
165
+ this.filteredOptions$ = new Observable();
166
+ }
167
+ ngOnChanges(changes) {
168
+ if (changes.conditionFormGroup) {
169
+ const field = this.conditionFormGroup.controls.field.value;
170
+ if (isEmpty(field) || field?.type !== 'string') {
171
+ throw new Error('String field is required!');
172
+ }
173
+ this.conditionFormGroup.addControl('operator', new FormControl(null));
174
+ this.conditionFormGroup.addControl('value', new FormControl(null));
175
+ const values = field.values;
176
+ if (values && !isEmpty(values)) {
177
+ this.filteredOptions$ = this.conditionFormGroup.get('value').valueChanges.pipe(takeUntilDestroyed(this.destroyRef), startWith(''), map(value => filterValues(values, toString(value) ?? '')));
178
+ }
179
+ }
180
+ }
181
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorTypeStringComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
182
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: GioElEditorTypeStringComponent, isStandalone: true, selector: "gio-el-editor-type-string", inputs: { conditionFormGroup: "conditionFormGroup" }, usesOnChanges: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n@if (conditionFormGroup) {\n <div [formGroup]=\"conditionFormGroup\" class=\"condition\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n\n <mat-select formControlName=\"operator\" placeholder=\"Select Operator\">\n @for (operator of operators; track operator.value) {\n <mat-option [value]=\"operator.value\">{{ operator.label }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Value</mat-label>\n <input matInput formControlName=\"value\" placeholder=\"Value\" [matAutocomplete]=\"auto\" />\n\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\n @for (option of filteredOptions$ | async; track option) {\n <mat-option [value]=\"option\">{{ option }}</mat-option>\n }\n </mat-autocomplete>\n </mat-form-field>\n </div>\n}\n", styles: [".condition{display:flex;flex-direction:row;align-items:flex-start;gap:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.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: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i6.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: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i6.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i7.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i7.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }] }); }
183
+ }
184
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorTypeStringComponent, decorators: [{
185
+ type: Component,
186
+ args: [{ selector: 'gio-el-editor-type-string', standalone: true, imports: [CommonModule, MatFormFieldModule, MatSelectModule, MatInputModule, ReactiveFormsModule, MatAutocompleteModule], template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n@if (conditionFormGroup) {\n <div [formGroup]=\"conditionFormGroup\" class=\"condition\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n\n <mat-select formControlName=\"operator\" placeholder=\"Select Operator\">\n @for (operator of operators; track operator.value) {\n <mat-option [value]=\"operator.value\">{{ operator.label }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Value</mat-label>\n <input matInput formControlName=\"value\" placeholder=\"Value\" [matAutocomplete]=\"auto\" />\n\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\n @for (option of filteredOptions$ | async; track option) {\n <mat-option [value]=\"option\">{{ option }}</mat-option>\n }\n </mat-autocomplete>\n </mat-form-field>\n </div>\n}\n", styles: [".condition{display:flex;flex-direction:row;align-items:flex-start;gap:8px}\n"] }]
187
+ }], propDecorators: { conditionFormGroup: [{
188
+ type: Input,
189
+ args: [{
190
+ required: true,
191
+ }]
192
+ }] } });
193
+ const filterValues = (values, value) => {
194
+ const filterValue = value.toLowerCase();
195
+ return values.filter(option => option.toLowerCase().includes(filterValue));
196
+ };
197
+
198
+ /*
199
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
200
+ *
201
+ * Licensed under the Apache License, Version 2.0 (the "License");
202
+ * you may not use this file except in compliance with the License.
203
+ * You may obtain a copy of the License at
204
+ *
205
+ * http://www.apache.org/licenses/LICENSE-2.0
206
+ *
207
+ * Unless required by applicable law or agreed to in writing, software
208
+ * distributed under the License is distributed on an "AS IS" BASIS,
209
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
210
+ * See the License for the specific language governing permissions and
211
+ * limitations under the License.
212
+ */
213
+ class GioElEditorTypeBooleanComponent {
214
+ constructor() {
215
+ this.operators = [
216
+ { label: 'Equals', value: 'EQUALS' },
217
+ { label: 'Not equals', value: 'NOT_EQUALS' },
218
+ ];
219
+ }
220
+ ngOnChanges(changes) {
221
+ if (changes.conditionFormGroup) {
222
+ const field = this.conditionFormGroup.controls.field.value;
223
+ if (isEmpty(field) || field?.type !== 'boolean') {
224
+ throw new Error('Boolean field is required!');
225
+ }
226
+ this.conditionFormGroup.addControl('operator', new FormControl(null));
227
+ this.conditionFormGroup.addControl('value', new FormControl(null));
228
+ this.conditionFormGroup.get('value')?.setValue(true);
229
+ }
230
+ }
231
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorTypeBooleanComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
232
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: GioElEditorTypeBooleanComponent, isStandalone: true, selector: "gio-el-editor-type-boolean", inputs: { conditionFormGroup: "conditionFormGroup" }, usesOnChanges: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n@if (conditionFormGroup) {\n <div [formGroup]=\"conditionFormGroup\" class=\"condition\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n\n <mat-select formControlName=\"operator\" placeholder=\"Select Operator\">\n @for (operator of operators; track operator.value) {\n <mat-option [value]=\"operator.value\">{{ operator.label }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-slide-toggle class=\"toggle\" #valueToggle formControlName=\"value\">\n <mat-label>{{ valueToggle.checked ? 'True' : 'False' }}</mat-label>\n </mat-slide-toggle>\n </div>\n}\n", styles: [".condition{display:flex;flex-direction:row;align-items:flex-start;gap:8px}.toggle{min-width:80px;align-self:center;margin-left:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i6.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }] }); }
233
+ }
234
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorTypeBooleanComponent, decorators: [{
235
+ type: Component,
236
+ args: [{ selector: 'gio-el-editor-type-boolean', standalone: true, imports: [CommonModule, MatFormFieldModule, MatSelectModule, ReactiveFormsModule, MatSlideToggle], template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n@if (conditionFormGroup) {\n <div [formGroup]=\"conditionFormGroup\" class=\"condition\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n\n <mat-select formControlName=\"operator\" placeholder=\"Select Operator\">\n @for (operator of operators; track operator.value) {\n <mat-option [value]=\"operator.value\">{{ operator.label }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-slide-toggle class=\"toggle\" #valueToggle formControlName=\"value\">\n <mat-label>{{ valueToggle.checked ? 'True' : 'False' }}</mat-label>\n </mat-slide-toggle>\n </div>\n}\n", styles: [".condition{display:flex;flex-direction:row;align-items:flex-start;gap:8px}.toggle{min-width:80px;align-self:center;margin-left:8px}\n"] }]
237
+ }], propDecorators: { conditionFormGroup: [{
238
+ type: Input,
239
+ args: [{
240
+ required: true,
241
+ }]
242
+ }] } });
243
+
244
+ /*
245
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
246
+ *
247
+ * Licensed under the Apache License, Version 2.0 (the "License");
248
+ * you may not use this file except in compliance with the License.
249
+ * You may obtain a copy of the License at
250
+ *
251
+ * http://www.apache.org/licenses/LICENSE-2.0
252
+ *
253
+ * Unless required by applicable law or agreed to in writing, software
254
+ * distributed under the License is distributed on an "AS IS" BASIS,
255
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
256
+ * See the License for the specific language governing permissions and
257
+ * limitations under the License.
258
+ */
259
+ class GioElEditorTypeNumberComponent {
260
+ constructor() {
261
+ this.operators = [
262
+ { label: 'Equals', value: 'EQUALS' },
263
+ { label: 'Not equals', value: 'NOT_EQUALS' },
264
+ { label: 'Less than', value: 'LESS_THAN' },
265
+ { label: 'Less than or equals', value: 'LESS_THAN_OR_EQUALS' },
266
+ { label: 'Greater than', value: 'GREATER_THAN' },
267
+ { label: 'Greater than or equals', value: 'GREATER_THAN_OR_EQUALS' },
268
+ ];
269
+ this.min = null;
270
+ this.max = null;
271
+ }
272
+ ngOnChanges(changes) {
273
+ if (changes.conditionFormGroup) {
274
+ const field = this.conditionFormGroup.controls.field.value;
275
+ if (isEmpty(field) || field?.type !== 'number') {
276
+ throw new Error('Number field is required!');
277
+ }
278
+ if (field.min) {
279
+ this.min = field.min;
280
+ }
281
+ if (field.max) {
282
+ this.max = field.max;
283
+ }
284
+ this.conditionFormGroup.addControl('operator', new FormControl(null));
285
+ this.conditionFormGroup.addControl('value', new FormControl(true));
286
+ }
287
+ }
288
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorTypeNumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
289
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: GioElEditorTypeNumberComponent, isStandalone: true, selector: "gio-el-editor-type-number", inputs: { conditionFormGroup: "conditionFormGroup" }, usesOnChanges: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n@if (conditionFormGroup) {\n <div [formGroup]=\"conditionFormGroup\" class=\"condition\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n\n <mat-select formControlName=\"operator\" placeholder=\"Select Operator\">\n @for (operator of operators; track operator.value) {\n <mat-option [value]=\"operator.value\">{{ operator.label }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Value</mat-label>\n <input matInput formControlName=\"value\" placeholder=\"Value\" type=\"number\" [min]=\"min\" [max]=\"max\" />\n <mat-error *ngIf=\"conditionFormGroup.get('value')?.hasError('min')\"> Value must be at least {{ min }} </mat-error>\n <mat-error *ngIf=\"conditionFormGroup.get('value')?.hasError('max')\"> Value must be at most {{ max }} </mat-error>\n </mat-form-field>\n </div>\n}\n", styles: [".condition{display:flex;flex-direction:row;align-items:flex-start;gap:8px}.toggle{min-width:80px;margin-left:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.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: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i6.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: i6.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i6.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i6.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
290
+ }
291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorTypeNumberComponent, decorators: [{
292
+ type: Component,
293
+ args: [{ selector: 'gio-el-editor-type-number', standalone: true, imports: [CommonModule, MatFormFieldModule, MatSelectModule, MatInputModule, ReactiveFormsModule], template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n@if (conditionFormGroup) {\n <div [formGroup]=\"conditionFormGroup\" class=\"condition\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n\n <mat-select formControlName=\"operator\" placeholder=\"Select Operator\">\n @for (operator of operators; track operator.value) {\n <mat-option [value]=\"operator.value\">{{ operator.label }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Value</mat-label>\n <input matInput formControlName=\"value\" placeholder=\"Value\" type=\"number\" [min]=\"min\" [max]=\"max\" />\n <mat-error *ngIf=\"conditionFormGroup.get('value')?.hasError('min')\"> Value must be at least {{ min }} </mat-error>\n <mat-error *ngIf=\"conditionFormGroup.get('value')?.hasError('max')\"> Value must be at most {{ max }} </mat-error>\n </mat-form-field>\n </div>\n}\n", styles: [".condition{display:flex;flex-direction:row;align-items:flex-start;gap:8px}.toggle{min-width:80px;margin-left:8px}\n"] }]
294
+ }], propDecorators: { conditionFormGroup: [{
295
+ type: Input,
296
+ args: [{
297
+ required: true,
298
+ }]
299
+ }] } });
300
+
301
+ /*
302
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
303
+ *
304
+ * Licensed under the Apache License, Version 2.0 (the "License");
305
+ * you may not use this file except in compliance with the License.
306
+ * You may obtain a copy of the License at
307
+ *
308
+ * http://www.apache.org/licenses/LICENSE-2.0
309
+ *
310
+ * Unless required by applicable law or agreed to in writing, software
311
+ * distributed under the License is distributed on an "AS IS" BASIS,
312
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
313
+ * See the License for the specific language governing permissions and
314
+ * limitations under the License.
315
+ */
316
+ class GioElEditorTypeDateComponent {
317
+ constructor() {
318
+ this.destroyRef = inject(DestroyRef);
319
+ this.operators = [
320
+ { label: 'Equals', value: 'EQUALS' },
321
+ { label: 'Not equals', value: 'NOT_EQUALS' },
322
+ { label: 'Less than', value: 'LESS_THAN' },
323
+ { label: 'Less than or equals', value: 'LESS_THAN_OR_EQUALS' },
324
+ { label: 'Greater than', value: 'GREATER_THAN' },
325
+ { label: 'Greater than or equals', value: 'GREATER_THAN_OR_EQUALS' },
326
+ ];
327
+ this.datepickerControl = new FormControl();
328
+ }
329
+ ngOnChanges(changes) {
330
+ if (changes.conditionFormGroup) {
331
+ const field = this.conditionFormGroup.controls.field.value;
332
+ if (isEmpty(field) || field?.type !== 'date') {
333
+ throw new Error('Date field is required!');
334
+ }
335
+ this.conditionFormGroup.addControl('operator', new FormControl(null));
336
+ this.conditionFormGroup.addControl('value', new FormControl(true));
337
+ this.datepickerControl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(value => {
338
+ if (!isDate(value)) {
339
+ return;
340
+ }
341
+ // Convert date to UTC ignoring timezone
342
+ const dateUtc = Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds());
343
+ this.conditionFormGroup.controls.value.setValue(new Date(dateUtc));
344
+ });
345
+ }
346
+ }
347
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorTypeDateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
348
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: GioElEditorTypeDateComponent, isStandalone: true, selector: "gio-el-editor-type-date", inputs: { conditionFormGroup: "conditionFormGroup" }, usesOnChanges: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n@if (conditionFormGroup) {\n <div [formGroup]=\"conditionFormGroup\" class=\"condition\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n\n <mat-select formControlName=\"operator\" placeholder=\"Select Operator\">\n @for (operator of operators; track operator.value) {\n <mat-option [value]=\"operator.value\">{{ operator.label }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Choose a date</mat-label>\n <input matInput [matDatepicker]=\"picker\" [formControl]=\"datepickerControl\" />\n <mat-hint>MM/DD/YYYY</mat-hint>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n </div>\n}\n", styles: [".condition{display:flex;flex-direction:row;align-items:flex-start;gap:8px}.toggle{min-width:80px;margin-left:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.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: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i6.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: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i6.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i6$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i6$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i6$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }] }); }
349
+ }
350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorTypeDateComponent, decorators: [{
351
+ type: Component,
352
+ args: [{ selector: 'gio-el-editor-type-date', standalone: true, imports: [CommonModule, MatFormFieldModule, MatSelectModule, MatInputModule, ReactiveFormsModule, MatDatepickerModule], template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n@if (conditionFormGroup) {\n <div [formGroup]=\"conditionFormGroup\" class=\"condition\">\n <mat-form-field>\n <mat-label>Operator</mat-label>\n\n <mat-select formControlName=\"operator\" placeholder=\"Select Operator\">\n @for (operator of operators; track operator.value) {\n <mat-option [value]=\"operator.value\">{{ operator.label }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Choose a date</mat-label>\n <input matInput [matDatepicker]=\"picker\" [formControl]=\"datepickerControl\" />\n <mat-hint>MM/DD/YYYY</mat-hint>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n </div>\n}\n", styles: [".condition{display:flex;flex-direction:row;align-items:flex-start;gap:8px}.toggle{min-width:80px;margin-left:8px}\n"] }]
353
+ }], propDecorators: { conditionFormGroup: [{
354
+ type: Input,
355
+ args: [{
356
+ required: true,
357
+ }]
358
+ }] } });
359
+
360
+ /*
361
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
362
+ *
363
+ * Licensed under the Apache License, Version 2.0 (the "License");
364
+ * you may not use this file except in compliance with the License.
365
+ * You may obtain a copy of the License at
366
+ *
367
+ * http://www.apache.org/licenses/LICENSE-2.0
368
+ *
369
+ * Unless required by applicable law or agreed to in writing, software
370
+ * distributed under the License is distributed on an "AS IS" BASIS,
371
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
372
+ * See the License for the specific language governing permissions and
373
+ * limitations under the License.
374
+ */
375
+ class GioElEditorConditionGroupComponent {
376
+ constructor() {
377
+ /**
378
+ * Condition models to generate the fields for the conditions.
379
+ */
380
+ this.conditionModels = [];
381
+ /**
382
+ * Level of the node in the tree. Useful for testing with Harness to limit the scope of the query.
383
+ */
384
+ this.nodeLvl = 0;
385
+ this.remove = new EventEmitter();
386
+ }
387
+ addConditionGroup() {
388
+ this.conditionGroupFormGroup.controls.conditions.push(newConditionGroupFormGroup$1(), { emitEvent: true });
389
+ this.checkMultipleCondition();
390
+ }
391
+ addCondition() {
392
+ this.conditionGroupFormGroup.controls.conditions.push(newConditionFormGroup());
393
+ this.checkMultipleCondition();
394
+ }
395
+ removeCondition(conditionIndex) {
396
+ this.conditionGroupFormGroup.controls.conditions.removeAt(conditionIndex);
397
+ this.checkMultipleCondition();
398
+ }
399
+ removeConditionGroup() {
400
+ this.remove.emit();
401
+ this.checkMultipleCondition();
402
+ }
403
+ isConditionGroupForm(formGroup) {
404
+ return 'condition' in formGroup.controls && 'conditions' in formGroup.controls;
405
+ }
406
+ checkMultipleCondition() {
407
+ if (this.conditionGroupFormGroup.controls.conditions.length > 1) {
408
+ this.conditionGroupFormGroup.controls.condition.enable();
409
+ }
410
+ else {
411
+ this.conditionGroupFormGroup.controls.condition.disable();
412
+ }
413
+ }
414
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorConditionGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
415
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: GioElEditorConditionGroupComponent, isStandalone: true, selector: "gio-el-editor-condition-group", inputs: { conditionGroupFormGroup: "conditionGroupFormGroup", conditionModels: "conditionModels", nodeLvl: "nodeLvl" }, outputs: { remove: "remove" }, host: { properties: { "attr.node-lvl": "this.nodeLvl" } }, ngImport: i0, template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div class=\"conditionGroup\" [formGroup]=\"conditionGroupFormGroup\">\n <div class=\"conditionGroup__header\">\n <div class=\"conditionGroup__header__conditionField\"></div>\n <mat-button-toggle-group\n class=\"gio-button-toggle-group\"\n name=\"condition\"\n aria-label=\"Condition\"\n formControlName=\"condition\"\n [hideSingleSelectionIndicator]=\"true\"\n >\n <mat-button-toggle class=\"mat-button-toggle-group\" value=\"AND\">AND</mat-button-toggle>\n <mat-button-toggle class=\"mat-button-toggle-group\" value=\"OR\">OR</mat-button-toggle>\n </mat-button-toggle-group>\n\n <div class=\"conditionGroup__header__addBtn\">\n <button mat-button [matMenuTriggerFor]=\"addBtn\">\n <mat-icon svgIcon=\"gio:plus\">Add</mat-icon>\n </button>\n <mat-menu #addBtn=\"matMenu\">\n <button mat-menu-item (click)=\"addConditionGroup()\">Add Group</button>\n <button mat-menu-item (click)=\"addCondition()\">Add Condition</button>\n </mat-menu>\n </div>\n\n @if (nodeLvl > 0) {\n <button class=\"conditionGroup__header__removeBtn\" mat-button aria-label=\"Remove Group\" (click)=\"removeConditionGroup()\">\n <mat-icon svgIcon=\"gio:cancel\"></mat-icon>\n </button>\n }\n </div>\n\n <div class=\"conditionGroup__conditions\">\n @for (condition of conditionGroupFormGroup.controls.conditions.controls; track conditionIndex; let conditionIndex = $index) {\n @if (isConditionGroupForm(condition)) {\n <gio-el-editor-condition-group\n class=\"conditionGroup__conditions__conditionGroup\"\n [conditionGroupFormGroup]=\"condition\"\n [conditionModels]=\"conditionModels\"\n [nodeLvl]=\"nodeLvl + 1\"\n (remove)=\"removeCondition(conditionIndex)\"\n ></gio-el-editor-condition-group>\n } @else {\n <div\n class=\"conditionGroup__conditions__condition\"\n [formGroup]=\"conditionGroupFormGroup.controls.conditions.at(conditionIndex)\"\n [attr.node-lvl]=\"nodeLvl\"\n >\n <mat-form-field class=\"conditionGroup__conditions__condition__field\">\n <mat-label>Field</mat-label>\n\n <mat-select formControlName=\"field\" placeholder=\"Select Field\">\n <mat-option *ngFor=\"let field of conditionModels\" [value]=\"field\">{{ field.label }}</mat-option>\n </mat-select>\n </mat-form-field>\n\n @switch (condition.controls.field.value?.type) {\n @case ('string') {\n <gio-el-editor-type-string [conditionFormGroup]=\"condition\"></gio-el-editor-type-string>\n }\n @case ('boolean') {\n <gio-el-editor-type-boolean [conditionFormGroup]=\"condition\"></gio-el-editor-type-boolean>\n }\n @case ('number') {\n <gio-el-editor-type-number [conditionFormGroup]=\"condition\"></gio-el-editor-type-number>\n }\n @case ('date') {\n <gio-el-editor-type-date [conditionFormGroup]=\"condition\"></gio-el-editor-type-date>\n }\n }\n\n <button\n class=\"conditionGroup__conditions__condition__removeBtn\"\n mat-button\n aria-label=\"Remove Condition\"\n (click)=\"removeCondition(conditionIndex)\"\n >\n <mat-icon svgIcon=\"gio:cancel\"></mat-icon>\n </button>\n </div>\n }\n }\n </div>\n</div>\n", styles: [".conditionGroup{display:flex;flex-direction:column;gap:8px}.conditionGroup__header{display:flex;flex-direction:row;align-items:center;gap:8px}.conditionGroup__header .gio-button-toggle-group{margin-bottom:0}.conditionGroup__conditions{display:flex;flex-direction:column;gap:8px}.conditionGroup__conditions__condition{display:flex;align-items:flex-start;gap:8px}.conditionGroup__conditions__condition__field{flex:0 0 auto}.conditionGroup__conditions__condition__removeBtn{align-self:center}.conditionGroup__conditions__conditionGroup{margin-left:18px}\n"], dependencies: [{ kind: "component", type: GioElEditorConditionGroupComponent, selector: "gio-el-editor-condition-group", inputs: ["conditionGroupFormGroup", "conditionModels", "nodeLvl"], outputs: ["remove"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i6.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i6$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatButtonToggleModule }, { kind: "directive", type: i7$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i7$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i8.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i8.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i8.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: GioIconsModule }, { kind: "component", type: i9.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: GioElEditorTypeBooleanComponent, selector: "gio-el-editor-type-boolean", inputs: ["conditionFormGroup"] }, { kind: "component", type: GioElEditorTypeDateComponent, selector: "gio-el-editor-type-date", inputs: ["conditionFormGroup"] }, { kind: "component", type: GioElEditorTypeStringComponent, selector: "gio-el-editor-type-string", inputs: ["conditionFormGroup"] }, { kind: "component", type: GioElEditorTypeNumberComponent, selector: "gio-el-editor-type-number", inputs: ["conditionFormGroup"] }] }); }
416
+ }
417
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorConditionGroupComponent, decorators: [{
418
+ type: Component,
419
+ args: [{ selector: 'gio-el-editor-condition-group', standalone: true, imports: [
420
+ CommonModule,
421
+ ReactiveFormsModule,
422
+ MatFormFieldModule,
423
+ MatSelectModule,
424
+ MatButtonModule,
425
+ MatButtonToggleModule,
426
+ MatMenuModule,
427
+ GioIconsModule,
428
+ GioElEditorTypeBooleanComponent,
429
+ GioElEditorTypeDateComponent,
430
+ GioElEditorTypeStringComponent,
431
+ GioElEditorTypeNumberComponent,
432
+ ], template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div class=\"conditionGroup\" [formGroup]=\"conditionGroupFormGroup\">\n <div class=\"conditionGroup__header\">\n <div class=\"conditionGroup__header__conditionField\"></div>\n <mat-button-toggle-group\n class=\"gio-button-toggle-group\"\n name=\"condition\"\n aria-label=\"Condition\"\n formControlName=\"condition\"\n [hideSingleSelectionIndicator]=\"true\"\n >\n <mat-button-toggle class=\"mat-button-toggle-group\" value=\"AND\">AND</mat-button-toggle>\n <mat-button-toggle class=\"mat-button-toggle-group\" value=\"OR\">OR</mat-button-toggle>\n </mat-button-toggle-group>\n\n <div class=\"conditionGroup__header__addBtn\">\n <button mat-button [matMenuTriggerFor]=\"addBtn\">\n <mat-icon svgIcon=\"gio:plus\">Add</mat-icon>\n </button>\n <mat-menu #addBtn=\"matMenu\">\n <button mat-menu-item (click)=\"addConditionGroup()\">Add Group</button>\n <button mat-menu-item (click)=\"addCondition()\">Add Condition</button>\n </mat-menu>\n </div>\n\n @if (nodeLvl > 0) {\n <button class=\"conditionGroup__header__removeBtn\" mat-button aria-label=\"Remove Group\" (click)=\"removeConditionGroup()\">\n <mat-icon svgIcon=\"gio:cancel\"></mat-icon>\n </button>\n }\n </div>\n\n <div class=\"conditionGroup__conditions\">\n @for (condition of conditionGroupFormGroup.controls.conditions.controls; track conditionIndex; let conditionIndex = $index) {\n @if (isConditionGroupForm(condition)) {\n <gio-el-editor-condition-group\n class=\"conditionGroup__conditions__conditionGroup\"\n [conditionGroupFormGroup]=\"condition\"\n [conditionModels]=\"conditionModels\"\n [nodeLvl]=\"nodeLvl + 1\"\n (remove)=\"removeCondition(conditionIndex)\"\n ></gio-el-editor-condition-group>\n } @else {\n <div\n class=\"conditionGroup__conditions__condition\"\n [formGroup]=\"conditionGroupFormGroup.controls.conditions.at(conditionIndex)\"\n [attr.node-lvl]=\"nodeLvl\"\n >\n <mat-form-field class=\"conditionGroup__conditions__condition__field\">\n <mat-label>Field</mat-label>\n\n <mat-select formControlName=\"field\" placeholder=\"Select Field\">\n <mat-option *ngFor=\"let field of conditionModels\" [value]=\"field\">{{ field.label }}</mat-option>\n </mat-select>\n </mat-form-field>\n\n @switch (condition.controls.field.value?.type) {\n @case ('string') {\n <gio-el-editor-type-string [conditionFormGroup]=\"condition\"></gio-el-editor-type-string>\n }\n @case ('boolean') {\n <gio-el-editor-type-boolean [conditionFormGroup]=\"condition\"></gio-el-editor-type-boolean>\n }\n @case ('number') {\n <gio-el-editor-type-number [conditionFormGroup]=\"condition\"></gio-el-editor-type-number>\n }\n @case ('date') {\n <gio-el-editor-type-date [conditionFormGroup]=\"condition\"></gio-el-editor-type-date>\n }\n }\n\n <button\n class=\"conditionGroup__conditions__condition__removeBtn\"\n mat-button\n aria-label=\"Remove Condition\"\n (click)=\"removeCondition(conditionIndex)\"\n >\n <mat-icon svgIcon=\"gio:cancel\"></mat-icon>\n </button>\n </div>\n }\n }\n </div>\n</div>\n", styles: [".conditionGroup{display:flex;flex-direction:column;gap:8px}.conditionGroup__header{display:flex;flex-direction:row;align-items:center;gap:8px}.conditionGroup__header .gio-button-toggle-group{margin-bottom:0}.conditionGroup__conditions{display:flex;flex-direction:column;gap:8px}.conditionGroup__conditions__condition{display:flex;align-items:flex-start;gap:8px}.conditionGroup__conditions__condition__field{flex:0 0 auto}.conditionGroup__conditions__condition__removeBtn{align-self:center}.conditionGroup__conditions__conditionGroup{margin-left:18px}\n"] }]
433
+ }], propDecorators: { conditionGroupFormGroup: [{
434
+ type: Input,
435
+ args: [{
436
+ required: true,
437
+ }]
438
+ }], conditionModels: [{
439
+ type: Input,
440
+ args: [{
441
+ required: true,
442
+ }]
443
+ }], nodeLvl: [{
444
+ type: Input
445
+ }, {
446
+ type: HostBinding,
447
+ args: ['attr.node-lvl']
448
+ }], remove: [{
449
+ type: Output
450
+ }] } });
451
+ const newConditionGroupFormGroup$1 = () => {
452
+ return new FormGroup({
453
+ condition: new FormControl({ value: 'AND', disabled: true }, { nonNullable: true, validators: Validators.required }),
454
+ conditions: new FormArray([]),
455
+ });
456
+ };
457
+ const newConditionFormGroup = () => {
458
+ return new FormGroup({
459
+ field: new FormControl(null),
460
+ operator: new FormControl(null),
461
+ value: new FormControl(null),
462
+ });
463
+ };
464
+
465
+ /*
466
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
467
+ *
468
+ * Licensed under the Apache License, Version 2.0 (the "License");
469
+ * you may not use this file except in compliance with the License.
470
+ * You may obtain a copy of the License at
471
+ *
472
+ * http://www.apache.org/licenses/LICENSE-2.0
473
+ *
474
+ * Unless required by applicable law or agreed to in writing, software
475
+ * distributed under the License is distributed on an "AS IS" BASIS,
476
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
477
+ * See the License for the specific language governing permissions and
478
+ * limitations under the License.
479
+ */
480
+ class GioElEditorComponent {
481
+ constructor() {
482
+ this.destroyRef = inject(DestroyRef);
483
+ this.conditionsModel = [];
484
+ this.conditionsGroupFormArray = new FormArray([]);
485
+ this.conditionGroupFormGroup = newConditionGroupFormGroup();
486
+ this.fields = [];
487
+ }
488
+ ngOnInit() {
489
+ for (const conditionModel of this.conditionsModel) {
490
+ if (isConditionModel(conditionModel)) {
491
+ // TOTO: Impl Deep Tree for conditions Limit to fist Node for fist impl
492
+ this.fields.push(conditionModel);
493
+ }
494
+ }
495
+ this.conditionGroupFormGroup.valueChanges
496
+ .pipe(takeUntilDestroyed(this.destroyRef), map(() => this.conditionGroupFormGroup.getRawValue()), map(value => {
497
+ const toCondition = (conditionValue) => {
498
+ if (isConditionGroupValue(conditionValue)) {
499
+ return toConditionGroup(conditionValue);
500
+ }
501
+ if (!isConditionValue(conditionValue) ||
502
+ isNil(conditionValue.field) ||
503
+ isNil(conditionValue.operator) ||
504
+ isNil(conditionValue.value)) {
505
+ return null;
506
+ }
507
+ return new Condition(conditionValue.field.field, conditionValue.field.type, conditionValue.operator, conditionValue.value);
508
+ };
509
+ const toConditionGroup = (conditionGroupValue) => {
510
+ const conditions = [];
511
+ if (!conditionGroupValue.condition || !conditionGroupValue.conditions || isEmpty(conditionGroupValue.conditions)) {
512
+ return null;
513
+ }
514
+ for (const conditionValue of conditionGroupValue.conditions) {
515
+ const condition = toCondition(conditionValue);
516
+ if (condition) {
517
+ conditions.push(condition);
518
+ }
519
+ }
520
+ if (isEmpty(conditions)) {
521
+ return null;
522
+ }
523
+ return new ConditionGroup(conditionGroupValue.condition, conditions);
524
+ };
525
+ const conditionGroupValue = toConditionGroup(value);
526
+ if (conditionGroupValue) {
527
+ this.elOutput = new ExpressionLanguageBuilder(conditionGroupValue).build();
528
+ }
529
+ }))
530
+ .subscribe();
531
+ }
532
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
533
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: GioElEditorComponent, isStandalone: true, selector: "gio-el-editor", inputs: { conditionsModel: "conditionsModel" }, ngImport: i0, template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<gio-el-editor-condition-group\n [conditionGroupFormGroup]=\"conditionGroupFormGroup\"\n [conditionModels]=\"fields\"\n></gio-el-editor-condition-group>\n\n@if (elOutput) {\n <div class=\"elOutput\">\n {{ elOutput }}\n </div>\n}\n", styles: [".conditionGroup{display:flex;flex-direction:column;gap:8px}.conditionGroup__header{display:flex;flex-direction:row;align-items:center;gap:8px}.conditionGroup__conditions{display:flex;flex-direction:column;gap:8px}.condition{display:flex;align-items:flex-start;gap:8px}.condition__removeBtn{align-self:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonToggleModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: GioIconsModule }, { kind: "ngmodule", type: MatMenuModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatInputModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: GioElEditorConditionGroupComponent, selector: "gio-el-editor-condition-group", inputs: ["conditionGroupFormGroup", "conditionModels", "nodeLvl"], outputs: ["remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
534
+ }
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GioElEditorComponent, decorators: [{
536
+ type: Component,
537
+ args: [{ selector: 'gio-el-editor', standalone: true, imports: [
538
+ CommonModule,
539
+ MatButtonToggleModule,
540
+ ReactiveFormsModule,
541
+ MatButtonModule,
542
+ GioIconsModule,
543
+ MatMenuModule,
544
+ MatFormFieldModule,
545
+ MatInputModule,
546
+ MatSelectModule,
547
+ GioElEditorTypeStringComponent,
548
+ GioElEditorTypeBooleanComponent,
549
+ GioElEditorTypeNumberComponent,
550
+ GioElEditorTypeDateComponent,
551
+ GioElEditorConditionGroupComponent,
552
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!--\n\n Copyright (C) 2024 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n\n<gio-el-editor-condition-group\n [conditionGroupFormGroup]=\"conditionGroupFormGroup\"\n [conditionModels]=\"fields\"\n></gio-el-editor-condition-group>\n\n@if (elOutput) {\n <div class=\"elOutput\">\n {{ elOutput }}\n </div>\n}\n", styles: [".conditionGroup{display:flex;flex-direction:column;gap:8px}.conditionGroup__header{display:flex;flex-direction:row;align-items:center;gap:8px}.conditionGroup__conditions{display:flex;flex-direction:column;gap:8px}.condition{display:flex;align-items:flex-start;gap:8px}.condition__removeBtn{align-self:center}\n"] }]
553
+ }], propDecorators: { conditionsModel: [{
554
+ type: Input,
555
+ args: [{ required: true }]
556
+ }] } });
557
+ const newConditionGroupFormGroup = () => {
558
+ return new FormGroup({
559
+ condition: new FormControl({ value: 'AND', disabled: true }, { nonNullable: true, validators: Validators.required }),
560
+ conditions: new FormArray([]),
561
+ });
562
+ };
563
+ const isConditionGroupValue = (value) => {
564
+ return !!value && has(value, 'condition') && has(value, 'conditions');
565
+ };
566
+ const isConditionValue = (value) => {
567
+ return !!value && has(value, 'field') && has(value, 'operator') && has(value, 'value');
568
+ };
569
+
570
+ /*
571
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
572
+ *
573
+ * Licensed under the Apache License, Version 2.0 (the "License");
574
+ * you may not use this file except in compliance with the License.
575
+ * You may obtain a copy of the License at
576
+ *
577
+ * http://www.apache.org/licenses/LICENSE-2.0
578
+ *
579
+ * Unless required by applicable law or agreed to in writing, software
580
+ * distributed under the License is distributed on an "AS IS" BASIS,
581
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
582
+ * See the License for the specific language governing permissions and
583
+ * limitations under the License.
584
+ */
585
+ class GioElEditorTypeComponentHarness extends ComponentHarness {
586
+ constructor() {
587
+ super(...arguments);
588
+ this.getOperatorSelector = this.locatorFor(MatSelectHarness.with({ selector: '[formControlName="operator"]' }));
589
+ }
590
+ async getAvailableOperators() {
591
+ const operatorSelector = await this.getOperatorSelector();
592
+ await operatorSelector.open();
593
+ const options = await operatorSelector.getOptions();
594
+ return parallel(() => options.map(async (option) => await option.getText()));
595
+ }
596
+ async selectOperator(operator) {
597
+ const operatorSelector = await this.getOperatorSelector();
598
+ await operatorSelector.clickOptions({ text: operator });
599
+ }
600
+ async getOperatorValue() {
601
+ const operatorSelector = await this.getOperatorSelector();
602
+ return operatorSelector.getValueText();
603
+ }
604
+ }
605
+
606
+ /*
607
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
608
+ *
609
+ * Licensed under the Apache License, Version 2.0 (the "License");
610
+ * you may not use this file except in compliance with the License.
611
+ * You may obtain a copy of the License at
612
+ *
613
+ * http://www.apache.org/licenses/LICENSE-2.0
614
+ *
615
+ * Unless required by applicable law or agreed to in writing, software
616
+ * distributed under the License is distributed on an "AS IS" BASIS,
617
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
618
+ * See the License for the specific language governing permissions and
619
+ * limitations under the License.
620
+ */
621
+ class GioElEditorTypeBooleanHarness extends GioElEditorTypeComponentHarness {
622
+ static { this.hostSelector = 'gio-el-editor-type-boolean'; }
623
+ async getValue() {
624
+ const slideToggleHarness = await this.locatorFor(MatSlideToggleHarness)();
625
+ return await slideToggleHarness.isChecked();
626
+ }
627
+ async setValue(value) {
628
+ const slideToggleHarness = await this.locatorFor(MatSlideToggleHarness)();
629
+ if (value !== (await slideToggleHarness.isChecked())) {
630
+ await slideToggleHarness.toggle();
631
+ }
632
+ }
633
+ }
634
+
635
+ /*
636
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
637
+ *
638
+ * Licensed under the Apache License, Version 2.0 (the "License");
639
+ * you may not use this file except in compliance with the License.
640
+ * You may obtain a copy of the License at
641
+ *
642
+ * http://www.apache.org/licenses/LICENSE-2.0
643
+ *
644
+ * Unless required by applicable law or agreed to in writing, software
645
+ * distributed under the License is distributed on an "AS IS" BASIS,
646
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
647
+ * See the License for the specific language governing permissions and
648
+ * limitations under the License.
649
+ */
650
+ class GioElEditorTypeStringHarness extends GioElEditorTypeComponentHarness {
651
+ static { this.hostSelector = 'gio-el-editor-type-string'; }
652
+ async getValue() {
653
+ const input = await this.locatorFor(MatInputHarness)();
654
+ return await input.getValue();
655
+ }
656
+ async setValue(value) {
657
+ const input = await this.locatorFor(MatInputHarness)();
658
+ await input.setValue(value);
659
+ }
660
+ }
661
+
662
+ /*
663
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
664
+ *
665
+ * Licensed under the Apache License, Version 2.0 (the "License");
666
+ * you may not use this file except in compliance with the License.
667
+ * You may obtain a copy of the License at
668
+ *
669
+ * http://www.apache.org/licenses/LICENSE-2.0
670
+ *
671
+ * Unless required by applicable law or agreed to in writing, software
672
+ * distributed under the License is distributed on an "AS IS" BASIS,
673
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
674
+ * See the License for the specific language governing permissions and
675
+ * limitations under the License.
676
+ */
677
+ class GioElEditorTypeNumberHarness extends GioElEditorTypeComponentHarness {
678
+ static { this.hostSelector = 'gio-el-editor-type-number'; }
679
+ async getValue() {
680
+ const input = await this.locatorFor(MatInputHarness)();
681
+ return Number(await input.getValue());
682
+ }
683
+ async setValue(value) {
684
+ const input = await this.locatorFor(MatInputHarness)();
685
+ await input.setValue(value.toString());
686
+ }
687
+ }
688
+
689
+ /*
690
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
691
+ *
692
+ * Licensed under the Apache License, Version 2.0 (the "License");
693
+ * you may not use this file except in compliance with the License.
694
+ * You may obtain a copy of the License at
695
+ *
696
+ * http://www.apache.org/licenses/LICENSE-2.0
697
+ *
698
+ * Unless required by applicable law or agreed to in writing, software
699
+ * distributed under the License is distributed on an "AS IS" BASIS,
700
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
701
+ * See the License for the specific language governing permissions and
702
+ * limitations under the License.
703
+ */
704
+ class GioElEditorTypeDateHarness extends GioElEditorTypeComponentHarness {
705
+ static { this.hostSelector = 'gio-el-editor-type-date'; }
706
+ async getValue() {
707
+ const datepickerInputHarness = await this.locatorFor(MatDatepickerInputHarness)();
708
+ return await datepickerInputHarness.getValue();
709
+ }
710
+ async setValue(value) {
711
+ const datepickerInputHarness = await this.locatorFor(MatDatepickerInputHarness)();
712
+ await datepickerInputHarness.setValue(value.toISOString());
713
+ }
714
+ }
715
+
716
+ /*
717
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
718
+ *
719
+ * Licensed under the Apache License, Version 2.0 (the "License");
720
+ * you may not use this file except in compliance with the License.
721
+ * You may obtain a copy of the License at
722
+ *
723
+ * http://www.apache.org/licenses/LICENSE-2.0
724
+ *
725
+ * Unless required by applicable law or agreed to in writing, software
726
+ * distributed under the License is distributed on an "AS IS" BASIS,
727
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
728
+ * See the License for the specific language governing permissions and
729
+ * limitations under the License.
730
+ */
731
+ class GioElEditorConditionGroupHarness extends ComponentHarness {
732
+ constructor() {
733
+ super(...arguments);
734
+ this.getNodeLvl = () => this.host().then(host => host.getAttribute('node-lvl'));
735
+ this.getAddMenuButton = this.locatorFor(MatMenuHarness.with({ triggerText: /Add/ }));
736
+ this.getConditionButtonToggleGroup = this.locatorFor(MatButtonToggleGroupHarness.with({ selector: '[formControlName="condition"]' }));
737
+ this.getConditionsHarness = async () => {
738
+ const nodeLvl = await this.getNodeLvl();
739
+ if (!nodeLvl) {
740
+ throw new Error('Node level not found');
741
+ }
742
+ return this.locatorForAll(DivHarness.with({
743
+ selector: `.conditionGroup__conditions__condition[node-lvl="${nodeLvl}"]`,
744
+ }), GioElEditorConditionGroupHarness.with({
745
+ selector: `.conditionGroup__conditions__conditionGroup[node-lvl="${Number(nodeLvl) + 1}"]`,
746
+ }))();
747
+ };
748
+ this.getConditionHarness = async (index) => (await this.getConditionsHarness()).at(index);
749
+ this.getConditionTypeHarness = (divHarness) => divHarness.childLocatorForOptional(GioElEditorTypeStringHarness, GioElEditorTypeBooleanHarness, GioElEditorTypeNumberHarness, GioElEditorTypeDateHarness)();
750
+ this.getConditionField = (divHarness) => divHarness.childLocatorFor(MatSelectHarness.with({ selector: '[formControlName="field"]' }))();
751
+ }
752
+ static { this.hostSelector = 'gio-el-editor-condition-group'; }
753
+ static with(options = {}) {
754
+ return new HarnessPredicate(GioElEditorConditionGroupHarness, options);
755
+ }
756
+ async clickAddNewConditionButton() {
757
+ await (await this.getAddMenuButton()).clickItem({ text: /Add Condition/ });
758
+ }
759
+ async clickAddNewGroupButton() {
760
+ await (await this.getAddMenuButton()).clickItem({ text: /Add Group/ });
761
+ }
762
+ async getConditionValue() {
763
+ const conditionButtonToggleGroup = await this.getConditionButtonToggleGroup();
764
+ const selectedToggles = await conditionButtonToggleGroup.getToggles({ checked: true });
765
+ if (selectedToggles.length !== 1) {
766
+ throw new Error('No operator selected');
767
+ }
768
+ const andOrMap = {
769
+ AND: 'AND',
770
+ OR: 'OR',
771
+ };
772
+ return andOrMap[await selectedToggles[0].getText()];
773
+ }
774
+ async selectConditionValue(operator) {
775
+ const conditionButtonToggleGroup = await this.getConditionButtonToggleGroup();
776
+ const toggles = await conditionButtonToggleGroup.getToggles({ text: operator });
777
+ if (toggles.length !== 1) {
778
+ throw new Error('No operator selected');
779
+ }
780
+ return toggles[0].check();
781
+ }
782
+ async selectConditionField(index, field) {
783
+ const conditionDiv = await this.getConditionHarness(index);
784
+ if (!conditionDiv || !(conditionDiv instanceof DivHarness)) {
785
+ throw new Error(`Condition with index ${index} not found`);
786
+ }
787
+ const fieldSelect = await this.getConditionField(conditionDiv);
788
+ await fieldSelect.clickOptions({ text: field });
789
+ }
790
+ async selectConditionOperator(index, operator) {
791
+ const conditionDiv = await this.getConditionHarness(index);
792
+ if (!conditionDiv || !(conditionDiv instanceof DivHarness)) {
793
+ throw new Error(`Condition with index ${index} not found`);
794
+ }
795
+ const conditionType = await this.getConditionTypeHarness(conditionDiv);
796
+ if (!conditionType) {
797
+ throw new Error(`Condition type not found. Select field first`);
798
+ }
799
+ await conditionType.selectOperator(operator);
800
+ }
801
+ async getConditionAvailableOperators(index) {
802
+ const conditionDiv = await this.getConditionHarness(index);
803
+ if (!conditionDiv || !(conditionDiv instanceof DivHarness)) {
804
+ throw new Error(`Condition with index ${index} not found`);
805
+ }
806
+ const conditionType = await this.getConditionTypeHarness(conditionDiv);
807
+ if (!conditionType) {
808
+ throw new Error(`Condition type not found. Select field first`);
809
+ }
810
+ return conditionType.getAvailableOperators();
811
+ }
812
+ async setConditionValue(index, value) {
813
+ const conditionDiv = await this.getConditionHarness(index);
814
+ if (!conditionDiv || !(conditionDiv instanceof DivHarness)) {
815
+ throw new Error(`Condition with index ${index} not found`);
816
+ }
817
+ const conditionType = await this.getConditionTypeHarness(conditionDiv);
818
+ if (!conditionType) {
819
+ throw new Error(`Condition type not found. Select field first`);
820
+ }
821
+ if (conditionType instanceof GioElEditorTypeStringHarness && typeof value === 'string') {
822
+ await conditionType.setValue(value);
823
+ }
824
+ else if (conditionType instanceof GioElEditorTypeBooleanHarness && typeof value === 'boolean') {
825
+ await conditionType.setValue(value);
826
+ }
827
+ else if (conditionType instanceof GioElEditorTypeNumberHarness && typeof value === 'number') {
828
+ await conditionType.setValue(value);
829
+ }
830
+ else if (conditionType instanceof GioElEditorTypeDateHarness && value instanceof Date) {
831
+ await conditionType.setValue(value);
832
+ }
833
+ else {
834
+ throw new Error(`Invalid value for condition type`);
835
+ }
836
+ }
837
+ async getConditionGroup(index) {
838
+ const conditionGroup = await this.getConditionHarness(index);
839
+ if (!conditionGroup || !(conditionGroup instanceof GioElEditorConditionGroupHarness)) {
840
+ throw new Error(`Condition group with index ${index} not found`);
841
+ }
842
+ return conditionGroup;
843
+ }
844
+ async getConditions() {
845
+ const getConditionsDiv = await this.getConditionsHarness();
846
+ const conditions = await parallel(() => getConditionsDiv.map(async (condition) => {
847
+ if (condition instanceof GioElEditorConditionGroupHarness) {
848
+ return await condition.getConditions();
849
+ }
850
+ const conditionField = await this.getConditionField(condition);
851
+ const conditionType = await this.getConditionTypeHarness(condition);
852
+ return {
853
+ field: await conditionField.getValueText(),
854
+ operator: await conditionType?.getOperatorValue(),
855
+ value: await conditionType?.getValue(),
856
+ };
857
+ }));
858
+ return {
859
+ condition: await this.getConditionValue(),
860
+ conditions,
861
+ };
862
+ }
863
+ }
864
+
865
+ /*
866
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
867
+ *
868
+ * Licensed under the Apache License, Version 2.0 (the "License");
869
+ * you may not use this file except in compliance with the License.
870
+ * You may obtain a copy of the License at
871
+ *
872
+ * http://www.apache.org/licenses/LICENSE-2.0
873
+ *
874
+ * Unless required by applicable law or agreed to in writing, software
875
+ * distributed under the License is distributed on an "AS IS" BASIS,
876
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
877
+ * See the License for the specific language governing permissions and
878
+ * limitations under the License.
879
+ */
880
+ class GioElEditorHarness extends ComponentHarness {
881
+ constructor() {
882
+ super(...arguments);
883
+ this.getMainConditionGroup = this.locatorFor(GioElEditorConditionGroupHarness);
884
+ }
885
+ static { this.hostSelector = 'gio-el-editor'; }
886
+ }
887
+
888
+ /*
889
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
890
+ *
891
+ * Licensed under the Apache License, Version 2.0 (the "License");
892
+ * you may not use this file except in compliance with the License.
893
+ * You may obtain a copy of the License at
894
+ *
895
+ * http://www.apache.org/licenses/LICENSE-2.0
896
+ *
897
+ * Unless required by applicable law or agreed to in writing, software
898
+ * distributed under the License is distributed on an "AS IS" BASIS,
899
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
900
+ * See the License for the specific language governing permissions and
901
+ * limitations under the License.
902
+ */
903
+
904
+ /*
905
+ * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
906
+ *
907
+ * Licensed under the Apache License, Version 2.0 (the "License");
908
+ * you may not use this file except in compliance with the License.
909
+ * You may obtain a copy of the License at
910
+ *
911
+ * http://www.apache.org/licenses/LICENSE-2.0
912
+ *
913
+ * Unless required by applicable law or agreed to in writing, software
914
+ * distributed under the License is distributed on an "AS IS" BASIS,
915
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
916
+ * See the License for the specific language governing permissions and
917
+ * limitations under the License.
918
+ */
919
+
920
+ /**
921
+ * Generated bundle index. Do not edit.
922
+ */
923
+
924
+ export { Condition, ExpressionLanguageBuilder, GioElEditorComponent, GioElEditorHarness, isConditionModel };
925
+ //# sourceMappingURL=gravitee-ui-particles-angular-gio-el.mjs.map