Skip to content

Commit

Permalink
upgrade support 2.0.0-rc.5
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyang041060120 committed Aug 19, 2016
1 parent f2e5345 commit b4fed1f
Show file tree
Hide file tree
Showing 25 changed files with 231 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea/
node_modules/
typings/
dist/
4 changes: 1 addition & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.idea/
app/
example/
node_modules/
typings/
.gitignore
index.html
tsconfig.json
typings.json
webpack.config.js
logo.png
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@ npm install angular2-ui-switch --save
# Usage

```javascript
import { Component } from '@angular/core';
import { UiSwitchComponent } from 'angular2-ui-switch';

@Component({
selector: 'app',
template: `
<ui-switch></ui-switch>
`,
directives: [UiSwitchComponent]
import { UiSwitchModule } from 'angular2-ui-switch'
import { AppComponent } from './app.component';

@NgModule({
imports: [BrowserModule, FormsModule, UiSwitchModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppComponent {
export class AppModule {
}
```

```html
<ui-switch></ui-switch>
```

# Params

### checked
Expand All @@ -38,7 +40,8 @@ export class AppComponent {
> default: false
```html
<ui-switch [checked]="true"></ui-switch>
<ui-switch checked></ui-switch>
<ui-switch [checked]="false"></ui-switch>
```

### disabled
Expand All @@ -48,7 +51,14 @@ export class AppComponent {
> default: false
```html
<ui-switch [disabled]="true"></ui-switch>
<ui-switch disabled></ui-switch>
<ui-switch checked [disabled]="true"></ui-switch>
```

### two way binding

```html
<ui-switch [(ngModel)]="enable"></ui-switch>
```

### change
Expand All @@ -58,7 +68,7 @@ export class AppComponent {
> default: noop
```html
<ui-switch (change)="enable = $event"></ui-switch>
<ui-switch (change)="onChange($event)"></ui-switch>
```

### size
Expand All @@ -67,12 +77,9 @@ export class AppComponent {
> default: medium
```html
<ui-switch size="large"></ui-switch>
```

```html
<ui-switch size="small"></ui-switch>
<ui-switch size="large"></ui-switch>
```

### color
Expand Down
18 changes: 0 additions & 18 deletions app/app.html

This file was deleted.

5 changes: 0 additions & 5 deletions app/main.ts

This file was deleted.

2 changes: 2 additions & 0 deletions example/dist/bundle.js

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

1 change: 1 addition & 0 deletions example/dist/bundle.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions example/dist/polyfills.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/dist/polyfills.js.map

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions example/dist/vendor.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/dist/vendor.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions example/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './src/app.module';

platformBrowserDynamic().bootstrapModule(AppModule);
2 changes: 2 additions & 0 deletions example/polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import 'reflect-metadata';
import 'zone.js/dist/zone';
16 changes: 10 additions & 6 deletions app/app.component.ts → example/src/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { Component, OnInit } from '@angular/core';

import { UiSwitchComponent } from '../src/ui-switch.component';

@Component({
selector: 'app',
template: require('./app.html'),
directives: [UiSwitchComponent]
template: require('./app.html')
})
export class AppComponent implements OnInit {
enable: boolean = false;
enable: boolean = true;
count: number = 0;

constructor() {

}

ngOnInit() {

}

onSubmit() {
}

onChange() {
this.count++;
}
}
34 changes: 34 additions & 0 deletions example/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<h3>checked</h3>
<p>
<ui-switch checked></ui-switch>
<ui-switch [checked]="false"></ui-switch>
</p>
<h3>disabled</h3>
<p>
<ui-switch disabled></ui-switch>
<ui-switch checked [disabled]="true"></ui-switch>
</p>

<h3>two way binding</h3>
<p>
<ui-switch [(ngModel)]="enable"></ui-switch> {{enable}}
</p>

<h3>change</h3>
<p>
<ui-switch (change)="onChange()"></ui-switch> change count {{count}}
</p>

<h3>size</h3>
<p>
<ui-switch size="small"></ui-switch>
<ui-switch></ui-switch>
<ui-switch size="large"></ui-switch>
</p>

<h3>color</h3>
<p>
<ui-switch></ui-switch>
<ui-switch color="blue"></ui-switch>
<ui-switch color="red"></ui-switch>
</p>
14 changes: 14 additions & 0 deletions example/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';

import { UiSwitchModule } from '../../src'
import { AppComponent } from './app.component';

@NgModule({
imports: [BrowserModule, FormsModule, UiSwitchModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {
}
7 changes: 2 additions & 5 deletions app/vendor.ts → example/vendor.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import 'reflect-metadata';
import 'zone.js/dist/zone';

import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/core';
import '@angular/compiler';
import '@angular/common';
import '@angular/http';

import 'rxjs';
import '@angular/forms';
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<app></app>

<script src="/webpack-dev-server.js"></script>
<script src="/dist/vendor.js"></script>
<script src="/dist/bundle.js"></script>
<script src="/example/dist/polyfills.js"></script>
<script src="/example/dist/vendor.js"></script>
<script src="/example/dist/bundle.js"></script>
</body>
</html>
1 change: 0 additions & 1 deletion index.ts

This file was deleted.

41 changes: 18 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "angular2-ui-switch",
"version": "1.0.5",
"version": "1.1.0",
"description": "switch button for angular2",
"main": "index.js",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --config webpack.config.js --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base",
"demo": "webpack --config webpack.config.js --inline --progress --profile --colors --display-error-details --display-cached --content-base",
"typings": "typings install",
"tsc": "tsc --project . --declaration",
"dev": "webpack-dev-server --config webpack.config.js --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base",
"example": "webpack --config webpack.config.js --inline --progress --profile --colors --display-error-details --display-cached --content-base",
"tsc": "tsc --rootDir src --outDir dist --declaration",
"prebuild": "rimraf dist",
"build": "npm run tsc",
"prepublish": "npm run build"
},
Expand All @@ -26,31 +27,25 @@
],
"dependencies": {},
"devDependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/http": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"angular2-in-memory-web-api": "^0.0.10",
"bootstrap": "~3.3.x",
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/forms": "0.3.0",
"@angular/http": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"@types/jasmine": "^2.2.29",
"@types/node": "^4.0.29",
"raw-loader": "^0.5.1",
"reflect-metadata": "^0.1.3",
"rimraf": "^2.5.4",
"rxjs": "5.0.0-beta.6",
"ts-loader": "^0.8.2",
"typescript": "^1.8.10",
"typings": "^0.8.1",
"typescript": "^2.0.0-beta",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1",
"zone.js": "^0.6.12"
},
"peerDependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1"
},
"bugs": {
"url": "https://github.com/yuyang041060120/angular2-ui-switch/issues"
},
Expand Down
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';

import { UiSwitchComponent } from './ui-switch.component';

@NgModule({
declarations: [UiSwitchComponent],
exports: [UiSwitchComponent]
})
export class UiSwitchModule {
}
Loading

0 comments on commit b4fed1f

Please sign in to comment.