mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-22 17:26:10 +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);
|
||||
}
|
||||
}
|
||||
|
|
@ -21,6 +21,13 @@ import {
|
|||
TinyMCEComponent,
|
||||
} from './components';
|
||||
|
||||
|
||||
import {
|
||||
CapitalizePipe,
|
||||
PluralPipe,
|
||||
RoundPipe,
|
||||
} from './pipes';
|
||||
|
||||
import { OneColumnLayoutComponent } from './layouts';
|
||||
|
||||
const BASE_MODULES = [
|
||||
|
|
@ -48,20 +55,27 @@ const COMPONENTS = [
|
|||
OneColumnLayoutComponent,
|
||||
];
|
||||
|
||||
const PIPES = [
|
||||
CapitalizePipe,
|
||||
PluralPipe,
|
||||
RoundPipe,
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
...BASE_MODULES,
|
||||
...NGA_MODULES,
|
||||
// TODO:
|
||||
NgaSidebarModule.forRoot(),
|
||||
],
|
||||
exports: [
|
||||
...BASE_MODULES,
|
||||
...NGA_MODULES,
|
||||
...COMPONENTS,
|
||||
...PIPES,
|
||||
],
|
||||
declarations: [
|
||||
...COMPONENTS,
|
||||
...PIPES,
|
||||
],
|
||||
})
|
||||
export class ThemeModule {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue