Plantilla proyecto inicial
This commit is contained in:
parent
ee100502df
commit
aa85fade20
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
export {NAME} from './module'
|
||||
export * from './config'
|
||||
import {ng} from '@salix/vendor'
|
|
@ -1,6 +0,0 @@
|
|||
import {module} from './module';
|
||||
config.$inject = [];
|
||||
export function config(){
|
||||
|
||||
}
|
||||
module.config(config);
|
|
@ -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,[]);
|
|
@ -1,4 +1,2 @@
|
|||
import * as vendor from '@salix/vendor';
|
||||
|
||||
export * from './src/core'
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<button type = "button" class="{{className}}" {{enabled}} >
|
||||
<i class="material-icons">{{icon}} </i>
|
||||
</button>
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
|
@ -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);
|
|
@ -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>
|
|
@ -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=[];
|
|
@ -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'
|
||||
|
|
|
@ -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;
|
|
@ -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);
|
|
@ -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);
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
<button class="">
|
||||
Button
|
||||
</button>
|
|
@ -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)
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<button class="">
|
||||
Button
|
||||
</button>
|
|
@ -1,3 +0,0 @@
|
|||
<button class="">
|
||||
Button
|
||||
</button>
|
|
@ -1,4 +1,4 @@
|
|||
import constant from './constants';
|
||||
import * as constant from './constants';
|
||||
|
||||
const FACTORY = 'Factory';
|
||||
const SERVICE = 'Service';
|
||||
|
|
|
@ -1 +1 @@
|
|||
import * as vendor from './src/vendor';
|
||||
export * from './src/vendor';
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
12
package.json
12
package.json
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,7 +32,6 @@ module.exports =
|
|||
resolve: {
|
||||
modulesDirectories: [
|
||||
__dirname,
|
||||
'src',
|
||||
'node_modules'
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue