Commit d96ed6a1 authored by Grand Francois's avatar Grand Francois
Browse files

intégration de la lib jalhyd et 1ère version d'un composant de saisie d'un paramètre hydraulique

Showing with 183 additions and 35 deletions
+183 -35
......@@ -29,21 +29,21 @@
"@angular/core": "~4.0.0",
"@angular/forms": "~4.0.0",
"@angular/http": "~4.0.0",
"@angular/material": "^2.0.0-beta.7",
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",
"angular-in-memory-web-api": "~0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.8.4"
"zone.js": "^0.8.4",
"jalhyd": "^1.0.0"
},
"devDependencies": {
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"typescript": "~2.1.0",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
......@@ -55,9 +55,8 @@
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"@types/node": "^6.0.46",
"@types/jasmine": "2.5.36"
},
"repository": {}
}
}
\ No newline at end of file
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<h1>Hello {{name}}</h1>`,
selector: 'nghyd-app',
template: `
<h1>{{title}}</h1>
<param-input symbol="Q"></param-input>
<param-input symbol="Ks"></param-input>
`,
})
export class AppComponent { name = 'Angular'; }
export class AppComponent {
title = "Calculette hydro";
}
import { NgModule } from '@angular/core';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms'; // <-- NgModel lives here
import { AppComponent } from './app.component';
import { AppComponent } from './app.component';
import { ParamInputComponent } from './param-input/param-input.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
imports: [
BrowserModule,
FormsModule // <-- import the FormsModule before binding with [(ngModel)]
],
declarations: [
AppComponent,
ParamInputComponent
],
bootstrap: [AppComponent]
})
export class AppModule { }
<div>
<label>{{_paramDef.symbol}}</label>
<input [(ngModel)]="_paramDef.v" />
</div>
<!--
<md-input-container>
<input mdInput placeholder="{{_paramDef.symbol}}" value="{{_paramDef.v}}">
</md-input-container>
-->
\ No newline at end of file
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var param_service_1 = require("../param-service/param.service");
var ParamInputComponent = (function () {
function ParamInputComponent(paramService) {
this.paramService = paramService;
}
ParamInputComponent.prototype.ngOnInit = function () {
this._paramDef = this.paramService.getParameter(this._paramSymbol);
};
return ParamInputComponent;
}());
__decorate([
core_1.Input('symbol'),
__metadata("design:type", String)
], ParamInputComponent.prototype, "_paramSymbol", void 0);
ParamInputComponent = __decorate([
core_1.Component({
selector: "param-input[symbol]",
templateUrl: "./param-input.component.html",
providers: [param_service_1.ParamService]
}),
__metadata("design:paramtypes", [param_service_1.ParamService])
], ParamInputComponent);
exports.ParamInputComponent = ParamInputComponent;
//# sourceMappingURL=param-input.component.js.map
\ No newline at end of file
{"version":3,"file":"param-input.component.js","sourceRoot":"","sources":["param-input.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAAyD;AAIzD,gEAA8D;AAO9D,IAAa,mBAAmB;IAQ5B,6BAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAI,CAAC;IAEnD,sCAAQ,GAAR;QACI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACvE,CAAC;IACL,0BAAC;AAAD,CAAC,AAbD,IAaC;AAToB;IAAhB,YAAK,CAAC,QAAQ,CAAC;;yDAAsB;AAJ7B,mBAAmB;IAL/B,gBAAS,CAAC;QACP,QAAQ,EAAE,qBAAqB;QAC/B,WAAW,EAAE,8BAA8B;QAC3C,SAAS,EAAE,CAAC,4BAAY,CAAC;KAC5B,CAAC;qCASoC,4BAAY;GARrC,mBAAmB,CAa/B;AAbY,kDAAmB"}
\ No newline at end of file
import { Component, Input, OnInit } from '@angular/core';
import { ParamDefinition } from 'jalhyd';
import { ParamService } from '../param-service/param.service';
@Component({
selector: "param-input[symbol]",
templateUrl: "./param-input.component.html",
providers: [ParamService]
})
export class ParamInputComponent implements OnInit {
/**
* Parameter symbol (Q, Ks, B, ...)
*/
@Input('symbol') _paramSymbol: string;
private _paramDef: ParamDefinition;
constructor(private paramService: ParamService) { }
ngOnInit(): void {
this._paramDef = this.paramService.getParameter(this._paramSymbol);
}
}
//import { Injectable } from '@angular/core';
"use strict";
var jalhyd_1 = require("jalhyd");
//@Injectable()
var ParamService = (function () {
function ParamService() {
this._params = [new jalhyd_1.ParamDefinition('Q', jalhyd_1.ParamDomainValue.POS_NULL, 0),
new jalhyd_1.ParamDefinition('Ks', jalhyd_1.ParamDomainValue.POS, 1)];
}
ParamService.prototype.getParameter = function (s) {
for (var _i = 0, _a = this._params; _i < _a.length; _i++) {
var p = _a[_i];
if (p.symbol == s)
return p;
}
return undefined;
};
return ParamService;
}());
exports.ParamService = ParamService;
//# sourceMappingURL=param.service.js.map
\ No newline at end of file
{"version":3,"file":"param.service.js","sourceRoot":"","sources":["param.service.ts"],"names":[],"mappings":"AAAA,6CAA6C;;AAE7C,iCAA2D;AAE3D,eAAe;AACf;IAGI;QACI,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,wBAAe,CAAC,GAAG,EAAE,yBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtE,IAAI,wBAAe,CAAC,IAAI,EAAE,yBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,mCAAY,GAAZ,UAAa,CAAS;QAClB,GAAG,CAAC,CAAU,UAAY,EAAZ,KAAA,IAAI,CAAC,OAAO,EAAZ,cAAY,EAAZ,IAAY;YAArB,IAAI,CAAC,SAAA;YACN,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;gBACd,MAAM,CAAC,CAAC,CAAC;SAChB;QAED,MAAM,CAAC,SAAS,CAAC;IACrB,CAAC;IACL,mBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,oCAAY"}
\ No newline at end of file
"use strict";
var jalhyd_1 = require("jalhyd");
var ParamService = (function () {
function ParamService() {
this._params = [new jalhyd_1.ParamDefinition('Q', jalhyd_1.ParamDomainValue.POS_NULL, 0),
new jalhyd_1.ParamDefinition('Ks', jalhyd_1.ParamDomainValue.POS, 1)];
}
ParamService.prototype.getParameter = function (s) {
for (var _i = 0, _a = this._params; _i < _a.length; _i++) {
var p = _a[_i];
if (p.symbol == s)
return p;
}
return undefined;
};
return ParamService;
}());
exports.ParamService = ParamService;
//# sourceMappingURL=param.service.js.map
\ No newline at end of file
{"version":3,"file":"param.service.js","sourceRoot":"","sources":["param.service.ts"],"names":[],"mappings":";AAAA,iCAA2D;AAE3D;IAGI;QACI,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,wBAAe,CAAC,GAAG,EAAE,yBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtE,IAAI,wBAAe,CAAC,IAAI,EAAE,yBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,mCAAY,GAAZ,UAAa,CAAS;QAClB,GAAG,CAAC,CAAU,UAAY,EAAZ,KAAA,IAAI,CAAC,OAAO,EAAZ,cAAY,EAAZ,IAAY;YAArB,IAAI,CAAC,SAAA;YACN,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;gBACd,MAAM,CAAC,CAAC,CAAC;SAChB;QAED,MAAM,CAAC,SAAS,CAAC;IACrB,CAAC;IACL,mBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,oCAAY"}
\ No newline at end of file
import { ParamDefinition, ParamDomainValue } from 'jalhyd';
export class ParamService {
private _params: ParamDefinition[];
constructor() {
this._params = [new ParamDefinition('Q', ParamDomainValue.POS_NULL, 0),
new ParamDefinition('Ks', ParamDomainValue.POS, 1)];
}
getParameter(s: string): ParamDefinition {
for (let p of this._params) {
if (p.symbol == s)
return p;
}
return undefined;
}
}
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<head>
<base href="/">
<title>NgHyd - Calculette hydro</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>
</head>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<body>
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function (err) { console.error(err); });
</script>
</head>
<body>
<nghyd-app></nghyd-app>
</body>
</html>
\ No newline at end of file
......@@ -24,8 +24,9 @@
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'jalhyd': 'npm:jalhyd'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
......@@ -39,7 +40,8 @@
},
rxjs: {
defaultExtension: 'js'
}
},
'jalhyd': { main: 'build/index.js', defaultExtension: 'js' }
}
});
})(this);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment