function customNode()

in fastmodel-ide/fastmodel-ide-open-front/src/components/fmlgraph/GraphConfig.ts [116:189]


function customNode(nodeName, attrs, stroke = '#5F95FF') {
    Graph.registerNode(
        nodeName,
        {
            inherit: 'rect',
            markup: [
                {
                    tagName: 'rect',
                    selector: 'body',
                },
                {
                    tagName: 'text',
                    selector: 'label',
                },
            ],
            attrs: attrs,
            ports: {
                groups: {
                    list: {
                        markup: [
                            {
                                tagName: 'rect',
                                selector: 'portBody',
                            },
                            {
                                tagName: 'text',
                                selector: 'portNameLabel',
                            },
                            {
                                tagName: 'text',
                                selector: 'portPrimary'
                            },
                            {
                                tagName: 'text',
                                selector: 'portTypeLabel',
                            },
                        ],
                        attrs: {
                            portBody: {
                                width: NODE_WIDTH,
                                height: LINE_HEIGHT,
                                strokeWidth: 1,
                                stroke: stroke,
                                fill: '#EFF4FF',
                                magnet: true,
                            },
                            portNameLabel: {
                                ref: 'portBody',
                                refX: 6,
                                refY: 6,
                                fontSize: 10
                            },
                            portPrimary: {
                                ref: 'portBody',
                                refX: 1,
                                refY: 6,
                                fontSize: 10,
                                fill: '#ff0000'
                            },
                            portTypeLabel: {
                                ref: 'portBody',
                                refX: 95,
                                refY: 6,
                                fontSize: 10,
                            },
                        },
                        position: 'erPortPosition',
                    },
                },
            },
        },
        true,
    )
}