material.scss 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. /*
  2. This stylesheet uses scss valiables for most of the colors / background-colors of the table
  3. to enable the customization of the displayed table without cloning the stylesheet into the
  4. own application.
  5. To modify table colors, add the following lines to the scss file of your application
  6. (this example modifies the color of the selected row - selectionType = single, multi or multiClick):
  7. $ngx-datatable-selected-active-background: yellow;
  8. $ngx-datatable-selected-active-background-hover: rgba(yellow, 0.2);
  9. @import '~@swimlane/ngx-datatable/index.css';
  10. @import '~@swimlane/ngx-datatable/themes/material.scss';
  11. @import '~@swimlane/ngx-datatable/assets/icons.css';
  12. That's all.
  13. */
  14. // common datatable colors
  15. $ngx-datatable-background: #fff !default;
  16. $ngx-datatable-box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14),
  17. 0 3px 14px 2px rgba(0, 0, 0, 0.12) !default;
  18. $ngx-datatable-row-odd-background: #eee !default;
  19. // default row and cell background colors
  20. $ngx-datatable-default-background: #fff !default;
  21. $ngx-datatable-default-background-hover: #eee !default;
  22. $ngx-datatable-default-background-focus: #ddd !default;
  23. // default background colors for cell selection style
  24. $ngx-datatable-cellselection-background-hover: #eee !default;
  25. $ngx-datatable-cellselection-background-focus: #ddd !default;
  26. // background and text colors for selected cell / row
  27. $ngx-datatable-selected-active-background: #304ffe !default;
  28. $ngx-datatable-selected-active-color: #fff !default;
  29. $ngx-datatable-selected-active-background-hover: #193ae4 !default;
  30. $ngx-datatable-selected-active-color-hover: #fff !default;
  31. $ngx-datatable-selected-active-background-focus: #2041ef !default;
  32. $ngx-datatable-selected-active-color-focus: #fff !default;
  33. // colors for header elements
  34. $datatable-header-cell-background: #fff !default;
  35. $datatable-header-cell-color: rgba(0, 0, 0, 0.54) !default;
  36. $datatable-header-border-bottom-color: rgba(0, 0, 0, 0.12) !default;
  37. $datatable-header-resize-handle-color: #eee !default;
  38. // colors for table body elements
  39. $datatable-row-detail-background: #f5f5f5 !default;
  40. $datatable-body-cell-color: rgba(0, 0, 0, 0.87) !default;
  41. $datatable-group-header-background: #f5f5f5 !default;
  42. $datatable-group-header-border-top-color: #d9d8d9 !default;
  43. $datatable-group-header-border-bottom-color: #d9d8d9 !default;
  44. // colors for footer elements
  45. $datatable-footer-cell-color: rgba(0, 0, 0, 0.54) !default;
  46. $datatable-footer-border-top-color: rgba(0, 0, 0, 0.12) !default;
  47. $datatable-pager-color: rgba(0, 0, 0, 0.54) !default;
  48. $datatable-pager-color-hover: rgba(0, 0, 0, 0.75) !default;
  49. $datatable-pager-background-hover: rgba(158, 158, 158, 0.2) !default;
  50. $datatable-pager-disabled-color: rgba(0, 0, 0, 0.26) !default;
  51. $datatable-pager-disabled-background: transparent !default;
  52. $datatable-pager-active-background: rgba(158, 158, 158, 0.2) !default;
  53. // colors for summary row elements
  54. $datatable-summary-row-background: #ddd !default;
  55. $datatable-summary-row-background-hover: #ddd !default;
  56. .ngx-datatable.material {
  57. background: $ngx-datatable-background;
  58. box-shadow: $ngx-datatable-box-shadow;
  59. &.striped {
  60. .datatable-row-odd {
  61. background: $ngx-datatable-row-odd-background;
  62. }
  63. }
  64. &.single-selection,
  65. &.multi-selection,
  66. &.multi-click-selection {
  67. .datatable-body-row {
  68. &.active,
  69. &.active .datatable-row-group {
  70. background-color: $ngx-datatable-selected-active-background;
  71. color: $ngx-datatable-selected-active-color;
  72. }
  73. &.active:hover,
  74. &.active:hover .datatable-row-group {
  75. background-color: $ngx-datatable-selected-active-background-hover;
  76. color: $ngx-datatable-selected-active-color-hover;
  77. }
  78. &.active:focus,
  79. &.active:focus .datatable-row-group {
  80. background-color: $ngx-datatable-selected-active-background-focus;
  81. color: $ngx-datatable-selected-active-color-focus;
  82. }
  83. }
  84. }
  85. &:not(.cell-selection) {
  86. .datatable-body-row {
  87. &:hover,
  88. &:hover .datatable-row-group {
  89. background-color: $ngx-datatable-default-background-hover;
  90. transition-property: background;
  91. transition-duration: 0.3s;
  92. transition-timing-function: linear;
  93. }
  94. &:focus,
  95. &:focus .datatable-row-group {
  96. background-color: $ngx-datatable-default-background-focus;
  97. }
  98. }
  99. }
  100. &.cell-selection {
  101. .datatable-body-cell {
  102. &:hover,
  103. &:hover .datatable-row-group {
  104. background-color: $ngx-datatable-cellselection-background-hover;
  105. transition-property: background;
  106. transition-duration: 0.3s;
  107. transition-timing-function: linear;
  108. }
  109. &:focus,
  110. &:focus .datatable-row-group {
  111. background-color: $ngx-datatable-cellselection-background-focus;
  112. }
  113. &.active,
  114. &.active .datatable-row-group {
  115. background-color: $ngx-datatable-selected-active-background;
  116. color: $ngx-datatable-selected-active-color;
  117. }
  118. &.active:hover,
  119. &.active:hover .datatable-row-group {
  120. background-color: $ngx-datatable-selected-active-background-hover;
  121. color: $ngx-datatable-selected-active-color-hover;
  122. }
  123. &.active:focus,
  124. &.active:focus .datatable-row-group {
  125. background-color: $ngx-datatable-selected-active-background-focus;
  126. color: $ngx-datatable-selected-active-color-focus;
  127. }
  128. }
  129. }
  130. /**
  131. * Shared Styles
  132. */
  133. .empty-row {
  134. height: 50px;
  135. text-align: left;
  136. padding: 0.5rem 1.2rem;
  137. vertical-align: top;
  138. border-top: 0;
  139. }
  140. .loading-row {
  141. text-align: left;
  142. padding: 0.5rem 1.2rem;
  143. vertical-align: top;
  144. border-top: 0;
  145. }
  146. /**
  147. * Global Row Styles
  148. */
  149. .datatable-header,
  150. .datatable-body {
  151. .datatable-row-left {
  152. background-color: $ngx-datatable-background;
  153. background-position: 100% 0;
  154. background-repeat: repeat-y;
  155. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAYAAAD5PA/NAAAAFklEQVQIHWPSkNeSBmJhTQVtbiDNCgASagIIuJX8OgAAAABJRU5ErkJggg==);
  156. }
  157. .datatable-row-right {
  158. background-position: 0 0;
  159. background-color: $ngx-datatable-background;
  160. background-repeat: repeat-y;
  161. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAYAAAD5PA/NAAAAFklEQVQI12PQkNdi1VTQ5gbSwkAsDQARLAIGtOSFUAAAAABJRU5ErkJggg==);
  162. }
  163. }
  164. /**
  165. * Header Styles
  166. */
  167. .datatable-header {
  168. border-bottom: 1px solid $datatable-header-border-bottom-color;
  169. .datatable-header-cell {
  170. text-align: left;
  171. padding: 0.9rem 1.2rem;
  172. font-weight: 400;
  173. background-color: $datatable-header-cell-background;
  174. color: $datatable-header-cell-color;
  175. vertical-align: bottom;
  176. font-size: 12px;
  177. font-weight: 500;
  178. .datatable-header-cell-wrapper {
  179. position: relative;
  180. }
  181. &.longpress {
  182. .draggable::after {
  183. transition: transform 400ms ease, opacity 400ms ease;
  184. opacity: 0.5;
  185. transform: scale(1);
  186. }
  187. }
  188. .draggable::after {
  189. content: ' ';
  190. position: absolute;
  191. top: 50%;
  192. left: 50%;
  193. margin: -30px 0 0 -30px;
  194. height: 60px;
  195. width: 60px;
  196. background: #eee;
  197. border-radius: 100%;
  198. opacity: 1;
  199. filter: none;
  200. transform: scale(0);
  201. z-index: 9999;
  202. pointer-events: none;
  203. }
  204. &.dragging {
  205. .resize-handle {
  206. border-right: none;
  207. }
  208. }
  209. }
  210. .resize-handle {
  211. border-right: solid 1px $datatable-header-resize-handle-color;
  212. }
  213. }
  214. /**
  215. * Body Styles
  216. */
  217. .datatable-body {
  218. .datatable-row-detail {
  219. background: $datatable-row-detail-background;
  220. padding: 10px;
  221. }
  222. .datatable-group-header {
  223. background: $datatable-group-header-background;
  224. border-bottom: solid 1px $datatable-group-header-border-bottom-color;
  225. border-top: solid 1px $datatable-group-header-border-top-color;
  226. }
  227. .datatable-body-row {
  228. .datatable-body-cell {
  229. text-align: left;
  230. padding: 0.9rem 1.2rem;
  231. vertical-align: top;
  232. border-top: 0;
  233. color: $datatable-body-cell-color;
  234. transition: width 0.3s ease;
  235. font-size: 14px;
  236. font-weight: 400;
  237. // cell active class
  238. // &.active {
  239. // background: #0829e0
  240. // }
  241. }
  242. .datatable-body-group-cell {
  243. text-align: left;
  244. padding: 0.9rem 1.2rem;
  245. vertical-align: top;
  246. border-top: 0;
  247. color: $datatable-body-cell-color;
  248. transition: width 0.3s ease;
  249. font-size: 14px;
  250. font-weight: 400;
  251. }
  252. }
  253. .progress-linear {
  254. display: block;
  255. position: relative;
  256. width: 100%;
  257. height: 5px;
  258. padding: 0;
  259. margin: 0;
  260. position: absolute;
  261. .container {
  262. display: block;
  263. position: relative;
  264. overflow: hidden;
  265. width: 100%;
  266. height: 5px;
  267. -webkit-transform: translate(0, 0) scale(1, 1);
  268. transform: translate(0, 0) scale(1, 1);
  269. background-color: rgb(170, 209, 249);
  270. .bar {
  271. transition: all 0.2s linear;
  272. -webkit-animation: query 0.8s infinite cubic-bezier(0.39, 0.575, 0.565, 1);
  273. animation: query 0.8s infinite cubic-bezier(0.39, 0.575, 0.565, 1);
  274. transition: -webkit-transform 0.2s linear;
  275. transition: transform 0.2s linear;
  276. background-color: rgb(16, 108, 200);
  277. position: absolute;
  278. left: 0;
  279. top: 0;
  280. bottom: 0;
  281. width: 100%;
  282. height: 5px;
  283. }
  284. }
  285. }
  286. }
  287. /**
  288. * Footer Styles
  289. */
  290. .datatable-footer {
  291. border-top: 1px solid $datatable-footer-border-top-color;
  292. font-size: 12px;
  293. font-weight: 400;
  294. color: $datatable-footer-cell-color;
  295. .page-count {
  296. line-height: 50px;
  297. height: 50px;
  298. padding: 0 1.2rem;
  299. }
  300. .datatable-pager {
  301. margin: 0 10px;
  302. li {
  303. vertical-align: middle;
  304. &.disabled a {
  305. color: $datatable-pager-disabled-color !important;
  306. background-color: $datatable-pager-disabled-background !important;
  307. }
  308. &.active a {
  309. background-color: $datatable-pager-active-background;
  310. font-weight: bold;
  311. }
  312. }
  313. a {
  314. height: 22px;
  315. min-width: 24px;
  316. line-height: 22px;
  317. padding: 0 6px;
  318. border-radius: 3px;
  319. margin: 6px 3px;
  320. text-align: center;
  321. vertical-align: top;
  322. color: $datatable-pager-color;
  323. text-decoration: none;
  324. vertical-align: bottom;
  325. &:hover {
  326. color: $datatable-pager-color-hover;
  327. background-color: $datatable-pager-background-hover;
  328. }
  329. }
  330. .datatable-icon-left,
  331. .datatable-icon-skip,
  332. .datatable-icon-right,
  333. .datatable-icon-prev {
  334. font-size: 20px;
  335. line-height: 20px;
  336. padding: 0 3px;
  337. }
  338. }
  339. }
  340. // Summary row styles
  341. .datatable-summary-row {
  342. .datatable-body-row {
  343. background-color: $datatable-summary-row-background;
  344. &:hover {
  345. background-color: $datatable-summary-row-background-hover;
  346. }
  347. .datatable-body-cell {
  348. font-weight: bold;
  349. }
  350. }
  351. }
  352. }
  353. /**
  354. * Checkboxes
  355. **/
  356. .datatable-checkbox {
  357. position: relative;
  358. margin: 0;
  359. cursor: pointer;
  360. vertical-align: middle;
  361. display: inline-block;
  362. box-sizing: border-box;
  363. padding: 0;
  364. input[type='checkbox'] {
  365. position: relative;
  366. margin: 0 1rem 0 0;
  367. cursor: pointer;
  368. outline: none;
  369. &:before {
  370. -webkit-transition: all 0.3s ease-in-out;
  371. -moz-transition: all 0.3s ease-in-out;
  372. transition: all 0.3s ease-in-out;
  373. content: '';
  374. position: absolute;
  375. left: 0;
  376. z-index: 1;
  377. width: 1rem;
  378. height: 1rem;
  379. border: 2px solid #f2f2f2;
  380. }
  381. &:checked:before {
  382. -webkit-transform: rotate(-45deg);
  383. -moz-transform: rotate(-45deg);
  384. -ms-transform: rotate(-45deg);
  385. transform: rotate(-45deg);
  386. height: 0.5rem;
  387. border-color: #009688;
  388. border-top-style: none;
  389. border-right-style: none;
  390. }
  391. &:after {
  392. content: '';
  393. position: absolute;
  394. top: 0;
  395. left: 0;
  396. width: 1rem;
  397. height: 1rem;
  398. background: #fff;
  399. cursor: pointer;
  400. }
  401. }
  402. }
  403. /**
  404. * Progress bar animations
  405. */
  406. @keyframes query {
  407. 0% {
  408. opacity: 1;
  409. transform: translateX(35%) scale(0.3, 1);
  410. }
  411. 100% {
  412. opacity: 0;
  413. transform: translateX(-50%) scale(0, 1);
  414. }
  415. }