예제 #1
0
        private void addSizeClass()
        {
            string[] sizes  = { "xs", "sm", "md", "lg", "xl", "xxl" };
            var      fileds = typeof(AntColComponent).GetFields().ToList();

            foreach (var size in sizes)
            {
                AntColSize antColSize = new AntColSize();
                var        maybeXs    = fileds.Find(f => f.Name.Equals(size));

                if (maybeXs == null)
                {
                    continue;
                }

                var oneOfX = (OneOf <AntColSpanType, AntColSize>)maybeXs.GetValue(typeof(AntColComponent));

                oneOfX.Switch(cspan =>
                {
                    antColSize.span = cspan;
                }, csize =>
                {
                    antColSize = csize;
                });

                ClassNames
                .Add($"{prefixCls}-{size}-{antColSize.span}", () => antColSize.span.Value != null)
                .Add($"{prefixCls}-{size}-order-{antColSize.order}", () => antColSize.order.Value != null)
                .Add($"{prefixCls}-{size}-offset-{antColSize.offset}", () => antColSize.offset.Value != null)
                .Add($"{prefixCls}-{size}-push-{antColSize.push}", () => antColSize.push.Value != null)
                .Add($"{prefixCls}-{size}-pull-{antColSize.pull}", () => antColSize.pull.Value != null)
                ;
            }
        }
예제 #2
0
        private string getInputClassName()
        {
            ClassNames classNames = new ClassNames();

            classNames
            .Add(prefixCls)
            .Add($"{prefixCls}-sm", () => size.Equals("small"))
            .Add($"{prefixCls}-lg", () => size.Equals("large"))
            .Add($"{prefixCls}-disabled", () => disabled)
            ;

            return(classNames.Class);
        }
예제 #3
0
        public void setParams()
        {
            ClassNames.Clear()
            .Add($"{prefixCls}-item")
            .Add($"{prefixCls}-item-pending", () => pending);

            /// dot class
            var c = new ClassNames();

            c.Add($"{prefixCls}-item-head")
            .Add($"{prefixCls}-item-head-custom", () => Dot != null)
            .Add($"{prefixCls}-item-head-{color}")
            ;
            DotClassName = c.ToString();

            /// dot style
            Regex rx = new Regex(@"blue|red|green");

            DotStyle = rx.IsMatch(color) ? "" : $"border-color: {color};";
        }