pull/5677/head
mertsincan 2024-04-25 01:44:13 +01:00
parent 38b4683485
commit 866643ef2b
2 changed files with 19 additions and 6 deletions

View File

@ -113,16 +113,26 @@ export default {
const { content, inkbar, tabs } = this.$refs;
const activeTab = DomHandler.findSingle(content, '[data-pc-name="tab"][data-p-active="true"]');
inkbar.style.width = DomHandler.getOuterWidth(activeTab) + 'px';
inkbar.style.left = DomHandler.getOffset(activeTab).left - DomHandler.getOffset(tabs).left + 'px';
if (this.$pcTabs.isVertical()) {
inkbar.style.height = DomHandler.getOuterHeight(activeTab) + 'px';
inkbar.style.top = DomHandler.getOffset(activeTab).top - DomHandler.getOffset(tabs).top + 'px';
} else {
inkbar.style.width = DomHandler.getOuterWidth(activeTab) + 'px';
inkbar.style.left = DomHandler.getOffset(activeTab).left - DomHandler.getOffset(tabs).left + 'px';
}
},
updateButtonState() {
const { list, content } = this.$refs;
const { scrollLeft, scrollWidth, offsetWidth } = content;
const width = DomHandler.getWidth(content);
const { scrollLeft, scrollTop, scrollWidth, scrollHeight, offsetWidth, offsetHeight } = content;
const [width, height] = [DomHandler.getWidth(content), DomHandler.getHeight(content)];
this.isPrevButtonEnabled = scrollLeft !== 0;
this.isNextButtonEnabled = list.offsetWidth >= offsetWidth && parseInt(scrollLeft) !== scrollWidth - width;
if (this.$pcTabs.isVertical()) {
this.isPrevButtonEnabled = scrollTop !== 0;
this.isNextButtonEnabled = list.offsetHeight >= offsetHeight && parseInt(scrollTop) !== scrollHeight - height;
} else {
this.isPrevButtonEnabled = scrollLeft !== 0;
this.isNextButtonEnabled = list.offsetWidth >= offsetWidth && parseInt(scrollLeft) !== scrollWidth - width;
}
},
getVisibleButtonWidths() {
const { prevBtn, nextBtn } = this.$refs;

View File

@ -36,6 +36,9 @@ export default {
this.d_value = newValue;
this.$emit('update:value', newValue);
}
},
isVertical() {
return this.orientation === 'vertical';
}
}
};