myprojectpackageprav
Version:
My package in npm
41 lines • 3.2 kB
JavaScript
import React, { useImperativeHandle } from "react";
var ActionButtons = React.forwardRef(function (props) {
var showhide = false;
useImperativeHandle(props === null || props === void 0 ? void 0 : props.ref, function () { return ({
buttonRefs: function () {
showhide = false;
}
}); });
var popupopenclose = function (ele) {
var _a;
var elementHeight = ele.currentTarget.offsetHeight;
var offsettopValue = ele.currentTarget.offsetTop;
var offsetWidthValue = ele.currentTarget.offsetWidth;
var offsetLeftValue = ele.currentTarget.offsetLeft;
var popupTop = ((elementHeight + offsettopValue));
var popupLeft = ((offsetWidthValue + offsetLeftValue));
var data = ele.currentTarget.attributes;
var displayName = '';
for (var i = 0; i < data.length; i++) {
if (data[i].nodeName === "value" && data[i].nodeValue === "false") {
showhide = true;
}
if (data[i].nodeName === "data-displayname") {
displayName = data[i].nodeValue;
}
}
(_a = props === null || props === void 0 ? void 0 : props.props) === null || _a === void 0 ? void 0 : _a.popupCloseOpenFunctionalityWork(displayName);
props.popupCloseOpenFunctionality(displayName, showhide, popupTop, popupLeft, offsetLeftValue, props === null || props === void 0 ? void 0 : props.reference, elementHeight, offsetWidthValue);
};
return (React.createElement("div", { className: (props === null || props === void 0 ? void 0 : props.className) ? "button-container ".concat(props === null || props === void 0 ? void 0 : props.btnclassName) : 'button-container' },
React.createElement("button", { type: props === null || props === void 0 ? void 0 : props.type, id: props === null || props === void 0 ? void 0 : props.id, "aria-label": props['aria-label'] || (props === null || props === void 0 ? void 0 : props.label), className: "btn ".concat(props === null || props === void 0 ? void 0 : props.className), onClick: popupopenclose, "data-displayname": props === null || props === void 0 ? void 0 : props.isClick, value: props === null || props === void 0 ? void 0 : props.showhide, title: (props === null || props === void 0 ? void 0 : props['aria-label']) || (props === null || props === void 0 ? void 0 : props.label) },
(props === null || props === void 0 ? void 0 : props.icon) && React.createElement("span", { className: props === null || props === void 0 ? void 0 : props.icon }),
" ", props === null || props === void 0 ? void 0 :
props.name,
" ",
(props === null || props === void 0 ? void 0 : props.ricon) && React.createElement("span", { className: props === null || props === void 0 ? void 0 : props.ricon }),
" ",
(props === null || props === void 0 ? void 0 : props.badgeinfo) && React.createElement("sup", { className: props === null || props === void 0 ? void 0 : props.badge }, props === null || props === void 0 ? void 0 : props.badgeinfo))));
});
export default ActionButtons;
//# sourceMappingURL=actionbutton.js.map