@gravitee/ui-particles-angular 14.2.1 → 15.0.0-gio-el-editor-4-1cd4100

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 (108) hide show
  1. package/assets/gio-icons.svg +1 -1
  2. package/esm2022/gio-asciidoctor/gio-asciidoctor.component.mjs +2 -2
  3. package/esm2022/gio-el/gio-el-condition-builder/models/Condition.mjs +9 -0
  4. package/esm2022/gio-el/gio-el-condition-builder/models/ConditionGroup.mjs +7 -0
  5. package/esm2022/gio-el/gio-el-condition-builder/models/ExpressionLanguageBuilder.mjs +97 -0
  6. package/esm2022/gio-el/gio-el-condition-builder/models/Operator.mjs +2 -0
  7. package/esm2022/gio-el/gio-el-condition-builder/models/public-api.mjs +19 -0
  8. package/esm2022/gio-el/models/ElProperty.mjs +34 -0
  9. package/esm2022/gio-el/public-api.mjs +2 -4
  10. package/esm2022/lib/gio-banner/gio-banner.component.mjs +10 -10
  11. package/esm2022/lib/gio-breadcrumb/gio-breadcrumb.component.mjs +2 -2
  12. package/esm2022/lib/gio-card-empty-state/gio-card-empty-state.component.mjs +2 -2
  13. package/esm2022/lib/gio-clipboard/gio-clipboard-copy-icon.component.mjs +2 -2
  14. package/esm2022/lib/gio-clipboard/gio-clipboard-copy-wrapper.component.mjs +2 -2
  15. package/esm2022/lib/gio-confirm-and-validate-dialog/gio-confirm-and-validate-dialog.component.mjs +2 -2
  16. package/esm2022/lib/gio-confirm-dialog/gio-confirm-dialog.component.mjs +2 -2
  17. package/esm2022/lib/gio-form-cron/gio-form-cron.component.mjs +2 -2
  18. package/esm2022/lib/gio-form-file-picker/gio-form-file-picker-add-button/gio-form-file-picker-add-button.component.mjs +2 -2
  19. package/esm2022/lib/gio-form-file-picker/gio-form-file-picker.component.mjs +2 -2
  20. package/esm2022/lib/gio-form-headers/gio-form-headers.component.mjs +2 -2
  21. package/esm2022/lib/gio-form-json-schema/type-component/array-type.component.mjs +2 -2
  22. package/esm2022/lib/gio-form-json-schema/type-component/headers-type.component.mjs +2 -2
  23. package/esm2022/lib/gio-form-json-schema/type-component/multischema-type.component.mjs +2 -2
  24. package/esm2022/lib/gio-form-json-schema/type-component/object-type.component.mjs +2 -2
  25. package/esm2022/lib/gio-form-json-schema/wrappers/gio-banner-wrapper.component.mjs +2 -2
  26. package/esm2022/lib/gio-form-selection-inline/gio-form-selection-inline-card-content/gio-form-selection-inline-card-content.component.mjs +2 -2
  27. package/esm2022/lib/gio-form-selection-inline/gio-form-selection-inline-card.component.mjs +2 -2
  28. package/esm2022/lib/gio-form-slide-toggle/gio-form-slide-toggle.component.mjs +2 -2
  29. package/esm2022/lib/gio-license/gio-license-dialog/gio-license-dialog.component.mjs +3 -3
  30. package/esm2022/lib/gio-license-expiration-notification/gio-license-expiration-notification.component.mjs +2 -2
  31. package/esm2022/lib/gio-save-bar/gio-save-bar.component.mjs +3 -3
  32. package/esm2022/lib/oem-theme/gio-menu/gio-menu-footer/gio-menu-footer.component.mjs +2 -2
  33. package/esm2022/lib/oem-theme/gio-menu/gio-menu-item/gio-menu-item.component.mjs +2 -2
  34. package/esm2022/lib/oem-theme/gio-menu/gio-menu-search/gio-menu-search.component.mjs +2 -2
  35. package/esm2022/lib/oem-theme/gio-menu/gio-menu-selector/gio-menu-selector.component.mjs +2 -2
  36. package/esm2022/lib/oem-theme/gio-menu/gio-menu.component.mjs +2 -2
  37. package/esm2022/lib/oem-theme/gio-submenu/gio-submenu-item/gio-submenu-item.component.mjs +2 -2
  38. package/esm2022/lib/oem-theme/gio-submenu/gio-submenu.component.mjs +2 -2
  39. package/esm2022/lib/oem-theme/gio-top-bar/gio-top-bar-content/gio-top-bar-content.component.mjs +2 -2
  40. package/esm2022/lib/oem-theme/gio-top-bar/gio-top-bar-link/gio-top-bar-link.component.mjs +2 -2
  41. package/esm2022/lib/oem-theme/gio-top-bar/gio-top-bar.component.mjs +2 -2
  42. package/esm2022/lib/oem-theme/oem-theme.service.mjs +2 -1
  43. package/fesm2022/gravitee-ui-particles-angular-gio-asciidoctor.mjs +2 -2
  44. package/fesm2022/gravitee-ui-particles-angular-gio-asciidoctor.mjs.map +1 -1
  45. package/fesm2022/gravitee-ui-particles-angular-gio-el.mjs +15 -1127
  46. package/fesm2022/gravitee-ui-particles-angular-gio-el.mjs.map +1 -1
  47. package/fesm2022/gravitee-ui-particles-angular.mjs +74 -73
  48. package/fesm2022/gravitee-ui-particles-angular.mjs.map +1 -1
  49. package/gio-el/{models → gio-el-condition-builder/models}/Condition.d.ts +6 -6
  50. package/gio-el/{models → gio-el-condition-builder/models}/ConditionGroup.d.ts +3 -3
  51. package/gio-el/{models → gio-el-condition-builder/models}/public-api.d.ts +0 -2
  52. package/gio-el/models/ElProperty.d.ts +49 -0
  53. package/gio-el/public-api.d.ts +1 -3
  54. package/lib/oem-theme/oem-theme.service.d.ts +1 -0
  55. package/package.json +5 -4
  56. package/src/lib/gio-badge/gio-badge.scss +3 -2
  57. package/src/lib/gio-button-toggle-group/gio-button-toggle-group.scss +8 -2
  58. package/src/scss/gio-fonts.scss +12 -6
  59. package/src/scss/gio-mat-palettes.scss +187 -124
  60. package/src/scss/gio-mat-theme-variable.scss +7 -7
  61. package/src/scss/gio-oem-palette-variable.scss +3 -3
  62. package/src/scss/gio-oem-palette.scss +3 -2
  63. package/src/scss/index.scss +1 -1
  64. package/src/scss/mat-override/mat-button.scss +27 -0
  65. package/src/scss/mat-override/mat-form-field.scss +12 -0
  66. package/src/scss/mat-override/mat-option.scss +14 -0
  67. package/src/scss/theme/typography/gio-typography.scss +3 -2
  68. package/esm2022/gio-el/gio-el-editor/gio-el-editor-condition-group/gio-el-editor-condition-group.component.mjs +0 -127
  69. package/esm2022/gio-el/gio-el-editor/gio-el-editor-condition-group/gio-el-editor-condition-group.harness.mjs +0 -158
  70. package/esm2022/gio-el/gio-el-editor/gio-el-editor.component.mjs +0 -131
  71. package/esm2022/gio-el/gio-el-editor/gio-el-editor.harness.mjs +0 -28
  72. package/esm2022/gio-el/gio-el-editor/gio-el-field/gio-el-field.component.mjs +0 -271
  73. package/esm2022/gio-el/gio-el-editor/gio-el-field/gio-el-field.harness.mjs +0 -53
  74. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-boolean/gio-el-editor-type-boolean.component.mjs +0 -57
  75. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-boolean/gio-el-editor-type-boolean.harness.mjs +0 -31
  76. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-date/gio-el-editor-type-date.component.mjs +0 -74
  77. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-date/gio-el-editor-type-date.harness.mjs +0 -29
  78. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-number/gio-el-editor-type-number.component.mjs +0 -70
  79. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-number/gio-el-editor-type-number.harness.mjs +0 -29
  80. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-string/gio-el-editor-type-string.component.mjs +0 -73
  81. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-string/gio-el-editor-type-string.harness.mjs +0 -29
  82. package/esm2022/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type.harness.mjs +0 -38
  83. package/esm2022/gio-el/models/Condition.mjs +0 -9
  84. package/esm2022/gio-el/models/ConditionGroup.mjs +0 -7
  85. package/esm2022/gio-el/models/ConditionModel.mjs +0 -17
  86. package/esm2022/gio-el/models/ConditionsModel.mjs +0 -4
  87. package/esm2022/gio-el/models/ExpressionLanguageBuilder.mjs +0 -97
  88. package/esm2022/gio-el/models/Operator.mjs +0 -2
  89. package/esm2022/gio-el/models/public-api.mjs +0 -21
  90. package/gio-el/gio-el-editor/gio-el-editor-condition-group/gio-el-editor-condition-group.component.d.ts +0 -25
  91. package/gio-el/gio-el-editor/gio-el-editor-condition-group/gio-el-editor-condition-group.harness.d.ts +0 -36
  92. package/gio-el/gio-el-editor/gio-el-editor.component.d.ts +0 -25
  93. package/gio-el/gio-el-editor/gio-el-editor.harness.d.ts +0 -7
  94. package/gio-el/gio-el-editor/gio-el-field/gio-el-field.component.d.ts +0 -70
  95. package/gio-el/gio-el-editor/gio-el-field/gio-el-field.harness.d.ts +0 -14
  96. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-boolean/gio-el-editor-type-boolean.component.d.ts +0 -15
  97. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-boolean/gio-el-editor-type-boolean.harness.d.ts +0 -6
  98. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-date/gio-el-editor-type-date.component.d.ts +0 -17
  99. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-date/gio-el-editor-type-date.harness.d.ts +0 -6
  100. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-number/gio-el-editor-type-number.component.d.ts +0 -17
  101. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-number/gio-el-editor-type-number.harness.d.ts +0 -6
  102. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-string/gio-el-editor-type-string.component.d.ts +0 -23
  103. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type-string/gio-el-editor-type-string.harness.d.ts +0 -6
  104. package/gio-el/gio-el-editor/gio-el-type/gio-el-editor-type.harness.d.ts +0 -10
  105. package/gio-el/models/ConditionModel.d.ts +0 -32
  106. package/gio-el/models/ConditionsModel.d.ts +0 -8
  107. /package/gio-el/{models → gio-el-condition-builder/models}/ExpressionLanguageBuilder.d.ts +0 -0
  108. /package/gio-el/{models → gio-el-condition-builder/models}/Operator.d.ts +0 -0
@@ -1,43 +1,13 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, DestroyRef, Component, Input, Optional, Self, HostBinding, EventEmitter, Output, ChangeDetectionStrategy } from '@angular/core';
3
- import * as i4$1 from '@angular/material/button-toggle';
4
- import { MatButtonToggleModule } from '@angular/material/button-toggle';
5
- import * as i5 from '@angular/forms';
6
- import { FormControl, ReactiveFormsModule, FormGroup, Validators, FormArray } from '@angular/forms';
7
- import * as i3$1 from '@angular/material/button';
8
- import { MatButtonModule } from '@angular/material/button';
9
- import * as i5$2 from '@angular/material/menu';
10
- import { MatMenuModule } from '@angular/material/menu';
11
- import * as i2 from '@angular/material/form-field';
12
- import { MatFormFieldModule, MatFormFieldControl } from '@angular/material/form-field';
13
- import * as i4 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 { isNil, isEmpty, toString, isDate, get, has } from 'lodash';
22
- import { GioIconsModule } from '@gravitee/ui-particles-angular';
23
- import * as i6 from '@angular/material/autocomplete';
24
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
25
- import { Observable, Subject, combineLatest } from 'rxjs';
26
- import { MatSlideToggle } from '@angular/material/slide-toggle';
27
- import * as i5$1 from '@angular/material/datepicker';
28
- import { MatDatepickerModule } from '@angular/material/datepicker';
29
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
30
- import * as i2$1 from '@angular/cdk/a11y';
31
- import * as i6$1 from '@angular/material/icon';
32
- import { ComponentHarness, parallel, HarnessPredicate } from '@angular/cdk/testing';
33
- import { MatMenuHarness } from '@angular/material/menu/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 { MatSelectHarness } from '@angular/material/select/testing';
38
- import { MatInputHarness } from '@angular/material/input/testing';
39
- import { MatDatepickerInputHarness } from '@angular/material/datepicker/testing';
40
- import { MatAutocompleteHarness } from '@angular/material/autocomplete/testing';
1
+ import { isNil } from 'lodash';
2
+
3
+ class Condition {
4
+ constructor(field, type, operator, value) {
5
+ this.field = field;
6
+ this.type = type;
7
+ this.operator = operator;
8
+ this.value = value;
9
+ }
10
+ }
41
11
 
42
12
  class ConditionGroup {
43
13
  constructor(condition, conditions) {
@@ -121,11 +91,11 @@ class ExpressionLanguageBuilder {
121
91
  }
122
92
  }
123
93
  static toFieldString(field) {
124
- if (field instanceof Object && !isNil(field.key1Value) && !isNil(field.key2Value)) {
125
- return `#${field.field}?.["${field.key1Value}"]?.[${field.key2Value}]`;
94
+ if (field instanceof Object && !isNil(field.key1) && !isNil(field.key2)) {
95
+ return `#${field.field}?.["${field.key1}"]?.[${field.key2}]`;
126
96
  }
127
- else if (field instanceof Object && !isNil(field.key1Value)) {
128
- return `#${field.field}?.["${field.key1Value}"]`;
97
+ else if (field instanceof Object && !isNil(field.key1)) {
98
+ return `#${field.field}?.["${field.key1}"]`;
129
99
  }
130
100
  else if (field instanceof Object) {
131
101
  return `#${field.field}`;
@@ -141,1088 +111,6 @@ class ExpressionLanguageBuilder {
141
111
  }
142
112
  }
143
113
 
144
- class Condition {
145
- constructor(field, type, operator, value) {
146
- this.field = field;
147
- this.type = type;
148
- this.operator = operator;
149
- this.value = value;
150
- }
151
- }
152
-
153
- /*
154
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
155
- *
156
- * Licensed under the Apache License, Version 2.0 (the "License");
157
- * you may not use this file except in compliance with the License.
158
- * You may obtain a copy of the License at
159
- *
160
- * http://www.apache.org/licenses/LICENSE-2.0
161
- *
162
- * Unless required by applicable law or agreed to in writing, software
163
- * distributed under the License is distributed on an "AS IS" BASIS,
164
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
165
- * See the License for the specific language governing permissions and
166
- * limitations under the License.
167
- */
168
- class GioElEditorTypeStringComponent {
169
- constructor() {
170
- this.destroyRef = inject(DestroyRef);
171
- this.operators = [
172
- { label: 'Equals', value: 'EQUALS' },
173
- { label: 'Not equals', value: 'NOT_EQUALS' },
174
- ];
175
- this.filteredOptions$ = new Observable();
176
- }
177
- ngOnChanges(changes) {
178
- if (changes.conditionFormGroup) {
179
- const field = this.conditionFormGroup.controls.field.value;
180
- if (isEmpty(field) || field?.type !== 'string') {
181
- throw new Error('String field is required!');
182
- }
183
- this.conditionFormGroup.addControl('operator', new FormControl(null));
184
- this.conditionFormGroup.addControl('value', new FormControl(null));
185
- const values = field.values?.map(value => (typeof value === 'string' ? { value, label: value } : value));
186
- if (values && !isEmpty(values)) {
187
- this.filteredOptions$ = this.conditionFormGroup.get('value').valueChanges.pipe(takeUntilDestroyed(this.destroyRef), startWith(''), map(value => filterValues(values, toString(value) ?? '')));
188
- }
189
- }
190
- }
191
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorTypeStringComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
192
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", 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 class=\"condition__operator\">\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.value\">{{ option.label }}</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}.condition__operator{width:120px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.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", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5.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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i6.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: i6.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }] }); }
193
- }
194
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorTypeStringComponent, decorators: [{
195
- type: Component,
196
- args: [{ selector: 'gio-el-editor-type-string', 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 class=\"condition__operator\">\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.value\">{{ option.label }}</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}.condition__operator{width:120px}\n"] }]
197
- }], propDecorators: { conditionFormGroup: [{
198
- type: Input,
199
- args: [{
200
- required: true,
201
- }]
202
- }] } });
203
- const filterValues = (values, value) => {
204
- const filterValue = value.toLowerCase();
205
- return values.filter(option => option.label.toLowerCase().includes(filterValue) || option.value.toLowerCase().includes(filterValue));
206
- };
207
-
208
- /*
209
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
210
- *
211
- * Licensed under the Apache License, Version 2.0 (the "License");
212
- * you may not use this file except in compliance with the License.
213
- * You may obtain a copy of the License at
214
- *
215
- * http://www.apache.org/licenses/LICENSE-2.0
216
- *
217
- * Unless required by applicable law or agreed to in writing, software
218
- * distributed under the License is distributed on an "AS IS" BASIS,
219
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
220
- * See the License for the specific language governing permissions and
221
- * limitations under the License.
222
- */
223
- class GioElEditorTypeBooleanComponent {
224
- constructor() {
225
- this.operators = [
226
- { label: 'Equals', value: 'EQUALS' },
227
- { label: 'Not equals', value: 'NOT_EQUALS' },
228
- ];
229
- }
230
- ngOnChanges(changes) {
231
- if (changes.conditionFormGroup) {
232
- const field = this.conditionFormGroup.controls.field.value;
233
- if (isEmpty(field) || field?.type !== 'boolean') {
234
- throw new Error('Boolean field is required!');
235
- }
236
- this.conditionFormGroup.addControl('operator', new FormControl(null));
237
- this.conditionFormGroup.addControl('value', new FormControl(null));
238
- this.conditionFormGroup.get('value')?.setValue(true);
239
- }
240
- }
241
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorTypeBooleanComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
242
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", 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 class=\"condition__operator\">\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}.condition__operator{width:120px}.toggle{min-width:80px;align-self:center;margin-left:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.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", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.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"] }] }); }
243
- }
244
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorTypeBooleanComponent, decorators: [{
245
- type: Component,
246
- args: [{ selector: 'gio-el-editor-type-boolean', 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 class=\"condition__operator\">\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}.condition__operator{width:120px}.toggle{min-width:80px;align-self:center;margin-left:8px}\n"] }]
247
- }], propDecorators: { conditionFormGroup: [{
248
- type: Input,
249
- args: [{
250
- required: true,
251
- }]
252
- }] } });
253
-
254
- /*
255
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
256
- *
257
- * Licensed under the Apache License, Version 2.0 (the "License");
258
- * you may not use this file except in compliance with the License.
259
- * You may obtain a copy of the License at
260
- *
261
- * http://www.apache.org/licenses/LICENSE-2.0
262
- *
263
- * Unless required by applicable law or agreed to in writing, software
264
- * distributed under the License is distributed on an "AS IS" BASIS,
265
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
266
- * See the License for the specific language governing permissions and
267
- * limitations under the License.
268
- */
269
- class GioElEditorTypeNumberComponent {
270
- constructor() {
271
- this.operators = [
272
- { label: 'Equals', value: 'EQUALS' },
273
- { label: 'Not equals', value: 'NOT_EQUALS' },
274
- { label: 'Less than', value: 'LESS_THAN' },
275
- { label: 'Less than or equals', value: 'LESS_THAN_OR_EQUALS' },
276
- { label: 'Greater than', value: 'GREATER_THAN' },
277
- { label: 'Greater than or equals', value: 'GREATER_THAN_OR_EQUALS' },
278
- ];
279
- this.min = null;
280
- this.max = null;
281
- }
282
- ngOnChanges(changes) {
283
- if (changes.conditionFormGroup) {
284
- const field = this.conditionFormGroup.controls.field.value;
285
- if (isEmpty(field) || field?.type !== 'number') {
286
- throw new Error('Number field is required!');
287
- }
288
- if (field.min) {
289
- this.min = field.min;
290
- }
291
- if (field.max) {
292
- this.max = field.max;
293
- }
294
- this.conditionFormGroup.addControl('operator', new FormControl(null));
295
- this.conditionFormGroup.addControl('value', new FormControl(true));
296
- }
297
- }
298
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorTypeNumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
299
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", 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 class=\"condition__operator\">\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}.condition__operator{width:120px}.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: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.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", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5.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: i5.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i5.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
300
- }
301
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorTypeNumberComponent, decorators: [{
302
- type: Component,
303
- args: [{ selector: 'gio-el-editor-type-number', 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 class=\"condition__operator\">\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}.condition__operator{width:120px}.toggle{min-width:80px;margin-left:8px}\n"] }]
304
- }], propDecorators: { conditionFormGroup: [{
305
- type: Input,
306
- args: [{
307
- required: true,
308
- }]
309
- }] } });
310
-
311
- /*
312
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
313
- *
314
- * Licensed under the Apache License, Version 2.0 (the "License");
315
- * you may not use this file except in compliance with the License.
316
- * You may obtain a copy of the License at
317
- *
318
- * http://www.apache.org/licenses/LICENSE-2.0
319
- *
320
- * Unless required by applicable law or agreed to in writing, software
321
- * distributed under the License is distributed on an "AS IS" BASIS,
322
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
323
- * See the License for the specific language governing permissions and
324
- * limitations under the License.
325
- */
326
- class GioElEditorTypeDateComponent {
327
- constructor() {
328
- this.destroyRef = inject(DestroyRef);
329
- this.operators = [
330
- { label: 'Equals', value: 'EQUALS' },
331
- { label: 'Not equals', value: 'NOT_EQUALS' },
332
- { label: 'Less than', value: 'LESS_THAN' },
333
- { label: 'Less than or equals', value: 'LESS_THAN_OR_EQUALS' },
334
- { label: 'Greater than', value: 'GREATER_THAN' },
335
- { label: 'Greater than or equals', value: 'GREATER_THAN_OR_EQUALS' },
336
- ];
337
- this.datepickerControl = new FormControl();
338
- }
339
- ngOnChanges(changes) {
340
- if (changes.conditionFormGroup) {
341
- const field = this.conditionFormGroup.controls.field.value;
342
- if (isEmpty(field) || field?.type !== 'date') {
343
- throw new Error('Date field is required!');
344
- }
345
- this.conditionFormGroup.addControl('operator', new FormControl(null));
346
- this.conditionFormGroup.addControl('value', new FormControl(true));
347
- this.datepickerControl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(value => {
348
- if (!isDate(value)) {
349
- return;
350
- }
351
- // Convert date to UTC ignoring timezone
352
- const dateUtc = Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds());
353
- this.conditionFormGroup.controls.value.setValue(new Date(dateUtc));
354
- });
355
- }
356
- }
357
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorTypeDateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
358
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", 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 class=\"condition__operator\">\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}.condition__operator{width:120px}.toggle{min-width:80px;margin-left:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.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", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5.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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i5$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }] }); }
359
- }
360
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorTypeDateComponent, decorators: [{
361
- type: Component,
362
- args: [{ selector: 'gio-el-editor-type-date', 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 class=\"condition__operator\">\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}.condition__operator{width:120px}.toggle{min-width:80px;margin-left:8px}\n"] }]
363
- }], propDecorators: { conditionFormGroup: [{
364
- type: Input,
365
- args: [{
366
- required: true,
367
- }]
368
- }] } });
369
-
370
- const isConditionModel = (conditions) => {
371
- return 'field' in conditions && 'label' in conditions && 'type' in conditions;
372
- };
373
-
374
- /*
375
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
376
- *
377
- * Licensed under the Apache License, Version 2.0 (the "License");
378
- * you may not use this file except in compliance with the License.
379
- * You may obtain a copy of the License at
380
- *
381
- * http://www.apache.org/licenses/LICENSE-2.0
382
- *
383
- * Unless required by applicable law or agreed to in writing, software
384
- * distributed under the License is distributed on an "AS IS" BASIS,
385
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
386
- * See the License for the specific language governing permissions and
387
- * limitations under the License.
388
- */
389
- class GioElFieldComponent {
390
- // From MatFormFieldControl
391
- set value(_value) {
392
- // Not implemented. Only for select new value.
393
- }
394
- // From MatFormFieldControl
395
- static { this.nextId = 0; }
396
- // From MatFormFieldControl
397
- get placeholder() {
398
- return this._placeholder;
399
- }
400
- set placeholder(plh) {
401
- this._placeholder = plh;
402
- this.stateChanges.next();
403
- }
404
- // From MatFormFieldControl
405
- get empty() {
406
- return !this.fieldFormControl.value;
407
- }
408
- // From MatFormFieldControl
409
- get shouldLabelFloat() {
410
- return this.focused || !this.empty;
411
- }
412
- // From MatFormFieldControl
413
- get required() {
414
- return this._required;
415
- }
416
- set required(req) {
417
- this._required = coerceBooleanProperty(req);
418
- this.stateChanges.next();
419
- }
420
- // From MatFormFieldControl
421
- get disabled() {
422
- return this._disabled;
423
- }
424
- set disabled(value) {
425
- this._disabled = coerceBooleanProperty(value);
426
- this._disabled ? this.fieldFormControl.disable() : this.fieldFormControl.enable();
427
- this.stateChanges.next();
428
- }
429
- // From MatFormFieldControl
430
- get errorState() {
431
- return this.fieldFormControl.invalid && this.touched;
432
- }
433
- // From MatFormFieldControl
434
- setDescribedByIds(ids) {
435
- this.userAriaDescribedBy = ids.join(' ');
436
- }
437
- constructor(ngControl, elementRef, focusMonitor) {
438
- this.ngControl = ngControl;
439
- this.elementRef = elementRef;
440
- this.focusMonitor = focusMonitor;
441
- this.destroyRef = inject(DestroyRef);
442
- this.conditionsModel = [];
443
- this.fieldFilteredOptions$ = new Observable();
444
- this.key1FilteredOptions$ = new Observable();
445
- this.selectedConditionModel = null;
446
- this.fieldFormControl = new FormControl(null);
447
- this.key1FormControl = new FormControl(null);
448
- this.key2FormControl = new FormControl(null);
449
- // From MatFormFieldControl
450
- this.stateChanges = new Subject();
451
- this.id = `gio-el-editor-input-${GioElFieldComponent.nextId++}`;
452
- this._placeholder = '';
453
- // From MatFormFieldControl
454
- this.focused = false;
455
- this._required = false;
456
- this._disabled = false;
457
- this.touched = false;
458
- // From MatFormFieldControl
459
- this.controlType = 'gio-el-editor-input';
460
- // From MatFormFieldControl
461
- // disableAutomaticLabeling?: boolean | undefined;
462
- this._onChange = () => ({});
463
- this._onTouched = () => ({});
464
- if (this.ngControl != null) {
465
- // Setting the value accessor directly (instead of using
466
- // the providers) to avoid running into a circular import.
467
- this.ngControl.valueAccessor = this;
468
- }
469
- this.focusMonitor
470
- .monitor(this.elementRef.nativeElement, true)
471
- .pipe(takeUntilDestroyed(this.destroyRef))
472
- .subscribe(origin => {
473
- this.focused = !!origin;
474
- this.touched = true;
475
- this._onTouched();
476
- this.stateChanges.next();
477
- });
478
- }
479
- ngOnChanges(changes) {
480
- if (changes.conditionsModel) {
481
- const flattenConditionsModelToOption = (conditions, parent = null) => {
482
- return conditions.flatMap(condition => {
483
- if (isConditionModel(condition)) {
484
- return {
485
- ...condition,
486
- label: parent ? `${parent.label} > ${condition.label}` : condition.label,
487
- field: parent ? `${parent.field}.${condition.field}` : condition.field,
488
- };
489
- }
490
- return flattenConditionsModelToOption(condition.conditions, {
491
- ...condition,
492
- field: parent ? `${parent.field}.${condition.field}` : condition.field,
493
- label: parent ? `${parent.label} > ${condition.label}` : condition.label,
494
- });
495
- });
496
- };
497
- const autocompleteModel = this.conditionsModel.map(conditionModel => {
498
- if (isConditionModel(conditionModel)) {
499
- return {
500
- ...conditionModel,
501
- };
502
- }
503
- return {
504
- field: conditionModel.field,
505
- label: conditionModel.label,
506
- options: flattenConditionsModelToOption(conditionModel.conditions).map(conditions => ({
507
- ...conditions,
508
- field: `${conditionModel.field}.${conditions.field}`,
509
- })),
510
- };
511
- });
512
- if (autocompleteModel && !isEmpty(autocompleteModel)) {
513
- this.fieldFilteredOptions$ = this.fieldFormControl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef), startWith(''), map(value => fieldFilterValues(autocompleteModel, toString(value) ?? '')));
514
- }
515
- combineLatest([
516
- this.fieldFormControl.valueChanges,
517
- this.key1FormControl.valueChanges.pipe(startWith(this.key1FormControl.value)),
518
- this.key2FormControl.valueChanges.pipe(startWith(this.key1FormControl.value)),
519
- ])
520
- .pipe(takeUntilDestroyed(this.destroyRef))
521
- .subscribe(([fieldValue, key1Value, key2Value]) => {
522
- let map = fieldValue?.map;
523
- if (map?.type === 'Map') {
524
- map = { ...map, key1Value };
525
- }
526
- if (map?.type === 'MultiMap') {
527
- map = { ...map, key1Value, key2Value };
528
- }
529
- if (fieldValue && isConditionModel(fieldValue)) {
530
- this._onChange({
531
- ...fieldValue,
532
- map,
533
- });
534
- }
535
- else {
536
- this._onChange(null);
537
- }
538
- this.stateChanges.next();
539
- });
540
- }
541
- }
542
- displayFn(option) {
543
- return option?.field;
544
- }
545
- onFieldSelected($event) {
546
- this.selectedConditionModel = $event.option.value;
547
- const key1AutocompleteValues = this.selectedConditionModel?.map?.key1Values?.map(value => typeof value === 'string' ? { value, label: value } : value);
548
- if (key1AutocompleteValues && !isEmpty(key1AutocompleteValues)) {
549
- this.key1FilteredOptions$ = this.key1FormControl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef), startWith(''), map(value => key1FilterValues(key1AutocompleteValues, toString(value) ?? '')));
550
- }
551
- }
552
- // From ControlValueAccessor interface
553
- writeValue() {
554
- // Not implemented. Only for select new value.
555
- }
556
- // From ControlValueAccessor interface
557
- registerOnChange(fn) {
558
- this._onChange = fn;
559
- }
560
- // From ControlValueAccessor interface
561
- registerOnTouched(fn) {
562
- this._onTouched = fn;
563
- }
564
- // From ControlValueAccessor interface
565
- setDisabledState(isDisabled) {
566
- this.disabled = isDisabled;
567
- if (isDisabled) {
568
- this.fieldFormControl.disable();
569
- }
570
- else {
571
- this.fieldFormControl.enable();
572
- }
573
- }
574
- // From ControlValueAccessor interface
575
- onContainerClick(event) {
576
- if (event.target.tagName.toLowerCase() != 'input') {
577
- this.elementRef.nativeElement.querySelector('input')?.focus();
578
- }
579
- }
580
- ngOnDestroy() {
581
- this.stateChanges.complete();
582
- this.focusMonitor.stopMonitoring(this.elementRef);
583
- }
584
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElFieldComponent, deps: [{ token: i5.NgControl, optional: true, self: true }, { token: i0.ElementRef }, { token: i2$1.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component }); }
585
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: GioElFieldComponent, isStandalone: true, selector: "gio-el-field", inputs: { conditionsModel: "conditionsModel", placeholder: "placeholder", required: "required" }, host: { properties: { "id": "this.id", "class.floating": "this.shouldLabelFloat", "attr.aria-describedBy": "this.userAriaDescribedBy" } }, providers: [{ provide: MatFormFieldControl, useExisting: GioElFieldComponent }], 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\n<div class=\"container\">\n <span class=\"text\">#</span>\n <input class=\"input fieldSelect\" matInput [formControl]=\"fieldFormControl\" [matAutocomplete]=\"fieldSelectAuto\" />\n\n <mat-autocomplete\n autoActiveFirstOption\n requireSelection\n #fieldSelectAuto=\"matAutocomplete\"\n panelWidth=\"auto\"\n [displayWith]=\"displayFn\"\n (optionSelected)=\"onFieldSelected($event)\"\n >\n @for (option of fieldFilteredOptions$ | async; track option) {\n @if (option.hasOwnProperty('options')) {\n <mat-optgroup [label]=\"option.label\">\n @for (option of $any(option).options; track option) {\n <mat-option [value]=\"option\">{{ option.label }}</mat-option>\n }\n </mat-optgroup>\n } @else {\n <mat-option [value]=\"option\">{{ option.label }}</mat-option>\n }\n }\n </mat-autocomplete>\n @if (selectedConditionModel?.map) {\n <span class=\"text\">[\"</span>\n <input class=\"input key1\" matInput [formControl]=\"key1FormControl\" [matAutocomplete]=\"key1SelectAuto\" />\n\n <mat-autocomplete #key1SelectAuto=\"matAutocomplete\" panelWidth=\"auto\">\n @for (option of key1FilteredOptions$ | async; track option) {\n <mat-option [value]=\"option.value\">{{ option.label }}</mat-option>\n }\n </mat-autocomplete>\n\n <span class=\"text\">\"]</span>\n }\n @if (selectedConditionModel?.map?.type === 'MultiMap') {\n <span class=\"text\">[</span>\n <input class=\"input key2\" type=\"number\" min=\"0\" matInput [formControl]=\"key2FormControl\" />\n\n <span class=\"text\">]</span>\n }\n</div>\n", styles: [":host{opacity:0}:host.floating{opacity:1}.container{display:flex;align-items:center}.input{flex:3 2 auto;padding:0;border:none;background:none;color:currentcolor;font:inherit;outline:none}.input.key1,.input.key2{flex:2 3 auto;border-bottom:1px dashed #a2a5b5!important}.text{color:#a2a5b5}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i6.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: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i3.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "directive", type: i6.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5.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: i5.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: GioIconsModule }] }); }
586
- }
587
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElFieldComponent, decorators: [{
588
- type: Component,
589
- args: [{ selector: 'gio-el-field', imports: [CommonModule, MatAutocompleteModule, MatInputModule, ReactiveFormsModule, MatButtonModule, GioIconsModule], providers: [{ provide: MatFormFieldControl, useExisting: GioElFieldComponent }], 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<div class=\"container\">\n <span class=\"text\">#</span>\n <input class=\"input fieldSelect\" matInput [formControl]=\"fieldFormControl\" [matAutocomplete]=\"fieldSelectAuto\" />\n\n <mat-autocomplete\n autoActiveFirstOption\n requireSelection\n #fieldSelectAuto=\"matAutocomplete\"\n panelWidth=\"auto\"\n [displayWith]=\"displayFn\"\n (optionSelected)=\"onFieldSelected($event)\"\n >\n @for (option of fieldFilteredOptions$ | async; track option) {\n @if (option.hasOwnProperty('options')) {\n <mat-optgroup [label]=\"option.label\">\n @for (option of $any(option).options; track option) {\n <mat-option [value]=\"option\">{{ option.label }}</mat-option>\n }\n </mat-optgroup>\n } @else {\n <mat-option [value]=\"option\">{{ option.label }}</mat-option>\n }\n }\n </mat-autocomplete>\n @if (selectedConditionModel?.map) {\n <span class=\"text\">[\"</span>\n <input class=\"input key1\" matInput [formControl]=\"key1FormControl\" [matAutocomplete]=\"key1SelectAuto\" />\n\n <mat-autocomplete #key1SelectAuto=\"matAutocomplete\" panelWidth=\"auto\">\n @for (option of key1FilteredOptions$ | async; track option) {\n <mat-option [value]=\"option.value\">{{ option.label }}</mat-option>\n }\n </mat-autocomplete>\n\n <span class=\"text\">\"]</span>\n }\n @if (selectedConditionModel?.map?.type === 'MultiMap') {\n <span class=\"text\">[</span>\n <input class=\"input key2\" type=\"number\" min=\"0\" matInput [formControl]=\"key2FormControl\" />\n\n <span class=\"text\">]</span>\n }\n</div>\n", styles: [":host{opacity:0}:host.floating{opacity:1}.container{display:flex;align-items:center}.input{flex:3 2 auto;padding:0;border:none;background:none;color:currentcolor;font:inherit;outline:none}.input.key1,.input.key2{flex:2 3 auto;border-bottom:1px dashed #a2a5b5!important}.text{color:#a2a5b5}\n"] }]
590
- }], ctorParameters: () => [{ type: i5.NgControl, decorators: [{
591
- type: Optional
592
- }, {
593
- type: Self
594
- }] }, { type: i0.ElementRef }, { type: i2$1.FocusMonitor }], propDecorators: { conditionsModel: [{
595
- type: Input,
596
- args: [{ required: true }]
597
- }], id: [{
598
- type: HostBinding
599
- }], placeholder: [{
600
- type: Input
601
- }], shouldLabelFloat: [{
602
- type: HostBinding,
603
- args: ['class.floating']
604
- }], required: [{
605
- type: Input
606
- }], userAriaDescribedBy: [{
607
- type: HostBinding,
608
- args: ['attr.aria-describedBy']
609
- }] } });
610
- const fieldFilterValues = (autocompleteModel, value) => {
611
- const filterValue = value.toLowerCase();
612
- return autocompleteModel.filter(option => {
613
- if ('options' in option) {
614
- return option.options.filter(condition => condition.label.toLowerCase().includes(filterValue));
615
- }
616
- return option.label.toLowerCase().includes(filterValue);
617
- });
618
- };
619
- const key1FilterValues = (values, value) => {
620
- const filterValue = value.toLowerCase();
621
- return values.filter(option => option.label.toLowerCase().includes(filterValue) || option.value.toLowerCase().includes(filterValue));
622
- };
623
-
624
- /*
625
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
626
- *
627
- * Licensed under the Apache License, Version 2.0 (the "License");
628
- * you may not use this file except in compliance with the License.
629
- * You may obtain a copy of the License at
630
- *
631
- * http://www.apache.org/licenses/LICENSE-2.0
632
- *
633
- * Unless required by applicable law or agreed to in writing, software
634
- * distributed under the License is distributed on an "AS IS" BASIS,
635
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
636
- * See the License for the specific language governing permissions and
637
- * limitations under the License.
638
- */
639
- class GioElEditorConditionGroupComponent {
640
- constructor() {
641
- /**
642
- * Conditions model to generate the fields for the conditions.
643
- */
644
- this.conditionsModel = [];
645
- /**
646
- * Level of the node in the tree. Useful for testing with Harness to limit the scope of the query.
647
- */
648
- this.nodeLvl = 0;
649
- this.remove = new EventEmitter();
650
- }
651
- addConditionGroup() {
652
- this.conditionGroupFormGroup.controls.conditions.push(newConditionGroupFormGroup$1(), { emitEvent: true });
653
- this.checkMultipleCondition();
654
- }
655
- addCondition() {
656
- this.conditionGroupFormGroup.controls.conditions.push(newConditionFormGroup());
657
- this.checkMultipleCondition();
658
- }
659
- removeCondition(conditionIndex) {
660
- this.conditionGroupFormGroup.controls.conditions.removeAt(conditionIndex);
661
- this.checkMultipleCondition();
662
- }
663
- removeConditionGroup() {
664
- this.remove.emit();
665
- this.checkMultipleCondition();
666
- }
667
- isConditionGroupForm(formGroup) {
668
- return 'condition' in formGroup.controls && 'conditions' in formGroup.controls;
669
- }
670
- checkMultipleCondition() {
671
- if (this.conditionGroupFormGroup.controls.conditions.length > 1) {
672
- this.conditionGroupFormGroup.controls.condition.enable();
673
- }
674
- else {
675
- this.conditionGroupFormGroup.controls.condition.disable();
676
- }
677
- }
678
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorConditionGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
679
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: GioElEditorConditionGroupComponent, isStandalone: true, selector: "gio-el-editor-condition-group", inputs: { conditionGroupFormGroup: "conditionGroupFormGroup", conditionsModel: "conditionsModel", 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 <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 [conditionsModel]=\"conditionsModel\"\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 <gio-el-field formControlName=\"field\" [conditionsModel]=\"conditionsModel\"></gio-el-field>\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;justify-content:center;gap:2px}.conditionGroup__conditions__condition{position:relative;display:flex;align-items:flex-start;padding:0 0 0 28px;gap:8px}.conditionGroup__conditions__condition__field{min-width:220px;max-width:440px;flex:auto}.conditionGroup__conditions__condition__removeBtn{align-self:center}.conditionGroup__conditions__condition:before{position:absolute;top:-8px;left:8px;width:1px;height:100%;border-left:2px dashed #a2a5b5;content:\"\"}.conditionGroup__conditions__condition:after{position:absolute;top:32px;left:8px;width:20px;border-top:2px dashed #a2a5b5;content:\"\"}.conditionGroup__conditions__condition:last-child:before{top:-8px;height:40px}.conditionGroup__conditions__conditionGroup{position:relative;display:block;padding:0 0 0 28px}.conditionGroup__conditions__conditionGroup:before{position:absolute;top:-8px;left:8px;width:1px;height:100%;border-left:2px dashed #a2a5b5;content:\"\"}.conditionGroup__conditions__conditionGroup:after{position:absolute;top:20px;left:8px;width:20px;border-top:2px dashed #a2a5b5;content:\"\"}.conditionGroup__conditions__conditionGroup:last-child:before{top:-8px;height:28px}\n"], dependencies: [{ kind: "component", type: GioElEditorConditionGroupComponent, selector: "gio-el-editor-condition-group", inputs: ["conditionGroupFormGroup", "conditionsModel", "nodeLvl"], outputs: ["remove"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatSelectModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.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: i4$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: i4$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: i5$2.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: i5$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i5$2.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: i6$1.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"] }, { kind: "component", type: GioElFieldComponent, selector: "gio-el-field", inputs: ["conditionsModel", "placeholder", "required"] }] }); }
680
- }
681
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorConditionGroupComponent, decorators: [{
682
- type: Component,
683
- args: [{ selector: 'gio-el-editor-condition-group', imports: [
684
- CommonModule,
685
- ReactiveFormsModule,
686
- MatFormFieldModule,
687
- MatSelectModule,
688
- MatButtonModule,
689
- MatButtonToggleModule,
690
- MatMenuModule,
691
- GioIconsModule,
692
- GioElEditorTypeBooleanComponent,
693
- GioElEditorTypeDateComponent,
694
- GioElEditorTypeStringComponent,
695
- GioElEditorTypeNumberComponent,
696
- GioElFieldComponent,
697
- ], 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 <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 [conditionsModel]=\"conditionsModel\"\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 <gio-el-field formControlName=\"field\" [conditionsModel]=\"conditionsModel\"></gio-el-field>\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;justify-content:center;gap:2px}.conditionGroup__conditions__condition{position:relative;display:flex;align-items:flex-start;padding:0 0 0 28px;gap:8px}.conditionGroup__conditions__condition__field{min-width:220px;max-width:440px;flex:auto}.conditionGroup__conditions__condition__removeBtn{align-self:center}.conditionGroup__conditions__condition:before{position:absolute;top:-8px;left:8px;width:1px;height:100%;border-left:2px dashed #a2a5b5;content:\"\"}.conditionGroup__conditions__condition:after{position:absolute;top:32px;left:8px;width:20px;border-top:2px dashed #a2a5b5;content:\"\"}.conditionGroup__conditions__condition:last-child:before{top:-8px;height:40px}.conditionGroup__conditions__conditionGroup{position:relative;display:block;padding:0 0 0 28px}.conditionGroup__conditions__conditionGroup:before{position:absolute;top:-8px;left:8px;width:1px;height:100%;border-left:2px dashed #a2a5b5;content:\"\"}.conditionGroup__conditions__conditionGroup:after{position:absolute;top:20px;left:8px;width:20px;border-top:2px dashed #a2a5b5;content:\"\"}.conditionGroup__conditions__conditionGroup:last-child:before{top:-8px;height:28px}\n"] }]
698
- }], propDecorators: { conditionGroupFormGroup: [{
699
- type: Input,
700
- args: [{
701
- required: true,
702
- }]
703
- }], conditionsModel: [{
704
- type: Input,
705
- args: [{
706
- required: true,
707
- }]
708
- }], nodeLvl: [{
709
- type: Input
710
- }, {
711
- type: HostBinding,
712
- args: ['attr.node-lvl']
713
- }], remove: [{
714
- type: Output
715
- }] } });
716
- const newConditionGroupFormGroup$1 = () => {
717
- return new FormGroup({
718
- condition: new FormControl({ value: 'AND', disabled: true }, { nonNullable: true, validators: Validators.required }),
719
- conditions: new FormArray([]),
720
- });
721
- };
722
- const newConditionFormGroup = () => {
723
- return new FormGroup({
724
- field: new FormControl(null),
725
- operator: new FormControl(null),
726
- value: new FormControl(null),
727
- });
728
- };
729
-
730
- /*
731
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
732
- *
733
- * Licensed under the Apache License, Version 2.0 (the "License");
734
- * you may not use this file except in compliance with the License.
735
- * You may obtain a copy of the License at
736
- *
737
- * http://www.apache.org/licenses/LICENSE-2.0
738
- *
739
- * Unless required by applicable law or agreed to in writing, software
740
- * distributed under the License is distributed on an "AS IS" BASIS,
741
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
742
- * See the License for the specific language governing permissions and
743
- * limitations under the License.
744
- */
745
- class GioElEditorComponent {
746
- constructor() {
747
- this.destroyRef = inject(DestroyRef);
748
- this.conditionsModel = [];
749
- this.elChange = new EventEmitter();
750
- this.conditionGroupFormGroup = newConditionGroupFormGroup();
751
- }
752
- ngOnInit() {
753
- this.conditionGroupFormGroup.valueChanges
754
- .pipe(takeUntilDestroyed(this.destroyRef), map(() => this.conditionGroupFormGroup.getRawValue()), map(value => {
755
- const toCondition = (conditionValue) => {
756
- if (isConditionGroupValue(conditionValue)) {
757
- return toConditionGroup(conditionValue);
758
- }
759
- if (!isConditionValue(conditionValue) ||
760
- isNil(conditionValue.field) ||
761
- isNil(conditionValue.operator) ||
762
- isNil(conditionValue.value)) {
763
- return null;
764
- }
765
- let field = conditionValue.field.field;
766
- if (conditionValue.field.map) {
767
- field = {
768
- field: conditionValue.field.field,
769
- key1Value: get(conditionValue.field.map, 'key1Value') ?? undefined,
770
- key2Value: get(conditionValue.field.map, 'key2Value') ?? undefined,
771
- };
772
- }
773
- return new Condition(field, conditionValue.field.type, conditionValue.operator, conditionValue.value);
774
- };
775
- const toConditionGroup = (conditionGroupValue) => {
776
- const conditions = [];
777
- if (!conditionGroupValue.condition || !conditionGroupValue.conditions || isEmpty(conditionGroupValue.conditions)) {
778
- return null;
779
- }
780
- for (const conditionValue of conditionGroupValue.conditions) {
781
- const condition = toCondition(conditionValue);
782
- if (condition) {
783
- conditions.push(condition);
784
- }
785
- }
786
- if (isEmpty(conditions)) {
787
- return null;
788
- }
789
- return new ConditionGroup(conditionGroupValue.condition, conditions);
790
- };
791
- const conditionGroupValue = toConditionGroup(value);
792
- if (conditionGroupValue) {
793
- this.elOutput = new ExpressionLanguageBuilder(conditionGroupValue).build();
794
- this.elChange.emit(this.elOutput);
795
- }
796
- }))
797
- .subscribe();
798
- }
799
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
800
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: GioElEditorComponent, isStandalone: true, selector: "gio-el-editor", inputs: { conditionsModel: "conditionsModel" }, outputs: { elChange: "elChange" }, 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 [conditionsModel]=\"conditionsModel\"\n></gio-el-editor-condition-group>\n\n@if (elOutput) {\n <div class=\"preview\">\n {{ elOutput }}\n </div>\n}\n", styles: ["@charset \"UTF-8\";.gio-top-bar-menu .gio-badge-accent{background-color:var(--gio-oem-palette--active, #e7e2fb);color:var(--gio-oem-palette--active-contrast, #100c27)}.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}.preview{display:flex;flex-direction:column;align-items:center;padding:8px;border-radius:4px;background-color:#e7e8ef;color:#000}\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", "conditionsModel", "nodeLvl"], outputs: ["remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
801
- }
802
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GioElEditorComponent, decorators: [{
803
- type: Component,
804
- args: [{ selector: 'gio-el-editor', imports: [
805
- CommonModule,
806
- MatButtonToggleModule,
807
- ReactiveFormsModule,
808
- MatButtonModule,
809
- GioIconsModule,
810
- MatMenuModule,
811
- MatFormFieldModule,
812
- MatInputModule,
813
- MatSelectModule,
814
- GioElEditorTypeStringComponent,
815
- GioElEditorTypeBooleanComponent,
816
- GioElEditorTypeNumberComponent,
817
- GioElEditorTypeDateComponent,
818
- GioElEditorConditionGroupComponent,
819
- ], 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 [conditionsModel]=\"conditionsModel\"\n></gio-el-editor-condition-group>\n\n@if (elOutput) {\n <div class=\"preview\">\n {{ elOutput }}\n </div>\n}\n", styles: ["@charset \"UTF-8\";.gio-top-bar-menu .gio-badge-accent{background-color:var(--gio-oem-palette--active, #e7e2fb);color:var(--gio-oem-palette--active-contrast, #100c27)}.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}.preview{display:flex;flex-direction:column;align-items:center;padding:8px;border-radius:4px;background-color:#e7e8ef;color:#000}\n"] }]
820
- }], propDecorators: { conditionsModel: [{
821
- type: Input,
822
- args: [{ required: true }]
823
- }], elChange: [{
824
- type: Output
825
- }] } });
826
- const newConditionGroupFormGroup = () => {
827
- return new FormGroup({
828
- condition: new FormControl({ value: 'AND', disabled: true }, { nonNullable: true, validators: Validators.required }),
829
- conditions: new FormArray([]),
830
- });
831
- };
832
- const isConditionGroupValue = (value) => {
833
- return !!value && has(value, 'condition') && has(value, 'conditions');
834
- };
835
- const isConditionValue = (value) => {
836
- return !!value && has(value, 'field') && has(value, 'operator') && has(value, 'value');
837
- };
838
-
839
- /*
840
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
841
- *
842
- * Licensed under the Apache License, Version 2.0 (the "License");
843
- * you may not use this file except in compliance with the License.
844
- * You may obtain a copy of the License at
845
- *
846
- * http://www.apache.org/licenses/LICENSE-2.0
847
- *
848
- * Unless required by applicable law or agreed to in writing, software
849
- * distributed under the License is distributed on an "AS IS" BASIS,
850
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
851
- * See the License for the specific language governing permissions and
852
- * limitations under the License.
853
- */
854
- class GioElEditorTypeComponentHarness extends ComponentHarness {
855
- constructor() {
856
- super(...arguments);
857
- this.getOperatorSelector = this.locatorFor(MatSelectHarness.with({ selector: '[formControlName="operator"]' }));
858
- }
859
- async getAvailableOperators() {
860
- const operatorSelector = await this.getOperatorSelector();
861
- await operatorSelector.open();
862
- const options = await operatorSelector.getOptions();
863
- return parallel(() => options.map(async (option) => await option.getText()));
864
- }
865
- async selectOperator(operator) {
866
- const operatorSelector = await this.getOperatorSelector();
867
- await operatorSelector.clickOptions({ text: operator });
868
- }
869
- async getOperatorValue() {
870
- const operatorSelector = await this.getOperatorSelector();
871
- return operatorSelector.getValueText();
872
- }
873
- }
874
-
875
- /*
876
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
877
- *
878
- * Licensed under the Apache License, Version 2.0 (the "License");
879
- * you may not use this file except in compliance with the License.
880
- * You may obtain a copy of the License at
881
- *
882
- * http://www.apache.org/licenses/LICENSE-2.0
883
- *
884
- * Unless required by applicable law or agreed to in writing, software
885
- * distributed under the License is distributed on an "AS IS" BASIS,
886
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
887
- * See the License for the specific language governing permissions and
888
- * limitations under the License.
889
- */
890
- class GioElEditorTypeBooleanHarness extends GioElEditorTypeComponentHarness {
891
- static { this.hostSelector = 'gio-el-editor-type-boolean'; }
892
- async getValue() {
893
- const slideToggleHarness = await this.locatorFor(MatSlideToggleHarness)();
894
- return await slideToggleHarness.isChecked();
895
- }
896
- async setValue(value) {
897
- const slideToggleHarness = await this.locatorFor(MatSlideToggleHarness)();
898
- if (value !== (await slideToggleHarness.isChecked())) {
899
- await slideToggleHarness.toggle();
900
- }
901
- }
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
- class GioElEditorTypeStringHarness extends GioElEditorTypeComponentHarness {
920
- static { this.hostSelector = 'gio-el-editor-type-string'; }
921
- async getValue() {
922
- const input = await this.locatorFor(MatInputHarness)();
923
- return await input.getValue();
924
- }
925
- async setValue(value) {
926
- const input = await this.locatorFor(MatInputHarness)();
927
- await input.setValue(value);
928
- }
929
- }
930
-
931
- /*
932
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
933
- *
934
- * Licensed under the Apache License, Version 2.0 (the "License");
935
- * you may not use this file except in compliance with the License.
936
- * You may obtain a copy of the License at
937
- *
938
- * http://www.apache.org/licenses/LICENSE-2.0
939
- *
940
- * Unless required by applicable law or agreed to in writing, software
941
- * distributed under the License is distributed on an "AS IS" BASIS,
942
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
943
- * See the License for the specific language governing permissions and
944
- * limitations under the License.
945
- */
946
- class GioElEditorTypeNumberHarness extends GioElEditorTypeComponentHarness {
947
- static { this.hostSelector = 'gio-el-editor-type-number'; }
948
- async getValue() {
949
- const input = await this.locatorFor(MatInputHarness)();
950
- return Number(await input.getValue());
951
- }
952
- async setValue(value) {
953
- const input = await this.locatorFor(MatInputHarness)();
954
- await input.setValue(value.toString());
955
- }
956
- }
957
-
958
- /*
959
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
960
- *
961
- * Licensed under the Apache License, Version 2.0 (the "License");
962
- * you may not use this file except in compliance with the License.
963
- * You may obtain a copy of the License at
964
- *
965
- * http://www.apache.org/licenses/LICENSE-2.0
966
- *
967
- * Unless required by applicable law or agreed to in writing, software
968
- * distributed under the License is distributed on an "AS IS" BASIS,
969
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
970
- * See the License for the specific language governing permissions and
971
- * limitations under the License.
972
- */
973
- class GioElEditorTypeDateHarness extends GioElEditorTypeComponentHarness {
974
- static { this.hostSelector = 'gio-el-editor-type-date'; }
975
- async getValue() {
976
- const datepickerInputHarness = await this.locatorFor(MatDatepickerInputHarness)();
977
- return await datepickerInputHarness.getValue();
978
- }
979
- async setValue(value) {
980
- const datepickerInputHarness = await this.locatorFor(MatDatepickerInputHarness)();
981
- await datepickerInputHarness.setValue(value.toISOString());
982
- }
983
- }
984
-
985
- /*
986
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
987
- *
988
- * Licensed under the Apache License, Version 2.0 (the "License");
989
- * you may not use this file except in compliance with the License.
990
- * You may obtain a copy of the License at
991
- *
992
- * http://www.apache.org/licenses/LICENSE-2.0
993
- *
994
- * Unless required by applicable law or agreed to in writing, software
995
- * distributed under the License is distributed on an "AS IS" BASIS,
996
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
997
- * See the License for the specific language governing permissions and
998
- * limitations under the License.
999
- */
1000
- class GioElFieldHarness extends ComponentHarness {
1001
- constructor() {
1002
- super(...arguments);
1003
- this.getAutocomplete = this.locatorFor(MatAutocompleteHarness.with({ selector: '.fieldSelect' }));
1004
- this.getKey1Input = this.locatorForOptional(MatInputHarness.with({ selector: '.key1' }));
1005
- this.getKey2Input = this.locatorForOptional(MatInputHarness.with({ selector: '.key2' }));
1006
- }
1007
- static { this.hostSelector = 'gio-el-field'; }
1008
- static with(options = {}) {
1009
- return new HarnessPredicate(GioElFieldHarness, options);
1010
- }
1011
- async setValue(field, key1, key2) {
1012
- const autocomplete = await this.getAutocomplete();
1013
- await autocomplete.focus();
1014
- await autocomplete.selectOption({ text: new RegExp(`${field}`) });
1015
- if (key1) {
1016
- const key1Input = await this.getKey1Input();
1017
- await key1Input?.setValue(key1);
1018
- }
1019
- if (key2) {
1020
- const key2Input = await this.getKey2Input();
1021
- await key2Input?.setValue(key2);
1022
- }
1023
- }
1024
- async getValue() {
1025
- const autocomplete = await this.getAutocomplete();
1026
- const field = await autocomplete.getValue();
1027
- const key1Input = await this.getKey1Input();
1028
- const key1 = await key1Input?.getValue();
1029
- const key2Input = await this.getKey2Input();
1030
- const key2 = await key2Input?.getValue();
1031
- return { field, key1, key2 };
1032
- }
1033
- }
1034
-
1035
- /*
1036
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
1037
- *
1038
- * Licensed under the Apache License, Version 2.0 (the "License");
1039
- * you may not use this file except in compliance with the License.
1040
- * You may obtain a copy of the License at
1041
- *
1042
- * http://www.apache.org/licenses/LICENSE-2.0
1043
- *
1044
- * Unless required by applicable law or agreed to in writing, software
1045
- * distributed under the License is distributed on an "AS IS" BASIS,
1046
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1047
- * See the License for the specific language governing permissions and
1048
- * limitations under the License.
1049
- */
1050
- class GioElEditorConditionGroupHarness extends ComponentHarness {
1051
- constructor() {
1052
- super(...arguments);
1053
- this.getNodeLvl = () => this.host().then(host => host.getAttribute('node-lvl'));
1054
- this.getAddMenuButton = this.locatorFor(MatMenuHarness.with({ triggerText: /Add/ }));
1055
- this.getConditionButtonToggleGroup = this.locatorFor(MatButtonToggleGroupHarness.with({ selector: '[formControlName="condition"]' }));
1056
- this.getConditionsHarness = async () => {
1057
- const nodeLvl = await this.getNodeLvl();
1058
- if (!nodeLvl) {
1059
- throw new Error('Node level not found');
1060
- }
1061
- return this.locatorForAll(DivHarness.with({
1062
- selector: `.conditionGroup__conditions__condition[node-lvl="${nodeLvl}"]`,
1063
- }), GioElEditorConditionGroupHarness.with({
1064
- selector: `.conditionGroup__conditions__conditionGroup[node-lvl="${Number(nodeLvl) + 1}"]`,
1065
- }))();
1066
- };
1067
- this.getConditionHarness = async (index) => (await this.getConditionsHarness()).at(index);
1068
- this.getConditionTypeHarness = (divHarness) => divHarness.childLocatorForOptional(GioElEditorTypeStringHarness, GioElEditorTypeBooleanHarness, GioElEditorTypeNumberHarness, GioElEditorTypeDateHarness)();
1069
- this.getConditionField = (divHarness) => divHarness.childLocatorFor(GioElFieldHarness.with({ selector: '[formControlName="field"]' }))();
1070
- }
1071
- static { this.hostSelector = 'gio-el-editor-condition-group'; }
1072
- static with(options = {}) {
1073
- return new HarnessPredicate(GioElEditorConditionGroupHarness, options);
1074
- }
1075
- async clickAddNewConditionButton() {
1076
- await (await this.getAddMenuButton()).clickItem({ text: /Add Condition/ });
1077
- }
1078
- async clickAddNewGroupButton() {
1079
- await (await this.getAddMenuButton()).clickItem({ text: /Add Group/ });
1080
- }
1081
- async getConditionValue() {
1082
- const conditionButtonToggleGroup = await this.getConditionButtonToggleGroup();
1083
- const selectedToggles = await conditionButtonToggleGroup.getToggles({ checked: true });
1084
- if (selectedToggles.length !== 1) {
1085
- throw new Error('No operator selected');
1086
- }
1087
- const andOrMap = {
1088
- AND: 'AND',
1089
- OR: 'OR',
1090
- };
1091
- return andOrMap[await selectedToggles[0].getText()];
1092
- }
1093
- async selectConditionValue(operator) {
1094
- const conditionButtonToggleGroup = await this.getConditionButtonToggleGroup();
1095
- const toggles = await conditionButtonToggleGroup.getToggles({ text: operator });
1096
- if (toggles.length !== 1) {
1097
- throw new Error('No operator selected');
1098
- }
1099
- return toggles[0].check();
1100
- }
1101
- async selectConditionField(index, field, key1, key2) {
1102
- const conditionDiv = await this.getConditionHarness(index);
1103
- if (!conditionDiv || !(conditionDiv instanceof DivHarness)) {
1104
- throw new Error(`Condition with index ${index} not found`);
1105
- }
1106
- const conditionField = await this.getConditionField(conditionDiv);
1107
- await conditionField.setValue(field, key1, key2);
1108
- }
1109
- async selectConditionOperator(index, operator) {
1110
- const conditionDiv = await this.getConditionHarness(index);
1111
- if (!conditionDiv || !(conditionDiv instanceof DivHarness)) {
1112
- throw new Error(`Condition with index ${index} not found`);
1113
- }
1114
- const conditionType = await this.getConditionTypeHarness(conditionDiv);
1115
- if (!conditionType) {
1116
- throw new Error(`Condition type not found. Select field first`);
1117
- }
1118
- await conditionType.selectOperator(operator);
1119
- }
1120
- async getConditionAvailableOperators(index) {
1121
- const conditionDiv = await this.getConditionHarness(index);
1122
- if (!conditionDiv || !(conditionDiv instanceof DivHarness)) {
1123
- throw new Error(`Condition with index ${index} not found`);
1124
- }
1125
- const conditionType = await this.getConditionTypeHarness(conditionDiv);
1126
- if (!conditionType) {
1127
- throw new Error(`Condition type not found. Select field first`);
1128
- }
1129
- return conditionType.getAvailableOperators();
1130
- }
1131
- async setConditionValue(index, value) {
1132
- const conditionDiv = await this.getConditionHarness(index);
1133
- if (!conditionDiv || !(conditionDiv instanceof DivHarness)) {
1134
- throw new Error(`Condition with index ${index} not found`);
1135
- }
1136
- const conditionType = await this.getConditionTypeHarness(conditionDiv);
1137
- if (!conditionType) {
1138
- throw new Error(`Condition type not found. Select field first`);
1139
- }
1140
- if (conditionType instanceof GioElEditorTypeStringHarness && typeof value === 'string') {
1141
- await conditionType.setValue(value);
1142
- }
1143
- else if (conditionType instanceof GioElEditorTypeBooleanHarness && typeof value === 'boolean') {
1144
- await conditionType.setValue(value);
1145
- }
1146
- else if (conditionType instanceof GioElEditorTypeNumberHarness && typeof value === 'number') {
1147
- await conditionType.setValue(value);
1148
- }
1149
- else if (conditionType instanceof GioElEditorTypeDateHarness && value instanceof Date) {
1150
- await conditionType.setValue(value);
1151
- }
1152
- else {
1153
- throw new Error(`Invalid value for condition type`);
1154
- }
1155
- }
1156
- async getConditionGroup(index) {
1157
- const conditionGroup = await this.getConditionHarness(index);
1158
- if (!conditionGroup || !(conditionGroup instanceof GioElEditorConditionGroupHarness)) {
1159
- throw new Error(`Condition group with index ${index} not found`);
1160
- }
1161
- return conditionGroup;
1162
- }
1163
- async getConditions() {
1164
- const getConditionsDiv = await this.getConditionsHarness();
1165
- const conditions = await parallel(() => getConditionsDiv.map(async (condition) => {
1166
- if (condition instanceof GioElEditorConditionGroupHarness) {
1167
- return await condition.getConditions();
1168
- }
1169
- const conditionField = await this.getConditionField(condition);
1170
- const conditionType = await this.getConditionTypeHarness(condition);
1171
- return {
1172
- field: await conditionField.getValue(),
1173
- operator: await conditionType?.getOperatorValue(),
1174
- value: await conditionType?.getValue(),
1175
- };
1176
- }));
1177
- return {
1178
- condition: await this.getConditionValue(),
1179
- conditions,
1180
- };
1181
- }
1182
- }
1183
-
1184
- /*
1185
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
1186
- *
1187
- * Licensed under the Apache License, Version 2.0 (the "License");
1188
- * you may not use this file except in compliance with the License.
1189
- * You may obtain a copy of the License at
1190
- *
1191
- * http://www.apache.org/licenses/LICENSE-2.0
1192
- *
1193
- * Unless required by applicable law or agreed to in writing, software
1194
- * distributed under the License is distributed on an "AS IS" BASIS,
1195
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1196
- * See the License for the specific language governing permissions and
1197
- * limitations under the License.
1198
- */
1199
- class GioElEditorHarness extends ComponentHarness {
1200
- constructor() {
1201
- super(...arguments);
1202
- this.getMainConditionGroup = this.locatorFor(GioElEditorConditionGroupHarness);
1203
- }
1204
- static { this.hostSelector = 'gio-el-editor'; }
1205
- static with(options = {}) {
1206
- return new HarnessPredicate(GioElEditorHarness, options);
1207
- }
1208
- }
1209
-
1210
- /*
1211
- * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
1212
- *
1213
- * Licensed under the Apache License, Version 2.0 (the "License");
1214
- * you may not use this file except in compliance with the License.
1215
- * You may obtain a copy of the License at
1216
- *
1217
- * http://www.apache.org/licenses/LICENSE-2.0
1218
- *
1219
- * Unless required by applicable law or agreed to in writing, software
1220
- * distributed under the License is distributed on an "AS IS" BASIS,
1221
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1222
- * See the License for the specific language governing permissions and
1223
- * limitations under the License.
1224
- */
1225
-
1226
114
  /*
1227
115
  * Copyright (C) 2024 The Gravitee team (http://gravitee.io)
1228
116
  *
@@ -1259,5 +147,5 @@ class GioElEditorHarness extends ComponentHarness {
1259
147
  * Generated bundle index. Do not edit.
1260
148
  */
1261
149
 
1262
- export { Condition, ExpressionLanguageBuilder, GioElEditorComponent, GioElEditorHarness, isConditionModel };
150
+ export { Condition, ExpressionLanguageBuilder };
1263
151
  //# sourceMappingURL=gravitee-ui-particles-angular-gio-el.mjs.map