From 0c0a135988e47c1a7b501a64269ff4f44fa8c56a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 14 六月 2023 09:36:02 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/menu/components/chart/antv-X6/nodeupdate/index.jsx |  135 ++++++++++++++++++++++++++++++---------------
 1 files changed, 90 insertions(+), 45 deletions(-)

diff --git a/src/menu/components/chart/antv-X6/nodeupdate/index.jsx b/src/menu/components/chart/antv-X6/nodeupdate/index.jsx
index 5371bcb..5dcfb27 100644
--- a/src/menu/components/chart/antv-X6/nodeupdate/index.jsx
+++ b/src/menu/components/chart/antv-X6/nodeupdate/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, InputNumber } from 'antd'
+import { Form, Row, Col, Input, Select, Radio, InputNumber } from 'antd'
 
 import ColorSketch from '@/mob/colorsketch'
 
@@ -51,29 +51,34 @@
       title = node.attrs.text.text || ''
     }
 
-    let fontSize = ''
-    if (node.attrs && node.attrs.text) {
-      fontSize = node.attrs.text.fontSize || 12
-    }
-
-    let fontFill = ''
-    if (node.attrs && node.attrs.text) {
-      fontFill = node.attrs.text.fill || '#262626'
-    }
-
-    let stroke = ''
-
-    if (node.attrs && node.attrs.body) {
-      stroke = node.attrs.body.stroke || ''
-    }
-    let fill = ''
-
-    if (node.attrs && node.attrs.body) {
-      fill = node.attrs.body.fill || ''
-    }
-
     if (node.shape === 'edge') {
+      // let fontSize = 14
+      // if (node.attrs && node.attrs.text) {
+      //   fontSize = node.attrs.text.fontSize || 14
+      // }
+      let stroke = ''
+
+      if (node.attrs && node.attrs.line) {
+        stroke = node.attrs.line.stroke || '#A2B1C3'
+      }
+
+      let strokeWidth = ''
+
+      if (node.attrs && node.attrs.line) {
+        strokeWidth = node.attrs.line.strokeWidth || 2
+      }
+
+      let lineType = 'solid'
+
+      if (node.attrs && node.attrs.line && node.attrs.line.strokeDasharray) {
+        lineType = 'dash'
+      }
+
       return [
+        {
+          type: 'title',
+          label: '鍐呭'
+        },
         {
           type: 'text',
           field: 'title',
@@ -81,31 +86,64 @@
           initval: title
         },
         {
-          type: 'color',
-          field: 'fill',
-          label: '鑳屾櫙',
-          initval: fill
+          type: 'title',
+          label: '鏍峰紡'
         },
         {
           type: 'color',
           field: 'stroke',
-          label: '杈规',
+          label: '棰滆壊',
           initval: stroke
         },
         {
           type: 'number',
-          field: 'fontSize',
-          label: '瀛楀彿',
-          initval: fontSize
+          field: 'strokeWidth',
+          label: '绾垮',
+          initval: strokeWidth
         },
         {
-          type: 'color',
-          field: 'fontFill',
-          label: '棰滆壊',
-          initval: fontFill
-        }
+          type: 'radio',
+          field: 'lineType',
+          label: '绾垮瀷',
+          initval: lineType,
+          options: [
+            {value: 'solid', text: '瀹炵嚎'},
+            {value: 'dash', text: '铏氱嚎'}
+          ]
+        },
+        // {
+        //   type: 'number',
+        //   field: 'fontSize',
+        //   label: '瀛楀彿',
+        //   initval: fontSize
+        // },
+        // {
+        //   type: 'color',
+        //   field: 'fontFill',
+        //   label: '棰滆壊',
+        //   initval: fontFill
+        // }
       ]
     } else {
+      let fontFill = '#262626'
+      if (node.attrs && node.attrs.text) {
+        fontFill = node.attrs.text.fill || '#262626'
+      }
+      
+      let fill = ''
+
+      if (node.attrs && node.attrs.body) {
+        fill = node.attrs.body.fill || ''
+      }
+      let fontSize = 12
+      if (node.attrs && node.attrs.text) {
+        fontSize = node.attrs.text.fontSize || 12
+      }
+      let stroke = ''
+
+      if (node.attrs && node.attrs.body) {
+        stroke = node.attrs.body.stroke || ''
+      }
       return [
         {
           type: 'title',
@@ -154,18 +192,10 @@
   }
 
   change = (value, key) => {
-    if (key === 'title') {
-      
-    } else if (key === 'fill') {
-
-    } else if (key === 'stroke') {
-
-    } else if (key === 'fontSize') {
+    if (key === 'fontSize') {
       if (typeof(value) !== 'number' || value < 0) {
         return
       }
-    } else if (key === 'fontFill') {
- 
     }
 
     this.props.onChange(value, key)
@@ -206,11 +236,12 @@
             <Form.Item label={item.label}>
               <Select
                 showSearch
+                defaultValue={item.initval}
                 filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                 onChange={(value) => {this.change(value, item.field)}}
               >
                 {item.options.map(option =>
-                  <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>
+                  <Select.Option key={option.value} value={option.value}>
                     {option.text}
                   </Select.Option>
                 )}
@@ -218,6 +249,20 @@
             </Form.Item>
           </Col>
         )
+      } else if (item.type === 'radio') {
+        fields.push(
+          <Col span={24} key={index}>
+            <Form.Item label={item.label}>
+              <Radio.Group defaultValue={item.initval} style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.change(e.target.value, item.field)}}>
+                {item.options.map(option => {
+                  return (
+                    <Radio key={option.value} value={option.value}>{option.text}</Radio>
+                  )
+                })}
+              </Radio.Group>
+            </Form.Item>
+          </Col>
+        )
       } else if (item.type === 'color') {
         fields.push(
           <Col span={24} key={index}>

--
Gitblit v1.8.0