@gravitee/ui-particles-angular 5.19.1 → 5.20.0-fix-json-schema-15570d2

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.
@@ -1,7 +1,7 @@
1
1
  import { trigger, transition, style, animate } from '@angular/animations';
2
2
  import * as i0 from '@angular/core';
3
3
  import { EventEmitter, Component, HostBinding, Input, Output, HostListener, NgModule, Optional, Self, ViewChild, Directive, Inject, forwardRef, ChangeDetectionStrategy, Injectable, ViewEncapsulation, ContentChildren, Host, ContentChild, InjectionToken } from '@angular/core';
4
- import { timer, Subject, fromEvent, of, BehaviorSubject, combineLatest, ReplaySubject } from 'rxjs';
4
+ import { timer, Subject, fromEvent, of, BehaviorSubject, merge, ReplaySubject } from 'rxjs';
5
5
  import * as i1 from '@angular/material/card';
6
6
  import { MatCardModule } from '@angular/material/card';
7
7
  import * as i2 from '@angular/material/button';
@@ -77,6 +77,8 @@ class GioSaveBarComponent {
77
77
  this.invalidState = false;
78
78
  this.creationMode = false;
79
79
  this.hasSubmitLock = true;
80
+ this.hideSubmitButton = false;
81
+ this.hideDiscardButton = false;
80
82
  this.resetClicked = new EventEmitter();
81
83
  this.submitted = new EventEmitter();
82
84
  this.submittedInvalidState = new EventEmitter();
@@ -120,7 +122,7 @@ class GioSaveBarComponent {
120
122
  }
121
123
  }
122
124
  GioSaveBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioSaveBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
123
- GioSaveBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioSaveBarComponent, selector: "gio-save-bar", inputs: { opened: "opened", invalidState: "invalidState", creationMode: "creationMode", form: "form", formInitialValues: "formInitialValues" }, outputs: { resetClicked: "resetClicked", submitted: "submitted", submittedInvalidState: "submittedInvalidState" }, host: { listeners: { "disable-submit-lock": "onDisableSubmitLock()" }, properties: { "class.save-bar-sticky": "this.isSticky", "class.is-open": "this.isOpen" } }, ngImport: i0, template: "<!--\n\n Copyright (C) 2015 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 *ngIf=\"isOpen\" [@slideUpDown] [@.disabled]=\"creationMode\">\n <mat-card class=\"save-bar__content\" [class.mat-elevation-z3]=\"creationMode\" [class.mat-elevation-z6]=\"!creationMode\">\n <div class=\"save-bar__content__label\">{{ creationMode ? '' : 'You have unsaved changes' }}</div>\n <div>\n <button *ngIf=\"!creationMode\" class=\"save-bar__content__reset-button\" mat-button type=\"button\" (click)=\"onResetClicked()\">\n Discard\n </button>\n <button\n class=\"save-bar__content__submit-button\"\n [class.invalid]=\"(form && form.invalid) || invalidState\"\n mat-flat-button\n color=\"primary\"\n [type]=\"form ? 'submit' : 'button'\"\n (click)=\"onSubmitClicked()\"\n >\n {{ creationMode ? 'Create' : 'Save' }}\n </button>\n </div>\n </mat-card>\n</div>\n", styles: [":host{z-index:1000;display:block;height:68px;margin-top:32px;visibility:hidden}:host.is-open{visibility:visible}:host(.save-bar-sticky){position:sticky;bottom:0;margin-right:-16px;margin-left:-16px}.save-bar__content{display:flex;height:100%;align-items:center;justify-content:space-between;padding:16px 24px}.save-bar__content__label{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.save-bar__content__reset-button{margin-right:16px}.save-bar__content__submit-button.invalid{background-color:#d6ffff;color:#000}.save-bar__content__submit-button.invalid:hover:enabled{background-color:#099;color:#fff}\n"], components: [{ type: i1.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [
125
+ GioSaveBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioSaveBarComponent, selector: "gio-save-bar", inputs: { opened: "opened", invalidState: "invalidState", creationMode: "creationMode", form: "form", formInitialValues: "formInitialValues", hideSubmitButton: "hideSubmitButton", hideDiscardButton: "hideDiscardButton" }, outputs: { resetClicked: "resetClicked", submitted: "submitted", submittedInvalidState: "submittedInvalidState" }, host: { listeners: { "disable-submit-lock": "onDisableSubmitLock()" }, properties: { "class.save-bar-sticky": "this.isSticky", "class.is-open": "this.isOpen" } }, ngImport: i0, template: "<!--\n\n Copyright (C) 2015 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 *ngIf=\"isOpen\" [@slideUpDown] [@.disabled]=\"creationMode\">\n <mat-card class=\"save-bar__content\" [class.mat-elevation-z3]=\"creationMode\" [class.mat-elevation-z6]=\"!creationMode\">\n <div class=\"save-bar__content__label\">{{ creationMode ? '' : 'You have unsaved changes' }}</div>\n <div class=\"save-bar__content__actions\">\n <button\n *ngIf=\"!creationMode && !hideDiscardButton\"\n class=\"save-bar__content__actions__reset-button\"\n mat-button\n type=\"button\"\n (click)=\"onResetClicked()\"\n >\n Discard\n </button>\n <ng-content></ng-content>\n <button\n *ngIf=\"!hideSubmitButton\"\n class=\"save-bar__content__actions__submit-button\"\n [class.invalid]=\"(form && form.invalid) || invalidState\"\n mat-flat-button\n color=\"primary\"\n [type]=\"form ? 'submit' : 'button'\"\n (click)=\"onSubmitClicked()\"\n >\n {{ creationMode ? 'Create' : 'Save' }}\n </button>\n </div>\n </mat-card>\n</div>\n", styles: [":host{z-index:1000;display:block;height:68px;margin-top:32px;visibility:hidden}:host.is-open{visibility:visible}:host(.save-bar-sticky){position:sticky;bottom:0;margin-right:-16px;margin-left:-16px}.save-bar__content{display:flex;height:100%;align-items:center;justify-content:space-between;padding:16px 24px}.save-bar__content__label{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.save-bar__content__actions{display:flex;gap:16px}.save-bar__content__actions__submit-button.invalid{background-color:#d6ffff;color:#000}.save-bar__content__actions__submit-button.invalid:hover:enabled{background-color:#099;color:#fff}\n"], components: [{ type: i1.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [
124
126
  trigger('slideUpDown', [
125
127
  transition(':enter', [
126
128
  style({ transform: 'translateY(40vh)', opacity: '0' }),
@@ -145,7 +147,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
145
147
  animate('300ms cubic-bezier(0.4, 0.0, 0.2, 1)', style({ transform: 'translateY(40vh)', opacity: '0' })),
146
148
  ]),
147
149
  ]),
148
- ], template: "<!--\n\n Copyright (C) 2015 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 *ngIf=\"isOpen\" [@slideUpDown] [@.disabled]=\"creationMode\">\n <mat-card class=\"save-bar__content\" [class.mat-elevation-z3]=\"creationMode\" [class.mat-elevation-z6]=\"!creationMode\">\n <div class=\"save-bar__content__label\">{{ creationMode ? '' : 'You have unsaved changes' }}</div>\n <div>\n <button *ngIf=\"!creationMode\" class=\"save-bar__content__reset-button\" mat-button type=\"button\" (click)=\"onResetClicked()\">\n Discard\n </button>\n <button\n class=\"save-bar__content__submit-button\"\n [class.invalid]=\"(form && form.invalid) || invalidState\"\n mat-flat-button\n color=\"primary\"\n [type]=\"form ? 'submit' : 'button'\"\n (click)=\"onSubmitClicked()\"\n >\n {{ creationMode ? 'Create' : 'Save' }}\n </button>\n </div>\n </mat-card>\n</div>\n", styles: [":host{z-index:1000;display:block;height:68px;margin-top:32px;visibility:hidden}:host.is-open{visibility:visible}:host(.save-bar-sticky){position:sticky;bottom:0;margin-right:-16px;margin-left:-16px}.save-bar__content{display:flex;height:100%;align-items:center;justify-content:space-between;padding:16px 24px}.save-bar__content__label{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.save-bar__content__reset-button{margin-right:16px}.save-bar__content__submit-button.invalid{background-color:#d6ffff;color:#000}.save-bar__content__submit-button.invalid:hover:enabled{background-color:#099;color:#fff}\n"] }]
150
+ ], template: "<!--\n\n Copyright (C) 2015 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 *ngIf=\"isOpen\" [@slideUpDown] [@.disabled]=\"creationMode\">\n <mat-card class=\"save-bar__content\" [class.mat-elevation-z3]=\"creationMode\" [class.mat-elevation-z6]=\"!creationMode\">\n <div class=\"save-bar__content__label\">{{ creationMode ? '' : 'You have unsaved changes' }}</div>\n <div class=\"save-bar__content__actions\">\n <button\n *ngIf=\"!creationMode && !hideDiscardButton\"\n class=\"save-bar__content__actions__reset-button\"\n mat-button\n type=\"button\"\n (click)=\"onResetClicked()\"\n >\n Discard\n </button>\n <ng-content></ng-content>\n <button\n *ngIf=\"!hideSubmitButton\"\n class=\"save-bar__content__actions__submit-button\"\n [class.invalid]=\"(form && form.invalid) || invalidState\"\n mat-flat-button\n color=\"primary\"\n [type]=\"form ? 'submit' : 'button'\"\n (click)=\"onSubmitClicked()\"\n >\n {{ creationMode ? 'Create' : 'Save' }}\n </button>\n </div>\n </mat-card>\n</div>\n", styles: [":host{z-index:1000;display:block;height:68px;margin-top:32px;visibility:hidden}:host.is-open{visibility:visible}:host(.save-bar-sticky){position:sticky;bottom:0;margin-right:-16px;margin-left:-16px}.save-bar__content{display:flex;height:100%;align-items:center;justify-content:space-between;padding:16px 24px}.save-bar__content__label{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.save-bar__content__actions{display:flex;gap:16px}.save-bar__content__actions__submit-button.invalid{background-color:#d6ffff;color:#000}.save-bar__content__actions__submit-button.invalid:hover:enabled{background-color:#099;color:#fff}\n"] }]
149
151
  }], propDecorators: { isSticky: [{
150
152
  type: HostBinding,
151
153
  args: ['class.save-bar-sticky']
@@ -159,6 +161,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
159
161
  type: Input
160
162
  }], formInitialValues: [{
161
163
  type: Input
164
+ }], hideSubmitButton: [{
165
+ type: Input
166
+ }], hideDiscardButton: [{
167
+ type: Input
162
168
  }], resetClicked: [{
163
169
  type: Output
164
170
  }], submitted: [{
@@ -220,14 +226,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
220
226
  class GioSaveBarHarness extends ComponentHarness {
221
227
  constructor() {
222
228
  super(...arguments);
223
- this.resetButtonSelector = '.save-bar__content__reset-button';
224
- this.submitButtonSelector = '.save-bar__content__submit-button';
229
+ this.cardSelector = '.save-bar__content';
230
+ this.resetButtonSelector = '.save-bar__content__actions__reset-button';
231
+ this.submitButtonSelector = '.save-bar__content__actions__submit-button';
225
232
  this.getSubmitButton = this.locatorFor(this.submitButtonSelector);
226
233
  this.getResetButton = this.locatorFor(this.resetButtonSelector);
227
234
  }
228
235
  async isVisible() {
229
- const submitButton = await this.locatorForOptional(this.submitButtonSelector)();
230
- return submitButton !== null;
236
+ const card = await this.locatorForOptional(this.cardSelector)();
237
+ return card !== null;
231
238
  }
232
239
  async clickSubmit() {
233
240
  const host = await this.host();
@@ -239,6 +246,10 @@ class GioSaveBarHarness extends ComponentHarness {
239
246
  const submitButton = await this.getSubmitButton();
240
247
  return submitButton.hasClass('invalid');
241
248
  }
249
+ async isSubmitButtonVisible() {
250
+ const submitButton = await this.locatorForOptional(this.submitButtonSelector)();
251
+ return submitButton !== null;
252
+ }
242
253
  async isResetButtonVisible() {
243
254
  const submitButton = await this.locatorForOptional(this.resetButtonSelector)();
244
255
  return submitButton !== null;
@@ -2773,6 +2784,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
2773
2784
  * limitations under the License.
2774
2785
  */
2775
2786
 
2787
+ /*
2788
+ * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
2789
+ *
2790
+ * Licensed under the Apache License, Version 2.0 (the "License");
2791
+ * you may not use this file except in compliance with the License.
2792
+ * You may obtain a copy of the License at
2793
+ *
2794
+ * http://www.apache.org/licenses/LICENSE-2.0
2795
+ *
2796
+ * Unless required by applicable law or agreed to in writing, software
2797
+ * distributed under the License is distributed on an "AS IS" BASIS,
2798
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2799
+ * See the License for the specific language governing permissions and
2800
+ * limitations under the License.
2801
+ */
2802
+ const GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR = 'gioFormFocusInvalidIgnore';
2803
+ class GioFormFocusInvalidIgnoreDirective {
2804
+ }
2805
+ GioFormFocusInvalidIgnoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidIgnoreDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2806
+ GioFormFocusInvalidIgnoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFocusInvalidIgnoreDirective, selector: "[gioFormFocusInvalidIgnore]", ngImport: i0 });
2807
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidIgnoreDirective, decorators: [{
2808
+ type: Directive,
2809
+ args: [{
2810
+ // eslint-disable-next-line @angular-eslint/directive-selector
2811
+ selector: `[${GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR}]`,
2812
+ }]
2813
+ }] });
2814
+
2776
2815
  /*
2777
2816
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
2778
2817
  *
@@ -2866,12 +2905,14 @@ const getBannerProperties = (banner) => {
2866
2905
  * limitations under the License.
2867
2906
  */
2868
2907
  class GioFormJsonSchemaComponent {
2869
- constructor(gioFormlyJsonSchema, elRef, fm, ngControl) {
2908
+ constructor(gioFormlyJsonSchema, elRef, fm, changeDetectorRef, ngControl) {
2870
2909
  this.gioFormlyJsonSchema = gioFormlyJsonSchema;
2871
2910
  this.elRef = elRef;
2872
2911
  this.fm = fm;
2912
+ this.changeDetectorRef = changeDetectorRef;
2873
2913
  this.ngControl = ngControl;
2874
2914
  this.unsubscribe$ = new Subject();
2915
+ this.gioFormFocusInvalidIgnore = true;
2875
2916
  this.formGroup = new FormGroup({});
2876
2917
  this.options = {};
2877
2918
  this.model = {};
@@ -2904,7 +2945,25 @@ class GioFormJsonSchemaComponent {
2904
2945
  }
2905
2946
  }
2906
2947
  ngOnInit() {
2907
- // When the parent form is touched, mark all the sub formGroup as touched ony once
2948
+ // Subscribe to state changes to manage touches, status and value
2949
+ this.stateChanges$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2950
+ const { status, value, touched } = this.formGroup;
2951
+ if (touched) {
2952
+ this._onTouched();
2953
+ this.touched = true;
2954
+ }
2955
+ if (this.touched) {
2956
+ this._onChange(value);
2957
+ }
2958
+ if (status === 'VALID') {
2959
+ this.ngControl?.control?.setErrors(null);
2960
+ }
2961
+ if (status === 'INVALID') {
2962
+ this.ngControl?.control?.setErrors({ invalid: true });
2963
+ }
2964
+ this.changeDetectorRef.detectChanges();
2965
+ });
2966
+ // When the parent form is touched, mark all the sub formGroup as touched if not already touched
2908
2967
  const parentControl = this.ngControl?.control?.parent;
2909
2968
  parentControl?.statusChanges
2910
2969
  ?.pipe(takeUntil(this.unsubscribe$), map(() => parentControl?.touched), filter(touched => touched === true), distinctUntilChanged())
@@ -2912,31 +2971,15 @@ class GioFormJsonSchemaComponent {
2912
2971
  this.formGroup.markAllAsTouched();
2913
2972
  this.stateChanges$.next();
2914
2973
  });
2915
- // To simulate the behavior of classic form controls, emit value only when the form is touched
2916
- // Allow to keep the formControl pristine until the user interact with it
2917
- combineLatest([this.formGroup.statusChanges, this.formGroup.valueChanges])
2918
- .pipe(takeUntil(this.unsubscribe$),
2919
2974
  // Group all valueChanges events emit by formly in a single one
2920
- debounceTime(100))
2975
+ merge(this.formGroup.statusChanges, this.formGroup.valueChanges)
2976
+ .pipe(takeUntil(this.unsubscribe$), debounceTime(100))
2921
2977
  .subscribe(() => {
2922
2978
  this.stateChanges$.next();
2923
2979
  });
2924
- this.stateChanges$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2925
- const { status, value, touched } = this.formGroup;
2926
- if (touched) {
2927
- this._onTouched();
2928
- this.touched = true;
2929
- }
2930
- if (this.touched) {
2931
- this._onChange(value);
2932
- if (status === 'VALID') {
2933
- this.ngControl?.control?.setErrors(null);
2934
- }
2935
- if (status === 'INVALID') {
2936
- this.ngControl?.control?.setErrors({ invalid: true });
2937
- }
2938
- }
2939
- });
2980
+ }
2981
+ ngAfterViewInit() {
2982
+ this.stateChanges$.next();
2940
2983
  }
2941
2984
  ngOnDestroy() {
2942
2985
  this.unsubscribe$.next();
@@ -2960,16 +3003,19 @@ class GioFormJsonSchemaComponent {
2960
3003
  throw new Error('Method not implemented.');
2961
3004
  }
2962
3005
  }
2963
- GioFormJsonSchemaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, deps: [{ token: GioFormlyJsonSchemaService }, { token: i0.ElementRef }, { token: i2$2.FocusMonitor }, { token: i7.NgControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2964
- GioFormJsonSchemaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormJsonSchemaComponent, selector: "gio-form-json-schema", inputs: { jsonSchema: "jsonSchema", options: "options" }, ngImport: i0, template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, isInline: true, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"], components: [{ type: i1$4.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
3006
+ GioFormJsonSchemaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, deps: [{ token: GioFormlyJsonSchemaService }, { token: i0.ElementRef }, { token: i2$2.FocusMonitor }, { token: i0.ChangeDetectorRef }, { token: i7.NgControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
3007
+ GioFormJsonSchemaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormJsonSchemaComponent, selector: "gio-form-json-schema", inputs: { jsonSchema: "jsonSchema", options: "options" }, host: { properties: { "attr.gioFormFocusInvalidIgnore": "this.gioFormFocusInvalidIgnore" } }, ngImport: i0, template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, isInline: true, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"], components: [{ type: i1$4.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2965
3008
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, decorators: [{
2966
3009
  type: Component,
2967
3010
  args: [{ selector: 'gio-form-json-schema', template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"] }]
2968
- }], ctorParameters: function () { return [{ type: GioFormlyJsonSchemaService }, { type: i0.ElementRef }, { type: i2$2.FocusMonitor }, { type: i7.NgControl, decorators: [{
3011
+ }], ctorParameters: function () { return [{ type: GioFormlyJsonSchemaService }, { type: i0.ElementRef }, { type: i2$2.FocusMonitor }, { type: i0.ChangeDetectorRef }, { type: i7.NgControl, decorators: [{
2969
3012
  type: Host
2970
3013
  }, {
2971
3014
  type: Optional
2972
- }] }]; }, propDecorators: { jsonSchema: [{
3015
+ }] }]; }, propDecorators: { gioFormFocusInvalidIgnore: [{
3016
+ type: HostBinding,
3017
+ args: [`attr.${GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR}`]
3018
+ }], jsonSchema: [{
2973
3019
  type: Input
2974
3020
  }], options: [{
2975
3021
  type: Input
@@ -3793,12 +3839,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3793
3839
  * See the License for the specific language governing permissions and
3794
3840
  * limitations under the License.
3795
3841
  */
3796
- class GioFormFocusInvalidDirective {
3797
- constructor(renderer, formGroupDirective) {
3798
- this.renderer = renderer;
3842
+ class GioBaseFormFocusInvalidDirective {
3843
+ constructor(hostElement, formGroupDirective) {
3844
+ this.hostElement = hostElement;
3799
3845
  this.formGroupDirective = formGroupDirective;
3800
3846
  }
3801
- onFormSubmit() {
3847
+ focusOnFirstInvalid() {
3802
3848
  const selector = '.ng-invalid[formControlName],input.ng-invalid,mat-select.ng-invalid,textarea.ng-invalid,.gio-ng-invalid';
3803
3849
  try {
3804
3850
  // Mark all controls as touched to display errors
@@ -3806,11 +3852,9 @@ class GioFormFocusInvalidDirective {
3806
3852
  this.formGroupDirective.control.markAllAsTouched();
3807
3853
  this.formGroupDirective.control.updateValueAndValidity();
3808
3854
  }
3809
- let invalidControl = this.renderer.selectRootElement(selector, true);
3810
- // If the form is a GioFormJsonSchema, we need to focus the first invalid control inside
3811
- if (invalidControl.tagName === 'GIO-FORM-JSON-SCHEMA') {
3812
- invalidControl = invalidControl.querySelector(selector);
3813
- }
3855
+ const parentForm = this.hostElement.nativeElement.closest('form');
3856
+ const invalidFieldElements = parentForm?.querySelectorAll(selector);
3857
+ const invalidControl = this.getFirstInvalidControl(invalidFieldElements);
3814
3858
  if (invalidControl) {
3815
3859
  invalidControl.scrollIntoView({ behavior: 'smooth', block: 'center' });
3816
3860
  invalidControl.focus({ preventScroll: true });
@@ -3821,20 +3865,54 @@ class GioFormFocusInvalidDirective {
3821
3865
  // 🧪 Useful to avoid som error in tests
3822
3866
  }
3823
3867
  }
3868
+ getFirstInvalidControl(invalidFieldElements, index = 0) {
3869
+ let invalidControl = invalidFieldElements?.item(index);
3870
+ const hasIgnoreAttribute = invalidControl?.attributes?.getNamedItem(GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR);
3871
+ if (hasIgnoreAttribute) {
3872
+ invalidControl = this.getFirstInvalidControl(invalidFieldElements, index + 1);
3873
+ }
3874
+ return invalidControl;
3875
+ }
3876
+ }
3877
+ GioBaseFormFocusInvalidDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBaseFormFocusInvalidDirective, deps: [{ token: i0.ElementRef }, { token: i7.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
3878
+ GioBaseFormFocusInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioBaseFormFocusInvalidDirective, ngImport: i0 });
3879
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBaseFormFocusInvalidDirective, decorators: [{
3880
+ type: Directive
3881
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i7.FormGroupDirective, decorators: [{
3882
+ type: Optional
3883
+ }] }]; } });
3884
+ class GioFormFocusInvalidFormDirective extends GioBaseFormFocusInvalidDirective {
3885
+ onFormSubmit() {
3886
+ this.focusOnFirstInvalid();
3887
+ }
3824
3888
  }
3825
- GioFormFocusInvalidDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidDirective, deps: [{ token: i0.Renderer2 }, { token: i7.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
3826
- GioFormFocusInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFocusInvalidDirective, selector: "form[gioFormFocusInvalid]", host: { listeners: { "submit": "onFormSubmit()" } }, ngImport: i0 });
3827
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidDirective, decorators: [{
3889
+ GioFormFocusInvalidFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
3890
+ GioFormFocusInvalidFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFocusInvalidFormDirective, selector: "form[gioFormFocusInvalid]", host: { listeners: { "submit": "onFormSubmit()" } }, usesInheritance: true, ngImport: i0 });
3891
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, decorators: [{
3828
3892
  type: Directive,
3829
3893
  args: [{
3830
3894
  selector: 'form[gioFormFocusInvalid]',
3831
3895
  }]
3832
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i7.FormGroupDirective, decorators: [{
3833
- type: Optional
3834
- }] }]; }, propDecorators: { onFormSubmit: [{
3896
+ }], propDecorators: { onFormSubmit: [{
3835
3897
  type: HostListener,
3836
3898
  args: ['submit']
3837
3899
  }] } });
3900
+ class GioButtonFocusInvalidButtonDirective extends GioBaseFormFocusInvalidDirective {
3901
+ onClick() {
3902
+ this.focusOnFirstInvalid();
3903
+ }
3904
+ }
3905
+ GioButtonFocusInvalidButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
3906
+ GioButtonFocusInvalidButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioButtonFocusInvalidButtonDirective, selector: "button[gioFormFocusInvalid]", host: { listeners: { "click": "onClick()" } }, usesInheritance: true, ngImport: i0 });
3907
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, decorators: [{
3908
+ type: Directive,
3909
+ args: [{
3910
+ selector: 'button[gioFormFocusInvalid]',
3911
+ }]
3912
+ }], propDecorators: { onClick: [{
3913
+ type: HostListener,
3914
+ args: ['click']
3915
+ }] } });
3838
3916
 
3839
3917
  /*
3840
3918
  * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
@@ -3854,13 +3932,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3854
3932
  class GioFormFocusInvalidModule {
3855
3933
  }
3856
3934
  GioFormFocusInvalidModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3857
- GioFormFocusInvalidModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, declarations: [GioFormFocusInvalidDirective], exports: [GioFormFocusInvalidDirective] });
3935
+ GioFormFocusInvalidModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, declarations: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective], exports: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective] });
3858
3936
  GioFormFocusInvalidModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule });
3859
3937
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, decorators: [{
3860
3938
  type: NgModule,
3861
3939
  args: [{
3862
- declarations: [GioFormFocusInvalidDirective],
3863
- exports: [GioFormFocusInvalidDirective],
3940
+ declarations: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
3941
+ exports: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
3864
3942
  }]
3865
3943
  }] });
3866
3944
 
@@ -4422,5 +4500,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
4422
4500
  * Generated bundle index. Do not edit.
4423
4501
  */
4424
4502
 
4425
- export { GioAvatarComponent, GioAvatarModule, GioBannerActionDirective, GioBannerBodyDirective, GioBannerComponent, GioBannerErrorComponent, GioBannerInfoComponent, GioBannerModule, GioBannerSuccessComponent, GioBannerWarningComponent, GioBreadcrumbComponent, GioBreadcrumbItemDirective, GioBreadcrumbModule, GioConfirmAndValidateDialogComponent, GioConfirmAndValidateDialogHarness, GioConfirmAndValidateDialogModule, GioConfirmDialogComponent, GioConfirmDialogHarness, GioConfirmDialogModule, GioFormFilePickerAddButtonComponent, GioFormFilePickerComponent, GioFormFilePickerEmptyComponent, GioFormFilePickerInputHarness, GioFormFilePickerLabelComponent, GioFormFilePickerModule, GioFormFocusInvalidDirective, GioFormFocusInvalidModule, GioFormHeadersComponent, GioFormHeadersHarness, GioFormHeadersModule, GioFormJsonSchemaComponent, GioFormJsonSchemaModule, GioFormLabelComponent, GioFormPrefixDirective, GioFormSlideToggleComponent, GioFormSlideToggleDirective, GioFormSlideToggleModule, GioFormTagsInputComponent, GioFormTagsInputHarness, GioFormTagsInputModule, GioIconsModule, GioLoaderComponent, GioLoaderModule, GioMatConfigModule, GioMenuComponent, GioMenuFooterComponent, GioMenuHeaderComponent, GioMenuItemComponent, GioMenuListComponent, GioMenuModule, GioMenuSelectorComponent, GioMenuSelectorHarness, GioMenuService, GioMonacoEditorComponent, GioMonacoEditorHarness, GioMonacoEditorModule, GioSaveBarComponent, GioSaveBarHarness, GioSaveBarModule, GioSubmenuComponent, GioSubmenuGroupComponent, GioSubmenuItemComponent, GioSubmenuModule, GioSubmenuTitleDirective, GioTopBarComponent, GioTopBarContentComponent, GioTopBarLinkComponent, GioTopBarLinkModule, GioTopBarMenuComponent, GioTopBarMenuModule, GioTopBarModule, NewFile };
4503
+ export { GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR, GioAvatarComponent, GioAvatarModule, GioBannerActionDirective, GioBannerBodyDirective, GioBannerComponent, GioBannerErrorComponent, GioBannerInfoComponent, GioBannerModule, GioBannerSuccessComponent, GioBannerWarningComponent, GioBaseFormFocusInvalidDirective, GioBreadcrumbComponent, GioBreadcrumbItemDirective, GioBreadcrumbModule, GioButtonFocusInvalidButtonDirective, GioConfirmAndValidateDialogComponent, GioConfirmAndValidateDialogHarness, GioConfirmAndValidateDialogModule, GioConfirmDialogComponent, GioConfirmDialogHarness, GioConfirmDialogModule, GioFormFilePickerAddButtonComponent, GioFormFilePickerComponent, GioFormFilePickerEmptyComponent, GioFormFilePickerInputHarness, GioFormFilePickerLabelComponent, GioFormFilePickerModule, GioFormFocusInvalidFormDirective, GioFormFocusInvalidIgnoreDirective, GioFormFocusInvalidModule, GioFormHeadersComponent, GioFormHeadersHarness, GioFormHeadersModule, GioFormJsonSchemaComponent, GioFormJsonSchemaModule, GioFormLabelComponent, GioFormPrefixDirective, GioFormSlideToggleComponent, GioFormSlideToggleDirective, GioFormSlideToggleModule, GioFormTagsInputComponent, GioFormTagsInputHarness, GioFormTagsInputModule, GioIconsModule, GioLoaderComponent, GioLoaderModule, GioMatConfigModule, GioMenuComponent, GioMenuFooterComponent, GioMenuHeaderComponent, GioMenuItemComponent, GioMenuListComponent, GioMenuModule, GioMenuSelectorComponent, GioMenuSelectorHarness, GioMenuService, GioMonacoEditorComponent, GioMonacoEditorHarness, GioMonacoEditorModule, GioSaveBarComponent, GioSaveBarHarness, GioSaveBarModule, GioSubmenuComponent, GioSubmenuGroupComponent, GioSubmenuItemComponent, GioSubmenuModule, GioSubmenuTitleDirective, GioTopBarComponent, GioTopBarContentComponent, GioTopBarLinkComponent, GioTopBarLinkModule, GioTopBarMenuComponent, GioTopBarMenuModule, GioTopBarModule, NewFile };
4426
4504
  //# sourceMappingURL=gravitee-ui-particles-angular.mjs.map