Skip to content

Commit

Permalink
feat(valueAccessor): created new example for value accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Apr 10, 2017
1 parent 059a0f9 commit 20bd211
Show file tree
Hide file tree
Showing 41 changed files with 4,539 additions and 0 deletions.
57 changes: 57 additions & 0 deletions examples/controlAccessor/.angular-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "control-accessor"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
13 changes: 13 additions & 0 deletions examples/controlAccessor/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
42 changes: 42 additions & 0 deletions examples/controlAccessor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
28 changes: 28 additions & 0 deletions examples/controlAccessor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ControlAccessor

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Before running the tests make sure you are serving the app via `ng serve`.

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
13 changes: 13 additions & 0 deletions examples/controlAccessor/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"cart": [
{ "product_id": 1, "quantity": 10 },
{ "product_id": 3, "quantity": 50 }
],
"products": [
{ "id": 1, "price": 2800, "name": "MacBook Pro" },
{ "id": 2, "price": 50, "name": "USB-C Adaptor" },
{ "id": 3, "price": 400, "name": "iPod" },
{ "id": 4, "price": 900, "name": "iPhone" },
{ "id": 5, "price": 600, "name": "Apple Watch" }
]
}
14 changes: 14 additions & 0 deletions examples/controlAccessor/e2e/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ControlAccessorPage } from './app.po';

describe('control-accessor App', () => {
let page: ControlAccessorPage;

beforeEach(() => {
page = new ControlAccessorPage();
});

it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
});
11 changes: 11 additions & 0 deletions examples/controlAccessor/e2e/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { browser, element, by } from 'protractor';

export class ControlAccessorPage {
navigateTo() {
return browser.get('/');
}

getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
12 changes: 12 additions & 0 deletions examples/controlAccessor/e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types":[
"jasmine",
"node"
]
}
}
47 changes: 47 additions & 0 deletions examples/controlAccessor/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "control-accessor",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"backend":"json-server --watch db.json --port 4200",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}
3 changes: 3 additions & 0 deletions examples/controlAccessor/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"/api/": "/"
}
10 changes: 10 additions & 0 deletions examples/controlAccessor/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div>
<stock-inventory></stock-inventory>
</div>
`
})
export class AppComponent {}
20 changes: 20 additions & 0 deletions examples/controlAccessor/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { StockInventoryModule } from './stock-inventory/stock-inventory.module';

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

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
StockInventoryModule
],
bootstrap: [
AppComponent
]
})
export class AppModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:host {
border-bottom: 1px solid #ccc;
margin: 0 0 20px;
padding: 0 0 20px;
display: block;
}
.error {
background: #B52D30;
color: #fff;
font-weight: 500;
font-size: 12px;
text-transform: uppercase;
border-radius: 0 0 3px 3px;
line-height: 1;
padding: 6px 10px;
margin-top: -1px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component, Input } from '@angular/core';
import { FormGroup } from '@angular/forms';

@Component({
selector: 'stock-branch',
styleUrls: ['stock-branch.component.scss'],
template: `
<div [formGroup]="parent">
<div formGroupName="store">
<input
type="text"
placeholder="Branch ID"
formControlName="branch">
<input
type="text"
placeholder="Manager Code"
formControlName="code">
</div>
</div>
`
})
export class StockBranchComponent {
@Input()
parent: FormGroup;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.stock-counter {
background: rgba(0, 0, 0, 0.05);
border-radius: 3px;
overflow: hidden;
& > div > div {
display: flex;
align-items: center;

& > div {
display: flex;
flex-direction: column;
}
}

p {
font-size: 16px;
font-weight: 400;
text-align: center;
width: 50px;
}

button {
padding: 3px;
border-radius: 0;
line-height: 1;
padding: 3px 7px;
background: #9E61C8;
color: #fff;
font-weight: 500;
&:disabled {
background: rgba(0, 0, 0, 0.1);
color: rgba(0, 0, 0, 0.4);
}
}
}

0 comments on commit 20bd211

Please sign in to comment.