From 3ec9669057b2e5cceae758829d9d8ea31e5e8c92 Mon Sep 17 00:00:00 2001 From: NI Date: Mon, 18 May 2020 23:31:31 +0800 Subject: [PATCH] Refixed tabIndex on the connector window with a better method --- ui/widgets/connector.vue | 7 +------ ui/widgets/connector_field_builder.js | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/ui/widgets/connector.vue b/ui/widgets/connector.vue index 55f554b..d6d3c59 100644 --- a/ui/widgets/connector.vue +++ b/ui/widgets/connector.vue @@ -409,12 +409,7 @@ export default { this.current.fields.push(f); - const newTabIndex = f.nextTabIndex(); - - // Ignore if the field does not contain tabIndex - if (newTabIndex > 1) { - tabIndex = newTabIndex; - } + tabIndex = f.nextTabIndex(); } this.submitterTabIndex = tabIndex > 0 ? tabIndex : 1; diff --git a/ui/widgets/connector_field_builder.js b/ui/widgets/connector_field_builder.js index 204ca29..be858dd 100644 --- a/ui/widgets/connector_field_builder.js +++ b/ui/widgets/connector_field_builder.js @@ -49,17 +49,26 @@ export function build(tabIndex, i, field) { blockedSuggestionValue: "", blockingSuggestion: false, nextTabIndex() { + let nextTabIndex = 0; + if (this.field.readonly) { - return this.tabIndex; + nextTabIndex = this.tabIndex; + } else { + switch (this.field.type) { + case "radio": + nextTabIndex = this.tabIndex + this.field.example.split(",").length; + break; + + default: + nextTabIndex = this.tabIndex + 1; + } } - switch (this.field.type) { - case "radio": - return this.tabIndex + this.field.example.split(",").length; - - default: - return this.tabIndex + 1; + if (tabIndex >= nextTabIndex) { + return tabIndex; } + + return nextTabIndex; }, nextSubTabIndex(subIndex) { if (this.field.readonly) {