-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theme): add new DatePicker component (#732)
- Loading branch information
Showing
84 changed files
with
3,058 additions
and
610 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,46 +1,51 @@ | ||
import { dest, src, task } from 'gulp'; | ||
|
||
const modify = require('gulp-json-modify'); | ||
const seq = require('gulp-sequence'); | ||
|
||
const VERSION_APPENDIX = process.env.NEBULAR_VERSION_APPENDIX; | ||
const VERSION = process.env.NEBULAR_VERSION || require('../../../package.json').version + | ||
(VERSION_APPENDIX ? '-' + VERSION_APPENDIX : ''); | ||
|
||
task('version', seq('bump', 'bump-peer')); | ||
|
||
task('bump', () => { | ||
src([ | ||
return bumpVersion([ | ||
'./package.json', | ||
'./src/framework/theme/package.json', | ||
'./src/framework/auth/package.json', | ||
'./src/framework/security/package.json', | ||
'./src/framework/bootstrap/package.json', | ||
], { base: './' }) | ||
.pipe(modify({ | ||
key: 'version', | ||
value: VERSION, | ||
})) | ||
.pipe(dest('./')); | ||
'./src/framework/moment/package.json', | ||
'./src/framework/date-fns/package.json', | ||
]); | ||
}); | ||
|
||
task('bump-peer', () => { | ||
src([ | ||
'./src/framework/bootstrap/package.json', | ||
], { base: './' }) | ||
.pipe(modify({ | ||
key: 'peerDependencies.@nebular/theme', | ||
value: VERSION, | ||
})) | ||
.pipe(dest('./')); | ||
task('bump-peer', seq('bump-theme', 'bump-bootstrap')); | ||
|
||
src([ | ||
task('bump-theme', () => { | ||
return bumpPeer([ | ||
'./src/framework/auth/package.json', | ||
], { base: './' }) | ||
.pipe(modify({ | ||
key: 'peerDependencies.@nebular/theme', | ||
value: VERSION, | ||
})) | ||
.pipe(modify({ | ||
key: 'peerDependencies.@nebular/bootstrap', | ||
value: VERSION, | ||
})) | ||
.pipe(dest('./')); | ||
'./src/framework/bootstrap/package.json', | ||
'./src/framework/moment/package.json', | ||
'./src/framework/date-fns/package.json', | ||
], 'theme'); | ||
}); | ||
|
||
task('bump-bootstrap', () => { | ||
return bumpPeer(['./src/framework/auth/package.json'], 'bootstrap'); | ||
}); | ||
|
||
function bumpPeer(packages: string[], peer: string) { | ||
return bump(packages, `peerDependencies.@nebular/${peer}`); | ||
} | ||
|
||
function bumpVersion(packages: string[]) { | ||
return bump(packages, 'version'); | ||
} | ||
|
||
function bump(packages: string[], key: string) { | ||
return src(packages, { base: './' }) | ||
.pipe(modify({ key, value: VERSION })) | ||
.pipe(dest('./')); | ||
} |
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,17 @@ | ||
/* | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { NgModule } from '@angular/core'; | ||
|
||
import { NbDateService } from '@nebular/theme'; | ||
import { NbDateFnsDateService } from './services/date-fns-date.service'; | ||
|
||
|
||
@NgModule({ | ||
providers: [{ provide: NbDateService, useClass: NbDateFnsDateService }], | ||
}) | ||
export class NbDateFnsDateModule { | ||
} |
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,8 @@ | ||
/* | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
export * from './services/date-fns-date.service'; | ||
export * from './date-fns.module'; |
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,30 @@ | ||
{ | ||
"name": "@nebular/date-fns", | ||
"version": "2.0.0-rc.10", | ||
"description": "@nebular/date-fns", | ||
"main": "./bundles/theme.umd.js", | ||
"module": "./index.js", | ||
"typings": "./index.d.ts", | ||
"author": "akveo", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/akveo/nebular.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/akveo/nebular/issues" | ||
}, | ||
"homepage": "https://github.com/akveo/nebular#readme", | ||
"keywords": [ | ||
"angular", | ||
"typescript", | ||
"ng2-admin", | ||
"ngx-admin", | ||
"theme", | ||
"nebular" | ||
], | ||
"peerDependencies": { | ||
"@nebular/theme": "2.0.0-rc.10", | ||
"date-fns": "^2.0.0-alpha.16" | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/framework/date-fns/services/date-fns-date.service.spec.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,27 @@ | ||
/* | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { TestBed } from '@angular/core/testing'; | ||
import { LOCALE_ID } from '@angular/core'; | ||
|
||
import { NbDateService } from '@nebular/theme'; | ||
|
||
import { NbDateFnsDateService } from './date-fns-date.service'; | ||
|
||
|
||
describe('date-fns-date-service', () => { | ||
let dateService: NbDateService<Date>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
dateService = new NbDateFnsDateService(TestBed.get(LOCALE_ID)); | ||
}); | ||
|
||
it('should parse date according to the MM.dd.yyyy format', () => { | ||
const date = '06.15.2018'; | ||
expect(dateService.parse(date, 'MM.dd.yyyy')).toEqual(new Date(2018, 5, 15)); | ||
}); | ||
}); |
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,24 @@ | ||
/* | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { Inject, Injectable, LOCALE_ID } from '@angular/core'; | ||
|
||
import { NbNativeDateService } from '@nebular/theme'; | ||
|
||
import * as parse from 'date-fns/parse'; | ||
|
||
|
||
@Injectable() | ||
export class NbDateFnsDateService extends NbNativeDateService { | ||
constructor(@Inject(LOCALE_ID) locale: string) { | ||
super(locale); | ||
this.setLocale(locale); | ||
} | ||
|
||
parse(date: string, format: string): Date { | ||
return parse(date, format, new Date()); | ||
} | ||
} |
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,8 @@ | ||
/* | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
export * from './services/moment-date.service'; | ||
export * from './moment.module'; |
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,17 @@ | ||
/* | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { NgModule } from '@angular/core'; | ||
|
||
import { NbDateService } from '@nebular/theme'; | ||
import { NbMomentDateService } from './services/moment-date.service'; | ||
|
||
|
||
@NgModule({ | ||
providers: [{ provide: NbDateService, useClass: NbMomentDateService }], | ||
}) | ||
export class NbMomentDateModule { | ||
} |
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,31 @@ | ||
{ | ||
"name": "@nebular/moment", | ||
"version": "2.0.0-rc.10", | ||
"description": "@nebular/moment", | ||
"main": "./bundles/theme.umd.js", | ||
"module": "./index.js", | ||
"typings": "./index.d.ts", | ||
"author": "akveo", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/akveo/nebular.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/akveo/nebular/issues" | ||
}, | ||
"homepage": "https://github.com/akveo/nebular#readme", | ||
"keywords": [ | ||
"angular", | ||
"typescript", | ||
"ng2-admin", | ||
"ngx-admin", | ||
"theme", | ||
"nebular" | ||
], | ||
"peerDependencies": { | ||
"@nebular/theme": "2.0.0-rc.10", | ||
"moment": "^2.22.2" | ||
} | ||
} | ||
|
Oops, something went wrong.