{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "diagram-swimlane",
  "framework": "javascript",
  "type": "registry:component",
  "component": "Diagram",
  "variant": "swimlane",
  "dependencies": [
    "@syncfusion/ej2-diagrams",
    "@syncfusion/ej2-navigations"
  ],
  "description": "Swimlane diagram builds a sales process flow chart with parallel lanes, a phase header, and a symbol palette of flow shapes.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/javascript/llms.txt",
    "skillPack": "syncfusion/javascript-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/javascript/diagram-swimlane.md"
  },
  "files": [
    {
      "target": "src/components/diagram-swimlane/diagram.html",
      "content": "<div class=\"control-section\">\n    <link href=\"https://ej2.syncfusion.com/demos/src/diagram/styles/diagram-common.css\" rel=\"stylesheet\">\n    <style>\n        /* These styles are used for aligning palette and diagram */\n        .diagram-swimlane .sb-mobile-palette {\n            width: 195px;\n            height: 559px;\n            float: left;\n        }\n\n        .diagram-swimlane .sb-mobile-palette-bar {\n            display: none;\n        }\n\n        .diagram-swimlane .sb-mobile-diagram {\n            width: calc(100% - 197px);\n            height: 559px;\n            float: left;\n            border: 1px solid rgba(0, 0, 0, 0.12);\n            border-left: none;\n        }\n\n        @media (max-width: 550px) {\n            .diagram-swimlane .sb-mobile-palette {\n                z-index: 19;\n                position: absolute;\n                transition: transform 300ms linear, visibility 0s linear 300ms;\n                width: 39%;\n                height: 100%;\n            }\n            .diagram-swimlane .sb-mobile-diagram {\n                width: 100%;\n            }\n            .diagram-swimlane .sb-mobile-palette-bar {\n                display: block;\n                width: 100%;\n                background: #fafafa;\n                padding: 10px 10px;\n                border: 0.5px solid #e0e0e0;\n                min-height: 40px;\n            }\n        }\n    </style>\n<div id=\"swimlaneDiagram\" style=\"width: 100%;\" class=\"diagram-swimlane\">\n    <div class=\"sb-mobile-palette-bar\">\n        <div id=\"palette-icon\" style=\"float: right;\" role=\"button\" class=\"e-ddb-icons1 e-toggle-palette\"></div>\n    </div>\n    <div id=\"palette-space\"  class=\"sb-mobile-palette\" >\n        <div id=\"symbolpalette\" style=\"width:90%;\"></div>\n    </div>\n    <div id=\"diagram-space\" class=\"sb-mobile-diagram\">\n        <div id=\"diagram\"></div>\n    </div>\n</div>\n</div>\n<div id=\"action-description\">\n<p>\nThis sample visualize the sales processing flow chart with the help of built-in swimlane shapes.\n</p>\n</div>\n<div id=\"description\">\n<p>\nThis sample shows how an sales process works with each entity involved in the process assigned a lane that contains all the activities for which they are responsible. The <code>type</code> property of the <code>shape</code> allows us to choose the swimlane shape type. Using the <code>children</code> property of the lane, we can add the nodes inside the lanes. We can also create the swimlane interactively using the swimlane shapes from the symbol palette.\n</p>\n</div>"
    },
    {
      "target": "src/components/diagram-swimlane/diagram.ts",
      "content": "// tslint:disable:no-non-null-assertion\nimport type {\n    NodeModel, ConnectorModel, SymbolInfo, PointPortModel, PaletteModel,\n    DiagramBeforeMenuOpenEventArgs, SwimLaneModel, LaneModel,\n    ShapeStyleModel, HeaderModel, ContextMenuSettingsModel, IDragEnterEventArgs\n} from '@syncfusion/ej2-diagrams';\nimport {\n    Diagram, SymbolPalette, SelectorConstraints, Node,\n    PortVisibility, PortConstraints, randomId, cloneObject,\n    UndoRedo, DiagramContextMenu, SnapConstraints\n} from '@syncfusion/ej2-diagrams';\nimport type { MenuEventArgs } from '@syncfusion/ej2-navigations';\nimport { Browser } from '@syncfusion/ej2-base';\n\n// tslint:disable\nDiagram.Inject(UndoRedo, DiagramContextMenu);\n\n// Define a variable to hold an instance of the Diagram\nlet diagram: Diagram;\n\n//Sets the default values of a Connector.\nfunction getConnectorDefaults(connector: ConnectorModel): ConnectorModel {\n    if ((connector.id.indexOf(\"straight\") !== -1) || (connector.id.indexOf(\"straightdashed\") !== -1)) {\n        connector.type = 'Straight';\n    }\n    else {\n        connector.type = 'Orthogonal';\n    }\n    setConnectorStyles(connector, '#717171');\n    return connector;\n}\n//set styles for connector\nfunction setConnectorStyles(connector: ConnectorModel, color: string) {\n    connector.targetDecorator.style.strokeColor = color;\n    connector.targetDecorator.style.fill = color;\n    connector.style.strokeColor = color;\n    connector.style.strokeWidth = 1;\n}\n\n//Set the default values of a node.\nfunction getNodeDefaults(node: NodeModel): NodeModel {\n    node.style.strokeColor = \"#717171\";\n    return node;\n}\n\n//Define custom menu items\nconst contextMenu: ContextMenuSettingsModel = {\n    show: true, items: [\n        {\n            text: 'Copy', id: 'Copy', target: '.e-diagramcontent', iconCss: 'e-icons e-copy'\n        },\n        {\n            text: 'Cut', id: 'Cut', target: '.e-diagramcontent', iconCss: 'e-icons e-cut'\n        },\n        {\n            text: 'Paste', id: 'Paste', target: '.e-diagramcontent', iconCss: 'e-icons e-paste'\n        },\n        {\n            text: 'Insert Lane Before', id: 'InsertLaneBefore', target: '.e-diagramcontent',\n        },\n        {\n            text: 'Insert Lane After', id: 'InsertLaneAfter', target: '.e-diagramcontent',\n        }],\n    showCustomMenuOnly: true,\n};\n\n//Open the context menu items\nfunction contextMenuOpen(args: DiagramBeforeMenuOpenEventArgs): void {\n    for (let item of args.items) {\n        if (diagram.selectedItems.connectors.length + diagram.selectedItems.nodes.length > 0) {\n            if (item.id === 'InsertLaneBefore' || item.id === 'InsertLaneAfter') {\n                if (\n                    diagram.selectedItems.connectors.length ||\n                    (diagram.selectedItems.nodes.length &&\n                        !(diagram.selectedItems.nodes[0] as Node).isLane)\n                ) {\n                    args.hiddenItems.push(item.id);\n                }\n            }\n        } else {\n            args.hiddenItems.push(item.id);\n        }\n    }\n}\n\n//Handles click events on menu items.\nfunction contextMenuClick(args: MenuEventArgs): void {\n    if (args.item.id === 'InsertLaneBefore' || args.item.id === 'InsertLaneAfter') {\n        if (diagram.selectedItems.nodes.length > 0 && (diagram.selectedItems.nodes[0] as Node).isLane) {\n            let index: number;\n            let node: Node = diagram.selectedItems.nodes[0] as Node;\n            let swimlane: NodeModel = diagram.getObject((diagram.selectedItems.nodes[0] as Node).parentId);\n            let shape: SwimLaneModel = swimlane.shape as SwimLaneModel;\n            let existingLane: LaneModel = cloneObject(shape.lanes[0]);\n\n            let newLane: LaneModel = {\n                id: randomId(),\n                header: {\n                    width: existingLane.header.width, height: existingLane.header.height,\n                    style: existingLane.header.style as ShapeStyleModel\n                } as HeaderModel,\n                style: existingLane.style as ShapeStyleModel,\n                height: existingLane.height, width: existingLane.width,\n            } as LaneModel;\n\n            if (shape.orientation === 'Horizontal') {\n                let exclude = 0;\n                exclude += (shape.header) ? 1 : 0;\n                exclude += (shape.phases.length) ? 1 : 0;\n                index = node.rowIndex - exclude;\n                newLane.header.width = existingLane.header.width;\n                newLane.header.height = existingLane.height;\n            } else {\n                index = node.columnIndex - (shape.phases.length) ? 1 : 0;\n                newLane.header.width = existingLane.width;\n                newLane.header.height = existingLane.header.height;\n            }\n            if (args.item.id === 'InsertLaneBefore') {\n                diagram.addLanes(swimlane, [newLane], index);\n            } else {\n                diagram.addLanes(swimlane, [newLane], index + 1);\n            }\n            diagram.clearSelection();\n        }\n    } else if (args.item.id === 'Cut') {\n        diagram.cut();\n    } else if (args.item.id === 'Copy') {\n        diagram.copy();\n    } else if (args.item.id === 'Paste') {\n        diagram.paste();\n    }\n}\n\n//Set the node style for DragEnter element.\nfunction dragEnter(arg: IDragEnterEventArgs): void {\n    if (arg.element instanceof Node) {\n        let shape: SwimLaneModel = arg.element.shape as SwimLaneModel;\n        if (shape.isLane) {\n            if (shape.orientation === 'Horizontal') {\n                shape.lanes[0].height = 100;\n                shape.lanes[0].width = 400;\n            } else if (shape.orientation === 'Vertical') {\n                shape.lanes[0].height = 400;\n                shape.lanes[0].width = 100;\n            }\n        }\n    }\n}\n\n// Initialization function for the diagram and symbol palette\nexport function initSwimlaneDiagram(): void {\n    let bounds: ClientRect = document.getElementById('diagram-space').getBoundingClientRect();\n    let pathData: string = 'M 120 24.9999 C 120 38.8072 109.642 50 96.8653 50 L 23.135' +\n        ' 50 C 10.3578 50 0 38.8072 0 24.9999 L 0 24.9999 C' +\n        '0 11.1928 10.3578 0 23.135 0 L 96.8653 0 C 109.642 0 120 11.1928 120 24.9999 Z';\n\n    //Create and add ports for node.\n    let port: PointPortModel[] = [\n        { id: 'Port1', offset: { x: 0, y: 0.5 }, visibility: PortVisibility.Connect | PortVisibility.Hover, constraints: PortConstraints.Default | PortConstraints.Draw },\n        { id: 'Port2', offset: { x: 0.5, y: 0 }, visibility: PortVisibility.Connect | PortVisibility.Hover, constraints: PortConstraints.Default | PortConstraints.Draw },\n        { id: 'Port3', offset: { x: 1, y: 0.5 }, visibility: PortVisibility.Connect | PortVisibility.Hover, constraints: PortConstraints.Default | PortConstraints.Draw },\n        { id: 'Port4', offset: { x: 0.5, y: 1 }, visibility: PortVisibility.Connect | PortVisibility.Hover, constraints: PortConstraints.Default | PortConstraints.Draw }\n    ];\n\n    //Initializes the nodes for the diagram.\n    let nodes: NodeModel[] = [\n        {\n            id: 'swimlane',\n            shape: {\n                type: 'SwimLane',\n                orientation: 'Horizontal',\n                header: {\n                    annotation: { content: 'SALES PROCESS FLOW CHART', style: { fill: 'transparent' } },\n                    height: 50, style: { fontSize: 11 },\n                },\n                lanes: [\n                    {\n                        id: 'stackCanvas1',\n                        header: {\n                            annotation: { content: 'Consumer' }, width: 50,\n                            style: { fontSize: 11 }\n                        },\n                        height: 100,\n                        children: [\n                            {\n                                id: 'node1',\n                                annotations: [\n                                    {\n                                        content: 'Consumer learns \\n of product',\n                                        style: { fontSize: 11 }\n                                    }\n                                ],\n                                margin: { left: 60, top: 30 },\n                                height: 40, width: 100, ports: port\n                            },\n                            {\n                                id: 'node2',\n                                shape: { type: 'Flow', shape: 'Decision' },\n                                annotations: [\n                                    {\n                                        content: 'Does \\nConsumer want \\nthe product',\n                                        style: { fontSize: 11 }\n                                    }\n                                ],\n                                margin: { left: 200, top: 20 },\n                                height: 60, width: 120, ports: port\n                            },\n                            {\n                                id: 'node3',\n                                annotations: [\n                                    {\n                                        content: 'No sales lead',\n                                        style: { fontSize: 11 }\n                                    }\n                                ],\n                                margin: { left: 370, top: 30 }, shape: { type: 'Path', data: pathData },\n                                height: 40, width: 100, ports: port\n                            },\n                            {\n                                id: 'node4',\n                                annotations: [\n                                    {\n                                        content: 'Sell to consumer',\n                                        style: { fontSize: 11 }\n                                    }\n                                ],\n                                margin: { left: 510, top: 30 },\n                                height: 40, width: 100, ports: port\n                            },\n                        ],\n                    },\n                    {\n                        id: 'stackCanvas2',\n                        header: {\n                            annotation: { content: 'Marketing' }, width: 50,\n                            style: { fontSize: 11 }\n                        },\n                        height: 100,\n                        children: [\n                            {\n                                id: 'node5',\n                                annotations: [{ content: 'Create marketing campaigns' }],\n                                margin: { left: 60, top: 20 },\n                                height: 40, width: 100, ports: port\n                            },\n                            {\n                                id: 'node6',\n                                annotations: [{ content: 'Marketing finds sales leads' }],\n                                margin: { left: 210, top: 20 },\n                                height: 40, width: 100, ports: port\n                            }\n                        ],\n                    },\n                    {\n                        id: 'stackCanvas3',\n                        header: {\n                            annotation: { content: 'Sales' }, width: 50,\n                            style: { fontSize: 11 }\n                        },\n                        height: 100,\n                        children: [\n                            {\n                                id: 'node7',\n                                annotations: [{ content: 'Sales receives lead' }],\n                                margin: { left: 210, top: 30 },\n                                height: 40, width: 100, ports: port\n                            }\n                        ],\n                    },\n                    {\n                        id: 'stackCanvas4',\n                        header: {\n                            annotation: { content: 'Success' }, width: 50,\n                            style: { fontSize: 11 }\n                        },\n                        height: 100,\n                        children: [\n                            {\n                                id: 'node8',\n                                annotations: [{ content: 'Success helps \\n retain consumer \\n as a customer' }],\n                                margin: { left: 510, top: 20 },\n                                height: 50, width: 100, ports: port\n                            }\n                        ],\n                    },\n                ],\n                phases: [\n                    {\n                        id: 'phase1', offset: 170,\n                        header: { annotation: { content: 'Phase' } }\n                    },\n                ],\n                phaseSize: 20,\n            },\n            offsetX: bounds.width / 2, offsetY: bounds.height / 2,\n            height: 100,\n            width: 650\n        },\n    ];\n\n    //Initialize the connectors for the diagram.\n    let connectors: ConnectorModel[] = [\n        {\n            id: 'connector1', sourceID: 'node1',\n            targetID: 'node2'\n        },\n        {\n            id: 'connector2', sourceID: 'node2',\n            targetID: 'node3', annotations: [{ content: 'No', style: { fill: 'white' } }]\n        },\n        {\n            id: 'connector3', sourceID: 'node4',\n            targetID: 'node8'\n        },\n        {\n            id: 'connector4', sourceID: 'node2',\n            targetID: 'node6', annotations: [{ content: 'Yes', style: { fill: 'white' } }]\n        },\n        {\n            id: 'connector5', sourceID: 'node5',\n            targetID: 'node1'\n        },\n        {\n            id: 'connector6', sourceID: 'node6',\n            targetID: 'node7'\n        },\n        {\n            id: 'connector7', sourceID: 'node4',\n            targetID: 'node7', sourcePortID: 'Port1', targetPortID: 'Port3'\n        },\n    ];\n\n    //initialize the diagram control.\n    diagram = new Diagram({\n        // sets the height and width of the diagram.\n        width: '100%', height: '100%',\n        // sets the nodes and connectors of the diagram.\n        nodes: nodes, connectors: connectors,\n        snapSettings: {\n            constraints: SnapConstraints.All & ~SnapConstraints.ShowLines\n        },\n        getConnectorDefaults: getConnectorDefaults,\n        getNodeDefaults: getNodeDefaults,\n        contextMenuSettings: contextMenu,\n        contextMenuOpen: contextMenuOpen,\n        contextMenuClick: contextMenuClick,\n        dragEnter: dragEnter,\n        selectedItems: { constraints: SelectorConstraints.All & ~SelectorConstraints.Rotate }\n    });\n    diagram.appendTo('#diagram');\n\n    // Initializes the palettes to be displayed in the symbol palette.\n    let palettes: PaletteModel[] = [\n        {\n            // Initializes flowshapes for the palettes\n            id: 'flow', expanded: true, title: 'Flow Shapes', symbols: [\n                {\n                    id: 'Terminator', addInfo: { tooltip: 'Terminator' }, width: 100, height: 60, shape: { type: 'Flow', shape: 'Terminator' }, ports: port\n                },\n                {\n                    id: 'Process', addInfo: { tooltip: 'Process' }, width: 100, height: 60, shape: { type: 'Flow', shape: 'Process' }, ports: port\n                },\n                {\n                    id: 'Decision', addInfo: { tooltip: 'Decision' }, width: 50, height: 50, shape: { type: 'Flow', shape: 'Decision' }, ports: port\n                },\n                {\n                    id: 'Document', addInfo: { tooltip: 'Document' }, width: 50, height: 50, shape: { type: 'Flow', shape: 'Document' }, ports: port\n                },\n                {\n                    id: 'Predefinedprocess', addInfo: { tooltip: 'Predefined process' }, width: 50, height: 50, shape: { type: 'Flow', shape: 'PreDefinedProcess' }, ports: port\n                },\n                {\n                    id: 'Data', addInfo: { tooltip: 'Data' }, width: 50, height: 50, shape: { type: 'Flow', shape: 'Data' }, ports: port\n                },\n            ]\n        },\n        {\n            id: 'swimlaneShapes', expanded: true,\n            title: 'Swimlane Shapes',\n            symbols: [\n                {\n                    id: 'Horizontalswimlane', addInfo: { tooltip: 'Horizontal swimlane' },\n                    shape: {\n                        type: 'SwimLane', lanes: [\n                            {\n                                id: 'lane1',\n                                height: 60, width: 150,\n                                header: { width: 50, height: 50, style: { fontSize: 11 } },\n                            }\n                        ],\n                        orientation: 'Horizontal', isLane: true\n                    },\n                    height: 60,\n                    width: 140,\n                    offsetX: 70,\n                    offsetY: 30,\n                }, {\n                    id: 'Verticalswimlane', addInfo: { tooltip: 'Vertical swimlane' },\n                    shape: {\n                        type: 'SwimLane',\n                        lanes: [\n                            {\n                                id: 'lane1',\n                                height: 150, width: 60,\n                                header: { width: 50, height: 50, style: { fontSize: 11 } },\n                            }\n                        ],\n                        orientation: 'Vertical', isLane: true\n                    },\n                    height: 140,\n                    width: 60,\n                    offsetX: 70,\n                    offsetY: 30,\n                }, {\n                    id: 'Verticalphase', addInfo: { tooltip: 'Vertical phase' },\n                    shape: {\n                        type: 'SwimLane',\n                        phases: [{ style: { strokeWidth: 1 }, }],\n                        annotations: [{ text: '' }],\n                        orientation: 'Vertical', isPhase: true\n                    },\n                    height: 60,\n                    width: 140\n                }, {\n                    id: 'Horizontalphase', addInfo: { tooltip: 'Horizontal phase' },\n                    shape: {\n                        type: 'SwimLane',\n                        phases: [{ style: { strokeWidth: 1 }, }],\n                        annotations: [{ text: '' }],\n                        orientation: 'Horizontal', isPhase: true\n                    },\n                    height: 60,\n                    width: 140\n                }\n            ]\n        },\n        {\n            id: 'connectors', expanded: true, symbols: [\n                {\n                    id: 'orthogonal', type: 'Orthogonal', sourcePoint: { x: 0, y: 0 }, targetPoint: { x: 40, y: 40 },\n                },\n                {\n                    id: 'Orthogonaldashed', type: 'Orthogonal', sourcePoint: { x: 0, y: 0 }, targetPoint: { x: 40, y: 40 },\n                    style: { strokeDashArray: '4 4' }\n                },\n                {\n                    id: 'straight', type: 'Straight', sourcePoint: { x: 0, y: 0 }, targetPoint: { x: 60, y: 60 },\n                },\n                {\n                    id: 'straightdashed', type: 'Straight', sourcePoint: { x: 0, y: 0 }, targetPoint: { x: 60, y: 60 },\n                    style: { strokeDashArray: '4 4' }\n                }\n            ], title: 'Connectors'\n        }\n    ];\n\n    // Initializes symbol palette.\n    let palette: SymbolPalette = new SymbolPalette({\n        // sets the expandable mode of the symbol palette.\n        expandMode: 'Multiple',\n        // Sets the palettes displayed in the symbol palette.\n        palettes: palettes,\n        // sets the width and height of the palette.\n        width: '100%', height: '100%',\n        symbolMargin: { left: 8, right: 8, top: 8, bottom: 8 },\n        symbolHeight: 48, symbolWidth: 48,\n        getConnectorDefaults: getConnectorDefaults,\n        getNodeDefaults: getNodeDefaults,\n        getSymbolInfo: (symbol: NodeModel): SymbolInfo => {\n            return { tooltip: symbol.addInfo ? symbol.addInfo['tooltip'] : symbol.id };\n        }\n    });\n    palette.appendTo('#symbolpalette');\n\n    // Check if the current environment is a device\n    if (Browser.isDevice) {\n        // If it is a device, fit the diagram to the page\n        diagram.fitToPage();\n    }\n}\n"
    }
  ]
}