src/ZKEACMS.FormGenerator/Models/FormField.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* http://www.zkea.net/ 
 * Copyright (c) ZKEASOFT. All rights reserved. 
 * http://www.zkea.net/licenses */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Easy.Extend;
using System.Text;
using Easy;
using Newtonsoft.Json;

namespace ZKEACMS.FormGenerator.Models
{
    public class FormField
    {
        private string id;
        public string ID
        {
            get
            {
                if (id.IsNullOrEmpty())
                {
                    id = $"FF{Guid.NewGuid().ToString("N")}";
                }
                return id;
            }
            set
            {
                id = value;
            }
        }
        public string Name { get; set; }
        public string DisplayName { get; set; }
        public string Value { get; set; }
        public string Description { get; set; }
        public string Placeholder { get; set; }
        public bool IsRequired { get; set; }
        public string RequiredMessage { get; set; }
        public int? Size { get; set; }
        public string Column { get; set; }
        public string RegexPattern { get; set; }
        public string RegexMessage { get; set; }
        Dictionary<string, object> attirbutes;
        [JsonIgnore]
        public Dictionary<string, object> Attributes
        {
            get
            {
                if (attirbutes == null)
                {
                    ILocalize localize = Easy.ServiceLocator.GetService<ILocalize>();
                    attirbutes = new Dictionary<string, object>();
                    attirbutes.Add("class", (IsRequired ? "required " : "") + "form-control ");
                    attirbutes.Add("data-val", "true");
                    if (IsRequired)
                    {
                        string requiredMessage = RequiredMessage ?? localize.Get("{0} is required").FormatWith(DisplayName);
                        attirbutes.Add("data-val-required", requiredMessage);
后面还有 36 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。