mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-02-22 07:54:06 +01:00
feat(dashboard): add logic for temperature dragger
This commit is contained in:
parent
ce8055ca84
commit
2ed871ff20
13 changed files with 262 additions and 47 deletions
11
src/app/@theme/pipes/capitalize.pipe.ts
Normal file
11
src/app/@theme/pipes/capitalize.pipe.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({ name: 'ngxCapitalize' })
|
||||
export class CapitalizePipe implements PipeTransform {
|
||||
|
||||
transform(input: string): string {
|
||||
return input && input.length
|
||||
? (input.charAt(0).toUpperCase() + input.slice(1).toLowerCase())
|
||||
: input;
|
||||
}
|
||||
}
|
||||
3
src/app/@theme/pipes/index.ts
Normal file
3
src/app/@theme/pipes/index.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export * from './capitalize.pipe';
|
||||
export * from './plural.pipe';
|
||||
export * from './round.pipe';
|
||||
14
src/app/@theme/pipes/plural.pipe.ts
Normal file
14
src/app/@theme/pipes/plural.pipe.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({ name: 'ngxPlural' })
|
||||
export class PluralPipe implements PipeTransform {
|
||||
|
||||
transform(input: number, label: string, pluralLabel: string = ''): string {
|
||||
input = input || 0;
|
||||
return input === 1
|
||||
? `${input} ${label}`
|
||||
: pluralLabel
|
||||
? `${input} ${pluralLabel}`
|
||||
: `${input} ${label}s`;
|
||||
}
|
||||
}
|
||||
9
src/app/@theme/pipes/round.pipe.ts
Normal file
9
src/app/@theme/pipes/round.pipe.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({ name: 'ngxRound' })
|
||||
export class RoundPipe implements PipeTransform {
|
||||
|
||||
transform(input: number): number {
|
||||
return Math.round(input);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue