mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
Fix all type errors in design system (#3956)
* 📘 Fix type errors in design system * 🔥 Remove unneeded `?` * 🔧 Add design system to Vetur * 📘 Improve typing of `$el` * ♻️ Address feedback * 📘 Type leftover `MouseEvent` * 📘 Type `event.target` properly
This commit is contained in:
@@ -51,12 +51,13 @@ export default Vue.extend({
|
||||
N8nIcon,
|
||||
},
|
||||
mounted() {
|
||||
const container = this.$refs.tabs;
|
||||
const container = this.$refs.tabs as HTMLDivElement | undefined;
|
||||
if (container) {
|
||||
container.addEventListener('scroll', (e) => {
|
||||
container.addEventListener('scroll', (event: Event) => {
|
||||
const width = container.clientWidth;
|
||||
const scrollWidth = container.scrollWidth;
|
||||
this.scrollPosition = e.srcElement.scrollLeft;
|
||||
// @ts-ignore
|
||||
this.scrollPosition = event.srcElement.scrollLeft;
|
||||
this.canScrollRight = scrollWidth - width > this.scrollPosition;
|
||||
});
|
||||
|
||||
@@ -73,13 +74,15 @@ export default Vue.extend({
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
this.resizeObserver.disconnect();
|
||||
if (this.resizeObserver) {
|
||||
this.resizeObserver.disconnect();
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
scrollPosition: 0,
|
||||
canScrollRight: false,
|
||||
resizeObserver: null,
|
||||
resizeObserver: null as ResizeObserver | null,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
@@ -102,13 +105,16 @@ export default Vue.extend({
|
||||
this.scroll(50);
|
||||
},
|
||||
scroll(left: number) {
|
||||
const container = this.$refs.tabs;
|
||||
const container = this.$refs.tabs as (HTMLDivElement & { scrollBy: ScrollByFunction }) | undefined;
|
||||
if (container) {
|
||||
container.scrollBy({ left, top: 0, behavior: 'smooth' });
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
type ScrollByFunction = (arg: { left: number, top: number, behavior: 'smooth' | 'instant' | 'auto' }) => void;
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user