Initial commit
This commit is contained in:
commit
8332027bf9
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
build
|
|
@ -0,0 +1 @@
|
|||
node_modules
|
|
@ -0,0 +1 @@
|
|||
export * from './src/app'
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "@salix/app",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
export {NAME} from './module'
|
||||
export * from './config'
|
|
@ -0,0 +1,6 @@
|
|||
import {module} from './module';
|
||||
config.$inject = [];
|
||||
export function config(){
|
||||
|
||||
}
|
||||
module.config(config);
|
|
@ -0,0 +1,5 @@
|
|||
import {ng} from '@salix/vendor';
|
||||
import * as core from '@salix/core';
|
||||
|
||||
export const NAME="vnapp";
|
||||
export const module=ng.module(NAME,[]);
|
|
@ -0,0 +1 @@
|
|||
node_modules
|
|
@ -0,0 +1,4 @@
|
|||
import * as vendor from '@salix/vendor';
|
||||
|
||||
export * from './src/core'
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "@salix/core",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"angular": "^1.5.8"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import core from '../core'
|
||||
import util from '../util'
|
||||
|
||||
const NAME = 'button-icon'
|
||||
|
||||
core.directive(util.getname(name),function(name?,attrs){
|
||||
return{
|
||||
templateUrl: NAME + '.' + util.getStyle() + '.html',
|
||||
icon: attrs.icon,
|
||||
className: 'default_button',
|
||||
enabled: attrs.enabled
|
||||
|
||||
}
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
<button type = "button" class="{{className}}" {{enabled}} >
|
||||
<i class="material-icons">{{icon}} </i>
|
||||
</button>
|
|
@ -0,0 +1,20 @@
|
|||
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,2 @@
|
|||
<!-- por definir -->
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
import coremodule from '../coremodule';
|
||||
import resolveFactory from '../resolveDefaultFactoryComponents';
|
||||
import constant from '../constants';
|
||||
import interpolate from '../interpolate';
|
||||
import util from '../util';
|
||||
|
||||
|
||||
const NAME = util.getName(constant.BUTTON_NAME);
|
||||
|
||||
buttonDirective.$inject =[resolveFactory.NAME,interpolate.NAME];
|
||||
|
||||
export function buttonDirective (resolve,vninterpolate){
|
||||
return{
|
||||
require:'E',
|
||||
template: function(_,attr){
|
||||
var scope= Object.assign(resolve.button,attrs);
|
||||
// return vninterpolate(require(util.getTemplateName(constant.BUTTON_NAME,resolve.name))(scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coremodule.directive(NAME,buttonDirective);
|
|
@ -0,0 +1,20 @@
|
|||
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,3 @@
|
|||
<button type = "*[typeName]" class="*[className]" *[enabled] >
|
||||
{{texto}}
|
||||
</button>
|
|
@ -0,0 +1,15 @@
|
|||
import core from '../core'
|
||||
import util from '../util'
|
||||
|
||||
const NAME = 'checkbox'
|
||||
|
||||
core.directive(util.getname(name),function(name?,attrs){
|
||||
return{
|
||||
templateUrl: NAME + '.' + util.getStyle() + '.html',
|
||||
texto: attrs.text,
|
||||
className: 'default_button',
|
||||
enabled: attrs.enabled,
|
||||
typeName: attrs.typeName
|
||||
|
||||
}
|
||||
})
|
|
@ -0,0 +1,4 @@
|
|||
<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>
|
|
@ -0,0 +1,8 @@
|
|||
// nombre del prefijo del proyecto
|
||||
export const PREFIX ='vn'
|
||||
// nombre del framework css
|
||||
export const MATERIAL_DESIGN_FRAMEWORK = 'mt';
|
||||
export const BOOTSTRAP_FRAMEWORK = 'bt';
|
||||
// directive name
|
||||
export const BUTTON_NAME ='button';
|
||||
export const BUTTON_ICON_NAME ='buttonIcon';
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* export public module
|
||||
*/
|
||||
export {NAME} from './coremodule';
|
|
@ -0,0 +1,10 @@
|
|||
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;
|
|
@ -0,0 +1,167 @@
|
|||
import coremodule from './coremodule';
|
||||
import util from './util';
|
||||
|
||||
export const NAME = util.getProviderName('interpolate');
|
||||
|
||||
export class Interpolate
|
||||
{
|
||||
contructor (){
|
||||
this._startSymbol='*[';
|
||||
|
||||
this._endSymbol = ']';
|
||||
}
|
||||
|
||||
set startSymbol (value) {
|
||||
if (value) {
|
||||
this._startSymbol = value;
|
||||
return this;
|
||||
} else {
|
||||
return this._startSymbol;
|
||||
}
|
||||
};
|
||||
|
||||
set endSymbol (value) {
|
||||
if (value) {
|
||||
this._endSymbol = value;
|
||||
return this;
|
||||
} else {
|
||||
return this._endSymbol;
|
||||
}
|
||||
};
|
||||
$get($parse, $exceptionHandler, $sce) {
|
||||
var startSymbolLength = this._startSymbol.length,
|
||||
endSymbolLength = this._endSymbol.length,
|
||||
escapedStartRegexp = new RegExp(this._startSymbol.replace(/./g, escape), 'g'),
|
||||
escapedEndRegexp = new RegExp(this._endSymbol.replace(/./g, escape), 'g');
|
||||
|
||||
function escape(ch) {
|
||||
return '\\\\\\' + ch;
|
||||
}
|
||||
|
||||
function unescapeText(text) {
|
||||
return text.replace(escapedStartRegexp, this._startSymbol).
|
||||
replace(escapedEndRegexp, this._endSymbol);
|
||||
}
|
||||
|
||||
// TODO: this is the same as the constantWatchDelegate in parse.js
|
||||
function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
|
||||
var unwatch = scope.$watch(function constantInterpolateWatch(scope) {
|
||||
unwatch();
|
||||
return constantInterp(scope);
|
||||
}, listener, objectEquality);
|
||||
return unwatch;
|
||||
}
|
||||
|
||||
function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing)
|
||||
{
|
||||
// Provide a quick exit and simplified result function for text with no interpolation
|
||||
if (!text.length || text.indexOf(this._startSymbol) === -1)
|
||||
{
|
||||
var constantInterp;
|
||||
if (!mustHaveExpression) {
|
||||
var unescapedText = unescapeText(text);
|
||||
constantInterp = valueFn(unescapedText);
|
||||
constantInterp.exp = text;
|
||||
constantInterp.expressions = [];
|
||||
constantInterp.$$watchDelegate = constantWatchDelegate;
|
||||
}
|
||||
return constantInterp;
|
||||
}
|
||||
|
||||
allOrNothing = !!allOrNothing;
|
||||
var startIndex,
|
||||
endIndex,
|
||||
index = 0,
|
||||
expressions = [],
|
||||
parseFns = [],
|
||||
textLength = text.length,
|
||||
exp,
|
||||
concat = [],
|
||||
expressionPositions = [];
|
||||
|
||||
while (index < textLength) {
|
||||
if (((startIndex = text.indexOf(this._startSymbol, index)) !== -1) &&
|
||||
((endIndex = text.indexOf(this._endSymbol, startIndex + this._startSymbolLength)) !== -1)) {
|
||||
if (index !== startIndex) {
|
||||
concat.push(unescapeText(text.substring(index, startIndex)));
|
||||
}
|
||||
exp = text.substring(startIndex + this._startSymbolLength, endIndex);
|
||||
expressions.push(exp);
|
||||
parseFns.push($parse(exp, parseStringifyInterceptor));
|
||||
index = endIndex + endSymbolLength;
|
||||
expressionPositions.push(concat.length);
|
||||
concat.push('');
|
||||
} else {
|
||||
// we did not find an interpolation, so we have to add the remainder to the separators array
|
||||
if (index !== textLength) {
|
||||
concat.push(unescapeText(text.substring(index)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (trustedContext && concat.length > 1) {
|
||||
$interpolateMinErr.throwNoconcat(text);
|
||||
}
|
||||
|
||||
if (!mustHaveExpression || expressions.length) {
|
||||
var compute = function (values) {
|
||||
for (var i = 0, ii = expressions.length; i < ii; i++) {
|
||||
if (allOrNothing && isUndefined(values[i])) return;
|
||||
concat[expressionPositions[i]] = values[i];
|
||||
}
|
||||
return concat.join('');
|
||||
};
|
||||
|
||||
var getValue = function (value) {
|
||||
return trustedContext ?
|
||||
$sce.getTrusted(trustedContext, value) :
|
||||
$sce.valueOf(value);
|
||||
};
|
||||
|
||||
return angular.extend(function interpolationFn(context) {
|
||||
var i = 0;
|
||||
var ii = expressions.length;
|
||||
var values = new Array(ii);
|
||||
|
||||
try {
|
||||
for (; i < ii; i++) {
|
||||
values[i] = parseFns[i](context);
|
||||
}
|
||||
|
||||
return compute(values);
|
||||
} catch (err) {
|
||||
$exceptionHandler($interpolateMinErr.interr(text, err));
|
||||
}
|
||||
|
||||
}, {
|
||||
// all of these properties are undocumented for now
|
||||
exp: text, //just for compatibility with regular watchers created via $watch
|
||||
expressions: expressions,
|
||||
});
|
||||
}
|
||||
|
||||
function parseStringifyInterceptor(value) {
|
||||
try {
|
||||
value = getValue(value);
|
||||
return allOrNothing && !isDefined(value) ? value : stringify(value);
|
||||
} catch (err) {
|
||||
$exceptionHandler($interpolateMinErr.interr(text, err));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$interpolate.startSymbol = function () {
|
||||
return startSymbol;
|
||||
};
|
||||
|
||||
$interpolate.endSymbol = function () {
|
||||
return endSymbol;
|
||||
};
|
||||
|
||||
return $interpolate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
coremodule.provider(NAME,interpolate);
|
|
@ -0,0 +1,10 @@
|
|||
import core from '../core'
|
||||
import util from '../util'
|
||||
|
||||
const NAME = 'button'
|
||||
|
||||
core.directive(util.getname(name),function(){
|
||||
return{
|
||||
templateUrl: NAME + '.' + STYLE + '.html'
|
||||
}
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
<button class="">
|
||||
Button
|
||||
</button>
|
|
@ -0,0 +1,28 @@
|
|||
import coremodule from './coremodule';
|
||||
import util from './util';
|
||||
import constant from './constants';
|
||||
|
||||
export const NAME = util.getProviderName('ResolveDefaultComponent');
|
||||
|
||||
export class ResolveDefaultComponent {
|
||||
|
||||
constructor(){
|
||||
this._name="mt";
|
||||
}
|
||||
set frameworkName(name){
|
||||
//mt or bt
|
||||
this._name = name;
|
||||
}
|
||||
|
||||
$get($injector){
|
||||
//Service Locator
|
||||
return {
|
||||
button:function(){
|
||||
return $injector.get(util.getFactoryName(constant.BUTTON_NAME + this._name)); // butonmtFactory
|
||||
},
|
||||
name : this._name
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
coremodule.provider(NAME,ResolveDefaultComponent)
|
|
@ -0,0 +1,10 @@
|
|||
import core from '../core'
|
||||
import util from '../util'
|
||||
|
||||
const NAME = 'button'
|
||||
|
||||
core.directive(util.getname(name),function(){
|
||||
return{
|
||||
templateUrl: NAME + '.' + STYLE + '.html'
|
||||
}
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
<button class="">
|
||||
Button
|
||||
</button>
|
|
@ -0,0 +1,10 @@
|
|||
import core from '../core'
|
||||
import util from '../util'
|
||||
|
||||
const NAME = 'button'
|
||||
|
||||
core.directive(util.getname(name),function(){
|
||||
return{
|
||||
templateUrl: NAME + '.' + STYLE + '.html'
|
||||
}
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
<button class="">
|
||||
Button
|
||||
</button>
|
|
@ -0,0 +1,37 @@
|
|||
import constant from './constants';
|
||||
|
||||
const FACTORY = 'Factory';
|
||||
const SERVICE = 'Service';
|
||||
const DEFAULT = 'default';
|
||||
|
||||
export function getName(name) {
|
||||
return constant.PREFIX + toUpperCamelCase(name)
|
||||
}
|
||||
|
||||
export function toUpperCamelCase(stringToConvert){
|
||||
return stringToConvert.substr( 0, 1 ).toUpperCase() + stringToConvert.substr( 1 )
|
||||
}
|
||||
|
||||
export function getFactoryName(name){
|
||||
return getName(name) + FACTORY
|
||||
}
|
||||
|
||||
export function getServiceName(name){
|
||||
return getName(name) + SERVICE
|
||||
}
|
||||
|
||||
export function getModuleName(name){
|
||||
return constant.PREFIX + name;
|
||||
}
|
||||
|
||||
export function getProviderNameFromConfig(name){
|
||||
return getName(name) + 'Provider';
|
||||
}
|
||||
|
||||
export function getProviderName(name){
|
||||
return getName(name);
|
||||
}
|
||||
|
||||
export function getTemplateName(componentName,frameworkName){
|
||||
return componentName + '.' + frameworkName + '.' + '.html'
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
node_modules
|
|
@ -0,0 +1 @@
|
|||
import * as vendor from './src/vendor';
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "@salix/vendor",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"angular": "^1.5.8",
|
||||
"angular-ui-router": "^0.3.1",
|
||||
"oclazyload": "^1.0.9"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
import * as angular from 'angular';
|
||||
|
||||
export const ng = {
|
||||
module: angular.module,
|
||||
bootstrap: angular.bootstrap
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import * as oclazyload from 'oclazyload';
|
||||
import {getComponentName} from './util';
|
||||
|
||||
export const oclazyloadVendor = {
|
||||
name: 'oc.lazyLoad',
|
||||
oclazyload: getComponentName('$ocLazyLoad')
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import * as angularuirouter from 'angular-ui-router';
|
||||
import {getComponentName} from './util';
|
||||
|
||||
export const uirouter = {
|
||||
name: 'ui.router',
|
||||
state: getComponentName('$state')
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
export function getComponentName(name, isProvider){
|
||||
if(isProvider){
|
||||
return {
|
||||
name: name,
|
||||
provider: name + "Provider"
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: name
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
export * from './angular-vendor';
|
||||
export * from './oclazyload-vendor';
|
||||
export * from './uirouter-vendor';
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Salix</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript" src="build/salix.app.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "salix-app",
|
||||
"version": "1.0.0",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix application",
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://git.verdnatura.es:/salix"
|
||||
},
|
||||
"dependencies": {
|
||||
"angular": "^1.5.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"webpack": "*",
|
||||
"webpack-dev-server": "*",
|
||||
"babel-core": "*",
|
||||
"babel-preset-es2015": "*",
|
||||
"babel-loader": "*",
|
||||
"css-loader": "*",
|
||||
"file-loader": "*",
|
||||
"json-loader": "*",
|
||||
"style-loader": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm build/* ; webpack --progress --colors"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
var webpack = require ('webpack');
|
||||
var path = require ('path');
|
||||
|
||||
module.exports =
|
||||
{
|
||||
entry: {
|
||||
'salix.vendor': ['@salix/vendor'],
|
||||
'salix.core': ['@salix/core'],
|
||||
'salix.app': ['@salix/app']
|
||||
},
|
||||
output: {
|
||||
path: path.join (__dirname, 'build'),
|
||||
filename: '[name].js',
|
||||
publicPath: 'build/'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel',
|
||||
exclude: /node_modules/,
|
||||
query: {
|
||||
presets: ['es2015']
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
modulesDirectories: [
|
||||
__dirname,
|
||||
'src',
|
||||
'node_modules'
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.CommonsChunkPlugin ({
|
||||
name: 'salix.vendor'
|
||||
})
|
||||
]
|
||||
};
|
||||
|
Loading…
Reference in New Issue