示例#1
0
文件: Page.cs 项目: sshaddicts/A2v10
 void AddAttributes(TagBuilder tag)
 {
     if (Background != BackgroundStyle.Default)
     {
         tag.AddCssClass("background-" + Background.ToString().ToKebabCase());
     }
     tag.AddCssClass(CssClass);
     tag.AddCssClassBoolNo(UserSelect, "user-select");
     if (Absolute != null)
     {
         Absolute.MergeAbsolute(tag);
         tag.MergeStyle("width", "auto");
         tag.MergeStyle("height", "auto");
     }
 }
示例#2
0
        internal virtual void MergeAttributes(TagBuilder tag, RenderContext context, MergeAttrMode mode = MergeAttrMode.All)
        {
            if (mode.HasFlag(MergeAttrMode.Visibility))
            {
                MergeVisibilityAttribures(tag, context);
            }

            if (mode.HasFlag(MergeAttrMode.Tip))
            {
                MergeBindingAttributeString(tag, context, "title", "Tip", Tip);
            }

            if (mode.HasFlag(MergeAttrMode.Wrap))
            {
                if (Wrap != WrapMode.Default)
                {
                    tag.AddCssClass(Wrap.ToString().ToKebabCase());
                }
            }

            if (mode.HasFlag(MergeAttrMode.Margin))
            {
                if (Margin != null)
                {
                    Margin.MergeStyles("margin", tag);
                }
                if (Padding != null)
                {
                    Padding.MergeStyles("padding", tag);
                }
            }

            if (Absolute != null)
            {
                Absolute.MergeAbsolute(tag);
            }

            tag.MergeAttribute("id", HtmlId);
        }
示例#3
0
        internal virtual void MergeAttributes(TagBuilder tag, RenderContext context, MergeAttrMode mode = MergeAttrMode.All)
        {
            if (mode.HasFlag(MergeAttrMode.Visibility))
            {
                MergeBindingAttributeBool(tag, context, "v-if", nameof(If), If);
                MergeBindingAttributeBool(tag, context, "v-show", nameof(Show), Show);
                // emulate v-hide
                MergeBindingAttributeBool(tag, context, "v-show", nameof(Hide), Hide, bInvert: true);
            }
            if (mode.HasFlag(MergeAttrMode.Tip))
            {
                MergeBindingAttributeString(tag, context, "title", "Tip", Tip);
            }
            if (mode.HasFlag(MergeAttrMode.Wrap))
            {
                if (Wrap != WrapMode.Default)
                {
                    tag.AddCssClass(Wrap.ToString().ToKebabCase());
                }
            }
            if (mode.HasFlag(MergeAttrMode.Margin))
            {
                if (Margin != null)
                {
                    Margin.MergeStyles("margin", tag);
                }
                if (Padding != null)
                {
                    Padding.MergeStyles("padding", tag);
                }

                if (Absolute != null)
                {
                    Absolute.MergeAbsolute(tag);
                }
            }
        }