@3kles/kles-material-dynamicforms 17.8.1 → 17.8.3
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/esm2022/lib/dynamic-form.component.mjs +3 -3
- package/esm2022/lib/fields/select.lazy-search.component.mjs +6 -6
- package/esm2022/lib/fields/select.search.component.mjs +25 -18
- package/fesm2022/3kles-kles-material-dynamicforms.mjs +29 -22
- package/fesm2022/3kles-kles-material-dynamicforms.mjs.map +1 -1
- package/lib/fields/select.search.component.d.ts +3 -2
- package/package.json +1 -1
|
@@ -497,7 +497,7 @@ class KlesDynamicFormComponent {
|
|
|
497
497
|
<mat-error matErrorForm [form]="form" [validations]="validators" [asyncValidations]="asyncValidators"></mat-error>
|
|
498
498
|
}
|
|
499
499
|
</form>
|
|
500
|
-
`, isInline: true, styles: [".dynamic-form-column{display:flex;flex-direction:column}\n", ".dynamic-form-column>*{width:100%}\n", ".dynamic-form-row{display:inline-flex;flex-wrap:wrap;gap:10px}\n", ".dynamic-form-row>*{width:100%}\n", ".dynamic-form-grid{display:grid}\n", ".dynamic-form-inline-grid{display:inline-grid}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: KlesDynamicFieldDirective, selector: "[klesDynamicField]", inputs: ["field", "group", "siblingFields"] }, { kind: "component", type: MatErrorFormDirective, selector: "[matErrorForm]", inputs: ["validations", "asyncValidations", "form"] }] }); }
|
|
500
|
+
`, isInline: true, styles: [".dynamic-form-column{display:flex;flex-direction:column}\n", ".dynamic-form-column>*{width:100%}\n", ".dynamic-form-row{display:inline-flex;flex-wrap:wrap;gap:10px;align-items:baseline}\n", ".dynamic-form-row>*{width:100%}\n", ".dynamic-form-grid{display:grid}\n", ".dynamic-form-inline-grid{display:inline-grid}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: KlesDynamicFieldDirective, selector: "[klesDynamicField]", inputs: ["field", "group", "siblingFields"] }, { kind: "component", type: MatErrorFormDirective, selector: "[matErrorForm]", inputs: ["validations", "asyncValidations", "form"] }] }); }
|
|
501
501
|
}
|
|
502
502
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: KlesDynamicFormComponent, decorators: [{
|
|
503
503
|
type: Component,
|
|
@@ -513,7 +513,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
513
513
|
<mat-error matErrorForm [form]="form" [validations]="validators" [asyncValidations]="asyncValidators"></mat-error>
|
|
514
514
|
}
|
|
515
515
|
</form>
|
|
516
|
-
`, styles: [".dynamic-form-column{display:flex;flex-direction:column}\n", ".dynamic-form-column>*{width:100%}\n", ".dynamic-form-row{display:inline-flex;flex-wrap:wrap;gap:10px}\n", ".dynamic-form-row>*{width:100%}\n", ".dynamic-form-grid{display:grid}\n", ".dynamic-form-inline-grid{display:inline-grid}\n"] }]
|
|
516
|
+
`, styles: [".dynamic-form-column{display:flex;flex-direction:column}\n", ".dynamic-form-column>*{width:100%}\n", ".dynamic-form-row{display:inline-flex;flex-wrap:wrap;gap:10px;align-items:baseline}\n", ".dynamic-form-row>*{width:100%}\n", ".dynamic-form-grid{display:grid}\n", ".dynamic-form-inline-grid{display:inline-grid}\n"] }]
|
|
517
517
|
}], ctorParameters: () => [{ type: i2$1.UntypedFormBuilder }], propDecorators: { fields: [{
|
|
518
518
|
type: Input
|
|
519
519
|
}], validators: [{
|
|
@@ -2785,9 +2785,10 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2785
2785
|
this.ref = ref;
|
|
2786
2786
|
this.searchControl = new UntypedFormControl();
|
|
2787
2787
|
this.selectAllControl = new UntypedFormControl(false);
|
|
2788
|
-
this.isLoading = false;
|
|
2788
|
+
this.isLoading = signal(false);
|
|
2789
2789
|
this.optionsFiltered$ = new ReplaySubject(1);
|
|
2790
2790
|
this.openChange$ = new BehaviorSubject(false);
|
|
2791
|
+
this.openClosed$ = new Subject();
|
|
2791
2792
|
this.compareFn = (o1, o2) => {
|
|
2792
2793
|
if (this.field.property && o1 && o2) {
|
|
2793
2794
|
return o1[this.field.property] === o2[this.field.property];
|
|
@@ -2798,10 +2799,10 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2798
2799
|
ngOnInit() {
|
|
2799
2800
|
super.ngOnInit();
|
|
2800
2801
|
if (this.field.lazy) {
|
|
2801
|
-
this.isLoading
|
|
2802
|
+
this.isLoading.set(true);
|
|
2802
2803
|
if (this.group.controls[this.field.name].value !== undefined && this.group.controls[this.field.name].value !== null) {
|
|
2803
2804
|
this.options$ = new BehaviorSubject(Array.isArray(this.group.controls[this.field.name].value) ? this.group.controls[this.field.name].value : [this.group.controls[this.field.name].value]);
|
|
2804
|
-
this.isLoading
|
|
2805
|
+
this.isLoading.set(false);
|
|
2805
2806
|
}
|
|
2806
2807
|
else {
|
|
2807
2808
|
this.options$ = new BehaviorSubject([]);
|
|
@@ -2825,7 +2826,7 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2825
2826
|
this.searchControl.valueChanges.pipe(takeUntil(this._onDestroy), debounceTime(this.field.debounceTime || 0), startWith(this.searchControl.value), switchMap(value => {
|
|
2826
2827
|
return concat(of({ loading: true, options: [] }), this.onSearchChange(value).pipe(take(1), map((options) => ({ loading: false, options }))));
|
|
2827
2828
|
})).subscribe(({ loading, options }) => {
|
|
2828
|
-
this.isLoading
|
|
2829
|
+
this.isLoading.set(loading);
|
|
2829
2830
|
this.optionsFiltered$.next(options);
|
|
2830
2831
|
this.ref.markForCheck();
|
|
2831
2832
|
});
|
|
@@ -2840,19 +2841,22 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2840
2841
|
}
|
|
2841
2842
|
ngOnDestroy() {
|
|
2842
2843
|
// this._onDestroy.next();
|
|
2844
|
+
this.openClosed$.next();
|
|
2845
|
+
this.openClosed$.complete();
|
|
2843
2846
|
super.ngOnDestroy();
|
|
2844
2847
|
}
|
|
2845
2848
|
toggleAllSelection(state) {
|
|
2846
2849
|
if (state.checked) {
|
|
2847
2850
|
this.optionsFiltered$.pipe(take(1), map((options) => options.filter((option) => !option?.disabled))).subscribe(options => {
|
|
2848
2851
|
if (options.length > 0) {
|
|
2849
|
-
this.group.controls[this.field.name].patchValue(options
|
|
2852
|
+
this.group.controls[this.field.name].patchValue(options);
|
|
2850
2853
|
}
|
|
2851
2854
|
});
|
|
2852
2855
|
}
|
|
2853
2856
|
else {
|
|
2854
|
-
this.group.controls[this.field.name].patchValue([]
|
|
2857
|
+
this.group.controls[this.field.name].patchValue([]);
|
|
2855
2858
|
}
|
|
2859
|
+
this.ref.markForCheck();
|
|
2856
2860
|
}
|
|
2857
2861
|
openChangeEvent() {
|
|
2858
2862
|
this.openChange$
|
|
@@ -2860,7 +2864,7 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2860
2864
|
return this.onOpenChange(isOpen);
|
|
2861
2865
|
}))
|
|
2862
2866
|
.subscribe((options) => {
|
|
2863
|
-
this.isLoading
|
|
2867
|
+
this.isLoading.set(false);
|
|
2864
2868
|
this.options$.next(options);
|
|
2865
2869
|
this.optionsFiltered$.next(options);
|
|
2866
2870
|
this.ref.markForCheck();
|
|
@@ -2869,12 +2873,12 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2869
2873
|
onOpenChange(isOpen) {
|
|
2870
2874
|
if (isOpen) {
|
|
2871
2875
|
if (this.field.options instanceof Observable) {
|
|
2872
|
-
this.isLoading
|
|
2873
|
-
return this.field.options.pipe(
|
|
2876
|
+
this.isLoading.set(true);
|
|
2877
|
+
return this.field.options.pipe(takeUntil(this.openClosed$));
|
|
2874
2878
|
}
|
|
2875
2879
|
else if (this.field.options instanceof Function) {
|
|
2876
|
-
this.isLoading
|
|
2877
|
-
return this.field.options().pipe(
|
|
2880
|
+
this.isLoading.set(true);
|
|
2881
|
+
return this.field.options().pipe(takeUntil(this.openClosed$));
|
|
2878
2882
|
}
|
|
2879
2883
|
else {
|
|
2880
2884
|
return of(this.field.options);
|
|
@@ -2916,6 +2920,9 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2916
2920
|
}
|
|
2917
2921
|
openChange($event) {
|
|
2918
2922
|
if (this.field.lazy) {
|
|
2923
|
+
if (!$event) {
|
|
2924
|
+
this.openClosed$.next();
|
|
2925
|
+
}
|
|
2919
2926
|
this.openChange$.next($event);
|
|
2920
2927
|
}
|
|
2921
2928
|
if (this.field.virtualScroll) {
|
|
@@ -2971,7 +2978,7 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2971
2978
|
</mat-option>
|
|
2972
2979
|
|
|
2973
2980
|
<cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
|
|
2974
|
-
@if (!isLoading) {
|
|
2981
|
+
@if (!isLoading()) {
|
|
2975
2982
|
@if (field.multiple) {
|
|
2976
2983
|
<mat-checkbox class="selectAll mat-mdc-option mdc-list-item" [formControl]="selectAllControl" (change)="toggleAllSelection($event)">
|
|
2977
2984
|
{{'selectAll' | translate}}
|
|
@@ -3030,7 +3037,7 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
3030
3037
|
placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
|
|
3031
3038
|
</mat-option>
|
|
3032
3039
|
|
|
3033
|
-
@if (!isLoading) {
|
|
3040
|
+
@if (!isLoading()) {
|
|
3034
3041
|
@if (field.multiple) {
|
|
3035
3042
|
<mat-checkbox class="selectAll mat-mdc-option mdc-list-item" [formControl]="selectAllControl" (change)="toggleAllSelection($event)">
|
|
3036
3043
|
{{'selectAll' | translate}}
|
|
@@ -3104,7 +3111,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
3104
3111
|
</mat-option>
|
|
3105
3112
|
|
|
3106
3113
|
<cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
|
|
3107
|
-
@if (!isLoading) {
|
|
3114
|
+
@if (!isLoading()) {
|
|
3108
3115
|
@if (field.multiple) {
|
|
3109
3116
|
<mat-checkbox class="selectAll mat-mdc-option mdc-list-item" [formControl]="selectAllControl" (change)="toggleAllSelection($event)">
|
|
3110
3117
|
{{'selectAll' | translate}}
|
|
@@ -3163,7 +3170,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
3163
3170
|
placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
|
|
3164
3171
|
</mat-option>
|
|
3165
3172
|
|
|
3166
|
-
@if (!isLoading) {
|
|
3173
|
+
@if (!isLoading()) {
|
|
3167
3174
|
@if (field.multiple) {
|
|
3168
3175
|
<mat-checkbox class="selectAll mat-mdc-option mdc-list-item" [formControl]="selectAllControl" (change)="toggleAllSelection($event)">
|
|
3169
3176
|
{{'selectAll' | translate}}
|
|
@@ -3917,7 +3924,7 @@ class KlesFormSelectLazySearchComponent extends KlesFormSelectSearchComponent {
|
|
|
3917
3924
|
this.searchControl.reset(null, { emitEvent: false });
|
|
3918
3925
|
}
|
|
3919
3926
|
this.optionsFiltered$.next(options);
|
|
3920
|
-
this.isLoading
|
|
3927
|
+
this.isLoading.set(false);
|
|
3921
3928
|
this.ref.markForCheck();
|
|
3922
3929
|
});
|
|
3923
3930
|
}
|
|
@@ -3944,7 +3951,7 @@ class KlesFormSelectLazySearchComponent extends KlesFormSelectSearchComponent {
|
|
|
3944
3951
|
</mat-option>
|
|
3945
3952
|
|
|
3946
3953
|
<cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
|
|
3947
|
-
@if (!isLoading) {
|
|
3954
|
+
@if (!isLoading()) {
|
|
3948
3955
|
@if (field.multiple) {
|
|
3949
3956
|
<mat-checkbox class="selectAll mat-mdc-option mdc-list-item" [formControl]="selectAllControl" (change)="toggleAllSelection($event)">
|
|
3950
3957
|
{{'selectAll' | translate}}
|
|
@@ -4003,7 +4010,7 @@ class KlesFormSelectLazySearchComponent extends KlesFormSelectSearchComponent {
|
|
|
4003
4010
|
placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
|
|
4004
4011
|
</mat-option>
|
|
4005
4012
|
|
|
4006
|
-
@if (!isLoading) {
|
|
4013
|
+
@if (!isLoading()) {
|
|
4007
4014
|
@if (field.multiple) {
|
|
4008
4015
|
<mat-checkbox class="selectAll mat-mdc-option mdc-list-item" [formControl]="selectAllControl" (change)="toggleAllSelection($event)">
|
|
4009
4016
|
{{'selectAll' | translate}}
|
|
@@ -4064,7 +4071,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
4064
4071
|
</mat-option>
|
|
4065
4072
|
|
|
4066
4073
|
<cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
|
|
4067
|
-
@if (!isLoading) {
|
|
4074
|
+
@if (!isLoading()) {
|
|
4068
4075
|
@if (field.multiple) {
|
|
4069
4076
|
<mat-checkbox class="selectAll mat-mdc-option mdc-list-item" [formControl]="selectAllControl" (change)="toggleAllSelection($event)">
|
|
4070
4077
|
{{'selectAll' | translate}}
|
|
@@ -4123,7 +4130,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
4123
4130
|
placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
|
|
4124
4131
|
</mat-option>
|
|
4125
4132
|
|
|
4126
|
-
@if (!isLoading) {
|
|
4133
|
+
@if (!isLoading()) {
|
|
4127
4134
|
@if (field.multiple) {
|
|
4128
4135
|
<mat-checkbox class="selectAll mat-mdc-option mdc-list-item" [formControl]="selectAllControl" (change)="toggleAllSelection($event)">
|
|
4129
4136
|
{{'selectAll' | translate}}
|