Merge pull request #5024 from vvlladd28/bug/action/element-click/propagation
[3.3.0] UI: Fixed widget action element click - not correct processing propagation event
This commit is contained in:
commit
8174568dfa
@ -1326,21 +1326,20 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
|
|||||||
}
|
}
|
||||||
|
|
||||||
private elementClick($event: Event) {
|
private elementClick($event: Event) {
|
||||||
const e = ($event.target || $event.srcElement) as Element;
|
const elementClicked = ($event.target || $event.srcElement) as Element;
|
||||||
if (e.id) {
|
|
||||||
const descriptors = this.getActionDescriptors('elementClick');
|
const descriptors = this.getActionDescriptors('elementClick');
|
||||||
if (descriptors.length) {
|
if (descriptors.length) {
|
||||||
descriptors.forEach((descriptor) => {
|
const idsList = descriptors.map(descriptor => `#${descriptor.name}`).join(',');
|
||||||
if (descriptor.name === e.id) {
|
const targetElement = $(elementClicked).closest(idsList, this.widgetContext.$container[0]);
|
||||||
|
if (targetElement.length && targetElement[0].id) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
|
const descriptor = descriptors.find(descriptorInfo => descriptorInfo.name === targetElement[0].id);
|
||||||
const entityInfo = this.getActiveEntityInfo();
|
const entityInfo = this.getActiveEntityInfo();
|
||||||
const entityId = entityInfo ? entityInfo.entityId : null;
|
const entityId = entityInfo ? entityInfo.entityId : null;
|
||||||
const entityName = entityInfo ? entityInfo.entityName : null;
|
const entityName = entityInfo ? entityInfo.entityName : null;
|
||||||
const entityLabel = entityInfo && entityInfo.entityLabel ? entityInfo.entityLabel : null;
|
const entityLabel = entityInfo && entityInfo.entityLabel ? entityInfo.entityLabel : null;
|
||||||
this.handleWidgetAction($event, descriptor, entityId, entityName, null, entityLabel);
|
this.handleWidgetAction($event, descriptor, entityId, entityName, null, entityLabel);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user