You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_tree.scss 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. /**
  2. *
  3. * @group tree
  4. */
  5. $v-tree-row-height: round($v-unit-size/1.3) !default;
  6. /**
  7. *
  8. * @group tree
  9. */
  10. $v-tree-animations-enabled: true !default;
  11. /**
  12. *
  13. * @group tree
  14. */
  15. $v-tree-expand-animation-enabled: false !default;
  16. @if $v-tree-expand-animation-enabled {
  17. @include keyframes(valo-tree-node-open) {
  18. 0% {
  19. max-height: 0;
  20. }
  21. 100% {
  22. max-height: $v-tree-row-height * 10;
  23. }
  24. }
  25. @include keyframes(valo-tree-node-close) {
  26. 0% {
  27. max-height: $v-tree-row-height * 10;
  28. }
  29. 100% {
  30. max-height: 0;
  31. }
  32. }
  33. }
  34. /**
  35. *
  36. *
  37. * @param {string} $primary-stylename (v-tree) -
  38. *
  39. * @group tree
  40. */
  41. @mixin valo-tree ($primary-stylename: v-tree) {
  42. .#{$primary-stylename} {
  43. position: relative;
  44. white-space: nowrap;
  45. &:focus {
  46. outline: none;
  47. }
  48. }
  49. .#{$primary-stylename}-node {
  50. &:before {
  51. content: "";
  52. position: absolute;
  53. display: inline-block;
  54. z-index: 3;
  55. width: 1.9em;
  56. height: $v-tree-row-height;
  57. cursor: pointer;
  58. // IE 9/10 need some color so that this element can receive mouse events.
  59. // 'red' just happens to be the shortest color name.
  60. background: red;
  61. opacity: 0;
  62. .v-ie8 & {
  63. position: static;
  64. margin-left: -1.9em;
  65. vertical-align: top;
  66. @include valo-tree-collapsed-icon-style;
  67. text-align: center;
  68. background: transparent;
  69. }
  70. }
  71. .v-ie8 & {
  72. padding-left: 1.9em;
  73. }
  74. }
  75. .#{$primary-stylename}-node-caption {
  76. height: $v-tree-row-height;
  77. line-height: $v-tree-row-height - 1px;
  78. overflow: hidden;
  79. white-space: nowrap;
  80. // Mainly to satisty IE8 (doesn't harm other browsers)
  81. vertical-align: top;
  82. & > div {
  83. display: inline-block;
  84. width: 100%;
  85. position: relative;
  86. z-index: 2;
  87. &:before {
  88. @include valo-tree-collapsed-icon-style;
  89. display: inline-block;
  90. width: .5em;
  91. text-align: center;
  92. margin: 0 .6em 0 .8em;
  93. @if $v-tree-animations-enabled {
  94. @include transition(all 100ms);
  95. }
  96. .v-ie8 & {
  97. display: none;
  98. }
  99. }
  100. }
  101. span {
  102. padding-right: $v-tree-row-height;
  103. cursor: pointer;
  104. display: inline-block;
  105. // Allow to click on the whole row (almost, at least the right side part)
  106. width: 100%;
  107. // IE does strange things when the width is wider than the parent
  108. .v-ie & {
  109. width: auto;
  110. }
  111. }
  112. .v-icon {
  113. padding-right: 0;
  114. width: auto;
  115. min-width: 1em;
  116. }
  117. &:after {
  118. content: "";
  119. display: block;
  120. vertical-align: top;
  121. position: absolute;
  122. z-index: 1;
  123. left: 0;
  124. margin-top: -$v-tree-row-height;
  125. width: 100%;
  126. height: $v-tree-row-height;
  127. border-radius: $v-border-radius;
  128. opacity: 0;
  129. @if $v-tree-animations-enabled {
  130. @include transition(opacity 120ms);
  131. }
  132. .v-ie8 & {
  133. content: none;
  134. }
  135. }
  136. .v-ie8 & {
  137. display: inline-block;
  138. }
  139. }
  140. .#{$primary-stylename}-node-expanded > .#{$primary-stylename}-node-caption > div:before {
  141. @include valo-tree-expanded-icon-style;
  142. @if $v-tree-animations-enabled {
  143. @include transform(rotate(90deg));
  144. @include valo-tree-collapsed-icon-style;
  145. }
  146. }
  147. .v-ie8 & .#{$primary-stylename}-node-expanded:before {
  148. @include valo-tree-expanded-icon-style(true);
  149. }
  150. .#{$primary-stylename}-node-leaf:before,
  151. .#{$primary-stylename}-node-leaf > .#{$primary-stylename}-node-caption > div:before {
  152. visibility: hidden;
  153. }
  154. .#{$primary-stylename}-node-focused {
  155. // This a v-tree-node-caption element
  156. &:after {
  157. opacity: 1;
  158. border: 1px solid $v-focus-color;
  159. }
  160. .v-ie8 & {
  161. outline: 1px dotted $v-focus-color;
  162. }
  163. }
  164. .#{$primary-stylename}-node-selected {
  165. $font-color: valo-font-color($v-selection-color, 0.9);
  166. color: $font-color;
  167. text-shadow: valo-text-shadow($font-color: $font-color, $background-color: $v-selection-item-selection-color);
  168. &:after {
  169. opacity: 1;
  170. @include valo-gradient($v-selection-color);
  171. border: none;
  172. .v-ie8 & {
  173. //visibility: visible;
  174. }
  175. }
  176. .v-ie8 & {
  177. @include valo-gradient($v-selection-color);
  178. }
  179. }
  180. .#{$primary-stylename}-node-children {
  181. padding-left: round($v-unit-size/2);
  182. .v-ie8 & {
  183. padding-left: 0;
  184. }
  185. }
  186. @if $v-tree-expand-animation-enabled {
  187. .#{$primary-stylename}-node-children[style*="display: none"] {
  188. @include animation(valo-tree-node-close 400ms ease-out forwards);
  189. display: block !important;
  190. }
  191. .#{$primary-stylename}-node-expanded > .#{$primary-stylename}-node-children {
  192. @include animation(valo-tree-node-open 400ms ease-in);
  193. }
  194. }
  195. // Drag'n'drop styles
  196. .#{$primary-stylename}-node-drag-top:before,
  197. .#{$primary-stylename}-node-drag-bottom:after,
  198. .#{$primary-stylename}-node-drag-bottom.#{$primary-stylename}-node-dragfolder.#{$primary-stylename}-node-expanded > .#{$primary-stylename}-node-children:before {
  199. content: "\2022";
  200. display: block;
  201. position: absolute;
  202. height: 2px;
  203. width: 100%;
  204. background: $v-focus-color;
  205. font-size: $v-font-size * 2;
  206. line-height: 2px;
  207. color: $v-focus-color;
  208. text-indent: round($v-font-size/-4);
  209. text-shadow: 0 0 1px $v-background-color, 0 0 1px $v-background-color;
  210. opacity: 1;
  211. visibility: visible;
  212. }
  213. .#{$primary-stylename}-node-drag-bottom.#{$primary-stylename}-node-dragfolder.#{$primary-stylename}-node-expanded:after {
  214. content: none;
  215. }
  216. .#{$primary-stylename}-node-caption-drag-center {
  217. @include box-shadow(0 0 0 2px $v-focus-color);
  218. position: relative;
  219. border-radius: $v-border-radius;
  220. .v-ie8 & {
  221. outline: 2px solid $v-focus-color;
  222. }
  223. }
  224. .v-ff & .#{$primary-stylename}-node-drag-top:before,
  225. .v-ff & .#{$primary-stylename}-node-drag-bottom:after {
  226. line-height: 1px;
  227. }
  228. .v-ie8 & .#{$primary-stylename}-node-drag-top:before,
  229. .v-ie8 & .#{$primary-stylename}-node-drag-bottom:after {
  230. line-height: 0;
  231. }
  232. }
  233. /**
  234. *
  235. *
  236. *
  237. * @group tree
  238. */
  239. @mixin valo-tree-collapsed-icon-style {
  240. content: "\f0da";
  241. font-family: ThemeIcons;
  242. }
  243. /**
  244. *
  245. *
  246. * @param {bool} $force (false) -
  247. *
  248. * @group tree
  249. */
  250. @mixin valo-tree-expanded-icon-style ($force: false) {
  251. @if $v-tree-animations-enabled == false or $force {
  252. content: "\f0d7";
  253. font-family: ThemeIcons;
  254. }
  255. }