vgapp 1.3.3 → 1.3.5

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.
Files changed (89) hide show
  1. package/README.md +5 -12
  2. package/app/langs/en/buttons.json +17 -17
  3. package/app/langs/en/messages.json +36 -36
  4. package/app/langs/ru/buttons.json +17 -17
  5. package/app/langs/ru/messages.json +36 -36
  6. package/app/modules/base-module.js +111 -111
  7. package/app/modules/vgalert/js/vgalert.js +52 -52
  8. package/app/modules/vgalert/readme.md +105 -105
  9. package/app/modules/vgdynamictable/index.js +5 -5
  10. package/app/modules/vgdynamictable/js/editable.js +19 -19
  11. package/app/modules/vgdynamictable/js/filters.js +21 -21
  12. package/app/modules/vgdynamictable/js/fixed.js +179 -179
  13. package/app/modules/vgdynamictable/js/pagination.js +1 -1
  14. package/app/modules/vgdynamictable/js/search.js +12 -12
  15. package/app/modules/vgdynamictable/js/sortable.js +71 -71
  16. package/app/modules/vgdynamictable/js/summary-footer.js +28 -28
  17. package/app/modules/vgdynamictable/js/table-remote.js +79 -79
  18. package/app/modules/vgdynamictable/js/table-url-state.js +31 -31
  19. package/app/modules/vgdynamictable/js/utils/common.js +48 -48
  20. package/app/modules/vgdynamictable/js/vgdynamictable.js +268 -268
  21. package/app/modules/vgdynamictable/readme.md +250 -250
  22. package/app/modules/vgdynamictable/scss/_skeleton.scss +6 -6
  23. package/app/modules/vgdynamictable/scss/_sortable.scss +24 -24
  24. package/app/modules/vgdynamictable/scss/_table.scss +4 -4
  25. package/app/modules/vgdynamictable/scss/_variables.scss +79 -79
  26. package/app/modules/vgdynamictable/scss/vgdynamictable.scss +27 -27
  27. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  28. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  29. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  30. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  31. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  32. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  33. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  34. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  35. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  36. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  37. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  38. package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
  39. package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
  40. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  41. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  42. package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
  43. package/app/modules/vgfilepreview/readme.md +68 -68
  44. package/app/modules/vgfilepreview/scss/_variables.scss +113 -113
  45. package/app/modules/vgfilepreview/scss/vgfilepreview.scss +464 -464
  46. package/app/modules/vgfiles/js/base.js +26 -26
  47. package/app/modules/vgfiles/js/droppable.js +260 -260
  48. package/app/modules/vgfiles/js/render.js +153 -153
  49. package/app/modules/vgfiles/js/vgfiles.js +104 -104
  50. package/app/modules/vgfiles/readme.md +123 -123
  51. package/app/modules/vgfiles/scss/_variables.scss +18 -18
  52. package/app/modules/vgfiles/scss/vgfiles.scss +148 -148
  53. package/app/modules/vgformsender/js/hideshowpass.js +16 -16
  54. package/app/modules/vgformsender/scss/vgformsender.scss +34 -34
  55. package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
  56. package/app/modules/vgmodal/js/vgmodal.js +188 -188
  57. package/app/modules/vgmodal/js/vgmodal.resize.js +27 -27
  58. package/app/modules/vgmodal/scss/vgmodal.scss +14 -14
  59. package/app/modules/vgnav/js/vgnav.js +135 -135
  60. package/app/modules/vgnav/readme.md +67 -67
  61. package/app/modules/vgnestable/README.md +307 -307
  62. package/app/modules/vgnestable/scss/_variables.scss +60 -60
  63. package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
  64. package/app/modules/vgrangeslider/js/skins.js +222 -222
  65. package/app/modules/vgrangeslider/js/vgrangeslider.js +704 -704
  66. package/app/modules/vgrangeslider/readme.md +523 -523
  67. package/app/modules/vgrangeslider/scss/_variables.scss +53 -53
  68. package/app/modules/vgrangeslider/scss/vgrangeslider.scss +240 -240
  69. package/app/modules/vgselect/js/vgselect.js +39 -39
  70. package/app/modules/vgselect/scss/vgselect.scss +22 -22
  71. package/app/modules/vgspy/readme.md +28 -28
  72. package/app/modules/vgtoast/readme.md +18 -18
  73. package/app/modules/vgtoast/scss/vgtoast.scss +48 -48
  74. package/app/modules/vgtooltip/js/vgtooltip.js +89 -89
  75. package/app/modules/vgtooltip/readme.md +181 -181
  76. package/app/utils/js/components/ajax.js +117 -117
  77. package/app/utils/js/components/audio-metadata.js +240 -240
  78. package/app/utils/js/components/backdrop.js +17 -17
  79. package/app/utils/js/components/file-icon.js +109 -109
  80. package/app/utils/js/components/file-preview.js +304 -304
  81. package/app/utils/js/components/sanitize.js +150 -150
  82. package/app/utils/js/components/video-metadata.js +140 -140
  83. package/app/vgapp.js +21 -21
  84. package/build/vgapp.css +1 -1
  85. package/build/vgapp.css.map +1 -1
  86. package/build/vgapp.js +1 -1
  87. package/build/vgapp.js.map +1 -1
  88. package/index.js +14 -14
  89. package/package.json +3 -2
@@ -13,56 +13,56 @@ const fixedColumnsMethods = {
13
13
  return String(raw || '').trim();
14
14
  },
15
15
 
16
- _hasFixedColumnsConfig() {
17
- const attr = this._getFixedColumnsConfigRaw();
18
- if (attr !== '') {
19
- return true;
20
- }
16
+ _hasFixedColumnsConfig() {
17
+ const attr = this._getFixedColumnsConfigRaw();
18
+ if (attr !== '') {
19
+ return true;
20
+ }
21
21
  const headers = this._element && this._element.tHead
22
22
  ? Array.from(this._element.tHead.querySelectorAll('th'))
23
23
  : [];
24
24
  return headers.some((header) => {
25
25
  const fixedAttr = String(header.getAttribute('data-fixed') || '').toLowerCase().trim();
26
26
  const fixedColumnAttr = String(header.getAttribute('data-fixed-column') || '').toLowerCase().trim();
27
- return fixedAttr === 'left' || fixedAttr === 'right' || fixedColumnAttr === 'left' || fixedColumnAttr === 'right';
28
- });
29
- },
30
-
31
- _buildFixedColumnsStateMap(fixed) {
32
- const state = new Map();
33
- const left = Array.isArray(fixed && fixed.left) ? fixed.left : [];
34
- const right = Array.isArray(fixed && fixed.right) ? fixed.right : [];
35
- left.forEach((index) => {
36
- if (Number.isInteger(index) && index >= 0) {
37
- state.set(index, 'left');
38
- }
39
- });
40
- right.forEach((index) => {
41
- if (Number.isInteger(index) && index >= 0 && !state.has(index)) {
42
- state.set(index, 'right');
43
- }
44
- });
45
- return state;
46
- },
47
-
48
- _collectFixedColumnsTransitions(nextState) {
49
- const previousState = this._fixedColumnsLastStateMap instanceof Map
50
- ? this._fixedColumnsLastStateMap
51
- : new Map();
52
- const transitions = [];
53
- nextState.forEach((side, index) => {
54
- if (previousState.get(index) !== side) {
55
- transitions.push({ index, side });
56
- }
57
- });
58
- this._fixedColumnsLastStateMap = nextState;
59
- return transitions;
60
- },
61
-
62
- _applyFixedColumnsLayout() {
63
- if (!this._element) {
64
- return;
65
- }
27
+ return fixedAttr === 'left' || fixedAttr === 'right' || fixedColumnAttr === 'left' || fixedColumnAttr === 'right';
28
+ });
29
+ },
30
+
31
+ _buildFixedColumnsStateMap(fixed) {
32
+ const state = new Map();
33
+ const left = Array.isArray(fixed && fixed.left) ? fixed.left : [];
34
+ const right = Array.isArray(fixed && fixed.right) ? fixed.right : [];
35
+ left.forEach((index) => {
36
+ if (Number.isInteger(index) && index >= 0) {
37
+ state.set(index, 'left');
38
+ }
39
+ });
40
+ right.forEach((index) => {
41
+ if (Number.isInteger(index) && index >= 0 && !state.has(index)) {
42
+ state.set(index, 'right');
43
+ }
44
+ });
45
+ return state;
46
+ },
47
+
48
+ _collectFixedColumnsTransitions(nextState) {
49
+ const previousState = this._fixedColumnsLastStateMap instanceof Map
50
+ ? this._fixedColumnsLastStateMap
51
+ : new Map();
52
+ const transitions = [];
53
+ nextState.forEach((side, index) => {
54
+ if (previousState.get(index) !== side) {
55
+ transitions.push({ index, side });
56
+ }
57
+ });
58
+ this._fixedColumnsLastStateMap = nextState;
59
+ return transitions;
60
+ },
61
+
62
+ _applyFixedColumnsLayout() {
63
+ if (!this._element) {
64
+ return;
65
+ }
66
66
  const suppressFixedColumns = Boolean(this._fixedColumnsSuppressed);
67
67
 
68
68
  const sourceHeaders = this._element.tHead ? Array.from(this._element.tHead.querySelectorAll('th')) : [];
@@ -74,40 +74,40 @@ const fixedColumnsMethods = {
74
74
  ? { left: [], right: [] }
75
75
  : this._applyMobileFixedColumnsGuard(this._element, sourceFixedRaw);
76
76
  const hasSourceFixed = sourceFixed.left.length > 0 || sourceFixed.right.length > 0;
77
- this._element.classList.toggle('table-fixed-cols', hasSourceFixed);
78
- if (this._parent) {
79
- this._parent.classList.toggle('table-fixed-cols', hasSourceFixed);
80
- }
81
- const sourceFixedTransitions = this._collectFixedColumnsTransitions(
82
- this._buildFixedColumnsStateMap(sourceFixed)
83
- );
84
- this._applyFixedColumnsToTable(this._element, sourceFixed, {
85
- includeBody: true,
86
- emitAction: true,
87
- transitionedColumns: sourceFixedTransitions,
88
- });
89
- this._toggleFixedColumnsScrollBinding(hasSourceFixed);
90
-
91
- const cloneTable = this._cloneStickyState && this._cloneStickyState.table
92
- ? this._cloneStickyState.table
93
- : null;
77
+ this._element.classList.toggle('table-fixed-cols', hasSourceFixed);
78
+ if (this._parent) {
79
+ this._parent.classList.toggle('table-fixed-cols', hasSourceFixed);
80
+ }
81
+ const sourceFixedTransitions = this._collectFixedColumnsTransitions(
82
+ this._buildFixedColumnsStateMap(sourceFixed)
83
+ );
84
+ this._applyFixedColumnsToTable(this._element, sourceFixed, {
85
+ includeBody: true,
86
+ emitAction: true,
87
+ transitionedColumns: sourceFixedTransitions,
88
+ });
89
+ this._toggleFixedColumnsScrollBinding(hasSourceFixed);
90
+
91
+ const cloneTable = this._cloneStickyState && this._cloneStickyState.table
92
+ ? this._cloneStickyState.table
93
+ : null;
94
94
  if (cloneTable) {
95
95
  const cloneHeaders = cloneTable.tHead ? Array.from(cloneTable.tHead.querySelectorAll('th')) : [];
96
96
  const cloneFixedRaw = this._getFixedColumnsByHeaders(cloneHeaders, {
97
97
  parseTableAttr: false,
98
98
  fallbackByPosition: false,
99
99
  });
100
- const cloneFixed = hasSourceFixed
101
- ? this._applyMobileFixedColumnsGuard(cloneTable, cloneFixedRaw)
102
- : { left: [], right: [] };
103
- this._applyFixedColumnsToTable(cloneTable, cloneFixed, {
104
- includeBody: false,
105
- emitAction: false,
106
- });
107
- }
108
- this._rebuildFixedColumnsCellsCache();
109
- this._syncFixedColumnsScroll({ immediate: true });
110
- },
100
+ const cloneFixed = hasSourceFixed
101
+ ? this._applyMobileFixedColumnsGuard(cloneTable, cloneFixedRaw)
102
+ : { left: [], right: [] };
103
+ this._applyFixedColumnsToTable(cloneTable, cloneFixed, {
104
+ includeBody: false,
105
+ emitAction: false,
106
+ });
107
+ }
108
+ this._rebuildFixedColumnsCellsCache();
109
+ this._syncFixedColumnsScroll({ immediate: true });
110
+ },
111
111
 
112
112
  _applyMobileFixedColumnsGuard(table, fixed) {
113
113
  const next = {
@@ -234,19 +234,19 @@ const fixedColumnsMethods = {
234
234
  return { left, right };
235
235
  },
236
236
 
237
- _applyFixedColumnsToTable(table, fixed, options = {}) {
238
- if (!table) {
239
- return;
240
- }
241
- const includeBody = options.includeBody !== false;
242
- const shouldEmitAction = options.emitAction !== false;
243
- const transitionedColumns = Array.isArray(options.transitionedColumns)
244
- ? options.transitionedColumns
245
- : [];
246
- const sections = [];
247
- if (table.tHead) {
248
- sections.push(table.tHead);
249
- }
237
+ _applyFixedColumnsToTable(table, fixed, options = {}) {
238
+ if (!table) {
239
+ return;
240
+ }
241
+ const includeBody = options.includeBody !== false;
242
+ const shouldEmitAction = options.emitAction !== false;
243
+ const transitionedColumns = Array.isArray(options.transitionedColumns)
244
+ ? options.transitionedColumns
245
+ : [];
246
+ const sections = [];
247
+ if (table.tHead) {
248
+ sections.push(table.tHead);
249
+ }
250
250
  if (includeBody && table.tBodies && table.tBodies.length) {
251
251
  sections.push(...Array.from(table.tBodies));
252
252
  }
@@ -282,17 +282,17 @@ const fixedColumnsMethods = {
282
282
  ? viewportMetrics.effectiveWidth
283
283
  : tableRect.width;
284
284
  const metrics = {};
285
- headerCells.forEach((cell, index) => {
286
- const rect = cell.getBoundingClientRect();
287
- metrics[index] = {
288
- width: Math.max(0, rect.width),
289
- left: Math.max(0, rect.left - tableRect.left),
290
- height: Math.max(0, rect.height),
291
- top: Math.max(0, rect.top - tableRect.top),
292
- };
293
- });
294
- const leftOffsets = {};
295
- let leftOffset = 0;
285
+ headerCells.forEach((cell, index) => {
286
+ const rect = cell.getBoundingClientRect();
287
+ metrics[index] = {
288
+ width: Math.max(0, rect.width),
289
+ left: Math.max(0, rect.left - tableRect.left),
290
+ height: Math.max(0, rect.height),
291
+ top: Math.max(0, rect.top - tableRect.top),
292
+ };
293
+ });
294
+ const leftOffsets = {};
295
+ let leftOffset = 0;
296
296
  fixed.left.forEach((index) => {
297
297
  const width = metrics[index] ? metrics[index].width : 0;
298
298
  leftOffsets[index] = leftOffset;
@@ -318,10 +318,10 @@ const fixedColumnsMethods = {
318
318
  if (!cell) {
319
319
  return;
320
320
  }
321
- const metric = metrics[index] || { left: 0 };
322
- const baseShift = leftOffsets[index] - metric.left;
323
- cell.setAttribute('data-fixed-side', 'left');
324
- cell.setAttribute('data-fixed-shift', String(baseShift));
321
+ const metric = metrics[index] || { left: 0 };
322
+ const baseShift = leftOffsets[index] - metric.left;
323
+ cell.setAttribute('data-fixed-side', 'left');
324
+ cell.setAttribute('data-fixed-shift', String(baseShift));
325
325
  cell.style.zIndex = String(zIndex);
326
326
  if (index === leftEdgeIndex) {
327
327
  cell.setAttribute('data-fixed-edge', 'right');
@@ -333,83 +333,83 @@ const fixedColumnsMethods = {
333
333
  if (!cell) {
334
334
  return;
335
335
  }
336
- const metric = metrics[index] || { left: 0, width: 0 };
337
- const desiredLeft = viewportWidth - rightOffsets[index] - metric.width;
338
- const baseShift = desiredLeft - metric.left;
339
- cell.setAttribute('data-fixed-side', 'right');
336
+ const metric = metrics[index] || { left: 0, width: 0 };
337
+ const desiredLeft = viewportWidth - rightOffsets[index] - metric.width;
338
+ const baseShift = desiredLeft - metric.left;
339
+ cell.setAttribute('data-fixed-side', 'right');
340
340
  cell.setAttribute('data-fixed-shift', String(baseShift));
341
341
  cell.style.zIndex = String(zIndex);
342
342
  if (index === rightEdgeIndex) {
343
343
  cell.setAttribute('data-fixed-edge', 'left');
344
- }
345
- });
346
- });
347
-
348
- if (!shouldEmitAction || typeof this._emitAction !== 'function' || !transitionedColumns.length) {
349
- return;
350
- }
351
-
352
- transitionedColumns.forEach((entry) => {
353
- const index = Number.isInteger(entry && entry.index) ? entry.index : -1;
354
- const side = entry && (entry.side === 'left' || entry.side === 'right')
355
- ? entry.side
356
- : '';
357
- const headerCell = index >= 0 && index < headerCells.length
358
- ? headerCells[index]
359
- : null;
360
- if (!headerCell || !side) {
361
- return;
362
- }
363
-
364
- const metric = metrics[index] || { left: 0, width: 0, top: 0, height: 0 };
365
- const width = metric.width || 0;
366
- const height = metric.height || 0;
367
- const left = side === 'left'
368
- ? (leftOffsets[index] || 0)
369
- : Math.max(0, viewportWidth - (rightOffsets[index] || 0) - width);
370
- const right = side === 'right'
371
- ? (rightOffsets[index] || 0)
372
- : Math.max(0, viewportWidth - left - width);
373
- const top = metric.top || 0;
374
- const bottom = Math.max(0, tableRect.height - top - height);
375
- const field = String(headerCell.getAttribute('data-field') || '').trim();
376
- const fallbackBaseShift = left - (metric.left || 0);
377
- const attrBaseShift = Number.parseFloat(headerCell.getAttribute('data-fixed-shift') || '');
378
- const baseShift = Number.isFinite(attrBaseShift) ? attrBaseShift : fallbackBaseShift;
379
- const scrollLeft = this._tableViewport ? (this._tableViewport.scrollLeft || 0) : 0;
380
- const fixedAtTs = Date.now();
381
-
382
- this._emitAction('columnfixed', {
383
- columnIndex: index,
384
- side,
385
- phase: 'fixed',
386
- field,
387
- column: {
388
- index,
389
- side,
390
- field,
391
- width,
392
- height,
393
- element: headerCell,
394
- },
395
- offsets: {
396
- left,
397
- right,
398
- top,
399
- bottom,
400
- },
401
- shift: {
402
- base: baseShift,
403
- current: baseShift + scrollLeft,
404
- scrollLeft,
405
- },
406
- fixedAt: {
407
- timestamp: fixedAtTs,
408
- iso: new Date(fixedAtTs).toISOString(),
409
- },
410
- });
411
- });
412
- },
344
+ }
345
+ });
346
+ });
347
+
348
+ if (!shouldEmitAction || typeof this._emitAction !== 'function' || !transitionedColumns.length) {
349
+ return;
350
+ }
351
+
352
+ transitionedColumns.forEach((entry) => {
353
+ const index = Number.isInteger(entry && entry.index) ? entry.index : -1;
354
+ const side = entry && (entry.side === 'left' || entry.side === 'right')
355
+ ? entry.side
356
+ : '';
357
+ const headerCell = index >= 0 && index < headerCells.length
358
+ ? headerCells[index]
359
+ : null;
360
+ if (!headerCell || !side) {
361
+ return;
362
+ }
363
+
364
+ const metric = metrics[index] || { left: 0, width: 0, top: 0, height: 0 };
365
+ const width = metric.width || 0;
366
+ const height = metric.height || 0;
367
+ const left = side === 'left'
368
+ ? (leftOffsets[index] || 0)
369
+ : Math.max(0, viewportWidth - (rightOffsets[index] || 0) - width);
370
+ const right = side === 'right'
371
+ ? (rightOffsets[index] || 0)
372
+ : Math.max(0, viewportWidth - left - width);
373
+ const top = metric.top || 0;
374
+ const bottom = Math.max(0, tableRect.height - top - height);
375
+ const field = String(headerCell.getAttribute('data-field') || '').trim();
376
+ const fallbackBaseShift = left - (metric.left || 0);
377
+ const attrBaseShift = Number.parseFloat(headerCell.getAttribute('data-fixed-shift') || '');
378
+ const baseShift = Number.isFinite(attrBaseShift) ? attrBaseShift : fallbackBaseShift;
379
+ const scrollLeft = this._tableViewport ? (this._tableViewport.scrollLeft || 0) : 0;
380
+ const fixedAtTs = Date.now();
381
+
382
+ this._emitAction('columnfixed', {
383
+ columnIndex: index,
384
+ side,
385
+ phase: 'fixed',
386
+ field,
387
+ column: {
388
+ index,
389
+ side,
390
+ field,
391
+ width,
392
+ height,
393
+ element: headerCell,
394
+ },
395
+ offsets: {
396
+ left,
397
+ right,
398
+ top,
399
+ bottom,
400
+ },
401
+ shift: {
402
+ base: baseShift,
403
+ current: baseShift + scrollLeft,
404
+ scrollLeft,
405
+ },
406
+ fixedAt: {
407
+ timestamp: fixedAtTs,
408
+ iso: new Date(fixedAtTs).toISOString(),
409
+ },
410
+ });
411
+ });
412
+ },
413
413
 
414
414
  _toggleFixedColumnsScrollBinding(enabled) {
415
415
  if (!this._tableViewport) {
@@ -436,12 +436,12 @@ const fixedColumnsMethods = {
436
436
  }
437
437
  this._fixedColumnsSyncFrame = 0;
438
438
  this._fixedColumnsLastScrollLeft = 0;
439
- this._fixedColumnsLastAppliedScrollLeft = Number.NaN;
440
- this._fixedColumnsLastShadowStateKey = '';
441
- this._fixedColumnsCellsCache = [];
442
- this._fixedColumnsShadowTargetsCache = [];
443
- this._fixedColumnsLastStateMap = new Map();
444
- },
439
+ this._fixedColumnsLastAppliedScrollLeft = Number.NaN;
440
+ this._fixedColumnsLastShadowStateKey = '';
441
+ this._fixedColumnsCellsCache = [];
442
+ this._fixedColumnsShadowTargetsCache = [];
443
+ this._fixedColumnsLastStateMap = new Map();
444
+ },
445
445
 
446
446
  _rebuildFixedColumnsCellsCache() {
447
447
  const tables = [this._element];
@@ -1,4 +1,4 @@
1
- import VGDropdown from "../../vgdropdown";
1
+ import VGDropdown from "../../vgdropdown";
2
2
 
3
3
  class Pagination {
4
4
  constructor(el, params = {}) {
@@ -1,6 +1,6 @@
1
- import {normalizeNonNegativeInt, safeQuerySelector} from "./utils/common";
2
-
3
- class Search {
1
+ import {normalizeNonNegativeInt, safeQuerySelector} from "./utils/common";
2
+
3
+ class Search {
4
4
  constructor(options = {}) {
5
5
  this._options = Object.assign({
6
6
  enabled: true,
@@ -27,10 +27,10 @@ class Search {
27
27
  return;
28
28
  }
29
29
 
30
- const input = safeQuerySelector(selector);
31
- if (!input) {
32
- return;
33
- }
30
+ const input = safeQuerySelector(selector);
31
+ if (!input) {
32
+ return;
33
+ }
34
34
 
35
35
  this._input = input;
36
36
  this._input.addEventListener('input', this._boundInput);
@@ -50,10 +50,10 @@ class Search {
50
50
  }
51
51
 
52
52
  _handleInput() {
53
- clearTimeout(this._timer);
54
- this._timer = setTimeout(() => {
55
- this._emit();
56
- }, normalizeNonNegativeInt(this._options.debounceMs, 300));
53
+ clearTimeout(this._timer);
54
+ this._timer = setTimeout(() => {
55
+ this._emit();
56
+ }, normalizeNonNegativeInt(this._options.debounceMs, 300));
57
57
  }
58
58
 
59
59
  _handleKeyDown(event) {
@@ -76,7 +76,7 @@ class Search {
76
76
  param: String(this._options.param || 'q'),
77
77
  });
78
78
  }
79
- }
79
+ }
80
80
 
81
81
  export default Search;
82
82
 
@@ -8,11 +8,11 @@ class Sortable {
8
8
  ascLabel: 'Сортировка по возрастанию',
9
9
  descLabel: 'Сортировка по убыванию',
10
10
  isColumnSortable: null,
11
- onChange: null,
12
- multiSort: false,
13
- multiSortWithShift: true,
14
- hideUnsortedArrows: false,
15
- }, options);
11
+ onChange: null,
12
+ multiSort: false,
13
+ multiSortWithShift: true,
14
+ hideUnsortedArrows: false,
15
+ }, options);
16
16
 
17
17
  this._headers = [];
18
18
  this._sorts = [];
@@ -21,12 +21,12 @@ class Sortable {
21
21
  this._boundKeyDown = this._handleKeyDown.bind(this);
22
22
  }
23
23
 
24
- init() {
25
- this._headers = this._getHeaders();
26
- if (!this._headers.length) {
27
- return;
28
- }
29
- this._syncControlsVisibilityMode();
24
+ init() {
25
+ this._headers = this._getHeaders();
26
+ if (!this._headers.length) {
27
+ return;
28
+ }
29
+ this._syncControlsVisibilityMode();
30
30
 
31
31
  this._headers.forEach((header, index) => {
32
32
  if (!this._isSortable(header, index)) {
@@ -64,12 +64,12 @@ class Sortable {
64
64
  this._setSorts([{ index, dir: this._normalizeDir(payload.dir) }], false);
65
65
  }
66
66
 
67
- refresh(payload = {}) {
68
- this._headers = this._getHeaders();
69
- if (!this._headers.length) {
70
- return;
71
- }
72
- this._syncControlsVisibilityMode();
67
+ refresh(payload = {}) {
68
+ this._headers = this._getHeaders();
69
+ if (!this._headers.length) {
70
+ return;
71
+ }
72
+ this._syncControlsVisibilityMode();
73
73
 
74
74
  this._headers.forEach((header, index) => {
75
75
  if (!this._isSortable(header, index)) {
@@ -97,17 +97,17 @@ class Sortable {
97
97
  this._setSorts(this._normalizeSorts(this._sorts), false);
98
98
  }
99
99
 
100
- _applyInitialState() {
101
- const index = this._resolveIndex({
102
- field: this._options.initialField,
103
- columnIndex: -1,
104
- });
105
- if (index < 0 || !this._isSortable(this._headers[index], index)) {
106
- this._setSorts([], false);
107
- return;
108
- }
109
- this._setSorts([{ index, dir: this._normalizeDir(this._options.initialDir) }], false);
110
- }
100
+ _applyInitialState() {
101
+ const index = this._resolveIndex({
102
+ field: this._options.initialField,
103
+ columnIndex: -1,
104
+ });
105
+ if (index < 0 || !this._isSortable(this._headers[index], index)) {
106
+ this._setSorts([], false);
107
+ return;
108
+ }
109
+ this._setSorts([{ index, dir: this._normalizeDir(this._options.initialDir) }], false);
110
+ }
111
111
 
112
112
  _getHeaders() {
113
113
  const head = this._table.tHead || this._table.querySelector('thead');
@@ -221,29 +221,29 @@ class Sortable {
221
221
  });
222
222
  });
223
223
 
224
- this._headers.forEach((header, headerIndex) => {
225
- const sort = sortByIndex.has(headerIndex) ? sortByIndex.get(headerIndex) : null;
226
- if (!this._isSortable(header, headerIndex)) {
227
- header.removeAttribute('data-sort-direction');
228
- header.removeAttribute('data-sort-priority');
229
- header.setAttribute('aria-sort', 'none');
230
- return;
231
- }
232
-
233
- const controls = this._getHeaderControls(header);
234
- const controlsNode = controls.controlsNode;
235
- const ascButton = controls.ascButton;
236
- const descButton = controls.descButton;
237
- const shouldHideControls = Boolean(this._options.hideUnsortedArrows && !sort);
238
-
239
- if (controlsNode) {
240
- controlsNode.hidden = shouldHideControls;
241
- }
242
-
243
- if (sort) {
244
- header.dataset.sortDirection = sort.dir;
245
- header.dataset.sortPriority = String(sort.priority);
246
- header.setAttribute('aria-sort', sort.dir === 'asc' ? 'ascending' : 'descending');
224
+ this._headers.forEach((header, headerIndex) => {
225
+ const sort = sortByIndex.has(headerIndex) ? sortByIndex.get(headerIndex) : null;
226
+ if (!this._isSortable(header, headerIndex)) {
227
+ header.removeAttribute('data-sort-direction');
228
+ header.removeAttribute('data-sort-priority');
229
+ header.setAttribute('aria-sort', 'none');
230
+ return;
231
+ }
232
+
233
+ const controls = this._getHeaderControls(header);
234
+ const controlsNode = controls.controlsNode;
235
+ const ascButton = controls.ascButton;
236
+ const descButton = controls.descButton;
237
+ const shouldHideControls = Boolean(this._options.hideUnsortedArrows && !sort);
238
+
239
+ if (controlsNode) {
240
+ controlsNode.hidden = shouldHideControls;
241
+ }
242
+
243
+ if (sort) {
244
+ header.dataset.sortDirection = sort.dir;
245
+ header.dataset.sortPriority = String(sort.priority);
246
+ header.setAttribute('aria-sort', sort.dir === 'asc' ? 'ascending' : 'descending');
247
247
  if (ascButton) ascButton.setAttribute('aria-pressed', sort.dir === 'asc' ? 'true' : 'false');
248
248
  if (descButton) descButton.setAttribute('aria-pressed', sort.dir === 'desc' ? 'true' : 'false');
249
249
  } else {
@@ -370,11 +370,11 @@ class Sortable {
370
370
  if (this._headerControls.has(header)) {
371
371
  return this._headerControls.get(header);
372
372
  }
373
- const controls = {
374
- controlsNode: header.querySelector('.vgdt-sort-controls'),
375
- ascButton: header.querySelector('[data-sort-arrow="asc"]'),
376
- descButton: header.querySelector('[data-sort-arrow="desc"]'),
377
- };
373
+ const controls = {
374
+ controlsNode: header.querySelector('.vgdt-sort-controls'),
375
+ ascButton: header.querySelector('[data-sort-arrow="asc"]'),
376
+ descButton: header.querySelector('[data-sort-arrow="desc"]'),
377
+ };
378
378
  this._headerControls.set(header, controls);
379
379
  return controls;
380
380
  }
@@ -412,21 +412,21 @@ class Sortable {
412
412
  return directions.includes(normalized) ? normalized : directions[0];
413
413
  }
414
414
 
415
- _getDirections() {
416
- const list = Array.isArray(this._options.directions) ? this._options.directions : ['asc', 'desc'];
417
- const normalized = list
418
- .map((item) => String(item).toLowerCase().trim())
419
- .filter((item) => item === 'asc' || item === 'desc');
420
- return normalized.length ? Array.from(new Set(normalized)) : ['asc', 'desc'];
421
- }
422
-
423
- _syncControlsVisibilityMode() {
424
- if (this._options.hideUnsortedArrows) {
425
- this._table.setAttribute('data-sort-hide-unsorted-arrows', '1');
426
- return;
427
- }
428
- this._table.removeAttribute('data-sort-hide-unsorted-arrows');
429
- }
415
+ _getDirections() {
416
+ const list = Array.isArray(this._options.directions) ? this._options.directions : ['asc', 'desc'];
417
+ const normalized = list
418
+ .map((item) => String(item).toLowerCase().trim())
419
+ .filter((item) => item === 'asc' || item === 'desc');
420
+ return normalized.length ? Array.from(new Set(normalized)) : ['asc', 'desc'];
421
+ }
422
+
423
+ _syncControlsVisibilityMode() {
424
+ if (this._options.hideUnsortedArrows) {
425
+ this._table.setAttribute('data-sort-hide-unsorted-arrows', '1');
426
+ return;
427
+ }
428
+ this._table.removeAttribute('data-sort-hide-unsorted-arrows');
429
+ }
430
430
 
431
431
  _escapeAttr(value) {
432
432
  return String(value)