diff --git a/packages/gi-assets-basic/package.json b/packages/gi-assets-basic/package.json index 9961e6543..3b08925aa 100644 --- a/packages/gi-assets-basic/package.json +++ b/packages/gi-assets-basic/package.json @@ -1,6 +1,6 @@ { "name": "@antv/gi-assets-basic", - "version": "2.4.20", + "version": "2.4.23", "description": "G6VP 基础资产包", "main": "lib/index.js", "module": "es/index.js", diff --git a/packages/gi-assets-basic/src/components/RichContainer/Component.tsx b/packages/gi-assets-basic/src/components/RichContainer/Component.tsx index 5da747404..21285eed7 100644 --- a/packages/gi-assets-basic/src/components/RichContainer/Component.tsx +++ b/packages/gi-assets-basic/src/components/RichContainer/Component.tsx @@ -1,5 +1,5 @@ import { Handler } from '@antv/gi-common-components'; -import { Icon, useContainer, useContext, utils } from '@antv/gi-sdk'; +import { Icon, useContainer, useContext } from '@antv/gi-sdk'; import { Button, Divider, Segmented, Select, Space } from 'antd'; import { Resizable } from 're-resizable'; import React, { memo, useEffect, useState } from 'react'; @@ -7,6 +7,7 @@ import $i18n from '../../i18n'; import Header from './Header'; import Toolbar from './Toolbar'; import './index.less'; + const URL_SEARCH_KEY = 'ActiveAssetID'; const visibleStyle: React.CSSProperties = { visibility: 'visible', @@ -34,7 +35,7 @@ const RichContainer = props => { const { HAS_GRAPH, GISDK_ID } = context; const Containers = useContainer(context); const [state, setState] = React.useState({ - activeKey: utils.searchParamOf(URL_SEARCH_KEY) || 'LanguageQuery', + activeKey: localStorage.getItem(URL_SEARCH_KEY) || 'LanguageQuery', viewMode: 'GISDK_CANVAS', }); const { activeKey, viewMode } = state; @@ -60,15 +61,24 @@ const RichContainer = props => { } else setWidth(0); }, [isExpanded]); + useEffect(()=>{ + if (localStorage.getItem(URL_SEARCH_KEY)) { + setState(preState => { + return { + ...preState, + activeKey: localStorage.getItem(URL_SEARCH_KEY) as string, + }; + }); + } + },[localStorage.getItem(URL_SEARCH_KEY)]) + const toggleClick = () => { setIsExpanded(prev => !prev); }; - const [NavbarLeftArea, NavbarRightArea, ViewArea, DataArea, FilterArea, StylingArea, CanvasArea] = Containers; + const [ NavbarLeftArea, NavbarRightArea, ViewArea, DataArea, FilterArea, StylingArea, CanvasArea, ConditionArea, TimeBarArea] = Containers; const handleChange = id => { - const { searchParams, path } = utils.getSearchParams(window.location); - searchParams.set(URL_SEARCH_KEY, id); - // window.location.hash = `${path}?${searchParams.toString()}`; + localStorage.setItem(URL_SEARCH_KEY, id) setState(preState => { return { @@ -90,6 +100,7 @@ const RichContainer = props => { }; }); }; + const DATA_QUERY_ID = DataArea.components.map(item => item.id); const DATA_FILTER_ID = FilterArea.components.map(item => item.id); const DATA_QUERY_OPTIONS = DataArea.components.map(item => { @@ -102,6 +113,7 @@ const RichContainer = props => { }); const HAS_QUERY_VIEW = DATA_QUERY_ID.indexOf(activeKey) !== -1; const HAS_FILTER_VIEW = DATA_FILTER_ID.indexOf(activeKey) !== -1; + const onResizeStart = () => { setIsResizing(true); @@ -180,6 +192,7 @@ const RichContainer = props => {