mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 04:32:16 +08:00
Add icon and tooltip to label template dropdown [SCI-7259][SCI-7260]
This commit is contained in:
parent
31554d0fd9
commit
7e06f29a75
3 changed files with 34 additions and 1 deletions
|
@ -42,4 +42,13 @@
|
|||
min-height: 200px;
|
||||
padding: .5em 0;
|
||||
}
|
||||
|
||||
.label-template-option {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
|
||||
img {
|
||||
margin-right: .25em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
:disableSearch="true"
|
||||
:options="templates_dropdown"
|
||||
:selectorId="`LabelTemplateSelector`"
|
||||
:optionLabel="templateOption"
|
||||
:onOpen="initTooltip"
|
||||
@dropdown:changed="selectTemplate"
|
||||
/>
|
||||
<div v-if="labelTemplateError" class="label-template-warning">
|
||||
|
@ -140,7 +142,14 @@
|
|||
}
|
||||
|
||||
return templates.map(i => {
|
||||
return {value: i.id, label: i.attributes.name}
|
||||
return {
|
||||
value: i.id,
|
||||
label: i.attributes.name,
|
||||
params: {
|
||||
icon: i.attributes.icon_url,
|
||||
description: i.attributes.description || ''
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
printers_dropdown() {
|
||||
|
@ -217,6 +226,17 @@
|
|||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
templateOption(option) {
|
||||
return `
|
||||
<div class="label-template-option" data-toggle="tooltip" data-placement="right" title="${option.params.description}">
|
||||
<img src="${option.params.icon}"></img>
|
||||
${option.label}
|
||||
</div>
|
||||
`
|
||||
},
|
||||
initTooltip() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
optionLabel: {
|
||||
type: Function
|
||||
},
|
||||
onOpen: {
|
||||
type: Function
|
||||
},
|
||||
inputTagMode: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
@ -114,6 +117,7 @@
|
|||
closeOnSelect: this.closeOnSelect,
|
||||
selectAppearance: this.selectAppearance,
|
||||
disableSearch: this.disableSearch,
|
||||
onOpen: this.onOpen,
|
||||
onChange: () => {
|
||||
if (this.onChange) this.onChange();
|
||||
this.selectChanged(dropdownSelector.getValues(`#${this.selectorId}`))
|
||||
|
|
Loading…
Reference in a new issue