web component fix context menu rtl

This commit is contained in:
MrSubhonbek 2023-06-09 14:15:24 +03:00
parent ce795a6ffd
commit 120b0af1d0
3 changed files with 32 additions and 17 deletions

View File

@ -76,7 +76,20 @@ const CodeInput = (props) => {
const elements = [];
for (let i = 0; i < characters; i++) {
if (i === 3) elements.push(<hr key="InputCode-line" />);
if (interfaceDirection === "rtl")
elements.unshift(
<input
key={`InputCode-${i}`}
onChange={handleOnChange}
onKeyDown={handleOnKeyDown}
onFocus={handleOnFocus}
onPaste={handleOnPaste}
ref={(el) => (inputsRef.current[i] = el)}
maxLength={1}
disabled={isDisabled}
/>
);
else
elements.push(
<input
key={`InputCode-${i}`}

View File

@ -118,8 +118,9 @@ class ContextMenu extends Component {
position = (event) => {
if (event) {
const rects = this.props.containerRef?.current.getBoundingClientRect();
let left = rects ? rects.left - this.props.leftOffset : event.pageX + 1;
let right = rects ? rects.right - this.props.leftOffset : event.pageY + 1;
let top = rects ? rects.top : event.pageY + 1;
let width = this.menuRef.current.offsetParent
? this.menuRef.current.offsetWidth
@ -167,8 +168,9 @@ class ContextMenu extends Component {
}
this.menuRef.current.style.minWidth = "210px";
}
if (this.props.interfaceDirection === "rtl")
this.menuRef.current.style.right = left + "px";
this.menuRef.current.style.left = left - width + "px";
else this.menuRef.current.style.left = left + "px";
this.menuRef.current.style.top = top + "px";
}

View File

@ -38,8 +38,8 @@ const InputPhone = ({
(option) => option.dialCode && str.startsWith(option.dialCode)
);
const singleСode = ["1", "7"];
const invalidCode = singleСode.find((code) => code === str);
const singleCode = ["1", "7"];
const invalidCode = singleCode.find((code) => code === str);
if (e.target.value === "" || !e.target.value.includes(invalidCode)) {
setIsValid(false);