namespace VberAdmin.Web.Models.Input;
public class VmInput : VmInputBase
{
public VmInput(string name, string displayName) : base(name, displayName, VmInputType.Default)
{
DefaultClass = "form-control form-control-sm form-control-solid";
DefaultValue = "";
}
#region Select
///
/// Select
///
///
///
///
///
///
public VmInputSelect WithSelect(string options, bool addBlank = false, bool isTree = false, bool isMultiple = false)
{
return new VmInputSelect(Name, DisplayName, options, addBlank, isTree, isMultiple);
}
///
/// AjaxSelect
///
///
///
///
///
///
public VmInputSelectAjax WithAjaxSelect(string codeKey, string modalId, string clear = "", int takeCount = 10)
{
return new VmInputSelectAjax(Name, DisplayName, codeKey, modalId, clear, takeCount);
}
#endregion Select
#region Number & Dialer
///
/// Dialer
///
///
///
///
public VmInputNumberDialer WithDialer(int? min, int? max)
{
return new VmInputNumberDialer(Name, DisplayName).WithDialer(min, max);
}
///
/// Dialer
///
///
///
///
///
///
///
///
public VmInputNumberDialer WithDialerStep(decimal step, int? min = null, int? max = null, int count = 0, string preFix = "", string subFix = "")
{
return new VmInputNumberDialer(Name, DisplayName).WithDialer(min, max).WithStep(step).WithDecimals(count).WithDialerFix(preFix, subFix);
}
///
/// Dialer
///
///
///
///
///
///
///
///
public VmInputNumberDialer WithDialerDecimal(int count, decimal step = 1, int? min = null, int? max = null, string preFix = "", string subFix = "")
{
return new VmInputNumberDialer(Name, DisplayName).WithDialer(min, max).WithStep(step).WithDecimals(count).WithDialerFix(preFix, subFix);
}
///
/// Dialer
///
///
///
///
///
///
///
///
public VmInputNumberDialer WithDialerFix(string preFix = "", string subFix = "", int count = 0, decimal step = 1, int? min = null, int? max = null)
{
return new VmInputNumberDialer(Name, DisplayName).WithDialer(min, max).WithStep(step).WithDecimals(count)
.WithDialerFix(preFix, subFix);
}
///
/// Number
///
/// 1:整数,0:数字
///
///
///
public VmInputNumber WithNumber(int numType, int? min = null, int? max = null)
{
return new VmInputNumber(Name, DisplayName).WithNumberType(numType, min, max);
}
///
/// Number
///
///
///
public VmInputNumber WithNumberMin(int min)
{
return new VmInputNumber(Name, DisplayName).WithMin(min);
}
///
/// Number
///
///
///
public VmInputNumber WithNumberMax(int max)
{
return new VmInputNumber(Name, DisplayName).WithMin(max);
}
#endregion Number & Dialer
#region CheckBox & Radio & Switch
///
/// CheckBox (name,value , name,value 成对设置)
///
/// name,value , name,value 成对设置
///
public VmInputCheckBox WithCheckBox(params string[] items)
{
return new VmInputCheckBox(Name, DisplayName).WithItems(items);
}
///
/// Radio (name,value , name,value 成对设置)
///
///
///
public VmInputRadio WithRadio(params string[] items)
{
return new VmInputRadio(Name, DisplayName).WithItems(items);
}
///
/// Radio (name,value , name,value 成对设置)
///
///
///
public VmInputSwitch WithSwitch(params string[] items)
{
return new VmInputSwitch(Name, DisplayName).WithItems(items);
}
#endregion CheckBox & Radio & Switch
#region Textarea & WangEditor
///
/// Textarea
///
///
public VmInputTextarea WithTextarea()
{
return new VmInputTextarea(Name, DisplayName);
}
///
/// WangEditor
///
///
public VmInputWangEditor WithWangEditor()
{
return new VmInputWangEditor(Name, DisplayName);
}
///
/// WangEditor
///
///
///
///
public VmInputWangEditor WithWangEditor(string menu, string options = "")
{
return new VmInputWangEditor(Name, DisplayName).WithMenus(menu).WithOptions(options);
}
#endregion Textarea & WangEditor
#region Date & Time
///
/// Date
///
///
public VmInputDate WithDate()
{
return new VmInputDate(Name, DisplayName);
}
///
/// DateRange
///
///
public VmInputDateRange WithDateRange()
{
return new VmInputDateRange(Name, DisplayName);
}
///
/// DateTime
///
///
public VmInputDateTime WithDateTime()
{
return new VmInputDateTime(Name, DisplayName);
}
///
/// DateTimeRange
///
///
public VmInputDateTimeRange WithDateTimeRange()
{
return new VmInputDateTimeRange(Name, DisplayName);
}
#endregion Date & Time
#region File & Image
///
/// File
///
///
public VmInputFile WithFile()
{
return new VmInputFile(Name, DisplayName).WithFile();
}
///
/// File
///
///
public VmInputFile WithImage()
{
return new VmInputFile(Name, DisplayName).WithFile(true);
}
///
/// File
///
///
///
///
///
///
public VmInputFile WithFile(string fileInfoField, string fileNameField = null, string fileExtField = null,
int maxSize = 5)
{
return new VmInputFile(Name, DisplayName).WithFile(fileInfoField, fileNameField, fileExtField, maxSize);
}
///
/// Image
///
///
///
///
///
///
public VmInputFile WithImage(string fileInfoField, string fileNameField = null, string fileExtField = null,
int maxSize = 5)
{
return new VmInputFile(Name, DisplayName).WithImage(fileInfoField, fileNameField, fileExtField, maxSize);
}
#endregion File & Image
}