@gravitee/ui-particles-angular 5.20.0 → 5.20.1
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-json-schema/gio-form-json-schema.component.mjs +31 -28
- package/fesm2015/gravitee-ui-particles-angular.mjs +28 -25
- package/fesm2015/gravitee-ui-particles-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-particles-angular.mjs +29 -26
- package/fesm2020/gravitee-ui-particles-angular.mjs.map +1 -1
- package/lib/gio-form-json-schema/gio-form-json-schema.component.d.ts +6 -4
- package/package.json +1 -1
|
@@ -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,
|
|
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';
|
|
@@ -2905,10 +2905,11 @@ const getBannerProperties = (banner) => {
|
|
|
2905
2905
|
* limitations under the License.
|
|
2906
2906
|
*/
|
|
2907
2907
|
class GioFormJsonSchemaComponent {
|
|
2908
|
-
constructor(gioFormlyJsonSchema, elRef, fm, ngControl) {
|
|
2908
|
+
constructor(gioFormlyJsonSchema, elRef, fm, changeDetectorRef, ngControl) {
|
|
2909
2909
|
this.gioFormlyJsonSchema = gioFormlyJsonSchema;
|
|
2910
2910
|
this.elRef = elRef;
|
|
2911
2911
|
this.fm = fm;
|
|
2912
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
2912
2913
|
this.ngControl = ngControl;
|
|
2913
2914
|
this.unsubscribe$ = new Subject();
|
|
2914
2915
|
this.gioFormFocusInvalidIgnore = true;
|
|
@@ -2944,7 +2945,25 @@ class GioFormJsonSchemaComponent {
|
|
|
2944
2945
|
}
|
|
2945
2946
|
}
|
|
2946
2947
|
ngOnInit() {
|
|
2947
|
-
//
|
|
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
|
|
2948
2967
|
const parentControl = this.ngControl?.control?.parent;
|
|
2949
2968
|
parentControl?.statusChanges
|
|
2950
2969
|
?.pipe(takeUntil(this.unsubscribe$), map(() => parentControl?.touched), filter(touched => touched === true), distinctUntilChanged())
|
|
@@ -2952,31 +2971,15 @@ class GioFormJsonSchemaComponent {
|
|
|
2952
2971
|
this.formGroup.markAllAsTouched();
|
|
2953
2972
|
this.stateChanges$.next();
|
|
2954
2973
|
});
|
|
2955
|
-
// To simulate the behavior of classic form controls, emit value only when the form is touched
|
|
2956
|
-
// Allow to keep the formControl pristine until the user interact with it
|
|
2957
|
-
combineLatest([this.formGroup.statusChanges, this.formGroup.valueChanges])
|
|
2958
|
-
.pipe(takeUntil(this.unsubscribe$),
|
|
2959
2974
|
// Group all valueChanges events emit by formly in a single one
|
|
2960
|
-
|
|
2975
|
+
merge(this.formGroup.statusChanges, this.formGroup.valueChanges)
|
|
2976
|
+
.pipe(takeUntil(this.unsubscribe$), debounceTime(100))
|
|
2961
2977
|
.subscribe(() => {
|
|
2962
2978
|
this.stateChanges$.next();
|
|
2963
2979
|
});
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
this._onTouched();
|
|
2968
|
-
this.touched = true;
|
|
2969
|
-
}
|
|
2970
|
-
if (this.touched) {
|
|
2971
|
-
this._onChange(value);
|
|
2972
|
-
if (status === 'VALID') {
|
|
2973
|
-
this.ngControl?.control?.setErrors(null);
|
|
2974
|
-
}
|
|
2975
|
-
if (status === 'INVALID') {
|
|
2976
|
-
this.ngControl?.control?.setErrors({ invalid: true });
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
});
|
|
2980
|
+
}
|
|
2981
|
+
ngAfterViewInit() {
|
|
2982
|
+
this.stateChanges$.next();
|
|
2980
2983
|
}
|
|
2981
2984
|
ngOnDestroy() {
|
|
2982
2985
|
this.unsubscribe$.next();
|
|
@@ -3000,12 +3003,12 @@ class GioFormJsonSchemaComponent {
|
|
|
3000
3003
|
throw new Error('Method not implemented.');
|
|
3001
3004
|
}
|
|
3002
3005
|
}
|
|
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 });
|
|
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 });
|
|
3004
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"] }] });
|
|
3005
3008
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, decorators: [{
|
|
3006
3009
|
type: Component,
|
|
3007
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"] }]
|
|
3008
|
-
}], 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: [{
|
|
3009
3012
|
type: Host
|
|
3010
3013
|
}, {
|
|
3011
3014
|
type: Optional
|