yummy-guide-generic-administrate 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b442ee0d24ba8d34271193cdbc8c2da175d5b91b3a2b847706ce5f5c316eff66
|
|
4
|
+
data.tar.gz: cc6d60ef4a0b80f2561638de33ce7abef3908ba1064c77c2c94e628d47dec970
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad2200cef92ab686ffb9fabee36c87672ff48dc1a507406995057effa3afff4bad625eb7fbaad8011ddf4ffa8eb93b5b95af2455436f131fabbdc18a8ff55873
|
|
7
|
+
data.tar.gz: 2502a4c2723a4d8fc25ca7d1ba5fd10aff5a2002dbfff58f5c698d042b21e21ebd0597c863463ec1b086934b3450e56088e718d5fddae8a8b1a861bd02bf08c5
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
var TABLE_SELECTOR =
|
|
3
|
-
var WRAPPER_SELECTOR =
|
|
2
|
+
var TABLE_SELECTOR = 'table[data-fixed-columns-count]';
|
|
3
|
+
var WRAPPER_SELECTOR = '[data-fixed-header-scroll], .scroll-table, .home-table__wrapper, .table-wrap, .af__table__content';
|
|
4
4
|
var resizeObservers = new WeakMap();
|
|
5
5
|
var observedScrolls = new WeakMap();
|
|
6
6
|
var scrollSyncStates = new WeakMap();
|
|
7
7
|
|
|
8
8
|
function directCells(row) {
|
|
9
9
|
return Array.from(row.children).filter(function(cell) {
|
|
10
|
-
return cell.tagName ===
|
|
10
|
+
return cell.tagName === 'TH' || cell.tagName === 'TD';
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function cssPixelValue(value) {
|
|
19
|
-
return preciseNumber(value) +
|
|
19
|
+
return preciseNumber(value) + 'px';
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function measuredWidth(element) {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function fixedColumnsCount(table) {
|
|
38
|
-
var parsedCount = parseInt(table.dataset.fixedColumnsCount ||
|
|
38
|
+
var parsedCount = parseInt(table.dataset.fixedColumnsCount || '0', 10);
|
|
39
39
|
return Number.isNaN(parsedCount) ? 0 : Math.max(parsedCount, 0);
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -55,23 +55,24 @@
|
|
|
55
55
|
if (!element) return false;
|
|
56
56
|
|
|
57
57
|
var styles = window.getComputedStyle(element);
|
|
58
|
-
return styles.display !==
|
|
58
|
+
return styles.display !== 'none' && styles.visibility !== 'hidden' && element.getClientRects().length > 0;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
function trackedTablesInWrapper(scroll) {
|
|
62
62
|
return Array.from(scroll.querySelectorAll(TABLE_SELECTOR)).filter(function(table) {
|
|
63
|
-
return table.getAttribute(
|
|
63
|
+
return table.getAttribute('aria-hidden') !== 'true' && !table.classList.contains('table-fixed-header__table');
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
function isSourceTableCandidate(table) {
|
|
68
|
-
return table.getAttribute(
|
|
69
|
-
!table.classList.contains(
|
|
70
|
-
!table.closest(
|
|
68
|
+
return table.getAttribute('aria-hidden') !== 'true' &&
|
|
69
|
+
!table.classList.contains('table-fixed-header__table') &&
|
|
70
|
+
!table.closest('[data-fixed-table-header]');
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function activeSourceTable(scroll) {
|
|
74
74
|
var tables = trackedTablesInWrapper(scroll);
|
|
75
|
+
|
|
75
76
|
return tables.find(isVisible) || tables[0] || null;
|
|
76
77
|
}
|
|
77
78
|
|
|
@@ -79,14 +80,16 @@
|
|
|
79
80
|
var existingWrapper = table.closest(WRAPPER_SELECTOR);
|
|
80
81
|
|
|
81
82
|
if (existingWrapper) {
|
|
82
|
-
existingWrapper.setAttribute(
|
|
83
|
-
existingWrapper.classList.
|
|
83
|
+
existingWrapper.setAttribute('data-fixed-header-scroll', '');
|
|
84
|
+
if (!existingWrapper.classList.contains('home-table__wrapper')) {
|
|
85
|
+
existingWrapper.classList.add('sticky-table-scroll');
|
|
86
|
+
}
|
|
84
87
|
return existingWrapper;
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
var wrapper = document.createElement(
|
|
88
|
-
wrapper.className =
|
|
89
|
-
wrapper.setAttribute(
|
|
90
|
+
var wrapper = document.createElement('div');
|
|
91
|
+
wrapper.className = 'scroll-table sticky-table-scroll';
|
|
92
|
+
wrapper.setAttribute('data-fixed-header-scroll', '');
|
|
90
93
|
table.parentNode.insertBefore(wrapper, table);
|
|
91
94
|
wrapper.appendChild(table);
|
|
92
95
|
|
|
@@ -95,40 +98,40 @@
|
|
|
95
98
|
|
|
96
99
|
function autoFixedHeaderSlot(scroll) {
|
|
97
100
|
var sibling = scroll.previousElementSibling;
|
|
98
|
-
if (!sibling || !sibling.hasAttribute(
|
|
101
|
+
if (!sibling || !sibling.hasAttribute('data-auto-fixed-table-header')) return null;
|
|
99
102
|
|
|
100
103
|
return sibling;
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
function explicitFixedHeaderSlot(scroll) {
|
|
104
|
-
var mainContent = scroll.closest(
|
|
107
|
+
var mainContent = scroll.closest('.main-content');
|
|
105
108
|
if (!mainContent) return null;
|
|
106
109
|
|
|
107
|
-
return Array.from(mainContent.querySelectorAll(
|
|
108
|
-
return !slot.hasAttribute(
|
|
110
|
+
return Array.from(mainContent.querySelectorAll('[data-fixed-table-header]')).find(function(slot) {
|
|
111
|
+
return !slot.hasAttribute('data-auto-fixed-table-header');
|
|
109
112
|
}) || null;
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
function prepareFixedHeaderSlot(slot, inline) {
|
|
113
|
-
slot.classList.add(
|
|
116
|
+
slot.classList.add('table-fixed-header-slot');
|
|
114
117
|
|
|
115
118
|
if (inline) {
|
|
116
|
-
slot.setAttribute(
|
|
119
|
+
slot.setAttribute('data-fixed-header-inline', 'true');
|
|
117
120
|
} else {
|
|
118
|
-
slot.removeAttribute(
|
|
121
|
+
slot.removeAttribute('data-fixed-header-inline');
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
function numericPixelValue(value) {
|
|
123
|
-
var parsedValue = parseFloat(value ||
|
|
126
|
+
var parsedValue = parseFloat(value || '0');
|
|
124
127
|
return Number.isNaN(parsedValue) ? 0 : parsedValue;
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
function syncAutoSlotGap(slot) {
|
|
128
131
|
if (!slot) return;
|
|
129
132
|
|
|
130
|
-
if (!slot.hasAttribute(
|
|
131
|
-
slot.style.removeProperty(
|
|
133
|
+
if (!slot.hasAttribute('data-auto-fixed-table-header')) {
|
|
134
|
+
slot.style.removeProperty('margin-bottom');
|
|
132
135
|
return;
|
|
133
136
|
}
|
|
134
137
|
|
|
@@ -136,8 +139,8 @@
|
|
|
136
139
|
if (!parent) return;
|
|
137
140
|
|
|
138
141
|
var parentStyles = window.getComputedStyle(parent);
|
|
139
|
-
var isColumnFlex = parentStyles.display ===
|
|
140
|
-
var isGrid = parentStyles.display ===
|
|
142
|
+
var isColumnFlex = parentStyles.display === 'flex' && parentStyles.flexDirection.indexOf('column') === 0;
|
|
143
|
+
var isGrid = parentStyles.display === 'grid';
|
|
141
144
|
var gap = numericPixelValue(parentStyles.rowGap || parentStyles.gap);
|
|
142
145
|
|
|
143
146
|
if ((isColumnFlex || isGrid) && gap > 0) {
|
|
@@ -145,28 +148,30 @@
|
|
|
145
148
|
return;
|
|
146
149
|
}
|
|
147
150
|
|
|
148
|
-
slot.style.removeProperty(
|
|
151
|
+
slot.style.removeProperty('margin-bottom');
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
function ensureFixedHeaderScrollViewport(slot) {
|
|
152
|
-
var fixedScroll = slot.querySelector(
|
|
155
|
+
var fixedScroll = slot.querySelector('.table-fixed-header__scroll');
|
|
156
|
+
|
|
153
157
|
if (fixedScroll) return fixedScroll;
|
|
154
158
|
|
|
155
|
-
fixedScroll = document.createElement(
|
|
156
|
-
fixedScroll.className =
|
|
157
|
-
slot.innerHTML =
|
|
159
|
+
fixedScroll = document.createElement('div');
|
|
160
|
+
fixedScroll.className = 'table-fixed-header__scroll';
|
|
161
|
+
slot.innerHTML = '';
|
|
158
162
|
slot.appendChild(fixedScroll);
|
|
159
163
|
|
|
160
164
|
return fixedScroll;
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
function ensureFixedHeaderSpacer(fixedScroll) {
|
|
164
|
-
var spacer = fixedScroll.querySelector(
|
|
168
|
+
var spacer = fixedScroll.querySelector('.table-fixed-header__spacer');
|
|
169
|
+
|
|
165
170
|
if (spacer) return spacer;
|
|
166
171
|
|
|
167
|
-
spacer = document.createElement(
|
|
168
|
-
spacer.className =
|
|
169
|
-
spacer.setAttribute(
|
|
172
|
+
spacer = document.createElement('div');
|
|
173
|
+
spacer.className = 'table-fixed-header__spacer';
|
|
174
|
+
spacer.setAttribute('aria-hidden', 'true');
|
|
170
175
|
fixedScroll.appendChild(spacer);
|
|
171
176
|
|
|
172
177
|
return spacer;
|
|
@@ -185,10 +190,10 @@
|
|
|
185
190
|
return autoSlot;
|
|
186
191
|
}
|
|
187
192
|
|
|
188
|
-
autoSlot = document.createElement(
|
|
189
|
-
autoSlot.className =
|
|
190
|
-
autoSlot.setAttribute(
|
|
191
|
-
autoSlot.setAttribute(
|
|
193
|
+
autoSlot = document.createElement('div');
|
|
194
|
+
autoSlot.className = 'table-fixed-header-slot';
|
|
195
|
+
autoSlot.setAttribute('data-fixed-table-header', '');
|
|
196
|
+
autoSlot.setAttribute('data-auto-fixed-table-header', 'true');
|
|
192
197
|
autoSlot.hidden = true;
|
|
193
198
|
scroll.parentNode.insertBefore(autoSlot, scroll);
|
|
194
199
|
|
|
@@ -196,24 +201,28 @@
|
|
|
196
201
|
}
|
|
197
202
|
|
|
198
203
|
function closestMainContentHeader(scroll) {
|
|
199
|
-
var mainContent = scroll.closest(
|
|
204
|
+
var mainContent = scroll.closest('.main-content');
|
|
200
205
|
if (!mainContent) return null;
|
|
201
206
|
|
|
202
|
-
return mainContent.querySelector(
|
|
207
|
+
return mainContent.querySelector('.main-content__header');
|
|
203
208
|
}
|
|
204
209
|
|
|
205
210
|
function syncStickyPageHeader(scroll, slot) {
|
|
206
211
|
var header = closestMainContentHeader(scroll);
|
|
207
212
|
if (!header) {
|
|
208
|
-
slot.style.top =
|
|
213
|
+
slot.style.top = '0px';
|
|
209
214
|
syncAutoSlotGap(slot);
|
|
210
215
|
return;
|
|
211
216
|
}
|
|
212
217
|
|
|
213
|
-
if (
|
|
214
|
-
|
|
218
|
+
if (!header.classList.contains('reservations-list-header')) {
|
|
219
|
+
header.classList.add('main-content__header--sticky-table-layout');
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (slot.hasAttribute('data-auto-fixed-table-header')) {
|
|
223
|
+
slot.style.top = Math.ceil(header.getBoundingClientRect().height) + 'px';
|
|
215
224
|
} else {
|
|
216
|
-
slot.style.top =
|
|
225
|
+
slot.style.top = '0px';
|
|
217
226
|
}
|
|
218
227
|
|
|
219
228
|
syncAutoSlotGap(slot);
|
|
@@ -222,53 +231,60 @@
|
|
|
222
231
|
function syncFixedHeaderScroll(scroll, fixedScroll, scrollLeft) {
|
|
223
232
|
if (!scroll || !fixedScroll) return;
|
|
224
233
|
|
|
225
|
-
var left = typeof scrollLeft ===
|
|
234
|
+
var left = typeof scrollLeft === 'number' ? scrollLeft : scroll.scrollLeft;
|
|
235
|
+
|
|
226
236
|
fixedScroll.scrollLeft = left;
|
|
227
237
|
}
|
|
228
238
|
|
|
229
239
|
function fixedHeaderTableClassName(sourceTable) {
|
|
230
240
|
var excludedClasses = {
|
|
231
|
-
|
|
232
|
-
|
|
241
|
+
'table-with-fixed-header': true,
|
|
242
|
+
'home-table--with-fixed-header': true,
|
|
243
|
+
'table-fixed-header__table': true,
|
|
244
|
+
'home-table--fixed-header': true
|
|
233
245
|
};
|
|
234
246
|
|
|
235
247
|
var classes = sourceTable.className ? sourceTable.className.split(/\s+/).filter(function(className) {
|
|
236
248
|
return className && !excludedClasses[className];
|
|
237
249
|
}) : [];
|
|
238
250
|
|
|
239
|
-
classes.push(
|
|
251
|
+
classes.push('table-fixed-header__table');
|
|
252
|
+
if (sourceTable.classList.contains('home-table')) {
|
|
253
|
+
classes.push('home-table--fixed-header');
|
|
254
|
+
}
|
|
240
255
|
|
|
241
|
-
return Array.from(new Set(classes)).join(
|
|
256
|
+
return Array.from(new Set(classes)).join(' ');
|
|
242
257
|
}
|
|
243
258
|
|
|
244
259
|
function applyColGroup(table, widths) {
|
|
245
260
|
if (!table || !widths.length) return;
|
|
246
261
|
|
|
247
|
-
var colgroup = table.querySelector(
|
|
262
|
+
var colgroup = table.querySelector('colgroup[data-fixed-header-colgroup]');
|
|
263
|
+
|
|
248
264
|
if (!colgroup) {
|
|
249
|
-
colgroup = document.createElement(
|
|
250
|
-
colgroup.setAttribute(
|
|
265
|
+
colgroup = document.createElement('colgroup');
|
|
266
|
+
colgroup.setAttribute('data-fixed-header-colgroup', 'true');
|
|
251
267
|
table.insertBefore(colgroup, table.firstChild);
|
|
252
268
|
}
|
|
253
269
|
|
|
254
|
-
colgroup.innerHTML =
|
|
270
|
+
colgroup.innerHTML = '';
|
|
255
271
|
|
|
256
272
|
widths.forEach(function(width) {
|
|
257
|
-
var col = document.createElement(
|
|
273
|
+
var col = document.createElement('col');
|
|
258
274
|
col.style.width = cssPixelValue(width);
|
|
259
275
|
colgroup.appendChild(col);
|
|
260
276
|
});
|
|
261
277
|
}
|
|
262
278
|
|
|
263
279
|
function applyFixedHeaderCellWidths(fixedTable, widths) {
|
|
264
|
-
var headerRow = fixedTable && fixedTable.querySelector(
|
|
280
|
+
var headerRow = fixedTable && fixedTable.querySelector('thead tr');
|
|
265
281
|
if (!headerRow) return;
|
|
266
282
|
|
|
267
283
|
directCells(headerRow).forEach(function(cell, index) {
|
|
268
284
|
var width = widths[index];
|
|
269
285
|
if (!width) {
|
|
270
|
-
cell.style.removeProperty(
|
|
271
|
-
cell.style.removeProperty(
|
|
286
|
+
cell.style.removeProperty('width');
|
|
287
|
+
cell.style.removeProperty('min-width');
|
|
272
288
|
return;
|
|
273
289
|
}
|
|
274
290
|
|
|
@@ -279,13 +295,13 @@
|
|
|
279
295
|
|
|
280
296
|
function widthCandidateRows(sourceTable, headerCellCount) {
|
|
281
297
|
var candidates = [];
|
|
282
|
-
var headerRow = sourceTable.querySelector(
|
|
298
|
+
var headerRow = sourceTable.querySelector('thead tr');
|
|
283
299
|
|
|
284
300
|
if (headerRow) {
|
|
285
301
|
candidates.push(headerRow);
|
|
286
302
|
}
|
|
287
303
|
|
|
288
|
-
Array.from(sourceTable.querySelectorAll(
|
|
304
|
+
Array.from(sourceTable.querySelectorAll('tbody tr, tfoot tr')).forEach(function(row) {
|
|
289
305
|
var cells = directCells(row);
|
|
290
306
|
if (cells.length !== headerCellCount || cells.some(function(cell) { return cell.colSpan > 1; })) return;
|
|
291
307
|
|
|
@@ -296,7 +312,7 @@
|
|
|
296
312
|
}
|
|
297
313
|
|
|
298
314
|
function hasMeasurableDataRow(sourceTable, headerCellCount) {
|
|
299
|
-
return Array.from(sourceTable.querySelectorAll(
|
|
315
|
+
return Array.from(sourceTable.querySelectorAll('tbody tr, tfoot tr')).some(function(row) {
|
|
300
316
|
var cells = directCells(row);
|
|
301
317
|
return cells.length === headerCellCount && !cells.some(function(cell) { return cell.colSpan > 1; });
|
|
302
318
|
});
|
|
@@ -305,7 +321,7 @@
|
|
|
305
321
|
function removeGeneratedColGroup(table) {
|
|
306
322
|
if (!table) return;
|
|
307
323
|
|
|
308
|
-
var colgroup = table.querySelector(
|
|
324
|
+
var colgroup = table.querySelector('colgroup[data-fixed-header-colgroup]');
|
|
309
325
|
if (colgroup) {
|
|
310
326
|
colgroup.remove();
|
|
311
327
|
}
|
|
@@ -314,11 +330,11 @@
|
|
|
314
330
|
function generatedColGroupWidths(table, expectedCount) {
|
|
315
331
|
if (!table) return [];
|
|
316
332
|
|
|
317
|
-
var colgroup = table.querySelector(
|
|
333
|
+
var colgroup = table.querySelector('colgroup[data-fixed-header-colgroup]');
|
|
318
334
|
if (!colgroup) return [];
|
|
319
335
|
|
|
320
336
|
var widths = Array.from(colgroup.children).map(function(col) {
|
|
321
|
-
var inlineWidth = parseFloat(col.style.width ||
|
|
337
|
+
var inlineWidth = parseFloat(col.style.width || '0');
|
|
322
338
|
return Number.isNaN(inlineWidth) ? 0 : preciseNumber(inlineWidth);
|
|
323
339
|
});
|
|
324
340
|
|
|
@@ -327,7 +343,7 @@
|
|
|
327
343
|
return widths;
|
|
328
344
|
}
|
|
329
345
|
|
|
330
|
-
function clearFixedHeaderState(slot, sourceTable) {
|
|
346
|
+
function clearFixedHeaderState(slot, scroll, sourceTable) {
|
|
331
347
|
if (slot) {
|
|
332
348
|
slot.hidden = true;
|
|
333
349
|
}
|
|
@@ -335,13 +351,21 @@
|
|
|
335
351
|
if (!sourceTable) return;
|
|
336
352
|
|
|
337
353
|
removeGeneratedColGroup(sourceTable);
|
|
338
|
-
sourceTable.classList.remove(
|
|
354
|
+
sourceTable.classList.remove('table-with-fixed-header');
|
|
355
|
+
|
|
356
|
+
if (sourceTable.classList.contains('home-table')) {
|
|
357
|
+
sourceTable.classList.remove('home-table--with-fixed-header');
|
|
358
|
+
|
|
359
|
+
if (scroll) {
|
|
360
|
+
scroll.classList.remove('home-table__wrapper--fixed-header-ready');
|
|
361
|
+
}
|
|
362
|
+
}
|
|
339
363
|
}
|
|
340
364
|
|
|
341
365
|
function measuredColumnWidths(sourceTable, fixedTable, options) {
|
|
342
366
|
var settings = options || {};
|
|
343
|
-
var sourceHead = sourceTable.querySelector(
|
|
344
|
-
var sourceRow = sourceHead && sourceHead.querySelector(
|
|
367
|
+
var sourceHead = sourceTable.querySelector('thead');
|
|
368
|
+
var sourceRow = sourceHead && sourceHead.querySelector('tr');
|
|
345
369
|
|
|
346
370
|
if (!sourceRow) return [];
|
|
347
371
|
|
|
@@ -362,7 +386,7 @@
|
|
|
362
386
|
}
|
|
363
387
|
|
|
364
388
|
if (!widths.some(Boolean) && fixedTable && settings.allowFixedTableFallback !== false) {
|
|
365
|
-
var fixedRow = fixedTable.querySelector(
|
|
389
|
+
var fixedRow = fixedTable.querySelector('thead tr');
|
|
366
390
|
var fixedCells = fixedRow ? directCells(fixedRow) : [];
|
|
367
391
|
|
|
368
392
|
fixedCells.forEach(function(cell, index) {
|
|
@@ -374,12 +398,12 @@
|
|
|
374
398
|
}
|
|
375
399
|
|
|
376
400
|
function applyFixedHeaderStickyColumns(sourceTable, fixedTable, widths) {
|
|
377
|
-
var headerRow = fixedTable.querySelector(
|
|
401
|
+
var headerRow = fixedTable.querySelector('thead tr');
|
|
378
402
|
if (!headerRow) return;
|
|
379
403
|
|
|
380
404
|
directCells(headerRow).forEach(function(cell) {
|
|
381
|
-
cell.classList.remove(
|
|
382
|
-
cell.style.removeProperty(
|
|
405
|
+
cell.classList.remove('sticky-left', 'sticky-left--last');
|
|
406
|
+
cell.style.removeProperty('left');
|
|
383
407
|
});
|
|
384
408
|
|
|
385
409
|
var count = fixedColumnsCount(sourceTable);
|
|
@@ -388,9 +412,9 @@
|
|
|
388
412
|
var offsets = stickyOffsets(widths.slice(0, count));
|
|
389
413
|
|
|
390
414
|
directCells(headerRow).slice(0, offsets.length).forEach(function(cell, index) {
|
|
391
|
-
cell.classList.add(
|
|
415
|
+
cell.classList.add('sticky-left');
|
|
392
416
|
if (index === offsets.length - 1) {
|
|
393
|
-
cell.classList.add(
|
|
417
|
+
cell.classList.add('sticky-left--last');
|
|
394
418
|
}
|
|
395
419
|
cell.style.left = cssPixelValue(offsets[index]);
|
|
396
420
|
});
|
|
@@ -399,36 +423,36 @@
|
|
|
399
423
|
function buildFixedTableHeader(slot, scroll, sourceTable) {
|
|
400
424
|
if (!slot || !scroll || !sourceTable) return;
|
|
401
425
|
|
|
402
|
-
var sourceHead = sourceTable.querySelector(
|
|
426
|
+
var sourceHead = sourceTable.querySelector('thead');
|
|
403
427
|
if (!sourceHead) {
|
|
404
|
-
clearFixedHeaderState(slot, sourceTable);
|
|
428
|
+
clearFixedHeaderState(slot, scroll, sourceTable);
|
|
405
429
|
return;
|
|
406
430
|
}
|
|
407
431
|
|
|
408
|
-
var sourceRow = sourceHead.querySelector(
|
|
432
|
+
var sourceRow = sourceHead.querySelector('tr');
|
|
409
433
|
var headerCells = sourceRow ? directCells(sourceRow) : [];
|
|
410
434
|
var hasDataRow = hasMeasurableDataRow(sourceTable, headerCells.length);
|
|
411
435
|
|
|
412
436
|
if (!headerCells.length) {
|
|
413
|
-
clearFixedHeaderState(slot, sourceTable);
|
|
437
|
+
clearFixedHeaderState(slot, scroll, sourceTable);
|
|
414
438
|
return;
|
|
415
439
|
}
|
|
416
440
|
|
|
417
441
|
var fixedScroll = ensureFixedHeaderScrollViewport(slot);
|
|
418
|
-
var fixedTable = fixedScroll.querySelector(
|
|
442
|
+
var fixedTable = fixedScroll.querySelector('.table-fixed-header__table');
|
|
419
443
|
var fixedSpacer = ensureFixedHeaderSpacer(fixedScroll);
|
|
420
444
|
|
|
421
445
|
if (!fixedTable) {
|
|
422
|
-
fixedTable = document.createElement(
|
|
423
|
-
fixedTable.setAttribute(
|
|
446
|
+
fixedTable = document.createElement('table');
|
|
447
|
+
fixedTable.setAttribute('aria-hidden', 'true');
|
|
424
448
|
}
|
|
425
449
|
|
|
426
450
|
fixedTable.className = fixedHeaderTableClassName(sourceTable);
|
|
427
|
-
fixedTable.dataset.fixedColumnsCount = sourceTable.dataset.fixedColumnsCount ||
|
|
451
|
+
fixedTable.dataset.fixedColumnsCount = sourceTable.dataset.fixedColumnsCount || '0';
|
|
428
452
|
fixedTable.innerHTML = sourceHead.outerHTML;
|
|
429
453
|
|
|
430
454
|
if (fixedTable.parentNode !== fixedScroll) {
|
|
431
|
-
fixedScroll.innerHTML =
|
|
455
|
+
fixedScroll.innerHTML = '';
|
|
432
456
|
fixedScroll.appendChild(fixedTable);
|
|
433
457
|
fixedScroll.appendChild(fixedSpacer);
|
|
434
458
|
}
|
|
@@ -436,9 +460,8 @@
|
|
|
436
460
|
var widths = measuredColumnWidths(sourceTable, fixedTable, {
|
|
437
461
|
allowFixedTableFallback: hasDataRow
|
|
438
462
|
});
|
|
439
|
-
|
|
440
463
|
if (!widths.some(Boolean)) {
|
|
441
|
-
clearFixedHeaderState(slot, sourceTable);
|
|
464
|
+
clearFixedHeaderState(slot, scroll, sourceTable);
|
|
442
465
|
return;
|
|
443
466
|
}
|
|
444
467
|
|
|
@@ -449,15 +472,20 @@
|
|
|
449
472
|
|
|
450
473
|
var fixedScrollWidth = measuredTableWidth(sourceTable, widths);
|
|
451
474
|
|
|
452
|
-
fixedTable.style.transform =
|
|
453
|
-
fixedTable.style.marginLeft =
|
|
475
|
+
fixedTable.style.transform = '';
|
|
476
|
+
fixedTable.style.marginLeft = '';
|
|
454
477
|
fixedTable.style.width = cssPixelValue(fixedScrollWidth);
|
|
455
|
-
fixedSpacer.style.width =
|
|
456
|
-
fixedSpacer.style.minWidth =
|
|
478
|
+
fixedSpacer.style.width = '0px';
|
|
479
|
+
fixedSpacer.style.minWidth = '0px';
|
|
457
480
|
syncStickyPageHeader(scroll, slot);
|
|
458
481
|
syncFixedHeaderScroll(scroll, fixedScroll);
|
|
459
482
|
|
|
460
|
-
sourceTable.classList.add(
|
|
483
|
+
sourceTable.classList.add('table-with-fixed-header');
|
|
484
|
+
if (sourceTable.classList.contains('home-table')) {
|
|
485
|
+
sourceTable.classList.add('home-table--with-fixed-header');
|
|
486
|
+
scroll.classList.add('home-table__wrapper--fixed-header-ready');
|
|
487
|
+
}
|
|
488
|
+
|
|
461
489
|
slot.hidden = false;
|
|
462
490
|
}
|
|
463
491
|
|
|
@@ -483,7 +511,7 @@
|
|
|
483
511
|
function observeFixedHeaderScroll(scroll) {
|
|
484
512
|
if (observedScrolls.has(scroll)) return;
|
|
485
513
|
|
|
486
|
-
scroll.addEventListener(
|
|
514
|
+
scroll.addEventListener('scroll', function() {
|
|
487
515
|
var state = scrollSyncStates.get(scroll) || {};
|
|
488
516
|
state.scrollLeft = scroll.scrollLeft;
|
|
489
517
|
|
|
@@ -492,7 +520,7 @@
|
|
|
492
520
|
state.frame = window.requestAnimationFrame(function() {
|
|
493
521
|
var slot = ensureFixedHeaderSlot(scroll);
|
|
494
522
|
state.frame = null;
|
|
495
|
-
syncFixedHeaderScroll(scroll, slot.querySelector(
|
|
523
|
+
syncFixedHeaderScroll(scroll, slot.querySelector('.table-fixed-header__scroll'), state.scrollLeft);
|
|
496
524
|
});
|
|
497
525
|
|
|
498
526
|
scrollSyncStates.set(scroll, state);
|
|
@@ -545,14 +573,14 @@
|
|
|
545
573
|
initializeFixedHeaders(document);
|
|
546
574
|
}
|
|
547
575
|
|
|
548
|
-
if (document.readyState ===
|
|
549
|
-
document.addEventListener(
|
|
576
|
+
if (document.readyState === 'loading') {
|
|
577
|
+
document.addEventListener('DOMContentLoaded', initializeFromDocument);
|
|
550
578
|
} else {
|
|
551
579
|
initializeFromDocument();
|
|
552
580
|
}
|
|
553
581
|
|
|
554
|
-
document.addEventListener(
|
|
555
|
-
window.addEventListener(
|
|
582
|
+
document.addEventListener('turbo:load', initializeFromDocument);
|
|
583
|
+
window.addEventListener('resize', initializeFromDocument);
|
|
556
584
|
|
|
557
585
|
if (window.MutationObserver) {
|
|
558
586
|
var mutationObserver = new MutationObserver(function(mutations) {
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
.scroll-table table th,
|
|
8
8
|
.scroll-table table td,
|
|
9
9
|
.sticky-table-scroll table th,
|
|
10
|
-
.sticky-table-scroll table td
|
|
10
|
+
.sticky-table-scroll table td,
|
|
11
|
+
.home-table th,
|
|
12
|
+
.home-table td {
|
|
11
13
|
vertical-align: middle;
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -171,19 +173,23 @@ td.cell-data:hover .admin-copy-cell__button:not([disabled]),
|
|
|
171
173
|
.scroll-table table th.sticky-left,
|
|
172
174
|
.scroll-table table td.sticky-left,
|
|
173
175
|
.sticky-table-scroll table th.sticky-left,
|
|
174
|
-
.sticky-table-scroll table td.sticky-left
|
|
176
|
+
.sticky-table-scroll table td.sticky-left,
|
|
177
|
+
.home-table th.sticky-left,
|
|
178
|
+
.home-table td.sticky-left {
|
|
175
179
|
position: sticky;
|
|
176
180
|
background-clip: padding-box;
|
|
177
181
|
}
|
|
178
182
|
|
|
179
183
|
.scroll-table table th.sticky-left,
|
|
180
|
-
.sticky-table-scroll table th.sticky-left
|
|
184
|
+
.sticky-table-scroll table th.sticky-left,
|
|
185
|
+
.home-table th.sticky-left {
|
|
181
186
|
z-index: 4;
|
|
182
187
|
background-color: #121012;
|
|
183
188
|
}
|
|
184
189
|
|
|
185
190
|
.scroll-table table td.sticky-left,
|
|
186
|
-
.sticky-table-scroll table td.sticky-left
|
|
191
|
+
.sticky-table-scroll table td.sticky-left,
|
|
192
|
+
.home-table td.sticky-left {
|
|
187
193
|
z-index: 3;
|
|
188
194
|
background-color: var(--sticky-cell-background, #fff);
|
|
189
195
|
}
|
|
@@ -191,7 +197,9 @@ td.cell-data:hover .admin-copy-cell__button:not([disabled]),
|
|
|
191
197
|
.scroll-table table th.sticky-left::after,
|
|
192
198
|
.scroll-table table td.sticky-left::after,
|
|
193
199
|
.sticky-table-scroll table th.sticky-left::after,
|
|
194
|
-
.sticky-table-scroll table td.sticky-left::after
|
|
200
|
+
.sticky-table-scroll table td.sticky-left::after,
|
|
201
|
+
.home-table th.sticky-left::after,
|
|
202
|
+
.home-table td.sticky-left::after {
|
|
195
203
|
content: "";
|
|
196
204
|
position: absolute;
|
|
197
205
|
top: -1px;
|
|
@@ -205,14 +213,18 @@ td.cell-data:hover .admin-copy-cell__button:not([disabled]),
|
|
|
205
213
|
.scroll-table table th.sticky-left--last,
|
|
206
214
|
.scroll-table table td.sticky-left--last,
|
|
207
215
|
.sticky-table-scroll table th.sticky-left--last,
|
|
208
|
-
.sticky-table-scroll table td.sticky-left--last
|
|
216
|
+
.sticky-table-scroll table td.sticky-left--last,
|
|
217
|
+
.home-table th.sticky-left--last,
|
|
218
|
+
.home-table td.sticky-left--last {
|
|
209
219
|
box-shadow: 6px 0 8px -8px rgba(0, 0, 0, 0.35);
|
|
210
220
|
}
|
|
211
221
|
|
|
212
222
|
.scroll-table table th.sticky,
|
|
213
223
|
.scroll-table table td.sticky,
|
|
214
224
|
.sticky-table-scroll table th.sticky,
|
|
215
|
-
.sticky-table-scroll table td.sticky
|
|
225
|
+
.sticky-table-scroll table td.sticky,
|
|
226
|
+
.home-table th.sticky,
|
|
227
|
+
.home-table td.sticky {
|
|
216
228
|
position: sticky;
|
|
217
229
|
right: 0;
|
|
218
230
|
background-color: inherit;
|
|
@@ -223,7 +235,9 @@ td.cell-data:hover .admin-copy-cell__button:not([disabled]),
|
|
|
223
235
|
.scroll-table table th.sticky::before,
|
|
224
236
|
.scroll-table table td.sticky::before,
|
|
225
237
|
.sticky-table-scroll table th.sticky::before,
|
|
226
|
-
.sticky-table-scroll table td.sticky::before
|
|
238
|
+
.sticky-table-scroll table td.sticky::before,
|
|
239
|
+
.home-table th.sticky::before,
|
|
240
|
+
.home-table td.sticky::before {
|
|
227
241
|
content: "";
|
|
228
242
|
position: absolute;
|
|
229
243
|
top: -1px;
|
|
@@ -235,12 +249,14 @@ td.cell-data:hover .admin-copy-cell__button:not([disabled]),
|
|
|
235
249
|
}
|
|
236
250
|
|
|
237
251
|
.scroll-table table th.sticky,
|
|
238
|
-
.sticky-table-scroll table th.sticky
|
|
252
|
+
.sticky-table-scroll table th.sticky,
|
|
253
|
+
.home-table th.sticky {
|
|
239
254
|
z-index: 5;
|
|
240
255
|
}
|
|
241
256
|
|
|
242
257
|
.scroll-table table td.sticky,
|
|
243
|
-
.sticky-table-scroll table td.sticky
|
|
258
|
+
.sticky-table-scroll table td.sticky,
|
|
259
|
+
.home-table td.sticky {
|
|
244
260
|
z-index: 4;
|
|
245
261
|
background-color: var(--sticky-cell-background, #fff);
|
|
246
262
|
}
|
|
@@ -253,7 +269,8 @@ td.cell-data:hover .admin-copy-cell__button:not([disabled]),
|
|
|
253
269
|
}
|
|
254
270
|
|
|
255
271
|
td.actions-column .sticky__item,
|
|
256
|
-
.sticky-table-scroll td.actions-column .sticky__item
|
|
272
|
+
.sticky-table-scroll td.actions-column .sticky__item,
|
|
273
|
+
.home-table td.actions-column .sticky__item {
|
|
257
274
|
width: max-content;
|
|
258
275
|
}
|
|
259
276
|
|
|
@@ -294,7 +311,8 @@ td.actions-column .sticky__item,
|
|
|
294
311
|
top: 0;
|
|
295
312
|
}
|
|
296
313
|
|
|
297
|
-
.table-with-fixed-header thead
|
|
314
|
+
.table-with-fixed-header thead,
|
|
315
|
+
.home-table--with-fixed-header thead {
|
|
298
316
|
display: none;
|
|
299
317
|
}
|
|
300
318
|
|
|
@@ -386,6 +404,27 @@ td.actions-column .sticky__item,
|
|
|
386
404
|
box-shadow: 6px 0 8px -8px rgba(0, 0, 0, 0.35);
|
|
387
405
|
}
|
|
388
406
|
|
|
407
|
+
|
|
408
|
+
.home-table--fixed-header {
|
|
409
|
+
table-layout: fixed;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.home-table--fixed-header th {
|
|
413
|
+
position: static;
|
|
414
|
+
top: auto;
|
|
415
|
+
z-index: auto;
|
|
416
|
+
border: 1px solid #121012;
|
|
417
|
+
white-space: normal;
|
|
418
|
+
overflow-wrap: break-word;
|
|
419
|
+
word-break: break-word;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.home-table--fixed-header th.sticky {
|
|
423
|
+
position: sticky;
|
|
424
|
+
right: 0;
|
|
425
|
+
z-index: 5;
|
|
426
|
+
}
|
|
427
|
+
|
|
389
428
|
.yummy-guide-administrate-filter-form {
|
|
390
429
|
display: flex;
|
|
391
430
|
flex-direction: column;
|