Commit 01b595185f034067e21254931b969417f231b59f

Authored by Vladyslav_Prykhodko
1 parent 30971564

UI: Fixed widget action element click - not correct processing propagation event

... ... @@ -1332,20 +1332,19 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
1332 1332 }
1333 1333
1334 1334 private elementClick($event: Event) {
1335   - const e = ($event.target || $event.srcElement) as Element;
1336   - if (e.id) {
1337   - const descriptors = this.getActionDescriptors('elementClick');
1338   - if (descriptors.length) {
1339   - descriptors.forEach((descriptor) => {
1340   - if (descriptor.name === e.id) {
1341   - $event.stopPropagation();
1342   - const entityInfo = this.getActiveEntityInfo();
1343   - const entityId = entityInfo ? entityInfo.entityId : null;
1344   - const entityName = entityInfo ? entityInfo.entityName : null;
1345   - const entityLabel = entityInfo && entityInfo.entityLabel ? entityInfo.entityLabel : null;
1346   - this.handleWidgetAction($event, descriptor, entityId, entityName, null, entityLabel);
1347   - }
1348   - });
  1335 + const elementClicked = ($event.target || $event.srcElement) as Element;
  1336 + const descriptors = this.getActionDescriptors('elementClick');
  1337 + if (descriptors.length) {
  1338 + const idsList = descriptors.map(descriptor => `#${descriptor.name}`).join(',');
  1339 + const targetElement = $(elementClicked).closest(idsList, this.widgetContext.$container[0]);
  1340 + if (targetElement.length && targetElement[0].id) {
  1341 + $event.stopPropagation();
  1342 + const descriptor = descriptors.find(descriptorInfo => descriptorInfo.name === targetElement[0].id);
  1343 + const entityInfo = this.getActiveEntityInfo();
  1344 + const entityId = entityInfo ? entityInfo.entityId : null;
  1345 + const entityName = entityInfo ? entityInfo.entityName : null;
  1346 + const entityLabel = entityInfo && entityInfo.entityLabel ? entityInfo.entityLabel : null;
  1347 + this.handleWidgetAction($event, descriptor, entityId, entityName, null, entityLabel);
1349 1348 }
1350 1349 }
1351 1350 }
... ...