update 优化属性面板,当面板未选中时默认展示流程面板

This commit is contained in:
LiuHao 2024-01-31 15:33:05 +08:00
parent b97068c72f
commit a73ce7f8bf

View File

@ -20,6 +20,7 @@ interface propsType {
const props = withDefaults(defineProps<propsType>(), {});
const element = ref<Element>();
const processElement = ref<Element>();
const startEndType = ['bpmn:IntermediateThrowEvent', 'bpmn:StartEvent', 'bpmn:EndEvent'];
const taskType = [
@ -36,6 +37,7 @@ const sequenceType = ['bpmn:SequenceFlow'];
const gatewayType = ['bpmn:InclusiveGateway', 'bpmn:ExclusiveGateway', 'bpmn:ParallelGateway', 'bpmn:EventBasedGateway'];
const processType = ['bpmn:Process'];
//
const component = computed(() => {
if (!element.value) return null;
const type = element.value.type;
@ -57,20 +59,20 @@ const nodeName = computed(() => {
const handleModeler = () => {
props.modeler.on('root.added', (e: any) => {
if (e.element.type === 'bpmn:Process') {
element.value = null;
if (e.element.type === 'bpmn:Process') {
nextTick(() => {
element.value = e.element;
// const modeling = props.modeler.get<Modeling>('modeling');
// modeling.setColor(e.element.children, {
// fill: 'green'
// });
processElement.value = e.element;
});
}
});
props.modeler.on('element.click', (e: any) => {
if (e.element.type === 'bpmn:Process') {
nextTick(() => {
element.value = e.element;
processElement.value = e.element;
});
}
});
props.modeler.on('selection.changed', (e: any) => {
@ -81,6 +83,10 @@ const handleModeler = () => {
nextTick(() => {
element.value = newElement;
});
} else {
nextTick(() => {
element.value = processElement.value;
});
}
});
};