Add 'On HTML element click' action source for HTML card (static and value) widgets

This commit is contained in:
Paolo Cristiani 2019-07-01 13:31:23 +02:00 committed by Igor Kulikov
parent 4676b19ca3
commit cd213bfeb9
7 changed files with 36 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -122,7 +122,8 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele
actionsApi: { actionsApi: {
actionDescriptorsBySourceId: actionDescriptorsBySourceId, actionDescriptorsBySourceId: actionDescriptorsBySourceId,
getActionDescriptors: getActionDescriptors, getActionDescriptors: getActionDescriptors,
handleWidgetAction: handleWidgetAction handleWidgetAction: handleWidgetAction,
elementClick: elementClick
}, },
stateController: stateController, stateController: stateController,
aliasController: aliasController aliasController: aliasController
@ -428,6 +429,24 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele
return result; return result;
} }
function elementClick(event) {
event.stopPropagation();
var e = event.target || event.srcElement;
if (e.id) {
var descriptors = getActionDescriptors('elementClick');
if (descriptors.length) {
for (var i = 0; i < descriptors.length; i++) {
if (descriptors[i].name == e.id) {
var entityInfo = getActiveEntityInfo();
var entityId = entityInfo ? entityInfo.entityId : null;
var entityName = entityInfo ? entityInfo.entityName : null;
handleWidgetAction(event, descriptors[i], entityId, entityName);
}
}
}
}
}
function updateEntityParams(params, targetEntityParamName, targetEntityId, entityName) { function updateEntityParams(params, targetEntityParamName, targetEntityId, entityName) {
if (targetEntityId) { if (targetEntityId) {
var targetEntityParams; var targetEntityParams;

View File

@ -1621,7 +1621,9 @@
"row-click": "Klick auf Zeile", "row-click": "Klick auf Zeile",
"polygon-click": "Klick auf Polygon", "polygon-click": "Klick auf Polygon",
"marker-click": "Klick auf Marker", "marker-click": "Klick auf Marker",
"tooltip-tag-action": "Tooltip-Tag-Aktion" "tooltip-tag-action": "Tooltip-Tag-Aktion",
"node-selected": "Klick auf Node",
"element-click": "Klick auf HTML element"
} }
}, },
"language": { "language": {

View File

@ -1672,7 +1672,8 @@
"polygon-click": "On polygon click", "polygon-click": "On polygon click",
"marker-click": "On marker click", "marker-click": "On marker click",
"tooltip-tag-action": "Tooltip tag action", "tooltip-tag-action": "Tooltip tag action",
"node-selected": "On node selected" "node-selected": "On node selected",
"element-click": "On HTML element click"
} }
}, },
"language": { "language": {

View File

@ -1621,7 +1621,9 @@
"row-click": "Clic en la fila", "row-click": "Clic en la fila",
"polygon-click": "Clic en la fila", "polygon-click": "Clic en la fila",
"marker-click": "Clic en el polígono", "marker-click": "Clic en el polígono",
"tooltip-tag-action": "Acción de etiqueta para globo de ayuda" "tooltip-tag-action": "Acción de etiqueta para globo de ayuda",
"node-selected": "Clic en el nodo seleccionado",
"element-click": "Clic en el elemento HTML"
} }
}, },
"language": { "language": {

View File

@ -337,7 +337,9 @@
"marker-click": "On marker click", "marker-click": "On marker click",
"row-click": "On row click", "row-click": "On row click",
"polygon-click": "On polygon click", "polygon-click": "On polygon click",
"tooltip-tag-action": "Tooltip tag action" "tooltip-tag-action": "Tooltip tag action",
"node-selected": "On node selected",
"element-click": "On HTML element click"
} }
}, },
"customer": { "customer": {

View File

@ -1626,7 +1626,9 @@
"row-click": "Click sulla riga", "row-click": "Click sulla riga",
"polygon-click": "Click sul poligono", "polygon-click": "Click sul poligono",
"marker-click": "Click sul marker", "marker-click": "Click sul marker",
"tooltip-tag-action": "Azione tooltip" "tooltip-tag-action": "Azione tooltip",
"node-selected": "Click su nodo selezionato",
"element-click": "Click su elemento HTML"
} }
}, },
"language": { "language": {