Plantilla proyecto inicial

This commit is contained in:
jgallego 2016-09-29 11:04:11 +02:00
parent ee100502df
commit aa85fade20
31 changed files with 136 additions and 138 deletions

View File

@ -1,6 +1,10 @@
{
"name": "@salix/app",
"version": "1.0.0",
"version": "0.0.0",
"description": "",
"main": "index.js"
"main": "index.js",
"repository": {
"type": "git",
"url": "http://git.verdnatura.es:/salix"
}
}

View File

@ -1,2 +1 @@
export {NAME} from './module'
export * from './config'
import {ng} from '@salix/vendor'

View File

@ -1,6 +0,0 @@
import {module} from './module';
config.$inject = [];
export function config(){
}
module.config(config);

View File

@ -1,5 +0,0 @@
import {ng} from '@salix/vendor';
import * as core from '@salix/core';
export const NAME="vnapp";
export const module=ng.module(NAME,[]);

View File

@ -1,4 +1,2 @@
import * as vendor from '@salix/vendor';
export * from './src/core'

View File

@ -1,9 +1,10 @@
{
"name": "@salix/core",
"version": "1.0.0",
"version": "0.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"angular": "^1.5.8"
}
"main": "index.js",
"repository": {
"type": "git",
"url": "http://git.verdnatura.es:/salix"
}
}

View File

@ -1,3 +0,0 @@
<button type = "button" class="{{className}}" {{enabled}} >
<i class="material-icons">{{icon}} </i>
</button>

View File

@ -1,20 +0,0 @@
import coremodule from '../coremodule';
import util from '../util';
import constant from '../constants';
const DEFAULT_BUTTON = ''; // clase css bootstrap. Pendiente de definir
const DEFAULT_TEXT = constant.BUTTON_NAME;
export const NAME = util.getFactoryName(constant.BUTTON_NAME + constant.BOOTSTRAPFRAMEWORK)
export function factoryBt(){
return{
texto: DEFAULT_TEXT,
className: DEFAULT_BUTTON,
enabled: 'true',
typeName: 'button'
}
};
coremodule.factory(NAME,factoryBt);

View File

@ -0,0 +1,24 @@
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './button.bt.html';
const DEFAULT_CLASS = ''; // clase css bootstrap. Pendiente de definir
const DEFAULT_TEXT = constant.BUTTON_NAME;
export const NAME = util.getFactoryName(constant.BUTTON_NAME + constant.BOOTSTRAPFRAMEWORK) //vnbuttonmtFactory
export function factory() {
return {
template: template,
default: {
texto: DEFAULT_TEXT,
className: DEFAULT_CLASS,
enabled: 'true',
typeName: 'button'
}
}
};
_module.factory(NAME, factory);

View File

@ -1,22 +1,20 @@
import coremodule from '../coremodule';
import resolveFactory from '../resolveDefaultFactoryComponents';
import constant from '../constants';
import interpolate from '../interpolate';
import util from '../util';
import {module as _module} from '../module';
import * as resolveFactory from '../resolveDefaultComponents';
import {BUTTON_NAME} from '../constants';
import * as util from '../util';
const NAME = util.getName(constant.BUTTON_NAME);
export const NAME = util.getName(BUTTON_NAME);
buttonDirective.$inject =[resolveFactory.NAME,interpolate.NAME];
directive.$inject =[resolveFactory.NAME];
export function buttonDirective (resolve,vninterpolate){
export function directive (resolve){
return{
require:'E',
template: function(_,attr){
var scope= Object.assign(resolve.button,attrs);
// return vninterpolate(require(util.getTemplateName(constant.BUTTON_NAME,resolve.name))(scope);
return resolve.getTemplate(BUTTON_NAME,attr);
}
}
}
coremodule.directive(NAME,buttonDirective);
_module.directive(NAME,directive);

View File

@ -1,20 +0,0 @@
import coremodule from '../coremodule';
import util from '../util';
import constant from '../constants';
const DEFAULT_BUTTON = 'mdl-button mdl-js-button mdl-button--raised';
const DEFAULT_TEXT = constant.BUTTON_NAME;
export const NAME = util.getFactoryName(constant.BUTTON_NAME + constant.MATERIALDESIGNFRAMEWORK); //buttonmtFactory
export function factoryMt(){
return{
texto: DEFAULT_TEXT,
className: DEFAULT_BUTTON,
enabled: 'true',
typeName: 'button'
}
};
coremodule.factory(NAME,factoryMt);

View File

@ -0,0 +1,24 @@
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './button.mt.html';
const DEFAULT_CLASS = 'mdl-button mdl-js-button mdl-button--raised';
const DEFAULT_TEXT = constant.BUTTON_NAME;
export const NAME = util.getFactoryName(constant.BUTTON_NAME + constant.MATERIALDESIGNFRAMEWORK); //buttonmtFactory
export function factoryMt() {
return {
template: template,
default: {
texto: DEFAULT_TEXT,
className: DEFAULT_CLASS,
enabled: 'true',
typeName: 'button'
}
}
};
_module.factory(NAME, factoryMt);

View File

@ -1,4 +0,0 @@
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-1">
<input type="checkbox" id="{{model}}" class="mdl-checkbox__input" checked>
<span class="mdl-checkbox__label">Checkbox</span>
</label>

View File

@ -5,4 +5,6 @@ export const MATERIAL_DESIGN_FRAMEWORK = 'mt';
export const BOOTSTRAP_FRAMEWORK = 'bt';
// directive name
export const BUTTON_NAME ='button';
export const BUTTON_ICON_NAME ='buttonIcon';
export const BUTTON_ICON_NAME ='buttonIcon';
//dependency module
export const EMPTYDEPENDECIES=[];

View File

@ -1,4 +1,10 @@
/**
* export public module
*/
export {NAME} from './coremodule';
export {NAME} from './module';
export * from './util';
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
export {NAME as INTERPOLATE,Interpolate} from './interpolate'
export {NAME as BUTTON,directive as ButtonDirective} from './button/button'
export {NAME as BUTTONMT,factory as buttonmt} from './button/button.mt'
export {NAME as BUTTONBT,factory as buttonbt} from './button/button.bt'

View File

@ -1,10 +0,0 @@
import angular from 'angular'
import util from './util'
const DEPENDENCIES ='[]'
export const NAME = util.getModuleName('core');
let moduleCore = angular.module(NAME,DEPENDENCIES);
export default moduleCore;

View File

@ -1,5 +1,5 @@
import coremodule from './coremodule';
import util from './util';
import {module as _module} from './module';
import * as util from './util';
export const NAME = util.getProviderName('interpolate');
@ -164,4 +164,4 @@ export class Interpolate
}
coremodule.provider(NAME,interpolate);
_module.provider(NAME,Interpolate);

View File

@ -0,0 +1,9 @@
import {ng} from '@salix/vendor';
import {EMPTYDEPENDECIES} from './constants';
import {getModuleName} from './util';
export const NAME = getModuleName('core');
export const module = ng.module(NAME,EMPTYDEPENDECIES);

View File

@ -1,3 +0,0 @@
<button class="">
Button
</button>

View File

@ -1,6 +1,7 @@
import coremodule from './coremodule';
import util from './util';
import {module as _module} from './module';
import * as util from './util';
import constant from './constants';
import interpolate from './interpolate';
export const NAME = util.getProviderName('ResolveDefaultComponent');
@ -9,20 +10,28 @@ export class ResolveDefaultComponent {
constructor(){
this._name="mt";
}
set frameworkName(name){
set frameworkName(value){
//mt or bt
this._name = name;
this._frameworkName = value;
}
$get($injector){
$get($injector,interpolate){
//Service Locator
return {
button:function(){
return $injector.get(util.getFactoryName(constant.BUTTON_NAME + this._name)); // butonmtFactory
},
name : this._name
getTemplate:function(name ,attr){
let _name = util.getFactoryName( name + this._frameworkName);
let defaultfactory = $injector.has(_name) ? $injector.get():undefined; // vnbutonmtFactory
if(!defaultfactory)
{
throw new Error("factoty is not defined");
}
let defaultValues = defaultfactory.default;
let template = defaultfactory.template;
let scope = Object.assign(defaultValues || {},attr||{});
return template && interpolate(template)(scope);
}
};
}
}
coremodule.provider(NAME,ResolveDefaultComponent)
_module.provider(NAME,ResolveDefaultComponent)

View File

@ -1,3 +0,0 @@
<button class="">
Button
</button>

View File

@ -1,3 +0,0 @@
<button class="">
Button
</button>

View File

@ -1,4 +1,4 @@
import constant from './constants';
import * as constant from './constants';
const FACTORY = 'Factory';
const SERVICE = 'Service';

View File

@ -1 +1 @@
import * as vendor from './src/vendor';
export * from './src/vendor';

View File

@ -1,10 +1,9 @@
{
"name": "@salix/vendor",
"version": "1.0.0",
"version": "0.0.0",
"description": "",
"dependencies": {
"angular": "^1.5.8",
"angular-ui-router": "^0.3.1",
"oclazyload": "^1.0.9"
}
"repository": {
"type": "git",
"url": "http://git.verdnatura.es:/salix"
}
}

View File

@ -1,6 +1,6 @@
import * as angular from 'angular';
import * as _angular from 'angular';
export const ng = {
module: angular.module,
bootstrap: angular.bootstrap
module: _angular.module,
bootstrap: _angular.bootstrap
}

View File

@ -1,7 +1,7 @@
import * as oclazyload from 'oclazyload';
import * as _oclazyload from 'oclazyload';
import {getComponentName} from './util';
export const oclazyloadVendor = {
export const oclazyload = {
name: 'oc.lazyLoad',
oclazyload: getComponentName('$ocLazyLoad')
oclazyload: getComponentName('$ocLazyLoad',true)
}

View File

@ -1,7 +1,7 @@
import * as angularuirouter from 'angular-ui-router';
import * as _uirouter from 'angular-ui-router';
import {getComponentName} from './util';
export const uirouter = {
name: 'ui.router',
state: getComponentName('$state')
state: getComponentName('$state',true)
}

View File

@ -3,7 +3,12 @@
<head>
<title>Salix</title>
</head>
<div id ="app">
</div>
<body>
<script type="text/javascript" src="build/salix.vendor.js"></script>
<script type="text/javascript" src="build/salix.core.js"></script>
<script type="text/javascript" src="build/salix.app.js"></script>
</body>
</html>

View File

@ -9,7 +9,9 @@
"url": "http://git.verdnatura.es:/salix"
},
"dependencies": {
"angular": "^1.5.8"
"angular": "^1.5.8",
"angular-ui-router": "^0.3.1",
"oclazyload": "^1.0.9"
},
"devDependencies": {
"webpack": "*",
@ -17,13 +19,9 @@
"babel-core": "*",
"babel-preset-es2015": "*",
"babel-loader": "*",
"css-loader": "*",
"file-loader": "*",
"json-loader": "*",
"style-loader": "*",
"raw-loader": "*"
},
"scripts": {
"build": "rm build/* ; webpack --progress --colors"
"build": "webpack --progress --colors"
}
}
}

View File

@ -32,7 +32,6 @@ module.exports =
resolve: {
modulesDirectories: [
__dirname,
'src',
'node_modules'
]
},