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:
Iván Ovejero
2022-08-29 12:21:40 +02:00
committed by GitHub
parent 1e6b1b8227
commit 3ae6450f0b
29 changed files with 153 additions and 104 deletions

View File

@@ -77,24 +77,27 @@ export default Vue.extend({
},
);
},
onClick(e) {
if (e.target.localName !== 'a') return;
onClick(event: MouseEvent) {
if (!(event.target instanceof HTMLElement)) return;
if (e.target.dataset && e.target.dataset.key) {
e.stopPropagation();
e.preventDefault();
if (event.target.localName !== 'a') return;
if (e.target.dataset.key === 'show-less') {
if (event.target.dataset && event.target.dataset.key) {
event.stopPropagation();
event.preventDefault();
if (event.target.dataset.key === 'show-less') {
this.showFullContent = false;
} else if (this.canTruncate && e.target.dataset.key === 'toggle-expand') {
} else if (this.canTruncate && event.target.dataset.key === 'toggle-expand') {
this.showFullContent = !this.showFullContent;
} else {
this.$emit('action', e.target.dataset.key);
this.$emit('action', event.target.dataset.key);
}
}
},
},
});
</script>
<style lang="scss" module>