Merge
This commit is contained in:
commit
9fb4b55c6b
|
@ -0,0 +1,41 @@
|
|||
export const graphRoutes = {
|
||||
routes: [
|
||||
{
|
||||
url: '/index',
|
||||
state: 'index',
|
||||
template: '<customer-index></customer-index>',
|
||||
module: 'compras',
|
||||
description: '',
|
||||
image: '',
|
||||
},
|
||||
{
|
||||
url: '/add',
|
||||
state: 'add',
|
||||
template: '<customer-add></customer-add>',
|
||||
module: 'compras',
|
||||
description: '',
|
||||
image: '',
|
||||
},
|
||||
{
|
||||
url: '/edit',
|
||||
state: 'edit',
|
||||
template: '<customer-edit></customer-edit>',
|
||||
module: 'compras',
|
||||
description: '',
|
||||
image: '',
|
||||
},
|
||||
{
|
||||
url: '/delete',
|
||||
state: 'delete',
|
||||
template: '<customer-delete></customer-delete>',
|
||||
module: 'compras',
|
||||
description: '',
|
||||
image: '',
|
||||
}
|
||||
],
|
||||
|
||||
graphDependendies: {
|
||||
compras:["crud"],
|
||||
crud:[]
|
||||
}
|
||||
};
|
|
@ -1,20 +1,32 @@
|
|||
import * as core from '@salix/core';
|
||||
import * as spliting from './spliting';
|
||||
import {routes} from './fake';
|
||||
|
||||
core.module.config(function($stateProvider, $urlRouterProvider) {
|
||||
|
||||
core.splitingRegister.registerGraph('hello');
|
||||
|
||||
function xxx(route){
|
||||
return function loader($ocLazyLoad, $q){
|
||||
return $q((resolve) => {
|
||||
core.splitingRegister.execute(route.module)
|
||||
spliting[route.module](() => {
|
||||
//resolve($ocLazyLoad.load({name: route.module}));
|
||||
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
$urlRouterProvider.otherwise("/");
|
||||
|
||||
$stateProvider
|
||||
.state('index', {
|
||||
url: "/index",
|
||||
template :'<customer-add></customer-add>',
|
||||
routes.forEach(function(route) {
|
||||
$stateProvider.state(route.state, {
|
||||
url: route.url,
|
||||
template :route.template,
|
||||
resolve: {
|
||||
loader: function($ocLazyLoad, $q){
|
||||
return $q((resolve) => {
|
||||
spliting.crud($ocLazyLoad, resolve);
|
||||
});
|
||||
}
|
||||
loader: xxx(route)
|
||||
}
|
||||
})
|
||||
}, this);
|
||||
});
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
export const crud = (lazy, resolve) => {
|
||||
require.ensure([], () => {
|
||||
var module = require('@salix/crud');
|
||||
resolve(lazy.load({name:'crud'}));
|
||||
}, "salix.crud");
|
||||
};
|
||||
export const compras = () => {
|
||||
import * as core from '@salix/core';
|
||||
|
||||
|
||||
|
||||
export const compras = (cb) => {
|
||||
require.ensure([], () => {
|
||||
require('@salix/compras')
|
||||
cb();
|
||||
}, "salix.compras");
|
||||
};
|
||||
|
||||
export const ventas = () => {
|
||||
require.ensure([], () => {
|
||||
require('@salix/ventas')
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
/**
|
||||
* export public module
|
||||
*/
|
||||
export * from './module';
|
||||
export * from './util';
|
||||
|
||||
export * from './module'
|
||||
export * from './util'
|
||||
|
||||
export {SplitingRegister as splitingRegister} from './splitingregister'
|
||||
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
|
||||
export {NAME as INTERPOLATE,Interpolate} from './interpolate'
|
||||
export {NAME as ROUTESLOADER, RoutesLoader} from './routesLoader'
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
const _SplitingRegister = ()=>{
|
||||
|
||||
var _graph;
|
||||
var dependencies = {};
|
||||
|
||||
return {
|
||||
registerGraph: function(graph){
|
||||
_graph = graph;
|
||||
},
|
||||
register: function(dependency,loader){
|
||||
dependencies[dependecy]=loader;
|
||||
},
|
||||
execute: function(dependency){
|
||||
|
||||
var _array=[];
|
||||
_array.push(dependency);
|
||||
var fist =graph[dependency];
|
||||
|
||||
//TODO:create dependy graph
|
||||
|
||||
|
||||
while(key=array.pop()){
|
||||
dependencies[key]();
|
||||
}
|
||||
|
||||
},
|
||||
write:function(){
|
||||
console.log(_graph);
|
||||
}
|
||||
}
|
||||
};
|
||||
export const SplitingRegister = _SplitingRegister();
|
|
@ -2,3 +2,4 @@ export * from './module';
|
|||
export * from './customer/routes';
|
||||
|
||||
export {NAME as CUSTOMER_INDEX, COMPONENT as CUSTOMER_INDEX_COMPONENT} from './customer/index'
|
||||
export {NAME as CUSTOMER_ADD, COMPONENT as CUSTOMER_ADD_COMPONENT} from './customer/index/add'
|
|
@ -0,0 +1 @@
|
|||
<vn-button text='customer add'></vn-button>
|
|
@ -0,0 +1,16 @@
|
|||
import template from './add.html';
|
||||
import {module} from '../../module';
|
||||
|
||||
export const NAME = 'customerAdd';
|
||||
|
||||
export const COMPONENT = {
|
||||
template: template,
|
||||
bindings :{
|
||||
users: '<'
|
||||
},
|
||||
controller :function($scope, $element, $attrs){
|
||||
console.log(this.users);
|
||||
}
|
||||
};
|
||||
|
||||
module.component(NAME, COMPONENT);
|
|
@ -1 +1 @@
|
|||
<div>index from component</div>
|
||||
<customer-add users="$ctrl.users"></customer-add>
|
|
@ -1,14 +1,13 @@
|
|||
import template from './index.html';
|
||||
import {module} from '../../module';
|
||||
|
||||
export const NAME = 'customerAdd';
|
||||
export const NAME = 'customerIndex';
|
||||
export const COMPONENT = {
|
||||
template: template,
|
||||
controller :function(){
|
||||
this.user = {name: 'world'};
|
||||
this.users = {id:10,name:"xxxx"};
|
||||
}
|
||||
};
|
||||
|
||||
module.component(NAME, COMPONENT);
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
|
||||
export const crud = (cb) => {
|
||||
require.ensure([], () => {
|
||||
require('@salix/crud');
|
||||
cb();
|
||||
}, "salix.crud");
|
||||
};
|
|
@ -0,0 +1,27 @@
|
|||
0 info it worked if it ends with ok
|
||||
1 verbose cli [ '/usr/local/Cellar/node/6.3.1/bin/node',
|
||||
1 verbose cli '/usr/local/bin/npm',
|
||||
1 verbose cli 'run',
|
||||
1 verbose cli 'dev' ]
|
||||
2 info using npm@3.10.3
|
||||
3 info using node@v6.3.1
|
||||
4 verbose stack Error: missing script: dev
|
||||
4 verbose stack at run (/usr/local/lib/node_modules/npm/lib/run-script.js:151:19)
|
||||
4 verbose stack at /usr/local/lib/node_modules/npm/lib/run-script.js:61:5
|
||||
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:356:5
|
||||
4 verbose stack at checkBinReferences_ (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:320:45)
|
||||
4 verbose stack at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:354:3)
|
||||
4 verbose stack at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:124:5)
|
||||
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:311:12
|
||||
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16
|
||||
4 verbose stack at tryToString (fs.js:455:3)
|
||||
4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:442:12)
|
||||
5 verbose cwd /Users/nelo/Documents/node/salix
|
||||
6 error Darwin 16.0.0
|
||||
7 error argv "/usr/local/Cellar/node/6.3.1/bin/node" "/usr/local/bin/npm" "run" "dev"
|
||||
8 error node v6.3.1
|
||||
9 error npm v3.10.3
|
||||
10 error missing script: dev
|
||||
11 error If you need help, you may report this error at:
|
||||
11 error <https://github.com/npm/npm/issues>
|
||||
12 verbose exit [ 1, true ]
|
Loading…
Reference in New Issue