-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathgridstack.scss
More file actions
259 lines (228 loc) · 8.98 KB
/
Copy pathgridstack.scss
File metadata and controls
259 lines (228 loc) · 8.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
/**
* gridstack SASS styles 13.1.2
* Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license
*/
$animation_speed: .3s !default;
.grid-stack {
position: relative;
}
.grid-stack-placeholder > .placeholder-content {
background-color: rgba(0,0,0,0.1);
margin: 0;
position: absolute;
width: auto;
z-index: 0 !important;
}
// make those more unique as to not conflict with side panel items
.grid-stack > .grid-stack-item {
position: absolute;
padding: 0;
top: 0; // some default to reduce at least first row inline styles
width: var(--gs-column-width); // reduce 1x1 items inline styles
height: var(--gs-cell-height);
> .grid-stack-item-content {
margin: 0;
position: absolute;
width: auto;
overflow-x: hidden;
overflow-y: auto;
}
&.size-to-content:not(.size-to-content-max) > .grid-stack-item-content {
overflow-y: hidden;
}
}
.grid-stack:not(.grid-stack-rtl) > .grid-stack-item {
left: 0; // some default to reduce at least first column inline styles
}
.grid-stack.grid-stack-rtl > .grid-stack-item {
right: 0; // some default to reduce at least first column inline styles
}
.grid-stack {
> .grid-stack-item > .grid-stack-item-content,
> .grid-stack-placeholder > .placeholder-content {
top: var(--gs-item-margin-top);
right: var(--gs-item-margin-right);
bottom: var(--gs-item-margin-bottom);
left: var(--gs-item-margin-left);
}
}
.grid-stack-item {
> .ui-resizable-handle {
position: absolute;
font-size: 0.1px;
display: block;
-ms-touch-action: none;
touch-action: none;
user-select: none;
z-index: 100;
}
&.ui-resizable-disabled > .ui-resizable-handle,
&.ui-resizable-autohide > .ui-resizable-handle { display: none; }
> .ui-resizable-ne,
> .ui-resizable-nw,
> .ui-resizable-se,
> .ui-resizable-sw {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');
background-repeat: no-repeat;
background-position: center;
// higher than the side handles
z-index: 101;
}
> .ui-resizable-ne {
transform: rotate(45deg);
}
> .ui-resizable-sw {
transform: rotate(45deg);
}
> .ui-resizable-nw {
transform: rotate(-45deg);
}
> .ui-resizable-se {
transform: rotate(-45deg);
}
> .ui-resizable-nw { cursor: nw-resize; width: 20px; height: 20px; top: var(--gs-item-margin-top); left: var(--gs-item-margin-left); }
> .ui-resizable-n { cursor: n-resize; height: 10px; top: var(--gs-item-margin-top); left: 25px; right: 25px; }
> .ui-resizable-ne { cursor: ne-resize; width: 20px; height: 20px; top: var(--gs-item-margin-top); right: var(--gs-item-margin-right); }
> .ui-resizable-e { cursor: e-resize; width: 10px; top: 15px; bottom: 15px; right: var(--gs-item-margin-right);}
> .ui-resizable-se { cursor: se-resize; width: 20px; height: 20px; bottom: var(--gs-item-margin-bottom); right: var(--gs-item-margin-right); }
> .ui-resizable-s { cursor: s-resize; height: 10px; left: 25px; bottom: var(--gs-item-margin-bottom); right: 25px; }
> .ui-resizable-sw { cursor: sw-resize; width: 20px; height: 20px; bottom: var(--gs-item-margin-bottom); left: var(--gs-item-margin-left); }
> .ui-resizable-w { cursor: w-resize; width: 10px; top: 15px; bottom: 15px; left: var(--gs-item-margin-left); }
&.ui-draggable-dragging {
&> .ui-resizable-handle {
display: none !important;
}
}
&.ui-draggable-dragging {
will-change: left, right, top;
}
&.ui-resizable-resizing {
will-change: width, height;
}
}
// not .grid-stack-item specific to also affect dragIn regions
.ui-draggable-dragging,
.ui-resizable-resizing {
z-index: 10000; // bootstrap modal has a z-index of 1050
> .grid-stack-item-content {
box-shadow: 1px 4px 6px rgba(0, 0, 0, 0.2);
opacity: 0.8;
}
}
.grid-stack-animate,
.grid-stack-animate .grid-stack-item {
transition: left $animation_speed, right $animation_speed, top $animation_speed, height $animation_speed, width $animation_speed;
}
.grid-stack-animate .grid-stack-item.ui-draggable-dragging,
.grid-stack-animate .grid-stack-item.ui-resizable-resizing,
.grid-stack-animate .grid-stack-item.grid-stack-placeholder{
transition: left 0s, right 0s, top 0s, height 0s, width 0s;
}
// make those more unique as to not conflict with side panel items, but apply to all column layouts (so not in loop below)
.grid-stack > .grid-stack-item[gs-y="0"] {
top: 0px;
}
.grid-stack:not(.grid-stack-rtl) > .grid-stack-item[gs-x="0"] {
left: 0%;
}
.grid-stack.grid-stack-rtl > .grid-stack-item[gs-x="0"] {
right: 0%;
}
@media print {
@page gs-landscape {
size: landscape;
}
@page gs-portrait {
size: portrait;
}
/* ========================================================================
DEFAULT PRINT MODE: Flow
Ignores exact Y/H coordinates and uses block/float flow.
Items auto-size their height and flow naturally across pages without slicing.
Drawback: Cannot force exact layout, page breaks/orientations may not work well.
======================================================================== */
.grid-stack:not(.gs-print-exact) {
display: block !important;
height: auto !important;
position: static !important;
}
.grid-stack:not(.gs-print-exact) > .grid-stack-item {
display: block !important;
float: left !important;
position: static !important;
height: auto !important; /* Let it grow with content */
left: auto !important;
top: auto !important;
/* Proportional width based on grid columns */
width: calc(100% * var(--gs-w) / var(--gs-columns, 12)) !important;
/* Prevent slicing items across pages */
break-inside: avoid !important;
page-break-inside: avoid !important;
}
.grid-stack:not(.gs-print-exact) > .grid-stack-item > .grid-stack-item-content {
position: relative !important; /* change from absolute to relative to dictate parent height */
height: auto !important;
overflow: visible !important;
white-space: normal !important;
/* Convert absolute positioning offsets to margins to keep the gaps */
margin-top: var(--gs-item-margin-top) !important;
margin-right: var(--gs-item-margin-right) !important;
margin-bottom: var(--gs-item-margin-bottom) !important;
margin-left: var(--gs-item-margin-left) !important;
top: auto !important;
right: auto !important;
bottom: auto !important;
left: auto !important;
}
/* ========================================================================
EXACT PRINT MODE: .gs-print-exact (CSS Grid)
Perfectly respects visual coordinates, dimensions, page breaks, and orientations.
Drawback: Chrome's print engine may slice tall items or push entire rows to the next page.
======================================================================== */
.grid-stack.gs-print-exact {
display: grid !important;
grid-template-columns: repeat(var(--gs-columns, 12), minmax(0, 1fr)) !important;
grid-auto-rows: var(--gs-cell-height) !important;
height: auto !important;
}
.grid-stack.gs-print-exact > .grid-stack-item {
position: relative !important;
float: none !important;
width: auto !important;
height: auto !important;
left: auto !important;
top: auto !important;
/* Apply GS coordinates natively via the injected CSS vars.
We deliberately DO NOT set grid-row-start so that the browser's
CSS Grid engine can natively auto-flow elements upwards, naturally
collapsing any empty rows caused by hidden elements! */
grid-column-start: calc(var(--gs-x) + 1) !important;
grid-column-end: span var(--gs-w) !important;
grid-row-end: span var(--gs-h) !important;
}
/* ========================================================================
SHARED PRINT STYLES
======================================================================== */
.grid-stack > .grid-stack-item[gs-page-break="true"] {
page-break-before: always !important;
break-before: page !important;
}
.gs-print-hide {
display: none !important;
}
.grid-stack > .grid-stack-item[gs-print-orientation="landscape"] {
page: gs-landscape;
/* Force item to take proper landscape width, overriding portrait grid track sizing.
vmax ensures we get the long edge of the paper regardless of default printer orientation */
min-width: calc(100vmax * var(--gs-w) / var(--gs-columns, 12)) !important;
}
.grid-stack > .grid-stack-item[gs-print-orientation="portrait"] {
page: gs-portrait;
/* vmin ensures we get the short edge of the paper */
min-width: calc(100vmin * var(--gs-w) / var(--gs-columns, 12)) !important;
}
/* Hide interactive elements during print */
.grid-stack > .grid-stack-item > .ui-resizable-handle {
display: none !important;
}
}