Selaa lähdekoodia

Porting AOT fixes into clarity branch

Richard Knight 6 vuotta sitten
vanhempi
commit
592a3a74f4

+ 3 - 3
src/app/_mock/testfields.v1.ts

@@ -127,8 +127,8 @@ const timepicker = new fmd.TimepickerField({
 	name: 'timepicker'
 });
 
-const clrdatepicker = new fmd.ClrDatepickerField({
-	name: 'clrDatepicker'
+const datepicker = new fmd.DatepickerField({
+	name: 'datepicker'
 });
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -161,7 +161,7 @@ const meta = {
 	// checkboxGroup,
 	checkbuttonGroup,
 	// // timepicker,
-	clrdatepicker,
+	datepicker,
 	basicTestContainer
 };
 

+ 3 - 3
src/app/_mock/testfields.v2.ts

@@ -125,8 +125,8 @@ const timepicker = {
 	type: 'timepicker'
 };
 
-const clrdatepicker = {
-	type: 'ClrDatepicker'
+const datepicker = {
+	type: 'datepicker'
 };
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -157,7 +157,7 @@ const meta = {
 	dropdownModifiedInput,
 	checkbuttonGroup,
 	// timepicker,
-	clrdatepicker,
+	datepicker,
 	container
 };
 

+ 2 - 2
src/app/dynaform/components/index.ts

@@ -9,7 +9,7 @@ import { ClrPasswordComponent as PasswordComponent } from './clarity/password/cl
 import { ClrSelectComponent as SelectComponent } from './clarity/select/clr-select.component';
 import { ClrRadioComponent as RadioComponent } from './clarity/radio/clr-radio.component';
 import { ClrCheckboxComponent as CheckboxComponent } from './clarity/checkbox/clr-checkbox.component';
-import { ClrDatepickerComponent } from './clarity/datepicker/datepicker.component';
+import { ClrDatepickerComponent  as DatepickerComponent } from './clarity/datepicker/datepicker.component';
 
 import { CheckbuttonComponent } from './custom/checkbutton/checkbutton.component';
 import { DropdownModifiedInputComponent } from './custom/dropdown-modified-input/dropdown-modified-input.component';
@@ -29,7 +29,7 @@ export const ffcArr = [
 	SelectComponent,
 	RadioComponent,
 	CheckboxComponent,
-	ClrDatepickerComponent,
+	DatepickerComponent,
 	CheckbuttonComponent,
 	DropdownModifiedInputComponent,
 	MultilineComponent,

+ 2 - 1
src/app/dynaform/directives/dynafield.directive.ts

@@ -10,7 +10,8 @@ import {
 	NG_ASYNC_VALIDATORS, AsyncValidatorFn
 } from '@angular/forms';
 
-import * as formFieldComponents from './../components';
+import { ffcArr } from './../components';
+const formFieldComponents = ffcArr.reduce((acc, componentClass) => ({ ...acc, [componentClass.name.replace('Clr', '')]: componentClass }), {});
 
 interface IFFC {
 	control: FormControl; // Remember, this can be an individual FormControl or a FormGroup

+ 0 - 1
src/app/dynaform/dynaform.module.ts

@@ -13,7 +13,6 @@ import { DynaformService } from './services/dynaform.service';
 import { ModelMapperService } from './services/model-mapper.service';
 
 import { ffcArr } from './components'; // ffcArr = Form Field Components Array, exported from components/index.ts
-console.log(ffcArr);
 
 @NgModule({
 	imports: [

+ 3 - 3
src/app/dynaform/models/field.model.ts

@@ -271,8 +271,8 @@ class TimepickerField extends SimpleField {
 
 }
 
-class ClrDatepickerField extends SimpleField {
-	type = 'ClrDatepicker';
+class DatepickerField extends SimpleField {
+	type = 'Datepicker';
 	value: Date = new Date();
 }
 
@@ -403,7 +403,7 @@ export {
 	TextField, TextareaField, PasswordField, SelectField, RadioField, CheckboxField, HiddenField,
 	CheckbuttonField, DropdownModifiedInputField, MultilineField,
 	CheckboxGroup, CheckbuttonGroup,
-	TimepickerField, ClrDatepickerField,
+	TimepickerField, DatepickerField,
 	Container, RepeatingContainer,
 	ButtonGroup, Heading, DisplayField
 };