Blazor-Diagrams / Blazor.Diagrams

A fully customizable and extensible all-purpose diagrams library for Blazor
https://blazor-diagrams.zhaytam.com
MIT License
1.01k stars 205 forks source link

How to retrieve form data from nodes when saving processes #441

Open xuzeyu91 opened 5 months ago

xuzeyu91 commented 5 months ago
<div>
    <Card Size="small" TitleTemplate="titleTemplate" Style="width:300px;">
        <Body>
            <p>选择应用</p>

            <Select 
                    @bind-Values="appIds"
                    Placeholder="选择应用"
                    TItemValue="string"
                    TItem="string"
                    Size="@AntSizeLDSType.Default">
                <SelectOptions>
                    @foreach (var app in _appList)
                    {
                        <SelectOption TItem="string" TItemValue="string" Value="@app.Id" Label="@app.Name" />
                    }
                </SelectOptions>
            </Select>
        </Body>
    </Card>

    @foreach (var port in Node.Ports)
    {
        // In case you have any ports to show
        // IMPORTANT: You are always in charge of rendering ports
        <PortRenderer @key="port" Port="port" />
    }
</div>

@code {
    // This gets filled by the library
    [Parameter] public AppNode Node { get; set; } = null!;
    [Inject] IApps_Repositories _apps_Repositories { get; set; }
    RenderFragment titleTemplate =@<div><Icon Type="windows" Theme="outline" />选择应用</div>;
    private List<Apps> _appList = new List<Apps>();
    IEnumerable<string> appIds;

    protected override void OnInitialized()
    {
        base.OnInitialized();
        _appList = _apps_Repositories.GetList();
    }
}

For example, when I use custom nodes, each node will have custom form content. How should I retrieve this data when saving? Currently, I can only retrieve nodes and links