Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit d073d14

Browse files
author
Nesmeyanov Kirill
committed
Add search reset button
1 parent 10f283d commit d073d14

File tree

6 files changed

+26
-13
lines changed

6 files changed

+26
-13
lines changed

dist/laravel-ui.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/laravel-ui.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/laravel-ui.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

docs/laravel-ui.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Select.vue

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@
259259
</template>
260260
<slot></slot>
261261
</div>
262+
263+
<template v-if="hiddenOptionsCount() !== 0">
264+
<ui-button view="flat" @click="resetSearch">
265+
{{ searchDescriptionReset.replace('{hidden}', hiddenOptionsCount()) }}
266+
</ui-button>
267+
</template>
262268
</section>
263269
</section>
264270
</template>
@@ -313,6 +319,13 @@
313319
type: String,
314320
default: 'No items found'
315321
},
322+
/**
323+
* Description button
324+
*/
325+
searchDescriptionReset: {
326+
type: String,
327+
default: '{hidden} more items are hidden.'
328+
},
316329
317330
/**
318331
* Maximum elements
@@ -349,12 +362,6 @@
349362
350363
this.$emit('toggle', this.isActive);
351364
},
352-
hiddenOptionsCount() {
353-
return this.allOptionsCount - this.foundOptionsCount;
354-
},
355-
allOptionsCount() {
356-
return this.allOptions().length;
357-
},
358365
sizeToHeight() {
359366
return this.size * 29 + 3;
360367
}
@@ -390,6 +397,12 @@
390397
})
391398
},
392399
methods: {
400+
allOptionsCount() {
401+
return this.allOptions().length;
402+
},
403+
hiddenOptionsCount() {
404+
return this.allOptionsCount() - this.foundOptionsCount;
405+
},
393406
allOptions() {
394407
let result = [];
395408
@@ -470,7 +483,7 @@
470483
},
471484
search(text) {
472485
this.doSearch(
473-
this.searchFuzzy ? text.trim().split(/\W+/) : [text],
486+
this.searchFuzzy ? text.trim().split(/[\h\s]+/g) : [text],
474487
this.searchCaseSensitive
475488
);
476489

0 commit comments

Comments
 (0)