File tree Expand file tree Collapse file tree 1 file changed +20
-17
lines changed Expand file tree Collapse file tree 1 file changed +20
-17
lines changed Original file line number Diff line number Diff line change 1313 <div class =" form-group with-icon-left" >
1414 <div class =" input-group" >
1515 <input
16- v-model =" selector "
16+ v-model =" search "
1717 id =" input-icon-left"
1818 name =" input-icon-left"
1919 required
4040 </vuestic-widget >
4141
4242 <vuestic-widget
43- v-for =" (list, index) in validatedLists "
43+ v-for =" (list, index) in filteredLists "
4444 :key =" index"
4545 :headerText =" list.name"
4646 class =" flex md12"
7272
7373<script >
7474export default {
75- name: ' set' ,
75+ name: ' vuestic-icon- set' ,
7676 props: {
7777 name: {
7878 type: String ,
@@ -84,7 +84,7 @@ export default {
8484 },
8585 data () {
8686 return {
87- selector : ' ' ,
87+ search : ' ' ,
8888 iconSize: 30 ,
8989 slider: {
9090 formatter : v => ` ${ v} px` ,
@@ -99,28 +99,31 @@ export default {
9999 if (set .href === this .name ) return set
100100 }
101101 },
102-
103- validatedLists ( ) {
104- if ( this . selector === ' ' ) {
102+ filteredLists () {
103+ if ( ! this . search ) {
104+ // If nothing is searched - we return all sets
105105 return this .set .lists
106106 }
107107
108- let result = [
109- {
110- name: ' Found Icons' ,
111- icons: [],
112- },
113- ]
114-
108+ const foundIcons = []
115109 this .set .lists .forEach (list => {
116110 list .icons .forEach (icon => {
117- if (icon .match (this .selector )) {
118- result[0 ].icons .push (icon)
111+ if (! icon .toUpperCase ().includes (this .search .toUpperCase ())) {
112+ return
113+ }
114+ // Same icon could be included in different sets.
115+ if (foundIcons .includes (icon)) {
116+ return
119117 }
118+ foundIcons .push (icon)
120119 })
121120 })
122121
123- return result
122+ // We return all found icons as a single set.
123+ return [{
124+ name: ' Found Icons' ,
125+ icons: foundIcons,
126+ }]
124127 },
125128 },
126129 methods: {
You can’t perform that action at this time.
0 commit comments