ability to remove attribute with mouse + other tweaks

This commit is contained in:
zadam
2020-08-13 23:23:57 +02:00
parent 47a9516ada
commit f6f9f0d2c0
7 changed files with 124 additions and 85 deletions

View File

@@ -162,18 +162,19 @@ export default class AttributeListWidget extends TabAwareWidget {
this.$widget.append(this.attributeDetailWidget.render());
}
async refreshWithNote(note) {
const hasPromotedAttrs = this.promotedAttributesWidget.getPromotedDefinitionAttributes().length > 0;
async refreshWithNote(note, updateOnly = false) {
if (!updateOnly) {
const hasPromotedAttrs = this.promotedAttributesWidget.getPromotedDefinitionAttributes().length > 0;
if (hasPromotedAttrs) {
this.$promotedExpander.show();
this.$allAttrWrapper.toggle(options.is('promotedAttributesExpanded'));
this.$ownedAndInheritedWrapper.hide();
this.$inheritedAttributesWrapper.hide();
}
else {
this.$promotedExpander.hide();
this.$ownedAndInheritedWrapper.toggle(options.is('attributeListExpanded'));
if (hasPromotedAttrs) {
this.$promotedExpander.show();
this.$allAttrWrapper.toggle(options.is('promotedAttributesExpanded'));
this.$ownedAndInheritedWrapper.hide();
this.$inheritedAttributesWrapper.hide();
} else {
this.$promotedExpander.hide();
this.$ownedAndInheritedWrapper.toggle(options.is('attributeListExpanded'));
}
}
const ownedAttributes = note.getOwnedAttributes().filter(attr => !attr.isAutoLink);
@@ -254,4 +255,10 @@ export default class AttributeListWidget extends TabAwareWidget {
this.$allAttrWrapper.slideDown(200);
}
}
entitiesReloadedEvent({loadResults}) {
if (loadResults.getAttributes(this.componentId).find(attr => attr.isAffecting(this.note))) {
this.refreshWithNote(this.note, true);
}
}
}