forked from mbk-lab/rui_orig
2
0
Fork 0

Bug fixing

This commit is contained in:
anoshenko 2023-05-04 13:37:26 +03:00
parent f75435eb6c
commit b6b5183f21
2 changed files with 15 additions and 18 deletions

View File

@ -242,22 +242,26 @@ function enterOrSpaceKeyClickEvent(event) {
function activateTab(layoutId, tabNumber) { function activateTab(layoutId, tabNumber) {
var element = document.getElementById(layoutId); var element = document.getElementById(layoutId);
if (element) { if (element) {
var currentTabId = element.getAttribute("data-current"); var currentNumber = element.getAttribute("data-current");
var newTabId = layoutId + '-' + tabNumber; if (currentNumber != tabNumber) {
if (currentTabId != newTabId) { function setTab(number, styleProperty, display) {
function setTab(tabId, styleProperty, display) { var tab = document.getElementById(layoutId + '-' + number);
var tab = document.getElementById(tabId);
if (tab) { if (tab) {
tab.className = element.getAttribute(styleProperty); tab.className = element.getAttribute(styleProperty);
var page = document.getElementById(tab.getAttribute("data-view")); var page = document.getElementById(tab.getAttribute("data-view"));
if (page) { if (page) {
page.style.display = display; page.style.display = display;
} }
return
}
var page = document.getElementById(layoutId + "-page" + number);
if (page) {
page.style.display = display;
} }
} }
setTab(currentTabId, "data-inactiveTabStyle", "none") setTab(currentNumber, "data-inactiveTabStyle", "none")
setTab(newTabId, "data-activeTabStyle", ""); setTab(tabNumber, "data-activeTabStyle", "");
element.setAttribute("data-current", newTabId); element.setAttribute("data-current", tabNumber);
scanElementsSize() scanElementsSize()
} }
} }
@ -1557,6 +1561,8 @@ function tableViewCellKeyDownEvent(element, event) {
case "End": case "End":
case "PageUp": case "PageUp":
case "PageDown": case "PageDown":
event.stopPropagation();
event.preventDefault();
const rows = element.getAttribute("data-rows"); const rows = element.getAttribute("data-rows");
const columns = element.getAttribute("data-columns"); const columns = element.getAttribute("data-columns");
if (rows && columns) { if (rows && columns) {
@ -1567,8 +1573,6 @@ function tableViewCellKeyDownEvent(element, event) {
column = 0; column = 0;
while (columns < columnCount) { while (columns < columnCount) {
if (setTableCellCursor(element, row, column)) { if (setTableCellCursor(element, row, column)) {
event.stopPropagation();
event.preventDefault();
return; return;
} }
column++; column++;
@ -1576,8 +1580,6 @@ function tableViewCellKeyDownEvent(element, event) {
row++; row++;
} }
} }
event.stopPropagation();
event.preventDefault();
break; break;
} }
return; return;

View File

@ -1,7 +1,6 @@
package rui package rui
import ( import (
"fmt"
"strconv" "strconv"
"strings" "strings"
) )
@ -650,10 +649,6 @@ func (tabsLayout *tabsLayoutData) RemoveView(index int) View {
return view return view
} }
func (tabsLayout *tabsLayoutData) currentID() string {
return fmt.Sprintf("%s-%d", tabsLayout.htmlID(), tabsLayout.currentItem(0))
}
func (tabsLayout *tabsLayoutData) htmlProperties(self View, buffer *strings.Builder) { func (tabsLayout *tabsLayoutData) htmlProperties(self View, buffer *strings.Builder) {
tabsLayout.viewsContainerData.htmlProperties(self, buffer) tabsLayout.viewsContainerData.htmlProperties(self, buffer)
buffer.WriteString(` data-inactiveTabStyle="`) buffer.WriteString(` data-inactiveTabStyle="`)
@ -661,7 +656,7 @@ func (tabsLayout *tabsLayoutData) htmlProperties(self View, buffer *strings.Buil
buffer.WriteString(`" data-activeTabStyle="`) buffer.WriteString(`" data-activeTabStyle="`)
buffer.WriteString(tabsLayout.activeTabStyle()) buffer.WriteString(tabsLayout.activeTabStyle())
buffer.WriteString(`" data-current="`) buffer.WriteString(`" data-current="`)
buffer.WriteString(tabsLayout.currentID()) buffer.WriteString(strconv.Itoa(tabsLayout.currentItem(0)))
buffer.WriteRune('"') buffer.WriteRune('"')
} }