forked from valor-software/ngx-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
241 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules | ||
npm-debug.log | ||
|
||
# type script artifacts | ||
typings | ||
|
||
# WebStorm | ||
.idea | ||
|
||
# build | ||
# ignore build and dist for now | ||
build | ||
dist | ||
src/**/*.js | ||
src/**/*.js.map |
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,7 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Valor Software | ||
Copyright (c) 2015 Dmitriy Shekhovtsov<[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
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,2 +1,17 @@ | ||
# angular2-bootstrap | ||
Native Angular2 directives for Bootstrap | ||
|
||
## Jump on board! :) | ||
|
||
```bash | ||
npm i | ||
npm start | ||
``` | ||
|
||
### TODO | ||
- [ ] find a better way to detect is event handler is set (see alerts.ts) | ||
- [ ] support `templateUrl` for directives | ||
- [ ] demo page | ||
- [ ] docs | ||
- [ ] support animation | ||
- [ ] publish to npm, bower, etc. |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var gulp = require('gulp'); | ||
var esLint = require('gulp-eslint'); | ||
var tslint = require('gulp-tslint'); | ||
var size = require('gulp-size'); | ||
|
||
var paths = gulp.paths; | ||
|
||
gulp.task('eslint', function() { | ||
return gulp.src(paths.jssrc) | ||
.pipe(esLint({useEslintrc: true})) | ||
.pipe(esLint.format()) | ||
.pipe(esLint.failOnError()); | ||
}); | ||
|
||
gulp.task('tslint', function() { | ||
return gulp.src(paths.tssrc) | ||
.pipe(size({showFiles: true})) | ||
.pipe(tslint()) | ||
.pipe(tslint.report('verbose', { | ||
emitError: true, | ||
reportLimit: 0 | ||
})); | ||
}); | ||
|
||
gulp.task('lint', ['tslint', 'eslint']); |
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/// <reference path="../../../typings/tsd.d.ts" /> | ||
|
||
import { | ||
Component, View, | ||
LifecycleEvent, EventEmitter, | ||
ElementRef, ViewContainerRef, | ||
NgIf, CSSClass | ||
} from 'angular2/angular2'; | ||
|
||
// TODO: templateUrl | ||
@Component({ | ||
selector: 'alert', | ||
properties: ['type', 'dismissOnTimeout: dismiss-on-timeout'], | ||
events: ['close'], | ||
lifecycle: [LifecycleEvent.onInit] | ||
}) | ||
@View({ | ||
template: ` | ||
<div class="alert" role="alert" [class]="classes" *ng-if="!closed"> | ||
<button *ng-if="closeable" type="button" class="close" (^click)="onClose($event)"> | ||
<span aria-hidden="true">×</span> | ||
<span class="sr-only">Close</span> | ||
</button> | ||
<ng-content></ng-content> | ||
</div> | ||
`, | ||
directives: [NgIf, CSSClass] | ||
}) | ||
export class AlertComponent { | ||
type:string; | ||
close:EventEmitter; | ||
templateUrl:string; | ||
dismissOnTimeout:number; | ||
private closed:boolean; | ||
private closeable:boolean; | ||
private classes:Array<string> = []; | ||
|
||
constructor(public el:ElementRef) { | ||
this.close = new EventEmitter(); | ||
this.closeable = el.nativeElement.getAttribute('(close)'); | ||
} | ||
|
||
onInit() { | ||
this.type = this.type || 'warning'; | ||
this.classes[0] = 'alert-' + (this.type || 'warning'); | ||
if (this.closeable) { | ||
this.classes[1] = 'alert-dismissible'; | ||
} | ||
|
||
if (this.dismissOnTimeout) { | ||
let close = this.onClose.bind(this); | ||
setTimeout(close, this.dismissOnTimeout); | ||
} | ||
} | ||
|
||
// todo: mouse event + touch + pointer | ||
onClose($event:any) { | ||
this.close.next($event); | ||
this.closed = true; | ||
} | ||
} |
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
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,56 @@ | ||
{ | ||
"rules": { | ||
"class-name": true, | ||
"comment-format": [true, "check-space"], | ||
"curly": true, | ||
"eofline": true, | ||
"forin": true, | ||
"indent": [true, "spaces"], | ||
"label-position": true, | ||
"label-undefined": true, | ||
"max-line-length": [true, 140], | ||
"no-arg": true, | ||
"no-bitwise": true, | ||
"no-console": [true, | ||
"debug", | ||
"info", | ||
"time", | ||
"timeEnd", | ||
"trace" | ||
], | ||
"no-construct": true, | ||
"no-debugger": true, | ||
"no-duplicate-key": true, | ||
"no-duplicate-variable": true, | ||
"no-empty": true, | ||
"no-eval": true, | ||
"no-shadowed-variable": true, | ||
"no-string-literal": true, | ||
"no-switch-case-fall-through": true, | ||
"no-trailing-comma": true, | ||
"no-trailing-whitespace": true, | ||
"no-unused-expression": true, | ||
"no-unused-variable": false, | ||
"no-unreachable": true, | ||
"no-use-before-declare": true, | ||
"no-var-keyword": true, | ||
"one-line": [true, | ||
"check-open-brace", | ||
"check-catch", | ||
"check-else", | ||
"check-whitespace" | ||
], | ||
"quotemark": [true, "single"], | ||
"radix": true, | ||
"semicolon": true, | ||
"sort-object-literal-keys": false, | ||
"triple-equals": [true, "allow-null-check"], | ||
"variable-name": false, | ||
"whitespace": [true, | ||
"check-branch", | ||
"check-decl", | ||
"check-operator", | ||
"check-separator" | ||
] | ||
} | ||
} |
Oops, something went wrong.