123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871 |
- import CustomColorPicker from "@/components/CustomColorPicker";
- import {
- BoldOutlined,
- ColumnHeightOutlined,
- FontSizeOutlined,
- ItalicOutlined,
- PictureOutlined,
- StrikethroughOutlined,
- SwapOutlined,
- UnderlineOutlined,
- VerticalAlignBottomOutlined,
- VerticalAlignMiddleOutlined,
- VerticalAlignTopOutlined,
- } from "@ant-design/icons";
- import {
- Button,
- Col,
- Divider,
- Form,
- Input,
- InputNumber,
- Row,
- Select,
- Tooltip,
- } from "antd";
- import { arrowOptions } from "@/pages/flow/data";
- import { useModel } from "umi";
- import { useEffect, useRef, useState } from "react";
- import { ImageFillType, ConnectorType, LineType } from "@/enum";
- import { set, cloneDeep } from "lodash-es";
- import { Cell } from "@antv/x6";
- import { fontFamilyOptions, alignOptionData } from '@/pages/flow/data';
- import { alignCell, matchSize } from '@/utils';
- type FormModel = {
- opacity: number;
- width: number;
- height: number;
- x: number;
- y: number;
- rotation: number;
- text: {
- fontFamily: string;
- color: string;
- fontSize: number;
- lineHeight: number;
- textAlign: "left" | "center" | "right";
- textVAlign: "top" | "middle" | "bottom";
- bold: boolean;
- italic: boolean;
- textDecoration: "underline" | "line-through" | "none";
- };
- connectorType: ConnectorType;
- startArrow: string;
- endArrow: string;
- fill: {
- fillType: "color" | "gradient" | "image";
- color1: string;
- color2: string;
- gradientType: "linear" | "radial";
- gradientValue: number;
- objectFit: ImageFillType;
- imageUrl: string;
- };
- stroke: {
- type: "solid" | "dashed" | "dotted" | "dashdot";
- color: string;
- width: number;
- };
- };
- export default function GraphStyle() {
- const { selectedCell } = useModel("graphModel");
- const [isMulit, setIsMulit] = useState(false);
- const [hasEdge, setHasEdge] = useState(false);
- const eventNodeList = useRef<Cell[]>([]);
- const [formModel, setFormModel] = useState<FormModel>({
- opacity: 100,
- width: 20,
- height: 20,
- x: 0,
- y: 0,
- rotation: 0,
- text: {
- fontFamily: "normal",
- color: "#000000",
- fontSize: 14,
- lineHeight: 1.25,
- textAlign: "center",
- textVAlign: "middle",
- bold: false,
- italic: false,
- textDecoration: "none",
- },
- fill: {
- fillType: "color",
- color1: "#FFFFFF",
- color2: "#eeeeee",
- gradientType: "linear",
- gradientValue: 0,
- objectFit: ImageFillType.Fill,
- imageUrl: "",
- },
- stroke: {
- type: "solid",
- color: "#323232",
- width: 1,
- },
- connectorType: ConnectorType.Normal,
- startArrow: "",
- endArrow: "",
- });
- useEffect(() => {
- const firstNode = selectedCell?.find((item) => item.isNode());
- const firstEdge = selectedCell?.find((item) => item.isEdge());
- eventNodeList.current = [];
- if (firstNode) {
- const position = firstNode.position();
- const size = firstNode.size();
- const data = firstNode.getData();
- setFormModel({
- ...formModel,
- x: position.x,
- y: position.y,
- width: size.width,
- height: size.height,
- rotation: firstNode.angle(),
- text: data.text,
- fill: data.fill,
- stroke: data.stroke,
- connectorType: ConnectorType.Normal,
- startArrow: "",
- endArrow: "",
- });
- // 监听当前选中节点的属性变化
- if (!eventNodeList.current.find((item) => item.id === firstNode.id)) {
- eventNodeList.current.push(firstNode);
- firstNode.on("change:*", (args) => {
- if (args.key === "position") {
- setFormModel((state) => {
- return {
- ...state,
- x: parseInt(args.current.x),
- y: parseInt(args.current.y),
- };
- });
- }
- if (args.key === "size") {
- setFormModel((state) => {
- return {
- ...state,
- width: args.current.width,
- height: args.current.height,
- };
- });
- }
- if (args.key === "data") {
- setFormModel((state) => {
- return {
- ...state,
- text: args.current.text,
- fill: args.current.fill,
- stroke: args.current.stroke,
- };
- });
- }
- });
- }
- }
- if(firstEdge) {
- const data = firstEdge.getData();
- const attrs = firstEdge.attrs || {};
- const sourceMarker = attrs.line?.sourceMarker as Record<string, any>;
- const targetMarker = attrs.line?.targetMarker as Record<string, any>;
- const lineType = attrs.line?.strokeDasharray === LineType.solid
- ? "solid"
- : attrs.line?.strokeDasharray === LineType.dashed
- ? "dashed"
- : attrs.line?.strokeDasharray === LineType.dotted
- ? "dotted"
- : "dashdot";
- let obj = {};
- if(!firstNode) {
- obj = {
- stroke: {
- type: lineType,
- color: attrs.line?.stroke || "#000000",
- width: attrs.line?.strokeWidth || 1,
- }
- }
- }
- setFormModel((state) => {
- return {
- ...state,
- ...obj,
- startArrow: sourceMarker?.name,
- endArrow: targetMarker?.name,
- }
- })
- }
- let nodeCount = 0;
- selectedCell?.forEach((cell) => {
- if (cell.isEdge()) {
- // 存在边线
- setHasEdge(true);
- }
- if (cell.isNode()) nodeCount++;
- });
- // 多个节点
- setIsMulit(nodeCount > 1);
- }, [selectedCell]);
- // 表单值改变,修改元素属性
- const handleChange = (model: FormModel) => {
- selectedCell?.forEach((cell) => {
- if (cell.isNode()) {
- cell.setPosition(model.x, model.y);
- cell.setSize(model.width, model.height);
- cell.rotate(model.rotation, { absolute: true });
- cell.setData({
- text: model.text,
- fill: model.fill,
- stroke: model.stroke,
- opacity: model.opacity,
- });
- }
- if (cell.isEdge()) {
- const attr = cell.attrs;
- const sourceMarker = attr?.line?.sourceMarker as Record<string, any>;
- const targetMarker = attr?.line?.targetMarker as Record<string, any>;
- cell.setAttrs({
- line: {
- ...(attr?.line || {}),
- stroke: model.stroke.color,
- strokeWidth: model.stroke.width,
- strokeDasharray: LineType[model.stroke.type],
- targetMarker: {
- ...(targetMarker || {}),
- name: model.endArrow,
- args: {
- size: model.stroke.width + 8,
- }
- },
- sourceMarker: {
- ...(sourceMarker || {}),
- name: model.startArrow,
- args: {
- size: model.stroke.width + 8,
- }
- }
- }
- })
- }
- });
- };
- // 设置对齐方式
- const handleAlign = (type: string) => {
- selectedCell && alignCell(type, selectedCell);
- };
- // 匹配宽高
- const handleMatchSize = (type: "width" | "height" | "auto") => {
- selectedCell && matchSize(type, selectedCell);
- };
- // 调换渐变色颜色
- const handleSwapColor = () => {
- const { color1, color2 } = formModel.fill;
- handleSetFormModel("fill", {
- ...formModel.fill,
- color1: color2,
- color2: color1,
- });
- };
- // 设置表单数据
- const handleSetFormModel = (key: string, value: any) => {
- const obj = cloneDeep(formModel);
- set(obj, key, value);
- setFormModel(obj);
- handleChange(obj);
- };
- return (
- <div>
- <section className="px-16px">
- <div className="bg-white rounded-s flex justify-between items-center mb-8px">
- {alignOptionData.map((item) => (
- <Tooltip key={item.id} title={item.name}>
- <Button
- type="text"
- icon={<i className={"iconfont " + item.icon} />}
- disabled={!isMulit}
- onClick={() => handleAlign(item.id)}
- />
- </Tooltip>
- ))}
- </div>
- <Form.Item
- label="不透明度"
- labelCol={{ span: 14 }}
- wrapperCol={{ span: 10 }}
- labelAlign="left"
- className="mb-8px"
- colon={false}
- >
- <InputNumber
- className="w-full"
- step={5}
- min={0}
- max={100}
- formatter={(val) => `${val}%`}
- disabled={!selectedCell?.length}
- value={formModel.opacity}
- onChange={(val) => handleSetFormModel("opacity", val)}
- />
- </Form.Item>
- </section>
- <Divider className="my-8px" />
- <section className="px-16px">
- <div className="font-bold mb-8px">布局</div>
- <Row gutter={8} className="mb-8px">
- <Col span={12}>
- <InputNumber
- className="w-full"
- step={1}
- min={20}
- max={10000}
- suffix="W"
- formatter={(val) => `${val}px`}
- disabled={!selectedCell?.length}
- value={formModel.width}
- onChange={(val) => handleSetFormModel("width", val)}
- />
- </Col>
- <Col span={12}>
- <InputNumber
- className="w-full"
- step={1}
- min={20}
- max={10000}
- suffix="H"
- formatter={(val) => `${val}px`}
- disabled={!selectedCell?.length}
- value={formModel.height}
- onChange={(val) => handleSetFormModel("height", val)}
- />
- </Col>
- </Row>
- <Row gutter={8} className="mb-8px">
- <Col span={12}>
- <InputNumber
- className="w-full"
- step={1}
- min={0}
- max={10000}
- precision={0}
- suffix="X"
- formatter={(val) => `${val}px`}
- disabled={!selectedCell?.length}
- value={formModel.x}
- onChange={(val) => handleSetFormModel("x", val)}
- />
- </Col>
- <Col span={12}>
- <InputNumber
- className="w-full"
- step={1}
- min={0}
- max={10000}
- precision={0}
- suffix="Y"
- formatter={(val) => `${val}px`}
- disabled={!selectedCell?.length}
- value={formModel.y}
- onChange={(val) => handleSetFormModel("y", val)}
- />
- </Col>
- </Row>
- <div className="flex justify-between items-center gap-12px mb-8px">
- <InputNumber
- className="flex-1"
- step={1}
- min={0}
- max={360}
- formatter={(val) => `${val}°`}
- suffix={<i className="iconfont icon-a-ziyuan126 text-12px" />}
- disabled={!selectedCell?.length}
- value={formModel.rotation}
- onChange={(val) => handleSetFormModel("rotation", val)}
- />
- <Button
- icon={<i className="iconfont icon-shangxiafanzhuan" />}
- disabled={!selectedCell?.length}
- onClick={() => handleSetFormModel("rotation", 0)}
- />
- <Button
- icon={<i className="iconfont icon-zuoyoufanzhuan" />}
- disabled={!selectedCell?.length}
- onClick={() => handleSetFormModel("rotation", 90)}
- />
- </div>
- <Form.Item
- label="匹配大小"
- labelCol={{ span: 14 }}
- wrapperCol={{ span: 10 }}
- labelAlign="left"
- className="mb-8px"
- colon={false}
- >
- <div className="bg-white rounded-s flex justify-between items-center mb-8px">
- <Tooltip title="适配宽度">
- <Button
- type="text"
- icon={<i className="iconfont icon-kuandu" />}
- disabled={!isMulit}
- onClick={() => handleMatchSize("width")}
- />
- </Tooltip>
- <Tooltip title="适配高度">
- <Button
- type="text"
- icon={<i className="iconfont icon-gaodu" />}
- disabled={!isMulit}
- onClick={() => handleMatchSize("height")}
- />
- </Tooltip>
- <Tooltip title="适配宽高">
- <Button
- type="text"
- icon={<i className="iconfont icon-shiyingkuangao" />}
- disabled={!isMulit}
- onClick={() => handleMatchSize("auto")}
- />
- </Tooltip>
- </div>
- </Form.Item>
- </section>
- <Divider className="my-8px" />
- <section className="px-16px">
- <div className="font-bold mb-8px">文本</div>
- <div className="flex items-center gap-12px mb-8px">
- <Select
- className="flex-1"
- disabled={!selectedCell?.length}
- options={fontFamilyOptions}
- value={formModel.text.fontFamily}
- labelRender={(item) => item.value}
- onChange={(val) => handleSetFormModel("text.fontFamily", val)}
- />
- <CustomColorPicker
- disabled={!selectedCell?.length}
- color={formModel.text.color}
- onChange={(color) => handleSetFormModel("text.color", color)}
- />
- </div>
- <div className="flex items-center gap-12px mb-8px">
- <InputNumber
- className="flex-1"
- prefix={<FontSizeOutlined />}
- step={1}
- min={12}
- max={10000}
- formatter={(val) => `${val}px`}
- disabled={!selectedCell?.length}
- value={formModel.text.fontSize}
- onChange={(val) => handleSetFormModel("text.fontSize", val)}
- />
- <Select
- className="flex-1"
- suffixIcon={<ColumnHeightOutlined />}
- options={[
- { label: "1.0", value: 1 },
- { label: "1.25", value: 1.25 },
- { label: "1.5", value: 1.5 },
- { label: "2.0", value: 2 },
- { label: "2.5", value: 2.5 },
- { label: "3.0", value: 3 },
- ]}
- disabled={!selectedCell?.length}
- value={formModel.text.lineHeight}
- onChange={(val) => handleSetFormModel("text.lineHeight", val)}
- />
- </div>
- <div className="flex items-center gap-12px mb-8px">
- <div className="bg-white rounded-s flex justify-between items-center mb-8px">
- <Tooltip title="左对齐">
- <Button
- type="text"
- icon={<i className="iconfont icon-zuoduiqi" />}
- className={formModel.text.textAlign === "left" ? "active" : ""}
- disabled={!selectedCell?.length}
- onClick={() => handleSetFormModel("text.textAlign", "left")}
- />
- </Tooltip>
- <Tooltip title="居中">
- <Button
- type="text"
- icon={<i className="iconfont icon-juzhong" />}
- className={
- formModel.text.textAlign === "center" ? "active" : ""
- }
- disabled={!selectedCell?.length}
- onClick={() => handleSetFormModel("text.textAlign", "center")}
- />
- </Tooltip>
- <Tooltip title="右对齐">
- <Button
- type="text"
- icon={<i className="iconfont icon-youduiqi" />}
- className={formModel.text.textAlign === "right" ? "active" : ""}
- disabled={!selectedCell?.length}
- onClick={() => handleSetFormModel("text.textAlign", "right")}
- />
- </Tooltip>
- </div>
- <div className="bg-white rounded-s flex justify-between items-center mb-8px">
- <Tooltip title="顶部对齐">
- <Button
- type="text"
- icon={<VerticalAlignTopOutlined />}
- disabled={!selectedCell?.length}
- className={formModel.text.textVAlign === "top" ? "active" : ""}
- onClick={() => handleSetFormModel("text.textVAlign", "top")}
- />
- </Tooltip>
- <Tooltip title="垂直居中">
- <Button
- type="text"
- icon={<VerticalAlignMiddleOutlined />}
- className={
- formModel.text.textVAlign === "middle" ? "active" : ""
- }
- disabled={!selectedCell?.length}
- onClick={() => handleSetFormModel("text.textVAlign", "middle")}
- />
- </Tooltip>
- <Tooltip title="底部对齐">
- <Button
- type="text"
- icon={<VerticalAlignBottomOutlined />}
- className={
- formModel.text.textVAlign === "bottom" ? "active" : ""
- }
- disabled={!selectedCell?.length}
- onClick={() => handleSetFormModel("text.textVAlign", "bottom")}
- />
- </Tooltip>
- </div>
- </div>
- <div className="flex items-center gap-12px mb-8px">
- <div className="bg-white rounded-s flex justify-between items-center mb-8px">
- <Tooltip placement="bottom" title="字体加粗">
- <Button
- type="text"
- icon={<BoldOutlined />}
- className={formModel.text.bold ? "active" : ""}
- disabled={!selectedCell?.length}
- onClick={() =>
- handleSetFormModel("text.bold", !formModel.text.bold)
- }
- />
- </Tooltip>
- <Tooltip placement="bottom" title="字体倾斜">
- <Button
- type="text"
- icon={<ItalicOutlined />}
- className={formModel.text.italic ? "active" : ""}
- disabled={!selectedCell?.length}
- onClick={() =>
- handleSetFormModel("text.italic", !formModel.text.italic)
- }
- />
- </Tooltip>
- <Tooltip placement="bottom" title="下划线">
- <Button
- type="text"
- icon={<UnderlineOutlined />}
- className={
- formModel.text.textDecoration === "underline" ? "active" : ""
- }
- disabled={!selectedCell?.length}
- onClick={() =>
- handleSetFormModel(
- "text.textDecoration",
- formModel.text.textDecoration === "underline"
- ? "none"
- : "underline"
- )
- }
- />
- </Tooltip>
- <Tooltip placement="bottom" title="中划线">
- <Button
- type="text"
- icon={<StrikethroughOutlined />}
- className={
- formModel.text.textDecoration === "line-through"
- ? "active"
- : ""
- }
- disabled={!selectedCell?.length}
- onClick={() =>
- handleSetFormModel(
- "text.textDecoration",
- formModel.text.textDecoration === "line-through"
- ? "none"
- : "line-through"
- )
- }
- />
- </Tooltip>
- </div>
- </div>
- </section>
- <Divider className="my-8px" />
- <section className="px-16px">
- <div className="font-bold mb-8px">填充</div>
- <div className="flex items-center gap-12px mb-8px">
- <Select
- className="flex-1"
- options={[
- { label: "纯色", value: "color" },
- { label: "渐变", value: "gradient" },
- { label: "图片", value: "image" },
- ]}
- disabled={!selectedCell?.length}
- value={formModel.fill.fillType}
- onChange={(value) => handleSetFormModel("fill.fillType", value)}
- />
- <div className="flex items-center gap-12px">
- <CustomColorPicker
- disabled={!selectedCell?.length}
- color={formModel.fill.color1}
- onChange={(color) => handleSetFormModel("fill.color1", color)}
- />
- {formModel.fill.fillType === "gradient" && (
- <>
- <Button
- icon={<SwapOutlined />}
- disabled={!selectedCell?.length}
- onClick={handleSwapColor}
- />
- <CustomColorPicker
- disabled={!selectedCell?.length}
- color={formModel.fill.color2}
- onChange={(color) => handleSetFormModel("fill.color2", color)}
- />
- </>
- )}
- </div>
- </div>
- {formModel.fill.fillType === "image" && (
- <>
- <Form.Item
- label="图片地址"
- labelCol={{ span: 14 }}
- wrapperCol={{ span: 10 }}
- labelAlign="left"
- className="mb-8px"
- colon={false}
- >
- <Input
- placeholder="图片地址"
- disabled={!selectedCell?.length}
- suffix={<PictureOutlined />}
- value={formModel.fill.imageUrl}
- onChange={(e) =>
- handleSetFormModel("fill.imageUrl", e.target.value)
- }
- />
- </Form.Item>
- <Form.Item
- label="填充方式"
- labelCol={{ span: 14 }}
- wrapperCol={{ span: 10 }}
- labelAlign="left"
- className="mb-8px"
- colon={false}
- >
- <Select
- options={[
- { value: ImageFillType.Fill, label: "填充" },
- { value: ImageFillType.Auto, label: "自适应" },
- { value: ImageFillType.Stretch, label: "按图形伸展" },
- { value: ImageFillType.Original, label: "原始尺寸" },
- { value: ImageFillType.Tiled, label: "平铺" },
- ]}
- disabled={!selectedCell?.length}
- value={formModel.fill.objectFit}
- onChange={(value) =>
- handleSetFormModel("fill.objectFit", value)
- }
- />
- </Form.Item>
- </>
- )}
- {formModel.fill.fillType === "gradient" && (
- <div className="flex items-center gap-12px">
- <Select
- className="flex-1"
- options={[
- { value: "linear", label: "线性渐变" },
- { value: "radial", label: "径向渐变" },
- ]}
- disabled={!selectedCell?.length}
- value={formModel.fill.gradientType}
- onChange={(value) => {
- handleSetFormModel("fill.gradientType", value);
- }}
- />
- {formModel.fill.fillType === "gradient" && (
- <>
- {formModel.fill.gradientType === "linear" && (
- <InputNumber
- className="flex-1"
- step={1}
- min={0}
- max={360}
- formatter={(val) => `${val}°`}
- suffix={
- <i className="iconfont icon-a-ziyuan126 text-12px" />
- }
- disabled={!selectedCell?.length}
- value={formModel.fill.gradientValue}
- onChange={(val) =>
- handleSetFormModel("fill.gradientValue", val)
- }
- />
- )}
- {formModel.fill.gradientType === "radial" && (
- <InputNumber
- className="flex-1"
- step={1}
- min={0}
- max={100}
- formatter={(val) => `${val}%`}
- suffix={
- <i className="iconfont icon-jingxiangjianbian text-12px" />
- }
- disabled={!selectedCell?.length}
- value={formModel.fill.gradientValue}
- onChange={(val) =>
- handleSetFormModel("fill.gradientValue", val)
- }
- />
- )}
- </>
- )}
- </div>
- )}
- </section>
- <Divider className="my-8px" />
- <section className="px-16px">
- <div className="font-bold mb-8px">线条</div>
- <div className="flex gap-12px mb-8px">
- <Select
- className="flex-1"
- options={[
- { label: "实线", value: "solid" },
- { label: "虚线", value: "dashed" },
- { label: "点线", value: "dotted" },
- { label: "点划线", value: "dashdot" },
- ]}
- disabled={!selectedCell?.length}
- value={formModel.stroke.type}
- onChange={(value) => handleSetFormModel("stroke.type", value)}
- />
- <CustomColorPicker
- disabled={!selectedCell?.length}
- color={formModel.stroke.color}
- onChange={(color) => handleSetFormModel("stroke.color", color)}
- />
- </div>
- <div className="flex gap-12px mb-8px">
- <InputNumber
- className="flex-1"
- step={1}
- min={1}
- max={10}
- formatter={(val) => `${val}px`}
- disabled={!selectedCell?.length}
- value={formModel.stroke.width}
- onChange={(val) => handleSetFormModel("stroke.width", val)}
- />
- <div className="bg-white rounded-s flex justify-between items-center">
- <Button
- type="text"
- icon={
- <i className="iconfont icon-a-icon16lianxianleixinghuizhilianxian" />
- }
- className={
- formModel.connectorType === ConnectorType.Rounded
- ? "active"
- : ""
- }
- disabled={!hasEdge}
- onClick={() =>
- handleSetFormModel("connectorType", ConnectorType.Rounded)
- }
- />
- <Button
- type="text"
- icon={
- <i className="iconfont icon-a-icon16lianxianleixingbeisaierquxian" />
- }
- className={
- formModel.connectorType === ConnectorType.Smooth ? "active" : ""
- }
- disabled={!hasEdge}
- onClick={() =>
- handleSetFormModel("connectorType", ConnectorType.Smooth)
- }
- />
- <Button
- type="text"
- icon={
- <i className="iconfont icon-a-icon16lianxianleixinghuizhizhixian" />
- }
- className={
- formModel.connectorType === ConnectorType.Normal ? "active" : ""
- }
- disabled={!hasEdge}
- onClick={() =>
- handleSetFormModel("connectorType", ConnectorType.Normal)
- }
- />
- </div>
- </div>
- <Form.Item
- label="箭头类型"
- labelAlign="left"
- colon={false}
- labelCol={{ span: 6 }}
- wrapperCol={{ span: 18 }}
- >
- <div className="flex gap-12px items-center">
- <Select
- options={arrowOptions.map((item) => {
- return {
- value: item.name,
- label: <img className="w-12px mx-50%" src={item.icon} />,
- };
- })}
- disabled={!hasEdge}
- value={formModel.startArrow}
- onChange={(value) => handleSetFormModel("startArrow", value)}
- />
- <Select
- options={arrowOptions.map((item) => {
- return {
- value: item.name,
- label: <img className="w-12px mx-50%" src={item.icon} />,
- };
- })}
- disabled={!hasEdge}
- value={formModel.endArrow}
- onChange={(value) => handleSetFormModel("endArrow", value)}
- />
- </div>
- </Form.Item>
- </section>
- </div>
- );
- }
|