Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
commit
ba62f545f7
|
@ -73,7 +73,7 @@ describe('Ticket Edit basic data path', () => {
|
|||
.wait(1900)
|
||||
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
||||
|
||||
expect(result).toContain('-€187.75');
|
||||
expect(result).toContain('-€208.75');
|
||||
});
|
||||
|
||||
it(`should then click next to move on to step three`, async() => {
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
<vn-horizontal class="text-container">
|
||||
<span class="text" ng-transclude="text" vn-one></span>
|
||||
</vn-horizontal>
|
||||
<div class="field"></div>
|
||||
<span class="text" ng-transclude="text"></span>
|
|
@ -1,38 +1,58 @@
|
|||
import ngModule from '../../module';
|
||||
import Component from '../../lib/component';
|
||||
import {focus} from '../../directives/focus';
|
||||
import './style.scss';
|
||||
|
||||
export default class Controller extends Component {
|
||||
constructor($element, $scope, $transclude) {
|
||||
constructor($element, $scope, $transclude, $timeout) {
|
||||
super($element, $scope);
|
||||
this.$timeout = $timeout;
|
||||
let element = $element[0];
|
||||
element.tabIndex = 0;
|
||||
|
||||
element.addEventListener('focus', () => {
|
||||
if (this.field) return;
|
||||
$transclude((tClone, tScope) => {
|
||||
this.field = tClone;
|
||||
this.tScope = tScope;
|
||||
this.element.querySelector('.field').appendChild(this.field[0]);
|
||||
element.tabIndex = -1;
|
||||
this.timer = $timeout(() => {
|
||||
this.timer = null;
|
||||
focus(this.field[0]);
|
||||
});
|
||||
}, null, 'field');
|
||||
element.classList.add('selected');
|
||||
});
|
||||
|
||||
element.addEventListener('focusout', event => {
|
||||
this.destroyTimer();
|
||||
this.lastEvent = event;
|
||||
let target = event.relatedTarget;
|
||||
while (target && target.parentNode != element)
|
||||
while (target && target != element)
|
||||
target = target.parentNode;
|
||||
|
||||
if (!target) {
|
||||
this.tScope.$destroy();
|
||||
this.field.remove();
|
||||
this.field = null;
|
||||
element.classList.remove('selected');
|
||||
element.tabIndex = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
destroyTimer() {
|
||||
if (this.timer) {
|
||||
this.$timeout.cancel(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$transclude'];
|
||||
$onDestroy() {
|
||||
this.destroyTimer();
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$element', '$scope', '$transclude', '$timeout'];
|
||||
|
||||
ngModule.component('vnTdEditable', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,16 +1,40 @@
|
|||
@import "variables";
|
||||
|
||||
vn-td-editable {
|
||||
cursor: pointer;
|
||||
& > div.text-container{
|
||||
width: 100%;
|
||||
}
|
||||
outline: none;
|
||||
position: relative;
|
||||
|
||||
&.selected {
|
||||
& > .text-container{
|
||||
&.selected > .text {
|
||||
visibility: hidden;
|
||||
}
|
||||
& > .field {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
padding: .6em;
|
||||
overflow: visible;
|
||||
|
||||
vn-icon {
|
||||
font-size: 1em;
|
||||
& > field {
|
||||
flex: 1;
|
||||
background-color: $color-bg-panel;
|
||||
padding: .5em;
|
||||
box-shadow: 0 0 .4em rgba(0, 0, 0, .2);
|
||||
border-radius: .1em;
|
||||
min-width: 6em;
|
||||
|
||||
& > * {
|
||||
width: 100%;
|
||||
max-width: initial;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.selected > .field {
|
||||
display: flex;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,6 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
/**
|
||||
* Sets the focus and selects the text on the input.
|
||||
*
|
||||
* @return {Object} The directive
|
||||
*/
|
||||
export function directive() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function($scope, $element, $attrs) {
|
||||
$scope.$watch('', function() {
|
||||
let input = $element[0];
|
||||
export function focus(input) {
|
||||
let selector = 'input, textarea, button, submit';
|
||||
|
||||
if (!input.matches(selector))
|
||||
|
@ -25,7 +15,18 @@ export function directive() {
|
|||
|
||||
if (input.select)
|
||||
input.select();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the focus and selects the text on the input.
|
||||
*
|
||||
* @return {Object} The directive
|
||||
*/
|
||||
export function directive() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function($scope, $element) {
|
||||
$scope.$watch('', () => focus($element[0]));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -547,7 +547,7 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
|
|||
(5, 1, 2 , 'Object1 Gem1 5', 10, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY)),
|
||||
(6, 1, 3 , 'Object1 Gem1 5', 15, 6.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY)),
|
||||
(7, 2, 11, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()),
|
||||
(8, 4, 11, 'Object4 Armor2 2', 10, 3.26, 0, 0, 0, CURDATE()),
|
||||
(8, 4, 11, 'Object4 Armor2 2', 10, 3.05, 0, 0, 0, CURDATE()),
|
||||
(9, 1, 16, 'Object1 Gem1 5', 5, 9.10, 0, 0, 0, CURDATE()),
|
||||
(10, 2, 16, 'Object2 Gem2 3', 10, 1.07, 0, 0, 0, CURDATE()),
|
||||
(11, 1, 16, 'Object1 Gem1 5', 2, 9.10, 0, 0, 0, CURDATE()),
|
||||
|
|
Loading…
Reference in New Issue