Esempio n. 1
0
        public static void MoveToOrderValue(IEnumerable <IObjectWithOrderValue> list, IObjectWithOrderValue obj, int newOrderValue)
        {
            if (newOrderValue <= 0)
            {
                newOrderValue = 1;
            }
            DropDirection dropDirection = obj.order > newOrderValue ? DropDirection.upwards : (obj.order < newOrderValue ? DropDirection.downwards : DropDirection.atpos);

            switch (dropDirection)
            {
            case DropDirection.downwards:
                foreach (var a in list.Where(a => a.order > obj.order && a.order <= newOrderValue).ToList())
                {
                    a.order = a.order - 1;
                }
                break;

            case DropDirection.atpos:
            case DropDirection.upwards:
                foreach (var a in list.Where(a => a.order >= newOrderValue && a.order < obj.order).ToList())
                {
                    a.order = a.order + 1;
                }
                break;
            }
            obj.order = newOrderValue;
        }
 private string GetDropCss()
 {
     return(CssBuild.New.Add("dropdown", !EnableDefaultMenuFlag)
            .Add("btn-group", EnableDefaultMenuFlag)
            .Add(DropDirection.ToDescriptionString())
            .Add("show", IsOpen)
            .Add(StyleClass)
            .Build()
            .CssString);
 }
Esempio n. 3
0
 /// <summary>
 /// 创建组件所需要的 class 类。
 /// </summary>
 /// <param name="collection">css 类名称集合。</param>
 protected override void CreateComponentCssClass(ICollection <string> collection)
 {
     if (DropDirection != Direction.Down)
     {
         collection.Add($"drop{DropDirection.ToString().ToLower()}");
     }
     if (IsActived)
     {
         collection.Add("show");
     }
 }