index.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { GroupNode } from '@logicflow/extension'
  2. import { storeToRefs } from 'pinia';
  3. import { useThemeConfig } from '/@/stores/themeConfig';
  4. const storesThemeConfig = useThemeConfig();
  5. const { themeConfig } = storeToRefs(storesThemeConfig);
  6. import { nodeStyleHandle } from '../tool'
  7. class SubProcessView extends GroupNode.view {
  8. }
  9. class SubProcessModel extends GroupNode.model {
  10. initNodeData (data: any) {
  11. super.initNodeData(data)
  12. this.isRestrict = true
  13. this.resizable = true
  14. this.foldable = false
  15. this.width = 500
  16. this.height = 300
  17. this.foldedWidth = 50
  18. this.foldedHeight = 50
  19. }
  20. getNodeStyle ():{
  21. [x: string]: any;
  22. width?: number;
  23. height?: number;
  24. radius?: number;
  25. fill?: string;
  26. stroke?: string;
  27. strokeWidth?: number;
  28. } {
  29. const style = super.getNodeStyle()
  30. // 设置样式
  31. if(themeConfig.value.isIsDark){
  32. style.fill = "#191919";
  33. style.stroke = "#fff"
  34. }else{
  35. style.fill = "#fff";
  36. style.stroke = "#3C50E0";
  37. }
  38. return nodeStyleHandle(this, style)
  39. }
  40. }
  41. const SubProcess = {
  42. type: 'hotline:subProcess',
  43. view: SubProcessView,
  44. model: SubProcessModel
  45. }
  46. export { SubProcess, SubProcessModel }
  47. export default SubProcess