myprojectpackageprav
Version:
My package in npm
83 lines • 5.09 kB
JavaScript
import { __assign } from "tslib";
import React, { useState, useRef, useEffect } from "react";
import ActionButtons from '../../../components/buttons/actionbutton';
import InputTextarea from "../../../utils/controls/input-textarea";
import Buttons from "../../../components/buttons/buttons";
import InputText from "../../../utils/controls/input-text";
var popupTop = '';
var xpositionvalue = '';
var offsetLeftValue = '';
var offsetTopValue = '';
var offsetWidthValue = '';
export default function Reply() {
/***** Responsive Popup Code Start*****/
var reply = useRef(null);
var popupbtnRef = useRef(null);
var _a = useState(''), xpositionvalueupdate = _a[0], setpopupwidthupdate = _a[1];
var _b = useState(''), popupheight = _b[0], setpopupheight = _b[1];
var _c = useState({
reply: false,
}), showActionPopups = _c[0], setShowActionPopups = _c[1];
var initialValues = ['reply'];
var _d = useState({
reply: false,
}), btnActionshowhide = _d[0], setActionbtnshowhide = _d[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 = __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(__assign(__assign({}, showhide), (_a = {}, _a[type] = value, _a)));
setShowActionPopups(__assign(__assign({}, showhide), (_b = {}, _b[type] = value, _b)));
}
}
return (React.createElement(React.Fragment, null,
React.createElement(ActionButtons, { 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.createElement("div", { className: 'popup popup-sm', ref: popupbtnRef, style: { top: popupTop + 8, position: "absolute", overflow: "auto", left: xpositionvalueupdate, maxHeight: popupheight } },
React.createElement("h3", null, "Reply"),
React.createElement("div", { className: "pt-2" },
React.createElement(InputText, { inputProps: {
id: 'input',
name: 'Input',
className: 'font-12',
placeholder: 'Input',
}, label: 'Input', className: 'form-sm', isMandatory: true, formClassName: "ms-auto form-vertical" })),
React.createElement("div", { className: "pt-2" },
React.createElement(InputTextarea, { inputProps: {
id: 'message',
name: 'Message',
className: 'font-12',
placeholder: 'Message',
}, label: 'Message', isMandatory: true, formClassName: "ms-auto form-vertical" })),
React.createElement("div", { className: 'pt-2 d-flex gap-2' },
React.createElement(Buttons, { 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.createElement(ActionButtons, { 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 })))
: ''));
}
//# sourceMappingURL=reply.js.map