Skip to content

Commit

Permalink
fix: update richcontainer component
Browse files Browse the repository at this point in the history
  • Loading branch information
baizn committed Sep 22, 2023
1 parent 2fc85c4 commit a8ab865
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -60,15 +61,26 @@ const RichContainer = props => {
} else setWidth(0);
}, [isExpanded]);

useEffect(()=>{
if (utils.searchParamOf(URL_SEARCH_KEY)) {
setState(preState => {
return {
...preState,
activeKey: utils.searchParamOf(URL_SEARCH_KEY) as string,
};
});
}
},[utils.searchParamOf(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] = Containers;

const handleChange = id => {
const { searchParams, path } = utils.getSearchParams(window.location);
searchParams.set(URL_SEARCH_KEY, id);
// window.location.hash = `${path}?${searchParams.toString()}`;
window.location.hash = `${path}?${searchParams.toString()}`;

setState(preState => {
return {
Expand All @@ -90,6 +102,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 => {
Expand All @@ -102,6 +115,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);
Expand Down Expand Up @@ -263,7 +277,7 @@ const RichContainer = props => {
<Segmented block value={activeKey} options={DATA_FILTER_OPTIONS} onChange={handleChange} />
)}

{[...DataArea.components, ...FilterArea.components, ...StylingArea.components].map(item => {
{[...DataArea.components, ...FilterArea.components, ...StylingArea.components, ...ConditionArea.components].map(item => {
const isActive = activeKey === item.id;
return (
<div key={item.id} style={{ display: isActive ? 'block' : 'none' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,22 @@ const registerMeta = context => {
default: [],
},
},
{
id: 'condition-content',
name:'条件展示容器',
required: true,
GI_CONTAINER: {
title: $i18n.get({ id: 'basic.components.RichContainer.registerMeta.IntegratedComponents', dm: '集成组件' }),
type: 'string',
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {
mode: 'multiple',
},
enum: GIAC_CONTENT_ITEMS,
default: [],
},
},
],
isSheet: {
title: '多页签',
Expand Down

0 comments on commit a8ab865

Please sign in to comment.