@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.
- package/esm2020/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid-ignore.directive.mjs +30 -0
- package/esm2020/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid.directive.mjs +49 -16
- package/esm2020/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid.module.mjs +6 -5
- package/esm2020/lib/gio-form-json-schema/gio-form-json-schema.component.mjs +9 -4
- package/esm2020/lib/gio-save-bar/gio-save-bar.component.mjs +9 -3
- package/esm2020/lib/gio-save-bar/gio-save-bar.harness.mjs +10 -5
- package/esm2020/lib/public-api.mjs +2 -1
- package/fesm2015/gravitee-ui-particles-angular.mjs +107 -29
- package/fesm2015/gravitee-ui-particles-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-particles-angular.mjs +102 -27
- package/fesm2020/gravitee-ui-particles-angular.mjs.map +1 -1
- package/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid-ignore.directive.d.ts +6 -0
- package/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid.directive.d.ts +17 -6
- package/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid.module.d.ts +2 -1
- package/lib/gio-form-json-schema/gio-form-json-schema.component.d.ts +1 -0
- package/lib/gio-save-bar/gio-save-bar.component.d.ts +3 -1
- package/lib/gio-save-bar/gio-save-bar.harness.d.ts +2 -0
- package/lib/public-api.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
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.
|
|
224
|
-
this.
|
|
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
|
|
230
|
-
return
|
|
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
|
*
|
|
@@ -2872,6 +2911,7 @@ class GioFormJsonSchemaComponent {
|
|
|
2872
2911
|
this.fm = fm;
|
|
2873
2912
|
this.ngControl = ngControl;
|
|
2874
2913
|
this.unsubscribe$ = new Subject();
|
|
2914
|
+
this.gioFormFocusInvalidIgnore = true;
|
|
2875
2915
|
this.formGroup = new FormGroup({});
|
|
2876
2916
|
this.options = {};
|
|
2877
2917
|
this.model = {};
|
|
@@ -2961,7 +3001,7 @@ class GioFormJsonSchemaComponent {
|
|
|
2961
3001
|
}
|
|
2962
3002
|
}
|
|
2963
3003
|
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"] }] });
|
|
3004
|
+
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
3005
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, decorators: [{
|
|
2966
3006
|
type: Component,
|
|
2967
3007
|
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"] }]
|
|
@@ -2969,7 +3009,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
2969
3009
|
type: Host
|
|
2970
3010
|
}, {
|
|
2971
3011
|
type: Optional
|
|
2972
|
-
}] }]; }, propDecorators: {
|
|
3012
|
+
}] }]; }, propDecorators: { gioFormFocusInvalidIgnore: [{
|
|
3013
|
+
type: HostBinding,
|
|
3014
|
+
args: [`attr.${GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR}`]
|
|
3015
|
+
}], jsonSchema: [{
|
|
2973
3016
|
type: Input
|
|
2974
3017
|
}], options: [{
|
|
2975
3018
|
type: Input
|
|
@@ -3793,12 +3836,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3793
3836
|
* See the License for the specific language governing permissions and
|
|
3794
3837
|
* limitations under the License.
|
|
3795
3838
|
*/
|
|
3796
|
-
class
|
|
3797
|
-
constructor(
|
|
3798
|
-
this.
|
|
3839
|
+
class GioBaseFormFocusInvalidDirective {
|
|
3840
|
+
constructor(hostElement, formGroupDirective) {
|
|
3841
|
+
this.hostElement = hostElement;
|
|
3799
3842
|
this.formGroupDirective = formGroupDirective;
|
|
3800
3843
|
}
|
|
3801
|
-
|
|
3844
|
+
focusOnFirstInvalid() {
|
|
3802
3845
|
const selector = '.ng-invalid[formControlName],input.ng-invalid,mat-select.ng-invalid,textarea.ng-invalid,.gio-ng-invalid';
|
|
3803
3846
|
try {
|
|
3804
3847
|
// Mark all controls as touched to display errors
|
|
@@ -3806,11 +3849,9 @@ class GioFormFocusInvalidDirective {
|
|
|
3806
3849
|
this.formGroupDirective.control.markAllAsTouched();
|
|
3807
3850
|
this.formGroupDirective.control.updateValueAndValidity();
|
|
3808
3851
|
}
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
invalidControl = invalidControl.querySelector(selector);
|
|
3813
|
-
}
|
|
3852
|
+
const parentForm = this.hostElement.nativeElement.closest('form');
|
|
3853
|
+
const invalidFieldElements = parentForm?.querySelectorAll(selector);
|
|
3854
|
+
const invalidControl = this.getFirstInvalidControl(invalidFieldElements);
|
|
3814
3855
|
if (invalidControl) {
|
|
3815
3856
|
invalidControl.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
3816
3857
|
invalidControl.focus({ preventScroll: true });
|
|
@@ -3821,20 +3862,54 @@ class GioFormFocusInvalidDirective {
|
|
|
3821
3862
|
// 🧪 Useful to avoid som error in tests
|
|
3822
3863
|
}
|
|
3823
3864
|
}
|
|
3865
|
+
getFirstInvalidControl(invalidFieldElements, index = 0) {
|
|
3866
|
+
let invalidControl = invalidFieldElements?.item(index);
|
|
3867
|
+
const hasIgnoreAttribute = invalidControl?.attributes?.getNamedItem(GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR);
|
|
3868
|
+
if (hasIgnoreAttribute) {
|
|
3869
|
+
invalidControl = this.getFirstInvalidControl(invalidFieldElements, index + 1);
|
|
3870
|
+
}
|
|
3871
|
+
return invalidControl;
|
|
3872
|
+
}
|
|
3824
3873
|
}
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type:
|
|
3874
|
+
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 });
|
|
3875
|
+
GioBaseFormFocusInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioBaseFormFocusInvalidDirective, ngImport: i0 });
|
|
3876
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBaseFormFocusInvalidDirective, decorators: [{
|
|
3877
|
+
type: Directive
|
|
3878
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i7.FormGroupDirective, decorators: [{
|
|
3879
|
+
type: Optional
|
|
3880
|
+
}] }]; } });
|
|
3881
|
+
class GioFormFocusInvalidFormDirective extends GioBaseFormFocusInvalidDirective {
|
|
3882
|
+
onFormSubmit() {
|
|
3883
|
+
this.focusOnFirstInvalid();
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
GioFormFocusInvalidFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
3887
|
+
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 });
|
|
3888
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, decorators: [{
|
|
3828
3889
|
type: Directive,
|
|
3829
3890
|
args: [{
|
|
3830
3891
|
selector: 'form[gioFormFocusInvalid]',
|
|
3831
3892
|
}]
|
|
3832
|
-
}],
|
|
3833
|
-
type: Optional
|
|
3834
|
-
}] }]; }, propDecorators: { onFormSubmit: [{
|
|
3893
|
+
}], propDecorators: { onFormSubmit: [{
|
|
3835
3894
|
type: HostListener,
|
|
3836
3895
|
args: ['submit']
|
|
3837
3896
|
}] } });
|
|
3897
|
+
class GioButtonFocusInvalidButtonDirective extends GioBaseFormFocusInvalidDirective {
|
|
3898
|
+
onClick() {
|
|
3899
|
+
this.focusOnFirstInvalid();
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3902
|
+
GioButtonFocusInvalidButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
3903
|
+
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 });
|
|
3904
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, decorators: [{
|
|
3905
|
+
type: Directive,
|
|
3906
|
+
args: [{
|
|
3907
|
+
selector: 'button[gioFormFocusInvalid]',
|
|
3908
|
+
}]
|
|
3909
|
+
}], propDecorators: { onClick: [{
|
|
3910
|
+
type: HostListener,
|
|
3911
|
+
args: ['click']
|
|
3912
|
+
}] } });
|
|
3838
3913
|
|
|
3839
3914
|
/*
|
|
3840
3915
|
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
@@ -3854,13 +3929,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3854
3929
|
class GioFormFocusInvalidModule {
|
|
3855
3930
|
}
|
|
3856
3931
|
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: [
|
|
3932
|
+
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
3933
|
GioFormFocusInvalidModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule });
|
|
3859
3934
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, decorators: [{
|
|
3860
3935
|
type: NgModule,
|
|
3861
3936
|
args: [{
|
|
3862
|
-
declarations: [
|
|
3863
|
-
exports: [
|
|
3937
|
+
declarations: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
|
|
3938
|
+
exports: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
|
|
3864
3939
|
}]
|
|
3865
3940
|
}] });
|
|
3866
3941
|
|
|
@@ -4422,5 +4497,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
4422
4497
|
* Generated bundle index. Do not edit.
|
|
4423
4498
|
*/
|
|
4424
4499
|
|
|
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,
|
|
4500
|
+
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
4501
|
//# sourceMappingURL=gravitee-ui-particles-angular.mjs.map
|