| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using VberZero.Tools.StringModel;
- namespace VberAdmin.Web.Models.Input;
- public class VmInputNumberDialer : VmInputBase
- {
- public VmInputNumberDialer(string name, string displayName) : base(name, displayName, VmInputType.Dialer)
- {
- Step = 1;
- Prefix = "";
- Suffix = "";
- Decimals = 0;
- DefaultClass = "form-control form-control-sm form-control-solid border-0 ps-12";
- }
- /// <summary>
- /// 步长
- /// </summary>
- public decimal Step { get; set; }
- /// <summary>
- /// 前缀
- /// </summary>
- public string Prefix { get; set; }
- /// <summary>
- /// 后缀
- /// </summary>
- public string Suffix { get; set; }
- /// <summary>
- /// 小数位数
- /// </summary>
- public int Decimals { get; set; }
- public string ControlDataStr => $"data-kt-dialer=\"true\" data-kt-dialer-step=\"{Step}\" {(Min != null ? $"data-kt-dialer-min=\"{Min}\"" : "")} {(Max is > 0 ? $"data-kt-dialer-max=\"{Max}\"" : "")} {(Decimals > 0 ? $"data-kt-dialer-decimals=\"{Decimals}\"" : "")} {(Prefix.Empty() ? "" : $"data-kt-dialer-prefix=\"{Prefix}\"")} {(Suffix.Empty() ? "" : $"data-kt-dialer-suffix=\"{Suffix}\"")} ";
- public override string Other
- {
- get => $"{base.Other ?? ""} data-kt-dialer-control=\"input\"";
- set => _other = value;
- }
- public VmInputNumberDialer WithDialerFix(string prefix = "", string suffix = "")
- {
- Prefix = prefix;
- Suffix = suffix;
- return this;
- }
- public VmInputNumberDialer WithDecimals(int count)
- {
- Decimals = count;
- return this;
- }
- public VmInputNumberDialer WithStep(decimal step)
- {
- if (step <= 0)
- {
- return this;
- }
- Step = step;
- return this;
- }
- public VmInputNumberDialer WithDialer(int? min = null, int? max = null)
- {
- Min = min;
- Max = max;
- DefaultValue = Min + "";
- return this;
- }
- }
|