Merge branch 'develop' into feature/shared-navigation

This commit is contained in:
Alexey Safronov 2024-01-15 17:29:36 +04:00
commit 2e3fc63ecc
14 changed files with 43 additions and 25 deletions

View File

@ -4,7 +4,7 @@ import styled from "styled-components";
import RoomType from "../RoomType";
import { Base } from "@docspace/shared/themes";
import { RoomsType } from "@docspace/shared/enums";
import { RoomsTypeValues } from "@docspace/shared/utils/common";
const StyledDropdownDesktop = styled.div`
max-width: 100%;
@ -42,7 +42,7 @@ const DropdownDesktop = ({ t, open, chooseRoomType }) => {
return (
<StyledDropdownDesktop className="dropdown-content-wrapper" isOpen={open}>
<div className="dropdown-content">
{Object.values(RoomsType).map((roomType) => (
{Object.values(RoomsTypeValues).map((roomType) => (
<RoomType
id={roomType}
t={t}

View File

@ -2,7 +2,7 @@ import React from "react";
import styled from "styled-components";
import RoomType from "../RoomType";
import { RoomsType } from "@docspace/shared/enums";
import { RoomsTypeValues } from "@docspace/shared/utils/common";
import { Backdrop } from "@docspace/shared/components/backdrop";
import { Base } from "@docspace/shared/themes";
@ -31,7 +31,7 @@ const DropdownMobile = ({ t, open, onClose, chooseRoomType }) => {
<>
<Backdrop visible={open} onClick={onClose} zIndex={450} />
<StyledDropdownMobile className="dropdown-mobile" isOpen={open}>
{Object.values(RoomsType).map((roomType) => (
{Object.values(RoomsTypeValues).map((roomType) => (
<RoomType
id={roomType}
t={t}

View File

@ -6,7 +6,7 @@ import RoomType from "./RoomType";
import withLoader from "@docspace/client/src/HOCs/withLoader";
import Loaders from "@docspace/common/components/Loaders";
import { RoomsType } from "@docspace/shared/enums";
import { RoomsTypeValues } from "@docspace/shared/utils/common";
const StyledRoomTypeList = styled.div`
width: 100%;
@ -19,7 +19,7 @@ const StyledRoomTypeList = styled.div`
const RoomTypeList = ({ t, setRoomType }) => {
return (
<StyledRoomTypeList>
{Object.values(RoomsType).map((roomType) => (
{Object.values(RoomsTypeValues).map((roomType) => (
<RoomType
id={roomType}
t={t}

View File

@ -15,6 +15,7 @@ import {
import config from "PACKAGE_FILE";
import FilesFilter from "@docspace/shared/api/files/filter";
import { combineUrl } from "@docspace/shared/utils/combineUrl";
import { getCategoryTypeByFolderType } from "SRC_DIR/helpers/utils";
import { getCategoryUrl } from "SRC_DIR/helpers/utils";
const SectionHeaderContent = ({

View File

@ -7,6 +7,7 @@ import find from "lodash/find";
import result from "lodash/result";
import { isTablet, isMobile } from "@docspace/shared/utils";
import { RoomsTypeValues } from "@docspace/shared/utils/common";
import FilterInput from "@docspace/common/components/FilterInput";
import Loaders from "@docspace/common/components/Loaders";
import { withLayoutSize } from "@docspace/shared/HOC/withLayoutSize";
@ -1200,7 +1201,7 @@ const SectionFilterContent = ({
isHeader: true,
isLast: isLastTypeOptionsRooms,
},
...Object.values(RoomsType).map((roomType) => {
...Object.values(RoomsTypeValues).map((roomType) => {
switch (roomType) {
case RoomsType.FillingFormsRoom:
return {

View File

@ -27,9 +27,9 @@ const Table = ({
});
return auditTrailUsers && auditTrailUsers.length > 0 ? (
<TableContainer forwardedRef={ref}>
<TableContainer forwardedRef={ref} useReactWindow={false}>
<TableHeader sectionWidth={sectionWidth} containerRef={ref} />
<TableBody>
<TableBody useReactWindow={false}>
{auditTrailUsers.map((item) => (
<TableRow
theme={theme}

View File

@ -25,9 +25,9 @@ const Table = ({
});
return historyUsers && historyUsers.length > 0 ? (
<TableContainer forwardedRef={ref}>
<TableContainer forwardedRef={ref} useReactWindow={false}>
<TableHeader sectionWidth={sectionWidth} containerRef={ref} />
<TableBody>
<TableBody useReactWindow={false}>
{historyUsers.map((item) => (
<TableRow theme={theme} key={item.id} item={item} />
))}

View File

@ -1,6 +1,6 @@
import React from "react";
import { RoomsType } from "@docspace/shared/enums";
import { RoomsTypeValues } from "@docspace/shared/utils/common";
import { RectangleSkeleton } from "@docspace/shared/skeletons";
import { StyledBlock, StyledContainer } from "./StyledFilterBlockLoader";
@ -16,7 +16,7 @@ const FilterBlockLoader = ({
}) => {
const roomTypeLoader = isRooms ? (
<>
{Object.values(RoomsType).map((roomType) => {
{Object.values(RoomsTypeValues).map((roomType) => {
switch (roomType) {
case RoomsType.FillingFormsRoom:
return (

View File

@ -51,6 +51,12 @@ module.exports = {
// "no-unneeded-ternary": "off",
"react/require-default-props": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off",
"prettier/prettier": [
"error",
{
endOfLine: "auto",
},
],
},
ignorePatterns: ["./tsconfig.json", "coverage/**", "storybook-static/**"],
};

View File

@ -685,7 +685,7 @@ export async function moveToFolder(
};
const res = (await request({
method: "put",
url: "/files/fileops/copy",
url: "/files/fileops/move",
data,
})) as TOperation[];

View File

@ -13,9 +13,9 @@ import { DropDownProps } from "./DropDown.types";
import { DEFAULT_PARENT_HEIGHT } from "./DropDown.constants";
const DropDown = ({
directionY,
directionX,
manualY,
directionY = "bottom",
directionX = "left",
open,
enableOnClickOutside,
isDefaultMode = true,
@ -37,6 +37,8 @@ const DropDown = ({
zIndex,
clickOutsideAction,
manualWidth,
manualX,
manualY,
className,
style,
}: DropDownProps) => {
@ -229,13 +231,13 @@ const DropDown = ({
}
}, [
fixedDirection,
theme?.interfaceDirection,
forwardedRef,
smallSectionWidth,
state.directionX,
state.borderOffset,
state.directionY,
state.manualY,
theme?.interfaceDirection,
state.borderOffset,
]);
// const handleClickOutside = (e: any) => {
@ -393,6 +395,7 @@ const DropDown = ({
zIndex={zIndex}
manualWidth={manualWidth}
className={className}
manualX={manualX}
>
<VirtualList
Row={Row}
@ -445,20 +448,26 @@ const DropDown = ({
clickOutsideAction?.(evt, !open);
};
const types: string[] = !eventTypes
? []
: Array.isArray(eventTypes)
? eventTypes
: [eventTypes];
if (!open) {
eventTypes?.forEach((type) => {
types?.forEach((type) => {
window.removeEventListener(type, listener);
});
return;
}
eventTypes?.forEach((type) => {
types?.forEach((type) => {
window.addEventListener(type, listener);
});
return () => {
eventTypes?.forEach((type) => {
types?.forEach((type) => {
window.removeEventListener(type, listener);
});
};

View File

@ -54,7 +54,7 @@ export interface DropDownProps {
appendTo?: HTMLElement;
isAside?: boolean;
withBackground?: boolean;
eventTypes?: string[];
eventTypes?: string[] | string;
forceCloseClickOutside?: boolean;
withoutBackground?: boolean;
zIndex?: number;

View File

@ -662,7 +662,7 @@ export const toUrlParams = (
}
} else if (typeof item === "object") {
str += `${key}=${encodeURIComponent(JSON.stringify(item))}`;
} else if (typeof item === "string") {
} else if (typeof item === "string" || typeof item === "number") {
str += `${key}=${encodeURIComponent(item)}`;
}
});
@ -698,6 +698,7 @@ export function getObjectByLocation(location: Location) {
export const RoomsTypeValues = Object.values(RoomsType).reduce(
(acc, current) => {
if (typeof current === "string") return { ...acc };
return { ...acc, [current]: current };
},
{},

View File

@ -3,6 +3,6 @@ import moment from "moment-timezone";
export const convertTime = (date: moment.Moment, locale: string) => {
return moment(date)
.tz(window.timezone || "")
.locale(locale)
.locale(locale || "")
.format("L, LTS");
};