pivotgrid-js 0.1.2 → 0.1.4

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.
package/widget/i18n.js CHANGED
@@ -91,6 +91,8 @@ const I18N = {
91
91
  ce_confirmDelete: 'Удалить конфиг «{name}»?',
92
92
  ce_deleteOk: 'Конфиг «{name}» удалён',
93
93
  ce_deleteFailed: 'Ошибка удаления: ',
94
+ gridGrow: '⤓ Увеличить',
95
+ gridShrink: '⤒ Уменьшить',
94
96
  },
95
97
  en: {
96
98
  loading: 'Loading...',
@@ -175,5 +177,7 @@ const I18N = {
175
177
  ce_confirmDelete: 'Delete config "{name}"?',
176
178
  ce_deleteOk: 'Config "{name}" deleted',
177
179
  ce_deleteFailed: 'Delete error: ',
180
+ gridGrow: '⤓ Increase',
181
+ gridShrink: '⤒ Decrease',
178
182
  },
179
183
  };
@@ -100,6 +100,9 @@ function buildHTML() {
100
100
  <div class="toolbar-sep"></div>
101
101
  <button class="toolbar-btn toolbar-btn--toggle" id="btn-subtotals">${t('subtotals')}</button>
102
102
  <button class="toolbar-btn" id="btn-export">${t('exportCsv')}</button>
103
+ <div class="toolbar-sep"></div>
104
+ <button class="toolbar-btn" id="btn-grid-grow">${t('gridGrow')}</button>
105
+ <button class="toolbar-btn" id="btn-grid-shrink">${t('gridShrink')}</button>
103
106
  </div>
104
107
 
105
108
  <div id="loading" style="
@@ -146,6 +149,8 @@ if (isEmpty) {
146
149
  pivotEl.innerHTML = buildHTML();
147
150
  }
148
151
 
152
+ const flexWrapper = isEmpty ? pivotEl : document.body;
153
+
149
154
  const gridEl = isEmpty
150
155
  ? document.getElementById('pivot-grid')
151
156
  : pivotEl;
@@ -355,6 +360,20 @@ function initToolbar() {
355
360
  document.getElementById('chk-fields').addEventListener('change', (e) => {
356
361
  document.querySelector('.field-zones').style.display = e.target.checked ? '' : 'none';
357
362
  });
363
+
364
+ document.getElementById('btn-grid-grow').addEventListener('click', () => {
365
+ grid?.growHeight();
366
+ flexWrapper.style.height = ''; // снимаем фиксированную высоту — даём расти
367
+ flexWrapper.style.overflow = 'auto'; // и скроллиться странице
368
+ });
369
+
370
+ document.getElementById('btn-grid-shrink').addEventListener('click', () => {
371
+ const backToOriginal = grid?.shrinkHeight();
372
+ if (backToOriginal) {
373
+ flexWrapper.style.height = '100dvh'; // вернули исходное поведение
374
+ flexWrapper.style.overflow = 'hidden';
375
+ }
376
+ });
358
377
  }
359
378
 
360
379
  // ── CSV export ────────────────────────────────────────────────────────────────