duration focus after update fix
This commit is contained in:
@@ -41,6 +41,7 @@ import Selectize from 'lib!selectize';
|
||||
* searched items.
|
||||
* @property {'value'|'text'|'$order'|'$score'} [sortBy='$order'] Item sorting.
|
||||
* @property {'asc'|'desc'} [sortDirection='asc'] Sort direction.
|
||||
* @property {function()} [onFocus] On-focus callback.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -153,6 +154,12 @@ const Select = {
|
||||
},
|
||||
};
|
||||
|
||||
if (options.onFocus) {
|
||||
selectizeOptions.onFocus = function () {
|
||||
options.onFocus();
|
||||
};
|
||||
}
|
||||
|
||||
if (!options.matchAnyWord) {
|
||||
/** @this Selectize */
|
||||
selectizeOptions.score = function (search) {
|
||||
|
||||
@@ -38,6 +38,12 @@ class DurationFieldView extends EnumFieldView {
|
||||
detailTemplate = 'fields/varchar/detail'
|
||||
editTemplate = 'fields/duration/edit'
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_justFocused = false
|
||||
|
||||
data() {
|
||||
const valueIsSet = this.model.has(this.startField) && this.model.has(this.endField);
|
||||
|
||||
@@ -342,6 +348,10 @@ class DurationFieldView extends EnumFieldView {
|
||||
|
||||
callback(list);
|
||||
},
|
||||
onFocus: () => {
|
||||
this._justFocused = true;
|
||||
setTimeout(() => this._justFocused = false, 150);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -435,7 +445,7 @@ class DurationFieldView extends EnumFieldView {
|
||||
updateDuration() {
|
||||
const seconds = this.seconds;
|
||||
|
||||
if (this.isEditMode() && this.$duration && this.$duration.length) {
|
||||
if (this.isEditMode() && this.$duration && this.$duration.length && !this._justFocused) {
|
||||
const options = this.getOptions().map(value => {
|
||||
return {
|
||||
value: value.toString(),
|
||||
|
||||
Reference in New Issue
Block a user