@gravitee/ui-particles-angular 5.19.1 → 5.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,6 +78,8 @@ class GioSaveBarComponent {
78
78
  this.invalidState = false;
79
79
  this.creationMode = false;
80
80
  this.hasSubmitLock = true;
81
+ this.hideSubmitButton = false;
82
+ this.hideDiscardButton = false;
81
83
  this.resetClicked = new EventEmitter();
82
84
  this.submitted = new EventEmitter();
83
85
  this.submittedInvalidState = new EventEmitter();
@@ -122,7 +124,7 @@ class GioSaveBarComponent {
122
124
  }
123
125
  }
124
126
  GioSaveBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioSaveBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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" }, 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: [
127
+ 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: [
126
128
  trigger('slideUpDown', [
127
129
  transition(':enter', [
128
130
  style({ transform: 'translateY(40vh)', opacity: '0' }),
@@ -147,7 +149,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
147
149
  animate('300ms cubic-bezier(0.4, 0.0, 0.2, 1)', style({ transform: 'translateY(40vh)', opacity: '0' })),
148
150
  ]),
149
151
  ]),
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>\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"] }]
152
+ ], 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"] }]
151
153
  }], propDecorators: { isSticky: [{
152
154
  type: HostBinding,
153
155
  args: ['class.save-bar-sticky']
@@ -161,6 +163,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
161
163
  type: Input
162
164
  }], formInitialValues: [{
163
165
  type: Input
166
+ }], hideSubmitButton: [{
167
+ type: Input
168
+ }], hideDiscardButton: [{
169
+ type: Input
164
170
  }], resetClicked: [{
165
171
  type: Output
166
172
  }], submitted: [{
@@ -207,15 +213,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
207
213
  class GioSaveBarHarness extends ComponentHarness {
208
214
  constructor() {
209
215
  super(...arguments);
210
- this.resetButtonSelector = '.save-bar__content__reset-button';
211
- this.submitButtonSelector = '.save-bar__content__submit-button';
216
+ this.cardSelector = '.save-bar__content';
217
+ this.resetButtonSelector = '.save-bar__content__actions__reset-button';
218
+ this.submitButtonSelector = '.save-bar__content__actions__submit-button';
212
219
  this.getSubmitButton = this.locatorFor(this.submitButtonSelector);
213
220
  this.getResetButton = this.locatorFor(this.resetButtonSelector);
214
221
  }
215
222
  isVisible() {
216
223
  return __awaiter(this, void 0, void 0, function* () {
217
- const submitButton = yield this.locatorForOptional(this.submitButtonSelector)();
218
- return submitButton !== null;
224
+ const card = yield this.locatorForOptional(this.cardSelector)();
225
+ return card !== null;
219
226
  });
220
227
  }
221
228
  clickSubmit() {
@@ -232,6 +239,12 @@ class GioSaveBarHarness extends ComponentHarness {
232
239
  return submitButton.hasClass('invalid');
233
240
  });
234
241
  }
242
+ isSubmitButtonVisible() {
243
+ return __awaiter(this, void 0, void 0, function* () {
244
+ const submitButton = yield this.locatorForOptional(this.submitButtonSelector)();
245
+ return submitButton !== null;
246
+ });
247
+ }
235
248
  isResetButtonVisible() {
236
249
  return __awaiter(this, void 0, void 0, function* () {
237
250
  const submitButton = yield this.locatorForOptional(this.resetButtonSelector)();
@@ -2738,6 +2751,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
2738
2751
  * limitations under the License.
2739
2752
  */
2740
2753
 
2754
+ /*
2755
+ * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
2756
+ *
2757
+ * Licensed under the Apache License, Version 2.0 (the "License");
2758
+ * you may not use this file except in compliance with the License.
2759
+ * You may obtain a copy of the License at
2760
+ *
2761
+ * http://www.apache.org/licenses/LICENSE-2.0
2762
+ *
2763
+ * Unless required by applicable law or agreed to in writing, software
2764
+ * distributed under the License is distributed on an "AS IS" BASIS,
2765
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2766
+ * See the License for the specific language governing permissions and
2767
+ * limitations under the License.
2768
+ */
2769
+ const GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR = 'gioFormFocusInvalidIgnore';
2770
+ class GioFormFocusInvalidIgnoreDirective {
2771
+ }
2772
+ GioFormFocusInvalidIgnoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidIgnoreDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2773
+ GioFormFocusInvalidIgnoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFocusInvalidIgnoreDirective, selector: "[gioFormFocusInvalidIgnore]", ngImport: i0 });
2774
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidIgnoreDirective, decorators: [{
2775
+ type: Directive,
2776
+ args: [{
2777
+ // eslint-disable-next-line @angular-eslint/directive-selector
2778
+ selector: `[${GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR}]`,
2779
+ }]
2780
+ }] });
2781
+
2741
2782
  /*
2742
2783
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
2743
2784
  *
@@ -2830,6 +2871,7 @@ class GioFormJsonSchemaComponent {
2830
2871
  this.fm = fm;
2831
2872
  this.ngControl = ngControl;
2832
2873
  this.unsubscribe$ = new Subject();
2874
+ this.gioFormFocusInvalidIgnore = true;
2833
2875
  this.formGroup = new FormGroup({});
2834
2876
  this.options = {};
2835
2877
  this.model = {};
@@ -2920,7 +2962,7 @@ class GioFormJsonSchemaComponent {
2920
2962
  }
2921
2963
  }
2922
2964
  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 });
2923
- 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"] }] });
2965
+ 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"] }] });
2924
2966
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, decorators: [{
2925
2967
  type: Component,
2926
2968
  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"] }]
@@ -2930,7 +2972,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
2930
2972
  }, {
2931
2973
  type: Optional
2932
2974
  }] }];
2933
- }, propDecorators: { jsonSchema: [{
2975
+ }, propDecorators: { gioFormFocusInvalidIgnore: [{
2976
+ type: HostBinding,
2977
+ args: [`attr.${GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR}`]
2978
+ }], jsonSchema: [{
2934
2979
  type: Input
2935
2980
  }], options: [{
2936
2981
  type: Input
@@ -3749,12 +3794,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3749
3794
  * See the License for the specific language governing permissions and
3750
3795
  * limitations under the License.
3751
3796
  */
3752
- class GioFormFocusInvalidDirective {
3753
- constructor(renderer, formGroupDirective) {
3754
- this.renderer = renderer;
3797
+ class GioBaseFormFocusInvalidDirective {
3798
+ constructor(hostElement, formGroupDirective) {
3799
+ this.hostElement = hostElement;
3755
3800
  this.formGroupDirective = formGroupDirective;
3756
3801
  }
3757
- onFormSubmit() {
3802
+ focusOnFirstInvalid() {
3758
3803
  const selector = '.ng-invalid[formControlName],input.ng-invalid,mat-select.ng-invalid,textarea.ng-invalid,.gio-ng-invalid';
3759
3804
  try {
3760
3805
  // Mark all controls as touched to display errors
@@ -3762,11 +3807,9 @@ class GioFormFocusInvalidDirective {
3762
3807
  this.formGroupDirective.control.markAllAsTouched();
3763
3808
  this.formGroupDirective.control.updateValueAndValidity();
3764
3809
  }
3765
- let invalidControl = this.renderer.selectRootElement(selector, true);
3766
- // If the form is a GioFormJsonSchema, we need to focus the first invalid control inside
3767
- if (invalidControl.tagName === 'GIO-FORM-JSON-SCHEMA') {
3768
- invalidControl = invalidControl.querySelector(selector);
3769
- }
3810
+ const parentForm = this.hostElement.nativeElement.closest('form');
3811
+ const invalidFieldElements = parentForm === null || parentForm === void 0 ? void 0 : parentForm.querySelectorAll(selector);
3812
+ const invalidControl = this.getFirstInvalidControl(invalidFieldElements);
3770
3813
  if (invalidControl) {
3771
3814
  invalidControl.scrollIntoView({ behavior: 'smooth', block: 'center' });
3772
3815
  invalidControl.focus({ preventScroll: true });
@@ -3777,22 +3820,57 @@ class GioFormFocusInvalidDirective {
3777
3820
  // 🧪 Useful to avoid som error in tests
3778
3821
  }
3779
3822
  }
3823
+ getFirstInvalidControl(invalidFieldElements, index = 0) {
3824
+ var _a;
3825
+ let invalidControl = invalidFieldElements === null || invalidFieldElements === void 0 ? void 0 : invalidFieldElements.item(index);
3826
+ const hasIgnoreAttribute = (_a = invalidControl === null || invalidControl === void 0 ? void 0 : invalidControl.attributes) === null || _a === void 0 ? void 0 : _a.getNamedItem(GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR);
3827
+ if (hasIgnoreAttribute) {
3828
+ invalidControl = this.getFirstInvalidControl(invalidFieldElements, index + 1);
3829
+ }
3830
+ return invalidControl;
3831
+ }
3780
3832
  }
3781
- 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 });
3782
- GioFormFocusInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFocusInvalidDirective, selector: "form[gioFormFocusInvalid]", host: { listeners: { "submit": "onFormSubmit()" } }, ngImport: i0 });
3783
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidDirective, decorators: [{
3833
+ 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 });
3834
+ GioBaseFormFocusInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioBaseFormFocusInvalidDirective, ngImport: i0 });
3835
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBaseFormFocusInvalidDirective, decorators: [{
3836
+ type: Directive
3837
+ }], ctorParameters: function () {
3838
+ return [{ type: i0.ElementRef }, { type: i7.FormGroupDirective, decorators: [{
3839
+ type: Optional
3840
+ }] }];
3841
+ } });
3842
+ class GioFormFocusInvalidFormDirective extends GioBaseFormFocusInvalidDirective {
3843
+ onFormSubmit() {
3844
+ this.focusOnFirstInvalid();
3845
+ }
3846
+ }
3847
+ GioFormFocusInvalidFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
3848
+ 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 });
3849
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, decorators: [{
3784
3850
  type: Directive,
3785
3851
  args: [{
3786
3852
  selector: 'form[gioFormFocusInvalid]',
3787
3853
  }]
3788
- }], ctorParameters: function () {
3789
- return [{ type: i0.Renderer2 }, { type: i7.FormGroupDirective, decorators: [{
3790
- type: Optional
3791
- }] }];
3792
- }, propDecorators: { onFormSubmit: [{
3854
+ }], propDecorators: { onFormSubmit: [{
3793
3855
  type: HostListener,
3794
3856
  args: ['submit']
3795
3857
  }] } });
3858
+ class GioButtonFocusInvalidButtonDirective extends GioBaseFormFocusInvalidDirective {
3859
+ onClick() {
3860
+ this.focusOnFirstInvalid();
3861
+ }
3862
+ }
3863
+ GioButtonFocusInvalidButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
3864
+ 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 });
3865
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, decorators: [{
3866
+ type: Directive,
3867
+ args: [{
3868
+ selector: 'button[gioFormFocusInvalid]',
3869
+ }]
3870
+ }], propDecorators: { onClick: [{
3871
+ type: HostListener,
3872
+ args: ['click']
3873
+ }] } });
3796
3874
 
3797
3875
  /*
3798
3876
  * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
@@ -3812,13 +3890,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3812
3890
  class GioFormFocusInvalidModule {
3813
3891
  }
3814
3892
  GioFormFocusInvalidModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3815
- GioFormFocusInvalidModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, declarations: [GioFormFocusInvalidDirective], exports: [GioFormFocusInvalidDirective] });
3893
+ GioFormFocusInvalidModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, declarations: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective], exports: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective] });
3816
3894
  GioFormFocusInvalidModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule });
3817
3895
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, decorators: [{
3818
3896
  type: NgModule,
3819
3897
  args: [{
3820
- declarations: [GioFormFocusInvalidDirective],
3821
- exports: [GioFormFocusInvalidDirective],
3898
+ declarations: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
3899
+ exports: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
3822
3900
  }]
3823
3901
  }] });
3824
3902
 
@@ -4368,5 +4446,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
4368
4446
  * Generated bundle index. Do not edit.
4369
4447
  */
4370
4448
 
4371
- 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 };
4449
+ 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 };
4372
4450
  //# sourceMappingURL=gravitee-ui-particles-angular.mjs.map