0
1
Fork 0
This commit is contained in:
Juan Ferrer Toribio 2017-08-21 12:20:36 +02:00
parent fab5253406
commit b8c83df08f
20 changed files with 95 additions and 127 deletions

View File

@ -12,7 +12,7 @@ Hedera.Address = new Class
,onStatusChange: function (form) ,onStatusChange: function (form)
{ {
if (form.ready && this.hash.get ('address') == 0) if (form.ready && this.$('params').$.address == 0)
form.insertRow (); form.insertRow ();
} }

View File

@ -1,14 +1,15 @@
<vn> <vn>
<vn-group> <vn-group>
<vn-param id="address"/> <vn-lot-query id="params">
<vn-hash-param key="address" param="address"/> <vn-spec name="address" type="Number"/>
</vn-lot-query>
<db-form id="iter" on-status-changed="onStatusChange"> <db-form id="iter" on-status-changed="onStatusChange">
<db-model <db-model
id="model" id="model"
property="model" property="model"
updatable="true" updatable="true"
mode="ON_DEMAND" mode="ON_DEMAND"
lot="hash" lot="params"
on-operations-done="onOperationsDone"> on-operations-done="onOperationsDone">
SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country
FROM address_view a FROM address_view a

View File

@ -164,17 +164,8 @@ Hedera.Catalog = new Class
,onRealmChange: function () ,onRealmChange: function ()
{ {
var newValue = this.hash.get ('realm'); var newValue = this.hash.get ('realm');
this.$('filters').style.display = newValue ? 'block' : 'none';
if (newValue) this.$('realm-msg').style.display = newValue ? 'none' : 'block';
{
this.$('filters').style.display = 'block';
this.$('realm-msg').style.display = 'none';
}
else
{
this.$('filters').style.display = 'none';
this.$('realm-msg').style.display = 'block';
}
this.refreshTitleColor (); this.refreshTitleColor ();
this.hash.params = { this.hash.params = {
@ -445,9 +436,7 @@ Vn.Filter = new Class
this._ul = this.createElement ('ul'); this._ul = this.createElement ('ul');
this.node.appendChild (this._ul); this.node.appendChild (this._ul);
this._modelLot = new Vn.LotQuery ({ this._modelLot = new Vn.LotQuery ();
type: Vn.LotQuery.Type.EXCLUDE
});
this.parent (props); this.parent (props);
} }

View File

@ -1,12 +1,17 @@
<vn> <vn>
<vn-group> <vn-group>
<vn-lot-query <vn-lot-query id="params" on-change="onLotChange">
id="lot" <vn-spec name="realm" type="Number"/>
source="hash" <vn-spec name="type" type="Number"/>
on-change="onLotChange"/> <vn-spec name="search" type="String"/>
<vn-spec name="color" type="String"/>
<vn-spec name="origin" type="Number"/>
<vn-spec name="category" type="String"/>
<vn-spec name="producer" type="Number"/>
</vn-lot-query>
<vn-lot id="card-lot"/> <vn-lot id="card-lot"/>
<vn-param lot="hash" name="realm" on-changed="onRealmChange"/> <vn-param lot="params" name="realm" on-changed="onRealmChange"/>
<vn-param lot="hash" name="type" on-changed="refreshTitle"/> <vn-param lot="params" name="type" on-changed="refreshTitle"/>
<sql-filter type="AND" id="filter"> <sql-filter type="AND" id="filter">
<sql-filter-item type="EQUAL" <sql-filter-item type="EQUAL"
field="tipo_id" target="a" field="tipo_id" target="a"
@ -35,7 +40,7 @@
<db-model <db-model
id="items" id="items"
result-index="2" result-index="2"
lot="lot" lot="params"
auto-load="false"> auto-load="false">
CREATE TEMPORARY TABLE tmp.bionic_calc CREATE TEMPORARY TABLE tmp.bionic_calc
(INDEX (item_id)) (INDEX (item_id))
@ -111,7 +116,7 @@
tip="_Switch view" tip="_Switch view"
on-click="onSwitchViewClick"/> on-click="onSwitchViewClick"/>
<htk-search-entry <htk-search-entry
lot="hash" lot="params"
name="search"/> name="search"/>
</div> </div>
<div id="main" class="catalog"> <div id="main" class="catalog">
@ -208,14 +213,14 @@
<div id="filters" class="filters"> <div id="filters" class="filters">
<h2><t>Filter by</t></h2> <h2><t>Filter by</t></h2>
<vn-filter <vn-filter
lot="hash" lot="params"
name="type" name="type"
placeholder="_Family"> placeholder="_Family">
<db-model <db-model
id="types" id="types"
property="model" property="model"
conn="conn" conn="conn"
lot="hash" lot="params"
result-index="1" result-index="1"
on-status-changed="refreshTitle"> on-status-changed="refreshTitle">
CALL item_available (); CALL item_available ();
@ -230,7 +235,7 @@
</vn-filter> </vn-filter>
<vn-filter <vn-filter
id="test" id="test"
lot="hash" lot="params"
name="color" name="color"
placeholder="_Color" placeholder="_Color"
filter="filter"> filter="filter">
@ -247,7 +252,7 @@
</db-model> </db-model>
</vn-filter> </vn-filter>
<vn-filter <vn-filter
lot="hash" lot="params"
name="producer" name="producer"
placeholder="_Producer" placeholder="_Producer"
filter="filter"> filter="filter">
@ -263,7 +268,7 @@
</db-model> </db-model>
</vn-filter> </vn-filter>
<vn-filter <vn-filter
lot="hash" lot="params"
name="origin" name="origin"
placeholder="_Origin" placeholder="_Origin"
filter="filter"> filter="filter">
@ -280,7 +285,7 @@
</db-model> </db-model>
</vn-filter> </vn-filter>
<vn-filter <vn-filter
lot="hash" lot="params"
name="category" name="category"
placeholder="_Category" placeholder="_Category"
filter="filter"> filter="filter">

View File

@ -44,12 +44,12 @@
<div class="card form"> <div class="card form">
<div> <div>
<label><t>Show orders from</t></label> <label><t>Show orders from</t></label>
<htk-date-chooser lot="hash" name="from"/> <htk-date-chooser lot="params" name="from"/>
</div> </div>
</div> </div>
<div class="card list"> <div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc"> <htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" lot="hash"> <db-model property="model" lot="params">
CALL clientTicketList (#from, NULL) CALL clientTicketList (#from, NULL)
</db-model> </db-model>
<custom> <custom>

View File

@ -1,11 +1,12 @@
<vn> <vn>
<vn-group> <vn-lot-query id="params">
<db-form id="ticket"> <vn-spec name="ticket" type="Number"/>
<db-model property="model" lot="hash"> </vn-lot-query>
CALL clientTicketGet(#ticket) <db-form id="ticket">
</db-model> <db-model property="model" lot="params">
</db-form> CALL clientTicketGet(#ticket)
</vn-group> </db-model>
</db-form>
<h1 id="title"> <h1 id="title">
<t>OrderDetail</t> <t>OrderDetail</t>
</h1> </h1>
@ -54,7 +55,7 @@
</div> </div>
</div> </div>
<htk-repeater form-id="iter" renderer="repeaterFunc"> <htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" id="movements" lot="hash"> <db-model property="model" id="movements" lot="params">
CALL clientTicketRowGet(#ticket) CALL clientTicketRowGet(#ticket)
</db-model> </db-model>
<custom> <custom>

View File

@ -1,4 +1,7 @@
<vn> <vn>
<vn-lot-query id="params">
<vn-spec name="config" type="Number"/>
</vn-lot-query>
<vn-lot id="lot"/> <vn-lot id="lot"/>
<h1 id="title"> <h1 id="title">
<t>Shelves</t> <t>Shelves</t>
@ -17,7 +20,7 @@
id="config" id="config"
placeholder="_Select config" placeholder="_Select config"
model="configs-model" model="configs-model"
lot="hash" lot="params"
name="config" name="config"
on-changed="onConfigChange" on-changed="onConfigChange"
on-ready="onConfigChange"> on-ready="onConfigChange">

View File

@ -309,7 +309,7 @@ Klass.implement
return true; return true;
for (var key in params) for (var key in params)
if (params[key] === undefined) if (params[key] == null)
return false; return false;
return true; return true;

View File

@ -23,7 +23,7 @@ module.exports = new Class
{ {
var object = params[this.id]; var object = params[this.id];
if (object != null) if (object !== undefined)
{ {
if (!(object instanceof SqlObject)) if (!(object instanceof SqlObject))
{ {

View File

@ -50,7 +50,7 @@ module.exports =
,'Feb' ,'Feb'
,'Mar' ,'Mar'
,'Apr' ,'Apr'
,'May' ,'MayAbr'
,'Jun' ,'Jun'
,'Jul' ,'Jul'
,'Ago' ,'Ago'

View File

@ -149,22 +149,11 @@ module.exports = new Class
switch (typeof v) switch (typeof v)
{ {
case 'number':
return '(Number)'+ v;
case 'boolean':
return '(Boolean)'+ (v ? 'true' : 'false');
case 'object': case 'object':
if (v instanceof Date) if (v instanceof Date)
return '(Date)'+ VnDate.strftime (v, '%Y-%m-%d'); return VnDate.strftime (v, '%Y-%m-%d');
else else
return '(Object)'+ JSON.stringify (v) return JSON.stringify (v)
}
switch (v.charAt (0))
{
case '(':
case '\\':
return '\\'+ v;
} }
return v; return v;
@ -177,43 +166,10 @@ module.exports = new Class
v = decodeURIComponent (v); v = decodeURIComponent (v);
if (v === '')
return v;
var typeStr;
switch (v.charAt(0))
{
case '(':
var index = v.indexOf (')');
typeStr = v.substr (1, index - 1);
v = v.substr (index + 1);
break;
case '\\':
v = v.substr (1);
break;
}
if (v === '') if (v === '')
return null; return null;
if (!typeStr)
return v;
switch (typeStr) return v;
{
case 'Boolean':
return (/^(true|1)$/i).test (v);
case 'Number':
return 0 + new Number (v);
case 'Date':
var date = new Date (v);
date.setHours (0, 0, 0, 0);
return date;
case 'Object':
return JSON.parse (v);
default:
return v;
}
} }
,_destroy: function () ,_destroy: function ()

View File

@ -32,7 +32,7 @@
,"Feb": "Febr" ,"Feb": "Febr"
,"Mar": "Març" ,"Mar": "Març"
,"Apr": "Abr" ,"Apr": "Abr"
,"May": "Maig" ,"MayAbr": "Maig"
,"Jun": "Juny" ,"Jun": "Juny"
,"Jul": "Jul" ,"Jul": "Jul"
,"Ago": "Ag" ,"Ago": "Ag"

View File

@ -32,7 +32,7 @@
,"Feb": "Feb" ,"Feb": "Feb"
,"Mar": "Mar" ,"Mar": "Mar"
,"Apr": "Apr" ,"Apr": "Apr"
,"May": "May" ,"MayAbr": "May"
,"Jun": "Jun" ,"Jun": "Jun"
,"Jul": "Jul" ,"Jul": "Jul"
,"Ago": "Ago" ,"Ago": "Ago"

View File

@ -32,7 +32,7 @@
,"Feb": "Feb" ,"Feb": "Feb"
,"Mar": "Mar" ,"Mar": "Mar"
,"Apr": "Abr" ,"Apr": "Abr"
,"May": "May" ,"MayAbr": "May"
,"Jun": "Jun" ,"Jun": "Jun"
,"Jul": "Jul" ,"Jul": "Jul"
,"Ago": "Ago" ,"Ago": "Ago"

View File

@ -32,7 +32,7 @@
,"Feb": "Fév" ,"Feb": "Fév"
,"Mar": "Mars" ,"Mar": "Mars"
,"Apr": "Avr" ,"Apr": "Avr"
,"May": "Mai" ,"MayAbr": "Mai"
,"Jun": "Juin" ,"Jun": "Juin"
,"Jul": "Juil" ,"Jul": "Juil"
,"Ago": "Août" ,"Ago": "Août"

View File

@ -32,7 +32,7 @@
,"Feb": "хоё" ,"Feb": "хоё"
,"Mar": "Гур" ,"Mar": "Гур"
,"Apr": "Дөр" ,"Apr": "Дөр"
,"May": "May" ,"MayAbr": "May"
,"Jun": "Jun" ,"Jun": "Jun"
,"Jul": "Jul" ,"Jul": "Jul"
,"Ago": "Най" ,"Ago": "Най"

View File

@ -32,7 +32,7 @@
,"Feb": "Fev" ,"Feb": "Fev"
,"Mar": "Mar" ,"Mar": "Mar"
,"Apr": "Abr" ,"Apr": "Abr"
,"May": "Mai" ,"MayAbr": "Mai"
,"Jun": "Jun" ,"Jun": "Jun"
,"Jul": "Jul" ,"Jul": "Jul"
,"Ago": "Ago" ,"Ago": "Ago"

View File

@ -43,6 +43,7 @@ module.exports = new Class
Object.assign (this, { Object.assign (this, {
_fields: null, _fields: null,
_source: null, _source: null,
_lockSource: false,
_specs: {} _specs: {}
}); });
this.parent (props); this.parent (props);
@ -58,6 +59,9 @@ module.exports = new Class
,_onSourceChange: function () ,_onSourceChange: function ()
{ {
if (this._lockSource)
return;
var params = this._source ? this._source.params : {}; var params = this._source ? this._source.params : {};
var myParams = {}; var myParams = {};
@ -67,6 +71,32 @@ module.exports = new Class
this.assign (myParams); this.assign (myParams);
} }
,assign: function (params)
{
params = this.transformParams (params);
var diff = Value.partialDiff (this._params, params);
if (diff)
{
Object.assign (this._params, diff);
if (this.source)
{
this._lockSource = true;
this.source.assign (diff);
this._lockSource = false;
}
this._paramsChanged (diff);
this.changed (diff);
}
}
,setAll: function (params)
{
this.assign (params);
}
,transformParams: function (params) ,transformParams: function (params)
{ {
var newParams = {}; var newParams = {};
@ -87,17 +117,17 @@ function cast (value, type)
switch (type) switch (type)
{ {
case Boolean: case Boolean:
return (/^(true|1)$/i).test (v); return (/^(true|1)$/i).test (value);
case Number: case Number:
return 0 + new Number (v); return 0 + new Number (value);
case Date: case Date:
var date = new Date (v); var date = new Date (value);
date.setHours (0, 0, 0, 0); date.setHours (0, 0, 0, 0);
return date; return date;
default: default:
if (type instanceof Object) if (type instanceof Object)
return JSON.parse (v); return JSON.parse (value);
else else
return v; return value;
} }
} }

View File

@ -42,11 +42,6 @@ module.exports = new Class
this.parent (props); this.parent (props);
} }
,get: function (field)
{
return this._params[field];
}
,keys: function () ,keys: function ()
{ {
return Object.keys (this._params); return Object.keys (this._params);
@ -54,7 +49,6 @@ module.exports = new Class
,assign: function (params) ,assign: function (params)
{ {
params = this.transformParams (params);
var diff = Value.partialDiff (this._params, params); var diff = Value.partialDiff (this._params, params);
if (diff) if (diff)
@ -67,7 +61,6 @@ module.exports = new Class
,setAll: function (params) ,setAll: function (params)
{ {
params = this.transformParams (params);
var diff = Value.diff (this._params, params); var diff = Value.diff (this._params, params);
if (diff) if (diff)
@ -85,16 +78,4 @@ module.exports = new Class
* @param {Object} diff Changed parameters and its new values * @param {Object} diff Changed parameters and its new values
*/ */
,_paramsChanged: function () {} ,_paramsChanged: function () {}
/**
* Called when lot params changes to apply transformations over them, can be
* implemented by child classes.
*
* @param {Object} params New parameters
* @return {Object} Transformed parameters
*/
,transformParams: function (params)
{
return params;
}
}); });

View File

@ -13,9 +13,7 @@ var baseConfig = {
entry: wpConfig.entry, entry: wpConfig.entry,
output: { output: {
path: outputPath, path: outputPath,
publicPath: publicPath, publicPath: publicPath
filename: '[name].js',
chunkFilename: 'chunk.[id].js'
}, },
module: { module: {
rules: [ rules: [
@ -64,13 +62,17 @@ var prodConfig = {
}; };
var devConfig = { var devConfig = {
output: {
filename: '[name].js',
chunkFilename: 'chunk.[id].js'
},
plugins: [ plugins: [
new webpack.NamedModulesPlugin () new webpack.NamedModulesPlugin ()
], ],
devServer: { devServer: {
host: '0.0.0.0', host: '0.0.0.0',
port: wpConfig.devServerPort, port: wpConfig.devServerPort,
headers: { "Access-Control-Allow-Origin": "*" }, headers: { 'Access-Control-Allow-Origin': '*' },
stats: { chunks: false } stats: { chunks: false }
}, },
devtool: 'eval' devtool: 'eval'