Shared:Utils: fix export

This commit is contained in:
Timofey Boyko 2023-12-04 10:00:35 +03:00
parent cd98b2e79a
commit 2cca1a76e6
4 changed files with 12 additions and 10 deletions

View File

@ -14,7 +14,7 @@ export default class DomHelpers {
return { width: w, height: h };
}
static getOffset(el: HTMLElement) {
static getOffset(el?: HTMLElement | null) {
if (el) {
const rect = el.getBoundingClientRect();
@ -40,7 +40,7 @@ export default class DomHelpers {
};
}
static getOuterWidth(el: HTMLElement, margin: string) {
static getOuterWidth(el: HTMLElement, margin?: string) {
if (el) {
let width = el.offsetWidth;
@ -54,7 +54,7 @@ export default class DomHelpers {
return 0;
}
static getHiddenElementOuterWidth(element: HTMLElement) {
static getHiddenElementOuterWidth(element: HTMLElement | null) {
if (element) {
element.style.visibility = "hidden";
element.style.display = "block";
@ -67,7 +67,7 @@ export default class DomHelpers {
return 0;
}
static getHiddenElementOuterHeight(element: HTMLElement) {
static getHiddenElementOuterHeight(element: HTMLElement | null) {
if (element) {
element.style.visibility = "hidden";
element.style.display = "block";
@ -80,7 +80,7 @@ export default class DomHelpers {
return 0;
}
static calculateScrollbarWidth(el: HTMLElement) {
static calculateScrollbarWidth(el?: HTMLElement) {
if (el) {
const style = getComputedStyle(el);
return (

View File

@ -9,16 +9,17 @@ import {
getCorrectFourValuesStyle,
} from "./rtlUtils";
import * as useClickOutside from "./useClickOutside";
import * as trimSeparator from "./trimSeparator";
import { trimSeparator } from "./trimSeparator";
import * as getCorrectDate from "./getCorrectDate";
import { handleAnyClick } from "./event";
import * as DomHelpers from "./domHelpers";
import * as ObjectUtils from "./objectUtils";
import DomHelpers from "./domHelpers";
import ObjectUtils from "./objectUtils";
import {
size,
mobile,
mobileMore,
tablet,
desktop,
transitionalScreenSize,
isMobile,
isTablet,
@ -33,6 +34,7 @@ import { classNames } from "./classNames";
import { getBannerAttribute, getLanguage } from "./banner";
export {
desktop,
checkIsSSR,
getLanguage,
isArrayEqual,

View File

@ -42,7 +42,7 @@ export const getCorrectFourValuesStyle = (
/* Returns correct border-radius value depending on interface direction (ltr/rtl) */
export const getCorrectBorderRadius = (
borderRadiusStr: string,
interfaceDirection: TInterfaceDirection,
interfaceDirection: TInterfaceDirection | string,
) => {
if (interfaceDirection === "ltr") return borderRadiusStr;

View File

@ -1,4 +1,4 @@
import type { ContextMenuModel } from "../components/context-menu";
import type { ContextMenuModel } from "../components";
export function trimSeparator(array: ContextMenuModel[]) {
if (!array || !Array.isArray(array) || array.length === 0) return array;