@gravitee/ui-particles-angular 7.14.0 → 7.15.0-apim-1415-table-style-c855338
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 +21 -12
- package/fesm2015/gravitee-ui-particles-angular.mjs +24 -15
- package/fesm2015/gravitee-ui-particles-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-particles-angular.mjs +20 -11
- package/fesm2020/gravitee-ui-particles-angular.mjs.map +1 -1
- package/lib/gio-form-json-schema/gio-form-json-schema.component.d.ts +1 -0
- package/package.json +1 -1
- package/src/scss/component/gio-table-light/gio-table-light.scss +9 -5
|
@@ -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, ReplaySubject, merge } 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';
|
|
@@ -13,7 +13,7 @@ import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
|
13
13
|
import * as i3$1 from '@angular/material/form-field';
|
|
14
14
|
import { MatFormFieldControl, MatFormFieldModule, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
15
15
|
import { isEmpty, toLower, dropRight, isNil, isArray, remove, isObject, cloneDeep, uniqueId, set } from 'lodash';
|
|
16
|
-
import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap, debounceTime } from 'rxjs/operators';
|
|
16
|
+
import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap, take, debounceTime } from 'rxjs/operators';
|
|
17
17
|
import * as i7 from '@angular/forms';
|
|
18
18
|
import { FormsModule, FormArray, FormGroup, FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule, NgControl } from '@angular/forms';
|
|
19
19
|
import * as i2$2 from '@angular/cdk/a11y';
|
|
@@ -2938,6 +2938,7 @@ class GioFormJsonSchemaComponent {
|
|
|
2938
2938
|
this._onChange = () => ({});
|
|
2939
2939
|
this._onTouched = () => ({});
|
|
2940
2940
|
this.touched = false;
|
|
2941
|
+
this.isValid$ = new ReplaySubject(1); // Wait JsonSchema to be loaded to check if it's valid
|
|
2941
2942
|
this.stateChanges$ = new Subject();
|
|
2942
2943
|
if (ngControl) {
|
|
2943
2944
|
// Setting the value accessor directly (instead of using
|
|
@@ -2965,25 +2966,33 @@ class GioFormJsonSchemaComponent {
|
|
|
2965
2966
|
}
|
|
2966
2967
|
}
|
|
2967
2968
|
ngOnInit() {
|
|
2969
|
+
// Invalid by default.
|
|
2970
|
+
this.ngControl?.control?.addAsyncValidators(() => {
|
|
2971
|
+
return this.isValid$.pipe(takeUntil(this.unsubscribe$), take(1), map(isValid => (isValid ? null : { invalid: true })));
|
|
2972
|
+
});
|
|
2973
|
+
this.ngControl?.control?.updateValueAndValidity({ emitEvent: false });
|
|
2968
2974
|
// Subscribe to state changes to manage touches, status and value
|
|
2969
|
-
this.stateChanges$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
2975
|
+
this.stateChanges$.pipe(takeUntil(this.unsubscribe$), debounceTime(100)).subscribe(() => {
|
|
2970
2976
|
const { status, value, touched } = this.formGroup;
|
|
2971
2977
|
if (this.isDisabled) {
|
|
2972
2978
|
return;
|
|
2973
2979
|
}
|
|
2974
|
-
if (touched) {
|
|
2975
|
-
this._onTouched();
|
|
2976
|
-
this.touched = true;
|
|
2977
|
-
}
|
|
2978
|
-
if (this.touched) {
|
|
2979
|
-
this._onChange(value);
|
|
2980
|
-
}
|
|
2981
2980
|
if (status === 'VALID') {
|
|
2981
|
+
this.isValid$.next(true);
|
|
2982
2982
|
this.ngControl?.control?.setErrors(null);
|
|
2983
2983
|
}
|
|
2984
2984
|
if (status === 'INVALID') {
|
|
2985
|
+
this.isValid$.next(false);
|
|
2985
2986
|
this.ngControl?.control?.setErrors({ invalid: true });
|
|
2986
2987
|
}
|
|
2988
|
+
if (touched && !this.touched) {
|
|
2989
|
+
this._onTouched();
|
|
2990
|
+
this.touched = true;
|
|
2991
|
+
}
|
|
2992
|
+
if (this.touched) {
|
|
2993
|
+
this._onChange(value);
|
|
2994
|
+
}
|
|
2995
|
+
this.ngControl?.control?.updateValueAndValidity({ emitEvent: false });
|
|
2987
2996
|
this.changeDetectorRef.detectChanges();
|
|
2988
2997
|
});
|
|
2989
2998
|
// When the parent form is touched, mark all the sub formGroup as touched if not already touched
|
|
@@ -2999,7 +3008,7 @@ class GioFormJsonSchemaComponent {
|
|
|
2999
3008
|
});
|
|
3000
3009
|
// Group all valueChanges events emit by formly in a single one
|
|
3001
3010
|
merge(this.formGroup.statusChanges, this.formGroup.valueChanges)
|
|
3002
|
-
.pipe(takeUntil(this.unsubscribe$)
|
|
3011
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3003
3012
|
.subscribe(() => {
|
|
3004
3013
|
this.stateChanges$.next();
|
|
3005
3014
|
});
|