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 { CircleBtn } from '@/components/CallBackButton/CircleBtn';
import {MinusOutlined, MinusSquareOutlined, PlusSquareOutlined} from "@ant-design/icons"; import useThemeValue from '@/hooks/useThemeValue';
import {Enable, Resizable, ResizeCallback, Size} from "re-resizable"; import { MinusOutlined } from '@ant-design/icons';
import {PageContainer} from "@ant-design/pro-components"; import { Space, TabPaneProps, theme } from 'antd';
import {l} from "@/utils/intl"; import { Enable, Resizable, ResizeCallback, Size } from 're-resizable';
import {Button, Space, TabPaneProps, theme} from "antd"; import React, { useState } from 'react';
import {MaxIcon, MinIcon} from "@/components/Icons/StudioIcon";
import {CircleBtn} from "@/components/CallBackButton/CircleBtn";
import useThemeValue from "@/hooks/useThemeValue";
import {THEME} from "@/types/Public/data";
export type MovableSidebarProps = { export type MovableSidebarProps = {
title?: React.ReactNode; title?: React.ReactNode;
...@@ -29,21 +25,40 @@ export type MovableSidebarProps = { ...@@ -29,21 +25,40 @@ export type MovableSidebarProps = {
}; };
const { useToken } = theme; const { useToken } = theme;
const MovableSidebar: React.FC<MovableSidebarProps> = (props) => { const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
const {token} = useToken(); const { token } = useToken();
const themeValue = useThemeValue(); const themeValue = useThemeValue();
const { const {
style, visible, onResize, defaultSize, style,
minWidth, maxWidth, minHeight, maxHeight, enable visible,
, children, title, contentHeight, handlerMinimize, handlerMaxsize, tagList onResize,
defaultSize,
minWidth,
maxWidth,
minHeight,
maxHeight,
enable,
children,
title,
contentHeight,
handlerMinimize,
handlerMaxsize,
tagList,
} = props; } = props;
const [showBtn,setShowBtn] = useState(false) const [showBtn, setShowBtn] = useState(false);
return ( return (
<div onMouseEnter={() => setShowBtn(true)} onMouseLeave={() => setShowBtn(false)}> <div
onMouseEnter={() => setShowBtn(true)}
onMouseLeave={() => setShowBtn(false)}
>
<Resizable <Resizable
className={'container'} className={'container'}
style={{...style, display: visible ? 'block' : 'none', borderRadius: 5}} style={{
...style,
display: visible ? 'block' : 'none',
borderRadius: 5,
}}
onResize={onResize} onResize={onResize}
defaultSize={defaultSize} defaultSize={defaultSize}
minWidth={minWidth} minWidth={minWidth}
...@@ -74,18 +89,34 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => { ...@@ -74,18 +89,34 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
{/* <div style={{height: contentHeight,marginBlock:-5,marginInline:-10}}>{children}</div>*/} {/* <div style={{height: contentHeight,marginBlock:-5,marginInline:-10}}>{children}</div>*/}
{/*</PageContainer>*/} {/*</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>{title}</div>
<div className={showBtn?"show":"hide"}> <div className={showBtn ? 'show' : 'hide'}>
<Space size={5}> <Space size={5}>
{props.btnGroup} {props.btnGroup}
<CircleBtn onClick={props.handlerMinimize} icon={<MinusOutlined/>}/> <CircleBtn
onClick={props.handlerMinimize}
icon={<MinusOutlined />}
/>
</Space> </Space>
</div> </div>
</div> </div>
<div style={{height: contentHeight,backgroundColor:token.colorBgBase}}>{children}</div> <div
style={{
height: contentHeight,
backgroundColor: token.colorBgBase,
overflow:"auto"
}}
>
{children}
</div>
</> </>
</Resizable> </Resizable>
</div> </div>
); );
......
...@@ -42,31 +42,27 @@ export const getParentKey = (key: number | string, tree: any): any => { ...@@ -42,31 +42,27 @@ export const getParentKey = (key: number | string, tree: any): any => {
* @returns {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) => { export const buildProjectTree = (data: Catalogue[], searchValue: string = '', path?: string[]): any =>
data.map((item: Catalogue) => {
// 使用 name 拼接 path todo: 有 bug ,需要修复 const currentPath = path ? [...path, item.name] : [item.name];
if (path) {
path.push(...path,item.name)
}
return { return {
// isLeaf: (item.type && item.children.length === 0) , // isLeaf: (item.type && item.children.length === 0) ,
isLeaf: item.isLeaf , isLeaf: item.isLeaf,
name: item.name, name: item.name,
parentId: item.parentId, parentId: item.parentId,
label: searchTreeNode(item.name, searchValue), 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, value: item.id,
path: path ?? [], path: currentPath,
type: item.type, type: item.type,
title: <>{searchTreeNode(item.name, searchValue)}</>, title: <>{searchTreeNode(item.name, searchValue)}</>,
fullInfo: item, fullInfo: item,
key: item.id, key: item.id,
id: item.id, id: item.id,
taskId: item.taskId, taskId: item.taskId,
children: buildProjectTree(item.children, searchValue , path), children: buildProjectTree(item.children, searchValue, currentPath),
} }
}); });
export const isUDF = (jobType: string) => { 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