feat: add visible
This commit is contained in:
@@ -50,6 +50,15 @@ const ContextMenu = () => {
|
|||||||
>
|
>
|
||||||
<Button>自定义</Button>
|
<Button>自定义</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
onClick={() => {
|
||||||
|
commander.exec('hide');
|
||||||
|
handleclick();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button style={{ width: '100%' }}>隐藏</Button>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
20
packages/dooringx-example/src/plugin/commands/hide.ts
Normal file
20
packages/dooringx-example/src/plugin/commands/hide.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import deepcopy from 'deepcopy';
|
||||||
|
import { CommanderItemFactory } from 'dooringx-lib';
|
||||||
|
import { IStoreData } from 'dooringx-lib/dist/core/store/storetype';
|
||||||
|
|
||||||
|
const hide = new CommanderItemFactory(
|
||||||
|
'hide',
|
||||||
|
'',
|
||||||
|
(store) => {
|
||||||
|
const clonedata: IStoreData = deepcopy(store.getData());
|
||||||
|
clonedata.block.forEach((v) => {
|
||||||
|
if (v.focus) {
|
||||||
|
v.canSee = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
store.setData(clonedata);
|
||||||
|
},
|
||||||
|
'隐藏'
|
||||||
|
);
|
||||||
|
|
||||||
|
export default hide;
|
@@ -146,7 +146,7 @@ function Blocks(props: PropsWithChildren<BlockProps>) {
|
|||||||
width: props.data.width,
|
width: props.data.width,
|
||||||
height: props.data.height,
|
height: props.data.height,
|
||||||
zIndex: props.data.zIndex,
|
zIndex: props.data.zIndex,
|
||||||
display: props.data.display,
|
display: props.data.canSee ? props.data.display : 'none',
|
||||||
opacity: props.iframe ? 0 : 1,
|
opacity: props.iframe ? 0 : 1,
|
||||||
transform: `rotate(${props.data.rotate.value}deg)`,
|
transform: `rotate(${props.data.rotate.value}deg)`,
|
||||||
}}
|
}}
|
||||||
|
@@ -11,7 +11,13 @@ import { SortableContainer, SortableElement, SortableHandle, SortEnd } from 'rea
|
|||||||
import UserConfig from '../../config';
|
import UserConfig from '../../config';
|
||||||
import { IBlockType, IStoreData } from '../../core/store/storetype';
|
import { IBlockType, IStoreData } from '../../core/store/storetype';
|
||||||
import { arrayMove } from '../../core/utils';
|
import { arrayMove } from '../../core/utils';
|
||||||
import { DeleteOutlined, MenuOutlined, PlayCircleOutlined } from '@ant-design/icons';
|
import {
|
||||||
|
DeleteOutlined,
|
||||||
|
EyeInvisibleOutlined,
|
||||||
|
EyeOutlined,
|
||||||
|
MenuOutlined,
|
||||||
|
PlayCircleOutlined,
|
||||||
|
} from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
TimeLineItem,
|
TimeLineItem,
|
||||||
itemHeight,
|
itemHeight,
|
||||||
@@ -83,7 +89,24 @@ const SortableItem = SortableElement(
|
|||||||
</div>
|
</div>
|
||||||
<div>{value.config.getComponentRegister().getMap()[value.value.name].display}</div>
|
<div>{value.config.getComponentRegister().getMap()[value.value.name].display}</div>
|
||||||
<div>{value.value.id.slice(-6)}</div>
|
<div>{value.value.id.slice(-6)}</div>
|
||||||
<div style={{ marginLeft: 5 }}>
|
<div style={{ marginLeft: 5, flex: 1, textAlign: 'right', paddingRight: 5 }}>
|
||||||
|
<span
|
||||||
|
style={{ marginRight: 5 }}
|
||||||
|
onClick={() => {
|
||||||
|
const store = value.config.getStore();
|
||||||
|
const clone = deepcopy(store.getData());
|
||||||
|
clone.block = clone.block.map((v) => {
|
||||||
|
if (v.id === value.value.id && !specialCoList.includes(value.value.name)) {
|
||||||
|
v.canSee = !v.canSee;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
store.setData(clone);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{value.value.canSee ? <EyeOutlined /> : <EyeInvisibleOutlined />}
|
||||||
|
</span>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={replaceLocale('control.popup.delete', '确认删除么', value.config)}
|
title={replaceLocale('control.popup.delete', '确认删除么', value.config)}
|
||||||
onConfirm={() => {
|
onConfirm={() => {
|
||||||
|
@@ -34,6 +34,7 @@ export function createBlock(
|
|||||||
height: ComponentItem.initData.height,
|
height: ComponentItem.initData.height,
|
||||||
syncList: ComponentItem.initData.syncList || [],
|
syncList: ComponentItem.initData.syncList || [],
|
||||||
canDrag: ComponentItem.initData.canDrag ?? true,
|
canDrag: ComponentItem.initData.canDrag ?? true,
|
||||||
|
canSee: ComponentItem.initData.canSee ?? true,
|
||||||
eventMap: ComponentItem.initData.eventMap || {},
|
eventMap: ComponentItem.initData.eventMap || {},
|
||||||
functionList: ComponentItem.initData.functionList || [],
|
functionList: ComponentItem.initData.functionList || [],
|
||||||
animate: ComponentItem.initData.animate || [],
|
animate: ComponentItem.initData.animate || [],
|
||||||
|
@@ -41,6 +41,7 @@ export interface IBlockType {
|
|||||||
focus: boolean;
|
focus: boolean;
|
||||||
resize: boolean;
|
resize: boolean;
|
||||||
canDrag: boolean;
|
canDrag: boolean;
|
||||||
|
canSee: boolean;
|
||||||
props: Record<string, any>;
|
props: Record<string, any>;
|
||||||
syncList: Array<string>;
|
syncList: Array<string>;
|
||||||
eventMap: EventCenterMapType; //调用的event 与对应的函数名 如果要增加参数,则类型不能是Array<string>,需要[{name:string,...args}]
|
eventMap: EventCenterMapType; //调用的event 与对应的函数名 如果要增加参数,则类型不能是Array<string>,需要[{name:string,...args}]
|
||||||
|
@@ -33,6 +33,7 @@ function createDefaultModalBlock(): IStoreData['block'] {
|
|||||||
props: {},
|
props: {},
|
||||||
resize: true,
|
resize: true,
|
||||||
focus: false,
|
focus: false,
|
||||||
|
canSee: true,
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
display: 'block',
|
display: 'block',
|
||||||
syncList: [],
|
syncList: [],
|
||||||
|
Reference in New Issue
Block a user