corrad-bp/components/process-flow/HtmlNodeConfigurationModal.vue
Md Afiq Iskandar b4eb3265c2 Enhance Process Builder with HTML and Subprocess Node Features
- Introduced new HTML and Subprocess nodes in ProcessBuilderComponents.vue, allowing users to add custom HTML content and execute subprocesses within the process flow.
- Updated ProcessFlowNodes.js to include HtmlNode and SubprocessNode components with appropriate properties and rendering logic.
- Enhanced ProcessFlowCanvas.vue to manage the new node types effectively, ensuring proper integration with existing flow functionalities.
- Improved index.vue to support configuration modals for HTML and Subprocess nodes, enhancing user interaction and customization options.
- Refactored process management logic to accommodate new node types, ensuring seamless integration and consistent user experience across the process builder.
2025-07-10 11:08:16 +08:00

116 lines
3.3 KiB
Vue

<template>
<RsModal
v-model="showModal"
title="HTML Node Configuration"
size="xl"
position="center"
:okCallback="saveAndClose"
okTitle="Save"
:cancelCallback="closeModal"
>
<template #body>
<div class="mb-6">
<div class="flex items-start">
<div class="mr-4 text-blue-500 flex-shrink-0 mt-1">
<Icon name="material-symbols:code" class="text-2xl" />
</div>
<div>
<h3 class="text-lg font-semibold mb-1">Configure HTML Node</h3>
<p class="text-sm text-gray-600">
Create custom HTML content to display in your process flow.
HTML nodes are useful for creating custom forms, displaying information, and providing interactive elements.
</p>
</div>
</div>
</div>
<!-- Main configuration area -->
<HtmlNodeConfiguration
:nodeData="localNodeData"
:availableVariables="availableVariables"
@update="handleUpdate"
/>
<!-- Quick Reference Guide -->
<div class="mt-6 bg-blue-50 p-4 rounded-md border border-blue-100">
<h4 class="font-medium text-blue-700 mb-2 flex items-center">
<Icon name="material-symbols:info-outline" class="mr-1" />
Quick Reference Guide
</h4>
<div class="text-sm text-blue-700">
<ul class="list-disc list-inside space-y-1">
<li>Use <code class="bg-blue-100 px-1">{{ variableSyntaxExample }}</code> syntax to display process variables in your HTML</li>
<li>Add CSS styles to customize the appearance of your HTML content</li>
<li>Include JavaScript for interactive functionality</li>
<li>Select input variables that your HTML node will read from</li>
<li>Define output variables that your HTML node will modify</li>
</ul>
</div>
</div>
</template>
</RsModal>
</template>
<script setup>
import { ref, watch, computed } from 'vue';
import HtmlNodeConfiguration from './HtmlNodeConfiguration.vue';
import { Icon } from '#components';
const props = defineProps({
modelValue: {
type: Boolean,
default: false
},
nodeData: {
type: Object,
required: true
},
availableVariables: {
type: Array,
default: () => []
}
});
const emit = defineEmits(['update:modelValue', 'update']);
const showModal = ref(props.modelValue);
const localNodeData = ref({ ...props.nodeData });
// Computed property to avoid template syntax issues
const variableSyntaxExample = computed(() => '{{ variableName }}');
// Watch for changes to modelValue prop to sync modal visibility
watch(() => props.modelValue, (value) => {
showModal.value = value;
});
// Watch for changes to showModal to emit update:modelValue
watch(() => showModal.value, (value) => {
emit('update:modelValue', value);
});
// Watch for changes to nodeData prop
watch(() => props.nodeData, (value) => {
localNodeData.value = { ...value };
}, { deep: true });
function handleUpdate(updatedData) {
localNodeData.value = { ...updatedData };
}
function saveAndClose() {
emit('update', localNodeData.value);
showModal.value = false;
}
function closeModal() {
showModal.value = false;
}
</script>
<style scoped>
code {
font-family: monospace;
border-radius: 0.25rem;
}
</style>