Commits
39
39
40
40
/**
41
41
* Register events.
42
42
*/
43
43
registerEvents() {
44
44
this._events = {
45
45
/**
46
46
* Event called when operation field changes.
47
47
*/
48
48
changeOperation: (ev) => {
49
-
if (ev.target.value == TAG_OPERATOR_EXISTS || ev.target.value == TAG_OPERATOR_NOT_EXISTS) {
50
-
this._value.addClass('display-none');
51
-
this._value._target.closest('td').style.paddingRight = 0;
49
+
const show_value = ev.target.value != TAG_OPERATOR_EXISTS && ev.target.value != TAG_OPERATOR_NOT_EXISTS;
52
50
53
-
if (typeof this._value._target.dataset.text === 'undefined'
54
-
|| this._value._target.dataset.text === '') {
55
-
this._value._target.dataset.text = this._value._target.value;
56
-
this._value._target.value = '';
57
-
}
51
+
if (this._value.hasClass('display-none') != show_value) {
52
+
return;
58
53
}
59
-
else {
54
+
55
+
if (show_value) {
60
56
this._value.removeClass('display-none');
61
57
this._value._target.closest('td').style.paddingRight = null;
62
58
63
-
if (typeof this._value._target.dataset.text !== 'undefined'
64
-
&& this._value._target.dataset.text !== '') {
65
-
this._value._target.value = this._value._target.dataset.text;
66
-
}
67
-
59
+
this._value._target.value = this._value._target.dataset.text;
68
60
this._value._target.dataset.text = '';
69
61
}
62
+
else {
63
+
this._value.addClass('display-none');
64
+
this._value._target.closest('td').style.paddingRight = 0;
65
+
66
+
this._value._target.dataset.text = this._value._target.value;
67
+
this._value._target.value = '';
68
+
}
70
69
}
71
70
}
72
71
73
72
this._operation.on('change', this._events.changeOperation);
74
73
}
75
74
}