From 83f13a0b0e545ee16fbf1f4474394c7603127d0b Mon Sep 17 00:00:00 2001 From: ptma Date: Wed, 28 Jan 2026 14:51:36 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20ruler=20=E6=94=B9=E7=94=A8=20@scena/rea?= =?UTF-8?q?ct-guides,=20=E5=B9=B6=E6=94=AF=E6=8C=81=E8=BE=85=E5=8A=A9?= =?UTF-8?q?=E7=BA=BF=E5=90=B8=E9=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-ui/package.json | 2 +- report-ui/src/components/Ruler/index.scss | 13 +++- report-ui/src/components/Ruler/index.tsx | 76 +++++++++++++++++-- .../components/common/screenConfig/index.tsx | 8 +- report-ui/src/hooks/useComponentDrag.ts | 22 ++++++ report-ui/src/hooks/useDrag.ts | 10 +-- report-ui/src/store/types/EditScreen.d.ts | 3 + report-ui/src/store/useEditScreen.ts | 11 ++- report-ui/src/styles/common.scss | 9 ++- .../screenDesign/Layout/Header/index.tsx | 46 +++++++---- .../screenDesign/Layout/Left/FirstMenu.tsx | 8 +- .../Left/component-lib/componentData.tsx | 22 +++--- .../Left/component-lib/componentList.tsx | 1 - .../components/DragWorkSpace/index.scss | 6 -- .../Middle/components/DragWorkSpace/index.tsx | 15 +--- .../Footer/components/ModalDialog.tsx | 57 ++++++++------ .../Middle/components/Footer/index.scss | 18 ++++- .../Layout/Middle/components/Footer/index.tsx | 38 +++++----- .../screenDesign/Layout/Right/index.scss | 12 +++ .../views/screenDesign/Layout/Right/index.tsx | 12 +-- report-ui/src/views/screenDesign/index.tsx | 30 ++++---- 21 files changed, 279 insertions(+), 140 deletions(-) diff --git a/report-ui/package.json b/report-ui/package.json index 13d1dad..a4d43ba 100644 --- a/report-ui/package.json +++ b/report-ui/package.json @@ -23,7 +23,7 @@ "@jiaminghi/data-view-react": "^1.2.5", "@monaco-editor/react": "^4.7.0", "@remixicon/react": "^4.8.0", - "@scena/react-ruler": "^0.19.0", + "@scena/react-guides": "^0.28.2", "@types/react-router-dom": "^5.3.3", "animate.css": "^4.1.1", "antd": "^5.26.7", diff --git a/report-ui/src/components/Ruler/index.scss b/report-ui/src/components/Ruler/index.scss index f03ae70..cf2fc61 100644 --- a/report-ui/src/components/Ruler/index.scss +++ b/report-ui/src/components/Ruler/index.scss @@ -1,8 +1,10 @@ .ruler-container { width: 100%; - height: calc(100% - 40px); + height: calc(100% - 36px); display: flex; overflow: hidden; + position: relative; + .left { width: 20px; height: 100%; @@ -16,4 +18,13 @@ .right { flex: 1; } + .dragMask { + background-color: transparent; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + overflow: auto; + } } diff --git a/report-ui/src/components/Ruler/index.tsx b/report-ui/src/components/Ruler/index.tsx index 2a82fc6..72d1d43 100644 --- a/report-ui/src/components/Ruler/index.tsx +++ b/report-ui/src/components/Ruler/index.tsx @@ -1,17 +1,24 @@ import { useEffect, useRef, useMemo, useCallback } from "react"; import { useEditScreen } from '@/store/useEditScreen' -import Ruler from "@scena/react-ruler"; +import Ruler from "@scena/react-guides"; import './index.scss' +import useDrag from "@/hooks/useDrag"; + const RulerComponent = (props) => { const { children } = props const scale = useEditScreen((state) => state.editor.scale) + const dragging = useEditScreen((state) => state.editor.dragging) + const editLayOutDom = useEditScreen((state) => state.editor.editLayOutDom) const dragCanvasDom = useEditScreen((state) => state.editor.dragCanvasDom) const setScale = useEditScreen((state) => state.setScale) const dragCansPosX = useEditScreen((state) => state.editor.dragCansPosX) const dragCansPosY = useEditScreen((state) => state.editor.dragCansPosY) const setDragPosition = useEditScreen((state) => state.setDragPosition) + const setGuides = useEditScreen((state) => state.setGuides) + const dragMaskRef = useRef(null) + const { handleDragEnter, handleDragOver, handleDrop } = useDrag(dragMaskRef) const verticalRulerRef = useRef(null) const horizontalRulerRef = useRef(null) // Ref保存最新scale(突破handleWheel闭包陷阱) @@ -21,14 +28,14 @@ const RulerComponent = (props) => { latestScaleRef.current = scale }, [scale]) const handleWheel = useCallback((e: WheelEvent) => { - if(!e.ctrlKey) return + if (!e.ctrlKey) return e.preventDefault(); const currentScale = latestScaleRef.current; if (e.deltaY < 0) { - if(currentScale >= 2) return; + if (currentScale >= 2) return; setScale(currentScale + 0.1) } else if (e.deltaY > 0) { - if(currentScale <= 0.5) return; + if (currentScale <= 0.5) return; setScale(currentScale - 0.1) } @@ -77,10 +84,18 @@ const RulerComponent = (props) => { } }, [editLayOutDom, handleWheel]) - useEffect(() => { + useEffect(() => { window.addEventListener("resize", handlePageResize) }, [handleScroll]) + useEffect(() => { + verticalRulerRef.current?.scrollGuides(dragCansPosX) + }, [dragCansPosX]) + + useEffect(() => { + horizontalRulerRef.current?.scrollGuides(dragCansPosY) + }, [dragCansPosY]) + return (
@@ -96,8 +111,25 @@ const RulerComponent = (props) => { zoom={scale} scrollPos={dragCansPosY} unit={computedUnit} - segment={2} + segment={10} textOffset={[10, 0]} + displayDragPos={true} + guidePosStyle={{ + color: "#1677FF", + fontWeight: "normal", + fontSize: 11, + }} + guideStyle={{ + backgroundColor: "transparent", + borderLeft: "1px dashed #1677FF", + }} + dragGuideStyle={{ + backgroundColor: "transparent", + borderLeft: "1px solid #1677FF", + }} + onChangeGuides={({ guides }) => { + setGuides(guides, "verticalGuides"); + }} />
@@ -113,12 +145,40 @@ const RulerComponent = (props) => { zoom={scale} scrollPos={dragCansPosX} unit={computedUnit} - segment={2} + segment={10} textOffset={[0, 10]} + displayDragPos={true} + guidePosStyle={{ + color: "#1677FF", + fontWeight: "normal", + fontSize: 11, + }} + guideStyle={{ + backgroundColor: "transparent", + borderTop: "1px dashed #1677FF", + }} + dragGuideStyle={{ + backgroundColor: "transparent", + borderTop: "1px solid #1677FF", + }} + onChangeGuides={({ guides }) => { + setGuides(guides, "horizontalGuides"); + }} />
- { children } + {children}
+ {/* 拖拽遮罩, 用于保证拖放时的事件对象统一(否则有可能是dragCanvas、dragLayout、以及已在画布上的元素) */} +
); } diff --git a/report-ui/src/components/common/screenConfig/index.tsx b/report-ui/src/components/common/screenConfig/index.tsx index 0db6a00..ab388b3 100644 --- a/report-ui/src/components/common/screenConfig/index.tsx +++ b/report-ui/src/components/common/screenConfig/index.tsx @@ -1,12 +1,11 @@ import { useState, useEffect } from 'react' import { Form, Input, InputNumber, Row, Col, Upload, Image, message, ColorPicker, Button, Space, Radio, Tooltip, Tabs } from 'antd' -import IconFonts from '@/components/IconFont' import type { GetProp, UploadFile, UploadProps } from 'antd'; import { getToken } from '@/utils/auth' import { toHex } from '@/utils' import './index.scss' import { useEditScreen } from '@/store/useEditScreen' -import { RiAspectRatioLine, RiCodeBlock, RiDropdownList, RiFlipHorizontal2Line, RiFlipVertical2Line, RiFullscreenLine, } from "@remixicon/react"; +import { RiAspectRatioLine, RiCodeBlock, RiDropdownList, RiFullscreenLine, RiImageAddLine, RiImageFill, RiSlideshow4Line, } from "@remixicon/react"; type FileType = Parameters>[0]; @@ -92,7 +91,7 @@ const ScreenConfig = () => { // 上传按钮 const uploadButton = ( ); @@ -146,10 +145,11 @@ const ScreenConfig = () => { , + icon: , key: '1', children: (
diff --git a/report-ui/src/hooks/useComponentDrag.ts b/report-ui/src/hooks/useComponentDrag.ts index 8d4dde2..22fc9a9 100644 --- a/report-ui/src/hooks/useComponentDrag.ts +++ b/report-ui/src/hooks/useComponentDrag.ts @@ -2,11 +2,15 @@ import { useEditScreen } from '@/store/useEditScreen'; import { throttle } from 'lodash-es' const useComponentDrag = () => { const scale = useEditScreen(state => state.editor.scale) + const verticalGuides = useEditScreen(state => state.editor.verticalGuides) + const horizontalGuides = useEditScreen(state => state.editor.horizontalGuides) const batchUpdateComponentConfig = useEditScreen(state => state.batchUpdateComponentConfig) // 大屏的宽高 const canvasWidth = useEditScreen(state => state.screenConfig.width) const canvasHeight = useEditScreen(state => state.screenConfig.height) const currentElement = useEditScreen(state => state.currentElement) + const setGuideIndex = useEditScreen(state => state.setGuideIndex) + // 改变大小 const mouseResizeHandler = (e, point, attrs) => { e.stopPropagation() @@ -48,6 +52,11 @@ const useComponentDrag = () => { document.addEventListener('mouseup', mouseup) } + // 吸附判定 + const canSnap = (currentOffset: number, guides: number) => { + return Math.abs(currentOffset - guides) <= 10 / scale; + } + // 选中组件按下事件 const mousedownHandle = (e, item) => { e.preventDefault() @@ -77,6 +86,19 @@ const useComponentDrag = () => { // 基于右下角位置检测 currX = currX > canvasWidth - distance ? canvasWidth - distance : currX currY = currY > canvasHeight - distance ? canvasHeight - distance : currY + + for (let i = 0; i < verticalGuides.length; i++) { + if (canSnap(currX, verticalGuides[i])) { + currX = verticalGuides[i] + break + } + } + for (let i = 0; i < horizontalGuides.length; i++) { + if (canSnap(currY, horizontalGuides[i])) { + currY = horizontalGuides[i] + break + } + } batchUpdateComponentConfig(item.id, { "attrs.offsetX": currX, "attrs.offsetY": currY }) }, 20) const mouseUp = () => { diff --git a/report-ui/src/hooks/useDrag.ts b/report-ui/src/hooks/useDrag.ts index f5fcab1..cf55350 100644 --- a/report-ui/src/hooks/useDrag.ts +++ b/report-ui/src/hooks/useDrag.ts @@ -10,16 +10,16 @@ import { createComponentConfig } from '@/components/scrComponents' import { JSONParse } from '@/utils' import { useEditScreen } from '@/store/useEditScreen' const useDrag = (container) => { - const screenConfig = useEditScreen((state) => state.screenConfig) const scale = useEditScreen((state) => state.editor.scale) const addComponent = useEditScreen(state => state.addComponent) const setCurrentElement = useEditScreen(state => state.setCurrentElement) const setDragging = useEditScreen(state => state.setDragging) + const dragCansPosX = useEditScreen(state => state.editor.dragCansPosX) + const dragCansPosY = useEditScreen(state => state.editor.dragCansPosY) const { closeRightMenu } = useRightMenu() // 拖拽进入目标区域 const handleDragEnter = (e) => { e.preventDefault() - e.stopPropagation() } // 拖拽在目标区域内移动 const handleDragOver = (e) => { @@ -35,9 +35,9 @@ const useDrag = (container) => { const chartConfig = JSONParse(drayData) const sourceOffset = JSONParse(e.dataTransfer.getData('sourceOffset')) const newComponent = await createComponentConfig(chartConfig) - // sourceOffset 偏移量未经过缩放, 需要转换一下 - const offsetX = (e.nativeEvent.offsetX - screenConfig.width / 2 - sourceOffset.x / scale) - const offsetY = (e.nativeEvent.offsetY - screenConfig.height / 2 - sourceOffset.y / scale) + // offset 偏移量未经过缩放, 需要转换一下, 20 偏移为标尺的宽度或高度 + const offsetX = (e.nativeEvent.offsetX / scale + dragCansPosX - sourceOffset.x / scale - 20 / scale) + const offsetY = (e.nativeEvent.offsetY / scale + dragCansPosY - sourceOffset.y / scale - 20 / scale) const dragNewComponent = { ...newComponent, attrs: { diff --git a/report-ui/src/store/types/EditScreen.d.ts b/report-ui/src/store/types/EditScreen.d.ts index cfefe53..2847e0f 100644 --- a/report-ui/src/store/types/EditScreen.d.ts +++ b/report-ui/src/store/types/EditScreen.d.ts @@ -22,6 +22,8 @@ export interface Editor { dragCansPosX: number dragCansPosY: number dragging: boolean + verticalGuides: number[] + horizontalGuides: number[] } export interface EditScreenState { @@ -58,6 +60,7 @@ export interface EditScreenState { setScale: (scale: number) => void setDragPosition: (position: number, dire: 'dragCansPosX' | 'dragCansPosY') => void setDragging: (dragging: boolean) => void + setGuides: (guides: number[], type: 'verticalGuides' | 'horizontalGuides') => void } export interface HistoryProps { diff --git a/report-ui/src/store/useEditScreen.ts b/report-ui/src/store/useEditScreen.ts index 9cd7caf..5e25c06 100644 --- a/report-ui/src/store/useEditScreen.ts +++ b/report-ui/src/store/useEditScreen.ts @@ -35,6 +35,8 @@ export const useEditScreen = create((set) => ({ dragCansPosX: 0, dragCansPosY: 0, dragging: false, + verticalGuides: [], + horizontalGuides: [], }, // 图表组件 componentList: [], @@ -427,5 +429,12 @@ export const useEditScreen = create((set) => ({ } } }), - + setGuides: (guides, type) => set((state) => { + return { + editor: { + ...state.editor, + [type]: guides + } + } + }), })) diff --git a/report-ui/src/styles/common.scss b/report-ui/src/styles/common.scss index 3c107de..1cb00ae 100644 --- a/report-ui/src/styles/common.scss +++ b/report-ui/src/styles/common.scss @@ -51,14 +51,15 @@ } .scrollbar { + overflow: auto; &::-webkit-scrollbar { - width: 6px; - height: 6px; + width: 4px; + height: 4px; } /* 滚动条滑块 */ &::-webkit-scrollbar-thumb { background: #c1c1c1; - border-radius: 3px; + border-radius: 2px; box-shadow: inset 0 0 5px rgba(0, 21, 41, 0.05); } &::-webkit-scrollbar-thumb:hover { @@ -68,7 +69,7 @@ /* 滚动条轨道 */ &::-webkit-scrollbar-track { background: #f1f1f1; - border-radius: 3px; + border-radius: 2px; box-shadow: inset 0 0 5px rgba(0, 21, 41, 0.05); } } diff --git a/report-ui/src/views/screenDesign/Layout/Header/index.tsx b/report-ui/src/views/screenDesign/Layout/Header/index.tsx index 386c139..1446243 100644 --- a/report-ui/src/views/screenDesign/Layout/Header/index.tsx +++ b/report-ui/src/views/screenDesign/Layout/Header/index.tsx @@ -8,26 +8,26 @@ import { Button, Space, Popconfirm } from 'antd' import { useEditScreen } from '@/store/useEditScreen' import { useNavigate } from 'react-router-dom' -import IconFonts from '@/components/IconFont' import './index.scss' +import { RiExportLine, RiHome4Line, RiImportLine, RiRepeat2Line, RiReplyLine, RiSave3Line, RiSlideshow3Line, RiSlideshowLine } from '@remixicon/react' const HeaderNav = () => { const navigate = useNavigate() const screenConfig = useEditScreen(state => state.screenConfig) const undoHistory = useEditScreen(state => state.undoHistory) - const redoHistory = useEditScreen(state => state.redoHistory) + const redoHistory = useEditScreen(state => state.redoHistory) const historyIndex = useEditScreen(state => state.historyIndex) const histories = useEditScreen(state => state.histories) const restartCanvas = useEditScreen(state => state.restartCanvas) // 是否可以撤销 const isCheckUndoDisabled = () => { - if(histories.length === 0 || historyIndex === 0) { + if (histories.length === 0 || historyIndex === 0) { return true } return false } // 是否可以重做 const isCheckRedoDisabled = () => { - if(histories.length === 0 || historyIndex === histories.length || historyIndex === -1) { + if (histories.length === 0 || historyIndex === histories.length || historyIndex === -1) { return true } return false @@ -36,12 +36,18 @@ const HeaderNav = () => { const handleGoBack = () => { navigate(-1) } - + return (
- + - - + +
- + 工作空间---{screenConfig.screenName}
- - - - + + + +
diff --git a/report-ui/src/views/screenDesign/Layout/Left/FirstMenu.tsx b/report-ui/src/views/screenDesign/Layout/Left/FirstMenu.tsx index 9fd1e14..bac0732 100644 --- a/report-ui/src/views/screenDesign/Layout/Left/FirstMenu.tsx +++ b/report-ui/src/views/screenDesign/Layout/Left/FirstMenu.tsx @@ -6,23 +6,23 @@ * @LastEditTime: 2025-11-29 10:48:39 */ import { Menu } from 'antd' -import IconFonts from '@/components/IconFont' import { useScreenLeftMenu } from '@/store/useScreenLeftMenu' +import { RiArchiveDrawerLine, RiBookShelfLine, RiStackLine } from '@remixicon/react'; const FirstMenuItems = [ { key: 'component-lib', - icon: , + icon: , label: '组件库' }, { key: 'source-list', - icon: , + icon: , label: '资源库' }, { key: 'layer-list', - icon: , + icon: , label: '图层' } ] diff --git a/report-ui/src/views/screenDesign/Layout/Left/component-lib/componentData.tsx b/report-ui/src/views/screenDesign/Layout/Left/component-lib/componentData.tsx index a51bc15..670da59 100644 --- a/report-ui/src/views/screenDesign/Layout/Left/component-lib/componentData.tsx +++ b/report-ui/src/views/screenDesign/Layout/Left/component-lib/componentData.tsx @@ -5,55 +5,55 @@ * @LastEditors: Do not edit * @LastEditTime: 2025-11-26 16:11:12 */ -import IconFonts from '@/components/IconFont' import { CategoryEnum, SubCategoryEnum } from '@/enums/commonEnum' +import { RiBarChartBoxAiLine, RiEarthLine, RiFilmAiLine, RiFunctionAiLine, RiMoreLine, RiPuzzle2Line, RiQuillPenAiLine, RiRoadMapLine, RiTextSnippet } from '@remixicon/react' // 二级分类数据 export const componentCategorize = [ { key: CategoryEnum.ALL, label: "所有", - icon: , + icon: , }, { key: CategoryEnum.CHART, label: "图表", - icon: , + icon: , }, { key: CategoryEnum.INFO, label: "信息", - icon: , + icon: , }, { key: CategoryEnum.Map, label: "地图", - icon: , + icon: , }, { key: CategoryEnum.ORNAMENT, label: "装饰", - icon: , + icon: , }, { key: CategoryEnum.MODEL, label: "模型", - icon: , + icon: , }, { key: CategoryEnum.MEDIA, label: "媒体", - icon: , + icon: , }, { key: CategoryEnum.WEB, - label: "web", - icon: , + label: "Web", + icon: , }, { key: CategoryEnum.OTHER, label: "其它", - icon: + icon: } ] diff --git a/report-ui/src/views/screenDesign/Layout/Left/component-lib/componentList.tsx b/report-ui/src/views/screenDesign/Layout/Left/component-lib/componentList.tsx index ef6c100..85518db 100644 --- a/report-ui/src/views/screenDesign/Layout/Left/component-lib/componentList.tsx +++ b/report-ui/src/views/screenDesign/Layout/Left/component-lib/componentList.tsx @@ -17,7 +17,6 @@ const CategoryList = () => { const setSecondMenuActive = useScreenLeftMenu(state => state.setSecondMenuActive) const setThirdMenuActive = useScreenLeftMenu(state => state.setThirdMenuActive) const onMenuClick = (e: any) => { - console.log('aaaaaaaaa') setSecondMenuActive(e.key) setThirdMenuActive(SubCategoryEnum.ALL) } diff --git a/report-ui/src/views/screenDesign/Layout/Middle/components/DragWorkSpace/index.scss b/report-ui/src/views/screenDesign/Layout/Middle/components/DragWorkSpace/index.scss index e6102bc..17afe59 100644 --- a/report-ui/src/views/screenDesign/Layout/Middle/components/DragWorkSpace/index.scss +++ b/report-ui/src/views/screenDesign/Layout/Middle/components/DragWorkSpace/index.scss @@ -18,11 +18,5 @@ transform-origin: left top; background-color: #f2f3f5; } - .dragMask { - position: absolute; - top: 0; - left: 0; - background-color: transparent; - } } } \ No newline at end of file diff --git a/report-ui/src/views/screenDesign/Layout/Middle/components/DragWorkSpace/index.tsx b/report-ui/src/views/screenDesign/Layout/Middle/components/DragWorkSpace/index.tsx index e4f9d40..f6639e5 100644 --- a/report-ui/src/views/screenDesign/Layout/Middle/components/DragWorkSpace/index.tsx +++ b/report-ui/src/views/screenDesign/Layout/Middle/components/DragWorkSpace/index.tsx @@ -5,7 +5,6 @@ import './index.scss' const DragWorkSpace = (props) => { const { children } = props const scale = useEditScreen((state) => state.editor.scale) - const dragging = useEditScreen((state) => state.editor.dragging) const setEditLayOutDom = useEditScreen((state) => state.setEditLayOutDom) const setDragCanvasDom = useEditScreen((state) => state.setDragCanvasDom) @@ -15,7 +14,7 @@ const DragWorkSpace = (props) => { const dragContainerRef = useRef(null) const dragCanvasRef = useRef(null) - const { handleDragEnter, handleDragOver, handleDrop, handleScreenClick } = useDrag(dragContainerRef) + const { handleScreenClick } = useDrag(dragContainerRef) // 拖拽画布 const isMouseDownRef = useRef(false) @@ -116,9 +115,6 @@ const DragWorkSpace = (props) => {
handleScreenClick(e)} onScroll={handleScroll} onMouseDown={dragCanvas} @@ -155,15 +151,6 @@ const DragWorkSpace = (props) => { > {children}
- {/* 拖拽遮罩, 用于保证拖放时的事件对象统一(否则有可能是dragCanvas、dragLayout、以及已在画布上的元素) */} -
) diff --git a/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/components/ModalDialog.tsx b/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/components/ModalDialog.tsx index 4c14744..2bb9337 100644 --- a/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/components/ModalDialog.tsx +++ b/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/components/ModalDialog.tsx @@ -29,70 +29,70 @@ const ModalDialog = (props) => { align: 'center' } ] - const data:DataType[] = [ + const data: DataType[] = [ { key: 1, name: '保存项目', - windows: 'ctrl + shift + s', - mac: '⌘ + shift + s' + windows: 'Ctrl + Shift + S', + mac: '⌘ + Shift + S' }, { key: 2, name: '克隆组件', - windows: 'ctrl + d', - mac: '⌘ + d' + windows: 'Ctrl + D', + mac: '⌘ + D' }, { key: 3, name: '锁定组件', - windows: 'ctrl + l', - mac: '⌘ + l' + windows: 'Ctrl + L', + mac: '⌘ + L' }, { key: 4, name: '解锁组件', - windows: 'ctrl + shift + l', - mac: '⌘ + shift + l' + windows: 'Ctrl + Shift + L', + mac: '⌘ + Shift + L' }, { key: 5, name: '隐藏组件', - windows: 'ctrl + h', - mac: '⌘ + h' + windows: 'Ctrl + H', + mac: '⌘ + H' }, { key: 6, name: '删除组件', - windows: 'backspace', - mac: '⌘ + delete' + windows: 'Backspace', + mac: '⌘ + Delete' }, { key: 7, name: '向 上/右/下/左 移动', - windows: 'CTRL + ↑ 或 → 或 ↓ 或 ←', + windows: 'Ctrl + ↑ 或 → 或 ↓ 或 ←', mac: '⌘ + ↑ 或 → 或 ↓ 或 ←' }, { key: 8, name: '撤销', - windows: 'ctrl + z', - mac: '⌘ + z' + windows: 'Ctrl + Z', + mac: '⌘ + Z' }, { key: 9, name: '重做', - windows: 'ctrl + shift + z', - mac: '⌘ + shift + z' + windows: 'Ctrl + Shift + Z', + mac: '⌘ + Shift + Z' }, { key: 10, - name: 'canvas放大缩小', - windows: 'ctrl + 鼠标滚轮上下', + name: 'Canvas放大缩小', + windows: 'Ctrl + 鼠标滚轮上下', mac: '⌘ + 鼠标滚轮上下' }, { key: 11, - name: 'canvas拖动', + name: 'Canvas拖动', windows: '空格 + 鼠标左键', mac: '空格 + 鼠标左键' } @@ -103,10 +103,21 @@ const ModalDialog = (props) => { width={800} title="快捷键说明" open={visible} - footer={null} + footer={null} onCancel={onCancel} > - +
); diff --git a/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/index.scss b/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/index.scss index ddc8d6f..79f0bfd 100644 --- a/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/index.scss +++ b/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/index.scss @@ -1,10 +1,7 @@ .middle-footer { - height: 40px; + height: 36px; width: 100%; background: #f2f3f5; - border-right: 4px solid #fff; - border-left: 4px solid #fff; - border-bottom: 4px solid #fff; box-sizing: border-box; display: flex; flex-direction: row; @@ -13,33 +10,46 @@ padding: 0 20px; box-sizing: border-box; overflow: hidden; + .footer-left { display: flex; align-items: center; + .footer-item { display: flex; align-items: center; margin-right: 20px; cursor: pointer; + .footer-icon { font-size: 20px; margin-right: 4px; margin-left: 5px; } + .footer-text { font-size: 12px; } } } + .footer-right { display: flex; align-items: center; } } + .popover-content { max-height: 80vh; overflow-y: scroll; + + .history-item { + display: flex; + align-items: center; + gap: 8px; + } } + .ant-popover-title { min-width: inherit !important; } \ No newline at end of file diff --git a/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/index.tsx b/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/index.tsx index 16860bb..c5670bb 100644 --- a/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/index.tsx +++ b/report-ui/src/views/screenDesign/Layout/Middle/components/Footer/index.tsx @@ -7,10 +7,10 @@ */ import { useState } from 'react' import { Tooltip, Select, Space, Slider, Popover } from 'antd' -import IconFonts from '@/components/IconFont' import ModalDialog from './components/ModalDialog' import { useEditScreen } from '@/store/useEditScreen' import './index.scss' +import { RiAddLine, RiDeleteBinLine, RiEditLine, RiFileCopy2Line, RiFileHistoryLine, RiInformationLine, RiKeyboardBoxLine } from '@remixicon/react' const formatScale = (num: number) => { if (isNaN(num)) return 0; @@ -30,25 +30,25 @@ const Footer = () => { { value: 100, label: '100%' }, { value: 80, label: '80%' }, { value: 60, label: '60%' }, - { value: 0, label: '自适应' }, + { value: 0, label: '自适应' }, ] - + const typeMap = { "add": { label: '新增', - icon: 'icon-xinzeng' + icon: }, "delete": { label: '删除', - icon: 'icon-shanchu1' + icon: }, "modify": { label: '修改', - icon: 'icon-xiugaishuxing' + icon: }, "clone": { label: '克隆', - icon: 'icon-fuzhi' + icon: } } const content = () => { @@ -56,9 +56,11 @@ const Footer = () => {
{histories.map((item, index) => { return ( -
- - {typeMap[item.type].label} - {item.data.chartConfig.title} +
+ {typeMap[item.type].icon} +
+ {typeMap[item.type].label} - {item.data.chartConfig.title} +
) })} @@ -86,35 +88,35 @@ const Footer = () => {
setIsModalOpen(true)}> - +
快捷键
- +
操作记录
- +