Unverified Commit ff1ec5bb authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Fix][Web]fix_some_bug_web (#2234)

* fix_some_bug_web * optimize icon size
parent 25a65b9c
import React, {Fragment, useState} from "react";
import {MinusOutlined, MinusSquareOutlined, PlusSquareOutlined} from "@ant-design/icons";
import {Enable, Resizable, ResizeCallback, Size} from "re-resizable";
import {PageContainer} from "@ant-design/pro-components";
import {l} from "@/utils/intl";
import {Button, Space, TabPaneProps, theme} from "antd";
import {MaxIcon, MinIcon} from "@/components/Icons/StudioIcon";
import {CircleBtn} from "@/components/CallBackButton/CircleBtn";
import useThemeValue from "@/hooks/useThemeValue";
import {THEME} from "@/types/Public/data";
import { CircleBtn } from '@/components/CallBackButton/CircleBtn';
import useThemeValue from '@/hooks/useThemeValue';
import { MinusOutlined } from '@ant-design/icons';
import { Space, TabPaneProps, theme } from 'antd';
import { Enable, Resizable, ResizeCallback, Size } from 're-resizable';
import React, { useState } from 'react';
export type MovableSidebarProps = {
title?: React.ReactNode;
......@@ -29,21 +25,40 @@ export type MovableSidebarProps = {
};
const { useToken } = theme;
const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
const {token} = useToken();
const { token } = useToken();
const themeValue = useThemeValue();
const {
style, visible, onResize, defaultSize,
minWidth, maxWidth, minHeight, maxHeight, enable
, children, title, contentHeight, handlerMinimize, handlerMaxsize, tagList
style,
visible,
onResize,
defaultSize,
minWidth,
maxWidth,
minHeight,
maxHeight,
enable,
children,
title,
contentHeight,
handlerMinimize,
handlerMaxsize,
tagList,
} = props;
const [showBtn,setShowBtn] = useState(false)
const [showBtn, setShowBtn] = useState(false);
return (
<div onMouseEnter={() => setShowBtn(true)} onMouseLeave={() => setShowBtn(false)}>
<div
onMouseEnter={() => setShowBtn(true)}
onMouseLeave={() => setShowBtn(false)}
>
<Resizable
className={'container'}
style={{...style, display: visible ? 'block' : 'none', borderRadius: 5}}
style={{
...style,
display: visible ? 'block' : 'none',
borderRadius: 5,
}}
onResize={onResize}
defaultSize={defaultSize}
minWidth={minWidth}
......@@ -74,18 +89,34 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
{/* <div style={{height: contentHeight,marginBlock:-5,marginInline:-10}}>{children}</div>*/}
{/*</PageContainer>*/}
<>
<div style={{backgroundColor:token.colorBgBase,borderBlockColor:themeValue.borderColor}} className={"container-header"}>
<div
style={{
backgroundColor: token.colorBgBase,
borderBlockColor: themeValue.borderColor,
}}
className={'container-header'}
>
<div>{title}</div>
<div className={showBtn?"show":"hide"}>
<div className={showBtn ? 'show' : 'hide'}>
<Space size={5}>
{props.btnGroup}
<CircleBtn onClick={props.handlerMinimize} icon={<MinusOutlined/>}/>
<CircleBtn
onClick={props.handlerMinimize}
icon={<MinusOutlined />}
/>
</Space>
</div>
</div>
<div style={{height: contentHeight,backgroundColor:token.colorBgBase}}>{children}</div>
<div
style={{
height: contentHeight,
backgroundColor: token.colorBgBase,
overflow:"auto"
}}
>
{children}
</div>
</>
</Resizable>
</div>
);
......
......@@ -42,31 +42,27 @@ export const getParentKey = (key: number | string, tree: any): any => {
* @returns {any}
*/
export const buildProjectTree = (data: Catalogue[], searchValue: string = '', path?: string[]): any => data.filter((ca: Catalogue) => (ca.name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1)).map((item: Catalogue) => {
// 使用 name 拼接 path todo: 有 bug ,需要修复
if (path) {
path.push(...path,item.name)
}
export const buildProjectTree = (data: Catalogue[], searchValue: string = '', path?: string[]): any =>
data.map((item: Catalogue) => {
const currentPath = path ? [...path, item.name] : [item.name];
return {
// isLeaf: (item.type && item.children.length === 0) ,
isLeaf: item.isLeaf ,
isLeaf: item.isLeaf,
name: item.name,
parentId: item.parentId,
label: searchTreeNode(item.name, searchValue),
icon: (item.type && item.children.length === 0) && getTabIcon(item.type,20),
icon: (item.type && item.children.length === 0) && getTabIcon(item.type, 20),
value: item.id,
path: path ?? [],
path: currentPath,
type: item.type,
title: <>{searchTreeNode(item.name, searchValue)}</>,
fullInfo: item,
key: item.id,
id: item.id,
taskId: item.taskId,
children: buildProjectTree(item.children, searchValue , path),
children: buildProjectTree(item.children, searchValue, currentPath),
}
});
});
export const isUDF = (jobType: string) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment