[IMP] web: make it possible to prefix KanbanAnimatedNumber

Use the `prefix` slot to give a prefix to KanbanAnimatedNumber, making
it possible to add text while not needing to extend the class/template.

Part-of: odoo/odoo#98837
This commit is contained in:
William Braeckman
2022-09-19 11:28:50 +02:00
parent 01d18acb34
commit 51a3d0e19f
2 changed files with 8 additions and 0 deletions
@@ -45,5 +45,12 @@ KanbanAnimatedNumber.props = {
animationClass: { type: String, optional: true },
currency: { type: [Object, Boolean], optional: true },
title: { type: String, optional: true },
slots: {
type: Object,
shape: {
prefix: { type: Object, optional: true },
},
optional: true,
},
};
KanbanAnimatedNumber.enableAnimations = true;
@@ -3,6 +3,7 @@
<t t-name="web.KanbanAnimatedNumber" owl="1">
<div class="o_kanban_counter_side ms-2 text-900 text-nowrap" t-att-class="state.value !== props.value and props.animationClass" t-att-title="props.title">
<t t-slot="prefix"/>
<span t-if="props.currency and props.currency.position === 'before'" t-esc="props.currency.symbol" class="ms-1"/>
<b t-esc="format(state.value)" />
<span t-if="props.currency and props.currency.position === 'after'" t-esc="props.currency.symbol" class="ms-1"/>