Files
mixtape/zero.Web.UI/App/directives/clickoutside.js
T

45 lines
777 B
JavaScript
Raw Normal View History

2021-03-22 15:44:02 +01:00
export var isServer = vNode =>
{
return typeof vNode.componentInstance !== 'undefined' && vNode.componentInstance.$isServer;
};
2021-03-22 15:44:02 +01:00
export var isPopup = (popupItem, elements) =>
{
if (!popupItem || !elements)
{
2021-03-22 15:44:02 +01:00
return false;
}
2021-03-22 15:44:02 +01:00
for (var i = 0, len = elements.length; i < len; i++)
2020-04-07 12:28:47 +02:00
{
2021-03-22 15:44:02 +01:00
try
2020-04-07 12:28:47 +02:00
{
2021-03-22 15:44:02 +01:00
if (popupItem.contains(elements[i]))
2020-04-07 12:28:47 +02:00
{
2021-03-22 15:44:02 +01:00
return true;
2020-04-07 12:28:47 +02:00
}
2021-03-22 15:44:02 +01:00
if (elements[i].contains(popupItem))
2020-04-07 12:28:47 +02:00
{
return false;
}
}
2021-03-22 15:44:02 +01:00
catch (e)
2020-04-07 12:28:47 +02:00
{
return false;
}
}
2021-03-22 15:44:02 +01:00
return false;
};
export var validate = (binding) =>
{
if (typeof binding.value !== 'function')
{
console.warn('v-click-outside: provided expression ' + binding.expression + ' is not a function.');
return false;
}
return true;
2020-04-07 12:28:47 +02:00
};