Exemplo n.º 1
0
 protected override void GetOption(TagHelperContext context, TagHelperOutput output)
 {
     if (OptionName != null)
     {
         var option = context.AllAttributes[OptionName].Value?.ToString();
         if (option.IsNotNullOrWhiteSpace())
         {
             foreach (var x in option.Split(','))
             {
                 var items = x.Split(':');
                 Options.AddOrUpdate(items[0], items[1]);
             }
         }
     }
 }
Exemplo n.º 2
0
        protected override void AddOption(TagHelperContext context, TagHelperOutput output)
        {
            Options.AddOrUpdate(LayuiConsts.Grid_Col_Sortable, Sortable);
            Options.AddOrUpdate(LayuiConsts.Width, Width);
            Options.AddOrUpdate(LayuiConsts.Grid_Col_Align, Align.ToString().ToLower());
            Options.AddIf(Fixed.HasValue, LayuiConsts.Grid_Col_Fixed, Fixed.ToString().ToLower());

            Options.AddIf(Title.IsNotNullOrWhiteSpace(), LayuiConsts.Title, Title);
            Options.AddIf(Field.IsNotNullOrWhiteSpace(), LayuiConsts.Field, Field.ToCamelCase());
            Options.AddIf(Style.IsNotNullOrWhiteSpace(), LayuiConsts.Grid_Col_Style, Style);
            Options.AddIf(Formatter.IsNotNullOrWhiteSpace(), LayuiConsts.Grid_Col_Formatter, Formatter);
            Options.AddIf(Edit.HasValue, LayuiConsts.Grid_Col_Edit, Edit.ToString().ToLower());
            Options.AddIf(Toolbar.IsNotNullOrWhiteSpace(), LayuiConsts.Grid_Col_Toolbar, Toolbar);

            if (ReplaceField.IsNotNullOrWhiteSpace())
            {
                output.Attributes.Add(LayuiConsts.Item_Replace, ReplaceField);
            }

            base.AddOption(context, output);
        }
Exemplo n.º 3
0
        protected override void AddOption(TagHelperContext context, TagHelperOutput output)
        {
            Options.AddOrUpdate(EasyuiConsts.Grid_Col_Align, Align.ToString().ToLower());
            Options.AddIf(Title.IsNotNullOrWhiteSpace(), EasyuiConsts.Title, Title);
            Options.AddIf(Styler.IsNotNullOrWhiteSpace(), EasyuiConsts.Grid_Col_Styler, Styler);
            Options.AddIf(Editor.IsNotNullOrWhiteSpace(), EasyuiConsts.Grid_Col_Editor, GetJavaScriptString(Editor));

            if (Field.IsNotNullOrWhiteSpace())
            {
                Options.AddOrUpdate(EasyuiConsts.Field, Field.ToCamelCase());
            }
            if (Formatter.IsNotNullOrWhiteSpace())
            {
                Options.AddOrUpdate(EasyuiConsts.Grid_Col_Formatter, GetJavaScriptString(Formatter));
            }

            if (Width != null)
            {
                Options.AddOrUpdate(EasyuiConsts.Width, Width);
            }

            if (IsFrozen)
            {
                output.Attributes.Add(EasyuiConsts.Grid_Col_IsFrozen, IsFrozen);
            }

            if (IsEdit)
            {
                output.Attributes.Add(EasyuiConsts.Grid_Col_IsEdit, IsEdit);
            }

            if (ReplaceField.IsNotNullOrWhiteSpace())
            {
                output.Attributes.Add(EasyuiConsts.Item_Replace, ReplaceField);
            }

            base.AddOption(context, output);
        }
Exemplo n.º 4
0
        protected override void AddOption(TagHelperContext context, TagHelperOutput output)
        {
            Options.AddIf(IsRequired.HasValue, EasyuiConsts.Required, IsRequired);
            Options.AddIf(IsMultiline.HasValue, EasyuiConsts.Multiline, IsMultiline);
            Options.AddIf(IsDisable.HasValue, EasyuiConsts.Disabled, IsDisable);
            Options.AddIf(IsEdit.HasValue, EasyuiConsts.Editable, IsEdit);

            if (MaxLength > 0)
            {
                ValidTypes.Add($"{EasyuiConsts.ValidType_MaxLength}[{MaxLength}]");
            }

            if (Options.ContainsKey(EasyuiConsts.ValidType))
            {
                var valids = Options[EasyuiConsts.ValidType].ToString().Split(',').Where(x => x.IsNotNullOrWhiteSpace());
                ValidTypes.AddRange(valids);
            }

            if (ValidType.IsNotNullOrWhiteSpace())
            {
                var valids = ValidType.Split(',').Where(x => x.IsNotNullOrWhiteSpace());
                ValidTypes.AddRange(valids);
            }

            if (IsDisable == true)
            {
                Clear = false;
            }
            if (Clear.HasValue)
            {
                output.Attributes.Add(EasyuiConsts.Clear, Clear.ToString().ToCamelCase());
            }

            if (ValidTypes.Any())
            {
                Options.AddOrUpdate(EasyuiConsts.ValidType, GetJavaScriptString(ValidTypes.ToJsonString()));
            }
        }