@3kles/kles-material-dynamicforms 1.1.22 → 1.2.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.
@@ -1,11 +1,11 @@
1
1
  import { __assign, __decorate, __extends, __awaiter, __generator } from 'tslib';
2
- import { EventEmitter, Input, Output, Component, ComponentFactoryResolver, ViewContainerRef, Directive, HostBinding, ViewChild, ViewChildren, NgModule, forwardRef, Pipe, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
2
+ import { EventEmitter, Input, Output, Component, ComponentFactoryResolver, ViewContainerRef, Directive, HostBinding, ViewChild, ViewChildren, Injector, NgModule, forwardRef, Pipe, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
4
  import { Validators, FormBuilder, FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule, FormsModule } from '@angular/forms';
5
5
  import { Subject, Observable, of, ReplaySubject } from 'rxjs';
6
6
  import { takeUntil, startWith, switchMap, map, take } from 'rxjs/operators';
7
7
  import { CdkVirtualScrollViewport, ScrollingModule, CdkScrollable } from '@angular/cdk/scrolling';
8
- import { MatOption, MatNativeDateModule, ErrorStateMatcher } from '@angular/material/core';
8
+ import { MatOption, MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule, ErrorStateMatcher } from '@angular/material/core';
9
9
  import { MatSliderModule } from '@angular/material/slider';
10
10
  import { MatButtonModule } from '@angular/material/button';
11
11
  import { MatToolbarModule } from '@angular/material/toolbar';
@@ -1128,7 +1128,25 @@ var KlesDynamicFieldDirective = /** @class */ (function () {
1128
1128
  var factory = this.resolver.resolveComponentFactory(this.field.component || componentMapper[this.field.type]);
1129
1129
  if (this.componentRef)
1130
1130
  this.componentRef.destroy();
1131
- this.componentRef = this.container.createComponent(factory);
1131
+ if (this.field.dateOptions) {
1132
+ var options = {
1133
+ providers: [
1134
+ { provide: MAT_DATE_LOCALE, useValue: this.field.dateOptions.language },
1135
+ // {
1136
+ // provide: DateAdapter,
1137
+ // useClass: this.field.dateOptions.dateAdapter,
1138
+ // // deps: [MAT_DATE_LOCALE, this.field.dateOptions.dateAdapterOptions]
1139
+ // deps: [MAT_DATE_LOCALE, MAT_MOMENT_DATE_ADAPTER_OPTIONS]
1140
+ // },
1141
+ { provide: MAT_DATE_FORMATS, useValue: this.field.dateOptions.dateFormat },
1142
+ ]
1143
+ };
1144
+ var injector = Injector.create(options);
1145
+ this.componentRef = this.container.createComponent(factory, 0, injector);
1146
+ }
1147
+ else {
1148
+ this.componentRef = this.container.createComponent(factory);
1149
+ }
1132
1150
  this.componentRef.instance.field = this.field;
1133
1151
  this.componentRef.instance.group = this.group;
1134
1152
  this.componentRef.instance.siblingFields = this.siblingFields;