Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
                }
            }
        }