-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added decimal render type, model and validators (#118)
- Loading branch information
1 parent
8005f8c
commit 5347f46
Showing
7 changed files
with
138 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 11 additions & 26 deletions
37
projects/ngx-formentry/src/components/ngx-time-picker/ngx-time-picker.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,12 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | ||
import { NgxTimePickerComponent } from './ngx-time-picker.component'; | ||
|
||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { FormsModule , ReactiveFormsModule } from '@angular/forms'; | ||
import { NgxTimePickerComponent } from './ngx-time-picker.component'; | ||
|
||
|
||
|
||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
ReactiveFormsModule | ||
], | ||
declarations: [ | ||
NgxTimePickerComponent | ||
], | ||
exports: [ | ||
NgxTimePickerComponent | ||
], | ||
providers: [ | ||
] | ||
}) | ||
export class NgxTimePickerModule { | ||
} | ||
|
||
@NgModule({ | ||
imports: [CommonModule, FormsModule, ReactiveFormsModule], | ||
declarations: [NgxTimePickerComponent], | ||
exports: [NgxTimePickerComponent], | ||
providers: [] | ||
}) | ||
export class NgxTimePickerModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
projects/ngx-formentry/src/form-entry/question-models/decimal-point-validation.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export class DecimalPointValidationModel { | ||
type: string; | ||
message: string; | ||
decimalPlace = 0; | ||
failsWhenExpression = ''; | ||
|
||
constructor(validations: any) { | ||
this.type = 'js_expression'; | ||
this.decimalPlace = validations.decimalPlace; | ||
} | ||
setFailExpression(): void { | ||
this.failsWhenExpression = `!isEmpty(myValue) && String(myValue).split('.')[1].length !== ${this.decimalPlace}`; | ||
} | ||
setMessage() { | ||
this.message = `Value must be to ${this.decimalPlace} decimal places`; | ||
} | ||
setValuesAndExpressions() { | ||
this.setMessage(); | ||
this.setFailExpression(); | ||
} | ||
} |
4 changes: 1 addition & 3 deletions
4
projects/ngx-formentry/src/form-entry/question-models/interfaces/time-question-options.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import { BaseOptions } from '../interfaces/base-options'; | ||
|
||
// tslint:disable-next-line:no-empty-interface | ||
export interface TimeQuestionOptions extends BaseOptions { | ||
|
||
} | ||
export interface TimeQuestionOptions extends BaseOptions {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters