From aa85fade20afcd3a3e0c43e2702b1340c02ac084 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 29 Sep 2016 11:04:11 +0200 Subject: [PATCH] Plantilla proyecto inicial --- @salix/app/package.json | 8 +++-- @salix/app/src/app.js | 3 +- @salix/app/src/config.js | 6 ---- @salix/app/src/module.js | 5 ---- @salix/core/index.js | 2 -- @salix/core/package.json | 11 +++---- .../core/src/button-icon/button-icon.mt.html | 3 -- @salix/core/src/button/button.bt.default.js | 20 ------------- @salix/core/src/button/button.bt.js | 24 +++++++++++++++ @salix/core/src/button/button.js | 20 ++++++------- @salix/core/src/button/button.mt.default.js | 20 ------------- @salix/core/src/button/button.mt.js | 24 +++++++++++++++ @salix/core/src/checkbox/checkbox.mt.html | 4 --- @salix/core/src/constants.js | 4 ++- @salix/core/src/core.js | 8 ++++- @salix/core/src/coremodule.js | 10 ------- @salix/core/src/interpolate.js | 6 ++-- @salix/core/src/module.js | 9 ++++++ @salix/core/src/radiobutton/button.mt.html | 3 -- @salix/core/src/resolveDefaultComponents.js | 29 ++++++++++++------- @salix/core/src/text/button.mt.html | 3 -- @salix/core/src/textfield/button.mt.html | 3 -- @salix/core/src/util.js | 2 +- @salix/vendor/index.js | 2 +- @salix/vendor/package.json | 11 ++++--- @salix/vendor/src/angular-vendor.js | 6 ++-- @salix/vendor/src/oclazyload-vendor.js | 6 ++-- @salix/vendor/src/uirouter-vendor.js | 4 +-- index.html | 5 ++++ package.json | 12 ++++---- webpack.config.js | 1 - 31 files changed, 136 insertions(+), 138 deletions(-) delete mode 100644 @salix/app/src/config.js delete mode 100644 @salix/app/src/module.js delete mode 100644 @salix/core/src/button-icon/button-icon.mt.html delete mode 100644 @salix/core/src/button/button.bt.default.js create mode 100644 @salix/core/src/button/button.bt.js delete mode 100644 @salix/core/src/button/button.mt.default.js create mode 100644 @salix/core/src/button/button.mt.js delete mode 100644 @salix/core/src/checkbox/checkbox.mt.html delete mode 100644 @salix/core/src/coremodule.js create mode 100644 @salix/core/src/module.js delete mode 100644 @salix/core/src/radiobutton/button.mt.html delete mode 100644 @salix/core/src/text/button.mt.html delete mode 100644 @salix/core/src/textfield/button.mt.html diff --git a/@salix/app/package.json b/@salix/app/package.json index e58e3937b..76f7c4784 100644 --- a/@salix/app/package.json +++ b/@salix/app/package.json @@ -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" + } } diff --git a/@salix/app/src/app.js b/@salix/app/src/app.js index 45ae7606e..e9fa3dc62 100644 --- a/@salix/app/src/app.js +++ b/@salix/app/src/app.js @@ -1,2 +1 @@ -export {NAME} from './module' -export * from './config' \ No newline at end of file +import {ng} from '@salix/vendor' \ No newline at end of file diff --git a/@salix/app/src/config.js b/@salix/app/src/config.js deleted file mode 100644 index a222419a7..000000000 --- a/@salix/app/src/config.js +++ /dev/null @@ -1,6 +0,0 @@ -import {module} from './module'; -config.$inject = []; -export function config(){ - -} -module.config(config); \ No newline at end of file diff --git a/@salix/app/src/module.js b/@salix/app/src/module.js deleted file mode 100644 index 336c5302d..000000000 --- a/@salix/app/src/module.js +++ /dev/null @@ -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,[]); diff --git a/@salix/core/index.js b/@salix/core/index.js index 4b0516a4c..064800130 100644 --- a/@salix/core/index.js +++ b/@salix/core/index.js @@ -1,4 +1,2 @@ -import * as vendor from '@salix/vendor'; - export * from './src/core' diff --git a/@salix/core/package.json b/@salix/core/package.json index cdbf81e2b..626726422 100644 --- a/@salix/core/package.json +++ b/@salix/core/package.json @@ -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" + } } diff --git a/@salix/core/src/button-icon/button-icon.mt.html b/@salix/core/src/button-icon/button-icon.mt.html deleted file mode 100644 index 336abbf85..000000000 --- a/@salix/core/src/button-icon/button-icon.mt.html +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/@salix/core/src/button/button.bt.default.js b/@salix/core/src/button/button.bt.default.js deleted file mode 100644 index 62876db7d..000000000 --- a/@salix/core/src/button/button.bt.default.js +++ /dev/null @@ -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); \ No newline at end of file diff --git a/@salix/core/src/button/button.bt.js b/@salix/core/src/button/button.bt.js new file mode 100644 index 000000000..9de37f1fa --- /dev/null +++ b/@salix/core/src/button/button.bt.js @@ -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); \ No newline at end of file diff --git a/@salix/core/src/button/button.js b/@salix/core/src/button/button.js index ccb3a3f87..451cd0f80 100644 --- a/@salix/core/src/button/button.js +++ b/@salix/core/src/button/button.js @@ -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); diff --git a/@salix/core/src/button/button.mt.default.js b/@salix/core/src/button/button.mt.default.js deleted file mode 100644 index 432f35e78..000000000 --- a/@salix/core/src/button/button.mt.default.js +++ /dev/null @@ -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); \ No newline at end of file diff --git a/@salix/core/src/button/button.mt.js b/@salix/core/src/button/button.mt.js new file mode 100644 index 000000000..8df62bc37 --- /dev/null +++ b/@salix/core/src/button/button.mt.js @@ -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); \ No newline at end of file diff --git a/@salix/core/src/checkbox/checkbox.mt.html b/@salix/core/src/checkbox/checkbox.mt.html deleted file mode 100644 index b1354b4f7..000000000 --- a/@salix/core/src/checkbox/checkbox.mt.html +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/@salix/core/src/constants.js b/@salix/core/src/constants.js index 8a2ed0691..54088e881 100644 --- a/@salix/core/src/constants.js +++ b/@salix/core/src/constants.js @@ -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'; \ No newline at end of file +export const BUTTON_ICON_NAME ='buttonIcon'; +//dependency module +export const EMPTYDEPENDECIES=[]; \ No newline at end of file diff --git a/@salix/core/src/core.js b/@salix/core/src/core.js index a4de8bf0e..511f8e75b 100644 --- a/@salix/core/src/core.js +++ b/@salix/core/src/core.js @@ -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' diff --git a/@salix/core/src/coremodule.js b/@salix/core/src/coremodule.js deleted file mode 100644 index 48f19cdb3..000000000 --- a/@salix/core/src/coremodule.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/@salix/core/src/interpolate.js b/@salix/core/src/interpolate.js index 2c1cb8aa6..b620667b3 100644 --- a/@salix/core/src/interpolate.js +++ b/@salix/core/src/interpolate.js @@ -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); \ No newline at end of file +_module.provider(NAME,Interpolate); \ No newline at end of file diff --git a/@salix/core/src/module.js b/@salix/core/src/module.js new file mode 100644 index 000000000..08809e875 --- /dev/null +++ b/@salix/core/src/module.js @@ -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); + diff --git a/@salix/core/src/radiobutton/button.mt.html b/@salix/core/src/radiobutton/button.mt.html deleted file mode 100644 index 767488942..000000000 --- a/@salix/core/src/radiobutton/button.mt.html +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/@salix/core/src/resolveDefaultComponents.js b/@salix/core/src/resolveDefaultComponents.js index cf2be50f9..563361f74 100644 --- a/@salix/core/src/resolveDefaultComponents.js +++ b/@salix/core/src/resolveDefaultComponents.js @@ -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) diff --git a/@salix/core/src/text/button.mt.html b/@salix/core/src/text/button.mt.html deleted file mode 100644 index 767488942..000000000 --- a/@salix/core/src/text/button.mt.html +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/@salix/core/src/textfield/button.mt.html b/@salix/core/src/textfield/button.mt.html deleted file mode 100644 index 767488942..000000000 --- a/@salix/core/src/textfield/button.mt.html +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/@salix/core/src/util.js b/@salix/core/src/util.js index 4e72aecb1..e92258ea1 100644 --- a/@salix/core/src/util.js +++ b/@salix/core/src/util.js @@ -1,4 +1,4 @@ -import constant from './constants'; +import * as constant from './constants'; const FACTORY = 'Factory'; const SERVICE = 'Service'; diff --git a/@salix/vendor/index.js b/@salix/vendor/index.js index 9af386389..a3d037373 100644 --- a/@salix/vendor/index.js +++ b/@salix/vendor/index.js @@ -1 +1 @@ -import * as vendor from './src/vendor'; \ No newline at end of file +export * from './src/vendor'; \ No newline at end of file diff --git a/@salix/vendor/package.json b/@salix/vendor/package.json index 98161f76f..961627e86 100644 --- a/@salix/vendor/package.json +++ b/@salix/vendor/package.json @@ -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" + } } diff --git a/@salix/vendor/src/angular-vendor.js b/@salix/vendor/src/angular-vendor.js index 19275df4a..8196ff52a 100644 --- a/@salix/vendor/src/angular-vendor.js +++ b/@salix/vendor/src/angular-vendor.js @@ -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 } diff --git a/@salix/vendor/src/oclazyload-vendor.js b/@salix/vendor/src/oclazyload-vendor.js index 9cc929e9b..9dcca2f2c 100644 --- a/@salix/vendor/src/oclazyload-vendor.js +++ b/@salix/vendor/src/oclazyload-vendor.js @@ -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) } diff --git a/@salix/vendor/src/uirouter-vendor.js b/@salix/vendor/src/uirouter-vendor.js index ec106c1ce..c24de02b5 100644 --- a/@salix/vendor/src/uirouter-vendor.js +++ b/@salix/vendor/src/uirouter-vendor.js @@ -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) } diff --git a/index.html b/index.html index 773c0b887..774ef01c5 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,12 @@ Salix +
+ +
+ + diff --git a/package.json b/package.json index 5b20983b9..2be0cf4bd 100644 --- a/package.json +++ b/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" } -} +} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 2f36df142..1565843b0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -32,7 +32,6 @@ module.exports = resolve: { modulesDirectories: [ __dirname, - 'src', 'node_modules' ] },