UNPKG

myprojectpackageprav

Version:
86 lines 5.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var react_1 = tslib_1.__importStar(require("react")); var actionbutton_1 = tslib_1.__importDefault(require("../../../components/buttons/actionbutton")); var input_textarea_1 = tslib_1.__importDefault(require("../../../utils/controls/input-textarea")); var buttons_1 = tslib_1.__importDefault(require("../../../components/buttons/buttons")); var input_text_1 = tslib_1.__importDefault(require("../../../utils/controls/input-text")); var popupTop = ''; var xpositionvalue = ''; var offsetLeftValue = ''; var offsetTopValue = ''; var offsetWidthValue = ''; function Reply() { /***** Responsive Popup Code Start*****/ var reply = (0, react_1.useRef)(null); var popupbtnRef = (0, react_1.useRef)(null); var _a = (0, react_1.useState)(''), xpositionvalueupdate = _a[0], setpopupwidthupdate = _a[1]; var _b = (0, react_1.useState)(''), popupheight = _b[0], setpopupheight = _b[1]; var _c = (0, react_1.useState)({ reply: false, }), showActionPopups = _c[0], setShowActionPopups = _c[1]; var initialValues = ['reply']; var _d = (0, react_1.useState)({ reply: false, }), btnActionshowhide = _d[0], setActionbtnshowhide = _d[1]; (0, react_1.useEffect)(function () { setpopupheight(window.innerHeight - (offsetTopValue + 30)); var popupwidthdata = popupbtnRef.current ? popupbtnRef.current.offsetWidth : 0; // setpopupwidth(popupwidthdata) if (popupwidthdata < xpositionvalue) { xpositionvalue = xpositionvalue - popupwidthdata; setpopupwidthupdate(xpositionvalue); } else if (popupwidthdata > offsetLeftValue && popupwidthdata < (window.innerWidth - (offsetLeftValue + offsetWidthValue))) { xpositionvalue = offsetLeftValue; setpopupwidthupdate(xpositionvalue); } else if (popupwidthdata > offsetLeftValue && popupwidthdata > (window.innerWidth - (offsetLeftValue + offsetWidthValue))) { xpositionvalue = 0; setpopupwidthupdate(xpositionvalue); } }, [showActionPopups]); var showhide = tslib_1.__assign({}, btnActionshowhide); function popupCloseOpenFunctionality(type, value, top, xposition, left, Ref, elementHeight, offsetWidth) { var _a, _b; popupTop = top; xpositionvalue = xposition; offsetLeftValue = left; offsetTopValue = top; offsetWidthValue = offsetWidth; initialValues.forEach(function (element) { showhide[element] = false; }); setActionbtnshowhide(showhide); if (type) { setActionbtnshowhide(tslib_1.__assign(tslib_1.__assign({}, showhide), (_a = {}, _a[type] = value, _a))); setShowActionPopups(tslib_1.__assign(tslib_1.__assign({}, showhide), (_b = {}, _b[type] = value, _b))); } } return (react_1.default.createElement(react_1.default.Fragment, null, react_1.default.createElement(actionbutton_1.default, { label: "Reply", name: 'Reply', className: (btnActionshowhide === null || btnActionshowhide === void 0 ? void 0 : btnActionshowhide.reply) ? 'btn btn-xs font-12 color-primary popup-arrow p-relative ms-auto' : 'btn btn-xs font-12 color-primary p-relative ms-auto', isClick: 'reply', type: "button", ref: reply, popupCloseOpenFunctionality: popupCloseOpenFunctionality, showhide: showActionPopups.reply }), (btnActionshowhide === null || btnActionshowhide === void 0 ? void 0 : btnActionshowhide.reply) ? react_1.default.createElement("div", { className: 'popup popup-sm', ref: popupbtnRef, style: { top: popupTop + 8, position: "absolute", overflow: "auto", left: xpositionvalueupdate, maxHeight: popupheight } }, react_1.default.createElement("h3", null, "Reply"), react_1.default.createElement("div", { className: "pt-2" }, react_1.default.createElement(input_text_1.default, { inputProps: { id: 'input', name: 'Input', className: 'font-12', placeholder: 'Input', }, label: 'Input', className: 'form-sm', isMandatory: true, formClassName: "ms-auto form-vertical" })), react_1.default.createElement("div", { className: "pt-2" }, react_1.default.createElement(input_textarea_1.default, { inputProps: { id: 'message', name: 'Message', className: 'font-12', placeholder: 'Message', }, label: 'Message', isMandatory: true, formClassName: "ms-auto form-vertical" })), react_1.default.createElement("div", { className: 'pt-2 d-flex gap-2' }, react_1.default.createElement(buttons_1.default, { label: "Ok", "aria-label": "Ok", icon: "icon-checked font-12 me-1", className: 'btn btn-sm btn-primary whitetext font-0 font-md-14 btn-border-radius3 ms-auto ' }), react_1.default.createElement(actionbutton_1.default, { label: "Cancel", name: "Cancel", className: 'btn-bgcolor5 whitetext btn btn-sm font-0 font-md-14 btn-border-radius3', icon: "icon-close font-10 me-1", type: "button", isClick: 'reply', ref: reply, popupCloseOpenFunctionality: popupCloseOpenFunctionality, showhide: showActionPopups.reply }))) : '')); } exports.default = Reply; //# sourceMappingURL=reply.js.map