@stemy/ngx-dynamic-form 13.1.16 → 13.1.18

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.
@@ -4,11 +4,11 @@ import { __decorate } from 'tslib';
4
4
  import * as i1 from '@ng-dynamic-forms/core';
5
5
  import { DynamicInputControlModel, DYNAMIC_FORM_CONTROL_TYPE_EDITOR, serializable, DynamicFormArrayGroupModel as DynamicFormArrayGroupModel$1, DynamicFormArrayModel as DynamicFormArrayModel$1, DynamicFormOption as DynamicFormOption$1, DynamicSelectModel as DynamicSelectModel$1, DynamicFormService as DynamicFormService$1, DynamicDatePickerModel, DynamicFormGroupModel, DynamicInputModel, DynamicFormValueControlModel, DynamicFileUploadModel, DynamicCheckboxModel, DynamicTextAreaModel, DynamicFormComponent, DynamicTemplateDirective, DynamicFormControlContainerComponent, DYNAMIC_FORM_CONTROL_TYPE_ARRAY, DynamicFormArrayComponent, DynamicFormControlComponent, DynamicFormGroupComponent, DYNAMIC_FORM_CONTROL_MAP_FN, DYNAMIC_VALIDATORS } from '@ng-dynamic-forms/core';
6
6
  export { DYNAMIC_FORM_CONTROL_TYPE_ARRAY, DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX, DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP, DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER, DYNAMIC_FORM_CONTROL_TYPE_EDITOR, DYNAMIC_FORM_CONTROL_TYPE_FILE_UPLOAD, DYNAMIC_FORM_CONTROL_TYPE_GROUP, DYNAMIC_FORM_CONTROL_TYPE_INPUT, DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP, DYNAMIC_FORM_CONTROL_TYPE_SELECT, DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA, DynamicCheckboxGroupModel, DynamicCheckboxModel, DynamicDatePickerModel, DynamicFileUploadModel, DynamicFormControlComponent, DynamicFormGroupModel, DynamicFormsCoreModule, DynamicInputModel, DynamicListDirective, DynamicRadioGroupModel, DynamicTemplateDirective, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
7
- import { BehaviorSubject, of, isObservable, map, Subject, firstValueFrom, Subscription, debounceTime, groupBy, mergeMap } from 'rxjs';
7
+ import { BehaviorSubject, of, isObservable, map, Subject, firstValueFrom, Subscription, debounceTime as debounceTime$1, groupBy, mergeMap } from 'rxjs';
8
8
  import * as i0 from '@angular/core';
9
- import { Injector, Injectable, Inject, EventEmitter, Directive, Input, Output, HostBinding, HostListener, QueryList, Component, ChangeDetectionStrategy, ContentChildren, ViewChildren, ViewChild, ViewContainerRef, forwardRef, NgModule } from '@angular/core';
10
- import { FormGroup, FormArray, NgForm, FormsModule, ReactiveFormsModule, NG_VALIDATORS } from '@angular/forms';
11
- import { first } from 'rxjs/operators';
9
+ import { Injector, Injectable, Inject, EventEmitter, Directive, Input, Output, HostBinding, HostListener, QueryList, Component, ChangeDetectionStrategy, ContentChildren, ViewChildren, ViewContainerRef, ViewChild, forwardRef, NgModule } from '@angular/core';
10
+ import { FormGroup, FormArray, FormsModule, ReactiveFormsModule, NG_VALIDATORS } from '@angular/forms';
11
+ import { debounceTime, first } from 'rxjs/operators';
12
12
  import { CommonModule } from '@angular/common';
13
13
 
14
14
  // --- Decorator functions ---
@@ -1030,7 +1030,7 @@ class AsyncSubmitDirective {
1030
1030
  }
1031
1031
  this.callback = null;
1032
1032
  });
1033
- this.onSubmit = this.form.onSubmit.subscribe(() => this.callMethod());
1033
+ this.onSubmit = this.form.onSubmit.pipe(debounceTime(200)).subscribe(() => this.callMethod());
1034
1034
  }
1035
1035
  ngOnDestroy() {
1036
1036
  if (this.onStatusChange)
@@ -1121,15 +1121,18 @@ class DynamicBaseFormComponent extends DynamicFormComponent {
1121
1121
  get status() {
1122
1122
  return !this.group ? null : this.group.status;
1123
1123
  }
1124
+ submit() {
1125
+ this.onSubmit.emit(this);
1126
+ }
1124
1127
  ngOnChanges(changes) {
1125
1128
  this.groupSubscription.unsubscribe();
1126
1129
  if (this.group) {
1127
1130
  this.groupSubscription = ObservableUtils.multiSubscription(this.group.statusChanges.subscribe(() => {
1128
1131
  this.onStatusChange.emit(this);
1129
- }), this.group.valueChanges.pipe(debounceTime(500)).subscribe(() => {
1132
+ }), this.group.valueChanges.pipe(debounceTime$1(500)).subscribe(() => {
1130
1133
  this.formService.notifyChanges(this.model, this.group);
1131
1134
  }), this.change.pipe(groupBy(ev => ev.model))
1132
- .pipe(mergeMap(t => t.pipe(debounceTime(500))))
1135
+ .pipe(mergeMap(t => t.pipe(debounceTime$1(500))))
1133
1136
  .subscribe(ev => {
1134
1137
  this.onValueChange.emit({ ...ev, form: this });
1135
1138
  }));
@@ -1145,8 +1148,6 @@ class DynamicBaseFormComponent extends DynamicFormComponent {
1145
1148
  }), this.events.languageChanged.subscribe(() => {
1146
1149
  this.formService.notifyChanges(this.model, this.group);
1147
1150
  this.formService.detectChanges(this);
1148
- }), this.ngForm.ngSubmit.subscribe(() => {
1149
- this.onSubmit.emit(this);
1150
1151
  }));
1151
1152
  }
1152
1153
  ngOnDestroy() {
@@ -1214,7 +1215,7 @@ class DynamicBaseFormComponent extends DynamicFormComponent {
1214
1215
  }
1215
1216
  }
1216
1217
  DynamicBaseFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: DynamicBaseFormComponent, deps: [{ token: DynamicFormService }, { token: EventsService }, { token: i0.ChangeDetectorRef }, { token: i1.DynamicFormComponentService }], target: i0.ɵɵFactoryTarget.Component });
1217
- DynamicBaseFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: DynamicBaseFormComponent, selector: "dynamic-base-form", inputs: { group: "group", model: "model", layout: "layout", labelPrefix: "labelPrefix", getComponentType: "getComponentType" }, outputs: { blur: "blur", change: "change", focus: "focus", onValueChange: "onValueChange", onStatusChange: "onStatusChange", onSubmit: "onSubmit", onDetectChanges: "onDetectChanges" }, queries: [{ propertyName: "contentTemplates", predicate: DynamicTemplateDirective }], viewQueries: [{ propertyName: "ngForm", first: true, predicate: NgForm, descendants: true }, { propertyName: "viewTemplates", predicate: DynamicTemplateDirective, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.Default });
1218
+ DynamicBaseFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: DynamicBaseFormComponent, selector: "dynamic-base-form", inputs: { group: "group", model: "model", layout: "layout", labelPrefix: "labelPrefix", getComponentType: "getComponentType" }, outputs: { blur: "blur", change: "change", focus: "focus", onValueChange: "onValueChange", onStatusChange: "onStatusChange", onSubmit: "onSubmit", onDetectChanges: "onDetectChanges" }, queries: [{ propertyName: "contentTemplates", predicate: DynamicTemplateDirective }], viewQueries: [{ propertyName: "viewTemplates", predicate: DynamicTemplateDirective, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.Default });
1218
1219
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: DynamicBaseFormComponent, decorators: [{
1219
1220
  type: Component,
1220
1221
  args: [{
@@ -1258,9 +1259,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
1258
1259
  type: Output
1259
1260
  }], onDetectChanges: [{
1260
1261
  type: Output
1261
- }], ngForm: [{
1262
- type: ViewChild,
1263
- args: [NgForm]
1264
1262
  }] } });
1265
1263
 
1266
1264
  class DynamicBaseFormControlContainerComponent extends DynamicFormControlContainerComponent {
@@ -1477,15 +1475,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
1477
1475
  }] } });
1478
1476
 
1479
1477
  class DynamicBaseFormControlComponent extends DynamicFormControlComponent {
1480
- constructor(cdr, layoutService, validationService) {
1478
+ constructor(layoutService, validationService, form, injector, cdr) {
1481
1479
  super(layoutService, validationService);
1480
+ this.form = form;
1481
+ this.injector = injector;
1482
1482
  this.cdr = cdr;
1483
1483
  this.blur = new EventEmitter();
1484
1484
  this.change = new EventEmitter();
1485
1485
  this.focus = new EventEmitter();
1486
1486
  }
1487
1487
  ngAfterViewInit() {
1488
- this.subscription = this.control.valueChanges.pipe(debounceTime(500)).subscribe(value => {
1488
+ this.subscription = this.control.valueChanges.pipe(debounceTime$1(500)).subscribe(value => {
1489
1489
  this.onValueChanged(value);
1490
1490
  });
1491
1491
  }
@@ -1494,10 +1494,13 @@ class DynamicBaseFormControlComponent extends DynamicFormControlComponent {
1494
1494
  return;
1495
1495
  this.subscription.unsubscribe();
1496
1496
  }
1497
+ submit() {
1498
+ this.form.submit();
1499
+ }
1497
1500
  onValueChanged(value) {
1498
1501
  }
1499
1502
  }
1500
- DynamicBaseFormControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: DynamicBaseFormControlComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.DynamicFormLayoutService }, { token: i1.DynamicFormValidationService }], target: i0.ɵɵFactoryTarget.Component });
1503
+ DynamicBaseFormControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: DynamicBaseFormControlComponent, deps: [{ token: i1.DynamicFormLayoutService }, { token: i1.DynamicFormValidationService }, { token: DynamicBaseFormComponent }, { token: i0.Injector }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1501
1504
  DynamicBaseFormControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: DynamicBaseFormControlComponent, selector: "dynamic-base-form-control", inputs: { formLayout: "formLayout", group: "group", layout: "layout", model: "model" }, outputs: { blur: "blur", change: "change", focus: "focus" }, usesInheritance: true, ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1502
1505
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: DynamicBaseFormControlComponent, decorators: [{
1503
1506
  type: Component,
@@ -1506,7 +1509,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
1506
1509
  template: "",
1507
1510
  changeDetection: ChangeDetectionStrategy.OnPush
1508
1511
  }]
1509
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.DynamicFormLayoutService }, { type: i1.DynamicFormValidationService }]; }, propDecorators: { formLayout: [{
1512
+ }], ctorParameters: function () { return [{ type: i1.DynamicFormLayoutService }, { type: i1.DynamicFormValidationService }, { type: DynamicBaseFormComponent }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { formLayout: [{
1510
1513
  type: Input
1511
1514
  }], group: [{
1512
1515
  type: Input