2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-16 09:10:33 +03:00

refactor: apply eslint fixes (#1469)

This commit is contained in:
Jeff Sagal
2021-08-01 12:30:50 -07:00
committed by GitHub
parent a64ffc32d0
commit dd281aa8c6
85 changed files with 3616 additions and 3208 deletions
+3 -1
View File
@@ -1,5 +1,7 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10">
<path d="M6.895455 5l2.842897-2.842898c.348864-.348863.348864-.914488 0-1.263636L9.106534.261648c-.348864-.348864-.914489-.348864-1.263636 0L5 3.104545 2.157102.261648c-.348863-.348864-.914488-.348864-1.263636 0L.261648.893466c-.348864.348864-.348864.914489 0 1.263636L3.104545 5 .261648 7.842898c-.348864.348863-.348864.914488 0 1.263636l.631818.631818c.348864.348864.914773.348864 1.263636 0L5 6.895455l2.842898 2.842897c.348863.348864.914772.348864 1.263636 0l.631818-.631818c.348864-.348864.348864-.914489 0-1.263636L6.895455 5z"/>
<path
d="M6.895455 5l2.842897-2.842898c.348864-.348863.348864-.914488 0-1.263636L9.106534.261648c-.348864-.348864-.914489-.348864-1.263636 0L5 3.104545 2.157102.261648c-.348863-.348864-.914488-.348864-1.263636 0L.261648.893466c-.348864.348864-.348864.914489 0 1.263636L3.104545 5 .261648 7.842898c-.348864.348863-.348864.914488 0 1.263636l.631818.631818c.348864.348864.914773.348864 1.263636 0L5 6.895455l2.842898 2.842897c.348863.348864.914772.348864 1.263636 0l.631818-.631818c.348864-.348864.348864-.914489 0-1.263636L6.895455 5z"
/>
</svg>
</template>
+3 -1
View File
@@ -1,5 +1,7 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="10">
<path d="M9.211364 7.59931l4.48338-4.867229c.407008-.441854.407008-1.158247 0-1.60046l-.73712-.80023c-.407008-.441854-1.066904-.441854-1.474243 0L7 5.198617 2.51662.33139c-.407008-.441853-1.066904-.441853-1.474243 0l-.737121.80023c-.407008.441854-.407008 1.158248 0 1.600461l4.48338 4.867228L7 10l2.211364-2.40069z"/>
<path
d="M9.211364 7.59931l4.48338-4.867229c.407008-.441854.407008-1.158247 0-1.60046l-.73712-.80023c-.407008-.441854-1.066904-.441854-1.474243 0L7 5.198617 2.51662.33139c-.407008-.441853-1.066904-.441853-1.474243 0l-.737121.80023c-.407008.441854-.407008 1.158248 0 1.600461l4.48338 4.867228L7 10l2.211364-2.40069z"
/>
</svg>
</template>
+1199 -1100
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,7 +1,7 @@
import Deselect from './Deselect';
import OpenIndicator from './OpenIndicator';
import Deselect from './Deselect'
import OpenIndicator from './OpenIndicator'
export default {
Deselect,
OpenIndicator
OpenIndicator,
}
+31 -24
View File
@@ -1,27 +1,34 @@
export default {
inserted (el, bindings, {context}) {
if (context.appendToBody) {
const {height, top, left, width} = context.$refs.toggle.getBoundingClientRect();
let scrollX = window.scrollX || window.pageXOffset;
let scrollY = window.scrollY || window.pageYOffset;
el.unbindPosition = context.calculatePosition(el, context, {
width: width + 'px',
left: (scrollX + left) + 'px',
top: (scrollY + top + height) + 'px',
});
document.body.appendChild(el);
}
},
inserted(el, bindings, { context }) {
if (context.appendToBody) {
const {
height,
top,
left,
width,
} = context.$refs.toggle.getBoundingClientRect()
unbind (el, bindings, {context}) {
if (context.appendToBody) {
if (el.unbindPosition && typeof el.unbindPosition === 'function') {
el.unbindPosition();
}
if (el.parentNode) {
el.parentNode.removeChild(el);
}
}
},
let scrollX = window.scrollX || window.pageXOffset
let scrollY = window.scrollY || window.pageYOffset
el.unbindPosition = context.calculatePosition(el, context, {
width: width + 'px',
left: scrollX + left + 'px',
top: scrollY + top + height + 'px',
})
document.body.appendChild(el)
}
},
unbind(el, bindings, { context }) {
if (context.appendToBody) {
if (el.unbindPosition && typeof el.unbindPosition === 'function') {
el.unbindPosition()
}
if (el.parentNode) {
el.parentNode.removeChild(el)
}
}
},
}
+10 -10
View File
@@ -11,10 +11,10 @@ export default {
},
},
data () {
data() {
return {
mutableLoading: false,
};
}
},
watch: {
@@ -27,8 +27,8 @@ export default {
*
* @emits search
*/
search () {
this.$emit('search', this.search, this.toggleLoading);
search() {
this.$emit('search', this.search, this.toggleLoading)
},
/**
@@ -36,8 +36,8 @@ export default {
* mutable loading value.
* @param val
*/
loading (val) {
this.mutableLoading = val;
loading(val) {
this.mutableLoading = val
},
},
@@ -49,11 +49,11 @@ export default {
* @param toggle Boolean
* @returns {*}
*/
toggleLoading (toggle = null) {
toggleLoading(toggle = null) {
if (toggle == null) {
return (this.mutableLoading = !this.mutableLoading);
return (this.mutableLoading = !this.mutableLoading)
}
return (this.mutableLoading = toggle);
return (this.mutableLoading = toggle)
},
},
};
}
+13 -13
View File
@@ -2,14 +2,14 @@ export default {
props: {
autoscroll: {
type: Boolean,
default: true
}
default: true,
},
},
watch: {
typeAheadPointer() {
if (this.autoscroll) {
this.maybeAdjustScroll();
this.maybeAdjustScroll()
}
},
},
@@ -23,17 +23,17 @@ export default {
*/
maybeAdjustScroll() {
const optionEl =
this.$refs.dropdownMenu?.children[this.typeAheadPointer] || false;
this.$refs.dropdownMenu?.children[this.typeAheadPointer] || false
if (optionEl) {
const bounds = this.getDropdownViewport();
const { top, bottom, height } = optionEl.getBoundingClientRect();
const bounds = this.getDropdownViewport()
const { top, bottom, height } = optionEl.getBoundingClientRect()
if (top < bounds.top) {
return (this.$refs.dropdownMenu.scrollTop = optionEl.offsetTop);
return (this.$refs.dropdownMenu.scrollTop = optionEl.offsetTop)
} else if (bottom > bounds.bottom) {
return (this.$refs.dropdownMenu.scrollTop =
optionEl.offsetTop - (bounds.height - height));
optionEl.offsetTop - (bounds.height - height))
}
}
},
@@ -48,8 +48,8 @@ export default {
: {
height: 0,
top: 0,
bottom: 0
};
}
}
};
bottom: 0,
}
},
},
}
+17 -13
View File
@@ -1,7 +1,7 @@
export default {
data() {
return {
typeAheadPointer: -1
typeAheadPointer: -1,
}
},
@@ -9,11 +9,11 @@ export default {
filteredOptions() {
for (let i = 0; i < this.filteredOptions.length; i++) {
if (this.selectable(this.filteredOptions[i])) {
this.typeAheadPointer = i;
break;
this.typeAheadPointer = i
break
}
}
}
},
},
methods: {
@@ -25,8 +25,8 @@ export default {
typeAheadUp() {
for (let i = this.typeAheadPointer - 1; i >= 0; i--) {
if (this.selectable(this.filteredOptions[i])) {
this.typeAheadPointer = i;
break;
this.typeAheadPointer = i
break
}
}
},
@@ -37,10 +37,14 @@ export default {
* @return {void}
*/
typeAheadDown() {
for (let i = this.typeAheadPointer + 1; i < this.filteredOptions.length; i++) {
for (
let i = this.typeAheadPointer + 1;
i < this.filteredOptions.length;
i++
) {
if (this.selectable(this.filteredOptions[i])) {
this.typeAheadPointer = i;
break;
this.typeAheadPointer = i
break
}
}
},
@@ -51,11 +55,11 @@ export default {
* @return {void}
*/
typeAheadSelect() {
const typeAheadOption = this.filteredOptions[this.typeAheadPointer];
const typeAheadOption = this.filteredOptions[this.typeAheadPointer]
if (typeAheadOption) {
this.select(typeAheadOption);
this.select(typeAheadOption)
}
}
}
},
},
}
+8 -6
View File
@@ -3,13 +3,15 @@
* @return {string}
*/
function sortAndStringify(sortable) {
const ordered = {};
const ordered = {}
Object.keys(sortable).sort().forEach(key => {
ordered[key] = sortable[key];
});
Object.keys(sortable)
.sort()
.forEach((key) => {
ordered[key] = sortable[key]
})
return JSON.stringify(ordered);
return JSON.stringify(ordered)
}
export default sortAndStringify;
export default sortAndStringify
+3 -3
View File
@@ -1,4 +1,4 @@
let idCount = 0;
let idCount = 0
/**
* Dead simple unique ID implementation.
@@ -6,7 +6,7 @@ let idCount = 0;
* @return {number}
*/
function uniqueId() {
return ++idCount;
return ++idCount
}
export default uniqueId;
export default uniqueId