Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tibing feature/datepicker #732

Merged
merged 42 commits into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
50367cb
feat(datepicker): setup
Tibing Sep 11, 2018
5eddecb
Merge branch 'master' into feature/datepicker
Tibing Sep 12, 2018
ed161f6
fix(calendar): cells emitters
Tibing Sep 12, 2018
c9f9d26
feat(datepicker): add datepicker components
Tibing Sep 12, 2018
42eb6e9
refactor(datepicker): move transformers in separate file
Tibing Sep 12, 2018
ceaf6a9
refactor(datepicker): move many logic in base picker
Tibing Sep 12, 2018
ad0c98f
feat(datepicker): implement form control
Tibing Sep 12, 2018
a564461
refactor(calendar): add locale service
Tibing Sep 13, 2018
a073a1d
refactor(calendar): implement native date service
Tibing Sep 13, 2018
5732659
feat(datepicker): setup validation
Tibing Sep 13, 2018
9cf25e8
refactor(calendar): fix specs
Tibing Sep 13, 2018
eedf8f7
refactor(datepicker): fix databindings
Tibing Sep 14, 2018
63538ca
feat(moment): setup moment package
Tibing Sep 14, 2018
d47bfab
feat(date-fns): setup date-fns module
Tibing Sep 14, 2018
2cf9cf2
refactor(date-fns): use it only for parsing purpose
Tibing Sep 14, 2018
56ba443
fix(datepicker): empty parsing exception
Tibing Sep 14, 2018
f30b397
feat(datepicker): date format input
Tibing Sep 14, 2018
cf9a8e6
refactor(datepicker): base datepicker component docs
Tibing Sep 14, 2018
4b0e4b8
refactor(datepicker): rename transformers into adapters
Tibing Sep 14, 2018
fb2eec1
feat(datepicker): validate according to inputs
Tibing Sep 17, 2018
5700984
feat(datepicker): theming
Tibing Sep 17, 2018
7f88b9e
fix(calendar-kit): native-date.service spec
Tibing Sep 17, 2018
7ec298f
feat(date-fns): spec
Tibing Sep 17, 2018
dc5b462
feat(moment): moment date service spec
Tibing Sep 17, 2018
0cb5381
Merge branch 'master' into feature/datepicker
Tibing Sep 17, 2018
4842f76
refactor(build): bump script
Tibing Sep 17, 2018
af08623
feat(build): bump moment and date-fns versions
Tibing Sep 17, 2018
a7d2aac
feat(datepicker): comments
Tibing Sep 17, 2018
262cc52
feat(datepicker): setup spec
Tibing Sep 17, 2018
34f8002
feat(datepicker): setup docs
Tibing Sep 17, 2018
86672d4
feat(datepicker): spec
Tibing Sep 17, 2018
e0bb0de
feat(datepicker): add rangepicker showcase
Tibing Sep 17, 2018
d6aaaa3
fix(moment): build issue
Tibing Sep 17, 2018
9c9b1de
Merge branch 'master' into feature/datepicker
Tibing Sep 18, 2018
fdc46bc
fix(datepicker): range formatting
Tibing Sep 18, 2018
a8c3551
fix(framework): style fixes
Tibing Sep 18, 2018
2158fe1
fix(moment): spec issue
Tibing Sep 18, 2018
23e4618
feat(datepicker): show/hide on focus
nnixaa Sep 19, 2018
f2be951
Merge branch 'master' into Tibing-feature/datepicker
nnixaa Sep 20, 2018
b312485
docs(datepicker): update comments
nnixaa Sep 20, 2018
e59085f
Merge branch 'master' into Tibing-feature/datepicker
nnixaa Sep 20, 2018
470428e
Merge branch 'master' into Tibing-feature/datepicker
nnixaa Sep 20, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions docs/assets/images/components/datepicker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/structure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,16 @@ export const structure = [
'NbSelectComponent',
],
},
{
type: 'tabs',
name: 'Datepicker',
icon: 'datepicker.svg',
source: [
'NbDatepickerDirective',
'NbDatepickerComponent',
'NbRangepickerComponent',
],
},
{
type: 'group',
name: 'Modals & Overlays',
Expand Down
25 changes: 25 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"bootstrap": "4.0.0",
"colors.js": "1.2.4",
"core-js": "2.5.1",
"date-fns": "^2.0.0-alpha.16",
"docsearch.js": "^2.5.2",
"gulp-bump": "2.7.0",
"highlight.js": "9.12.0",
Expand All @@ -97,6 +98,7 @@
"jasmine-fail-fast": "2.0.0",
"leaflet": "1.0.3",
"marked": "0.3.9",
"moment": "^2.22.2",
"nebular-icons": "1.0.6",
"normalize.css": "8.0.0",
"rxjs": "^6.1.0",
Expand Down Expand Up @@ -132,6 +134,7 @@
"gulp-replace": "0.5.4",
"gulp-rollup": "2.13.0",
"gulp-sass": "3.1.0",
"gulp-sequence": "1.0.0",
"gulp-sourcemaps": "2.6.0",
"gulp-typedoc": "2.0.2",
"husky": "0.13.3",
Expand Down
2 changes: 0 additions & 2 deletions scripts/gulp/gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ import './tasks/copy-sources';
import './tasks/bump-versions';

task('default', ['copy-sources']);
task('version', ['bump', 'bump-peer']);

59 changes: 32 additions & 27 deletions scripts/gulp/tasks/bump-versions.ts
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('./'));
}
17 changes: 17 additions & 0 deletions src/framework/date-fns/date-fns.module.ts
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 {
}
8 changes: 8 additions & 0 deletions src/framework/date-fns/index.ts
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';
30 changes: 30 additions & 0 deletions src/framework/date-fns/package.json
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 src/framework/date-fns/services/date-fns-date.service.spec.ts
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));
});
});
24 changes: 24 additions & 0 deletions src/framework/date-fns/services/date-fns-date.service.ts
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());
}
}
8 changes: 8 additions & 0 deletions src/framework/moment/index.ts
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';
17 changes: 17 additions & 0 deletions src/framework/moment/moment.module.ts
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 {
}
31 changes: 31 additions & 0 deletions src/framework/moment/package.json
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"
}
}

Loading