@globalbrain/sefirot
Advanced tools
Comparing version 0.20.1 to 0.21.0
@@ -0,1 +1,12 @@ | ||
# [0.21.0](https://github.com/globalbrain/sefirot/compare/v0.20.1...v0.21.0) (2021-01-12) | ||
### Bug Fixes | ||
* **input-dropdown:** search not working as expected ([50f1445](https://github.com/globalbrain/sefirot/commit/50f1445f4b1793f822b8831ac05a1c944c3f5cec)) | ||
### Features | ||
* **input-text:** emit value as number when the input type is number ([3ad5b98](https://github.com/globalbrain/sefirot/commit/3ad5b98b876b64a4326227472c9f2286e235ce74)) | ||
* **input-textarea:** add size and mode options ([f9eea98](https://github.com/globalbrain/sefirot/commit/f9eea9820296b5521d034ecb8282e54783e6a77b)) | ||
## [0.20.1](https://github.com/globalbrain/sefirot/compare/v0.20.0...v0.20.1) (2021-01-12) | ||
@@ -2,0 +13,0 @@ |
import Fuse from 'fuse.js' | ||
import { Ref, ComputedRef, ref, computed } from '@vue/composition-api' | ||
import { Ref, ComputedRef, ref, computed, isRef } from '@vue/composition-api' | ||
@@ -46,3 +46,3 @@ export interface Dropdown { | ||
selected?: ComputedRef<any> | ||
items: Item[] | ||
items: Item[] | ComputedRef<Item[]> | ||
callback? (item: Item): void | ||
@@ -91,4 +91,6 @@ } | ||
function useItems(items: Item[], search?: Search): ComputedRef<Item[]> { | ||
const fuse = createFuse(items, search) | ||
function useItems(items: Item[] | ComputedRef<Item[]>, search?: Search): ComputedRef<Item[]> { | ||
const fuse = computed(() => { | ||
return createFuse(isRef(items) ? items.value : items, search) | ||
}) | ||
@@ -98,3 +100,7 @@ return computed(() => { | ||
return value ? fuse!.search(value).map(result => result.item) : items | ||
if (!value) { | ||
return isRef(items) ? items.value : items | ||
} | ||
return fuse.value!.search(value).map(result => result.item) | ||
}) | ||
@@ -101,0 +107,0 @@ } |
{ | ||
"name": "@globalbrain/sefirot", | ||
"version": "0.20.1", | ||
"version": "0.21.0", | ||
"description": "Vue Components for Global Brain Design System.", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
204385
1272