-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): Adding TomSelect for link tags
Signed-off-by: Binyamin Yawitz <[email protected]>
- Loading branch information
Showing
7 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
@import "core"; | ||
@import "vendor/tom-select"; | ||
|
||
html[dir="rtl"] { | ||
@import "tabler.rtl.min"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<template> | ||
<div :class="`mb-${mb}`"> | ||
<label class="form-label">{{ label }}</label> | ||
<select class="form-select" v-model="model" ref="el" multiple style="display: none"> | ||
<option v-for="option in options" :value="option.value" :key="option.value" v-text="option.text" /> | ||
</select> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { onMounted, type PropType, ref } from 'vue'; | ||
import TomSelect from 'tom-select'; | ||
import { useI18n } from 'vue-i18n'; | ||
declare type SelectOptions = { value: any; text: string }; | ||
defineProps({ | ||
options: { default: [], type: Array as PropType<SelectOptions[]> }, | ||
label: { default: '', type: String }, | ||
mb: { default: '3', type: String } | ||
}); | ||
const model = defineModel(); | ||
const el = ref(); | ||
const { t } = useI18n(); | ||
onMounted(() => { | ||
new TomSelect(el.value, { | ||
createOnBlur: true, | ||
create: true, | ||
render: { | ||
option: (data: any, escape: any) => { | ||
return '<div>' + escape(data.text) + '</div>'; | ||
}, | ||
item: function (data: any, escape: any) { | ||
return '<div>' + escape(data.text) + '</div>'; | ||
}, | ||
option_create: function (data: any, escape: any) { | ||
return `<div class="create">${t('Add')} <strong>${escape(data.input)}</strong>…</div>`; | ||
}, | ||
no_results: function (data: any, escape: any) { | ||
return `<div class="no-results">${t('no-results-for')} "${escape(data.input)}"</div>`; | ||
}, | ||
not_loading: function (data: any, escape: any) { | ||
// no default content | ||
}, | ||
loading: function (data: any, escape: any) { | ||
return '<div class="spinner"></div>'; | ||
}, | ||
dropdown: function () { | ||
return '<div></div>'; | ||
} | ||
} | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters