From da14a41387ba5794f8fde72f0133c7621c6ef6b6 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 6 Mar 2025 13:56:00 +0200 Subject: [PATCH 1/2] duration focus after update fix --- client/src/ui/select.js | 7 +++++++ client/src/views/fields/duration.js | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/client/src/ui/select.js b/client/src/ui/select.js index 4a7505974d..43b17fed33 100644 --- a/client/src/ui/select.js +++ b/client/src/ui/select.js @@ -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) { diff --git a/client/src/views/fields/duration.js b/client/src/views/fields/duration.js index 744b7392fc..be61d51e7d 100644 --- a/client/src/views/fields/duration.js +++ b/client/src/views/fields/duration.js @@ -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(), From 5cfbdb21e983330462ee4ce8c4a489d63886ef9a Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Tue, 11 Mar 2025 19:01:15 +0200 Subject: [PATCH 2/2] style fix --- client/res/templates/record/search.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/res/templates/record/search.tpl b/client/res/templates/record/search.tpl index 446e4d46fc..5488d16b3f 100644 --- a/client/res/templates/record/search.tpl +++ b/client/res/templates/record/search.tpl @@ -158,7 +158,7 @@