Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 40 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,47 +234,46 @@ See All Samples : src/components/sample
```

# Props

| Component | Name | Type | Default | Description |
|-----------------|-----------------|----------|----------------------------|----------------------------|
| ModelSelect | options | Array | | option list |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| ModelListSelect | list | Array | | option list |
| | optionValue | String | | value key |
| | optionText | String | | text key |
| | customText | Function | | custom text function |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| BasicSelect | options | Array | | option list |
| | selectedOption | Object | { value: '', text: '' } | default option |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| ListSelect | list | Array | | option list |
| | optionValue | String | | value key |
| | optionText | String | | text key |
| | customText | Function | | custom text function |
| | selectedItem | Object | | default option(raw object) |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| MultiSelect | options | Array | | option list |
| | selectedOptions | Array | | default option list |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| MultiListSelect | list | Array | | option list |
| | optionValue | String | | value key |
| | optionText | String | | text key |
| | customText | Function | | custom text function |
| | selectedItems | Array | | default option(raw object) |
| | isError | String | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |

| Component | Name | Type | Default | Description |
|-----------------|-----------------|----------|----------------------------|--------------------------------- |
| BasicSelect | options | Array | | option list |
| | selectedOption | Object | { value: '', text: '' } | default option |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| ListSelect | list | Array | | option list |
| | optionValue | String | | value key |
| | optionText | String | | text key |
| | customText | Function | | custome text function |
| | selectedItem | Object | | default option(raw object) |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| MultiSelect | options | Array | | option list |
| | selectedOptions | Array | | default option list |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| MultiListSelect | list | Array | | option list |
| | optionValue | String | | value key |
| | optionText | String | | text key |
| | optionTextTag | String | | text will be displayed in the tag |
| | customText | Function | | custome text function |
| | selectedItems | Array | | default option(raw object) |
| | isError | String | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| ModelSelect | options | Array | | option list |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |
| ModelListSelect | list | Array | | option list |
| | optionValue | String | | value key |
| | optionText | String | | text key |
| | customText | Function | | custome text function |
| | isError | Boolean | false | error style |
| | placeholder | String | '' | |
| | filterPredicate | String | new RegExp(inputText, 'i') | |

# Run examples

Expand Down
18 changes: 16 additions & 2 deletions src/components/lib/MultiListSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
optionText: {
type: String
},
optionTextTag: {
type: String
},
customText: {
type: Function
},
Expand All @@ -42,12 +45,20 @@
computed: {
options () {
return this.list.map((e, i) => {
return { value: e[this.optionValue], text: this.buildText(e) }
return {
value: e[this.optionValue],
text: this.buildText(e),
textTag: this.buildTextTag(e)
}
})
},
items () {
return this.selectedItems.map((e, i) => {
return { value: e[this.optionValue], text: this.buildText(e) }
return {
value: e[this.optionValue],
text: this.buildText(e),
textTag: this.buildTextTag(e)
}
})
}
},
Expand All @@ -63,6 +74,9 @@
return ''
}
},
buildTextTag (e) {
return e[this.optionTextTag] === undefined ? this.buildText(e) : e[this.optionTextTag]
},
onSelect (options, option) {
if (Object.keys(option).length === 0 && option.constructor === Object) {
this.$emit('select', options, option)
Expand Down
2 changes: 1 addition & 1 deletion src/components/lib/MultiSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<template v-for="(option, idx) in selectedOptions">
<a class="ui label transition visible"
style="display: inline-block !important;">
{{option.text}}<i class="delete icon" @click="deleteItem(option)"></i>
{{option.textTag}}<i class="delete icon" @click="deleteItem(option)"></i>
</a>
</template>
<input class="search"
Expand Down