yummy-guide-generic-administrate 0.3.0 → 0.3.2

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: 12a0170a3f475fc86fa867a2dcdbbb558cce85d0b1024687cbcc84a4cdbc5501
4
- data.tar.gz: bb0c145f4aaea534a02bff5f173e7917172193b6cca10f9a865cd4b2ebd6eda8
3
+ metadata.gz: 2e28359ae136f4efa7cb334c6cb9eb4f3001371d02b8104c68bf8924fa052692
4
+ data.tar.gz: 7f38757520d5d46d9a7fbd1f095e0659a31d65be38f9cc91baa08f4e7e7a4228
5
5
  SHA512:
6
- metadata.gz: 35cec1573335c70b7779deb4cc9c492ff045a3acf785c5fac447789b1a80c6e7dac5b61423978a2a9751c7df6fb4c880aa5560d14652cd06fe6b8addec743530
7
- data.tar.gz: 391aaee40d54f4f9ab58513d53bedfa9cdffd3a02f882ab679a690f394e9ea289927b34eb86b10da444348ddf8e34976c6482fa328810934240242a7dc091e76
6
+ metadata.gz: 3fcc34c49df48b58a1c81f1d14dc31ea0fc6df8b950a8390a86cace55d3adbbd1067f9326ffb12dd821524230e226d0c9db6771224c02230252adb4b29493977
7
+ data.tar.gz: 23dfaaf929e5bbd3afa4fa422ffe3a13bb3a45c5f5190a317884359ad56173b514a7052cd569d27e17cd28632bdd229819b343530159a4cf71ba615dc60f4e77
@@ -1,13 +1,14 @@
1
1
  (function() {
2
- var TABLE_SELECTOR = "table[data-fixed-columns-count]";
3
- var WRAPPER_SELECTOR = "[data-fixed-header-scroll], .scroll-table, .table-wrap, .af__table__content";
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
+ var observedFixedScrolls = new WeakMap();
6
7
  var scrollSyncStates = new WeakMap();
7
8
 
8
9
  function directCells(row) {
9
10
  return Array.from(row.children).filter(function(cell) {
10
- return cell.tagName === "TH" || cell.tagName === "TD";
11
+ return cell.tagName === 'TH' || cell.tagName === 'TD';
11
12
  });
12
13
  }
13
14
 
@@ -16,7 +17,7 @@
16
17
  }
17
18
 
18
19
  function cssPixelValue(value) {
19
- return preciseNumber(value) + "px";
20
+ return preciseNumber(value) + 'px';
20
21
  }
21
22
 
22
23
  function measuredWidth(element) {
@@ -35,7 +36,7 @@
35
36
  }
36
37
 
37
38
  function fixedColumnsCount(table) {
38
- var parsedCount = parseInt(table.dataset.fixedColumnsCount || "0", 10);
39
+ var parsedCount = parseInt(table.dataset.fixedColumnsCount || '0', 10);
39
40
  return Number.isNaN(parsedCount) ? 0 : Math.max(parsedCount, 0);
40
41
  }
41
42
 
@@ -55,23 +56,24 @@
55
56
  if (!element) return false;
56
57
 
57
58
  var styles = window.getComputedStyle(element);
58
- return styles.display !== "none" && styles.visibility !== "hidden" && element.getClientRects().length > 0;
59
+ return styles.display !== 'none' && styles.visibility !== 'hidden' && element.getClientRects().length > 0;
59
60
  }
60
61
 
61
62
  function trackedTablesInWrapper(scroll) {
62
63
  return Array.from(scroll.querySelectorAll(TABLE_SELECTOR)).filter(function(table) {
63
- return table.getAttribute("aria-hidden") !== "true" && !table.classList.contains("table-fixed-header__table");
64
+ return table.getAttribute('aria-hidden') !== 'true' && !table.classList.contains('table-fixed-header__table');
64
65
  });
65
66
  }
66
67
 
67
68
  function isSourceTableCandidate(table) {
68
- return table.getAttribute("aria-hidden") !== "true" &&
69
- !table.classList.contains("table-fixed-header__table") &&
70
- !table.closest("[data-fixed-table-header]");
69
+ return table.getAttribute('aria-hidden') !== 'true' &&
70
+ !table.classList.contains('table-fixed-header__table') &&
71
+ !table.closest('[data-fixed-table-header]');
71
72
  }
72
73
 
73
74
  function activeSourceTable(scroll) {
74
75
  var tables = trackedTablesInWrapper(scroll);
76
+
75
77
  return tables.find(isVisible) || tables[0] || null;
76
78
  }
77
79
 
@@ -79,14 +81,16 @@
79
81
  var existingWrapper = table.closest(WRAPPER_SELECTOR);
80
82
 
81
83
  if (existingWrapper) {
82
- existingWrapper.setAttribute("data-fixed-header-scroll", "");
83
- existingWrapper.classList.add("sticky-table-scroll");
84
+ existingWrapper.setAttribute('data-fixed-header-scroll', '');
85
+ if (!existingWrapper.classList.contains('home-table__wrapper')) {
86
+ existingWrapper.classList.add('sticky-table-scroll');
87
+ }
84
88
  return existingWrapper;
85
89
  }
86
90
 
87
- var wrapper = document.createElement("div");
88
- wrapper.className = "scroll-table sticky-table-scroll";
89
- wrapper.setAttribute("data-fixed-header-scroll", "");
91
+ var wrapper = document.createElement('div');
92
+ wrapper.className = 'scroll-table sticky-table-scroll';
93
+ wrapper.setAttribute('data-fixed-header-scroll', '');
90
94
  table.parentNode.insertBefore(wrapper, table);
91
95
  wrapper.appendChild(table);
92
96
 
@@ -95,40 +99,40 @@
95
99
 
96
100
  function autoFixedHeaderSlot(scroll) {
97
101
  var sibling = scroll.previousElementSibling;
98
- if (!sibling || !sibling.hasAttribute("data-auto-fixed-table-header")) return null;
102
+ if (!sibling || !sibling.hasAttribute('data-auto-fixed-table-header')) return null;
99
103
 
100
104
  return sibling;
101
105
  }
102
106
 
103
107
  function explicitFixedHeaderSlot(scroll) {
104
- var mainContent = scroll.closest(".main-content");
108
+ var mainContent = scroll.closest('.main-content');
105
109
  if (!mainContent) return null;
106
110
 
107
- return Array.from(mainContent.querySelectorAll("[data-fixed-table-header]")).find(function(slot) {
108
- return !slot.hasAttribute("data-auto-fixed-table-header");
111
+ return Array.from(mainContent.querySelectorAll('[data-fixed-table-header]')).find(function(slot) {
112
+ return !slot.hasAttribute('data-auto-fixed-table-header');
109
113
  }) || null;
110
114
  }
111
115
 
112
116
  function prepareFixedHeaderSlot(slot, inline) {
113
- slot.classList.add("table-fixed-header-slot");
117
+ slot.classList.add('table-fixed-header-slot');
114
118
 
115
119
  if (inline) {
116
- slot.setAttribute("data-fixed-header-inline", "true");
120
+ slot.setAttribute('data-fixed-header-inline', 'true');
117
121
  } else {
118
- slot.removeAttribute("data-fixed-header-inline");
122
+ slot.removeAttribute('data-fixed-header-inline');
119
123
  }
120
124
  }
121
125
 
122
126
  function numericPixelValue(value) {
123
- var parsedValue = parseFloat(value || "0");
127
+ var parsedValue = parseFloat(value || '0');
124
128
  return Number.isNaN(parsedValue) ? 0 : parsedValue;
125
129
  }
126
130
 
127
131
  function syncAutoSlotGap(slot) {
128
132
  if (!slot) return;
129
133
 
130
- if (!slot.hasAttribute("data-auto-fixed-table-header")) {
131
- slot.style.removeProperty("margin-bottom");
134
+ if (!slot.hasAttribute('data-auto-fixed-table-header')) {
135
+ slot.style.removeProperty('margin-bottom');
132
136
  return;
133
137
  }
134
138
 
@@ -136,8 +140,8 @@
136
140
  if (!parent) return;
137
141
 
138
142
  var parentStyles = window.getComputedStyle(parent);
139
- var isColumnFlex = parentStyles.display === "flex" && parentStyles.flexDirection.indexOf("column") === 0;
140
- var isGrid = parentStyles.display === "grid";
143
+ var isColumnFlex = parentStyles.display === 'flex' && parentStyles.flexDirection.indexOf('column') === 0;
144
+ var isGrid = parentStyles.display === 'grid';
141
145
  var gap = numericPixelValue(parentStyles.rowGap || parentStyles.gap);
142
146
 
143
147
  if ((isColumnFlex || isGrid) && gap > 0) {
@@ -145,28 +149,30 @@
145
149
  return;
146
150
  }
147
151
 
148
- slot.style.removeProperty("margin-bottom");
152
+ slot.style.removeProperty('margin-bottom');
149
153
  }
150
154
 
151
155
  function ensureFixedHeaderScrollViewport(slot) {
152
- var fixedScroll = slot.querySelector(".table-fixed-header__scroll");
156
+ var fixedScroll = slot.querySelector('.table-fixed-header__scroll');
157
+
153
158
  if (fixedScroll) return fixedScroll;
154
159
 
155
- fixedScroll = document.createElement("div");
156
- fixedScroll.className = "table-fixed-header__scroll";
157
- slot.innerHTML = "";
160
+ fixedScroll = document.createElement('div');
161
+ fixedScroll.className = 'table-fixed-header__scroll';
162
+ slot.innerHTML = '';
158
163
  slot.appendChild(fixedScroll);
159
164
 
160
165
  return fixedScroll;
161
166
  }
162
167
 
163
168
  function ensureFixedHeaderSpacer(fixedScroll) {
164
- var spacer = fixedScroll.querySelector(".table-fixed-header__spacer");
169
+ var spacer = fixedScroll.querySelector('.table-fixed-header__spacer');
170
+
165
171
  if (spacer) return spacer;
166
172
 
167
- spacer = document.createElement("div");
168
- spacer.className = "table-fixed-header__spacer";
169
- spacer.setAttribute("aria-hidden", "true");
173
+ spacer = document.createElement('div');
174
+ spacer.className = 'table-fixed-header__spacer';
175
+ spacer.setAttribute('aria-hidden', 'true');
170
176
  fixedScroll.appendChild(spacer);
171
177
 
172
178
  return spacer;
@@ -185,10 +191,10 @@
185
191
  return autoSlot;
186
192
  }
187
193
 
188
- autoSlot = document.createElement("div");
189
- autoSlot.className = "table-fixed-header-slot";
190
- autoSlot.setAttribute("data-fixed-table-header", "");
191
- autoSlot.setAttribute("data-auto-fixed-table-header", "true");
194
+ autoSlot = document.createElement('div');
195
+ autoSlot.className = 'table-fixed-header-slot';
196
+ autoSlot.setAttribute('data-fixed-table-header', '');
197
+ autoSlot.setAttribute('data-auto-fixed-table-header', 'true');
192
198
  autoSlot.hidden = true;
193
199
  scroll.parentNode.insertBefore(autoSlot, scroll);
194
200
 
@@ -196,24 +202,28 @@
196
202
  }
197
203
 
198
204
  function closestMainContentHeader(scroll) {
199
- var mainContent = scroll.closest(".main-content");
205
+ var mainContent = scroll.closest('.main-content');
200
206
  if (!mainContent) return null;
201
207
 
202
- return mainContent.querySelector(".main-content__header");
208
+ return mainContent.querySelector('.main-content__header');
203
209
  }
204
210
 
205
211
  function syncStickyPageHeader(scroll, slot) {
206
212
  var header = closestMainContentHeader(scroll);
207
213
  if (!header) {
208
- slot.style.top = "0px";
214
+ slot.style.top = '0px';
209
215
  syncAutoSlotGap(slot);
210
216
  return;
211
217
  }
212
218
 
213
- if (slot.hasAttribute("data-auto-fixed-table-header")) {
214
- slot.style.top = Math.ceil(header.getBoundingClientRect().height) + "px";
219
+ if (!header.classList.contains('reservations-list-header')) {
220
+ header.classList.add('main-content__header--sticky-table-layout');
221
+ }
222
+
223
+ if (slot.hasAttribute('data-auto-fixed-table-header')) {
224
+ slot.style.top = Math.ceil(header.getBoundingClientRect().height) + 'px';
215
225
  } else {
216
- slot.style.top = "0px";
226
+ slot.style.top = '0px';
217
227
  }
218
228
 
219
229
  syncAutoSlotGap(slot);
@@ -222,53 +232,111 @@
222
232
  function syncFixedHeaderScroll(scroll, fixedScroll, scrollLeft) {
223
233
  if (!scroll || !fixedScroll) return;
224
234
 
225
- var left = typeof scrollLeft === "number" ? scrollLeft : scroll.scrollLeft;
235
+ var left = typeof scrollLeft === 'number' ? scrollLeft : scroll.scrollLeft;
236
+ var state = ensureScrollSyncState(scroll);
237
+ var currentLeft = preciseNumber(fixedScroll.scrollLeft);
238
+
239
+ if (Math.abs(currentLeft - left) < 0.5) {
240
+ state.ignoredFixedScrollLeft = null;
241
+ return;
242
+ }
243
+
244
+ state.ignoredFixedScrollLeft = preciseNumber(left);
226
245
  fixedScroll.scrollLeft = left;
227
246
  }
228
247
 
248
+ function syncSourceScroll(scroll, fixedScroll, scrollLeft) {
249
+ if (!scroll || !fixedScroll) return;
250
+
251
+ var left = typeof scrollLeft === 'number' ? scrollLeft : fixedScroll.scrollLeft;
252
+ var state = ensureScrollSyncState(scroll);
253
+ var currentLeft = preciseNumber(scroll.scrollLeft);
254
+
255
+ if (Math.abs(currentLeft - left) < 0.5) {
256
+ state.ignoredSourceScrollLeft = null;
257
+ return;
258
+ }
259
+
260
+ state.ignoredSourceScrollLeft = preciseNumber(left);
261
+ scroll.scrollLeft = left;
262
+ }
263
+
264
+ function ensureScrollSyncState(scroll) {
265
+ var state = scrollSyncStates.get(scroll);
266
+
267
+ if (state) return state;
268
+
269
+ state = {
270
+ sourceFrame: null,
271
+ fixedFrame: null,
272
+ sourceScrollLeft: 0,
273
+ fixedScrollLeft: 0,
274
+ ignoredSourceScrollLeft: null,
275
+ ignoredFixedScrollLeft: null
276
+ };
277
+
278
+ scrollSyncStates.set(scroll, state);
279
+ return state;
280
+ }
281
+
282
+ function consumeIgnoredScrollLeft(state, key, scrollLeft) {
283
+ if (!state || state[key] === null || typeof state[key] === 'undefined') return false;
284
+
285
+ var ignoredLeft = state[key];
286
+ state[key] = null;
287
+
288
+ return Math.abs(ignoredLeft - preciseNumber(scrollLeft)) < 0.5;
289
+ }
290
+
229
291
  function fixedHeaderTableClassName(sourceTable) {
230
292
  var excludedClasses = {
231
- "table-with-fixed-header": true,
232
- "table-fixed-header__table": true
293
+ 'table-with-fixed-header': true,
294
+ 'home-table--with-fixed-header': true,
295
+ 'table-fixed-header__table': true,
296
+ 'home-table--fixed-header': true
233
297
  };
234
298
 
235
299
  var classes = sourceTable.className ? sourceTable.className.split(/\s+/).filter(function(className) {
236
300
  return className && !excludedClasses[className];
237
301
  }) : [];
238
302
 
239
- classes.push("table-fixed-header__table");
303
+ classes.push('table-fixed-header__table');
304
+ if (sourceTable.classList.contains('home-table')) {
305
+ classes.push('home-table--fixed-header');
306
+ }
240
307
 
241
- return Array.from(new Set(classes)).join(" ");
308
+ return Array.from(new Set(classes)).join(' ');
242
309
  }
243
310
 
244
311
  function applyColGroup(table, widths) {
245
312
  if (!table || !widths.length) return;
246
313
 
247
- var colgroup = table.querySelector("colgroup[data-fixed-header-colgroup]");
314
+ var colgroup = table.querySelector('colgroup[data-fixed-header-colgroup]');
315
+
248
316
  if (!colgroup) {
249
- colgroup = document.createElement("colgroup");
250
- colgroup.setAttribute("data-fixed-header-colgroup", "true");
317
+ colgroup = document.createElement('colgroup');
318
+ colgroup.setAttribute('data-fixed-header-colgroup', 'true');
251
319
  table.insertBefore(colgroup, table.firstChild);
252
320
  }
253
321
 
254
- colgroup.innerHTML = "";
322
+ colgroup.innerHTML = '';
255
323
 
256
324
  widths.forEach(function(width) {
257
- var col = document.createElement("col");
325
+ var col = document.createElement('col');
258
326
  col.style.width = cssPixelValue(width);
259
327
  colgroup.appendChild(col);
260
328
  });
261
329
  }
262
330
 
263
331
  function applyFixedHeaderCellWidths(fixedTable, widths) {
264
- var headerRow = fixedTable && fixedTable.querySelector("thead tr");
332
+ var headerRow = fixedTable && fixedTable.querySelector('thead tr');
265
333
  if (!headerRow) return;
266
334
 
267
335
  directCells(headerRow).forEach(function(cell, index) {
268
336
  var width = widths[index];
269
337
  if (!width) {
270
- cell.style.removeProperty("width");
271
- cell.style.removeProperty("min-width");
338
+ cell.style.removeProperty('width');
339
+ cell.style.removeProperty('min-width');
272
340
  return;
273
341
  }
274
342
 
@@ -279,13 +347,13 @@
279
347
 
280
348
  function widthCandidateRows(sourceTable, headerCellCount) {
281
349
  var candidates = [];
282
- var headerRow = sourceTable.querySelector("thead tr");
350
+ var headerRow = sourceTable.querySelector('thead tr');
283
351
 
284
352
  if (headerRow) {
285
353
  candidates.push(headerRow);
286
354
  }
287
355
 
288
- Array.from(sourceTable.querySelectorAll("tbody tr, tfoot tr")).forEach(function(row) {
356
+ Array.from(sourceTable.querySelectorAll('tbody tr, tfoot tr')).forEach(function(row) {
289
357
  var cells = directCells(row);
290
358
  if (cells.length !== headerCellCount || cells.some(function(cell) { return cell.colSpan > 1; })) return;
291
359
 
@@ -296,7 +364,7 @@
296
364
  }
297
365
 
298
366
  function hasMeasurableDataRow(sourceTable, headerCellCount) {
299
- return Array.from(sourceTable.querySelectorAll("tbody tr, tfoot tr")).some(function(row) {
367
+ return Array.from(sourceTable.querySelectorAll('tbody tr, tfoot tr')).some(function(row) {
300
368
  var cells = directCells(row);
301
369
  return cells.length === headerCellCount && !cells.some(function(cell) { return cell.colSpan > 1; });
302
370
  });
@@ -305,7 +373,7 @@
305
373
  function removeGeneratedColGroup(table) {
306
374
  if (!table) return;
307
375
 
308
- var colgroup = table.querySelector("colgroup[data-fixed-header-colgroup]");
376
+ var colgroup = table.querySelector('colgroup[data-fixed-header-colgroup]');
309
377
  if (colgroup) {
310
378
  colgroup.remove();
311
379
  }
@@ -314,11 +382,11 @@
314
382
  function generatedColGroupWidths(table, expectedCount) {
315
383
  if (!table) return [];
316
384
 
317
- var colgroup = table.querySelector("colgroup[data-fixed-header-colgroup]");
385
+ var colgroup = table.querySelector('colgroup[data-fixed-header-colgroup]');
318
386
  if (!colgroup) return [];
319
387
 
320
388
  var widths = Array.from(colgroup.children).map(function(col) {
321
- var inlineWidth = parseFloat(col.style.width || "0");
389
+ var inlineWidth = parseFloat(col.style.width || '0');
322
390
  return Number.isNaN(inlineWidth) ? 0 : preciseNumber(inlineWidth);
323
391
  });
324
392
 
@@ -327,7 +395,7 @@
327
395
  return widths;
328
396
  }
329
397
 
330
- function clearFixedHeaderState(slot, sourceTable) {
398
+ function clearFixedHeaderState(slot, scroll, sourceTable) {
331
399
  if (slot) {
332
400
  slot.hidden = true;
333
401
  }
@@ -335,13 +403,21 @@
335
403
  if (!sourceTable) return;
336
404
 
337
405
  removeGeneratedColGroup(sourceTable);
338
- sourceTable.classList.remove("table-with-fixed-header");
406
+ sourceTable.classList.remove('table-with-fixed-header');
407
+
408
+ if (sourceTable.classList.contains('home-table')) {
409
+ sourceTable.classList.remove('home-table--with-fixed-header');
410
+
411
+ if (scroll) {
412
+ scroll.classList.remove('home-table__wrapper--fixed-header-ready');
413
+ }
414
+ }
339
415
  }
340
416
 
341
417
  function measuredColumnWidths(sourceTable, fixedTable, options) {
342
418
  var settings = options || {};
343
- var sourceHead = sourceTable.querySelector("thead");
344
- var sourceRow = sourceHead && sourceHead.querySelector("tr");
419
+ var sourceHead = sourceTable.querySelector('thead');
420
+ var sourceRow = sourceHead && sourceHead.querySelector('tr');
345
421
 
346
422
  if (!sourceRow) return [];
347
423
 
@@ -362,7 +438,7 @@
362
438
  }
363
439
 
364
440
  if (!widths.some(Boolean) && fixedTable && settings.allowFixedTableFallback !== false) {
365
- var fixedRow = fixedTable.querySelector("thead tr");
441
+ var fixedRow = fixedTable.querySelector('thead tr');
366
442
  var fixedCells = fixedRow ? directCells(fixedRow) : [];
367
443
 
368
444
  fixedCells.forEach(function(cell, index) {
@@ -374,12 +450,12 @@
374
450
  }
375
451
 
376
452
  function applyFixedHeaderStickyColumns(sourceTable, fixedTable, widths) {
377
- var headerRow = fixedTable.querySelector("thead tr");
453
+ var headerRow = fixedTable.querySelector('thead tr');
378
454
  if (!headerRow) return;
379
455
 
380
456
  directCells(headerRow).forEach(function(cell) {
381
- cell.classList.remove("sticky-left", "sticky-left--last");
382
- cell.style.removeProperty("left");
457
+ cell.classList.remove('sticky-left', 'sticky-left--last');
458
+ cell.style.removeProperty('left');
383
459
  });
384
460
 
385
461
  var count = fixedColumnsCount(sourceTable);
@@ -388,9 +464,9 @@
388
464
  var offsets = stickyOffsets(widths.slice(0, count));
389
465
 
390
466
  directCells(headerRow).slice(0, offsets.length).forEach(function(cell, index) {
391
- cell.classList.add("sticky-left");
467
+ cell.classList.add('sticky-left');
392
468
  if (index === offsets.length - 1) {
393
- cell.classList.add("sticky-left--last");
469
+ cell.classList.add('sticky-left--last');
394
470
  }
395
471
  cell.style.left = cssPixelValue(offsets[index]);
396
472
  });
@@ -399,36 +475,36 @@
399
475
  function buildFixedTableHeader(slot, scroll, sourceTable) {
400
476
  if (!slot || !scroll || !sourceTable) return;
401
477
 
402
- var sourceHead = sourceTable.querySelector("thead");
478
+ var sourceHead = sourceTable.querySelector('thead');
403
479
  if (!sourceHead) {
404
- clearFixedHeaderState(slot, sourceTable);
480
+ clearFixedHeaderState(slot, scroll, sourceTable);
405
481
  return;
406
482
  }
407
483
 
408
- var sourceRow = sourceHead.querySelector("tr");
484
+ var sourceRow = sourceHead.querySelector('tr');
409
485
  var headerCells = sourceRow ? directCells(sourceRow) : [];
410
486
  var hasDataRow = hasMeasurableDataRow(sourceTable, headerCells.length);
411
487
 
412
488
  if (!headerCells.length) {
413
- clearFixedHeaderState(slot, sourceTable);
489
+ clearFixedHeaderState(slot, scroll, sourceTable);
414
490
  return;
415
491
  }
416
492
 
417
493
  var fixedScroll = ensureFixedHeaderScrollViewport(slot);
418
- var fixedTable = fixedScroll.querySelector(".table-fixed-header__table");
494
+ var fixedTable = fixedScroll.querySelector('.table-fixed-header__table');
419
495
  var fixedSpacer = ensureFixedHeaderSpacer(fixedScroll);
420
496
 
421
497
  if (!fixedTable) {
422
- fixedTable = document.createElement("table");
423
- fixedTable.setAttribute("aria-hidden", "true");
498
+ fixedTable = document.createElement('table');
499
+ fixedTable.setAttribute('aria-hidden', 'true');
424
500
  }
425
501
 
426
502
  fixedTable.className = fixedHeaderTableClassName(sourceTable);
427
- fixedTable.dataset.fixedColumnsCount = sourceTable.dataset.fixedColumnsCount || "0";
503
+ fixedTable.dataset.fixedColumnsCount = sourceTable.dataset.fixedColumnsCount || '0';
428
504
  fixedTable.innerHTML = sourceHead.outerHTML;
429
505
 
430
506
  if (fixedTable.parentNode !== fixedScroll) {
431
- fixedScroll.innerHTML = "";
507
+ fixedScroll.innerHTML = '';
432
508
  fixedScroll.appendChild(fixedTable);
433
509
  fixedScroll.appendChild(fixedSpacer);
434
510
  }
@@ -436,9 +512,8 @@
436
512
  var widths = measuredColumnWidths(sourceTable, fixedTable, {
437
513
  allowFixedTableFallback: hasDataRow
438
514
  });
439
-
440
515
  if (!widths.some(Boolean)) {
441
- clearFixedHeaderState(slot, sourceTable);
516
+ clearFixedHeaderState(slot, scroll, sourceTable);
442
517
  return;
443
518
  }
444
519
 
@@ -449,15 +524,20 @@
449
524
 
450
525
  var fixedScrollWidth = measuredTableWidth(sourceTable, widths);
451
526
 
452
- fixedTable.style.transform = "";
453
- fixedTable.style.marginLeft = "";
527
+ fixedTable.style.transform = '';
528
+ fixedTable.style.marginLeft = '';
454
529
  fixedTable.style.width = cssPixelValue(fixedScrollWidth);
455
- fixedSpacer.style.width = "0px";
456
- fixedSpacer.style.minWidth = "0px";
530
+ fixedSpacer.style.width = '0px';
531
+ fixedSpacer.style.minWidth = '0px';
457
532
  syncStickyPageHeader(scroll, slot);
458
533
  syncFixedHeaderScroll(scroll, fixedScroll);
459
534
 
460
- sourceTable.classList.add("table-with-fixed-header");
535
+ sourceTable.classList.add('table-with-fixed-header');
536
+ if (sourceTable.classList.contains('home-table')) {
537
+ sourceTable.classList.add('home-table--with-fixed-header');
538
+ scroll.classList.add('home-table__wrapper--fixed-header-ready');
539
+ }
540
+
461
541
  slot.hidden = false;
462
542
  }
463
543
 
@@ -480,35 +560,57 @@
480
560
  });
481
561
  }
482
562
 
483
- function observeFixedHeaderScroll(scroll) {
563
+ function observeSourceScroll(scroll) {
484
564
  if (observedScrolls.has(scroll)) return;
485
565
 
486
- scroll.addEventListener("scroll", function() {
487
- var state = scrollSyncStates.get(scroll) || {};
566
+ scroll.addEventListener('scroll', function() {
567
+ var state = ensureScrollSyncState(scroll);
568
+ if (consumeIgnoredScrollLeft(state, 'ignoredSourceScrollLeft', scroll.scrollLeft)) return;
569
+
488
570
  state.scrollLeft = scroll.scrollLeft;
571
+ state.sourceScrollLeft = scroll.scrollLeft;
489
572
 
490
- if (state.frame) return;
573
+ if (state.sourceFrame) return;
491
574
 
492
- state.frame = window.requestAnimationFrame(function() {
575
+ state.sourceFrame = window.requestAnimationFrame(function() {
493
576
  var slot = ensureFixedHeaderSlot(scroll);
494
- state.frame = null;
495
- syncFixedHeaderScroll(scroll, slot.querySelector(".table-fixed-header__scroll"), state.scrollLeft);
577
+ state.sourceFrame = null;
578
+ syncFixedHeaderScroll(scroll, ensureFixedHeaderScrollViewport(slot), state.sourceScrollLeft);
496
579
  });
497
-
498
- scrollSyncStates.set(scroll, state);
499
580
  }, { passive: true });
500
581
 
501
582
  observedScrolls.set(scroll, true);
502
583
  }
503
584
 
585
+ function observeFixedHeaderViewport(scroll, fixedScroll) {
586
+ if (!fixedScroll || observedFixedScrolls.get(fixedScroll) === scroll) return;
587
+
588
+ fixedScroll.addEventListener('scroll', function() {
589
+ var state = ensureScrollSyncState(scroll);
590
+ if (consumeIgnoredScrollLeft(state, 'ignoredFixedScrollLeft', fixedScroll.scrollLeft)) return;
591
+
592
+ state.fixedScrollLeft = fixedScroll.scrollLeft;
593
+
594
+ if (state.fixedFrame) return;
595
+
596
+ state.fixedFrame = window.requestAnimationFrame(function() {
597
+ state.fixedFrame = null;
598
+ syncSourceScroll(scroll, fixedScroll, state.fixedScrollLeft);
599
+ });
600
+ }, { passive: true });
601
+
602
+ observedFixedScrolls.set(fixedScroll, scroll);
603
+ }
604
+
504
605
  function initializeFixedHeaderForScroll(scroll) {
505
606
  var sourceTable = activeSourceTable(scroll);
506
607
  if (!sourceTable) return;
507
608
 
508
609
  var slot = ensureFixedHeaderSlot(scroll);
509
610
  buildFixedTableHeader(slot, scroll, sourceTable);
611
+ observeFixedHeaderViewport(scroll, slot.querySelector('.table-fixed-header__scroll'));
510
612
  observeFixedHeader(scroll);
511
- observeFixedHeaderScroll(scroll);
613
+ observeSourceScroll(scroll);
512
614
  }
513
615
 
514
616
  function initializeFixedHeaders(root) {
@@ -545,14 +647,14 @@
545
647
  initializeFixedHeaders(document);
546
648
  }
547
649
 
548
- if (document.readyState === "loading") {
549
- document.addEventListener("DOMContentLoaded", initializeFromDocument);
650
+ if (document.readyState === 'loading') {
651
+ document.addEventListener('DOMContentLoaded', initializeFromDocument);
550
652
  } else {
551
653
  initializeFromDocument();
552
654
  }
553
655
 
554
- document.addEventListener("turbo:load", initializeFromDocument);
555
- window.addEventListener("resize", initializeFromDocument);
656
+ document.addEventListener('turbo:load', initializeFromDocument);
657
+ window.addEventListener('resize', initializeFromDocument);
556
658
 
557
659
  if (window.MutationObserver) {
558
660
  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;
@@ -2,6 +2,6 @@
2
2
 
3
3
  module YummyGuide
4
4
  module Administrate
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yummy-guide-generic-administrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - akatsuki-kk