logoEnterprise-level component library based on Bootstrap and Blazor
gitee
version
license
download
repo
commit
build
coverage

Transfer

Demo

You can customize the list title copy, button copy, rendering function of data items, check status copy at the bottom of the list, content area at the bottom of the list, and so on.

Demo

In cases where there is a lot of data, you can search and filter the data.

Demo

When component data changes, the bidirectional binding bind-Value values change synchronously

Demo

Transfer component is a generic component that supports three binding types string IEnumerable<string> IEnumerable<SelectedItem> in this case bidirectional binding TheSelectValue type is IEnumerable<SelectedItem>

Value:Backup 01;Backup 02;Backup 05

When component data changes, the bidirectional binding bind-Value values change synchronously

Demo

The Transfer component built into the ValidateForm component turns on client authentication, in this case the component bidirectional binding Model.Hobby type is IEnumerable<string>

Hobby:

MinMaxIntro

Demo

When you set the IsDisabled property value to true, the component suppresses input

Demo

By setting the OnSetItemClass callback method styles options based on the values of SelectedItem

Demo

Attributes

Loading...

Event

Loading...
@page "/transfers"
@inject IStringLocalizer<Transfers> Localizer

<h3>Transfer</h3>

<DemoBlock Title="Basic usage" Introduction="" Name="Normal">
    <Transfer TValue="string" Items="@Items" OnSelectedItemsChanged="@OnSelectedItemsChanged" />
    <BlockLogger @ref="Trace" class="mt-3" />
</DemoBlock>

<DemoBlock Title="Customizable" Introduction="You can customize the list title copy, button copy, rendering function of data items, check status copy at the bottom of the list, content area at the bottom of the list, and so on." Name="Customer">
    <Transfer TValue="string" Items="@Items1"
              LeftPanelText="The list on the left" RightPanelText="The list on the right"
              LeftButtonText="To the left" RightButtonText="To the Right" />
</DemoBlock>

<DemoBlock Title="Searchable" Introduction="In cases where there is a lot of data, you can search and filter the data." Name="Search">
    <Transfer TValue="string" Items="@Items2"
              LeftPanelText="The list on the left" RightPanelText="The list on the right"
              LeftButtonText="To the left" RightButtonText="To the Right"
              LeftPannelSearchPlaceHolderString="Please enter" RightPannelSearchPlaceHolderString="Please enter"
              ShowSearch="true" />
</DemoBlock>

<DemoBlock Title="Two-way binding" Introduction="When component data changes, the bidirectional binding <code>bind-Value</code> values change synchronously" Name="Bind">
    <p><code>Transfer</code> component is a generic component that supports three binding types <code>string</code> <code>IEnumerable<string></code> <code>IEnumerable<SelectedItem></code> in this case bidirectional binding The<code>SelectValue</code> type is <code>IEnumerable<SelectedItem></code></p>
    <Transfer Items="@Items3" @bind-Value="@SelectedValue" />
    <div class="my-3">Value:@string.Join(";", SelectedValue.Select(i => i.Text))</div>
    <Button Text="Add" OnClick="@OnAddItem" />
</DemoBlock>

<DemoBlock Title="Client Validation" Introduction="When component data changes, the bidirectional binding <code>bind-Value</code> values change synchronously" Name="Validate">
    <p>The <code>Transfer</code> component built into the <code>ValidateForm</code> component turns on client authentication, in this case the component bidirectional binding <code>Model.Hobby</code> type is <code>IEnumerable<string></code></p>
    <ValidateForm Model="@Model">
        <div class="row g-3">
            <div class="col-12">
                <Transfer Items="@Items5" @bind-Value="@Model.Hobby" />
            </div>
            <div class="col-12">
                <Button ButtonType="ButtonType.Submit">Submit</Button>
            </div>
        </div>
    </ValidateForm>
    <div class="mt-3">Hobby: @string.Join(",", Model.Hobby)</div>
</DemoBlock>

<DemoBlock Title="@Localizer["MinMaxTitle"]" Introduction="@Localizer["MinMaxIntro"]" Name="MinMax">
    <ValidateForm Model="@Model6">
        <div class="row g-3">
            <div class="col-12">
                <Transfer Items="@Items6" @bind-Value="@Model.Hobby" Min="2" Max="4" />
            </div>
            <div class="col-12">
                <Button ButtonType="ButtonType.Submit">Submit</Button>
            </div>
        </div>
    </ValidateForm>
</DemoBlock>

<DemoBlock Title="Disable" Introduction="When you set the <code>IsDisabled</code> property value to <code>true</code>, the component suppresses input" Name="Disable">
    <Transfer TValue="string" Items="@Items4" IsDisabled="true"
              LeftPanelText="The list on the left" RightPanelText="The list on the right"
              LeftButtonText="To the left" RightButtonText="To the Right"
              LeftPannelSearchPlaceHolderString="Please enter" RightPannelSearchPlaceHolderString="Please enter"
              ShowSearch="true" />
</DemoBlock>

<DemoBlock Title="Set the Item style" Introduction="By setting the <code>OnSetItemClass</code> callback method styles options based on the</code> values of <code>SelectedItem" Name="ItemClass">
    <Transfer TValue="string" Items="@Items4" OnSetItemClass="SetItemClass" />
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />

<EventTable Items="@GetEvents()" />
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/

namespace BootstrapBlazor.Shared.Samples;

/// <summary>
/// 
/// </summary>
public sealed partial class Transfers : ComponentBase
{
    /// <summary>
    /// 
    /// </summary>
    [NotNull]
    private IEnumerable<SelectedItem>? Items { get; set; }

    [NotNull]
    private IEnumerable<SelectedItem>? Items1 { get; set; }

    [NotNull]
    private IEnumerable<SelectedItem>? Items2 { get; set; }

    [NotNull]
    private List<SelectedItem>? Items3 { get; set; }

    [NotNull]
    private IEnumerable<SelectedItem>? Items4 { get; set; }

    [NotNull]
    private IEnumerable<SelectedItem>? Items5 { get; set; }

    [NotNull]
    private IEnumerable<SelectedItem>? Items6 { get; set; }

    [NotNull]
    private BlockLogger? Trace { get; set; }

    private IEnumerable<SelectedItem> SelectedValue { get; set; } = Enumerable.Empty<SelectedItem>();

    private Foo Model { get; set; } = new();

    private Foo Model6 { get; set; } = new();

    /// <summary>
    /// OnInitializedAsync 方法
    /// </summary>
    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        // 模拟异步加载数据源
        await Task.Delay(100);

        Items = GeneratorItems();

        Items1 = GeneratorItems();

        Items2 = GeneratorItems();

        Items3 = Enumerable.Range(1, 15).Select(i => new SelectedItem()
        {
            Text = $"{Localizer["Backup"]} {i:d2}",
            Value = i.ToString()
        }).ToList();

        var v = SelectedValue.ToList();
        v.AddRange(Items3.Take(2));
        v.AddRange(Items3.Skip(4).Take(1));
        SelectedValue = v;

        Items4 = GeneratorItems();

        Items5 = GeneratorItems();

        Items6 = GeneratorItems();
    }

    private IEnumerable<SelectedItem> GeneratorItems() =>Enumerable.Range(1, 15).Select(i => new SelectedItem()
    {
        Text = $"{Localizer["Data"]} {i:d2}",
        Value = i.ToString()
    });

    private void OnAddItem()
    {
        var count = Items3.Count + 1;
        Items3.Add(new SelectedItem(count.ToString(), $"{Localizer["Backup"]} {count:d2}"));
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="items"></param>
    private Task OnSelectedItemsChanged(IEnumerable<SelectedItem> items)
    {
        Trace?.Log(string.Join(" ", items.Select(i => i.Text)));
        return Task.CompletedTask;
    }

    private static string? SetItemClass(SelectedItem item) => item.Value switch
    {
        "2" => "bg-success text-white",
        "4" => "bg-info text-white",
        "6" => "bg-primary text-white",
        "8" => "bg-warning text-white",
        _ => null
    };

    /// <summary>
    /// 获得属性方法
    /// </summary>
    /// <returns></returns>
    private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
    {
        // TODO: 移动到数据库中
        new AttributeItem() {
            Name = "Items",
            Description = Localizer["Items"],
            Type = "IEnumerable<SelectedItem>",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "LeftButtonText",
            Description = Localizer["LeftButtonTextAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "LeftPanelText",
            Description = Localizer["LeftPanelTextAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = Localizer["LeftPanelDefaultValue"]!
        },
        new AttributeItem() {
            Name = "RightButtonText",
            Description = Localizer["RightButtonTextAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "RightPanelText",
            Description = Localizer["RightPanelTextAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = Localizer["RightPanelTextDefaultValue"]!
        },
        new AttributeItem() {
            Name = "ShowSearch",
            Description = "",
            Type = "boolean",
            ValueList = " — ",
            DefaultValue = "false"
        },
        new AttributeItem() {
            Name = "LeftPannelSearchPlaceHolderString",
            Description = Localizer["LeftPannelSearchPlaceHolderString"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "RightPannelSearchPlaceHolderString",
            Description = Localizer["RightPannelSearchPlaceHolderString"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "IsDisabled",
            Description = Localizer["IsDisabled"],
            Type = "boolean",
            ValueList = "true / false",
            DefaultValue = "false"
        }
    };

    /// <summary>
    /// 获得事件方法
    /// </summary>
    /// <returns></returns>
    private IEnumerable<EventItem> GetEvents() => new EventItem[]
    {
        new EventItem()
        {
            Name = nameof(Transfer<string>.OnSelectedItemsChanged),
            Description = Localizer["OnSelectedItemsChanged"],
            Type = "Func<IEnumerable<SelectedItem>, Task>"
        },
        new EventItem()
        {
            Name = "OnSetItemClass",
            Description = Localizer["OnSetItemClass"],
            Type = "Func<SelectedItem, string?>"
        }
    };
}

B station related video link

No

交流群

QQ Group:BootstrapAdmin & Blazor 795206915 675147445 Welcome to join the group discussion
img
Themes
Bootstrap
Motronic
Ant Design (完善中)
DevUI (制作中)
LayUI (完善中)
An error has occurred. This application may no longer respond until reloaded. Reload
Seems like the connection with the server has been lost. It can be due to poor or broken network. Please hang on while we're trying to reconnect...
Oh snap! Failed to reconnect with the server. This is typically caused by a longer network outage, or if the server has been taken down. You can try to reconnect, but if that does not work, you need to reload the page.
Oh man! The server rejected the attempt to reconnect. The only option now is to reload the page, but be prepared that it won't work, since this is typically caused by a failure on the server.
Bootstrap Blazor Component library updated to 7.0.8-beta05

Bootstrap Blazor at present has more than 120 components. This component is based on Bootstrap Blazor An enterprise-level component library that provides several types of common components such as layout, navigation, form, data, notification, icon, voice, etc. Each component has been carefully designed with modularity, responsiveness and excellent performance. Starting from more practical scenarios, meeting the needs of various scenarios, greatly reducing the time cost of developers, greatly shortening the development cycle, greatly improving development efficiency, and providing a set of General Rights Management System Example project。Bootstrap Blazor Products are maintained by a professional full-time technical team, with efficient response speed, diversified solutions, long-term support, and enterprise-level support. At present, it has been used in many well-known state-owned enterprises, and the project is running stably with a maximum of 1200 people online. On the right is the QR code of the Chinese Blazor QQ community with the largest number of people in China, welcome to scan and join the group.

component updated to 6.6.0 Change log [portal] If the component brings you convenience, please help to light up the project Star github gitee

QQGroup
QQ 795206915