This commit is contained in:
Juan Ferrer Toribio 2017-11-20 13:15:01 +01:00
parent 7658a5680d
commit ce167066f4
34 changed files with 322 additions and 243 deletions

View File

@ -2,7 +2,7 @@
var methodsData = { var methodsData = {
AGENCY: { AGENCY: {
steps: ['method', 'date', 'address', 'agency', 'confirm'], steps: ['method', 'date', 'address', 'delivery', 'confirm'],
isDelivery: true, isDelivery: true,
textId: 'agencyText' textId: 'agencyText'
}, },
@ -12,7 +12,7 @@ var methodsData = {
textId: 'deliveryText' textId: 'deliveryText'
}, },
PICKUP: { PICKUP: {
steps: ['method', 'date', 'address', 'pickup', 'confirm'], steps: ['method', 'date', 'address', 'delivery', 'confirm'],
isDelivery: false, isDelivery: false,
textId: 'pickupText' textId: 'pickupText'
} }
@ -125,11 +125,13 @@ Hedera.Checkout = new Class
case 'date': case 'date':
var dateQuestion = methodData.isDelivery ? var dateQuestion = methodData.isDelivery ?
'OrderDateDeliveryQuestion' : 'OrderDatePickupQuestion'; 'OrderDateDeliveryQuestion' : 'OrderDatePickupQuestion';
Vn.Node.setText (_(dateQuestion)); Vn.Node.setText (this.$.dateQuestion, _(dateQuestion));
this.$.calendar.goToSelectedMonth (); this.$.calendar.goToSelectedMonth ();
break; break;
case 'agency': case 'delivery':
case 'pickup': var whQuestion = methodData.isDelivery ?
'AgencyQuestion' : 'PickupWarehouseQuestion';
Vn.Node.setText (this.$.whQuestion, _(whQuestion));
this.$.agencies.refresh (); this.$.agencies.refresh ();
break; break;
case 'confirm': case 'confirm':
@ -144,9 +146,9 @@ Hedera.Checkout = new Class
return stepName; return stepName;
} }
,onFieldChange: function () ,onFieldChange: function (_, value)
{ {
if (!this.autoStepLocked) if (!this.autoStepLocked && value != null)
setTimeout (this.goNextStep.bind (this), 75); setTimeout (this.goNextStep.bind (this), 75);
} }

View File

@ -8,6 +8,7 @@
,"ReceiveThroughtAgency": "Rebre per agència" ,"ReceiveThroughtAgency": "Rebre per agència"
,"ReceiveThroughtRoute": "Repartiment Verdnatura" ,"ReceiveThroughtRoute": "Repartiment Verdnatura"
,"PickupInStore": "Recollir en magatzem" ,"PickupInStore": "Recollir en magatzem"
,"Select agency": "Selecciona agencia"
,"OrderDateDeliveryQuestion": "Quin dia vols rebre la comanda?" ,"OrderDateDeliveryQuestion": "Quin dia vols rebre la comanda?"
,"OrderDatePickupQuestion": "Quin dia vols recollir la comanda?" ,"OrderDatePickupQuestion": "Quin dia vols recollir la comanda?"

View File

@ -8,6 +8,7 @@
,"ReceiveThroughtAgency": "Receive by agency" ,"ReceiveThroughtAgency": "Receive by agency"
,"ReceiveThroughtRoute": "Verdnatura delivery" ,"ReceiveThroughtRoute": "Verdnatura delivery"
,"PickupInStore": "Store pickup" ,"PickupInStore": "Store pickup"
,"Select agency": "Select agency"
,"OrderDateDeliveryQuestion": "What day you want to receive the order?" ,"OrderDateDeliveryQuestion": "What day you want to receive the order?"
,"OrderDatePickupQuestion": "What day you want to pickup your order?" ,"OrderDatePickupQuestion": "What day you want to pickup your order?"

View File

@ -8,6 +8,7 @@
,"ReceiveThroughtAgency": "Recibir por agencia" ,"ReceiveThroughtAgency": "Recibir por agencia"
,"ReceiveThroughtRoute": "Reparto Verdnatura" ,"ReceiveThroughtRoute": "Reparto Verdnatura"
,"PickupInStore": "Recoger en almacén" ,"PickupInStore": "Recoger en almacén"
,"Select agency": "Selecciona agencia"
,"OrderDateDeliveryQuestion": "¿Qué día quieres recibir el pedido?" ,"OrderDateDeliveryQuestion": "¿Qué día quieres recibir el pedido?"
,"OrderDatePickupQuestion": "¿Qué día quieres recoger el pedido?" ,"OrderDatePickupQuestion": "¿Qué día quieres recoger el pedido?"

View File

@ -8,6 +8,7 @@
,"ReceiveThroughtAgency": "Recevez par l'agence" ,"ReceiveThroughtAgency": "Recevez par l'agence"
,"ReceiveThroughtRoute": "Livraison par Verdnatura" ,"ReceiveThroughtRoute": "Livraison par Verdnatura"
,"PickupInStore": "Livraison en magasin" ,"PickupInStore": "Livraison en magasin"
,"Select agency": "Sélectionnez une agence"
,"OrderDateDeliveryQuestion": "Date de livraison?" ,"OrderDateDeliveryQuestion": "Date de livraison?"
,"OrderDatePickupQuestion": "Date retrait commande?" ,"OrderDatePickupQuestion": "Date retrait commande?"

View File

@ -8,6 +8,7 @@
,"ReceiveThroughtAgency": "Receive by agency" ,"ReceiveThroughtAgency": "Receive by agency"
,"ReceiveThroughtRoute": "Verdnatura delivery" ,"ReceiveThroughtRoute": "Verdnatura delivery"
,"PickupInStore": "Store pickup" ,"PickupInStore": "Store pickup"
,"Select agency": "Select agency"
,"OrderDateDeliveryQuestion": "What day you want to receive the order?" ,"OrderDateDeliveryQuestion": "What day you want to receive the order?"
,"OrderDatePickupQuestion": "What day you want to pickup your order?" ,"OrderDatePickupQuestion": "What day you want to pickup your order?"

View File

@ -8,6 +8,7 @@
,"ReceiveThroughtAgency": "Receber por agência" ,"ReceiveThroughtAgency": "Receber por agência"
,"ReceiveThroughtRoute": "Transporte Verdnatura" ,"ReceiveThroughtRoute": "Transporte Verdnatura"
,"PickupInStore": "Recolher no armazém" ,"PickupInStore": "Recolher no armazém"
,"Select agency": "Selecione uma agência"
,"OrderDateDeliveryQuestion": "Que dia queres receber o pedido?" ,"OrderDateDeliveryQuestion": "Que dia queres receber o pedido?"
,"OrderDatePickupQuestion": "Que dia queres recolher o pedido?" ,"OrderDatePickupQuestion": "Que dia queres recolher o pedido?"

View File

@ -16,7 +16,7 @@
{ {
font-size: 1.3em; font-size: 1.3em;
} }
.answers .htk-select .answers .htk-combo
{ {
max-width: 10em; max-width: 10em;
display: block; display: block;

View File

@ -69,7 +69,7 @@
</div> </div>
</htk-step> </htk-step>
<htk-step name="date"> <htk-step name="date">
<h2 id="date-question">_OrderDateDeliveryQuestion</h2> <h2 id="date-question"/>
<div class="answers"> <div class="answers">
<htk-calendar <htk-calendar
id="calendar" id="calendar"
@ -102,25 +102,15 @@
</htk-repeater> </htk-repeater>
</div> </div>
</htk-step> </htk-step>
<htk-step name="agency"> <htk-step name="delivery">
<h2>_AgencyQuestion</h2> <h2 id="wh-question"/>
<div class="answers target"> <div class="answers target">
<htk-combo <htk-combo
id="agency" id="agency"
lot="lot" lot="lot"
name="agency" name="agency"
show-field="description" not-null="true"
on-changed="onFieldChange" placeholder="_Select agency"
model="agencies"/>
</div>
</htk-step>
<htk-step name="pickup">
<h2>_PickupWarehouseQuestion</h2>
<div class="answers target">
<htk-combo
id="warehouse"
lot="lot"
name="agency"
show-field="description" show-field="description"
on-changed="onFieldChange" on-changed="onFieldChange"
model="agencies"/> model="agencies"/>
@ -142,7 +132,7 @@
_ReceiveThroughtRoute _ReceiveThroughtRoute
</p> </p>
<p id="pickup-text"> <p id="pickup-text">
<span>_Warehouse</span> {{warehouse.description}} <span>_Warehouse</span> {{agency.description}}
</p> </p>
<button id="confirm-button" class="thin" on-click="onConfirmClick"> <button id="confirm-button" class="thin" on-click="onConfirmClick">
_Confirm _Confirm

View File

@ -16,7 +16,7 @@
height="16" height="16"
id="svg7384" id="svg7384"
version="1.1" version="1.1"
inkscape:version="0.48.5 r10040" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
width="16"> width="16">
<metadata <metadata
id="metadata90"> id="metadata90">
@ -36,8 +36,8 @@
bordercolor="#666666" bordercolor="#666666"
borderopacity="1" borderopacity="1"
inkscape:current-layer="layer9" inkscape:current-layer="layer9"
inkscape:cx="-0.061047297" inkscape:cx="8"
inkscape:cy="6.5448724" inkscape:cy="8"
gridtolerance="10" gridtolerance="10"
inkscape:guide-bbox="true" inkscape:guide-bbox="true"
guidetolerance="10" guidetolerance="10"
@ -58,21 +58,21 @@
inkscape:snap-nodes="true" inkscape:snap-nodes="true"
inkscape:snap-others="false" inkscape:snap-others="false"
inkscape:snap-to-guides="true" inkscape:snap-to-guides="true"
inkscape:window-height="1014" inkscape:window-height="1016"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-x="1920" inkscape:window-x="1920"
inkscape:window-y="27" inkscape:window-y="27"
inkscape:zoom="31.384543"> inkscape:zoom="51.4375">
<inkscape:grid <inkscape:grid
empspacing="2" empspacing="2"
enabled="true" enabled="true"
id="grid4866" id="grid4866"
originx="200px" originx="200"
originy="120px" originy="120"
snapvisiblegridlinesonly="true" snapvisiblegridlinesonly="true"
spacingx="1px" spacingx="1"
spacingy="1px" spacingy="1"
type="xygrid" type="xygrid"
visible="true" /> visible="true" />
</sodipodi:namedview> </sodipodi:namedview>
@ -95,7 +95,7 @@
<path <path
sodipodi:cx="49.5" sodipodi:cx="49.5"
sodipodi:cy="342.5" sodipodi:cy="342.5"
d="m 52,342.5 c 0,1.38071 -1.119288,2.5 -2.5,2.5 -1.380712,0 -2.5,-1.11929 -2.5,-2.5 0,-1.38071 1.119288,-2.5 2.5,-2.5 1.380712,0 2.5,1.11929 2.5,2.5 z" d="M 52,342.5 A 2.5,2.5 0 0 1 49.5,345 2.5,2.5 0 0 1 47,342.5 2.5,2.5 0 0 1 49.5,340 2.5,2.5 0 0 1 52,342.5 Z"
id="path3942-6" id="path3942-6"
sodipodi:rx="2.5" sodipodi:rx="2.5"
sodipodi:ry="2.5" sodipodi:ry="2.5"

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -11,7 +11,7 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg7384" id="svg7384"
version="1.1" version="1.1"
inkscape:version="0.91 r13725" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
height="16" height="16"
sodipodi:docname="add.svg" sodipodi:docname="add.svg"
width="16"> width="16">
@ -54,7 +54,7 @@
borderopacity="1" borderopacity="1"
guidetolerance="10" guidetolerance="10"
inkscape:snap-bbox-midpoints="false" inkscape:snap-bbox-midpoints="false"
inkscape:cx="8" inkscape:cx="3.3398058"
inkscape:bbox-paths="false" inkscape:bbox-paths="false"
inkscape:snap-grids="true" inkscape:snap-grids="true"
inkscape:pageopacity="1" inkscape:pageopacity="1"
@ -65,15 +65,15 @@
fit-margin-bottom="0"> fit-margin-bottom="0">
<inkscape:grid <inkscape:grid
visible="true" visible="true"
spacingx="1px" spacingx="1"
type="xygrid" type="xygrid"
spacingy="1px" spacingy="1"
id="grid4866" id="grid4866"
empspacing="2" empspacing="2"
enabled="true" enabled="true"
snapvisiblegridlinesonly="true" snapvisiblegridlinesonly="true"
originx="-3px" originx="-3"
originy="-3px" /> originy="-3" />
</sodipodi:namedview> </sodipodi:namedview>
<title <title
id="title9167">Gnome Symbolic Icon Theme</title> id="title9167">Gnome Symbolic Icon Theme</title>

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

60
image/icon/light/down.svg Normal file
View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
fill="#000000"
height="24"
viewBox="0 0 24 24"
width="24"
version="1.1"
id="svg6"
sodipodi:docname="down.svg"
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1016"
id="namedview8"
showgrid="false"
inkscape:zoom="34.291667"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-x="1920"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg6" />
<path
d="M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z"
id="path2"
style="fill:#666666;fill-opacity:1" />
<path
d="M0-.75h24v24H0z"
fill="none"
id="path4" />
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -81,4 +81,50 @@ module.exports = new Class
if (child.nodeType === Node.TEXT_NODE) if (child.nodeType === Node.TEXT_NODE)
this.query = child.textContent; this.query = child.textContent;
} }
,refresh: function ()
{
if (this._model)
this._model.refresh ();
}
,performOperations: function ()
{
if (this._model)
this._model.performOperations ();
}
/**
* Get the index of the column from its name.
*
* @param {string} columnName The column name
* @return {integer} The column index or -1 if column not exists
*/
,getColumnIndex: function (columnName)
{
return this._model ?
this._model.getColumnIndex (columnName) : -1;
}
/**
* Gets a value from the form using the column index.
*
* @param {string} columnName The column index
* @return {Object} The value
*/
,getByIndex: function (column)
{
return this._model.getByIndex (this._row, column);
}
/**
* Sets a value on the form using the column index.
*
* @param {string} columnName The column index
* @param {Object} value The new value
*/
,setByIndex: function (column, value)
{
return this._model.setByIndex (this._row, column, value);
}
}); });

View File

@ -75,7 +75,6 @@ module.exports = new Class
this._shown = true; this._shown = true;
this.doc.body.appendChild (this.node); this.doc.body.appendChild (this.node);
Htk.Toast.pushTop (this.$.formHolder);
if (Vn.isMobile ()) if (Vn.isMobile ())
{ {
@ -106,7 +105,6 @@ module.exports = new Class
if (Vn.isMobile ()) if (Vn.isMobile ())
window.removeEventListener ('scroll', this._onScrollHandler); window.removeEventListener ('scroll', this._onScrollHandler);
Htk.Toast.popTop ();
this.formParam.unref (); this.formParam.unref ();
this.closeForm (); this.closeForm ();
this.hideMenu (); this.hideMenu ();

View File

@ -149,28 +149,33 @@ p
/* Efects */ /* Efects */
button, button,
.list-row, input[type=submit],
.clickable, input[type=button],
.clickable-img input[type=reset],
{ select,
cursor: pointer; .button,
}
button,
.list-row, .list-row,
.clickable .clickable
{ {
transition: background-color 200ms ease-out; cursor: pointer;
-webkit-transition: background-color 200ms ease-out; transition: background-color 500ms ease-out;
-webkit-transition: background-color 500ms ease-out;
} }
button:hover, button:hover,
input[type=submit]:hover,
input[type=button]:hover,
input[type=reset]:hover,
select:hover,
.button:hover,
.list-row:hover, .list-row:hover,
.clickable:hover .clickable:hover
{ {
background-color: rgba(1, 1, 1, 0.05); background-color: rgba(1, 1, 1, 0.1);
} }
.clickable-img .clickable-img
{ {
cursor: pointer;
transition: opacity 200ms ease-out; transition: opacity 200ms ease-out;
-webkit-transition: opacity 200ms ease-out; -webkit-transition: opacity 200ms ease-out;
} }
@ -187,7 +192,8 @@ button:focus
outline: 1px solid rgba(1, 1, 1, 0.15); outline: 1px solid rgba(1, 1, 1, 0.15);
-moz-outline-radius: .1em; -moz-outline-radius: .1em;
} }
input:focus input:focus,
.input:focus
{ {
outline: none; outline: none;
border-bottom: 1px solid black; border-bottom: 1px solid black;
@ -269,9 +275,13 @@ input[type=radio]
} }
select select
{ {
background-color: white; background-color: transparent;
-moz-appearance: none;
appearance: none; appearance: none;
-moz-appearance: none;
}
select:hover
{
background-color: rgba(1, 1, 1, 0.1);
} }
option option
{ {
@ -279,8 +289,8 @@ option
border-width: 0; border-width: 0;
font-weight: normal; font-weight: normal;
font-size: 1em; font-size: 1em;
cursor: pointer;
} }
select,
option option
{ {
cursor: pointer; cursor: pointer;
@ -291,21 +301,14 @@ option
button, button,
input[type=submit], input[type=submit],
input[type=button], input[type=button],
input[type=reset] input[type=reset],
.button
{ {
border: none; border: none;
background-color: transparent;
padding: 0.5em; padding: 0.5em;
cursor: pointer; background-color: transparent;
border-radius: 0.1em;
margin: -0.5em; margin: -0.5em;
} border-radius: 0.1em;
button:hover,
input[type=submit]:hover,
input[type=button]:hover,
input[type=reset]:hover
{
background-color: rgba(1, 1, 1, 0.1);
} }
/* Flat button */ /* Flat button */

View File

@ -104,17 +104,20 @@ module.exports = new Class
} }
,_editable: true ,_editable: true
,_lockEntry: false ,_lockField: false
,_setValue: function (newValue) ,_setValue: function (newValue)
{ {
Vn.ParamIface.prototype._setValue.call (this, newValue); if (!this._putValue (newValue))
return;
if (!this._lockEntry) if (!this._lockField)
this.putValue (newValue); this._putFieldValue (newValue);
if (this.conditionalFunc) if (this.conditionalFunc)
this.conditionalFunc (this, newValue); this.conditionalFunc (this, newValue);
this._notifyChanges ();
} }
/** /**
@ -123,13 +126,21 @@ module.exports = new Class
* *
* @param {*} value The new entry value * @param {*} value The new entry value
*/ */
,valueChanged: function (value) ,_notifyFieldChange: function (value)
{ {
this._lockEntry = true; this._lockField = true;
this._setValue (value); this._setValue (value);
this._lockEntry = false; this._lockField = false;
} }
/**
* Virtual method that must be implemented by class childs to put the value
* on the associated entry.
*
* @param {*} value The new value for the entry
*/
,_putFieldValue: function () {}
/** /**
* Virtual method that must be implemented by class childs to set the entry * Virtual method that must be implemented by class childs to set the entry
* editable. * editable.
@ -137,13 +148,5 @@ module.exports = new Class
* @param {boolean} editable Whether the user is allowed to edit the entry * @param {boolean} editable Whether the user is allowed to edit the entry
*/ */
,setEditable: function () {} ,setEditable: function () {}
/**
* Virtual method that must be implemented by class childs to put the value
* on the associated entry.
*
* @param {*} value The new value for the entry
*/
,putValue: function () {}
}); });

View File

@ -234,7 +234,7 @@ module.exports = new Class
this.selectedCell = cellIndex; this.selectedCell = cellIndex;
} }
,putValue: function () ,_putFieldValue: function ()
{ {
this.goToSelectedMonth (); this.goToSelectedMonth ();
} }
@ -249,7 +249,7 @@ module.exports = new Class
var newDate = new Date (this.year, this.month, cell.day); var newDate = new Date (this.year, this.month, cell.day);
this.emit ('pick', newDate); this.emit ('pick', newDate);
this.valueChanged (newDate); this._notifyFieldChange (newDate);
} }
} }

View File

@ -13,10 +13,10 @@ module.exports = new Class
,changed: function () ,changed: function ()
{ {
this.valueChanged (this.node.checked); this._notifyFieldChange (this.node.checked);
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
if (value) if (value)
this.node.checked = true; this.node.checked = true;

View File

@ -101,6 +101,22 @@ module.exports = new Class
return this._notNull; return this._notNull;
} }
}, },
/**
* The field to use for internal value.
*/
valueField:
{
type: String,
value: 'id'
},
/**
* The field to display.
*/
showField:
{
type: String,
value: 'name'
},
params: params:
{ {
type: Object type: Object
@ -125,16 +141,6 @@ module.exports = new Class
return this._params; return this._params;
} }
} }
,valueField:
{
type: String,
value: 'id'
}
,showField:
{
type: String,
value: 'name'
}
} }
,_row: -1 ,_row: -1
@ -144,22 +150,33 @@ module.exports = new Class
,render: function () ,render: function ()
{ {
var node = this.createRoot ('div'); var node = this.createRoot ('div');
node.className = 'htk-combo'; node.className = 'htk-combo input clickable';
node.tabIndex = 0;
node.addEventListener ('mousedown',
this._onMouseDown.bind (this));
var icons = this.createElement ('div');
icons.className = 'icons';
node.appendChild (icons);
var clearButton = this.createElement ('htk-icon'); var clearButton = this.createElement ('htk-icon');
clearButton.className = 'clear'; clearButton.className = 'clear button';
clearButton.icon = 'close'; clearButton.icon = 'close';
clearButton.node.title = _('Clear');
clearButton.on ('click', this._onClearClick, this); clearButton.on ('click', this._onClearClick, this);
node.appendChild (clearButton.node); clearButton.on ('mousedown', this._onClearMouseDown, this);
icons.appendChild (clearButton.node);
var button = this.createElement ('button'); var downIcon = this.createElement ('htk-icon');
button.type = 'button'; downIcon.className = 'down';
button.className = 'htk-combo input'; downIcon.icon = 'down';
button.addEventListener ('mousedown', icons.appendChild (downIcon.node);
this._onButtonMouseDown.bind (this));
node.appendChild (button);
this.button = button; var text = this.createElement ('div');
text.className = 'text';
node.appendChild (text);
this.text = text;
this.clearButton = clearButton; this.clearButton = clearButton;
this._refreshShowText (); this._refreshShowText ();
} }
@ -169,6 +186,11 @@ module.exports = new Class
this.value = null; this.value = null;
} }
,_onClearMouseDown: function (_, event)
{
event.preventDefault ();
}
,_setRow: function (row) ,_setRow: function (row)
{ {
this._row = row; this._row = row;
@ -176,8 +198,11 @@ module.exports = new Class
this.rowChanged (); this.rowChanged ();
} }
,_onButtonMouseDown: function (e) ,_onMouseDown: function (e)
{ {
if (e.defaultPrevented)
return;
if (this._popup) if (this._popup)
{ {
this._popup.hide (); this._popup.hide ();
@ -209,6 +234,7 @@ module.exports = new Class
,_onGridClicked: function (grid, e) ,_onGridClicked: function (grid, e)
{ {
e.stopPropagation ();
var target = e.target; var target = e.target;
var parentNode = target.parentNode; var parentNode = target.parentNode;
@ -226,11 +252,18 @@ module.exports = new Class
else else
value = null; value = null;
this._setRow (row);
this.valueChanged (value);
this._popup.hide (); this._popup.hide ();
e.stopPropagation (); var changed = this._putValue (value);
this._setRow (row);
if (changed)
{
if (this.conditionalFunc)
this.conditionalFunc (this, newValue);
this._notifyChanges ();
}
} }
,_onPopupClose: function () ,_onPopupClose: function ()
@ -254,15 +287,15 @@ module.exports = new Class
if (this.node) if (this.node)
{ {
var visibility; var display;
if (this._value && !this._notNull) if (this._value && !this._notNull)
visibility = 'visible'; display = '';
else else
visibility = 'hidden'; display = 'none';
this.clearButton.node.style.visibility = visibility; this.clearButton.node.style.display = display;
Vn.Node.setText (this.button, showText); Vn.Node.setText (this.text, showText);
} }
} }
@ -283,11 +316,6 @@ module.exports = new Class
this._setRow (-1); this._setRow (-1);
} }
,setEditable: function (editable)
{
this.node.disabled = !editable;
}
,_selectOption: function () ,_selectOption: function ()
{ {
var row; var row;
@ -300,8 +328,13 @@ module.exports = new Class
this._setRow (row); this._setRow (row);
} }
,putValue: function () ,_putFieldValue: function ()
{ {
this._selectOption (); this._selectOption ();
} }
,setEditable: function (editable)
{
this.node.disabled = !editable;
}
}); });

View File

@ -21,7 +21,7 @@ module.exports = new Class
this.setEditable (this._editable); this.setEditable (this._editable);
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
var dateString; var dateString;
@ -72,11 +72,11 @@ module.exports = new Class
this.popup.hide (); this.popup.hide ();
var newDate = calendar.value; var newDate = calendar.value;
this.putValue (newDate); this._putFieldValue (newDate);
this.valueChanged (newDate); this._notifyFieldChange (newDate);
} }
,_onClick: function (event) ,_onClick: function ()
{ {
this.ignoreCalendarChange = true; this.ignoreCalendarChange = true;
this.calendar.value = this._value; this.calendar.value = this._value;

View File

@ -20,10 +20,10 @@ module.exports = new Class
else else
newValue = this.node.value; newValue = this.node.value;
this.valueChanged (newValue); this._notifyFieldChange (newValue);
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
if (!value) if (!value)
this.node.value = ''; this.node.value = '';

View File

@ -9,7 +9,7 @@ module.exports = new Class
this.createRoot ('div'); this.createRoot ('div');
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
this.node.innerHTML = value; this.node.innerHTML = value;
} }

View File

@ -160,7 +160,7 @@ module.exports = new Class
this.img.src = ''; this.img.src = '';
} }
,putValue: function () ,_putFieldValue: function ()
{ {
this._refreshSrc (); this._refreshSrc ();
} }

View File

@ -14,7 +14,7 @@ module.exports = new Class
,set: function (x) ,set: function (x)
{ {
this._format = _(x); this._format = _(x);
this.putValue (this._value); this._putFieldValue (this._value);
} }
,get: function () ,get: function ()
{ {
@ -52,7 +52,7 @@ module.exports = new Class
this.createRoot ('label'); this.createRoot ('label');
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
Vn.Node.setText (this.node, Vn.Node.setText (this.node,
Vn.Value.format (value, this._format)); Vn.Value.format (value, this._format));

View File

@ -64,7 +64,7 @@ module.exports = new Class
this.node.checked = false; this.node.checked = false;
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
if (!value) if (!value)
this.node.value = ''; this.node.value = '';

View File

@ -34,10 +34,10 @@ module.exports = new Class
else else
newValue = this._input.value; newValue = this._input.value;
this.valueChanged (newValue); this._notifyFieldChange (newValue);
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
if (!value) if (!value)
this._input.value = ''; this._input.value = '';

View File

@ -18,10 +18,10 @@ module.exports = new Class
{ {
var newValue = (this.node.value == '') ? null : parseFloat (this.node.value); var newValue = (this.node.value == '') ? null : parseFloat (this.node.value);
this.node.value = newValue; this.node.value = newValue;
this.valueChanged (newValue); this._notifyFieldChange (newValue);
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
var text; var text;

View File

@ -19,7 +19,7 @@ module.exports = new Class
else else
value = this.node.value; value = this.node.value;
this.valueChanged (value); this._notifyFieldChange (value);
} }
,setEditable: function (editable) ,setEditable: function (editable)
@ -27,7 +27,7 @@ module.exports = new Class
this.node.readOnly = !editable; this.node.readOnly = !editable;
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
if (!value) if (!value)
this.node.value = ''; this.node.value = '';

View File

@ -14,7 +14,7 @@ module.exports = new Class
,set: function (x) ,set: function (x)
{ {
this._format = _(x); this._format = _(x);
this.putValue (this._value); this._putFieldValue (this._value);
} }
,get: function () ,get: function ()
{ {
@ -30,7 +30,7 @@ module.exports = new Class
this._node = this.createTextNode (''); this._node = this.createTextNode ('');
} }
,putValue: function (value) ,_putFieldValue: function (value)
{ {
this._node.nodeValue = Vn.Value.format (value, this._format); this._node.nodeValue = Vn.Value.format (value, this._format);
} }

View File

@ -122,7 +122,6 @@ module.exports = new Class
var bg = this._bg = this.createElement ('div'); var bg = this._bg = this.createElement ('div');
bg.className = 'htk-background'; bg.className = 'htk-background';
bg.addEventListener ('mousedown', this._bgMouseDownHandler); bg.addEventListener ('mousedown', this._bgMouseDownHandler);
Htk.Toast.pushTop (bg);
Vn.Node.addClass (node, 'modal'); Vn.Node.addClass (node, 'modal');
bg.appendChild (node); bg.appendChild (node);
@ -245,7 +244,6 @@ module.exports = new Class
if (this._bg) if (this._bg)
{ {
Htk.Toast.popTop ();
Vn.Node.remove (this._bg); Vn.Node.remove (this._bg);
Vn.Node.removeClass (node, 'modal'); Vn.Node.removeClass (node, 'modal');
this._bg = null; this._bg = null;

View File

@ -136,33 +136,43 @@ td.cell-image .htk-image
.htk-combo .htk-combo
{ {
position: relative; line-height: 2.2em;
}
.htk-combo > .text
{
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
} }
.htk-combo > button .htk-combo > button
{ {
max-width: 100%; max-width: 100%;
height: 2em; height: 2em;
text-align: left; text-align: left;
z-index: 1;
} }
.htk-combo > .clear .htk-combo > .icons
{
float: right;
height: 100%;
z-index: 100;
display: block;
}
.htk-combo > .icons > *
{
vertical-align: middle;
display: inline;
}
.htk-combo > .icons > .clear
{ {
position: absolute;
right: 0;
margin: .2em;
padding: .3em; padding: .3em;
cursor: pointer; margin: 0;
z-index: 2;
border-radius: .1em; border-radius: .1em;
visibility: hidden; z-index: 40;
display: none;
} }
.htk-combo:hover > .clear .htk-combo:hover > .icons > .clear
{ {
visibility: visible; display: inline;
}
.htk-combo > .clear:hover
{
background-color: rgba(0, 0, 0, 0.1)
} }
.htk-combo-menu .htk-combo-menu

View File

@ -39,39 +39,6 @@ module.exports =
this._showText (message, 'error'); this._showText (message, 'error');
} }
,pushTop: function (top)
{
this._topHeap.push (top);
this._refreshPosition ();
}
,popTop: function ()
{
var top = this._topHeap.pop ();
this._refreshPosition ();
return top;
}
,_refreshPosition: function ()
{
if (!this._container)
return;
var left;
var heapLen = this._topHeap.length;
if (heapLen > 0)
{
var top = this._topHeap[heapLen - 1];
var rect = top.getBoundingClientRect ();
left = (rect.left + parseInt (rect.width / 2) - window.pageXOffset) +'px';
}
else
left = '';
this._container.style.left = left;
}
/** /**
* Hides all currently displayed toast messages. * Hides all currently displayed toast messages.
*/ */
@ -106,8 +73,6 @@ module.exports =
this._timeouts = []; this._timeouts = [];
this._container = container; this._container = container;
} }
this._refreshPosition ();
} }
,_showText: function (message, className) ,_showText: function (message, className)

View File

@ -37,36 +37,12 @@ module.exports = new Class
} }
} }
,refresh: function ()
{
if (this._model)
this._model.refresh ();
}
/**
* Get the index of the column from its name.
*
* @param {string} columnName The column name
* @return {integer} The column index or -1 if column not exists
*/
,getColumnIndex: function (columnName)
{
return this._model ?
this._model.getColumnIndex (columnName) : -1;
}
,insertRow: function () ,insertRow: function ()
{ {
if (this._model) if (this._model)
this.row = this._model.insertRow (); this.row = this._model.insertRow ();
} }
,performOperations: function ()
{
if (this._model)
this._model.performOperations ();
}
/** /**
* Removes the current row. * Removes the current row.
*/ */
@ -98,26 +74,4 @@ module.exports = new Class
{ {
this._model.set (this._row, columnName, value); this._model.set (this._row, columnName, value);
} }
/**
* Gets a value from the form using the column index.
*
* @param {string} columnName The column index
* @return {Object} The value
*/
,getByIndex: function (column)
{
return this._model.getByIndex (this._row, column);
}
/**
* Sets a value on the form using the column index.
*
* @param {string} columnName The column index
* @param {Object} value The new value
*/
,setByIndex: function (column, value)
{
return this._model.setByIndex (this._row, column, value);
}
}); });

View File

@ -66,14 +66,25 @@ module.exports = new Class
,_oneWay: false ,_oneWay: false
,_setValue: function (newValue) ,_setValue: function (newValue)
{
if (this._putValue (newValue))
this._notifyChanges ();
}
,_putValue: function (newValue)
{ {
if (Value.simpleEquals (newValue, this._value)) if (Value.simpleEquals (newValue, this._value))
return; return false;
this._value = Value.simpleClone (newValue); this._value = Value.simpleClone (newValue);
return true;
}
,_notifyChanges: function ()
{
this._refreshLot (); this._refreshLot ();
this._refreshParam (); this._refreshParam ();
this.emit ('changed', newValue); this.emit ('changed', this._value);
} }
,_setType: function (type) ,_setType: function (type)