@rxap/forms 13.0.0-next.0 → 13.0.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.
@@ -4,7 +4,7 @@ import { map, distinctUntilChanged, debounceTime, filter, tap, startWith, take }
4
4
  import { merge, defer, of, EMPTY, Subject, isObservable, BehaviorSubject, Subscription } from 'rxjs';
5
5
  import { equals, coerceArray, HasRxapOnInitMethod, assertIsArray, assertIsObject, assertIsFunction, isPromise, isObject, clone, Required, hasIndexSignature, coerceBoolean } from '@rxap/utilities';
6
6
  import * as i0 from '@angular/core';
7
- import { Injector, isDevMode, InjectionToken, EventEmitter, ChangeDetectorRef, forwardRef, Directive, Inject, Optional, SkipSelf, Input, Output, HostBinding, TemplateRef, ViewContainerRef, Host, HostListener, Self, NgModule } from '@angular/core';
7
+ import { isDevMode, Injector, InjectionToken, EventEmitter, ChangeDetectorRef, forwardRef, Directive, Inject, Optional, SkipSelf, Input, Output, HostBinding, TemplateRef, ViewContainerRef, Host, HostListener, Self, NgModule } from '@angular/core';
8
8
  import { GetDefinitionMetadata, DefinitionMetadata } from '@rxap/definition';
9
9
  import { getMetadata, setMetadataMapSet, setMetadataMap } from '@rxap/utilities/reflect-metadata';
10
10
  import { __decorate, __metadata } from 'tslib';
@@ -159,7 +159,9 @@ class RxapFormArray extends FormArray {
159
159
  return super.getRawValue();
160
160
  }
161
161
  insert(index, control) {
162
- console.warn('It is not recommend to use the FormArray.insert method');
162
+ if (isDevMode()) {
163
+ console.warn('It is not recommend to use the FormArray.insert method');
164
+ }
163
165
  return super.insert(index, control);
164
166
  }
165
167
  /**
@@ -241,7 +243,9 @@ class RxapFormArray extends FormArray {
241
243
  return hasErrorAndDirty(this, errorCode, path);
242
244
  }
243
245
  removeAt(index) {
244
- console.warn('It is not recommend to use the FormArray.removeAt method');
246
+ if (isDevMode()) {
247
+ console.warn('It is not recommend to use the FormArray.removeAt method');
248
+ }
245
249
  super.removeAt(index);
246
250
  this._controlRemovedFn(index);
247
251
  }
@@ -249,14 +253,18 @@ class RxapFormArray extends FormArray {
249
253
  enableControl(this, enable, opts);
250
254
  }
251
255
  push(control) {
252
- console.warn('It is not recommend to use the FormArray.push method');
256
+ if (isDevMode()) {
257
+ console.warn('It is not recommend to use the FormArray.push method');
258
+ }
253
259
  return super.push(control);
254
260
  }
255
261
  setDisable(disable = true, opts) {
256
262
  disableControl(this, disable, opts);
257
263
  }
258
264
  setControl(index, control) {
259
- console.warn('It is not recommend to use the FormArray.setControl method');
265
+ if (isDevMode()) {
266
+ console.warn('It is not recommend to use the FormArray.setControl method');
267
+ }
260
268
  return super.setControl(index, control);
261
269
  }
262
270
  markAsTouched(opts) {
@@ -1978,8 +1986,12 @@ class FormSubmitDirective extends ConfirmClick {
1978
1986
  this._resetAfterSubmit = coerceBoolean(value);
1979
1987
  }
1980
1988
  execute() {
1981
- this.subscription = this.formDirective.rxapSubmit.pipe(take(1), tap(event => {
1982
- this.afterSubmit.emit(event);
1989
+ this.formDirective.form.markAllAsDirty();
1990
+ this.formDirective.form.markAllAsTouched();
1991
+ this.formDirective.cdr.markForCheck();
1992
+ this.subscription = this.formDirective.rxapSubmit.pipe(take(1), tap(value => {
1993
+ const clonedValue = clone(value);
1994
+ this.afterSubmit.emit(clonedValue);
1983
1995
  if (this._resetAfterSubmit) {
1984
1996
  this.formDirective.reset();
1985
1997
  }