From 279234a081e5ea772978732ae5d2e45d8adcd741 Mon Sep 17 00:00:00 2001 From: Zephyrrus Date: Wed, 22 Jul 2020 02:14:06 +0300 Subject: feat: add new search input For now, it clones the autocomplete from buefy, untill a PR or resolution to the opened issue about not being able to manipulate how the suggestions are applied is found --- src/site/components/search-input/SearchInput.vue | 516 +++++++++++++++++++++++ 1 file changed, 516 insertions(+) create mode 100644 src/site/components/search-input/SearchInput.vue (limited to 'src/site/components/search-input') diff --git a/src/site/components/search-input/SearchInput.vue b/src/site/components/search-input/SearchInput.vue new file mode 100644 index 0000000..abc433a --- /dev/null +++ b/src/site/components/search-input/SearchInput.vue @@ -0,0 +1,516 @@ + + + -- cgit v1.2.3 From 90001c2df56d58e69fd199a518ae7f3e4ed327fc Mon Sep 17 00:00:00 2001 From: Zephyrrus Date: Thu, 24 Dec 2020 10:40:50 +0200 Subject: chore: remove trailing commas --- src/site/components/search-input/SearchInput.vue | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/site/components/search-input') diff --git a/src/site/components/search-input/SearchInput.vue b/src/site/components/search-input/SearchInput.vue index abc433a..1c5b983 100644 --- a/src/site/components/search-input/SearchInput.vue +++ b/src/site/components/search-input/SearchInput.vue @@ -90,11 +90,11 @@ export default { value: [Number, String], data: { type: Array, - default: () => [], + default: () => [] }, field: { type: String, - default: 'value', + default: 'value' }, keepFirst: Boolean, clearOnSelect: Boolean, @@ -106,12 +106,12 @@ export default { maxHeight: [String, Number], dropdownPosition: { type: String, - default: 'auto', + default: 'auto' }, iconRight: String, iconRightClickable: Boolean, appendToBody: Boolean, - customSelector: Function, + customSelector: Function }, data() { return { @@ -125,7 +125,7 @@ export default { style: {}, _isAutocomplete: true, _elementRef: 'input', - _bodyEl: undefined, // Used to append to body + _bodyEl: undefined // Used to append to body }; }, computed: { @@ -202,9 +202,9 @@ export default { // eslint-disable-next-line no-nested-ternary maxHeight: this.maxHeight === undefined // eslint-disable-next-line no-restricted-globals - ? null : (isNaN(this.maxHeight) ? this.maxHeight : `${this.maxHeight}px`), + ? null : (isNaN(this.maxHeight) ? this.maxHeight : `${this.maxHeight}px`) }; - }, + } }, watch: { /** @@ -258,7 +258,7 @@ export default { if (this.keepFirst) { this.selectFirstOption(value); } - }, + } }, created() { if (typeof window !== 'undefined') { @@ -507,10 +507,10 @@ export default { left: `${left}px`, width: `${trigger.clientWidth}px`, maxWidth: `${trigger.clientWidth}px`, - zIndex: '99', + zIndex: '99' }; } - }, - }, + } + } }; -- cgit v1.2.3 From fb2c27086f570fec60f4d52dcc9ca80e53186293 Mon Sep 17 00:00:00 2001 From: Pitu Date: Thu, 24 Dec 2020 23:45:16 +0900 Subject: Fix ESLint rules once and for all --- src/site/components/search-input/SearchInput.vue | 49 ++++++++++++------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'src/site/components/search-input') diff --git a/src/site/components/search-input/SearchInput.vue b/src/site/components/search-input/SearchInput.vue index 1c5b983..10728a0 100644 --- a/src/site/components/search-input/SearchInput.vue +++ b/src/site/components/search-input/SearchInput.vue @@ -89,12 +89,12 @@ export default { props: { value: [Number, String], data: { - type: Array, - default: () => [] + 'type': Array, + 'default': () => [] }, field: { - type: String, - default: 'value' + 'type': String, + 'default': 'value' }, keepFirst: Boolean, clearOnSelect: Boolean, @@ -105,8 +105,8 @@ export default { clearable: Boolean, maxHeight: [String, Number], dropdownPosition: { - type: String, - default: 'auto' + 'type': String, + 'default': 'auto' }, iconRight: String, iconRightClickable: Boolean, @@ -159,25 +159,25 @@ export default { * Check if exists default slot */ hasDefaultSlot() { - return !!this.$scopedSlots.default; + return Boolean(this.$scopedSlots.default); }, /** * Check if exists "empty" slot */ hasEmptySlot() { - return !!this.$slots.empty; + return Boolean(this.$slots.empty); }, /** * Check if exists "header" slot */ hasHeaderSlot() { - return !!this.$slots.header; + return Boolean(this.$slots.header); }, /** * Check if exists "footer" slot */ hasFooterSlot() { - return !!this.$slots.footer; + return Boolean(this.$slots.footer); }, /** * Apply dropdownPosition property @@ -202,7 +202,8 @@ export default { // eslint-disable-next-line no-nested-ternary maxHeight: this.maxHeight === undefined // eslint-disable-next-line no-restricted-globals - ? null : (isNaN(this.maxHeight) ? this.maxHeight : `${this.maxHeight}px`) + ? null + : (isNaN(this.maxHeight) ? this.maxHeight : `${this.maxHeight}px`) }; } }, @@ -239,7 +240,7 @@ export default { } // Close dropdown if input is clear or else open it if (this.hasFocus && (!this.openOnFocus || value)) { - this.isActive = !!value; + this.isActive = Boolean(value); } }, /** @@ -378,8 +379,8 @@ export default { * reached it's end. */ checkIfReachedTheEndOfScroll(list) { - if (list.clientHeight !== list.scrollHeight - && list.scrollTop + list.clientHeight >= list.scrollHeight) { + if (list.clientHeight !== list.scrollHeight && + list.scrollTop + list.clientHeight >= list.scrollHeight) { this.$emit('infinite-scroll'); } }, @@ -396,9 +397,9 @@ export default { if (this.$refs.dropdown === undefined) return; const rect = this.$refs.dropdown.getBoundingClientRect(); this.isListInViewportVertically = ( - rect.top >= 0 - && rect.bottom <= (window.innerHeight - || document.documentElement.clientHeight) + rect.top >= 0 && + rect.bottom <= (window.innerHeight || + document.documentElement.clientHeight) ); if (this.appendToBody) { this.updateAppendToBody(); @@ -425,9 +426,9 @@ export default { list.scrollTop = element.offsetTop; } else if (element.offsetTop >= visMax) { list.scrollTop = ( - element.offsetTop - - list.clientHeight - + element.clientHeight + element.offsetTop - + list.clientHeight + + element.clientHeight ); } } else { @@ -487,7 +488,7 @@ export default { if (dropdownMenu && trigger) { // update wrapper dropdown const root = this.$data._bodyEl; - root.classList.forEach((item) => root.classList.remove(item)); + root.classList.forEach(item => root.classList.remove(item)); root.classList.add('autocomplete'); root.classList.add('control'); if (this.expandend) { @@ -496,10 +497,10 @@ export default { const rect = trigger.getBoundingClientRect(); let top = rect.top + window.scrollY; const left = rect.left + window.scrollX; - if (!this.isOpenedTop) { - top += trigger.clientHeight; - } else { + if (this.isOpenedTop) { top -= dropdownMenu.clientHeight; + } else { + top += trigger.clientHeight; } this.style = { position: 'absolute', -- cgit v1.2.3