nya-bs-select.less 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. @width-default: 220px;
  2. @color-red-error: rgb(185, 74, 72);
  3. @color-blue-hover: rgb(100, 177, 216);
  4. @color-grey-arrow: rgb(204, 204, 204);
  5. @zindex-select-dropdown: 1035; // must be lower than a modal background (1040) but higher than the fixed navbar (1030)
  6. .cursor-disabled() {
  7. cursor: not-allowed;
  8. }
  9. .nya-bs-select {
  10. /*width: 220px\9; IE8 and below*/
  11. //noinspection CssShorthandPropertyValue
  12. width: 220px \0; /*IE9 and below*/
  13. padding: 0;
  14. margin: 0;
  15. &:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
  16. width: @width-default;
  17. }
  18. &.form-control {
  19. margin-bottom: 0;
  20. padding: 0;
  21. border: none;
  22. &:not([class*="col-"]) {
  23. width: 100%;
  24. }
  25. }
  26. & > .btn {
  27. width: 100%;
  28. padding-right: 25px;
  29. .filter-option {
  30. display: inline-block;
  31. overflow: hidden;
  32. width: 100%;
  33. text-align: left;
  34. }
  35. .caret {
  36. position: absolute;
  37. top: 50%;
  38. right: 12px;
  39. margin-top: -2px;
  40. vertical-align: middle;
  41. }
  42. }
  43. &.fit-width {
  44. width: auto !important;
  45. }
  46. &.btn-group {
  47. &:not(.input-group-btn),
  48. &[class*="col-"] {
  49. float: none;
  50. display: inline-block;
  51. margin-left: 0;
  52. }
  53. &,
  54. &[class*="col-"],
  55. .row-fluid &[class*="col-"] {
  56. &.dropdown-menu-right {
  57. float: right;
  58. }
  59. }
  60. &[class*="col-"] .btn {
  61. width: 100%;
  62. }
  63. .dropdown-menu {
  64. min-width: 100%;
  65. z-index: @zindex-select-dropdown;
  66. box-sizing: border-box;
  67. &.inner {
  68. position: static;
  69. border: 0;
  70. padding: 0;
  71. margin: 0;
  72. border-radius: 0;
  73. box-shadow: none;
  74. }
  75. li {
  76. position: relative;
  77. &.disabled a {
  78. .cursor-disabled();
  79. }
  80. &.not-match {
  81. display: none;
  82. }
  83. &.no-search-result {
  84. display: none;
  85. padding: 3px;
  86. background: #f5f5f5;
  87. margin: 0 5px;
  88. &.show {
  89. display: list-item;
  90. }
  91. }
  92. &.group-item a {
  93. padding-left: 2.25em;
  94. }
  95. a {
  96. cursor: pointer;
  97. span.check-mark {
  98. display: none;
  99. }
  100. span.text {
  101. display: inline-block;
  102. }
  103. }
  104. small {
  105. padding-left: 0.5em;
  106. }
  107. &.selected a .check-mark {
  108. position: absolute;
  109. display: inline-block;
  110. right: 15px;
  111. margin-top: 5px;
  112. }
  113. a span.text {
  114. margin-right: 34px;
  115. }
  116. .dropdown-header {
  117. display: none;
  118. }
  119. &.first-in-group {
  120. margin-top: 1.75em;
  121. .dropdown-header {
  122. display: block;
  123. position: absolute;
  124. top: -1.75em;
  125. left: 0;
  126. }
  127. }
  128. }
  129. }
  130. }
  131. &.show-menu-arrow {
  132. &.open > .btn {
  133. z-index:@zindex-select-dropdown + 1;
  134. }
  135. .dropdown-toggle {
  136. &:before {
  137. content: " ";
  138. border-left: 7px solid transparent;
  139. border-right: 7px solid transparent;
  140. border-bottom-width: 7px;
  141. border-bottom-style: solid;
  142. border-bottom-color: fade(@color-grey-arrow, 20%);
  143. position: absolute;
  144. bottom: -4px;
  145. left: 9px;
  146. display: none;
  147. }
  148. &:after {
  149. content: '';
  150. border-left: 6px solid transparent;
  151. border-right: 6px solid transparent;
  152. border-bottom: 6px solid white;
  153. position: absolute;
  154. bottom: -4px;
  155. left: 10px;
  156. display: none;
  157. }
  158. }
  159. &.dropup .dropdown-toggle {
  160. &:before {
  161. bottom: auto;
  162. top: -3px;
  163. border-bottom: 0;
  164. border-top-width: 7px;
  165. border-top-style: solid;
  166. border-top-color: fade(@color-grey-arrow, 20%);
  167. }
  168. &:after {
  169. bottom: auto;
  170. top: -3px;
  171. border-top: 6px solid white;
  172. border-bottom: 0;
  173. }
  174. }
  175. &.pull-right .dropdown-toggle {
  176. &:before {
  177. right: 12px;
  178. left: auto;
  179. }
  180. &:after {
  181. right: 13px;
  182. left: auto;
  183. }
  184. }
  185. &.open > .dropdown-toggle {
  186. &:before,
  187. &:after {
  188. display: block;
  189. }
  190. }
  191. }
  192. .bs-searchbox {
  193. padding: 4px 8px;
  194. & input.form-control {
  195. margin-bottom: 0;
  196. width: 100%;
  197. float: none;
  198. z-index: inherit;
  199. display: block;
  200. position: static;
  201. border-radius: 4px;
  202. }
  203. }
  204. &.fit-width .btn {
  205. .filter-option {
  206. position: static;
  207. }
  208. .caret {
  209. position: static;
  210. top: auto;
  211. margin-top: -1px;
  212. }
  213. }
  214. &.on-modal {
  215. .dropdown-menu {
  216. z-index: @zindex-select-dropdown + 5;
  217. }
  218. &.open > .btn {
  219. z-index:@zindex-select-dropdown + 6;
  220. }
  221. }
  222. }