Propagate the @update event to the parent entities

This commit is contained in:
Fabio Manganiello 2023-01-21 14:55:06 +01:00
parent 4d762b81dc
commit fb562bb415
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 11 additions and 5 deletions

View File

@ -2,7 +2,7 @@
<div class="entity-container-wrapper"
:class="{'with-children': hasChildren, collapsed: isCollapsed, hidden: !value?.name?.length}">
<div class="row item entity-container"
:class="{blink: justUpdated, 'with-children': hasChildren, collapsed: isCollapsed}">
:class="{ 'with-children': hasChildren, collapsed: isCollapsed, blink: justUpdated }">
<div class="adjuster" :class="{'col-12': !hasChildren, 'col-11': hasChildren}">
<component
:is="component"
@ -28,6 +28,7 @@
:value="entity"
:loading="loading"
:level="level + 1"
@update="setJustUpdated"
@input="$emit('input', entity)" />
</div>
</div>
@ -95,7 +96,13 @@ export default {
// Propagate the collapsed state to the wrapped component if applicable
if (this.instance)
this.instance.collapsed = !this.instance.collapsed
}
},
setJustUpdated() {
this.justUpdated = true
const self = this;
setTimeout(() => self.justUpdated = false, 1000)
},
},
mounted() {
@ -110,9 +117,8 @@ export default {
if (this.valuesEqual(oldValue, newValue))
return false
this.justUpdated = true
const self = this;
setTimeout(() => self.justUpdated = false, 1000)
this.setJustUpdated()
this.$emit('update', {value: newValue})
}
)