vnFocus: Errores solucionados

This commit is contained in:
Juan Ferrer Toribio 2017-02-07 16:04:30 +01:00
parent 692a5b9d44
commit e60084657e
8 changed files with 14 additions and 10 deletions

View File

@ -6,7 +6,7 @@
<vn-check vn-one label="Predeterminado" field="addressData.address.default"></vn-check>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Consignatario" field="addressData.address.consignee" focus></vn-textfield>
<vn-textfield vn-one label="Consignatario" field="addressData.address.consignee" vn-focus></vn-textfield>
<vn-textfield vn-one label="Domicilio" field="addressData.address.street"></vn-textfield>
</vn-horizontal>
<vn-horizontal>

View File

@ -7,7 +7,7 @@
<vn-check vn-one label="Predeterminado" field="addressData.address.default"></vn-check>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Consignatario" field="addressData.address.consignee"></vn-textfield>
<vn-textfield vn-one label="Consignatario" field="addressData.address.consignee" vn-focus></vn-textfield>
<vn-textfield vn-one label="Domicilio" field="addressData.address.street"></vn-textfield>
</vn-horizontal>
<vn-horizontal>

View File

@ -3,7 +3,7 @@
<vn-vertical pad-large>
<vn-title>Datos básicos</vn-title>
<vn-horizontal>
<vn-textfield vn-one label="Nombre" field="$ctrl.client.name" focus></vn-textfield>
<vn-textfield vn-one label="Nombre" field="$ctrl.client.name" vn-focus></vn-textfield>
<vn-textfield vn-one label="NIF/CIF" field="$ctrl.client.fi"></vn-textfield>
<vn-textfield autofocus vn-one label="Razón social" field="$ctrl.client.socialName"></vn-textfield>
</vn-horizontal>

View File

@ -4,7 +4,7 @@
<vn-vertical pad-large>
<vn-title>Crear Cliente</vn-title>
<vn-horizontal>
<vn-textfield vn-one label="Nombre" field="create.client.name" focus></vn-textfield>
<vn-textfield vn-one label="Nombre" field="create.client.name" vn-focus></vn-textfield>
<vn-textfield vn-one label="NIF/CIF" field="create.client.fi"></vn-textfield>
</vn-horizontal>
<vn-horizontal>

View File

@ -7,7 +7,7 @@
<vn-check vn-one label="Factura impresa" field="fiscal.client.invoiceByEmail"></vn-check>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-two label="Domicilio fiscal" field="fiscal.client.street" focus></vn-textfield>
<vn-textfield vn-two label="Domicilio fiscal" field="fiscal.client.street" vn-focus></vn-textfield>
<vn-textfield vn-one label="Municipio" field="fiscal.client.city"></vn-textfield>
</vn-horizontal>
<vn-horizontal>

View File

@ -2,7 +2,7 @@
<vn-card>
<vn-vertical pad-large>
<vn-title>Nueva nota</vn-title>
<vn-textarea label="Nueva nota" model="newNote.note.text" focus padd-medium-top></vn-textarea>
<vn-textarea label="Nueva nota" model="newNote.note.text" vn-focus padd-medium-top></vn-textarea>
</vn-vertical>
</vn-card>
<vn-button-bar>

View File

@ -3,7 +3,7 @@
<vn-vertical pad-large>
<vn-title>Web access</vn-title>
<vn-check label="Acceso Web" field="$ctrl.account.active"></vn-check>
<vn-textfield label="Usuario" class="margin-medium-top" field="$ctrl.account.name" focus></vn-textfield>
<vn-textfield label="Usuario" class="margin-medium-top" field="$ctrl.account.name" vn-focus></vn-textfield>
</vn-vertical>
</vn-card>
<vn-button-bar>
@ -23,7 +23,7 @@
on-open="$ctrl.onPassOpen()"
on-response="$ctrl.onPassChange(response)">
<dbody>
<vn-password label="New password" model="$ctrl.newPassword" focus></vn-password>
<vn-password label="New password" model="$ctrl.newPassword"></vn-password>
<vn-password label="Repeat password" model="$ctrl.repeatPassword"></vn-password>
</dbody>
<buttons>

View File

@ -1,13 +1,17 @@
import {module} from '../module';
/**
* Sets the focus and selects the text on the directive element.
* Sets the focus and selects the text on the input.
*/
export function directive() {
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
var input = $element[0];
var input = $element[0].parentNode.querySelector('input, textarea');
if(!input)
throw new Error(`vnFocus: Can't find an input element`);
input.focus();
input.select();
}