|
| 1 | +/** |
| 2 | + * Create vendor-prefixed CSS in one go, e.g. |
| 3 | + * |
| 4 | + `@include vendor(border-radius, 4px);` |
| 5 | + * |
| 6 | + */ |
| 7 | +@mixin vendor($property, $value...){ |
| 8 | + -webkit-#{$property}:$value; |
| 9 | + -moz-#{$property}:$value; |
| 10 | + -ms-#{$property}:$value; |
| 11 | + -o-#{$property}:$value; |
| 12 | + #{$property}:$value; |
| 13 | +} |
| 14 | + |
| 15 | +:root .grid-stack-item > .ui-resizable-handle { filter: none; } |
| 16 | + |
| 17 | +.grid-stack { |
| 18 | + position: relative; |
| 19 | + |
| 20 | + .grid-stack-item { |
| 21 | + min-width: 8.33333333%; |
| 22 | + position: absolute; |
| 23 | + padding: 0; |
| 24 | + |
| 25 | + > .grid-stack-item-content, |
| 26 | + > .placeholder-content { |
| 27 | + margin: 0; |
| 28 | + position: absolute; |
| 29 | + top: 0; |
| 30 | + left: 10px; |
| 31 | + right: 10px; |
| 32 | + bottom: 0; |
| 33 | + width: auto; |
| 34 | + z-index: 0 !important; |
| 35 | + overflow: auto; |
| 36 | + } |
| 37 | + |
| 38 | + > .ui-resizable-handle { |
| 39 | + position: absolute; |
| 40 | + font-size: 0.1px; |
| 41 | + display: block; |
| 42 | + -ms-touch-action: none; |
| 43 | + touch-action: none; |
| 44 | + } |
| 45 | + |
| 46 | + &.ui-resizable-disabled > .ui-resizable-handle, |
| 47 | + &.ui-resizable-autohide > .ui-resizable-handle { display: none; } |
| 48 | + |
| 49 | + &.ui-draggable-dragging, |
| 50 | + &.ui-resizable-resizing { |
| 51 | + z-index: 100; |
| 52 | + |
| 53 | + > .grid-stack-item-content, |
| 54 | + > .grid-stack-item-content { |
| 55 | + box-shadow: 1px 4px 6px rgba(0, 0, 0, 0.2); |
| 56 | + opacity: 0.8; |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + > .ui-resizable-se, |
| 61 | + > .ui-resizable-sw { |
| 62 | + text-align: right; |
| 63 | + color: gray; |
| 64 | + |
| 65 | + padding: 2px 3px 0 0; |
| 66 | + margin: 0; |
| 67 | + |
| 68 | + font: normal normal normal 10px/1 FontAwesome; |
| 69 | + font-size: inherit; |
| 70 | + text-rendering: auto; |
| 71 | + -webkit-font-smoothing: antialiased; |
| 72 | + -moz-osx-font-smoothing: grayscale; |
| 73 | + |
| 74 | + &::before { content: "\f065"; } |
| 75 | + } |
| 76 | + |
| 77 | + > .ui-resizable-se { |
| 78 | + display: inline-block; |
| 79 | + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); |
| 80 | + @include vendor(transform, rotate(90deg)); |
| 81 | + } |
| 82 | + |
| 83 | + /** Uncomment this to show bottom-left resize handle **/ |
| 84 | + /* |
| 85 | + > .ui-resizable-sw { |
| 86 | + display: inline-block; |
| 87 | + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); |
| 88 | + @include vendor(transform, rotate(180deg)); |
| 89 | + } |
| 90 | + */ |
| 91 | + |
| 92 | + > .ui-resizable-nw { cursor: nw-resize; width: 20px; height: 20px; left: 10px; top: 0; } |
| 93 | + > .ui-resizable-n { cursor: n-resize; height: 10px; top: 0; left: 25px; right: 25px; } |
| 94 | + > .ui-resizable-ne { cursor: ne-resize; width: 20px; height: 20px; right: 10px; top: 0; } |
| 95 | + > .ui-resizable-e { cursor: e-resize; width: 10px; right: 10px; top: 15px; bottom: 15px; } |
| 96 | + > .ui-resizable-se { cursor: se-resize; width: 20px; height: 20px; right: 10px; bottom: 0; } |
| 97 | + > .ui-resizable-s { cursor: s-resize; height: 10px; left: 25px; bottom: 0; right: 25px; } |
| 98 | + > .ui-resizable-sw { cursor: sw-resize; width: 20px; height: 20px; left: 10px; bottom: 0; } |
| 99 | + > .ui-resizable-w { cursor: w-resize; width: 10px; left: 10px; top: 15px; bottom: 15px; } |
| 100 | + |
| 101 | + /** |
| 102 | + * Update grid by changing $gridstack-columns only |
| 103 | + */ |
| 104 | + $gridstack-columns: 12; |
| 105 | + |
| 106 | + @for $i from 1 through $gridstack-columns { |
| 107 | + &[data-gs-width='#{$i}'] { width: (100% / $gridstack-columns) * $i; } |
| 108 | + &[data-gs-x='#{$i}'] { left: (100% / $gridstack-columns) * $i; } |
| 109 | + &[data-gs-min-width='#{$i}'] { min-width: (100% / $gridstack-columns) * $i; } |
| 110 | + &[data-gs-max-width='#{$i}'] { max-width: (100% / $gridstack-columns) * $i; } |
| 111 | + } |
| 112 | + } |
| 113 | + |
| 114 | + &.grid-stack-animate, |
| 115 | + &.grid-stack-animate .grid-stack-item { |
| 116 | + @include vendor(transition, 'left .3s, top .3s, height .3s, width .3s'); |
| 117 | + } |
| 118 | + |
| 119 | + /*Don't animate the placeholder or when dragging/resizing*/ |
| 120 | + &.grid-stack-animate .grid-stack-item.ui-draggable-dragging, |
| 121 | + &.grid-stack-animate .grid-stack-item.ui-resizable-resizing, |
| 122 | + &.grid-stack-animate .grid-stack-item.grid-stack-placeholder{ |
| 123 | + @include vendor(transition, 'left .0s, top .0s, height .0s, width .0s'); |
| 124 | + } |
| 125 | +} |
| 126 | + |
| 127 | + |
| 128 | +@media (max-width: 768px) { |
| 129 | + .grid-stack-item { |
| 130 | + position: relative !important; |
| 131 | + width: auto !important; |
| 132 | + left: 0 !important; |
| 133 | + top: auto !important; |
| 134 | + margin-bottom: 20px; |
| 135 | + |
| 136 | + .ui-resizable-handle { display: none; } |
| 137 | + } |
| 138 | + |
| 139 | + .grid-stack { height: auto !important; } |
| 140 | +} |
0 commit comments