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

View File

@ -1,7 +1,6 @@
package rui
import (
"fmt"
"strconv"
"strings"
)
@ -650,10 +649,6 @@ func (tabsLayout *tabsLayoutData) RemoveView(index int) 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) {
tabsLayout.viewsContainerData.htmlProperties(self, buffer)
buffer.WriteString(` data-inactiveTabStyle="`)
@ -661,7 +656,7 @@ func (tabsLayout *tabsLayoutData) htmlProperties(self View, buffer *strings.Buil
buffer.WriteString(`" data-activeTabStyle="`)
buffer.WriteString(tabsLayout.activeTabStyle())
buffer.WriteString(`" data-current="`)
buffer.WriteString(tabsLayout.currentID())
buffer.WriteString(strconv.Itoa(tabsLayout.currentItem(0)))
buffer.WriteRune('"')
}