melondtable 1.20.7 → 1.21.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.
package/LICENSE CHANGED
@@ -1,2 +0,0 @@
1
- The MIT License
2
-
@@ -2206,14 +2206,18 @@ class DataManager {
2206
2206
  }
2207
2207
  }
2208
2208
 
2209
+ const sortValue = cell => {
2210
+ const hook = cell.column && cell.column.sortValue;
2211
+ const value = hook ? hook(cell) : cell.content;
2212
+ return value == null ? '' : value;
2213
+ };
2214
+
2209
2215
  this.rowViewOrder.sort((a, b) => {
2210
2216
  const aIndex = a;
2211
2217
  const bIndex = b;
2212
2218
 
2213
- let aContent = this.getCell(colIndex, a).content;
2214
- let bContent = this.getCell(colIndex, b).content;
2215
- aContent = aContent == null ? '' : aContent;
2216
- bContent = bContent == null ? '' : bContent;
2219
+ const aContent = sortValue(this.getCell(colIndex, a));
2220
+ const bContent = sortValue(this.getCell(colIndex, b));
2217
2221
 
2218
2222
  if (sortOrder === 'none') {
2219
2223
  return aIndex - bIndex;
@@ -3666,12 +3670,6 @@ class ColumnManager {
3666
3670
  document.body.classList.remove('dt-resize');
3667
3671
  if (!$resizingCell) return;
3668
3672
  isDragging = false;
3669
-
3670
- const {
3671
- colIndex
3672
- } = $.data($resizingCell);
3673
- this.setColumnWidth(colIndex);
3674
- this.style.setBodyStyle();
3675
3673
  $resizingCell = null;
3676
3674
  };
3677
3675
  $.on(document.body, 'mouseup', onMouseup);
@@ -3699,6 +3697,9 @@ class ColumnManager {
3699
3697
  width: finalWidth
3700
3698
  });
3701
3699
  this.setColumnHeaderWidth(colIndex);
3700
+ this.setColumnWidth(colIndex);
3701
+ this.style.refreshStickyColumns();
3702
+ this.style.setBodyStyle();
3702
3703
  };
3703
3704
  $.on(document.body, 'mousemove', onMouseMove);
3704
3705
  this.instance.on('onDestroy', () => {
@@ -3735,6 +3736,7 @@ class ColumnManager {
3735
3736
  this.datamanager.updateColumn(colIndex, { width });
3736
3737
  this.setColumnHeaderWidth(colIndex);
3737
3738
  this.setColumnWidth(colIndex);
3739
+ this.style.refreshStickyColumns();
3738
3740
  });
3739
3741
  }
3740
3742
 
@@ -5162,8 +5164,7 @@ class Style {
5162
5164
  this.setupColumnWidth();
5163
5165
  this.distributeRemainingWidth();
5164
5166
  this.setColumnStyle();
5165
- this.setStickyColumnStyle();
5166
- this.updateStickyTopPositions(this.bodyScrollable.scrollLeft || 0);
5167
+ this.refreshStickyColumns();
5167
5168
  this.setBodyStyle();
5168
5169
  }
5169
5170
 
@@ -5321,6 +5322,10 @@ class Style {
5321
5322
  this.columnmanager.setColumnHeaderWidth(column.colIndex);
5322
5323
  this.columnmanager.setColumnWidth(column.colIndex);
5323
5324
  });
5325
+ this.refreshStickyColumns();
5326
+ }
5327
+
5328
+ refreshStickyColumns() {
5324
5329
  this.setStickyColumnStyle();
5325
5330
  this.updateStickyTopPositions(this.bodyScrollable.scrollLeft || 0);
5326
5331
  }
@@ -5387,11 +5392,14 @@ class Style {
5387
5392
  setStickyColumnStyle() {
5388
5393
  if (!this.datamanager || !this.datamanager.getColumns) return;
5389
5394
 
5395
+ const columns = this.datamanager.getColumns();
5396
+ if (!columns.some(column => column.sticky) && !(this._stickySelectors || []).length) return;
5397
+
5390
5398
  const stickySelectors = [];
5391
5399
  let stickyOffset = 0;
5392
5400
  let normalOffset = 0;
5393
5401
 
5394
- this.datamanager.getColumns().forEach((column) => {
5402
+ columns.forEach((column) => {
5395
5403
  const $headerCell = this.getColumnHeaderElement(column.colIndex);
5396
5404
  const renderedWidth = $headerCell ? $headerCell.offsetWidth : column.width;
5397
5405
 
@@ -290,18 +290,11 @@ var DataTable = (function (Sortable) {
290
290
 
291
291
  var _freeGlobal = freeGlobal;
292
292
 
293
- var _freeGlobal$1 = /*#__PURE__*/Object.freeze({
294
- default: _freeGlobal,
295
- __moduleExports: _freeGlobal
296
- });
297
-
298
- var freeGlobal$1 = ( _freeGlobal$1 && _freeGlobal ) || _freeGlobal$1;
299
-
300
293
  /** Detect free variable `self`. */
301
294
  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
302
295
 
303
296
  /** Used as a reference to the global object. */
304
- var root = freeGlobal$1 || freeSelf || Function('return this')();
297
+ var root = _freeGlobal || freeSelf || Function('return this')();
305
298
 
306
299
  var _root = root;
307
300
 
@@ -376,11 +369,6 @@ var DataTable = (function (Sortable) {
376
369
 
377
370
  var _getRawTag = getRawTag;
378
371
 
379
- var _getRawTag$1 = /*#__PURE__*/Object.freeze({
380
- default: _getRawTag,
381
- __moduleExports: _getRawTag
382
- });
383
-
384
372
  /** Used for built-in method references. */
385
373
  var objectProto$1 = Object.prototype;
386
374
 
@@ -404,8 +392,6 @@ var DataTable = (function (Sortable) {
404
392
 
405
393
  var _objectToString = objectToString;
406
394
 
407
- var getRawTag$1 = ( _getRawTag$1 && _getRawTag ) || _getRawTag$1;
408
-
409
395
  /** `Object#toString` result references. */
410
396
  var nullTag = '[object Null]',
411
397
  undefinedTag = '[object Undefined]';
@@ -425,7 +411,7 @@ var DataTable = (function (Sortable) {
425
411
  return value === undefined ? undefinedTag : nullTag;
426
412
  }
427
413
  return (symToStringTag$1 && symToStringTag$1 in Object(value))
428
- ? getRawTag$1(value)
414
+ ? _getRawTag(value)
429
415
  : _objectToString(value);
430
416
  }
431
417
 
@@ -461,13 +447,6 @@ var DataTable = (function (Sortable) {
461
447
 
462
448
  var isObjectLike_1 = isObjectLike;
463
449
 
464
- var isObjectLike$1 = /*#__PURE__*/Object.freeze({
465
- default: isObjectLike_1,
466
- __moduleExports: isObjectLike_1
467
- });
468
-
469
- var isObjectLike$2 = ( isObjectLike$1 && isObjectLike_1 ) || isObjectLike$1;
470
-
471
450
  /** `Object#toString` result references. */
472
451
  var symbolTag = '[object Symbol]';
473
452
 
@@ -490,7 +469,7 @@ var DataTable = (function (Sortable) {
490
469
  */
491
470
  function isSymbol(value) {
492
471
  return typeof value == 'symbol' ||
493
- (isObjectLike$2(value) && _baseGetTag(value) == symbolTag);
472
+ (isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
494
473
  }
495
474
 
496
475
  var isSymbol_1 = isSymbol;
@@ -848,19 +827,21 @@ var DataTable = (function (Sortable) {
848
827
 
849
828
  var isFunction_1 = isFunction;
850
829
 
851
- var isFunction$1 = /*#__PURE__*/Object.freeze({
852
- default: isFunction_1,
853
- __moduleExports: isFunction_1
854
- });
855
-
856
830
  /** Used to detect overreaching core-js shims. */
857
831
  var coreJsData = _root['__core-js_shared__'];
858
832
 
859
833
  var _coreJsData = coreJsData;
860
834
 
835
+ var _coreJsData$1 = /*#__PURE__*/Object.freeze({
836
+ default: _coreJsData,
837
+ __moduleExports: _coreJsData
838
+ });
839
+
840
+ var coreJsData$1 = ( _coreJsData$1 && _coreJsData ) || _coreJsData$1;
841
+
861
842
  /** Used to detect methods masquerading as native. */
862
843
  var maskSrcKey = (function() {
863
- var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
844
+ var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || '');
864
845
  return uid ? ('Symbol(src)_1.' + uid) : '';
865
846
  }());
866
847
 
@@ -904,8 +885,6 @@ var DataTable = (function (Sortable) {
904
885
 
905
886
  var _toSource = toSource;
906
887
 
907
- var isFunction$2 = ( isFunction$1 && isFunction_1 ) || isFunction$1;
908
-
909
888
  /**
910
889
  * Used to match `RegExp`
911
890
  * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
@@ -943,7 +922,7 @@ var DataTable = (function (Sortable) {
943
922
  if (!isObject_1(value) || _isMasked(value)) {
944
923
  return false;
945
924
  }
946
- var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
925
+ var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
947
926
  return pattern.test(_toSource(value));
948
927
  }
949
928
 
@@ -1066,11 +1045,6 @@ var DataTable = (function (Sortable) {
1066
1045
 
1067
1046
  var _hashHas = hashHas;
1068
1047
 
1069
- var _hashHas$1 = /*#__PURE__*/Object.freeze({
1070
- default: _hashHas,
1071
- __moduleExports: _hashHas
1072
- });
1073
-
1074
1048
  /** Used to stand-in for `undefined` hash values. */
1075
1049
  var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
1076
1050
 
@@ -1093,8 +1067,6 @@ var DataTable = (function (Sortable) {
1093
1067
 
1094
1068
  var _hashSet = hashSet;
1095
1069
 
1096
- var hashHas$1 = ( _hashHas$1 && _hashHas ) || _hashHas$1;
1097
-
1098
1070
  /**
1099
1071
  * Creates a hash object.
1100
1072
  *
@@ -1117,7 +1089,7 @@ var DataTable = (function (Sortable) {
1117
1089
  Hash.prototype.clear = _hashClear;
1118
1090
  Hash.prototype['delete'] = _hashDelete;
1119
1091
  Hash.prototype.get = _hashGet;
1120
- Hash.prototype.has = hashHas$1;
1092
+ Hash.prototype.has = _hashHas;
1121
1093
  Hash.prototype.set = _hashSet;
1122
1094
 
1123
1095
  var _Hash = Hash;
@@ -1136,6 +1108,11 @@ var DataTable = (function (Sortable) {
1136
1108
 
1137
1109
  var _listCacheClear = listCacheClear;
1138
1110
 
1111
+ var _listCacheClear$1 = /*#__PURE__*/Object.freeze({
1112
+ default: _listCacheClear,
1113
+ __moduleExports: _listCacheClear
1114
+ });
1115
+
1139
1116
  /**
1140
1117
  * Performs a
1141
1118
  * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@@ -1174,13 +1151,6 @@ var DataTable = (function (Sortable) {
1174
1151
 
1175
1152
  var eq_1 = eq;
1176
1153
 
1177
- var eq$1 = /*#__PURE__*/Object.freeze({
1178
- default: eq_1,
1179
- __moduleExports: eq_1
1180
- });
1181
-
1182
- var eq$2 = ( eq$1 && eq_1 ) || eq$1;
1183
-
1184
1154
  /**
1185
1155
  * Gets the index at which the `key` is found in `array` of key-value pairs.
1186
1156
  *
@@ -1192,7 +1162,7 @@ var DataTable = (function (Sortable) {
1192
1162
  function assocIndexOf(array, key) {
1193
1163
  var length = array.length;
1194
1164
  while (length--) {
1195
- if (eq$2(array[length][0], key)) {
1165
+ if (eq_1(array[length][0], key)) {
1196
1166
  return length;
1197
1167
  }
1198
1168
  }
@@ -1300,6 +1270,8 @@ var DataTable = (function (Sortable) {
1300
1270
 
1301
1271
  var _listCacheSet = listCacheSet;
1302
1272
 
1273
+ var listCacheClear$1 = ( _listCacheClear$1 && _listCacheClear ) || _listCacheClear$1;
1274
+
1303
1275
  /**
1304
1276
  * Creates an list cache object.
1305
1277
  *
@@ -1319,7 +1291,7 @@ var DataTable = (function (Sortable) {
1319
1291
  }
1320
1292
 
1321
1293
  // Add methods to `ListCache`.
1322
- ListCache.prototype.clear = _listCacheClear;
1294
+ ListCache.prototype.clear = listCacheClear$1;
1323
1295
  ListCache.prototype['delete'] = _listCacheDelete;
1324
1296
  ListCache.prototype.get = _listCacheGet;
1325
1297
  ListCache.prototype.has = _listCacheHas;
@@ -1327,11 +1299,18 @@ var DataTable = (function (Sortable) {
1327
1299
 
1328
1300
  var _ListCache = ListCache;
1329
1301
 
1302
+ var _ListCache$1 = /*#__PURE__*/Object.freeze({
1303
+ default: _ListCache,
1304
+ __moduleExports: _ListCache
1305
+ });
1306
+
1330
1307
  /* Built-in method references that are verified to be native. */
1331
1308
  var Map = _getNative(_root, 'Map');
1332
1309
 
1333
1310
  var _Map = Map;
1334
1311
 
1312
+ var ListCache$1 = ( _ListCache$1 && _ListCache ) || _ListCache$1;
1313
+
1335
1314
  /**
1336
1315
  * Removes all key-value entries from the map.
1337
1316
  *
@@ -1343,18 +1322,13 @@ var DataTable = (function (Sortable) {
1343
1322
  this.size = 0;
1344
1323
  this.__data__ = {
1345
1324
  'hash': new _Hash,
1346
- 'map': new (_Map || _ListCache),
1325
+ 'map': new (_Map || ListCache$1),
1347
1326
  'string': new _Hash
1348
1327
  };
1349
1328
  }
1350
1329
 
1351
1330
  var _mapCacheClear = mapCacheClear;
1352
1331
 
1353
- var _mapCacheClear$1 = /*#__PURE__*/Object.freeze({
1354
- default: _mapCacheClear,
1355
- __moduleExports: _mapCacheClear
1356
- });
1357
-
1358
1332
  /**
1359
1333
  * Checks if `value` is suitable for use as unique object key.
1360
1334
  *
@@ -1395,13 +1369,6 @@ var DataTable = (function (Sortable) {
1395
1369
 
1396
1370
  var _getMapData = getMapData;
1397
1371
 
1398
- var _getMapData$1 = /*#__PURE__*/Object.freeze({
1399
- default: _getMapData,
1400
- __moduleExports: _getMapData
1401
- });
1402
-
1403
- var getMapData$1 = ( _getMapData$1 && _getMapData ) || _getMapData$1;
1404
-
1405
1372
  /**
1406
1373
  * Removes `key` and its value from the map.
1407
1374
  *
@@ -1412,7 +1379,7 @@ var DataTable = (function (Sortable) {
1412
1379
  * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1413
1380
  */
1414
1381
  function mapCacheDelete(key) {
1415
- var result = getMapData$1(this, key)['delete'](key);
1382
+ var result = _getMapData(this, key)['delete'](key);
1416
1383
  this.size -= result ? 1 : 0;
1417
1384
  return result;
1418
1385
  }
@@ -1429,7 +1396,7 @@ var DataTable = (function (Sortable) {
1429
1396
  * @returns {*} Returns the entry value.
1430
1397
  */
1431
1398
  function mapCacheGet(key) {
1432
- return getMapData$1(this, key).get(key);
1399
+ return _getMapData(this, key).get(key);
1433
1400
  }
1434
1401
 
1435
1402
  var _mapCacheGet = mapCacheGet;
@@ -1444,7 +1411,7 @@ var DataTable = (function (Sortable) {
1444
1411
  * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1445
1412
  */
1446
1413
  function mapCacheHas(key) {
1447
- return getMapData$1(this, key).has(key);
1414
+ return _getMapData(this, key).has(key);
1448
1415
  }
1449
1416
 
1450
1417
  var _mapCacheHas = mapCacheHas;
@@ -1460,7 +1427,7 @@ var DataTable = (function (Sortable) {
1460
1427
  * @returns {Object} Returns the map cache instance.
1461
1428
  */
1462
1429
  function mapCacheSet(key, value) {
1463
- var data = getMapData$1(this, key),
1430
+ var data = _getMapData(this, key),
1464
1431
  size = data.size;
1465
1432
 
1466
1433
  data.set(key, value);
@@ -1470,8 +1437,6 @@ var DataTable = (function (Sortable) {
1470
1437
 
1471
1438
  var _mapCacheSet = mapCacheSet;
1472
1439
 
1473
- var mapCacheClear$1 = ( _mapCacheClear$1 && _mapCacheClear ) || _mapCacheClear$1;
1474
-
1475
1440
  /**
1476
1441
  * Creates a map cache object to store key-value pairs.
1477
1442
  *
@@ -1491,7 +1456,7 @@ var DataTable = (function (Sortable) {
1491
1456
  }
1492
1457
 
1493
1458
  // Add methods to `MapCache`.
1494
- MapCache.prototype.clear = mapCacheClear$1;
1459
+ MapCache.prototype.clear = _mapCacheClear;
1495
1460
  MapCache.prototype['delete'] = _mapCacheDelete;
1496
1461
  MapCache.prototype.get = _mapCacheGet;
1497
1462
  MapCache.prototype.has = _mapCacheHas;
@@ -1519,6 +1484,11 @@ var DataTable = (function (Sortable) {
1519
1484
 
1520
1485
  var _setCacheAdd = setCacheAdd;
1521
1486
 
1487
+ var _setCacheAdd$1 = /*#__PURE__*/Object.freeze({
1488
+ default: _setCacheAdd,
1489
+ __moduleExports: _setCacheAdd
1490
+ });
1491
+
1522
1492
  /**
1523
1493
  * Checks if `value` is in the array cache.
1524
1494
  *
@@ -1534,6 +1504,8 @@ var DataTable = (function (Sortable) {
1534
1504
 
1535
1505
  var _setCacheHas = setCacheHas;
1536
1506
 
1507
+ var setCacheAdd$1 = ( _setCacheAdd$1 && _setCacheAdd ) || _setCacheAdd$1;
1508
+
1537
1509
  /**
1538
1510
  *
1539
1511
  * Creates an array cache object to store unique values.
@@ -1553,7 +1525,7 @@ var DataTable = (function (Sortable) {
1553
1525
  }
1554
1526
 
1555
1527
  // Add methods to `SetCache`.
1556
- SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;
1528
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd$1;
1557
1529
  SetCache.prototype.has = _setCacheHas;
1558
1530
 
1559
1531
  var _SetCache = SetCache;
@@ -1637,13 +1609,6 @@ var DataTable = (function (Sortable) {
1637
1609
 
1638
1610
  var _baseIndexOf = baseIndexOf;
1639
1611
 
1640
- var _baseIndexOf$1 = /*#__PURE__*/Object.freeze({
1641
- default: _baseIndexOf,
1642
- __moduleExports: _baseIndexOf
1643
- });
1644
-
1645
- var baseIndexOf$1 = ( _baseIndexOf$1 && _baseIndexOf ) || _baseIndexOf$1;
1646
-
1647
1612
  /**
1648
1613
  * A specialized version of `_.includes` for arrays without support for
1649
1614
  * specifying an index to search from.
@@ -1655,16 +1620,11 @@ var DataTable = (function (Sortable) {
1655
1620
  */
1656
1621
  function arrayIncludes(array, value) {
1657
1622
  var length = array == null ? 0 : array.length;
1658
- return !!length && baseIndexOf$1(array, value, 0) > -1;
1623
+ return !!length && _baseIndexOf(array, value, 0) > -1;
1659
1624
  }
1660
1625
 
1661
1626
  var _arrayIncludes = arrayIncludes;
1662
1627
 
1663
- var _arrayIncludes$1 = /*#__PURE__*/Object.freeze({
1664
- default: _arrayIncludes,
1665
- __moduleExports: _arrayIncludes
1666
- });
1667
-
1668
1628
  /**
1669
1629
  * This function is like `arrayIncludes` except that it accepts a comparator.
1670
1630
  *
@@ -1760,8 +1720,6 @@ var DataTable = (function (Sortable) {
1760
1720
 
1761
1721
  var _createSet = createSet;
1762
1722
 
1763
- var arrayIncludes$1 = ( _arrayIncludes$1 && _arrayIncludes ) || _arrayIncludes$1;
1764
-
1765
1723
  /** Used as the size to enable large array optimizations. */
1766
1724
  var LARGE_ARRAY_SIZE = 200;
1767
1725
 
@@ -1776,7 +1734,7 @@ var DataTable = (function (Sortable) {
1776
1734
  */
1777
1735
  function baseUniq(array, iteratee, comparator) {
1778
1736
  var index = -1,
1779
- includes = arrayIncludes$1,
1737
+ includes = _arrayIncludes,
1780
1738
  length = array.length,
1781
1739
  isCommon = true,
1782
1740
  result = [],
@@ -1828,13 +1786,6 @@ var DataTable = (function (Sortable) {
1828
1786
 
1829
1787
  var _baseUniq = baseUniq;
1830
1788
 
1831
- var _baseUniq$1 = /*#__PURE__*/Object.freeze({
1832
- default: _baseUniq,
1833
- __moduleExports: _baseUniq
1834
- });
1835
-
1836
- var baseUniq$1 = ( _baseUniq$1 && _baseUniq ) || _baseUniq$1;
1837
-
1838
1789
  /**
1839
1790
  * Creates a duplicate-free version of an array, using
1840
1791
  * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@@ -1854,7 +1805,7 @@ var DataTable = (function (Sortable) {
1854
1805
  * // => [2, 1]
1855
1806
  */
1856
1807
  function uniq(array) {
1857
- return (array && array.length) ? baseUniq$1(array) : [];
1808
+ return (array && array.length) ? _baseUniq(array) : [];
1858
1809
  }
1859
1810
 
1860
1811
  var uniq_1 = uniq;
@@ -2296,14 +2247,18 @@ var DataTable = (function (Sortable) {
2296
2247
  }
2297
2248
  }
2298
2249
 
2250
+ const sortValue = cell => {
2251
+ const hook = cell.column && cell.column.sortValue;
2252
+ const value = hook ? hook(cell) : cell.content;
2253
+ return value == null ? '' : value;
2254
+ };
2255
+
2299
2256
  this.rowViewOrder.sort((a, b) => {
2300
2257
  const aIndex = a;
2301
2258
  const bIndex = b;
2302
2259
 
2303
- let aContent = this.getCell(colIndex, a).content;
2304
- let bContent = this.getCell(colIndex, b).content;
2305
- aContent = aContent == null ? '' : aContent;
2306
- bContent = bContent == null ? '' : bContent;
2260
+ const aContent = sortValue(this.getCell(colIndex, a));
2261
+ const bContent = sortValue(this.getCell(colIndex, b));
2307
2262
 
2308
2263
  if (sortOrder === 'none') {
2309
2264
  return aIndex - bIndex;
@@ -3756,12 +3711,6 @@ var DataTable = (function (Sortable) {
3756
3711
  document.body.classList.remove('dt-resize');
3757
3712
  if (!$resizingCell) return;
3758
3713
  isDragging = false;
3759
-
3760
- const {
3761
- colIndex
3762
- } = $.data($resizingCell);
3763
- this.setColumnWidth(colIndex);
3764
- this.style.setBodyStyle();
3765
3714
  $resizingCell = null;
3766
3715
  };
3767
3716
  $.on(document.body, 'mouseup', onMouseup);
@@ -3789,6 +3738,9 @@ var DataTable = (function (Sortable) {
3789
3738
  width: finalWidth
3790
3739
  });
3791
3740
  this.setColumnHeaderWidth(colIndex);
3741
+ this.setColumnWidth(colIndex);
3742
+ this.style.refreshStickyColumns();
3743
+ this.style.setBodyStyle();
3792
3744
  };
3793
3745
  $.on(document.body, 'mousemove', onMouseMove);
3794
3746
  this.instance.on('onDestroy', () => {
@@ -3825,6 +3777,7 @@ var DataTable = (function (Sortable) {
3825
3777
  this.datamanager.updateColumn(colIndex, { width });
3826
3778
  this.setColumnHeaderWidth(colIndex);
3827
3779
  this.setColumnWidth(colIndex);
3780
+ this.style.refreshStickyColumns();
3828
3781
  });
3829
3782
  }
3830
3783
 
@@ -5252,8 +5205,7 @@ var DataTable = (function (Sortable) {
5252
5205
  this.setupColumnWidth();
5253
5206
  this.distributeRemainingWidth();
5254
5207
  this.setColumnStyle();
5255
- this.setStickyColumnStyle();
5256
- this.updateStickyTopPositions(this.bodyScrollable.scrollLeft || 0);
5208
+ this.refreshStickyColumns();
5257
5209
  this.setBodyStyle();
5258
5210
  }
5259
5211
 
@@ -5411,6 +5363,10 @@ var DataTable = (function (Sortable) {
5411
5363
  this.columnmanager.setColumnHeaderWidth(column.colIndex);
5412
5364
  this.columnmanager.setColumnWidth(column.colIndex);
5413
5365
  });
5366
+ this.refreshStickyColumns();
5367
+ }
5368
+
5369
+ refreshStickyColumns() {
5414
5370
  this.setStickyColumnStyle();
5415
5371
  this.updateStickyTopPositions(this.bodyScrollable.scrollLeft || 0);
5416
5372
  }
@@ -5477,11 +5433,14 @@ var DataTable = (function (Sortable) {
5477
5433
  setStickyColumnStyle() {
5478
5434
  if (!this.datamanager || !this.datamanager.getColumns) return;
5479
5435
 
5436
+ const columns = this.datamanager.getColumns();
5437
+ if (!columns.some(column => column.sticky) && !(this._stickySelectors || []).length) return;
5438
+
5480
5439
  const stickySelectors = [];
5481
5440
  let stickyOffset = 0;
5482
5441
  let normalOffset = 0;
5483
5442
 
5484
- this.datamanager.getColumns().forEach((column) => {
5443
+ columns.forEach((column) => {
5485
5444
  const $headerCell = this.getColumnHeaderElement(column.colIndex);
5486
5445
  const renderedWidth = $headerCell ? $headerCell.offsetWidth : column.width;
5487
5446
 
@@ -1 +1 @@
1
- var DataTable=function(t){"use strict";function e(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function n(){const t=document.createElement("div");e.style(t,{width:"100px",height:"100px",overflow:"scroll",position:"absolute",top:"-9999px"}),document.body.appendChild(t);const n=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),n}function i(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function o(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function s(t){var e=Ot.call(t,Mt),n=t[Mt];try{t[Mt]=void 0}catch(t){}var i=Lt.call(t);return e?t[Mt]=n:delete t[Mt],i}function r(t){return Dt.call(t)}function l(t){return null==t?void 0===t?jt:Ft:At&&At in Object(t)?$t(t):zt(t)}function a(t){return null!=t&&"object"==typeof t}function c(t){return"symbol"==typeof t||Nt(t)&&Wt(t)==Pt}function h(t){if("number"==typeof t)return t;if(qt(t))return Kt;if(vt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=vt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Ut,"");var n=Xt.test(t);return n||Gt.test(t)?Jt(t.slice(2),n?2:8):Zt.test(t)?Kt:+t}function u(t,e,n){function i(e){var n=d,i=f;return d=f=void 0,y=e,p=t.apply(i,n)}function o(t){return y=t,g=setTimeout(l,e),b?i(t):p}function s(t){var n=t-y,i=e-(t-w);return C?ee(i,m-n):i}function r(t){var n=t-w,i=t-y;return void 0===w||n>=e||n<0||C&&i>=m}function l(){var t=Tt();if(r(t))return a(t);g=setTimeout(l,s(t))}function a(t){return g=void 0,v&&d?i(t):(d=f=void 0,p)}function c(){void 0!==g&&clearTimeout(g),y=0,d=w=f=g=void 0}function h(){return void 0===g?p:a(Tt())}function u(){var t=Tt(),n=r(t);if(d=arguments,f=this,w=t,n){if(void 0===g)return o(w);if(C)return g=setTimeout(l,e),i(w)}return void 0===g&&(g=setTimeout(l,e)),p}var d,f,m,p,g,w,y=0,b=!1,C=!1,v=!0;if("function"!=typeof t)throw new TypeError(Qt);return e=Yt(e)||0,vt(n)&&(b=!!n.leading,m=(C="maxWait"in n)?te(Yt(n.maxWait)||0,e):m,v="trailing"in n?!!n.trailing:v),u.cancel=c,u.flush=h,u}function d(t,e,n){var i=!0,o=!0;if("function"!=typeof t)throw new TypeError(ie);return vt(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),ne(t,e,{leading:i,maxWait:e,trailing:o})}function f(t){if(!vt(t))return!1;var e=Wt(t);return e==re||e==le||e==se||e==ae}function m(t){return!!de&&de in t}function p(t){if(null!=t){try{return me.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function g(t){return!(!vt(t)||fe(t))&&(we(t)?Ie:be).test(ye(t))}function w(t,e){return null==t?void 0:t[e]}function y(t,e){var n=Re(t,e);return Se(n)?n:void 0}function b(){this.__data__=Le?Le(null):{},this.size=0}function C(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function v(t){var e=this.__data__;if(Le){var n=e[t];return n===De?void 0:n}return ze.call(e,t)?e[t]:void 0}function _(t){var e=this.__data__;return Le?void 0!==e[t]:je.call(e,t)}function x(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Le&&void 0===e?We:e,this}function I(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function S(){this.__data__=[],this.size=0}function R(t,e){return t===e||t!==t&&e!==e}function k(t,e){for(var n=t.length;n--;)if(Ue(t[n][0],e))return n;return-1}function T(t){var e=this.__data__,n=Ze(e,t);return!(n<0)&&(n==e.length-1?e.pop():Xe.call(e,n,1),--this.size,!0)}function E(t){var e=this.__data__,n=Ze(e,t);return n<0?void 0:e[n][1]}function H(t){return Ze(this.__data__,t)>-1}function O(t,e){var n=this.__data__,i=Ze(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}function L(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function M(){this.size=0,this.__data__={hash:new on,map:new(nn||sn),string:new on}}function $(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function D(t,e){var n=t.__data__;return ln(e)?n["string"==typeof e?"string":"hash"]:n.map}function z(t){var e=an(this,t).delete(t);return this.size-=e?1:0,e}function F(t){return an(this,t).get(t)}function j(t){return an(this,t).has(t)}function A(t,e){var n=an(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}function W(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function N(t){return this.__data__.set(t,mn),this}function P(t){return this.__data__.has(t)}function B(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new fn;++e<n;)this.add(t[e])}function V(t,e,n,i){for(var o=t.length,s=n+(i?1:-1);i?s--:++s<o;)if(e(t[s],s,t))return s;return-1}function q(t){return t!==t}function K(t,e,n){for(var i=n-1,o=t.length;++i<o;)if(t[i]===e)return i;return-1}function U(t,e,n){return e===e?Cn(t,e,n):yn(t,bn,n)}function Z(t,e){return!!(null==t?0:t.length)&&vn(t,e,0)>-1}function X(t,e,n){for(var i=-1,o=null==t?0:t.length;++i<o;)if(n(e,t[i]))return!0;return!1}function G(t,e){return t.has(e)}function J(){}function Y(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function Q(t,e,n){var i=-1,o=_n,s=t.length,r=!0,l=[],a=l;if(n)r=!1,o=xn;else if(s>=En){var c=e?null:Tn(t);if(c)return kn(c);r=!1,o=In,a=new wn}else a=e?[]:l;t:for(;++i<s;){var h=t[i],u=e?e(h):h;if(h=n||0!==h?h:0,r&&u===u){for(var d=a.length;d--;)if(a[d]===u)continue t;e&&a.push(u),l.push(h)}else o(a,u,n)||(a!==l&&a.push(u),l.push(h))}return l}function tt(t){return t&&t.length?Hn(t):[]}function et(t){return t.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`)}function nt(t){return Object.keys(t).map(e=>{const n=et(e);const i=t[e];if(void 0===i)return"";return`data-${n}="${i}" `}).join("").trim()}function it(t){var e=document.createElement("textarea");e.style.position="fixed",e.style.top=0,e.style.left=0,e.style.width="2em",e.style.height="2em",e.style.padding=0,e.style.border="none",e.style.outline="none",e.style.boxShadow="none",e.style.background="transparent",e.value=t,document.body.appendChild(e),e.select();try{document.execCommand("copy")}catch(t){console.log("Oops, unable to copy")}document.body.removeChild(e)}function ot(t){return!isNaN(t)}function st(t,e=null){return(...n)=>new Promise(i=>{const o=()=>{const o=t.apply(e,n);i(o)};setTimeout(o)})}function rt(t,e,n){const i=n.reduce((t,n)=>{t[n]={get(){return e[n]}};return t},{});Object.defineProperties(t,i)}function lt(t){return void 0!==t||null!==t}function at(t){return!lt(t)}function ct(t){return!isNaN(t)}function ht(t){return Array.isArray(t)?t:[t]}function ut(t){return On(t)}function dt(t,e){return t-e}function ft(t){return t.replace(/<[^>]*>/g,"")}function mt(t,e){return t?(Object.keys(e).forEach(n=>{let i=new RegExp(`{(${n})}`,"g");t=t.replace(i,e[n])}),t):t}function pt(t){if(!t)return"";let e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};return String(t).replace(/[&<>"'`=/]/g,t=>e[t]||t)}function gt(){return{en:qn,de:Kn,fr:Un,it:Zn}}function wt(t,e,n){let i=[];if(0===Object.keys(e).length)return t.map(t=>t.meta.rowIndex);for(let o in e){const s=e[o],r=i.length?i.map(e=>t[e]):t,l=r.map(t=>t[o]);let a=bt(s),c=yt(t,n,a);i=c?c(a.text,l):l.map(t=>t.rowIndex)}return i}function yt(t,e,n){const i=i=>{let o=Fn.getCustomCellFormatter(i);let s=t[i.rowIndex];e&&e.data&&e.data.length&&(s=e.data[i.rowIndex]);if(o&&i.content)return i.html=o(i.content,t[i.rowIndex],i.column,s,n),ft(i.html);return i.content||""},o=t=>String(ft(t.html||"")||i(t)).toLowerCase(),s=t=>parseFloat(t.content),r=(t,e)=>{if(t.column.compareValue){const n=t.column.compareValue(t,e);if(n&&Array.isArray(n))return n}const n=s(t);if(!isNaN(n))return[n,e];return[o(t),e]};return{contains(t,e){return e.filter(e=>{const n=(t||"").toLowerCase();return!n||(e.content||"").toLowerCase().includes(n)||o(e).includes(n)}).map(t=>t.rowIndex)},greaterThan(t,e){return e.filter(e=>{const[n,i]=r(e,t);return n>i}).map(t=>t.rowIndex)},lessThan(t,e){return e.filter(e=>{const[n,i]=r(e,t);return n<i}).map(t=>t.rowIndex)},equals(t,e){return e.filter(e=>{const n=parseFloat(e.content);return n===t}).map(t=>t.rowIndex)},notEquals(t,e){return e.filter(e=>{const n=parseFloat(e.content);return n!==t}).map(t=>t.rowIndex)},range(t,e){return e.filter(e=>{const n=r(e,t[0]);const i=r(e,t[1]);const o=n[0];return o>=n[1]&&o<=i[1]}).map(t=>t.rowIndex)},containsNumber(t,e){return e.filter(e=>{let n=parseFloat(t,10);let i=t;let r=s(e);let l=o(e);return n===r||l.includes(i)}).map(t=>t.rowIndex)}}[n.type]}function bt(t=""){if(0===t.length)return{};let e=t;return[">","<","="].includes(e[0])?e=t.slice(1):e.startsWith("!=")&&(e=t.slice(2)),t.startsWith(">")&&e?{type:"greaterThan",text:e.trim()}:t.startsWith("<")&&e?{type:"lessThan",text:e.trim()}:t.startsWith("=")&&ct(e)?{type:"equals",text:Number(t.slice(1).trim())}:ct(e)?{type:"containsNumber",text:e}:t.startsWith("!=")&&ct(e)?{type:"notEquals",text:Number(t.slice(2).trim())}:2===t.split(":").length&&t.split(":").every(t=>ct(t.trim()))?(e=t.split(":"),{type:"range",text:e.map(t=>t.trim())}):{type:"contains",text:e.toLowerCase()}}function Ct(t){return{columns:[],data:[],dropdownButton:zn.chevronDown,headerDropdown:[{label:t.translate("Sort Ascending"),action:function(t){this.sortColumn(t.colIndex,"asc")}},{label:t.translate("Sort Descending"),action:function(t){this.sortColumn(t.colIndex,"desc")}},{label:t.translate("Reset sorting"),action:function(t){this.sortColumn(t.colIndex,"none")}},{label:t.translate("Remove column"),action:function(t){this.removeColumn(t.colIndex)}},{label:t.translate("Freeze"),stickyAction:"stick",display:"hidden",action:function(t){this.setColumnSticky(t.colIndex,!0)}},{label:t.translate("Unfreeze"),stickyAction:"unstick",display:"hidden",action:function(t){this.setColumnSticky(t.colIndex,!1)}}],events:{onRemoveColumn(t){},onSwitchColumn(t,e){},onSortColumn(t){},onCheckRow(t){},onDestroy(){}},hooks:{columnTotal:null},sortIndicator:{asc:"↑",desc:"↓",none:""},overrideComponents:{},filterRows:wt,freezeMessage:"",getEditor:null,serialNoColumn:!0,serialNoColumnLabel:"",checkboxColumn:!1,clusterize:!0,logs:!1,layout:"fixed",noDataMessage:t.translate("No Data"),cellHeight:40,minimumColumnWidth:30,inlineFilters:!1,treeView:!1,checkedRowStatus:!0,dynamicRowHeight:!1,pasteFromClipboard:!1,showTotalRow:!1,direction:"ltr",disableReorderColumn:!1}}t=t&&t.hasOwnProperty("default")?t.default:t,e.each=((t,e)=>"string"==typeof t?Array.from((e||document).querySelectorAll(t)):t||null),e.create=((t,n)=>{let i=document.createElement(t);for(let t in n){let o=n[t];if("inside"===t)e(o).appendChild(i);else if("around"===t){let t=e(o);t.parentNode.insertBefore(i,t),i.appendChild(t)}else"styles"===t?"object"==typeof o&&Object.keys(o).map(t=>{i.style[t]=o[t]}):t in i?i[t]=o:i.setAttribute(t,o)}return i}),e.on=((t,n,i,o)=>{o?e.delegate(t,n,i,o):(o=i,e.bind(t,n,o))}),e.off=((t,e,n)=>{t.removeEventListener(e,n)}),e.bind=((t,e,n)=>{e.split(/\s+/).forEach(function(e){t.addEventListener(e,n)})}),e.delegate=((t,e,n,i)=>{t.addEventListener(e,function(t){const e=t.target.closest(n);e&&(t.delegatedTarget=e,i.call(this,t,e))})}),e.unbind=((t,e)=>{if(t)for(let n in e){let i=e[n];n.split(/\s+/).forEach(function(e){t.removeEventListener(e,i)})}}),e.fire=((t,e,n)=>{let i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!0);for(let t in n)i[t]=n[t];return t.dispatchEvent(i)}),e.data=((t,e)=>{if(!e)return t.dataset;for(const n in e)t.dataset[n]=e[n]}),e.style=((t,n)=>{if("string"==typeof n)return e.getStyle(t,n);Array.isArray(t)||(t=[t]);t.map(t=>{for(const e in n)t.style[e]=n[e]})}),e.removeStyle=((t,e)=>{Array.isArray(t)||(t=[t]);Array.isArray(e)||(e=[e]);t.map(t=>{for(const n of e)t.style[n]=""})}),e.getStyle=((t,e)=>{if(!e)return getComputedStyle(t);let n=getComputedStyle(t)[e];["width","height"].includes(e)&&(n=parseFloat(n));return n}),e.closest=((t,n)=>{if(!n)return null;if(n.matches(t))return n;return e.closest(t,n.parentNode)}),e.inViewport=((t,e)=>{const{top:top,left:left,bottom:bottom,right:right}=t.getBoundingClientRect();const{top:pTop,left:pLeft,bottom:pBottom,right:pRight}=e.getBoundingClientRect();return top>=pTop&&left>=pLeft&&bottom<=pBottom&&right<=pRight}),e.scrollTop=function(t,e){requestAnimationFrame(()=>{t.scrollTop=e})},e.scrollbarSize=function(){return e.scrollBarSizeValue||(e.scrollBarSizeValue=n()),e.scrollBarSizeValue},e.hasVerticalOverflow=function(t){return t.scrollHeight>t.offsetHeight+10},e.hasHorizontalOverflow=function(t){return t.scrollWidth>t.offsetWidth+10},e.measureTextWidth=function(t){const e=document.createElement("div");return e.style.position="absolute",e.style.visibility="hidden",e.style.height="auto",e.style.width="auto",e.style.whiteSpace="nowrap",e.innerText=t,document.body.appendChild(e),e.clientWidth+1};var vt=i,_t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},xt="object"==typeof _t&&_t&&_t.Object===Object&&_t,It="object"==typeof self&&self&&self.Object===Object&&self,St=xt||It||Function("return this")(),Rt=Object.freeze({default:St,__moduleExports:St}),kt=Rt&&St||Rt,Tt=function(){return kt.Date.now()},Et=kt.Symbol,Ht=Object.prototype,Ot=Ht.hasOwnProperty,Lt=Ht.toString,Mt=Et?Et.toStringTag:void 0,$t=s,Dt=Object.prototype.toString,zt=r,Ft="[object Null]",jt="[object Undefined]",At=Et?Et.toStringTag:void 0,Wt=l,Nt=a,Pt="[object Symbol]",Bt=c,Vt=Object.freeze({default:Bt,__moduleExports:Bt}),qt=Vt&&Bt||Vt,Kt=NaN,Ut=/^\s+|\s+$/g,Zt=/^[-+]0x[0-9a-f]+$/i,Xt=/^0b[01]+$/i,Gt=/^0o[0-7]+$/i,Jt=parseInt,Yt=h,Qt="Expected a function",te=Math.max,ee=Math.min,ne=u,ie="Expected a function",oe=d,se="[object AsyncFunction]",re="[object Function]",le="[object GeneratorFunction]",ae="[object Proxy]",ce=f,he=Object.freeze({default:ce,__moduleExports:ce}),ue=kt["__core-js_shared__"],de=function(){var t=/[^.]+$/.exec(ue&&ue.keys&&ue.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),fe=m,me=Function.prototype.toString,pe=p,ge=Object.freeze({default:pe,__moduleExports:pe}),we=he&&ce||he,ye=ge&&pe||ge,be=/^\[object .+?Constructor\]$/,Ce=Function.prototype,ve=Object.prototype,_e=Ce.toString,xe=ve.hasOwnProperty,Ie=RegExp("^"+_e.call(xe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Se=g,Re=w,ke=y,Te=Object.freeze({default:ke,__moduleExports:ke}),Ee=Te&&ke||Te,He=Ee(Object,"create"),Oe=Object.freeze({default:He,__moduleExports:He}),Le=Oe&&He||Oe,Me=b,$e=C,De="__lodash_hash_undefined__",ze=Object.prototype.hasOwnProperty,Fe=v,je=Object.prototype.hasOwnProperty,Ae=_,We="__lodash_hash_undefined__",Ne=x;I.prototype.clear=Me,I.prototype.delete=$e,I.prototype.get=Fe,I.prototype.has=Ae,I.prototype.set=Ne;var Pe=I,Be=Object.freeze({default:Pe,__moduleExports:Pe}),Ve=S,qe=R,Ke=Object.freeze({default:qe,__moduleExports:qe}),Ue=Ke&&qe||Ke,Ze=k,Xe=Array.prototype.splice,Ge=T,Je=E,Ye=H,Qe=O;L.prototype.clear=Ve,L.prototype.delete=Ge,L.prototype.get=Je,L.prototype.has=Ye,L.prototype.set=Qe;var tn=L,en=Object.freeze({default:tn,__moduleExports:tn}),nn=Ee(kt,"Map"),on=Be&&Pe||Be,sn=en&&tn||en,rn=M,ln=$,an=D,cn=z,hn=F,un=j,dn=A;W.prototype.clear=rn,W.prototype.delete=cn,W.prototype.get=hn,W.prototype.has=un,W.prototype.set=dn;var fn=W,mn="__lodash_hash_undefined__",pn=N,gn=P;B.prototype.add=B.prototype.push=pn,B.prototype.has=gn;var wn=B,yn=V,bn=q,Cn=K,vn=U,_n=Z,xn=X,In=G,Sn=Ee(kt,"Set"),Rn=J,kn=Y,Tn=Sn&&1/kn(new Sn([,-0]))[1]==1/0?function(t){return new Sn(t)}:Rn,En=200,Hn=Q,On=tt;let Ln=oe,Mn=ne;class $n{constructor(t){this.options=t,this.sortRows=st(this.sortRows,this),this.switchColumn=st(this.switchColumn,this),this.removeColumn=st(this.removeColumn,this),this.options.filterRows=st(this.options.filterRows,this)}init(t,e){t||(t=this.options.data),e&&(this.options.columns=e),this.data=t,this.rowCount=0,this.columns=[],this.rows=[],this.prepareColumns(),this.validateData(this.data),this.rows=this.prepareRows(this.data),this.prepareTreeRows(),this.prepareRowView(),this.prepareNumericColumns()}get currentSort(){return this.columns.find(t=>"none"!==t.sortOrder)||{colIndex:-1,sortOrder:"none"}}prepareColumns(){this.columns=[],this.validateColumns(),this.prepareDefaultColumns(),this.prepareHeader()}prepareDefaultColumns(){if(this.options.checkboxColumn&&!this.hasColumnById("_checkbox")){const t={id:"_checkbox",content:this.getCheckboxHTML(),editable:!1,resizable:!1,sortable:!1,focusable:!1,dropdown:!1,sticky:!0,width:32};this.columns.push(t)}if(this.options.serialNoColumn&&!this.hasColumnById("_rowIndex")){let t={id:"_rowIndex",content:this.options.serialNoColumnLabel||"",align:"center",editable:!1,resizable:!0,focusable:!1,dropdown:!1,sticky:!0};this.columns.push(t)}}prepareHeader(){let t=this.columns.concat(this.options.columns);const e={isHeader:1,editable:!0,sortable:!0,resizable:!0,focusable:!0,dropdown:!0,width:null,format:t=>{if(null===t||void 0===t)return"";return t+""}};this.columns=t.map((t,e)=>this.prepareCell(t,e)).map(t=>Object.assign({},e,t)).map(t=>{t.content=t.content||t.name||"";t.id=t.id||t.content;return t})}prepareCell(t,e){const n={content:"",sortOrder:"none",colIndex:e,column:this.columns[e]};return null!==t&&"object"==typeof t?Object.assign(n,t):n.content=t,n}prepareNumericColumns(){const t=this.getRow(0);t&&(this.columns=this.columns.map((e,n)=>{const i=t[n].content;!e.align&&ot(i)&&(e.align="right");return e}))}prepareRows(t){return t.map((t,e)=>{const n=this._getNextRowCount();let i=[];let o={rowIndex:n};if(Array.isArray(t))for(this.options.checkboxColumn&&i.push(this.getCheckboxHTML()),this.options.serialNoColumn&&i.push(n+1+""),i=i.concat(t);i.length<this.columns.length;)i.push("");else{for(let e of this.columns)"_checkbox"===e.id?i.push(this.getCheckboxHTML()):"_rowIndex"===e.id?i.push(n+1+""):i.push(t[e.id]);o.indent=t.indent||0}return this.prepareRow(i,o)})}prepareTreeRows(){this.rows.forEach((t,e)=>{if(ct(t.meta.indent)){const n=this.getRow(e+1);t.meta.isLeaf=!n||at(n.meta.indent)||n.meta.indent<=t.meta.indent,t.meta.isTreeNodeClose=!1}})}prepareRowView(){this.rowViewOrder=this.rows.map(t=>t.meta.rowIndex)}prepareRow(t,e){return t=t.map((t,e)=>this.prepareCell(t,e)).map(t=>{null==t.rowIndex&&(t.rowIndex=e.rowIndex);null==t.indent&&(t.indent=e.indent);return t}),t.meta=e,t}validateColumns(){const t=this.options.columns;if(!Array.isArray(t))throw new Dn("`columns` must be an array");t.forEach((t,e)=>{if("string"!=typeof t&&"object"!=typeof t)throw new Dn(`column "${e}" must be a string or an object`)})}validateData(t){if(Array.isArray(t)&&(0===t.length||Array.isArray(t[0])||"object"==typeof t[0]))return!0;throw new Dn("`data` must be an array of arrays or objects")}appendRows(t){this.validateData(t),this.rows=this.rows.concat(this.prepareRows(t)),this.prepareTreeRows(),this.prepareRowView()}sortRows(t,e="none"){t=+t,this.getColumns().map(n=>{n.colIndex===t?n.sortOrder=e:n.sortOrder="none"}),this._sortRows(t,e)}_sortRows(t,e){if(this.currentSort.colIndex===t&&("asc"===this.currentSort.sortOrder&&"desc"===e||"desc"===this.currentSort.sortOrder&&"asc"===e))return this.reverseArray(this.rowViewOrder),void(this.currentSort.sortOrder=e);if(this.rowViewOrder.sort((n,i)=>{const o=n;const s=i;let r=this.getCell(t,n).content;let l=this.getCell(t,i).content;r=null==r?"":r;l=null==l?"":l;if("none"===e)return o-s;if("asc"===e){if(r<l)return-1;if(r>l)return 1;if(r===l)return 0}else if("desc"===e){if(r<l)return 1;if(r>l)return-1;if(r===l)return 0}return 0}),this.hasColumnById("_rowIndex")){const t=this.getColumnIndexById("_rowIndex");this.rows.forEach((e,n)=>{const i=this.rowViewOrder.indexOf(n);const o=e[t];o.content=i+1+""})}}reverseArray(t){let e=null,n=null;for(e=0,n=t.length-1;e<n;e+=1,n-=1){const i=t[e];t[e]=t[n],t[n]=i}}switchColumn(t,e){const n=this.columns[t];this.columns[t]=this.columns[e],this.columns[e]=n,this.columns[t].colIndex=t,this.columns[e].colIndex=e,this.rows.forEach(n=>{const i=Object.assign({},n[t],{colIndex:e});const o=Object.assign({},n[e],{colIndex:t});n[e]=i;n[t]=o})}removeColumn(t){t=+t;const e=e=>e.colIndex!==t,n=(t,e)=>Object.assign({},t,{colIndex:e});this.columns=this.columns.filter(e).map(n),this.rows.forEach(e=>{e.splice(t,1);e.forEach((t,e)=>{t.colIndex=e})})}updateRow(t,e){if(t.length<this.columns.length){if(this.hasColumnById("_rowIndex")){const n=e+1+"";t=[n].concat(t)}if(this.hasColumnById("_checkbox")){const e='<input type="checkbox" />';t=[e].concat(t)}}const n=this.prepareRow(t,{rowIndex:e}),i=this.rows.findIndex(t=>t[0].rowIndex===e);return this.rows[i]=n,n}updateCell(t,e,n){let i;"object"==typeof t&&(t=(i=t).colIndex,e=i.rowIndex,n=i),i=this.getCell(t,e);for(let t in n){const e=n[t];void 0!==e&&(i[t]=e)}return i}updateColumn(t,e){const n=this.getColumn(t);for(let t in e){const i=e[t];void 0!==i&&(n[t]=i)}return n}filterRows(t){return this.options.filterRows(this.rows,t,this).then(t=>{t||(t=this.getAllRowIndices());t.then||(t=Promise.resolve(t));return t.then(t=>{this._filteredRows=t;const e=this.getAllRowIndices().filter(e=>!t.includes(e));return{rowsToHide:e,rowsToShow:t}})})}getFilteredRowIndices(){return this._filteredRows||this.getAllRowIndices()}getAllRowIndices(){return this.rows.map(t=>t.meta.rowIndex)}getRowCount(){return this.rowCount}_getNextRowCount(){const t=this.rowCount;return this.rowCount++,t}getRows(t,e){return this.rows.slice(t,e)}getRowsForView(t,e){return this.rowViewOrder.map(t=>this.rows[t]).slice(t,e)}getColumns(t){let e=this.columns;return t&&(e=e.slice(this.getStandardColumnCount())),e}getStandardColumnCount(){return this.options.checkboxColumn&&this.options.serialNoColumn?2:this.options.checkboxColumn||this.options.serialNoColumn?1:0}getColumnCount(t){let e=this.columns.length;return t&&(e-=this.getStandardColumnCount()),e}getColumn(t){return(t=+t)<0&&(t=this.columns.length+t),this.columns.find(e=>e.colIndex===t)}getColumnById(t){return this.columns.find(e=>e.id===t)}getRow(t){return t=+t,this.rows[t]}getCell(t,e){return e=+e,t=+t,this.getRow(e)[t]}getChildren(t){t=+t;const e=this.getRow(t).meta.indent,n=[];for(let i=t+1;i<this.rowCount;i++){const t=this.getRow(i);if(!isNaN(t.meta.indent)&&(t.meta.indent>e&&n.push(i),t.meta.indent===e))break}return n}getImmediateChildren(t){t=+t;const e=this.getRow(t).meta.indent,n=[],i=e+1;for(let o=t+1;o<this.rowCount;o++){const t=this.getRow(o);if(!(isNaN(t.meta.indent)||t.meta.indent>i)&&(t.meta.indent===i&&n.push(o),t.meta.indent===e))break}return n}get(){return{columns:this.columns,rows:this.rows}}getData(t){return this.data[t]}hasColumn(t){return Boolean(this.columns.find(e=>e.content===t))}hasColumnById(t){return Boolean(this.columns.find(e=>e.id===t))}getColumnIndex(t){return this.columns.findIndex(e=>e.content===t)}getColumnIndexById(t){return this.columns.findIndex(e=>e.id===t)}getCheckboxHTML(){return'<input type="checkbox" />'}}class Dn extends TypeError{}let zn={chevronDown:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down"><polyline points="6 9 12 15 18 9"></polyline></svg>',chevronRight:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>'};class Fn{constructor(t){this.instance=t,rt(this,this.instance,["wrapper","options","style","header","bodyScrollable","columnmanager","rowmanager","datamanager","keyboard","footer"]),this.bindEvents()}bindEvents(){this.bindFocusCell(),this.bindEditCell(),this.bindKeyboardSelection(),this.bindCopyCellContents(),this.bindMouseEvents(),this.bindWheelEvents(),this.bindTreeEvents()}bindFocusCell(){this.bindKeyboardNav()}bindEditCell(){this.$editingCell=null,e.on(this.bodyScrollable,"dblclick",".dt-cell",(t,e)=>{this.activateEditing(e)}),this.keyboard.on("enter",()=>{this.$focusedCell&&!this.$editingCell?this.activateEditing(this.$focusedCell):this.$editingCell&&this.deactivateEditing()})}bindKeyboardNav(){const t=t=>{if(!this.$focusedCell||this.$editingCell)return!1;let n=this.$focusedCell;const{rowIndex:rowIndex,colIndex:colIndex}=e.data(n);"left"===t?n=this.getLeftMostCell$(rowIndex):"right"===t?n=this.getRightMostCell$(rowIndex):"up"===t?n=this.getTopMostCell$(colIndex):"down"===t&&(n=this.getBottomMostCell$(colIndex));this.focusCell(n);sessionStorage.setItem("dt-last-nav-method","key");return!0};["left","right","up","down","tab","shift+tab"].map(t=>this.keyboard.on(t,()=>this.focusCellInDirection(t))),["left","right","up","down"].map(e=>this.keyboard.on(`ctrl+${e}`,()=>t(e))),this.keyboard.on("esc",()=>{this.deactivateEditing(!1);this.columnmanager.toggleFilter(!1)}),this.options.inlineFilters&&(this.keyboard.on("ctrl+f",t=>{const n=e.closest(".dt-cell",t.target);const{colIndex:colIndex}=e.data(n);this.activateFilter(colIndex);return!0}),e.on(this.header,"focusin",".dt-filter",()=>{this.unfocusCell(this.$focusedCell)}))}bindKeyboardSelection(){const t=t=>{let e=this.getSelectionCursor();"left"===t?e=this.getLeftCell$(e):"right"===t?e=this.getRightCell$(e):"up"===t?e=this.getAboveCell$(e):"down"===t&&(e=this.getBelowCell$(e));return e};["left","right","up","down"].map(e=>this.keyboard.on(`shift+${e}`,()=>this.selectArea(t(e))))}bindCopyCellContents(){this.keyboard.on("ctrl+c",()=>{const t=this.copyCellContents(this.$focusedCell,this.$selectionCursor);const e=this.instance.translate("{count} cells copied",{count:t});t&&this.instance.showToastMessage(e,2)}),this.options.pasteFromClipboard&&this.keyboard.on("ctrl+v",t=>{this.instance.pasteTarget.focus();setTimeout(()=>{const t=this.instance.pasteTarget.value;this.instance.pasteTarget.value="";this.pasteContentInCell(t)},10);return!1})}bindMouseEvents(){let t=null;e.on(this.bodyScrollable,"mousedown",".dt-cell",n=>{t=!0;this.focusCell(e(n.delegatedTarget))}),e.on(this.bodyScrollable,"mouseup",()=>{t=!1}),this.options.showTotalRow&&e.on(this.footer,"click",".dt-cell",t=>{this.focusCell(e(t.delegatedTarget))});const n=n=>{if(!t)return;this.selectArea(e(n.delegatedTarget))};e.on(this.bodyScrollable,"mousemove",".dt-cell",Ln(n,50))}bindWheelEvents(){e.on(this.bodyScrollable,"wheel",t=>{sessionStorage.setItem("dt-last-nav-method","scroll")})}bindTreeEvents(){e.on(this.bodyScrollable,"click",".dt-tree-node__toggle",(t,n)=>{const i=e.closest(".dt-cell",n);const{rowIndex:rowIndex}=e.data(i);i.classList.contains("dt-cell--tree-close")?this.rowmanager.openSingleNode(rowIndex):this.rowmanager.closeSingleNode(rowIndex)})}focusCell(t,{skipClearSelection:skipClearSelection=0,skipDOMFocus:skipDOMFocus=0,skipScrollToCell:skipScrollToCell=0}={}){if(t&&t!==this.$editingCell){const{colIndex:colIndex,isHeader:isHeader}=e.data(t);isHeader||!1!==this.columnmanager.getColumn(colIndex).focusable&&(skipScrollToCell||this.scrollToCell(t),this.deactivateEditing(),skipClearSelection||this.clearSelection(),this.$focusedCell&&this.$focusedCell.classList.remove("dt-cell--focus"),this.$focusedCell=t,t.classList.add("dt-cell--focus"),skipDOMFocus||t.focus(),this.highlightRowColumnHeader(t))}}unfocusCell(t){t&&(t.classList.remove("dt-cell--focus"),this.$focusedCell=null,this.lastHeaders&&this.lastHeaders.forEach(t=>t&&t.classList.remove("dt-cell--highlight")))}highlightRowColumnHeader(t){const{colIndex:colIndex,rowIndex:rowIndex}=e.data(t),n=`.dt-cell--header-${colIndex}`,i=`.dt-cell--${this.datamanager.getColumnIndexById("_rowIndex")}-${rowIndex}`;this.lastHeaders&&this.lastHeaders.forEach(t=>t&&t.classList.remove("dt-cell--highlight"));const o=e(n,this.wrapper),s=e(i,this.wrapper);this.lastHeaders=[o,s],this.lastHeaders.forEach(t=>t&&t.classList.add("dt-cell--highlight"))}selectAreaOnClusterChanged(){if(this.$focusedCell&&this.$selectionCursor){const{colIndex:colIndex,rowIndex:rowIndex}=e.data(this.$selectionCursor),t=this.getCell$(colIndex,rowIndex);if(t&&t!==this.$selectionCursor){const n=e.data(this.$focusedCell);this.$focusedCell=this.getCell$(n.colIndex,n.rowIndex),this.selectArea(t)}}}focusCellOnClusterChanged(){if(this.$focusedCell){const{colIndex:colIndex,rowIndex:rowIndex}=e.data(this.$focusedCell),t=this.getCell$(colIndex,rowIndex);if(t){const e="key"!==sessionStorage.getItem("dt-last-nav-method");this.focusCell(t,{skipDOMFocus:e,skipClearSelection:1,skipScrollToCell:1})}}}selectArea(t){this.$focusedCell&&this._selectArea(this.$focusedCell,t)&&(this.$selectionCursor=t)}_selectArea(t,e){if(t===e)return!1;const n=this.getCellsInRange(t,e);return!!n&&(this.clearSelection(),this._selectedCells=n.map(t=>this.getCell$(...t)),requestAnimationFrame(()=>{this._selectedCells.map(t=>t.classList.add("dt-cell--highlight"))}),!0)}getCellsInRange(t,n){let i,o,s,r;if("number"==typeof t)[i,o,s,r]=arguments;else if("object"==typeof t){if(!t||!n)return!1;const l=e.data(t),a=e.data(n);i=+l.colIndex,s=+a.colIndex,this.columnmanager.sortState?(this.sortedColumn=!0,o=this.datamanager.rowViewOrder.indexOf(parseInt(l.rowIndex,10)),r=this.datamanager.rowViewOrder.indexOf(parseInt(a.rowIndex,10))):(o=+l.rowIndex,r=+a.rowIndex)}if(o>r&&([o,r]=[r,o]),i>s&&([i,s]=[s,i]),this.isStandardCell(i)||this.isStandardCell(s))return!1;const l=[];let a=i,c=o;const h=[];for(;c<=r;)h.push(c),c+=1;return h.map(t=>{for(;a<=s;)l.push([a,t]),a++;a=i}),this.columnmanager.sortState&&l.forEach(t=>{t[1]=this.datamanager.rowViewOrder[t[1]]}),l}clearSelection(){(this._selectedCells||[]).forEach(t=>t.classList.remove("dt-cell--highlight")),this._selectedCells=[],this.$selectionCursor=null}getSelectionCursor(){return this.$selectionCursor||this.$focusedCell}activateEditing(t){this.focusCell(t);const{rowIndex:rowIndex,colIndex:colIndex}=e.data(t),n=this.columnmanager.getColumn(colIndex);if(!n||!1!==n.editable&&!1!==n.focusable){const i=this.getCell(colIndex,rowIndex);if(!i||!1!==i.editable){if(this.$editingCell){const{_rowIndex:_rowIndex,_colIndex:_colIndex}=e.data(this.$editingCell);if(rowIndex===_rowIndex&&colIndex===_colIndex)return}this.$editingCell=t,t.classList.add("dt-cell--editing");const o=e(".dt-cell__edit",t);o.innerHTML="";const s=this.getEditor(colIndex,rowIndex,i.content,o);s&&(this.currentCellEditor=s,s.initValue(i.content,rowIndex,n))}}}deactivateEditing(t=!0){t&&this.submitEditing(),this.$focusedCell&&this.$focusedCell.focus(),this.$editingCell&&(this.$editingCell.classList.remove("dt-cell--editing"),this.$editingCell=null)}getEditor(t,e,n,i){const o=this.datamanager.getColumn(t),s=this.datamanager.getRow(e),r=this.datamanager.getData(e);let l=this.options.getEditor?this.options.getEditor(t,e,n,i,o,s,r):this.getDefaultEditor(i);return!1!==l&&(void 0===l&&(l=this.getDefaultEditor(i)),l)}getDefaultEditor(t){const n=e.create("input",{class:"dt-input",type:"text",inside:t});return{initValue(t){n.focus(),n.value=t},getValue(){return n.value},setValue(t){n.value=t}}}submitEditing(){let t=Promise.resolve();if(!this.$editingCell)return t;const n=this.$editingCell,{rowIndex:rowIndex,colIndex:colIndex}=e.data(n),i=this.datamanager.getColumn(colIndex);if(n){const e=this.currentCellEditor;if(e){let o=e.getValue();o.then||(o=Promise.resolve(o)),t=o.then(t=>{const o=this.getCell(colIndex,rowIndex).content;if(o===t)return!1;const s=e.setValue(t,rowIndex,i);this.updateCell(colIndex,rowIndex,t,!0);n.focus();s&&s.then&&s.catch(t=>{console.log(t);this.updateCell(colIndex,rowIndex,o)});return s})}}return this.currentCellEditor=null,t}copyCellContents(t,n){if(!n&&t){const{colIndex:colIndex,rowIndex:rowIndex,isTotalRow:isTotalRow}=e.data(t);let n="";if(isTotalRow){let t=this.$focusedCell;n=t.children[0].title}else{const t=this.getCell(colIndex,rowIndex);n=t.content}return it(n),1}const i=this.getCellsInRange(t,n);if(!i)return 0;const o=i.map(t=>this.getCell(...t)).reduce((t,e)=>{const n=e.rowIndex;t[n]=t[n]||[];t[n].push(e.content);return t},[]);return it(o.map(t=>t.join("\t")).join("\n")),o.reduce((t,e)=>t+e.length,0)}pasteContentInCell(t){if(this.$focusedCell){const n=t.split("\n").map(t=>t.split("\t")).filter(t=>t.length&&t.every(t=>t));let{colIndex:colIndex,rowIndex:rowIndex}=e.data(this.$focusedCell),i={colIndex:+colIndex,rowIndex:+rowIndex};n.forEach((t,e)=>{let n=e+i.rowIndex;t.forEach((t,e)=>{let o=e+i.colIndex;this.updateCell(o,n,t,!0)})})}}activateFilter(t){this.columnmanager.toggleFilter(),this.columnmanager.focusFilter(t),this.columnmanager.isFilterShown||this.$focusedCell&&this.$focusedCell.focus()}updateCell(t,e,n,i=!1){const o=this.datamanager.updateCell(t,e,{content:n});this.refreshCell(o,i)}refreshCell(t,n=!1){e(this.selector(t.colIndex,t.rowIndex),this.bodyScrollable).innerHTML=this.getCellContent(t,n)}toggleTreeButton(t,e){const n=this.columnmanager.getFirstColumnIndex(),i=this.getCell$(n,t);i&&i.classList[e?"remove":"add"]("dt-cell--tree-close")}isStandardCell(t){return t<this.columnmanager.getFirstColumnIndex()}focusCellInDirection(t){if(!this.$focusedCell||this.$editingCell&&["left","right","up","down"].includes(t))return!1;this.$editingCell&&["tab","shift+tab"].includes(t)&&this.deactivateEditing();let n=this.$focusedCell;if("left"===t||"shift+tab"===t?n=this.getLeftCell$(n):"right"===t||"tab"===t?n=this.getRightCell$(n):"up"===t?n=this.getAboveCell$(n):"down"===t&&(n=this.getBelowCell$(n)),!n)return!1;const{colIndex:colIndex}=e.data(n);if(!this.columnmanager.getColumn(colIndex).focusable){let e=this.$focusedCell;this.unfocusCell(e),this.$focusedCell=n;let i=this.focusCellInDirection(t);return i||this.focusCell(e),i}return this.focusCell(n),sessionStorage.setItem("dt-last-nav-method","key"),!0}getCell$(t,n){return e(this.selector(t,n),this.bodyScrollable)}getAboveCell$(t){const{colIndex:colIndex}=e.data(t);let n=t.parentElement.previousElementSibling;for(;n&&n.classList.contains("dt-row--hide");)n=n.previousElementSibling;return n?e(`.dt-cell--col-${colIndex}`,n):t}getBelowCell$(t){const{colIndex:colIndex}=e.data(t);let n=t.parentElement.nextElementSibling;for(;n&&n.classList.contains("dt-row--hide");)n=n.nextElementSibling;return n?e(`.dt-cell--col-${colIndex}`,n):t}getLeftCell$(t){return t.previousElementSibling}getRightCell$(t){return t.nextElementSibling}getLeftMostCell$(t){return this.getCell$(this.columnmanager.getFirstColumnIndex(),t)}getRightMostCell$(t){return this.getCell$(this.columnmanager.getLastColumnIndex(),t)}getTopMostCell$(t){return this.getCell$(t,this.rowmanager.getFirstRowIndex())}getBottomMostCell$(t){return this.getCell$(t,this.rowmanager.getLastRowIndex())}getCell(t,e){return this.instance.datamanager.getCell(t,e)}getRowHeight(){return e.style(e(".dt-row",this.bodyScrollable),"height")}scrollToCell(t){if(e.inViewport(t,this.bodyScrollable)||e.inViewport(t,this.footer))return!1;const{rowIndex:rowIndex}=e.data(t);return this.rowmanager.scrollToRow(rowIndex),!1}getRowCountPerPage(){return Math.ceil(this.instance.getViewportHeight()/this.getRowHeight())}getCellHTML(t){const{rowIndex:rowIndex,colIndex:colIndex,isHeader:isHeader,isFilter:isFilter,isTotalRow:isTotalRow}=t,e=nt({rowIndex:rowIndex,colIndex:colIndex,isHeader:isHeader,isFilter:isFilter,isTotalRow:isTotalRow}),n=this.datamanager.getRow(rowIndex),i=t.column||this.datamanager.getColumn(colIndex)||{},o=!(isHeader||isFilter||isTotalRow),s=Boolean(i.sticky),r=this.datamanager.getColumns().filter(t=>t.sticky),l=r[r.length-1],a=s&&l&&l.colIndex===colIndex;return`\n <div class="${["dt-cell","dt-cell--col-"+colIndex,o?`dt-cell--${colIndex}-${rowIndex}`:"",o?"dt-cell--row-"+rowIndex:"",isHeader?"dt-cell--header":"",isHeader?`dt-cell--header-${colIndex}`:"",isFilter?"dt-cell--filter":"",o&&n&&n.meta.isTreeNodeClose?"dt-cell--tree-close":"",s?"dt-cell--sticky":"",s&&!o?"dt-cell--sticky-top":"",a?"dt-cell--sticky-last":""].join(" ")}" ${e} tabindex="0">\n ${this.getCellContent(t)}\n </div>\n `}getCellContent(t,e=!1){const{isHeader:isHeader,isFilter:isFilter,colIndex:colIndex}=t,n=!isHeader&&!1!==t.editable?this.getEditCellHTML(colIndex):"",i=isHeader&&!1!==t.sortable?`<span class="sort-indicator">\n ${this.options.sortIndicator[t.sortOrder]}\n </span>`:"",o=isHeader&&!1!==t.resizable?'<span class="dt-cell__resize-handle"></span>':"",s=isHeader&&!1!==t.dropdown?this.columnmanager.getDropdownHTML():"";let r,l=Fn.getCustomCellFormatter(t);if(isHeader||isFilter||!l)r=t.content;else if(!t.html||e){const e=this.datamanager.getRow(t.rowIndex),n=this.datamanager.getData(t.rowIndex);r=l(t.content,e,t.column,n)}else r=t.html;if(t.html=r,this.options.treeView&&!isHeader&&!isFilter&&void 0!==t.indent){const e=this.datamanager.getRow(t.rowIndex+1),n=e&&e.meta.indent>t.indent,i=this.datamanager.getColumnIndexById("_rowIndex")+1;if(i===t.colIndex){const e=20*(t.indent||0),i=n?`<span class="dt-tree-node__toggle" style="left: ${e-20}px">\n <span class="icon-open">${zn.chevronDown}</span>\n <span class="icon-close">${zn.chevronRight}</span>\n </span>`:"";r=`<span class="dt-tree-node" style="padding-left: ${e}px">\n ${i}\n <span>${r}</span>\n </span>`}}let a=`\n <div class="${["dt-cell__content",isHeader?`dt-cell__content--header-${colIndex}`:`dt-cell__content--col-${colIndex}`].join(" ")}">\n ${r}\n ${i}\n ${o}\n ${s}\n </div>\n ${n}\n `,c=document.createElement("div");c.innerHTML=r;let h=c.textContent;return h=h.replace(/\s+/g," ").trim(),a=a.replace(">",` title="${pt(h)}">`)}getEditCellHTML(t){return`<div class="dt-cell__edit dt-cell__edit--col-${t}"></div>`}selector(t,e){return`.dt-cell--${t}-${e}`}static getCustomCellFormatter(t){return t.format||t.column&&t.column.format||null}}class jn{constructor(t){this.instance=t,rt(this,this.instance,["options","fireEvent","header","datamanager","cellmanager","style","wrapper","rowmanager","bodyScrollable","bodyRenderer"]),this.bindEvents()}renderHeader(){this.header.innerHTML="<div></div>",this.refreshHeader()}refreshHeader(){const t=this.datamanager.getColumns();e("div",this.header).innerHTML=this.getHeaderHTML(t),this.$filterRow=e(".dt-row-filter",this.header),this.$filterRow&&e.style(this.$filterRow,{display:"none"}),this.$columnMap=[],this.bindMoveColumn()}getHeaderHTML(t){let e=this.rowmanager.getRowHTML(t,{isHeader:1});return this.options.inlineFilters&&(e+=this.rowmanager.getRowHTML(t,{isFilter:1})),e}bindEvents(){this.bindDropdown(),this.bindResizeColumn(),this.bindPerfectColumnWidth(),this.bindFilter()}bindDropdown(){function t(t){i.hideDropdown()}this.instance.dropdownContainer.innerHTML=this.getDropdownListHTML(),this.$dropdownList=this.instance.dropdownContainer.firstElementChild,e.on(this.header,"click",".dt-dropdown__toggle",t=>{this.openDropdown(t)});const n=e=>{const n=[".dt-dropdown__toggle",".dt-dropdown__toggle *",".dt-dropdown__list",".dt-dropdown__list *"].join(",");if(e.target.matches(n))return;t()};e.on(document.body,"click",n),document.addEventListener("scroll",t,!0),this.instance.on("onDestroy",()=>{e.off(document.body,"click",n);e.off(document,"scroll",t)}),e.on(this.$dropdownList,"click",".dt-dropdown__list-item",(t,n)=>{if(null==this._dropdownActiveColIndex)return;const i=this.options.headerDropdown;const{index:index}=e.data(n);const o=this._dropdownActiveColIndex;let s=i[index].action;s&&s.call(this.instance,this.getColumn(o));this.hideDropdown()});const i=this;this.stickDropdownIndex=this.options.headerDropdown.findIndex(t=>"stick"===t.stickyAction),this.unstickDropdownIndex=this.options.headerDropdown.findIndex(t=>"unstick"===t.stickyAction),this.hideDropdown()}openDropdown(t){this._dropdownWidth||(e.style(this.$dropdownList,{display:""}),this._dropdownWidth=e.style(this.$dropdownList,"width")),e.style(this.$dropdownList,{display:"",left:t.clientX-this._dropdownWidth+4+"px",top:t.clientY+4+"px"});const n=e.closest(".dt-cell",t.target),{colIndex:colIndex}=e.data(n);this._dropdownActiveColIndex=colIndex,this.updateStickyDropdownItems(this.getColumn(colIndex))}hideDropdown(){e.style(this.$dropdownList,{display:"none"}),this._dropdownActiveColIndex=null}bindResizeColumn(){let t,n,i,o=!1;e.on(this.header,"mousedown",".dt-cell .dt-cell__resize-handle",(s,r)=>{document.body.classList.add("dt-resize");const l=r.parentNode.parentNode;t=l;const{colIndex:colIndex}=e.data(t);const a=this.getColumn(colIndex);if(a&&!1===a.resizable)return;o=!0;n=e.style(e(".dt-cell__content",t),"width");i=s.pageX});const s=n=>{document.body.classList.remove("dt-resize");if(!t)return;o=!1;const{colIndex:colIndex}=e.data(t);this.setColumnWidth(colIndex);this.style.setBodyStyle();t=null};e.on(document.body,"mouseup",s),this.instance.on("onDestroy",()=>{e.off(document.body,"mouseup",s)});const r=s=>{if(!o)return;let r=s.pageX-i;"rtl"===this.options.direction&&(r*=-1);const l=n+r;const{colIndex:colIndex}=e.data(t);let a=this.options.minimumColumnWidth;if(a>l)return;this.datamanager.updateColumn(colIndex,{width:l});this.setColumnHeaderWidth(colIndex)};e.on(document.body,"mousemove",r),this.instance.on("onDestroy",()=>{e.off(document.body,"mousemove",r)})}bindPerfectColumnWidth(){e.on(this.header,"dblclick",".dt-cell .dt-cell__resize-handle",(t,n)=>{const i=n.parentNode.parentNode;const{colIndex:colIndex}=e.data(i);let o=this.bodyRenderer.visibleRows.map(t=>t[colIndex]).reduce((t,e)=>t.content.length>e.content.length?t:e);let s=this.cellmanager.getCellHTML(o);let r=document.createElement("div");r.innerHTML=s;let l=r.querySelector(".dt-cell__content").textContent;let{borderLeftWidth:borderLeftWidth,borderRightWidth:borderRightWidth,paddingLeft:paddingLeft,paddingRight:paddingRight}=e.getStyle(this.bodyScrollable.querySelector(".dt-cell__content"));let a=[borderLeftWidth,borderRightWidth,paddingLeft,paddingRight].map(parseFloat).reduce((t,e)=>t+e);let c=e.measureTextWidth(l)+a;this.datamanager.updateColumn(colIndex,{width:c});this.setColumnHeaderWidth(colIndex);this.setColumnWidth(colIndex)})}bindMoveColumn(){if(!this.options.disableReorderColumn){const n=e(".dt-row",this.header);this.sortable=t.create(n,{onEnd:t=>{const{oldIndex:oldIndex,newIndex:newIndex}=t;const n=t.item;const{colIndex:colIndex}=e.data(n);if(+colIndex===newIndex)return;this.switchColumn(oldIndex,newIndex)},preventOnFilter:!1,filter:".dt-cell__resize-handle, .dt-dropdown",chosenClass:"dt-cell--dragging",animation:150})}}sortColumn(t,e){this.instance.freeze(),this.sortRows(t,e).then(()=>{this.refreshHeader();return this.rowmanager.refreshRows()}).then(()=>this.instance.unfreeze()).then(()=>{this.fireEvent("onSortColumn",this.getColumn(t));this.setSortState()})}saveSorting(t){let e=this.getColumn(t),n={[e.name]:{colIndex:t,sortOrder:e.sortOrder}};this.sortingKey=this.options.sortingKey?`${this.options.sortingKey}::sortedColumns`:"sortedColumns",localStorage.setItem(this.sortingKey,JSON.stringify(n))}setSortState(t){this.sortState="none"!==t}removeColumn(t){const e=this.getColumn(t);this.instance.freeze(),this.datamanager.removeColumn(t).then(()=>{this.refreshHeader();return this.rowmanager.refreshRows()}).then(()=>this.instance.unfreeze()).then(()=>{this.fireEvent("onRemoveColumn",e)})}setColumnSticky(t,e){const n=this.getColumn(t);n&&n.sticky!==e&&(this.instance.freeze(),this.datamanager.updateColumn(t,{sticky:e}),this.refreshHeader(),this.rowmanager.refreshRows().then(()=>this.instance.unfreeze()))}switchColumn(t,e){this.instance.freeze(),this.datamanager.switchColumn(t,e).then(()=>{this.refreshHeader();return this.rowmanager.refreshRows()}).then(()=>{this.setColumnWidth(t);this.setColumnWidth(e);this.instance.unfreeze()}).then(()=>{this.fireEvent("onSwitchColumn",this.getColumn(t),this.getColumn(e))})}toggleFilter(t){if(this.options.inlineFilters){let n;(n=void 0===t?!this.isFilterShown:t)?e.style(this.$filterRow,{display:""}):e.style(this.$filterRow,{display:"none"}),this.isFilterShown=n,this.style.setBodyStyle()}}focusFilter(t){this.isFilterShown&&e(`.dt-cell--col-${t} .dt-filter`,this.$filterRow).focus()}bindFilter(){if(this.options.inlineFilters){const t=t=>{this.applyFilter(this.getAppliedFilters())};e.on(this.header,"keydown",".dt-filter",Mn(t,300))}}applyFilter(t){this.datamanager.filterRows(t).then(({rowsToShow:rowsToShow})=>{this.rowmanager.showRows(rowsToShow)})}getAppliedFilters(){const t={};return e.each(".dt-filter",this.header).map(e=>{const n=e.value;n&&(t[e.dataset.colIndex]=n)}),t}applyDefaultSortOrder(){const t=this.getColumns().filter(t=>"none"!==t.sortOrder);if(1===t.length){const e=t[0];this.sortColumn(e.colIndex,e.sortOrder)}}applySavedSortOrder(){let t=this.options.sortingKey?`${this.options.sortingKey}::sortedColumns`:"sortedColumns",e=JSON.parse(localStorage.getItem(t));if(e){const t=Object.values(e);for(let e of t)this.sortColumn(e.colIndex,e.sortOrder),this.sortState=!0}}sortRows(t,e){return this.datamanager.sortRows(t,e)}getColumn(t){return this.datamanager.getColumn(t)}getColumns(){return this.datamanager.getColumns()}setColumnWidth(t,e){t=+t;let n=e||this.getColumn(t).width;const i=[`.dt-cell__content--col-${t}`,`.dt-cell__edit--col-${t}`].join(", "),o={width:n+"px"};this.style.setStyle(i,o)}setColumnHeaderWidth(t){t=+t,this.$columnMap=this.$columnMap||[];const e=`.dt-cell__content--header-${t}`,{width:width}=this.getColumn(t);let n=this.$columnMap[t];n||(n=this.header.querySelector(e),this.$columnMap[t]=n),n.style.width=width+"px"}getColumnMinWidth(t){return t=+t,this.getColumn(t).minWidth||24}getFirstColumnIndex(){return this.datamanager.getColumnIndexById("_rowIndex")+1}getHeaderCell$(t){return e(`.dt-cell--header-${t}`,this.header)}getLastColumnIndex(){return this.datamanager.getColumnCount()-1}getDropdownHTML(){const{dropdownButton:dropdownButton}=this.options;return`\n <div class="dt-dropdown">\n <div class="dt-dropdown__toggle">${dropdownButton}</div>\n </div>\n `}getDropdownListHTML(){const{headerDropdown:dropdownItems}=this.options;return`\n <div class="dt-dropdown__list">\n ${dropdownItems.map((t,e)=>`\n <div \n class="dt-dropdown__list-item${t.display?" dt-hidden":""}" \n data-index="${e}"\n >\n ${t.label}\n </div>\n `).join("")}\n </div>\n `}toggleDropdownItem(t){e(".dt-dropdown__list",this.instance.dropdownContainer).children[t].classList.toggle("dt-hidden")}updateStickyDropdownItems(t){if(t&&-1!==this.stickDropdownIndex&&-1!==this.unstickDropdownIndex){const e=this.$dropdownList.children[this.stickDropdownIndex],n=this.$dropdownList.children[this.unstickDropdownIndex];e&&n&&(t.sticky?(e.classList.add("dt-hidden"),n.classList.remove("dt-hidden")):(e.classList.remove("dt-hidden"),n.classList.add("dt-hidden")))}}}class An{constructor(t){this.instance=t,rt(this,this.instance,["options","fireEvent","wrapper","bodyScrollable","bodyRenderer","style"]),this.bindEvents(),this.refreshRows=st(this.refreshRows,this)}get datamanager(){return this.instance.datamanager}get cellmanager(){return this.instance.cellmanager}bindEvents(){this.bindCheckbox()}bindCheckbox(){this.options.checkboxColumn&&(this.checkMap=[],e.on(this.wrapper,"click",'.dt-cell--col-0 [type="checkbox"]',(t,n)=>{const i=n.closest(".dt-cell");const{rowIndex:rowIndex,isHeader:isHeader}=e.data(i);const o=n.checked;isHeader?this.checkAll(o):this.checkRow(rowIndex,o)}))}refreshRows(){this.instance.renderBody(),this.instance.setDimensions()}refreshRow(t,e){this.datamanager.updateRow(t,e).forEach(t=>{this.cellmanager.refreshCell(t,!0)})}getCheckedRows(){if(!this.checkMap)return[];let t=[];for(let e in this.checkMap){const n=this.checkMap[e];1===n&&t.push(e)}return t}highlightCheckedRows(){this.getCheckedRows().map(t=>this.checkRow(t,!0))}checkRow(t,n){const i=n?1:0,o=t=>`.dt-cell--0-${t} [type="checkbox"]`;this.checkMap[t]=i,e.each(o(t),this.bodyScrollable).map(t=>{t.checked=n}),this.highlightRow(t,n),this.showCheckStatus(),this.fireEvent("onCheckRow",this.datamanager.getRow(t))}checkAll(t){const n=t?1:0;t?this.datamanager._filteredRows?this.datamanager._filteredRows.forEach(e=>{this.checkRow(e,t)}):this.checkMap=Array.from(Array(this.getTotalRows())).map(t=>n):this.checkMap=[],e.each('.dt-cell--col-0 [type="checkbox"]',this.bodyScrollable).map(e=>{e.checked=t}),this.highlightAll(t),this.showCheckStatus(),this.fireEvent("onCheckRow")}showCheckStatus(){if(this.options.checkedRowStatus){const t=this.getCheckedRows().length;if(t>0){let e=this.instance.translate("{count} rows selected",{count:t});this.bodyRenderer.showToastMessage(e)}else this.bodyRenderer.clearToastMessage()}}highlightRow(t,e=!0){const n=this.getRow$(t);if(n){if(!e&&this.bodyScrollable.classList.contains("dt-scrollable--highlight-all"))return void n.classList.add("dt-row--unhighlight");e&&n.classList.contains("dt-row--unhighlight")&&n.classList.remove("dt-row--unhighlight"),this._highlightedRows=this._highlightedRows||{},e?(n.classList.add("dt-row--highlight"),this._highlightedRows[t]=n):(n.classList.remove("dt-row--highlight"),delete this._highlightedRows[t])}}highlightAll(t=!0){if(t)this.bodyScrollable.classList.add("dt-scrollable--highlight-all");else{this.bodyScrollable.classList.remove("dt-scrollable--highlight-all");for(const t in this._highlightedRows){const e=this._highlightedRows[t];e.classList.remove("dt-row--highlight")}this._highlightedRows={}}}showRows(t){const e=(t=ht(t)).map(t=>this.datamanager.getRow(t));this.bodyRenderer.renderRows(e)}showAllRows(){const t=this.datamanager.getAllRowIndices();this.showRows(t)}getChildrenToShowForNode(t){return this.datamanager.getRow(t).meta.isTreeNodeClose=!1,this.datamanager.getImmediateChildren(t)}openSingleNode(t){const e=ut([...this.getChildrenToShowForNode(t),...this.bodyRenderer.visibleRowIndices]).sort(dt);this.showRows(e)}getChildrenToHideForNode(t){this.datamanager.getRow(t).meta.isTreeNodeClose=!0;const e=this.datamanager.getChildren(t);return e.forEach(t=>{const e=this.datamanager.getRow(t);e.meta.isLeaf||(e.meta.isTreeNodeClose=!0)}),e}closeSingleNode(t){const e=this.getChildrenToHideForNode(t),n=this.bodyRenderer.visibleRowIndices.filter(t=>!e.includes(t)).sort(dt);this.showRows(n)}expandAllNodes(){const t=ut([...this.datamanager.getRows().filter(t=>!t.meta.isLeaf).map(t=>this.getChildrenToShowForNode(t.meta.rowIndex)).flat(),...this.bodyRenderer.visibleRowIndices]).sort(dt);this.showRows(t)}collapseAllNodes(){const t=this.datamanager.getRows().filter(t=>0===t.meta.indent).map(t=>this.getChildrenToHideForNode(t.meta.rowIndex)).flat(),e=this.bodyRenderer.visibleRowIndices.filter(e=>!t.includes(e)).sort(dt);this.showRows(e)}setTreeDepth(t){let e=this.datamanager.getRows();const n=e.filter(e=>e.meta.indent<t),i=e.filter(e=>e.meta.indent>=t),o=i.filter(e=>e.meta.indent>t);i.forEach(t=>{t.meta.isLeaf||(t.meta.isTreeNodeClose=!0)}),n.forEach(t=>{t.meta.isLeaf||(t.meta.isTreeNodeClose=!1)});const s=e.filter(t=>!o.includes(t)).map(t=>t.meta.rowIndex).sort(dt);this.showRows(s)}getRow$(t){return e(this.selector(t),this.bodyScrollable)}getTotalRows(){return this.datamanager.getRowCount()}getFirstRowIndex(){return 0}getLastRowIndex(){return this.datamanager.getRowCount()-1}scrollToRow(t){t=+t,this._lastScrollTo=this._lastScrollTo||0;const n=this.getRow$(t);if(!e.inViewport(n,this.bodyScrollable)){const{height:height}=n.getBoundingClientRect(),{top:top,bottom:bottom}=this.bodyScrollable.getBoundingClientRect(),i=Math.floor((bottom-top)/height);let o=0;o=t>this._lastScrollTo?height*(t+1-i):height*(t+1-1),this._lastScrollTo=t,e.scrollTop(this.bodyScrollable,o)}}getRowHTML(t,e){const n=nt(e);let i=e.rowIndex;return e.isFilter&&(t=t.map(t=>Object.assign({},t,{content:this.getFilterInput({colIndex:t.colIndex,name:t.name}),isFilter:1,isHeader:void 0,editable:!1})),i="filter"),e.isHeader&&(i="header"),`\n <div class="dt-row dt-row-${i}" ${n}>\n ${t.map(t=>this.cellmanager.getCellHTML(t)).join("")}\n </div>\n `}getFilterInput(t){let e=`title="Filter based on ${t.name||"Index"}"`;return`<input class="dt-filter dt-input" type="text" ${nt(t)} tabindex="1"\n ${0===t.colIndex?"disabled":e} />`}selector(t){return`.dt-row-${t}`}}var Wn=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){!function(e){t.exports=function(){return function t(e,n,i){function s(l,a){if(!n[l]){if(!e[l]){var c="function"==typeof o&&o;if(!a&&c)return c(l,!0);if(r)return r(l,!0);var h=new Error("Cannot find module '"+l+"'");throw h.code="MODULE_NOT_FOUND",h}var u=n[l]={exports:{}};e[l][0].call(u.exports,function(t){var n=e[l][1][t];return s(n||t)},u,u.exports,t,e,n,i)}return n[l].exports}for(var r="function"==typeof o&&o,l=0;l<i.length;l++)s(i[l]);return s}({1:[function(t,e,n){function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s={width:"100%",height:"100%"},r=function(t){return Number(t)===Number(t)},l=function(){function t(e,n){var o=this;i(this,t),this._config={},this._lastRepaint=null,this._maxElementHeight=t.getMaxBrowserHeight(),this.refresh(e,n);var s=this._config;!function t(){var e=o._getScrollPosition(),n=o._lastRepaint;if(o._renderAnimationFrame=window.requestAnimationFrame(t),e!==n&&(!n||Math.abs(e-n)>o._averageHeight)){var i=o._renderChunk();o._lastRepaint=e,!1!==i&&"function"==typeof s.afterRender&&s.afterRender()}}()}return o(t,null,[{key:"create",value:function(e,n){return new t(e,n)}},{key:"mergeStyle",value:function(t,e){for(var n in e)t.style[n]!==e[n]&&(t.style[n]=e[n])}},{key:"getMaxBrowserHeight",value:function(){var e=document.createElement("div"),n=document.createElement("div");t.mergeStyle(e,{position:"absolute",height:"1px",opacity:0}),t.mergeStyle(n,{height:"1e7px"}),e.appendChild(n),document.body.appendChild(e);var i=n.offsetHeight;return document.body.removeChild(e),i}}]),o(t,[{key:"destroy",value:function(){window.cancelAnimationFrame(this._renderAnimationFrame)}},{key:"refresh",value:function(e,n){var i=this;if(Object.assign(this._config,s,n),!e||1!==e.nodeType)throw new Error("HyperList requires a valid DOM Node container");this._element=e;var o=this._config,l=this._scroller||o.scroller||document.createElement(o.scrollerTagName||"tr");if("boolean"!=typeof o.useFragment&&(this._config.useFragment=!0),!o.generate)throw new Error("Missing required `generate` function");if(!r(o.total))throw new Error("Invalid required `total` value, expected number");if(!Array.isArray(o.itemHeight)&&!r(o.itemHeight))throw new Error("\n Invalid required `itemHeight` value, expected number or array\n ".trim());r(o.itemHeight)?this._itemHeights=Array(o.total).fill(o.itemHeight):this._itemHeights=o.itemHeight,Object.keys(s).filter(function(t){return t in o}).forEach(function(t){var e=o[t],n=r(e),s=!n&&"%"===e.slice(-1);if(e&&"string"!=typeof e&&"number"!=typeof e){var l="Invalid optional `"+t+"`, expected string or number";throw new Error(l)}if(n&&(o[t]=e+"px"),"height"===t){var a=n?e:parseInt(e.replace(/px|%/,""),10);i._containerHeight=s?window.innerHeight*a/100:r(e)?e:a}});var a={width:""+o.width,height:""+o.height,overflow:"auto",position:"relative"};t.mergeStyle(e,a);var c=o.itemHeight*o.total,h=this._maxElementHeight;c>h&&console.warn(["HyperList: The maximum element height",h+"px has","been exceeded; please reduce your item height."].join(" "));var u={opacity:"0",position:"absolute",width:"1px",height:c+"px"};t.mergeStyle(l,u),this._scroller||e.appendChild(l),this._scroller=l,this._scrollHeight=this._computeScrollHeight(),this._itemPositions=this._itemPositions||Array(o.total).fill(0),this._computePositions(0),this._renderChunk(null!==this._lastRepaint),"function"==typeof o.afterRender&&o.afterRender()}},{key:"_getRow",value:function(e){var n=this._config,i=n.generate(e),o=i.height;if(void 0!==o&&r(o)?(i=i.element,o!==this._itemHeights&&(this._itemHeights[e]=o,this._computePositions(e),this._scrollHeight=this._computeScrollHeight(e))):o=this._itemHeights[e],!i||1!==i.nodeType)throw new Error("Generator did not return a DOM Node for index: "+e);var s=i.getAttribute("class")||"";i.setAttribute("class",s+" "+(n.rowClassName||"vrow"));var l=this._itemPositions[e];return t.mergeStyle(i,{position:"absolute",top:l+"px"}),i}},{key:"_getScrollPosition",value:function(){var t=this._config;return"function"==typeof t.overrideScrollPosition?t.overrideScrollPosition():this._element.scrollTop}},{key:"_renderChunk",value:function(t){var e=this._config,n=this._element,i=this._getScrollPosition(),o=e.total,s=e.reverse?this._getReverseFrom(i):this._getFrom(i)-1;if((s<0||s-this._screenItemsLen<0)&&(s=0),!t&&this._lastFrom===s)return!1;this._lastFrom=s;var r=s+this._cachedItemsLen;(r>o||r+this._cachedItemsLen>o)&&(r=o);var l=e.useFragment?document.createDocumentFragment():[],a=this._scroller;l[e.useFragment?"appendChild":"push"](a);for(var c=s;c<r;c++){var h=this._getRow(c);l[e.useFragment?"appendChild":"push"](h)}if(e.applyPatch)return e.applyPatch(n,l);n.innerHTML="",n.appendChild(l)}},{key:"_computePositions",value:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],e=this._config,n=e.total,i=e.reverse;t<1&&!i&&(t=1);for(var o=t;o<n;o++)i?0===o?this._itemPositions[0]=this._scrollHeight-this._itemHeights[0]:this._itemPositions[o]=this._itemPositions[o-1]-this._itemHeights[o]:this._itemPositions[o]=this._itemHeights[o-1]+this._itemPositions[o-1]}},{key:"_computeScrollHeight",value:function(){var e=this,n=this._config,i=n.total,o=this._itemHeights.reduce(function(t,e){return t+e},0);t.mergeStyle(this._scroller,{opacity:0,position:"absolute",width:"1px",height:o+"px"});var s=this._itemHeights.slice(0).sort(function(t,e){return t-e}),r=Math.floor(i/2),l=i%2==0?(s[r]+s[r-1])/2:s[r],a=this._element.clientHeight?this._element.clientHeight:this._containerHeight;return this._screenItemsLen=Math.ceil(a/l),this._containerHeight=a,this._cachedItemsLen=Math.max(this._cachedItemsLen||0,3*this._screenItemsLen),this._averageHeight=l,n.reverse&&window.requestAnimationFrame(function(){e._element.scrollTop=o}),o}},{key:"_getFrom",value:function(t){for(var e=0;this._itemPositions[e]<t;)e++;return e}},{key:"_getReverseFrom",value:function(t){for(var e=this._config.total-1;e>0&&this._itemPositions[e]<t+this._containerHeight;)e--;return e}}]),t}();n.default=l,e.exports=n.default},{}]},{},[1])(1)}()}()}));class Nn{constructor(t){this.instance=t,this.options=t.options,this.datamanager=t.datamanager,this.rowmanager=t.rowmanager,this.cellmanager=t.cellmanager,this.bodyScrollable=t.bodyScrollable,this.footer=this.instance.footer,this.log=t.log}renderRows(t){if(this.visibleRows=t,this.visibleRowIndices=t.map(t=>t.meta.rowIndex),this.instance.noData=!1,0===t.length)return this.bodyScrollable.innerHTML=this.getNoDataHTML(),this.instance.noData=!0,void(this.footer.innerHTML="");let e=new Set(this.visibleRowIndices);const n=this.datamanager.rowViewOrder.map(t=>{if(e.has(t))return t;return null}).filter(t=>null!==t),i=getComputedStyle(this.bodyScrollable);let o={width:i.width,height:i.height,itemHeight:this.options.cellHeight,total:t.length,generate:t=>{const e=document.createElement("div");const i=n[t];const o=this.datamanager.getRow(i);const s=this.rowmanager.getRowHTML(o,o.meta);e.innerHTML=s;return e.children[0]},afterRender:()=>{this.restoreState()}};this.hyperlist?this.hyperlist.refresh(this.bodyScrollable,o):this.hyperlist=new Wn(this.bodyScrollable,o),this.renderFooter()}render(){const t=this.getRowsToRender();this.renderRows(t),this.instance.setDimensions()}getRowsToRender(){let t=null;return this.datamanager.getRowsForView().filter(e=>{const{indent:indent,isTreeNodeClose:isTreeNodeClose}=e.meta;if(null!==t&&indent>t)return!1;t=isTreeNodeClose?indent:null;return!0})}renderFooter(){if(this.options.showTotalRow){const t=this.getTotalRow();let e=this.rowmanager.getRowHTML(t,{isTotalRow:1,rowIndex:"totalRow"});this.footer.innerHTML=e}}getTotalRow(){return this.datamanager.getColumns().map(t=>{let e=null;["_rowIndex","_checkbox"].includes(t.id)&&(e="");return{content:e,isTotalRow:1,colIndex:t.colIndex,column:t}}).map((t,e)=>{if(""===t.content)return t;if(this.options.hooks.columnTotal){const n=this.visibleRows.map(t=>t[e].content),i=this.options.hooks.columnTotal.call(this.instance,n,t);if(null!=i)return t.content=i,t}t.content=this.visibleRows.reduce((t,n)=>{const i=n[e];if("number"==typeof i.content)return null==t&&(t=0),t+i.content;return t},t.content);return t})}restoreState(){this.rowmanager.highlightCheckedRows(),this.cellmanager.selectAreaOnClusterChanged(),this.cellmanager.focusCellOnClusterChanged()}showToastMessage(t,e){this.instance.toastMessage.innerHTML=this.getToastMessageHTML(t),e&&setTimeout(()=>{this.clearToastMessage()},1e3*e)}clearToastMessage(){this.instance.toastMessage.innerHTML=""}getNoDataHTML(){const t=window.getComputedStyle(this.instance.header);return`\n <div \n class="dt-scrollable__no-data" \n style="width: ${-new DOMMatrixReadOnly(t.transform).m41+this.instance.header.clientWidth}px; height: ${this.bodyScrollable.clientHeight}px"\n >\n <div class="dt-scrollable__no-data no-data-message">\n ${this.options.noDataMessage}\n </div>\n </div>\n `}getToastMessageHTML(t){return`<span class="dt-toast__message">${t}</span>`}}class Pn{constructor(t){this.instance=t,rt(this,this.instance,["options","datamanager","columnmanager","header","footer","bodyScrollable","datatableWrapper","getColumn","bodyRenderer"]),this.scopeClass="dt-instance-"+t.constructor.instances,t.datatableWrapper.classList.add(this.scopeClass);const e=document.createElement("style");t.wrapper.insertBefore(e,t.datatableWrapper),this.styleEl=e,this.bindResizeWindow(),this.bindScrollHeader()}get stylesheet(){return this.styleEl.sheet}bindResizeWindow(){this.onWindowResize=this.onWindowResize.bind(this),this.onWindowResize=Ln(this.onWindowResize,300),"fluid"===this.options.layout&&e.on(window,"resize",this.onWindowResize)}bindScrollHeader(){this._settingHeaderPosition=!1,this.updateStickyTopPositions(0),e.on(this.bodyScrollable,"scroll",t=>{if(this._settingHeaderPosition)return;this._settingHeaderPosition=!0;requestAnimationFrame(()=>{const n=t.target.scrollLeft;const i=-n;e.style(this.header,{transform:`translateX(${i}px)`});e.style(this.footer,{transform:`translateX(${i}px)`});this.updateStickyTopPositions(n);this._settingHeaderPosition=!1;this.instance.noData&&e.style(e(".no-data-message"),{left:`${this.instance.wrapper.clientWidth/2-i}px`});this._settingHeaderPosition=!1})})}onWindowResize(){this.distributeRemainingWidth(),this.refreshColumnWidth(),this.setBodyStyle()}destroy(){this.styleEl.remove(),e.off(window,"resize",this.onWindowResize)}setStyle(t,e){if(t.includes(","))return void t.split(",").map(t=>t.trim()).forEach(t=>{this.setStyle(t,e)});if(t=t.trim()){this._styleRulesMap=this._styleRulesMap||{};const n=this._getPrefixedSelector(t);this._styleRulesMap[n]&&(this.removeStyle(t),e=Object.assign({},this._styleRulesMap[n],e));const i=`${n} { ${this._getRuleString(e)} }`;this._styleRulesMap[n]=e,this.stylesheet.insertRule(i)}}removeStyle(t){if(t.includes(","))return void t.split(",").map(t=>t.trim()).forEach(t=>{this.removeStyle(t)});if(t=t.trim()){const e=this._getPrefixedSelector(t),n=Array.from(this.stylesheet.cssRules).findIndex(t=>t.selectorText===e);-1!==n&&this.stylesheet.deleteRule(n)}}_getPrefixedSelector(t){return`.${this.scopeClass} ${t}`}_getRuleString(t){return Object.keys(t).map(e=>{let n=e;e.includes("-")||(n=et(e));return`${n}:${t[e]};`}).join("")}setDimensions(){this.setCellHeight(),this.setupMinWidth(),this.setupNaturalColumnWidth(),this.setupColumnWidth(),this.distributeRemainingWidth(),this.setColumnStyle(),this.setStickyColumnStyle(),this.updateStickyTopPositions(this.bodyScrollable.scrollLeft||0),this.setBodyStyle()}setCellHeight(){this.setStyle(".dt-cell",{height:this.options.cellHeight+"px"})}setupMinWidth(){e.each(".dt-cell--header",this.header).map(t=>{const{colIndex:colIndex}=e.data(t);const n=this.getColumn(colIndex);if(!n.minWidth){const i=e.style(e(".dt-cell__content",t),"width");n.minWidth=i}})}setupNaturalColumnWidth(){e(".dt-row")&&(e.each(".dt-row-header .dt-cell",this.header).map(t=>{const{colIndex:colIndex}=e.data(t);const n=this.datamanager.getColumn(colIndex);let i=e.style(e(".dt-cell__content",t),"width");"number"==typeof i&&i>=this.options.minimumColumnWidth?n.naturalWidth=i:n.naturalWidth=this.options.minimumColumnWidth}),e.each(".dt-row-0 .dt-cell",this.bodyScrollable).map(t=>{const{colIndex:colIndex}=e.data(t);const n=this.datamanager.getColumn(colIndex);let i=e.style(e(".dt-cell__content",t),"width");"number"==typeof i&&i>=n.naturalWidth?n.naturalWidth=i:n.naturalWidth=n.naturalWidth}))}setupColumnWidth(){if("ratio"===this.options.layout){let t=e.style(this.datatableWrapper,"width");if(this.options.serialNoColumn){const e=this.datamanager.getColumnById("_rowIndex");t=t-e.width-1}if(this.options.checkboxColumn){const e=this.datamanager.getColumnById("_checkbox");t=t-e.width-1}const n=this.datamanager.getColumns().map(t=>{if("_rowIndex"===t.id||"_checkbox"===t.id)return 0;t.width||(t.width=1);t.ratioWidth=parseInt(t.width,10);return t.ratioWidth}).reduce((t,e)=>t+e),i=t/n;this.datamanager.getColumns().map(t=>{if("_rowIndex"===t.id||"_checkbox"===t.id)return;t.width=Math.floor(i*t.ratioWidth)-1})}else this.datamanager.getColumns().map(t=>{t.width||(t.width=t.naturalWidth);"_rowIndex"===t.id&&(t.width=this.getRowIndexColumnWidth());t.width<this.options.minimumColumnWidth&&(t.width=this.options.minimumColumnWidth)})}distributeRemainingWidth(){if("fluid"===this.options.layout){const t=e.style(this.instance.datatableWrapper,"width");let n=e(".dt-row",this.bodyScrollable),i=t;if(n)i=e.style(n,"width");else{let t=e(".dt-row",this.instance.header),n=Array.from(t.children).map(t=>t.offsetWidth);i=n.reduce((t,e)=>t+e,0)}const o=this.datamanager.getColumns().filter(t=>t.resizable),s=(t-i)/o.length;o.map(t=>{const n=e.style(this.getColumnHeaderElement(t.colIndex),"width");let i=Math.floor(n+s)-2;this.datamanager.updateColumn(t.colIndex,{width:i})})}}setColumnStyle(){this.datamanager.getColumns().map(t=>{t.align||(t.align="left");["left","center","right"].includes(t.align)||(t.align="left");this.setStyle(`.dt-cell--col-${t.colIndex}`,{"text-align":t.align});this.columnmanager.setColumnHeaderWidth(t.colIndex);this.columnmanager.setColumnWidth(t.colIndex)})}refreshColumnWidth(){this.datamanager.getColumns().map(t=>{this.columnmanager.setColumnHeaderWidth(t.colIndex);this.columnmanager.setColumnWidth(t.colIndex)}),this.setStickyColumnStyle(),this.updateStickyTopPositions(this.bodyScrollable.scrollLeft||0)}setBodyStyle(){const t=e.style(this.datatableWrapper,"width"),n=e(".dt-row",this.bodyScrollable);if(n){const i=e.style(n,"width");let o=t>i?i+10:t;e.style(this.bodyScrollable,{width:o+"px"}),e.removeStyle(this.bodyScrollable,"height");let s=e.getStyle(this.bodyScrollable,"height");const r=(this.bodyRenderer.hyperlist||{})._scrollHeight||1/0,l=e.hasHorizontalOverflow(this.bodyScrollable);let a;r<s&&(a=r,l&&(a+=e.scrollbarSize()),e.style(this.bodyScrollable,{height:a+"px"})),this.bodyScrollable.scrollHeight-this.bodyScrollable.offsetHeight<e.scrollbarSize()&&e.style(this.bodyScrollable,{overflowY:"hidden"}),"fluid"===this.options.layout&&e.style(this.bodyScrollable,{overflowX:"hidden"})}}getColumnHeaderElement(t){return t=+t,t<0?null:e(`.dt-cell--col-${t}`,this.header)}setStickyColumnStyle(){if(this.datamanager&&this.datamanager.getColumns){const t=[];let e=0,n=0;this.datamanager.getColumns().forEach(i=>{const o=this.getColumnHeaderElement(i.colIndex);const s=o?o.offsetWidth:i.width;if(i.sticky){const o=`.dt-cell--col-${i.colIndex}.dt-cell--sticky`,r={left:`${e}px`};i.stickyLeft=e,i.stickyScrollTrigger=n-e,i.renderedWidth=s,this.setStyle(o,r),t.push(o),e+=s}n+=s}),(this._stickySelectors||[]).filter(e=>!t.includes(e)).forEach(t=>this.removeStyle(t)),this._stickySelectors=t}}updateStickyTopPositions(t){this.datamanager&&this.datamanager.getColumns&&this.datamanager.getColumns().filter(t=>t.sticky).forEach(n=>{const i=Math.max(0,n.stickyScrollTrigger||0);const o=Math.max(0,t-i);const s=e.each(`.dt-cell--col-${n.colIndex}.dt-cell--sticky-top`,this.wrapper)||[];e.style(s,{transform:o?`translateX(${o}px)`:""})})}getRowIndexColumnWidth(){const t=this.datamanager.getRowCount();return e.measureTextWidth(t+"")+22}}const Bn={13:"enter",91:"meta",16:"shift",17:"ctrl",18:"alt",37:"left",38:"up",39:"right",40:"down",9:"tab",27:"esc",67:"c",70:"f",86:"v"};class Vn{constructor(t){this.listeners={},e.on(t,"keydown",this.handler.bind(this))}handler(t){let e=Bn[t.keyCode];t.shiftKey&&"shift"!==e&&(e="shift+"+e),(t.ctrlKey&&"ctrl"!==e||t.metaKey&&"meta"!==e)&&(e="ctrl+"+e);const n=this.listeners[e];if(n&&n.length>0)for(let e of n){const n=e(t);void 0!==n&&!0!==n||t.preventDefault()}}on(t,e){t.split(",").map(t=>t.trim()).map(t=>{this.listeners[t]=this.listeners[t]||[];this.listeners[t].push(e)})}}var qn={Freeze:"Freeze",Unfreeze:"Unfreeze","Sort Ascending":"Sort Ascending","Sort Descending":"Sort Descending","Reset sorting":"Reset sorting","Remove column":"Remove column","No Data":"No Data","{count} cells copied":{1:"{count} cell copied",default:"{count} cells copied"},"{count} rows selected":{1:"{count} row selected",default:"{count} rows selected"}},Kn={Freeze:"Bevriezen",Unfreeze:"Ontdooien","Sort Ascending":"Aufsteigend sortieren","Sort Descending":"Absteigend sortieren","Reset sorting":"Sortierung zurücksetzen","Remove column":"Spalte entfernen","No Data":"Keine Daten","{count} cells copied":{1:"{count} Zelle kopiert",default:"{count} Zellen kopiert"},"{count} rows selected":{1:"{count} Zeile ausgewählt",default:"{count} Zeilen ausgewählt"}},Un={Freeze:"Geler",Unfreeze:"Dégeler","Sort Ascending":"Trier par ordre croissant","Sort Descending":"Trier par ordre décroissant","Reset sorting":"Réinitialiser le tri","Remove column":"Supprimer colonne","No Data":"Pas de données","{count} cells copied":{1:"{count} cellule copiée",default:"{count} cellules copiées"},"{count} rows selected":{1:"{count} ligne sélectionnée",default:"{count} lignes sélectionnées"}},Zn={Freeze:"Congelare",Unfreeze:"Dégeler","Sort Ascending":"Ordinamento ascendente","Sort Descending":"Ordinamento decrescente","Reset sorting":"Azzeramento ordinamento","Remove column":"Rimuovi colonna","No Data":"Nessun dato","{count} cells copied":{1:"Copiato {count} cella",default:"{count} celle copiate"},"{count} rows selected":{1:"{count} linea selezionata",default:"{count} linee selezionate"}};class Xn{constructor(t){this.language=t,this.translations=gt()}addTranslations(t){this.translations=Object.assign(this.translations,t)}translate(t,e){let n=this.translations[this.language]&&this.translations[this.language][t]||t;return"object"==typeof n&&(n=e&&e.count?this.getPluralizedTranslation(n,e.count):t),mt(n,e||{})}getPluralizedTranslation(t,e){return t[e]||t.default}}let Gn={DataManager:$n,CellManager:Fn,ColumnManager:jn,RowManager:An,BodyRenderer:Nn,Style:Pn,Keyboard:Vn};class Jn{constructor(t,e){if(Jn.instances++,"string"==typeof t&&(t=document.querySelector(t)),this.wrapper=t,!(this.wrapper instanceof HTMLElement))throw new Error("Invalid argument given for `wrapper`");this.initializeTranslations(e),this.setDefaultOptions(),this.buildOptions(e),this.prepare(),this.initializeComponents(),this.options.data&&(this.refresh(),this.columnmanager.applyDefaultSortOrder(),this.options.saveSorting&&(this.setupSaveSorting(),this.columnmanager.applySavedSortOrder()))}initializeTranslations(t){this.language=t.language||"en",this.translationManager=new Xn(this.language),t.translations&&this.translationManager.addTranslations(t.translations)}setDefaultOptions(){this.DEFAULT_OPTIONS=Ct(this)}buildOptions(t){this.options=this.options||{},this.options=Object.assign({},this.DEFAULT_OPTIONS,this.options||{},t),t.headerDropdown=t.headerDropdown||[],this.options.headerDropdown=[...this.DEFAULT_OPTIONS.headerDropdown,...t.headerDropdown],this.events=Object.assign({},this.DEFAULT_OPTIONS.events,this.options.events||{},t.events||{}),this.fireEvent=this.fireEvent.bind(this)}prepare(){this.prepareDom(),this.unfreeze()}initializeComponents(){let t=Object.assign({},Gn,this.options.overrideComponents),{Style:Style$$1,Keyboard:Keyboard$$1,DataManager:DataManager$$1,RowManager:RowManager$$1,ColumnManager:ColumnManager$$1,CellManager:CellManager$$1,BodyRenderer:BodyRenderer$$1}=t;this.style=new Style$$1(this),this.keyboard=new Keyboard$$1(this.wrapper),this.datamanager=new DataManager$$1(this.options),this.rowmanager=new RowManager$$1(this),this.columnmanager=new ColumnManager$$1(this),this.cellmanager=new CellManager$$1(this),this.bodyRenderer=new BodyRenderer$$1(this)}prepareDom(){this.wrapper.innerHTML=`\n <div class="datatable" dir="${this.options.direction}">\n <div class="dt-header"></div>\n <div class="dt-scrollable"></div>\n <div class="dt-footer"></div>\n <div class="dt-freeze">\n <span class="dt-freeze__message">\n ${this.options.freezeMessage}\n </span>\n </div>\n <div class="dt-toast"></div>\n <div class="dt-dropdown-container"></div>\n <textarea class="dt-paste-target"></textarea>\n </div>\n `,this.datatableWrapper=e(".datatable",this.wrapper),this.header=e(".dt-header",this.wrapper),this.footer=e(".dt-footer",this.wrapper),this.bodyScrollable=e(".dt-scrollable",this.wrapper),this.freezeContainer=e(".dt-freeze",this.wrapper),this.toastMessage=e(".dt-toast",this.wrapper),this.pasteTarget=e(".dt-paste-target",this.wrapper),this.dropdownContainer=e(".dt-dropdown-container",this.wrapper)}refresh(t,e){this.datamanager.init(t,e),this.render(),this.setDimensions()}destroy(){this.wrapper.innerHTML="",this.style.destroy(),this.fireEvent("onDestroy")}appendRows(t){this.datamanager.appendRows(t),this.rowmanager.refreshRows()}refreshRow(t,e){this.rowmanager.refreshRow(t,e)}render(){this.renderHeader(),this.renderBody()}renderHeader(){this.columnmanager.renderHeader()}renderBody(){this.bodyRenderer.render()}setDimensions(){this.style.setDimensions()}showToastMessage(t,e){this.bodyRenderer.showToastMessage(t,e)}clearToastMessage(){this.bodyRenderer.clearToastMessage()}getColumn(t){return this.datamanager.getColumn(t)}getColumns(){return this.datamanager.getColumns()}getRows(){return this.datamanager.getRows()}getCell(t,e){return this.datamanager.getCell(t,e)}getColumnHeaderElement(t){return this.columnmanager.getColumnHeaderElement(t)}getViewportHeight(){return this.viewportHeight||(this.viewportHeight=e.style(this.bodyScrollable,"height")),this.viewportHeight}sortColumn(t,e){this.columnmanager.sortColumn(t,e)}saveSorting(t,e){this.columnmanager.saveSorting(t,e)}removeColumn(t){this.columnmanager.removeColumn(t)}setColumnSticky(t,e){this.columnmanager.setColumnSticky(t,e)}scrollToLastColumn(){this.datatableWrapper.scrollLeft=9999}freeze(){e.style(this.freezeContainer,{display:""})}unfreeze(){e.style(this.freezeContainer,{display:"none"})}updateOptions(t){this.buildOptions(t)}fireEvent(t,...e){const n=[...this._internalEventHandlers[t]||[],this.events[t]].filter(Boolean);for(let t of n)t.apply(this,e)}on(t,e){this._internalEventHandlers=this._internalEventHandlers||{},this._internalEventHandlers[t]=this._internalEventHandlers[t]||[],this._internalEventHandlers[t].push(e)}log(){this.options.logs&&console.log.apply(console,arguments)}translate(t,e){return this.translationManager.translate(t,e)}setupSaveSorting(){let t={label:this.translate("Save Sorting"),action:function(t){this.saveSorting(t.colIndex,t.sotOrder)},display:"hidden"};this.options.headerDropdown.push(t),this.columnmanager.bindDropdown(),this.on("onSortColumn",function(t){this.columnmanager.toggleDropdownItem(4),"none"===t.sortOrder&&localStorage.removeItem(this.columnmanager.sortingKey)})}}Jn.instances=0;var Yn={name:"melondtable",version:"0.0.0-development",description:"A modern datatable library for the web",main:"dist/melondtable.cjs.js",unpkg:"dist/melondtable.min.js",jsdelivr:"dist/melondtable.min.js",scripts:{start:"yarn run dev",build:"rollup -c && NODE_ENV=production rollup -c",dev:"rollup -c -w","cy:server":"http-server -p 8989","cy:open":"cypress open","cy:run":"cypress run",test:"start-server-and-test cy:server http://localhost:8989 cy:run","test-local":"start-server-and-test cy:server http://localhost:8989 cy:open","travis-deploy-once":"travis-deploy-once","semantic-release":"semantic-release",lint:"eslint src","lint-and-build":"yarn lint && yarn build",commit:"npx git-cz"},files:["dist","src"],devDependencies:{autoprefixer:"^9.0.0",chai:"3.5.0",cypress:"^9.2.0","cz-conventional-changelog":"^2.1.0",deepmerge:"^2.0.1",eslint:"^5.0.1","eslint-config-airbnb":"^16.1.0","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-import":"^2.11.0","http-server":"^0.11.1",mocha:"3.3.0","postcss-custom-properties":"^7.0.0","postcss-nested":"^3.0.0",rollup:"^0.59.4","rollup-plugin-commonjs":"^8.3.0","rollup-plugin-eslint":"^4.0.0","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.3","rollup-plugin-postcss":"^1.2.8","rollup-plugin-uglify-es":"^0.0.1","semantic-release":"^25.0.3","start-server-and-test":"^1.4.1","travis-deploy-once":"^5.0.1"},repository:{type:"git",url:"https://github.com/amonak/melondtable.git"},keywords:["datatable","data","grid","table"],author:"Alphamonak Solutions",license:"MIT",bugs:{url:"https://github.com/amonak/datatable/issues"},homepage:"https://devel.monakerp.com/datatable",dependencies:{hyperlist:"^1.0.0-beta",lodash:"^4.17.5",sortablejs:"^1.7.0"},config:{commitizen:{path:"cz-conventional-changelog"}}};return Jn.__version__=Yn.version,Jn}(Sortable);
1
+ var DataTable=function(t){"use strict";function e(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function n(){const t=document.createElement("div");e.style(t,{width:"100px",height:"100px",overflow:"scroll",position:"absolute",top:"-9999px"}),document.body.appendChild(t);const n=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),n}function i(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function o(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function s(t){var e=Et.call(t,Ot),n=t[Ot];try{t[Ot]=void 0}catch(t){}var i=Ht.call(t);return e?t[Ot]=n:delete t[Ot],i}function r(t){return Mt.call(t)}function l(t){return null==t?void 0===t?zt:Dt:Ft&&Ft in Object(t)?Lt(t):$t(t)}function a(t){return null!=t&&"object"==typeof t}function c(t){return"symbol"==typeof t||Nt(t)&&jt(t)==Pt}function h(t){if("number"==typeof t)return t;if(Bt(t))return Vt;if(vt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=vt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(qt,"");var n=Ut.test(t);return n||Zt.test(t)?Xt(t.slice(2),n?2:8):Kt.test(t)?Vt:+t}function u(t,e,n){function i(e){var n=d,i=f;return d=f=void 0,y=e,g=t.apply(i,n)}function o(t){return y=t,p=setTimeout(l,e),b?i(t):g}function s(t){var n=t-y,i=e-(t-w);return C?Qt(i,m-n):i}function r(t){var n=t-w,i=t-y;return void 0===w||n>=e||n<0||C&&i>=m}function l(){var t=Rt();if(r(t))return a(t);p=setTimeout(l,s(t))}function a(t){return p=void 0,v&&d?i(t):(d=f=void 0,g)}function c(){void 0!==p&&clearTimeout(p),y=0,d=w=f=p=void 0}function h(){return void 0===p?g:a(Rt())}function u(){var t=Rt(),n=r(t);if(d=arguments,f=this,w=t,n){if(void 0===p)return o(w);if(C)return p=setTimeout(l,e),i(w)}return void 0===p&&(p=setTimeout(l,e)),g}var d,f,m,g,p,w,y=0,b=!1,C=!1,v=!0;if("function"!=typeof t)throw new TypeError(Jt);return e=Gt(e)||0,vt(n)&&(b=!!n.leading,m=(C="maxWait"in n)?Yt(Gt(n.maxWait)||0,e):m,v="trailing"in n?!!n.trailing:v),u.cancel=c,u.flush=h,u}function d(t,e,n){var i=!0,o=!0;if("function"!=typeof t)throw new TypeError(ee);return vt(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),te(t,e,{leading:i,maxWait:e,trailing:o})}function f(t){if(!vt(t))return!1;var e=jt(t);return e==oe||e==se||e==ie||e==re}function m(t){return!!ce&&ce in t}function g(t){if(null!=t){try{return ue.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function p(t){return!(!vt(t)||he(t))&&(le(t)?ye:fe).test(de(t))}function w(t,e){return null==t?void 0:t[e]}function y(t,e){var n=Ce(t,e);return be(n)?n:void 0}function b(){this.__data__=Se?Se(null):{},this.size=0}function C(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function v(t){var e=this.__data__;if(Se){var n=e[t];return n===ke?void 0:n}return Te.call(e,t)?e[t]:void 0}function _(t){var e=this.__data__;return Se?void 0!==e[t]:Oe.call(e,t)}function x(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Se&&void 0===e?Me:e,this}function S(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function I(){this.__data__=[],this.size=0}function R(t,e){return t===e||t!==t&&e!==e}function k(t,e){for(var n=t.length;n--;)if(We(t[n][0],e))return n;return-1}function T(t){var e=this.__data__,n=Ne(e,t);return!(n<0)&&(n==e.length-1?e.pop():Pe.call(e,n,1),--this.size,!0)}function E(t){var e=this.__data__,n=Ne(e,t);return n<0?void 0:e[n][1]}function H(t){return Ne(this.__data__,t)>-1}function O(t,e){var n=this.__data__,i=Ne(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}function L(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function M(){this.size=0,this.__data__={hash:new ze,map:new(Ge||Ue),string:new ze}}function $(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function D(t,e){var n=t.__data__;return Ye(e)?n["string"==typeof e?"string":"hash"]:n.map}function z(t){var e=en(this,t).delete(t);return this.size-=e?1:0,e}function F(t){return en(this,t).get(t)}function j(t){return en(this,t).has(t)}function A(t,e){var n=en(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}function W(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function N(t){return this.__data__.set(t,an),this}function P(t){return this.__data__.has(t)}function B(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ln;++e<n;)this.add(t[e])}function V(t,e,n,i){for(var o=t.length,s=n+(i?1:-1);i?s--:++s<o;)if(e(t[s],s,t))return s;return-1}function q(t){return t!==t}function K(t,e,n){for(var i=n-1,o=t.length;++i<o;)if(t[i]===e)return i;return-1}function U(t,e,n){return e===e?pn(t,e,n):mn(t,gn,n)}function Z(t,e){return!!(null==t?0:t.length)&&wn(t,e,0)>-1}function X(t,e,n){for(var i=-1,o=null==t?0:t.length;++i<o;)if(n(e,t[i]))return!0;return!1}function G(t,e){return t.has(e)}function J(){}function Y(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function Q(t,e,n){var i=-1,o=yn,s=t.length,r=!0,l=[],a=l;if(n)r=!1,o=bn;else if(s>=kn){var c=e?null:Rn(t);if(c)return Sn(c);r=!1,o=Cn,a=new fn}else a=e?[]:l;t:for(;++i<s;){var h=t[i],u=e?e(h):h;if(h=n||0!==h?h:0,r&&u===u){for(var d=a.length;d--;)if(a[d]===u)continue t;e&&a.push(u),l.push(h)}else o(a,u,n)||(a!==l&&a.push(u),l.push(h))}return l}function tt(t){return t&&t.length?Tn(t):[]}function et(t){return t.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`)}function nt(t){return Object.keys(t).map(e=>{const n=et(e);const i=t[e];if(void 0===i)return"";return`data-${n}="${i}" `}).join("").trim()}function it(t){var e=document.createElement("textarea");e.style.position="fixed",e.style.top=0,e.style.left=0,e.style.width="2em",e.style.height="2em",e.style.padding=0,e.style.border="none",e.style.outline="none",e.style.boxShadow="none",e.style.background="transparent",e.value=t,document.body.appendChild(e),e.select();try{document.execCommand("copy")}catch(t){console.log("Oops, unable to copy")}document.body.removeChild(e)}function ot(t){return!isNaN(t)}function st(t,e=null){return(...n)=>new Promise(i=>{const o=()=>{const o=t.apply(e,n);i(o)};setTimeout(o)})}function rt(t,e,n){const i=n.reduce((t,n)=>{t[n]={get(){return e[n]}};return t},{});Object.defineProperties(t,i)}function lt(t){return void 0!==t||null!==t}function at(t){return!lt(t)}function ct(t){return!isNaN(t)}function ht(t){return Array.isArray(t)?t:[t]}function ut(t){return En(t)}function dt(t,e){return t-e}function ft(t){return t.replace(/<[^>]*>/g,"")}function mt(t,e){return t?(Object.keys(e).forEach(n=>{let i=new RegExp(`{(${n})}`,"g");t=t.replace(i,e[n])}),t):t}function gt(t){if(!t)return"";let e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};return String(t).replace(/[&<>"'`=/]/g,t=>e[t]||t)}function pt(){return{en:Bn,de:Vn,fr:qn,it:Kn}}function wt(t,e,n){let i=[];if(0===Object.keys(e).length)return t.map(t=>t.meta.rowIndex);for(let o in e){const s=e[o],r=i.length?i.map(e=>t[e]):t,l=r.map(t=>t[o]);let a=bt(s),c=yt(t,n,a);i=c?c(a.text,l):l.map(t=>t.rowIndex)}return i}function yt(t,e,n){const i=i=>{let o=Dn.getCustomCellFormatter(i);let s=t[i.rowIndex];e&&e.data&&e.data.length&&(s=e.data[i.rowIndex]);if(o&&i.content)return i.html=o(i.content,t[i.rowIndex],i.column,s,n),ft(i.html);return i.content||""},o=t=>String(ft(t.html||"")||i(t)).toLowerCase(),s=t=>parseFloat(t.content),r=(t,e)=>{if(t.column.compareValue){const n=t.column.compareValue(t,e);if(n&&Array.isArray(n))return n}const n=s(t);if(!isNaN(n))return[n,e];return[o(t),e]};return{contains(t,e){return e.filter(e=>{const n=(t||"").toLowerCase();return!n||(e.content||"").toLowerCase().includes(n)||o(e).includes(n)}).map(t=>t.rowIndex)},greaterThan(t,e){return e.filter(e=>{const[n,i]=r(e,t);return n>i}).map(t=>t.rowIndex)},lessThan(t,e){return e.filter(e=>{const[n,i]=r(e,t);return n<i}).map(t=>t.rowIndex)},equals(t,e){return e.filter(e=>{const n=parseFloat(e.content);return n===t}).map(t=>t.rowIndex)},notEquals(t,e){return e.filter(e=>{const n=parseFloat(e.content);return n!==t}).map(t=>t.rowIndex)},range(t,e){return e.filter(e=>{const n=r(e,t[0]);const i=r(e,t[1]);const o=n[0];return o>=n[1]&&o<=i[1]}).map(t=>t.rowIndex)},containsNumber(t,e){return e.filter(e=>{let n=parseFloat(t,10);let i=t;let r=s(e);let l=o(e);return n===r||l.includes(i)}).map(t=>t.rowIndex)}}[n.type]}function bt(t=""){if(0===t.length)return{};let e=t;return[">","<","="].includes(e[0])?e=t.slice(1):e.startsWith("!=")&&(e=t.slice(2)),t.startsWith(">")&&e?{type:"greaterThan",text:e.trim()}:t.startsWith("<")&&e?{type:"lessThan",text:e.trim()}:t.startsWith("=")&&ct(e)?{type:"equals",text:Number(t.slice(1).trim())}:ct(e)?{type:"containsNumber",text:e}:t.startsWith("!=")&&ct(e)?{type:"notEquals",text:Number(t.slice(2).trim())}:2===t.split(":").length&&t.split(":").every(t=>ct(t.trim()))?(e=t.split(":"),{type:"range",text:e.map(t=>t.trim())}):{type:"contains",text:e.toLowerCase()}}function Ct(t){return{columns:[],data:[],dropdownButton:$n.chevronDown,headerDropdown:[{label:t.translate("Sort Ascending"),action:function(t){this.sortColumn(t.colIndex,"asc")}},{label:t.translate("Sort Descending"),action:function(t){this.sortColumn(t.colIndex,"desc")}},{label:t.translate("Reset sorting"),action:function(t){this.sortColumn(t.colIndex,"none")}},{label:t.translate("Remove column"),action:function(t){this.removeColumn(t.colIndex)}},{label:t.translate("Freeze"),stickyAction:"stick",display:"hidden",action:function(t){this.setColumnSticky(t.colIndex,!0)}},{label:t.translate("Unfreeze"),stickyAction:"unstick",display:"hidden",action:function(t){this.setColumnSticky(t.colIndex,!1)}}],events:{onRemoveColumn(t){},onSwitchColumn(t,e){},onSortColumn(t){},onCheckRow(t){},onDestroy(){}},hooks:{columnTotal:null},sortIndicator:{asc:"↑",desc:"↓",none:""},overrideComponents:{},filterRows:wt,freezeMessage:"",getEditor:null,serialNoColumn:!0,serialNoColumnLabel:"",checkboxColumn:!1,clusterize:!0,logs:!1,layout:"fixed",noDataMessage:t.translate("No Data"),cellHeight:40,minimumColumnWidth:30,inlineFilters:!1,treeView:!1,checkedRowStatus:!0,dynamicRowHeight:!1,pasteFromClipboard:!1,showTotalRow:!1,direction:"ltr",disableReorderColumn:!1}}t=t&&t.hasOwnProperty("default")?t.default:t,e.each=((t,e)=>"string"==typeof t?Array.from((e||document).querySelectorAll(t)):t||null),e.create=((t,n)=>{let i=document.createElement(t);for(let t in n){let o=n[t];if("inside"===t)e(o).appendChild(i);else if("around"===t){let t=e(o);t.parentNode.insertBefore(i,t),i.appendChild(t)}else"styles"===t?"object"==typeof o&&Object.keys(o).map(t=>{i.style[t]=o[t]}):t in i?i[t]=o:i.setAttribute(t,o)}return i}),e.on=((t,n,i,o)=>{o?e.delegate(t,n,i,o):(o=i,e.bind(t,n,o))}),e.off=((t,e,n)=>{t.removeEventListener(e,n)}),e.bind=((t,e,n)=>{e.split(/\s+/).forEach(function(e){t.addEventListener(e,n)})}),e.delegate=((t,e,n,i)=>{t.addEventListener(e,function(t){const e=t.target.closest(n);e&&(t.delegatedTarget=e,i.call(this,t,e))})}),e.unbind=((t,e)=>{if(t)for(let n in e){let i=e[n];n.split(/\s+/).forEach(function(e){t.removeEventListener(e,i)})}}),e.fire=((t,e,n)=>{let i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!0);for(let t in n)i[t]=n[t];return t.dispatchEvent(i)}),e.data=((t,e)=>{if(!e)return t.dataset;for(const n in e)t.dataset[n]=e[n]}),e.style=((t,n)=>{if("string"==typeof n)return e.getStyle(t,n);Array.isArray(t)||(t=[t]);t.map(t=>{for(const e in n)t.style[e]=n[e]})}),e.removeStyle=((t,e)=>{Array.isArray(t)||(t=[t]);Array.isArray(e)||(e=[e]);t.map(t=>{for(const n of e)t.style[n]=""})}),e.getStyle=((t,e)=>{if(!e)return getComputedStyle(t);let n=getComputedStyle(t)[e];["width","height"].includes(e)&&(n=parseFloat(n));return n}),e.closest=((t,n)=>{if(!n)return null;if(n.matches(t))return n;return e.closest(t,n.parentNode)}),e.inViewport=((t,e)=>{const{top:top,left:left,bottom:bottom,right:right}=t.getBoundingClientRect();const{top:pTop,left:pLeft,bottom:pBottom,right:pRight}=e.getBoundingClientRect();return top>=pTop&&left>=pLeft&&bottom<=pBottom&&right<=pRight}),e.scrollTop=function(t,e){requestAnimationFrame(()=>{t.scrollTop=e})},e.scrollbarSize=function(){return e.scrollBarSizeValue||(e.scrollBarSizeValue=n()),e.scrollBarSizeValue},e.hasVerticalOverflow=function(t){return t.scrollHeight>t.offsetHeight+10},e.hasHorizontalOverflow=function(t){return t.scrollWidth>t.offsetWidth+10},e.measureTextWidth=function(t){const e=document.createElement("div");return e.style.position="absolute",e.style.visibility="hidden",e.style.height="auto",e.style.width="auto",e.style.whiteSpace="nowrap",e.innerText=t,document.body.appendChild(e),e.clientWidth+1};var vt=i,_t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},xt="object"==typeof _t&&_t&&_t.Object===Object&&_t,St="object"==typeof self&&self&&self.Object===Object&&self,It=xt||St||Function("return this")(),Rt=function(){return It.Date.now()},kt=It.Symbol,Tt=Object.prototype,Et=Tt.hasOwnProperty,Ht=Tt.toString,Ot=kt?kt.toStringTag:void 0,Lt=s,Mt=Object.prototype.toString,$t=r,Dt="[object Null]",zt="[object Undefined]",Ft=kt?kt.toStringTag:void 0,jt=l,At=a,Wt=Object.freeze({default:At,__moduleExports:At}),Nt=Wt&&At||Wt,Pt="[object Symbol]",Bt=c,Vt=NaN,qt=/^\s+|\s+$/g,Kt=/^[-+]0x[0-9a-f]+$/i,Ut=/^0b[01]+$/i,Zt=/^0o[0-7]+$/i,Xt=parseInt,Gt=h,Jt="Expected a function",Yt=Math.max,Qt=Math.min,te=u,ee="Expected a function",ne=d,ie="[object AsyncFunction]",oe="[object Function]",se="[object GeneratorFunction]",re="[object Proxy]",le=f,ae=It["__core-js_shared__"],ce=function(){var t=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),he=m,ue=Function.prototype.toString,de=g,fe=/^\[object .+?Constructor\]$/,me=Function.prototype,ge=Object.prototype,pe=me.toString,we=ge.hasOwnProperty,ye=RegExp("^"+pe.call(we).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),be=p,Ce=w,ve=y,_e=ve(Object,"create"),xe=Object.freeze({default:_e,__moduleExports:_e}),Se=xe&&_e||xe,Ie=b,Re=C,ke="__lodash_hash_undefined__",Te=Object.prototype.hasOwnProperty,Ee=v,He=Object.freeze({default:Ee,__moduleExports:Ee}),Oe=Object.prototype.hasOwnProperty,Le=_,Me="__lodash_hash_undefined__",$e=x,De=He&&Ee||He;S.prototype.clear=Ie,S.prototype.delete=Re,S.prototype.get=De,S.prototype.has=Le,S.prototype.set=$e;var ze=S,Fe=I,je=R,Ae=Object.freeze({default:je,__moduleExports:je}),We=Ae&&je||Ae,Ne=k,Pe=Array.prototype.splice,Be=T,Ve=E,qe=H,Ke=O;L.prototype.clear=Fe,L.prototype.delete=Be,L.prototype.get=Ve,L.prototype.has=qe,L.prototype.set=Ke;var Ue=L,Ze=ve(It,"Map"),Xe=Object.freeze({default:Ze,__moduleExports:Ze}),Ge=Xe&&Ze||Xe,Je=M,Ye=$,Qe=D,tn=Object.freeze({default:Qe,__moduleExports:Qe}),en=tn&&Qe||tn,nn=z,on=F,sn=j,rn=A;W.prototype.clear=Je,W.prototype.delete=nn,W.prototype.get=on,W.prototype.has=sn,W.prototype.set=rn;var ln=W,an="__lodash_hash_undefined__",cn=N,hn=Object.freeze({default:cn,__moduleExports:cn}),un=P,dn=hn&&cn||hn;B.prototype.add=B.prototype.push=dn,B.prototype.has=un;var fn=B,mn=V,gn=q,pn=K,wn=U,yn=Z,bn=X,Cn=G,vn=ve(It,"Set"),_n=Object.freeze({default:vn,__moduleExports:vn}),xn=J,Sn=Y,In=_n&&vn||_n,Rn=In&&1/Sn(new In([,-0]))[1]==1/0?function(t){return new In(t)}:xn,kn=200,Tn=Q,En=tt;let Hn=ne,On=te;class Ln{constructor(t){this.options=t,this.sortRows=st(this.sortRows,this),this.switchColumn=st(this.switchColumn,this),this.removeColumn=st(this.removeColumn,this),this.options.filterRows=st(this.options.filterRows,this)}init(t,e){t||(t=this.options.data),e&&(this.options.columns=e),this.data=t,this.rowCount=0,this.columns=[],this.rows=[],this.prepareColumns(),this.validateData(this.data),this.rows=this.prepareRows(this.data),this.prepareTreeRows(),this.prepareRowView(),this.prepareNumericColumns()}get currentSort(){return this.columns.find(t=>"none"!==t.sortOrder)||{colIndex:-1,sortOrder:"none"}}prepareColumns(){this.columns=[],this.validateColumns(),this.prepareDefaultColumns(),this.prepareHeader()}prepareDefaultColumns(){if(this.options.checkboxColumn&&!this.hasColumnById("_checkbox")){const t={id:"_checkbox",content:this.getCheckboxHTML(),editable:!1,resizable:!1,sortable:!1,focusable:!1,dropdown:!1,sticky:!0,width:32};this.columns.push(t)}if(this.options.serialNoColumn&&!this.hasColumnById("_rowIndex")){let t={id:"_rowIndex",content:this.options.serialNoColumnLabel||"",align:"center",editable:!1,resizable:!0,focusable:!1,dropdown:!1,sticky:!0};this.columns.push(t)}}prepareHeader(){let t=this.columns.concat(this.options.columns);const e={isHeader:1,editable:!0,sortable:!0,resizable:!0,focusable:!0,dropdown:!0,width:null,format:t=>{if(null===t||void 0===t)return"";return t+""}};this.columns=t.map((t,e)=>this.prepareCell(t,e)).map(t=>Object.assign({},e,t)).map(t=>{t.content=t.content||t.name||"";t.id=t.id||t.content;return t})}prepareCell(t,e){const n={content:"",sortOrder:"none",colIndex:e,column:this.columns[e]};return null!==t&&"object"==typeof t?Object.assign(n,t):n.content=t,n}prepareNumericColumns(){const t=this.getRow(0);t&&(this.columns=this.columns.map((e,n)=>{const i=t[n].content;!e.align&&ot(i)&&(e.align="right");return e}))}prepareRows(t){return t.map((t,e)=>{const n=this._getNextRowCount();let i=[];let o={rowIndex:n};if(Array.isArray(t))for(this.options.checkboxColumn&&i.push(this.getCheckboxHTML()),this.options.serialNoColumn&&i.push(n+1+""),i=i.concat(t);i.length<this.columns.length;)i.push("");else{for(let e of this.columns)"_checkbox"===e.id?i.push(this.getCheckboxHTML()):"_rowIndex"===e.id?i.push(n+1+""):i.push(t[e.id]);o.indent=t.indent||0}return this.prepareRow(i,o)})}prepareTreeRows(){this.rows.forEach((t,e)=>{if(ct(t.meta.indent)){const n=this.getRow(e+1);t.meta.isLeaf=!n||at(n.meta.indent)||n.meta.indent<=t.meta.indent,t.meta.isTreeNodeClose=!1}})}prepareRowView(){this.rowViewOrder=this.rows.map(t=>t.meta.rowIndex)}prepareRow(t,e){return t=t.map((t,e)=>this.prepareCell(t,e)).map(t=>{null==t.rowIndex&&(t.rowIndex=e.rowIndex);null==t.indent&&(t.indent=e.indent);return t}),t.meta=e,t}validateColumns(){const t=this.options.columns;if(!Array.isArray(t))throw new Mn("`columns` must be an array");t.forEach((t,e)=>{if("string"!=typeof t&&"object"!=typeof t)throw new Mn(`column "${e}" must be a string or an object`)})}validateData(t){if(Array.isArray(t)&&(0===t.length||Array.isArray(t[0])||"object"==typeof t[0]))return!0;throw new Mn("`data` must be an array of arrays or objects")}appendRows(t){this.validateData(t),this.rows=this.rows.concat(this.prepareRows(t)),this.prepareTreeRows(),this.prepareRowView()}sortRows(t,e="none"){t=+t,this.getColumns().map(n=>{n.colIndex===t?n.sortOrder=e:n.sortOrder="none"}),this._sortRows(t,e)}_sortRows(t,e){if(this.currentSort.colIndex===t&&("asc"===this.currentSort.sortOrder&&"desc"===e||"desc"===this.currentSort.sortOrder&&"asc"===e))return this.reverseArray(this.rowViewOrder),void(this.currentSort.sortOrder=e);const n=t=>{const e=t.column&&t.column.sortValue;const n=e?e(t):t.content;return null==n?"":n};if(this.rowViewOrder.sort((i,o)=>{const s=i;const r=o;const l=n(this.getCell(t,i));const a=n(this.getCell(t,o));if("none"===e)return s-r;if("asc"===e){if(l<a)return-1;if(l>a)return 1;if(l===a)return 0}else if("desc"===e){if(l<a)return 1;if(l>a)return-1;if(l===a)return 0}return 0}),this.hasColumnById("_rowIndex")){const t=this.getColumnIndexById("_rowIndex");this.rows.forEach((e,n)=>{const i=this.rowViewOrder.indexOf(n);const o=e[t];o.content=i+1+""})}}reverseArray(t){let e=null,n=null;for(e=0,n=t.length-1;e<n;e+=1,n-=1){const i=t[e];t[e]=t[n],t[n]=i}}switchColumn(t,e){const n=this.columns[t];this.columns[t]=this.columns[e],this.columns[e]=n,this.columns[t].colIndex=t,this.columns[e].colIndex=e,this.rows.forEach(n=>{const i=Object.assign({},n[t],{colIndex:e});const o=Object.assign({},n[e],{colIndex:t});n[e]=i;n[t]=o})}removeColumn(t){t=+t;const e=e=>e.colIndex!==t,n=(t,e)=>Object.assign({},t,{colIndex:e});this.columns=this.columns.filter(e).map(n),this.rows.forEach(e=>{e.splice(t,1);e.forEach((t,e)=>{t.colIndex=e})})}updateRow(t,e){if(t.length<this.columns.length){if(this.hasColumnById("_rowIndex")){const n=e+1+"";t=[n].concat(t)}if(this.hasColumnById("_checkbox")){const e='<input type="checkbox" />';t=[e].concat(t)}}const n=this.prepareRow(t,{rowIndex:e}),i=this.rows.findIndex(t=>t[0].rowIndex===e);return this.rows[i]=n,n}updateCell(t,e,n){let i;"object"==typeof t&&(t=(i=t).colIndex,e=i.rowIndex,n=i),i=this.getCell(t,e);for(let t in n){const e=n[t];void 0!==e&&(i[t]=e)}return i}updateColumn(t,e){const n=this.getColumn(t);for(let t in e){const i=e[t];void 0!==i&&(n[t]=i)}return n}filterRows(t){return this.options.filterRows(this.rows,t,this).then(t=>{t||(t=this.getAllRowIndices());t.then||(t=Promise.resolve(t));return t.then(t=>{this._filteredRows=t;const e=this.getAllRowIndices().filter(e=>!t.includes(e));return{rowsToHide:e,rowsToShow:t}})})}getFilteredRowIndices(){return this._filteredRows||this.getAllRowIndices()}getAllRowIndices(){return this.rows.map(t=>t.meta.rowIndex)}getRowCount(){return this.rowCount}_getNextRowCount(){const t=this.rowCount;return this.rowCount++,t}getRows(t,e){return this.rows.slice(t,e)}getRowsForView(t,e){return this.rowViewOrder.map(t=>this.rows[t]).slice(t,e)}getColumns(t){let e=this.columns;return t&&(e=e.slice(this.getStandardColumnCount())),e}getStandardColumnCount(){return this.options.checkboxColumn&&this.options.serialNoColumn?2:this.options.checkboxColumn||this.options.serialNoColumn?1:0}getColumnCount(t){let e=this.columns.length;return t&&(e-=this.getStandardColumnCount()),e}getColumn(t){return(t=+t)<0&&(t=this.columns.length+t),this.columns.find(e=>e.colIndex===t)}getColumnById(t){return this.columns.find(e=>e.id===t)}getRow(t){return t=+t,this.rows[t]}getCell(t,e){return e=+e,t=+t,this.getRow(e)[t]}getChildren(t){t=+t;const e=this.getRow(t).meta.indent,n=[];for(let i=t+1;i<this.rowCount;i++){const t=this.getRow(i);if(!isNaN(t.meta.indent)&&(t.meta.indent>e&&n.push(i),t.meta.indent===e))break}return n}getImmediateChildren(t){t=+t;const e=this.getRow(t).meta.indent,n=[],i=e+1;for(let o=t+1;o<this.rowCount;o++){const t=this.getRow(o);if(!(isNaN(t.meta.indent)||t.meta.indent>i)&&(t.meta.indent===i&&n.push(o),t.meta.indent===e))break}return n}get(){return{columns:this.columns,rows:this.rows}}getData(t){return this.data[t]}hasColumn(t){return Boolean(this.columns.find(e=>e.content===t))}hasColumnById(t){return Boolean(this.columns.find(e=>e.id===t))}getColumnIndex(t){return this.columns.findIndex(e=>e.content===t)}getColumnIndexById(t){return this.columns.findIndex(e=>e.id===t)}getCheckboxHTML(){return'<input type="checkbox" />'}}class Mn extends TypeError{}let $n={chevronDown:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down"><polyline points="6 9 12 15 18 9"></polyline></svg>',chevronRight:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>'};class Dn{constructor(t){this.instance=t,rt(this,this.instance,["wrapper","options","style","header","bodyScrollable","columnmanager","rowmanager","datamanager","keyboard","footer"]),this.bindEvents()}bindEvents(){this.bindFocusCell(),this.bindEditCell(),this.bindKeyboardSelection(),this.bindCopyCellContents(),this.bindMouseEvents(),this.bindWheelEvents(),this.bindTreeEvents()}bindFocusCell(){this.bindKeyboardNav()}bindEditCell(){this.$editingCell=null,e.on(this.bodyScrollable,"dblclick",".dt-cell",(t,e)=>{this.activateEditing(e)}),this.keyboard.on("enter",()=>{this.$focusedCell&&!this.$editingCell?this.activateEditing(this.$focusedCell):this.$editingCell&&this.deactivateEditing()})}bindKeyboardNav(){const t=t=>{if(!this.$focusedCell||this.$editingCell)return!1;let n=this.$focusedCell;const{rowIndex:rowIndex,colIndex:colIndex}=e.data(n);"left"===t?n=this.getLeftMostCell$(rowIndex):"right"===t?n=this.getRightMostCell$(rowIndex):"up"===t?n=this.getTopMostCell$(colIndex):"down"===t&&(n=this.getBottomMostCell$(colIndex));this.focusCell(n);sessionStorage.setItem("dt-last-nav-method","key");return!0};["left","right","up","down","tab","shift+tab"].map(t=>this.keyboard.on(t,()=>this.focusCellInDirection(t))),["left","right","up","down"].map(e=>this.keyboard.on(`ctrl+${e}`,()=>t(e))),this.keyboard.on("esc",()=>{this.deactivateEditing(!1);this.columnmanager.toggleFilter(!1)}),this.options.inlineFilters&&(this.keyboard.on("ctrl+f",t=>{const n=e.closest(".dt-cell",t.target);const{colIndex:colIndex}=e.data(n);this.activateFilter(colIndex);return!0}),e.on(this.header,"focusin",".dt-filter",()=>{this.unfocusCell(this.$focusedCell)}))}bindKeyboardSelection(){const t=t=>{let e=this.getSelectionCursor();"left"===t?e=this.getLeftCell$(e):"right"===t?e=this.getRightCell$(e):"up"===t?e=this.getAboveCell$(e):"down"===t&&(e=this.getBelowCell$(e));return e};["left","right","up","down"].map(e=>this.keyboard.on(`shift+${e}`,()=>this.selectArea(t(e))))}bindCopyCellContents(){this.keyboard.on("ctrl+c",()=>{const t=this.copyCellContents(this.$focusedCell,this.$selectionCursor);const e=this.instance.translate("{count} cells copied",{count:t});t&&this.instance.showToastMessage(e,2)}),this.options.pasteFromClipboard&&this.keyboard.on("ctrl+v",t=>{this.instance.pasteTarget.focus();setTimeout(()=>{const t=this.instance.pasteTarget.value;this.instance.pasteTarget.value="";this.pasteContentInCell(t)},10);return!1})}bindMouseEvents(){let t=null;e.on(this.bodyScrollable,"mousedown",".dt-cell",n=>{t=!0;this.focusCell(e(n.delegatedTarget))}),e.on(this.bodyScrollable,"mouseup",()=>{t=!1}),this.options.showTotalRow&&e.on(this.footer,"click",".dt-cell",t=>{this.focusCell(e(t.delegatedTarget))});const n=n=>{if(!t)return;this.selectArea(e(n.delegatedTarget))};e.on(this.bodyScrollable,"mousemove",".dt-cell",Hn(n,50))}bindWheelEvents(){e.on(this.bodyScrollable,"wheel",t=>{sessionStorage.setItem("dt-last-nav-method","scroll")})}bindTreeEvents(){e.on(this.bodyScrollable,"click",".dt-tree-node__toggle",(t,n)=>{const i=e.closest(".dt-cell",n);const{rowIndex:rowIndex}=e.data(i);i.classList.contains("dt-cell--tree-close")?this.rowmanager.openSingleNode(rowIndex):this.rowmanager.closeSingleNode(rowIndex)})}focusCell(t,{skipClearSelection:skipClearSelection=0,skipDOMFocus:skipDOMFocus=0,skipScrollToCell:skipScrollToCell=0}={}){if(t&&t!==this.$editingCell){const{colIndex:colIndex,isHeader:isHeader}=e.data(t);isHeader||!1!==this.columnmanager.getColumn(colIndex).focusable&&(skipScrollToCell||this.scrollToCell(t),this.deactivateEditing(),skipClearSelection||this.clearSelection(),this.$focusedCell&&this.$focusedCell.classList.remove("dt-cell--focus"),this.$focusedCell=t,t.classList.add("dt-cell--focus"),skipDOMFocus||t.focus(),this.highlightRowColumnHeader(t))}}unfocusCell(t){t&&(t.classList.remove("dt-cell--focus"),this.$focusedCell=null,this.lastHeaders&&this.lastHeaders.forEach(t=>t&&t.classList.remove("dt-cell--highlight")))}highlightRowColumnHeader(t){const{colIndex:colIndex,rowIndex:rowIndex}=e.data(t),n=`.dt-cell--header-${colIndex}`,i=`.dt-cell--${this.datamanager.getColumnIndexById("_rowIndex")}-${rowIndex}`;this.lastHeaders&&this.lastHeaders.forEach(t=>t&&t.classList.remove("dt-cell--highlight"));const o=e(n,this.wrapper),s=e(i,this.wrapper);this.lastHeaders=[o,s],this.lastHeaders.forEach(t=>t&&t.classList.add("dt-cell--highlight"))}selectAreaOnClusterChanged(){if(this.$focusedCell&&this.$selectionCursor){const{colIndex:colIndex,rowIndex:rowIndex}=e.data(this.$selectionCursor),t=this.getCell$(colIndex,rowIndex);if(t&&t!==this.$selectionCursor){const n=e.data(this.$focusedCell);this.$focusedCell=this.getCell$(n.colIndex,n.rowIndex),this.selectArea(t)}}}focusCellOnClusterChanged(){if(this.$focusedCell){const{colIndex:colIndex,rowIndex:rowIndex}=e.data(this.$focusedCell),t=this.getCell$(colIndex,rowIndex);if(t){const e="key"!==sessionStorage.getItem("dt-last-nav-method");this.focusCell(t,{skipDOMFocus:e,skipClearSelection:1,skipScrollToCell:1})}}}selectArea(t){this.$focusedCell&&this._selectArea(this.$focusedCell,t)&&(this.$selectionCursor=t)}_selectArea(t,e){if(t===e)return!1;const n=this.getCellsInRange(t,e);return!!n&&(this.clearSelection(),this._selectedCells=n.map(t=>this.getCell$(...t)),requestAnimationFrame(()=>{this._selectedCells.map(t=>t.classList.add("dt-cell--highlight"))}),!0)}getCellsInRange(t,n){let i,o,s,r;if("number"==typeof t)[i,o,s,r]=arguments;else if("object"==typeof t){if(!t||!n)return!1;const l=e.data(t),a=e.data(n);i=+l.colIndex,s=+a.colIndex,this.columnmanager.sortState?(this.sortedColumn=!0,o=this.datamanager.rowViewOrder.indexOf(parseInt(l.rowIndex,10)),r=this.datamanager.rowViewOrder.indexOf(parseInt(a.rowIndex,10))):(o=+l.rowIndex,r=+a.rowIndex)}if(o>r&&([o,r]=[r,o]),i>s&&([i,s]=[s,i]),this.isStandardCell(i)||this.isStandardCell(s))return!1;const l=[];let a=i,c=o;const h=[];for(;c<=r;)h.push(c),c+=1;return h.map(t=>{for(;a<=s;)l.push([a,t]),a++;a=i}),this.columnmanager.sortState&&l.forEach(t=>{t[1]=this.datamanager.rowViewOrder[t[1]]}),l}clearSelection(){(this._selectedCells||[]).forEach(t=>t.classList.remove("dt-cell--highlight")),this._selectedCells=[],this.$selectionCursor=null}getSelectionCursor(){return this.$selectionCursor||this.$focusedCell}activateEditing(t){this.focusCell(t);const{rowIndex:rowIndex,colIndex:colIndex}=e.data(t),n=this.columnmanager.getColumn(colIndex);if(!n||!1!==n.editable&&!1!==n.focusable){const i=this.getCell(colIndex,rowIndex);if(!i||!1!==i.editable){if(this.$editingCell){const{_rowIndex:_rowIndex,_colIndex:_colIndex}=e.data(this.$editingCell);if(rowIndex===_rowIndex&&colIndex===_colIndex)return}this.$editingCell=t,t.classList.add("dt-cell--editing");const o=e(".dt-cell__edit",t);o.innerHTML="";const s=this.getEditor(colIndex,rowIndex,i.content,o);s&&(this.currentCellEditor=s,s.initValue(i.content,rowIndex,n))}}}deactivateEditing(t=!0){t&&this.submitEditing(),this.$focusedCell&&this.$focusedCell.focus(),this.$editingCell&&(this.$editingCell.classList.remove("dt-cell--editing"),this.$editingCell=null)}getEditor(t,e,n,i){const o=this.datamanager.getColumn(t),s=this.datamanager.getRow(e),r=this.datamanager.getData(e);let l=this.options.getEditor?this.options.getEditor(t,e,n,i,o,s,r):this.getDefaultEditor(i);return!1!==l&&(void 0===l&&(l=this.getDefaultEditor(i)),l)}getDefaultEditor(t){const n=e.create("input",{class:"dt-input",type:"text",inside:t});return{initValue(t){n.focus(),n.value=t},getValue(){return n.value},setValue(t){n.value=t}}}submitEditing(){let t=Promise.resolve();if(!this.$editingCell)return t;const n=this.$editingCell,{rowIndex:rowIndex,colIndex:colIndex}=e.data(n),i=this.datamanager.getColumn(colIndex);if(n){const e=this.currentCellEditor;if(e){let o=e.getValue();o.then||(o=Promise.resolve(o)),t=o.then(t=>{const o=this.getCell(colIndex,rowIndex).content;if(o===t)return!1;const s=e.setValue(t,rowIndex,i);this.updateCell(colIndex,rowIndex,t,!0);n.focus();s&&s.then&&s.catch(t=>{console.log(t);this.updateCell(colIndex,rowIndex,o)});return s})}}return this.currentCellEditor=null,t}copyCellContents(t,n){if(!n&&t){const{colIndex:colIndex,rowIndex:rowIndex,isTotalRow:isTotalRow}=e.data(t);let n="";if(isTotalRow){let t=this.$focusedCell;n=t.children[0].title}else{const t=this.getCell(colIndex,rowIndex);n=t.content}return it(n),1}const i=this.getCellsInRange(t,n);if(!i)return 0;const o=i.map(t=>this.getCell(...t)).reduce((t,e)=>{const n=e.rowIndex;t[n]=t[n]||[];t[n].push(e.content);return t},[]);return it(o.map(t=>t.join("\t")).join("\n")),o.reduce((t,e)=>t+e.length,0)}pasteContentInCell(t){if(this.$focusedCell){const n=t.split("\n").map(t=>t.split("\t")).filter(t=>t.length&&t.every(t=>t));let{colIndex:colIndex,rowIndex:rowIndex}=e.data(this.$focusedCell),i={colIndex:+colIndex,rowIndex:+rowIndex};n.forEach((t,e)=>{let n=e+i.rowIndex;t.forEach((t,e)=>{let o=e+i.colIndex;this.updateCell(o,n,t,!0)})})}}activateFilter(t){this.columnmanager.toggleFilter(),this.columnmanager.focusFilter(t),this.columnmanager.isFilterShown||this.$focusedCell&&this.$focusedCell.focus()}updateCell(t,e,n,i=!1){const o=this.datamanager.updateCell(t,e,{content:n});this.refreshCell(o,i)}refreshCell(t,n=!1){e(this.selector(t.colIndex,t.rowIndex),this.bodyScrollable).innerHTML=this.getCellContent(t,n)}toggleTreeButton(t,e){const n=this.columnmanager.getFirstColumnIndex(),i=this.getCell$(n,t);i&&i.classList[e?"remove":"add"]("dt-cell--tree-close")}isStandardCell(t){return t<this.columnmanager.getFirstColumnIndex()}focusCellInDirection(t){if(!this.$focusedCell||this.$editingCell&&["left","right","up","down"].includes(t))return!1;this.$editingCell&&["tab","shift+tab"].includes(t)&&this.deactivateEditing();let n=this.$focusedCell;if("left"===t||"shift+tab"===t?n=this.getLeftCell$(n):"right"===t||"tab"===t?n=this.getRightCell$(n):"up"===t?n=this.getAboveCell$(n):"down"===t&&(n=this.getBelowCell$(n)),!n)return!1;const{colIndex:colIndex}=e.data(n);if(!this.columnmanager.getColumn(colIndex).focusable){let e=this.$focusedCell;this.unfocusCell(e),this.$focusedCell=n;let i=this.focusCellInDirection(t);return i||this.focusCell(e),i}return this.focusCell(n),sessionStorage.setItem("dt-last-nav-method","key"),!0}getCell$(t,n){return e(this.selector(t,n),this.bodyScrollable)}getAboveCell$(t){const{colIndex:colIndex}=e.data(t);let n=t.parentElement.previousElementSibling;for(;n&&n.classList.contains("dt-row--hide");)n=n.previousElementSibling;return n?e(`.dt-cell--col-${colIndex}`,n):t}getBelowCell$(t){const{colIndex:colIndex}=e.data(t);let n=t.parentElement.nextElementSibling;for(;n&&n.classList.contains("dt-row--hide");)n=n.nextElementSibling;return n?e(`.dt-cell--col-${colIndex}`,n):t}getLeftCell$(t){return t.previousElementSibling}getRightCell$(t){return t.nextElementSibling}getLeftMostCell$(t){return this.getCell$(this.columnmanager.getFirstColumnIndex(),t)}getRightMostCell$(t){return this.getCell$(this.columnmanager.getLastColumnIndex(),t)}getTopMostCell$(t){return this.getCell$(t,this.rowmanager.getFirstRowIndex())}getBottomMostCell$(t){return this.getCell$(t,this.rowmanager.getLastRowIndex())}getCell(t,e){return this.instance.datamanager.getCell(t,e)}getRowHeight(){return e.style(e(".dt-row",this.bodyScrollable),"height")}scrollToCell(t){if(e.inViewport(t,this.bodyScrollable)||e.inViewport(t,this.footer))return!1;const{rowIndex:rowIndex}=e.data(t);return this.rowmanager.scrollToRow(rowIndex),!1}getRowCountPerPage(){return Math.ceil(this.instance.getViewportHeight()/this.getRowHeight())}getCellHTML(t){const{rowIndex:rowIndex,colIndex:colIndex,isHeader:isHeader,isFilter:isFilter,isTotalRow:isTotalRow}=t,e=nt({rowIndex:rowIndex,colIndex:colIndex,isHeader:isHeader,isFilter:isFilter,isTotalRow:isTotalRow}),n=this.datamanager.getRow(rowIndex),i=t.column||this.datamanager.getColumn(colIndex)||{},o=!(isHeader||isFilter||isTotalRow),s=Boolean(i.sticky),r=this.datamanager.getColumns().filter(t=>t.sticky),l=r[r.length-1],a=s&&l&&l.colIndex===colIndex;return`\n <div class="${["dt-cell","dt-cell--col-"+colIndex,o?`dt-cell--${colIndex}-${rowIndex}`:"",o?"dt-cell--row-"+rowIndex:"",isHeader?"dt-cell--header":"",isHeader?`dt-cell--header-${colIndex}`:"",isFilter?"dt-cell--filter":"",o&&n&&n.meta.isTreeNodeClose?"dt-cell--tree-close":"",s?"dt-cell--sticky":"",s&&!o?"dt-cell--sticky-top":"",a?"dt-cell--sticky-last":""].join(" ")}" ${e} tabindex="0">\n ${this.getCellContent(t)}\n </div>\n `}getCellContent(t,e=!1){const{isHeader:isHeader,isFilter:isFilter,colIndex:colIndex}=t,n=!isHeader&&!1!==t.editable?this.getEditCellHTML(colIndex):"",i=isHeader&&!1!==t.sortable?`<span class="sort-indicator">\n ${this.options.sortIndicator[t.sortOrder]}\n </span>`:"",o=isHeader&&!1!==t.resizable?'<span class="dt-cell__resize-handle"></span>':"",s=isHeader&&!1!==t.dropdown?this.columnmanager.getDropdownHTML():"";let r,l=Dn.getCustomCellFormatter(t);if(isHeader||isFilter||!l)r=t.content;else if(!t.html||e){const e=this.datamanager.getRow(t.rowIndex),n=this.datamanager.getData(t.rowIndex);r=l(t.content,e,t.column,n)}else r=t.html;if(t.html=r,this.options.treeView&&!isHeader&&!isFilter&&void 0!==t.indent){const e=this.datamanager.getRow(t.rowIndex+1),n=e&&e.meta.indent>t.indent,i=this.datamanager.getColumnIndexById("_rowIndex")+1;if(i===t.colIndex){const e=20*(t.indent||0),i=n?`<span class="dt-tree-node__toggle" style="left: ${e-20}px">\n <span class="icon-open">${$n.chevronDown}</span>\n <span class="icon-close">${$n.chevronRight}</span>\n </span>`:"";r=`<span class="dt-tree-node" style="padding-left: ${e}px">\n ${i}\n <span>${r}</span>\n </span>`}}let a=`\n <div class="${["dt-cell__content",isHeader?`dt-cell__content--header-${colIndex}`:`dt-cell__content--col-${colIndex}`].join(" ")}">\n ${r}\n ${i}\n ${o}\n ${s}\n </div>\n ${n}\n `,c=document.createElement("div");c.innerHTML=r;let h=c.textContent;return h=h.replace(/\s+/g," ").trim(),a=a.replace(">",` title="${gt(h)}">`)}getEditCellHTML(t){return`<div class="dt-cell__edit dt-cell__edit--col-${t}"></div>`}selector(t,e){return`.dt-cell--${t}-${e}`}static getCustomCellFormatter(t){return t.format||t.column&&t.column.format||null}}class zn{constructor(t){this.instance=t,rt(this,this.instance,["options","fireEvent","header","datamanager","cellmanager","style","wrapper","rowmanager","bodyScrollable","bodyRenderer"]),this.bindEvents()}renderHeader(){this.header.innerHTML="<div></div>",this.refreshHeader()}refreshHeader(){const t=this.datamanager.getColumns();e("div",this.header).innerHTML=this.getHeaderHTML(t),this.$filterRow=e(".dt-row-filter",this.header),this.$filterRow&&e.style(this.$filterRow,{display:"none"}),this.$columnMap=[],this.bindMoveColumn()}getHeaderHTML(t){let e=this.rowmanager.getRowHTML(t,{isHeader:1});return this.options.inlineFilters&&(e+=this.rowmanager.getRowHTML(t,{isFilter:1})),e}bindEvents(){this.bindDropdown(),this.bindResizeColumn(),this.bindPerfectColumnWidth(),this.bindFilter()}bindDropdown(){function t(t){i.hideDropdown()}this.instance.dropdownContainer.innerHTML=this.getDropdownListHTML(),this.$dropdownList=this.instance.dropdownContainer.firstElementChild,e.on(this.header,"click",".dt-dropdown__toggle",t=>{this.openDropdown(t)});const n=e=>{const n=[".dt-dropdown__toggle",".dt-dropdown__toggle *",".dt-dropdown__list",".dt-dropdown__list *"].join(",");if(e.target.matches(n))return;t()};e.on(document.body,"click",n),document.addEventListener("scroll",t,!0),this.instance.on("onDestroy",()=>{e.off(document.body,"click",n);e.off(document,"scroll",t)}),e.on(this.$dropdownList,"click",".dt-dropdown__list-item",(t,n)=>{if(null==this._dropdownActiveColIndex)return;const i=this.options.headerDropdown;const{index:index}=e.data(n);const o=this._dropdownActiveColIndex;let s=i[index].action;s&&s.call(this.instance,this.getColumn(o));this.hideDropdown()});const i=this;this.stickDropdownIndex=this.options.headerDropdown.findIndex(t=>"stick"===t.stickyAction),this.unstickDropdownIndex=this.options.headerDropdown.findIndex(t=>"unstick"===t.stickyAction),this.hideDropdown()}openDropdown(t){this._dropdownWidth||(e.style(this.$dropdownList,{display:""}),this._dropdownWidth=e.style(this.$dropdownList,"width")),e.style(this.$dropdownList,{display:"",left:t.clientX-this._dropdownWidth+4+"px",top:t.clientY+4+"px"});const n=e.closest(".dt-cell",t.target),{colIndex:colIndex}=e.data(n);this._dropdownActiveColIndex=colIndex,this.updateStickyDropdownItems(this.getColumn(colIndex))}hideDropdown(){e.style(this.$dropdownList,{display:"none"}),this._dropdownActiveColIndex=null}bindResizeColumn(){let t,n,i,o=!1;e.on(this.header,"mousedown",".dt-cell .dt-cell__resize-handle",(s,r)=>{document.body.classList.add("dt-resize");const l=r.parentNode.parentNode;t=l;const{colIndex:colIndex}=e.data(t);const a=this.getColumn(colIndex);if(a&&!1===a.resizable)return;o=!0;n=e.style(e(".dt-cell__content",t),"width");i=s.pageX});const s=e=>{document.body.classList.remove("dt-resize");if(!t)return;o=!1;t=null};e.on(document.body,"mouseup",s),this.instance.on("onDestroy",()=>{e.off(document.body,"mouseup",s)});const r=s=>{if(!o)return;let r=s.pageX-i;"rtl"===this.options.direction&&(r*=-1);const l=n+r;const{colIndex:colIndex}=e.data(t);let a=this.options.minimumColumnWidth;if(a>l)return;this.datamanager.updateColumn(colIndex,{width:l});this.setColumnHeaderWidth(colIndex);this.setColumnWidth(colIndex);this.style.refreshStickyColumns();this.style.setBodyStyle()};e.on(document.body,"mousemove",r),this.instance.on("onDestroy",()=>{e.off(document.body,"mousemove",r)})}bindPerfectColumnWidth(){e.on(this.header,"dblclick",".dt-cell .dt-cell__resize-handle",(t,n)=>{const i=n.parentNode.parentNode;const{colIndex:colIndex}=e.data(i);let o=this.bodyRenderer.visibleRows.map(t=>t[colIndex]).reduce((t,e)=>t.content.length>e.content.length?t:e);let s=this.cellmanager.getCellHTML(o);let r=document.createElement("div");r.innerHTML=s;let l=r.querySelector(".dt-cell__content").textContent;let{borderLeftWidth:borderLeftWidth,borderRightWidth:borderRightWidth,paddingLeft:paddingLeft,paddingRight:paddingRight}=e.getStyle(this.bodyScrollable.querySelector(".dt-cell__content"));let a=[borderLeftWidth,borderRightWidth,paddingLeft,paddingRight].map(parseFloat).reduce((t,e)=>t+e);let c=e.measureTextWidth(l)+a;this.datamanager.updateColumn(colIndex,{width:c});this.setColumnHeaderWidth(colIndex);this.setColumnWidth(colIndex);this.style.refreshStickyColumns()})}bindMoveColumn(){if(!this.options.disableReorderColumn){const n=e(".dt-row",this.header);this.sortable=t.create(n,{onEnd:t=>{const{oldIndex:oldIndex,newIndex:newIndex}=t;const n=t.item;const{colIndex:colIndex}=e.data(n);if(+colIndex===newIndex)return;this.switchColumn(oldIndex,newIndex)},preventOnFilter:!1,filter:".dt-cell__resize-handle, .dt-dropdown",chosenClass:"dt-cell--dragging",animation:150})}}sortColumn(t,e){this.instance.freeze(),this.sortRows(t,e).then(()=>{this.refreshHeader();return this.rowmanager.refreshRows()}).then(()=>this.instance.unfreeze()).then(()=>{this.fireEvent("onSortColumn",this.getColumn(t));this.setSortState()})}saveSorting(t){let e=this.getColumn(t),n={[e.name]:{colIndex:t,sortOrder:e.sortOrder}};this.sortingKey=this.options.sortingKey?`${this.options.sortingKey}::sortedColumns`:"sortedColumns",localStorage.setItem(this.sortingKey,JSON.stringify(n))}setSortState(t){this.sortState="none"!==t}removeColumn(t){const e=this.getColumn(t);this.instance.freeze(),this.datamanager.removeColumn(t).then(()=>{this.refreshHeader();return this.rowmanager.refreshRows()}).then(()=>this.instance.unfreeze()).then(()=>{this.fireEvent("onRemoveColumn",e)})}setColumnSticky(t,e){const n=this.getColumn(t);n&&n.sticky!==e&&(this.instance.freeze(),this.datamanager.updateColumn(t,{sticky:e}),this.refreshHeader(),this.rowmanager.refreshRows().then(()=>this.instance.unfreeze()))}switchColumn(t,e){this.instance.freeze(),this.datamanager.switchColumn(t,e).then(()=>{this.refreshHeader();return this.rowmanager.refreshRows()}).then(()=>{this.setColumnWidth(t);this.setColumnWidth(e);this.instance.unfreeze()}).then(()=>{this.fireEvent("onSwitchColumn",this.getColumn(t),this.getColumn(e))})}toggleFilter(t){if(this.options.inlineFilters){let n;(n=void 0===t?!this.isFilterShown:t)?e.style(this.$filterRow,{display:""}):e.style(this.$filterRow,{display:"none"}),this.isFilterShown=n,this.style.setBodyStyle()}}focusFilter(t){this.isFilterShown&&e(`.dt-cell--col-${t} .dt-filter`,this.$filterRow).focus()}bindFilter(){if(this.options.inlineFilters){const t=t=>{this.applyFilter(this.getAppliedFilters())};e.on(this.header,"keydown",".dt-filter",On(t,300))}}applyFilter(t){this.datamanager.filterRows(t).then(({rowsToShow:rowsToShow})=>{this.rowmanager.showRows(rowsToShow)})}getAppliedFilters(){const t={};return e.each(".dt-filter",this.header).map(e=>{const n=e.value;n&&(t[e.dataset.colIndex]=n)}),t}applyDefaultSortOrder(){const t=this.getColumns().filter(t=>"none"!==t.sortOrder);if(1===t.length){const e=t[0];this.sortColumn(e.colIndex,e.sortOrder)}}applySavedSortOrder(){let t=this.options.sortingKey?`${this.options.sortingKey}::sortedColumns`:"sortedColumns",e=JSON.parse(localStorage.getItem(t));if(e){const t=Object.values(e);for(let e of t)this.sortColumn(e.colIndex,e.sortOrder),this.sortState=!0}}sortRows(t,e){return this.datamanager.sortRows(t,e)}getColumn(t){return this.datamanager.getColumn(t)}getColumns(){return this.datamanager.getColumns()}setColumnWidth(t,e){t=+t;let n=e||this.getColumn(t).width;const i=[`.dt-cell__content--col-${t}`,`.dt-cell__edit--col-${t}`].join(", "),o={width:n+"px"};this.style.setStyle(i,o)}setColumnHeaderWidth(t){t=+t,this.$columnMap=this.$columnMap||[];const e=`.dt-cell__content--header-${t}`,{width:width}=this.getColumn(t);let n=this.$columnMap[t];n||(n=this.header.querySelector(e),this.$columnMap[t]=n),n.style.width=width+"px"}getColumnMinWidth(t){return t=+t,this.getColumn(t).minWidth||24}getFirstColumnIndex(){return this.datamanager.getColumnIndexById("_rowIndex")+1}getHeaderCell$(t){return e(`.dt-cell--header-${t}`,this.header)}getLastColumnIndex(){return this.datamanager.getColumnCount()-1}getDropdownHTML(){const{dropdownButton:dropdownButton}=this.options;return`\n <div class="dt-dropdown">\n <div class="dt-dropdown__toggle">${dropdownButton}</div>\n </div>\n `}getDropdownListHTML(){const{headerDropdown:dropdownItems}=this.options;return`\n <div class="dt-dropdown__list">\n ${dropdownItems.map((t,e)=>`\n <div \n class="dt-dropdown__list-item${t.display?" dt-hidden":""}" \n data-index="${e}"\n >\n ${t.label}\n </div>\n `).join("")}\n </div>\n `}toggleDropdownItem(t){e(".dt-dropdown__list",this.instance.dropdownContainer).children[t].classList.toggle("dt-hidden")}updateStickyDropdownItems(t){if(t&&-1!==this.stickDropdownIndex&&-1!==this.unstickDropdownIndex){const e=this.$dropdownList.children[this.stickDropdownIndex],n=this.$dropdownList.children[this.unstickDropdownIndex];e&&n&&(t.sticky?(e.classList.add("dt-hidden"),n.classList.remove("dt-hidden")):(e.classList.remove("dt-hidden"),n.classList.add("dt-hidden")))}}}class Fn{constructor(t){this.instance=t,rt(this,this.instance,["options","fireEvent","wrapper","bodyScrollable","bodyRenderer","style"]),this.bindEvents(),this.refreshRows=st(this.refreshRows,this)}get datamanager(){return this.instance.datamanager}get cellmanager(){return this.instance.cellmanager}bindEvents(){this.bindCheckbox()}bindCheckbox(){this.options.checkboxColumn&&(this.checkMap=[],e.on(this.wrapper,"click",'.dt-cell--col-0 [type="checkbox"]',(t,n)=>{const i=n.closest(".dt-cell");const{rowIndex:rowIndex,isHeader:isHeader}=e.data(i);const o=n.checked;isHeader?this.checkAll(o):this.checkRow(rowIndex,o)}))}refreshRows(){this.instance.renderBody(),this.instance.setDimensions()}refreshRow(t,e){this.datamanager.updateRow(t,e).forEach(t=>{this.cellmanager.refreshCell(t,!0)})}getCheckedRows(){if(!this.checkMap)return[];let t=[];for(let e in this.checkMap){const n=this.checkMap[e];1===n&&t.push(e)}return t}highlightCheckedRows(){this.getCheckedRows().map(t=>this.checkRow(t,!0))}checkRow(t,n){const i=n?1:0,o=t=>`.dt-cell--0-${t} [type="checkbox"]`;this.checkMap[t]=i,e.each(o(t),this.bodyScrollable).map(t=>{t.checked=n}),this.highlightRow(t,n),this.showCheckStatus(),this.fireEvent("onCheckRow",this.datamanager.getRow(t))}checkAll(t){const n=t?1:0;t?this.datamanager._filteredRows?this.datamanager._filteredRows.forEach(e=>{this.checkRow(e,t)}):this.checkMap=Array.from(Array(this.getTotalRows())).map(t=>n):this.checkMap=[],e.each('.dt-cell--col-0 [type="checkbox"]',this.bodyScrollable).map(e=>{e.checked=t}),this.highlightAll(t),this.showCheckStatus(),this.fireEvent("onCheckRow")}showCheckStatus(){if(this.options.checkedRowStatus){const t=this.getCheckedRows().length;if(t>0){let e=this.instance.translate("{count} rows selected",{count:t});this.bodyRenderer.showToastMessage(e)}else this.bodyRenderer.clearToastMessage()}}highlightRow(t,e=!0){const n=this.getRow$(t);if(n){if(!e&&this.bodyScrollable.classList.contains("dt-scrollable--highlight-all"))return void n.classList.add("dt-row--unhighlight");e&&n.classList.contains("dt-row--unhighlight")&&n.classList.remove("dt-row--unhighlight"),this._highlightedRows=this._highlightedRows||{},e?(n.classList.add("dt-row--highlight"),this._highlightedRows[t]=n):(n.classList.remove("dt-row--highlight"),delete this._highlightedRows[t])}}highlightAll(t=!0){if(t)this.bodyScrollable.classList.add("dt-scrollable--highlight-all");else{this.bodyScrollable.classList.remove("dt-scrollable--highlight-all");for(const t in this._highlightedRows){const e=this._highlightedRows[t];e.classList.remove("dt-row--highlight")}this._highlightedRows={}}}showRows(t){const e=(t=ht(t)).map(t=>this.datamanager.getRow(t));this.bodyRenderer.renderRows(e)}showAllRows(){const t=this.datamanager.getAllRowIndices();this.showRows(t)}getChildrenToShowForNode(t){return this.datamanager.getRow(t).meta.isTreeNodeClose=!1,this.datamanager.getImmediateChildren(t)}openSingleNode(t){const e=ut([...this.getChildrenToShowForNode(t),...this.bodyRenderer.visibleRowIndices]).sort(dt);this.showRows(e)}getChildrenToHideForNode(t){this.datamanager.getRow(t).meta.isTreeNodeClose=!0;const e=this.datamanager.getChildren(t);return e.forEach(t=>{const e=this.datamanager.getRow(t);e.meta.isLeaf||(e.meta.isTreeNodeClose=!0)}),e}closeSingleNode(t){const e=this.getChildrenToHideForNode(t),n=this.bodyRenderer.visibleRowIndices.filter(t=>!e.includes(t)).sort(dt);this.showRows(n)}expandAllNodes(){const t=ut([...this.datamanager.getRows().filter(t=>!t.meta.isLeaf).map(t=>this.getChildrenToShowForNode(t.meta.rowIndex)).flat(),...this.bodyRenderer.visibleRowIndices]).sort(dt);this.showRows(t)}collapseAllNodes(){const t=this.datamanager.getRows().filter(t=>0===t.meta.indent).map(t=>this.getChildrenToHideForNode(t.meta.rowIndex)).flat(),e=this.bodyRenderer.visibleRowIndices.filter(e=>!t.includes(e)).sort(dt);this.showRows(e)}setTreeDepth(t){let e=this.datamanager.getRows();const n=e.filter(e=>e.meta.indent<t),i=e.filter(e=>e.meta.indent>=t),o=i.filter(e=>e.meta.indent>t);i.forEach(t=>{t.meta.isLeaf||(t.meta.isTreeNodeClose=!0)}),n.forEach(t=>{t.meta.isLeaf||(t.meta.isTreeNodeClose=!1)});const s=e.filter(t=>!o.includes(t)).map(t=>t.meta.rowIndex).sort(dt);this.showRows(s)}getRow$(t){return e(this.selector(t),this.bodyScrollable)}getTotalRows(){return this.datamanager.getRowCount()}getFirstRowIndex(){return 0}getLastRowIndex(){return this.datamanager.getRowCount()-1}scrollToRow(t){t=+t,this._lastScrollTo=this._lastScrollTo||0;const n=this.getRow$(t);if(!e.inViewport(n,this.bodyScrollable)){const{height:height}=n.getBoundingClientRect(),{top:top,bottom:bottom}=this.bodyScrollable.getBoundingClientRect(),i=Math.floor((bottom-top)/height);let o=0;o=t>this._lastScrollTo?height*(t+1-i):height*(t+1-1),this._lastScrollTo=t,e.scrollTop(this.bodyScrollable,o)}}getRowHTML(t,e){const n=nt(e);let i=e.rowIndex;return e.isFilter&&(t=t.map(t=>Object.assign({},t,{content:this.getFilterInput({colIndex:t.colIndex,name:t.name}),isFilter:1,isHeader:void 0,editable:!1})),i="filter"),e.isHeader&&(i="header"),`\n <div class="dt-row dt-row-${i}" ${n}>\n ${t.map(t=>this.cellmanager.getCellHTML(t)).join("")}\n </div>\n `}getFilterInput(t){let e=`title="Filter based on ${t.name||"Index"}"`;return`<input class="dt-filter dt-input" type="text" ${nt(t)} tabindex="1"\n ${0===t.colIndex?"disabled":e} />`}selector(t){return`.dt-row-${t}`}}var jn=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){!function(e){t.exports=function(){return function t(e,n,i){function s(l,a){if(!n[l]){if(!e[l]){var c="function"==typeof o&&o;if(!a&&c)return c(l,!0);if(r)return r(l,!0);var h=new Error("Cannot find module '"+l+"'");throw h.code="MODULE_NOT_FOUND",h}var u=n[l]={exports:{}};e[l][0].call(u.exports,function(t){var n=e[l][1][t];return s(n||t)},u,u.exports,t,e,n,i)}return n[l].exports}for(var r="function"==typeof o&&o,l=0;l<i.length;l++)s(i[l]);return s}({1:[function(t,e,n){function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s={width:"100%",height:"100%"},r=function(t){return Number(t)===Number(t)},l=function(){function t(e,n){var o=this;i(this,t),this._config={},this._lastRepaint=null,this._maxElementHeight=t.getMaxBrowserHeight(),this.refresh(e,n);var s=this._config;!function t(){var e=o._getScrollPosition(),n=o._lastRepaint;if(o._renderAnimationFrame=window.requestAnimationFrame(t),e!==n&&(!n||Math.abs(e-n)>o._averageHeight)){var i=o._renderChunk();o._lastRepaint=e,!1!==i&&"function"==typeof s.afterRender&&s.afterRender()}}()}return o(t,null,[{key:"create",value:function(e,n){return new t(e,n)}},{key:"mergeStyle",value:function(t,e){for(var n in e)t.style[n]!==e[n]&&(t.style[n]=e[n])}},{key:"getMaxBrowserHeight",value:function(){var e=document.createElement("div"),n=document.createElement("div");t.mergeStyle(e,{position:"absolute",height:"1px",opacity:0}),t.mergeStyle(n,{height:"1e7px"}),e.appendChild(n),document.body.appendChild(e);var i=n.offsetHeight;return document.body.removeChild(e),i}}]),o(t,[{key:"destroy",value:function(){window.cancelAnimationFrame(this._renderAnimationFrame)}},{key:"refresh",value:function(e,n){var i=this;if(Object.assign(this._config,s,n),!e||1!==e.nodeType)throw new Error("HyperList requires a valid DOM Node container");this._element=e;var o=this._config,l=this._scroller||o.scroller||document.createElement(o.scrollerTagName||"tr");if("boolean"!=typeof o.useFragment&&(this._config.useFragment=!0),!o.generate)throw new Error("Missing required `generate` function");if(!r(o.total))throw new Error("Invalid required `total` value, expected number");if(!Array.isArray(o.itemHeight)&&!r(o.itemHeight))throw new Error("\n Invalid required `itemHeight` value, expected number or array\n ".trim());r(o.itemHeight)?this._itemHeights=Array(o.total).fill(o.itemHeight):this._itemHeights=o.itemHeight,Object.keys(s).filter(function(t){return t in o}).forEach(function(t){var e=o[t],n=r(e),s=!n&&"%"===e.slice(-1);if(e&&"string"!=typeof e&&"number"!=typeof e){var l="Invalid optional `"+t+"`, expected string or number";throw new Error(l)}if(n&&(o[t]=e+"px"),"height"===t){var a=n?e:parseInt(e.replace(/px|%/,""),10);i._containerHeight=s?window.innerHeight*a/100:r(e)?e:a}});var a={width:""+o.width,height:""+o.height,overflow:"auto",position:"relative"};t.mergeStyle(e,a);var c=o.itemHeight*o.total,h=this._maxElementHeight;c>h&&console.warn(["HyperList: The maximum element height",h+"px has","been exceeded; please reduce your item height."].join(" "));var u={opacity:"0",position:"absolute",width:"1px",height:c+"px"};t.mergeStyle(l,u),this._scroller||e.appendChild(l),this._scroller=l,this._scrollHeight=this._computeScrollHeight(),this._itemPositions=this._itemPositions||Array(o.total).fill(0),this._computePositions(0),this._renderChunk(null!==this._lastRepaint),"function"==typeof o.afterRender&&o.afterRender()}},{key:"_getRow",value:function(e){var n=this._config,i=n.generate(e),o=i.height;if(void 0!==o&&r(o)?(i=i.element,o!==this._itemHeights&&(this._itemHeights[e]=o,this._computePositions(e),this._scrollHeight=this._computeScrollHeight(e))):o=this._itemHeights[e],!i||1!==i.nodeType)throw new Error("Generator did not return a DOM Node for index: "+e);var s=i.getAttribute("class")||"";i.setAttribute("class",s+" "+(n.rowClassName||"vrow"));var l=this._itemPositions[e];return t.mergeStyle(i,{position:"absolute",top:l+"px"}),i}},{key:"_getScrollPosition",value:function(){var t=this._config;return"function"==typeof t.overrideScrollPosition?t.overrideScrollPosition():this._element.scrollTop}},{key:"_renderChunk",value:function(t){var e=this._config,n=this._element,i=this._getScrollPosition(),o=e.total,s=e.reverse?this._getReverseFrom(i):this._getFrom(i)-1;if((s<0||s-this._screenItemsLen<0)&&(s=0),!t&&this._lastFrom===s)return!1;this._lastFrom=s;var r=s+this._cachedItemsLen;(r>o||r+this._cachedItemsLen>o)&&(r=o);var l=e.useFragment?document.createDocumentFragment():[],a=this._scroller;l[e.useFragment?"appendChild":"push"](a);for(var c=s;c<r;c++){var h=this._getRow(c);l[e.useFragment?"appendChild":"push"](h)}if(e.applyPatch)return e.applyPatch(n,l);n.innerHTML="",n.appendChild(l)}},{key:"_computePositions",value:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],e=this._config,n=e.total,i=e.reverse;t<1&&!i&&(t=1);for(var o=t;o<n;o++)i?0===o?this._itemPositions[0]=this._scrollHeight-this._itemHeights[0]:this._itemPositions[o]=this._itemPositions[o-1]-this._itemHeights[o]:this._itemPositions[o]=this._itemHeights[o-1]+this._itemPositions[o-1]}},{key:"_computeScrollHeight",value:function(){var e=this,n=this._config,i=n.total,o=this._itemHeights.reduce(function(t,e){return t+e},0);t.mergeStyle(this._scroller,{opacity:0,position:"absolute",width:"1px",height:o+"px"});var s=this._itemHeights.slice(0).sort(function(t,e){return t-e}),r=Math.floor(i/2),l=i%2==0?(s[r]+s[r-1])/2:s[r],a=this._element.clientHeight?this._element.clientHeight:this._containerHeight;return this._screenItemsLen=Math.ceil(a/l),this._containerHeight=a,this._cachedItemsLen=Math.max(this._cachedItemsLen||0,3*this._screenItemsLen),this._averageHeight=l,n.reverse&&window.requestAnimationFrame(function(){e._element.scrollTop=o}),o}},{key:"_getFrom",value:function(t){for(var e=0;this._itemPositions[e]<t;)e++;return e}},{key:"_getReverseFrom",value:function(t){for(var e=this._config.total-1;e>0&&this._itemPositions[e]<t+this._containerHeight;)e--;return e}}]),t}();n.default=l,e.exports=n.default},{}]},{},[1])(1)}()}()}));class An{constructor(t){this.instance=t,this.options=t.options,this.datamanager=t.datamanager,this.rowmanager=t.rowmanager,this.cellmanager=t.cellmanager,this.bodyScrollable=t.bodyScrollable,this.footer=this.instance.footer,this.log=t.log}renderRows(t){if(this.visibleRows=t,this.visibleRowIndices=t.map(t=>t.meta.rowIndex),this.instance.noData=!1,0===t.length)return this.bodyScrollable.innerHTML=this.getNoDataHTML(),this.instance.noData=!0,void(this.footer.innerHTML="");let e=new Set(this.visibleRowIndices);const n=this.datamanager.rowViewOrder.map(t=>{if(e.has(t))return t;return null}).filter(t=>null!==t),i=getComputedStyle(this.bodyScrollable);let o={width:i.width,height:i.height,itemHeight:this.options.cellHeight,total:t.length,generate:t=>{const e=document.createElement("div");const i=n[t];const o=this.datamanager.getRow(i);const s=this.rowmanager.getRowHTML(o,o.meta);e.innerHTML=s;return e.children[0]},afterRender:()=>{this.restoreState()}};this.hyperlist?this.hyperlist.refresh(this.bodyScrollable,o):this.hyperlist=new jn(this.bodyScrollable,o),this.renderFooter()}render(){const t=this.getRowsToRender();this.renderRows(t),this.instance.setDimensions()}getRowsToRender(){let t=null;return this.datamanager.getRowsForView().filter(e=>{const{indent:indent,isTreeNodeClose:isTreeNodeClose}=e.meta;if(null!==t&&indent>t)return!1;t=isTreeNodeClose?indent:null;return!0})}renderFooter(){if(this.options.showTotalRow){const t=this.getTotalRow();let e=this.rowmanager.getRowHTML(t,{isTotalRow:1,rowIndex:"totalRow"});this.footer.innerHTML=e}}getTotalRow(){return this.datamanager.getColumns().map(t=>{let e=null;["_rowIndex","_checkbox"].includes(t.id)&&(e="");return{content:e,isTotalRow:1,colIndex:t.colIndex,column:t}}).map((t,e)=>{if(""===t.content)return t;if(this.options.hooks.columnTotal){const n=this.visibleRows.map(t=>t[e].content),i=this.options.hooks.columnTotal.call(this.instance,n,t);if(null!=i)return t.content=i,t}t.content=this.visibleRows.reduce((t,n)=>{const i=n[e];if("number"==typeof i.content)return null==t&&(t=0),t+i.content;return t},t.content);return t})}restoreState(){this.rowmanager.highlightCheckedRows(),this.cellmanager.selectAreaOnClusterChanged(),this.cellmanager.focusCellOnClusterChanged()}showToastMessage(t,e){this.instance.toastMessage.innerHTML=this.getToastMessageHTML(t),e&&setTimeout(()=>{this.clearToastMessage()},1e3*e)}clearToastMessage(){this.instance.toastMessage.innerHTML=""}getNoDataHTML(){const t=window.getComputedStyle(this.instance.header);return`\n <div \n class="dt-scrollable__no-data" \n style="width: ${-new DOMMatrixReadOnly(t.transform).m41+this.instance.header.clientWidth}px; height: ${this.bodyScrollable.clientHeight}px"\n >\n <div class="dt-scrollable__no-data no-data-message">\n ${this.options.noDataMessage}\n </div>\n </div>\n `}getToastMessageHTML(t){return`<span class="dt-toast__message">${t}</span>`}}class Wn{constructor(t){this.instance=t,rt(this,this.instance,["options","datamanager","columnmanager","header","footer","bodyScrollable","datatableWrapper","getColumn","bodyRenderer"]),this.scopeClass="dt-instance-"+t.constructor.instances,t.datatableWrapper.classList.add(this.scopeClass);const e=document.createElement("style");t.wrapper.insertBefore(e,t.datatableWrapper),this.styleEl=e,this.bindResizeWindow(),this.bindScrollHeader()}get stylesheet(){return this.styleEl.sheet}bindResizeWindow(){this.onWindowResize=this.onWindowResize.bind(this),this.onWindowResize=Hn(this.onWindowResize,300),"fluid"===this.options.layout&&e.on(window,"resize",this.onWindowResize)}bindScrollHeader(){this._settingHeaderPosition=!1,this.updateStickyTopPositions(0),e.on(this.bodyScrollable,"scroll",t=>{if(this._settingHeaderPosition)return;this._settingHeaderPosition=!0;requestAnimationFrame(()=>{const n=t.target.scrollLeft;const i=-n;e.style(this.header,{transform:`translateX(${i}px)`});e.style(this.footer,{transform:`translateX(${i}px)`});this.updateStickyTopPositions(n);this._settingHeaderPosition=!1;this.instance.noData&&e.style(e(".no-data-message"),{left:`${this.instance.wrapper.clientWidth/2-i}px`});this._settingHeaderPosition=!1})})}onWindowResize(){this.distributeRemainingWidth(),this.refreshColumnWidth(),this.setBodyStyle()}destroy(){this.styleEl.remove(),e.off(window,"resize",this.onWindowResize)}setStyle(t,e){if(t.includes(","))return void t.split(",").map(t=>t.trim()).forEach(t=>{this.setStyle(t,e)});if(t=t.trim()){this._styleRulesMap=this._styleRulesMap||{};const n=this._getPrefixedSelector(t);this._styleRulesMap[n]&&(this.removeStyle(t),e=Object.assign({},this._styleRulesMap[n],e));const i=`${n} { ${this._getRuleString(e)} }`;this._styleRulesMap[n]=e,this.stylesheet.insertRule(i)}}removeStyle(t){if(t.includes(","))return void t.split(",").map(t=>t.trim()).forEach(t=>{this.removeStyle(t)});if(t=t.trim()){const e=this._getPrefixedSelector(t),n=Array.from(this.stylesheet.cssRules).findIndex(t=>t.selectorText===e);-1!==n&&this.stylesheet.deleteRule(n)}}_getPrefixedSelector(t){return`.${this.scopeClass} ${t}`}_getRuleString(t){return Object.keys(t).map(e=>{let n=e;e.includes("-")||(n=et(e));return`${n}:${t[e]};`}).join("")}setDimensions(){this.setCellHeight(),this.setupMinWidth(),this.setupNaturalColumnWidth(),this.setupColumnWidth(),this.distributeRemainingWidth(),this.setColumnStyle(),this.refreshStickyColumns(),this.setBodyStyle()}setCellHeight(){this.setStyle(".dt-cell",{height:this.options.cellHeight+"px"})}setupMinWidth(){e.each(".dt-cell--header",this.header).map(t=>{const{colIndex:colIndex}=e.data(t);const n=this.getColumn(colIndex);if(!n.minWidth){const i=e.style(e(".dt-cell__content",t),"width");n.minWidth=i}})}setupNaturalColumnWidth(){e(".dt-row")&&(e.each(".dt-row-header .dt-cell",this.header).map(t=>{const{colIndex:colIndex}=e.data(t);const n=this.datamanager.getColumn(colIndex);let i=e.style(e(".dt-cell__content",t),"width");"number"==typeof i&&i>=this.options.minimumColumnWidth?n.naturalWidth=i:n.naturalWidth=this.options.minimumColumnWidth}),e.each(".dt-row-0 .dt-cell",this.bodyScrollable).map(t=>{const{colIndex:colIndex}=e.data(t);const n=this.datamanager.getColumn(colIndex);let i=e.style(e(".dt-cell__content",t),"width");"number"==typeof i&&i>=n.naturalWidth?n.naturalWidth=i:n.naturalWidth=n.naturalWidth}))}setupColumnWidth(){if("ratio"===this.options.layout){let t=e.style(this.datatableWrapper,"width");if(this.options.serialNoColumn){const e=this.datamanager.getColumnById("_rowIndex");t=t-e.width-1}if(this.options.checkboxColumn){const e=this.datamanager.getColumnById("_checkbox");t=t-e.width-1}const n=this.datamanager.getColumns().map(t=>{if("_rowIndex"===t.id||"_checkbox"===t.id)return 0;t.width||(t.width=1);t.ratioWidth=parseInt(t.width,10);return t.ratioWidth}).reduce((t,e)=>t+e),i=t/n;this.datamanager.getColumns().map(t=>{if("_rowIndex"===t.id||"_checkbox"===t.id)return;t.width=Math.floor(i*t.ratioWidth)-1})}else this.datamanager.getColumns().map(t=>{t.width||(t.width=t.naturalWidth);"_rowIndex"===t.id&&(t.width=this.getRowIndexColumnWidth());t.width<this.options.minimumColumnWidth&&(t.width=this.options.minimumColumnWidth)})}distributeRemainingWidth(){if("fluid"===this.options.layout){const t=e.style(this.instance.datatableWrapper,"width");let n=e(".dt-row",this.bodyScrollable),i=t;if(n)i=e.style(n,"width");else{let t=e(".dt-row",this.instance.header),n=Array.from(t.children).map(t=>t.offsetWidth);i=n.reduce((t,e)=>t+e,0)}const o=this.datamanager.getColumns().filter(t=>t.resizable),s=(t-i)/o.length;o.map(t=>{const n=e.style(this.getColumnHeaderElement(t.colIndex),"width");let i=Math.floor(n+s)-2;this.datamanager.updateColumn(t.colIndex,{width:i})})}}setColumnStyle(){this.datamanager.getColumns().map(t=>{t.align||(t.align="left");["left","center","right"].includes(t.align)||(t.align="left");this.setStyle(`.dt-cell--col-${t.colIndex}`,{"text-align":t.align});this.columnmanager.setColumnHeaderWidth(t.colIndex);this.columnmanager.setColumnWidth(t.colIndex)})}refreshColumnWidth(){this.datamanager.getColumns().map(t=>{this.columnmanager.setColumnHeaderWidth(t.colIndex);this.columnmanager.setColumnWidth(t.colIndex)}),this.refreshStickyColumns()}refreshStickyColumns(){this.setStickyColumnStyle(),this.updateStickyTopPositions(this.bodyScrollable.scrollLeft||0)}setBodyStyle(){const t=e.style(this.datatableWrapper,"width"),n=e(".dt-row",this.bodyScrollable);if(n){const i=e.style(n,"width");let o=t>i?i+10:t;e.style(this.bodyScrollable,{width:o+"px"}),e.removeStyle(this.bodyScrollable,"height");let s=e.getStyle(this.bodyScrollable,"height");const r=(this.bodyRenderer.hyperlist||{})._scrollHeight||1/0,l=e.hasHorizontalOverflow(this.bodyScrollable);let a;r<s&&(a=r,l&&(a+=e.scrollbarSize()),e.style(this.bodyScrollable,{height:a+"px"})),this.bodyScrollable.scrollHeight-this.bodyScrollable.offsetHeight<e.scrollbarSize()&&e.style(this.bodyScrollable,{overflowY:"hidden"}),"fluid"===this.options.layout&&e.style(this.bodyScrollable,{overflowX:"hidden"})}}getColumnHeaderElement(t){return t=+t,t<0?null:e(`.dt-cell--col-${t}`,this.header)}setStickyColumnStyle(){if(this.datamanager&&this.datamanager.getColumns){const t=this.datamanager.getColumns();if(t.some(t=>t.sticky)||(this._stickySelectors||[]).length){const e=[];let n=0,i=0;t.forEach(t=>{const o=this.getColumnHeaderElement(t.colIndex);const s=o?o.offsetWidth:t.width;if(t.sticky){const o=`.dt-cell--col-${t.colIndex}.dt-cell--sticky`,r={left:`${n}px`};t.stickyLeft=n,t.stickyScrollTrigger=i-n,t.renderedWidth=s,this.setStyle(o,r),e.push(o),n+=s}i+=s}),(this._stickySelectors||[]).filter(t=>!e.includes(t)).forEach(t=>this.removeStyle(t)),this._stickySelectors=e}}}updateStickyTopPositions(t){this.datamanager&&this.datamanager.getColumns&&this.datamanager.getColumns().filter(t=>t.sticky).forEach(n=>{const i=Math.max(0,n.stickyScrollTrigger||0);const o=Math.max(0,t-i);const s=e.each(`.dt-cell--col-${n.colIndex}.dt-cell--sticky-top`,this.wrapper)||[];e.style(s,{transform:o?`translateX(${o}px)`:""})})}getRowIndexColumnWidth(){const t=this.datamanager.getRowCount();return e.measureTextWidth(t+"")+22}}const Nn={13:"enter",91:"meta",16:"shift",17:"ctrl",18:"alt",37:"left",38:"up",39:"right",40:"down",9:"tab",27:"esc",67:"c",70:"f",86:"v"};class Pn{constructor(t){this.listeners={},e.on(t,"keydown",this.handler.bind(this))}handler(t){let e=Nn[t.keyCode];t.shiftKey&&"shift"!==e&&(e="shift+"+e),(t.ctrlKey&&"ctrl"!==e||t.metaKey&&"meta"!==e)&&(e="ctrl+"+e);const n=this.listeners[e];if(n&&n.length>0)for(let e of n){const n=e(t);void 0!==n&&!0!==n||t.preventDefault()}}on(t,e){t.split(",").map(t=>t.trim()).map(t=>{this.listeners[t]=this.listeners[t]||[];this.listeners[t].push(e)})}}var Bn={Freeze:"Freeze",Unfreeze:"Unfreeze","Sort Ascending":"Sort Ascending","Sort Descending":"Sort Descending","Reset sorting":"Reset sorting","Remove column":"Remove column","No Data":"No Data","{count} cells copied":{1:"{count} cell copied",default:"{count} cells copied"},"{count} rows selected":{1:"{count} row selected",default:"{count} rows selected"}},Vn={Freeze:"Bevriezen",Unfreeze:"Ontdooien","Sort Ascending":"Aufsteigend sortieren","Sort Descending":"Absteigend sortieren","Reset sorting":"Sortierung zurücksetzen","Remove column":"Spalte entfernen","No Data":"Keine Daten","{count} cells copied":{1:"{count} Zelle kopiert",default:"{count} Zellen kopiert"},"{count} rows selected":{1:"{count} Zeile ausgewählt",default:"{count} Zeilen ausgewählt"}},qn={Freeze:"Geler",Unfreeze:"Dégeler","Sort Ascending":"Trier par ordre croissant","Sort Descending":"Trier par ordre décroissant","Reset sorting":"Réinitialiser le tri","Remove column":"Supprimer colonne","No Data":"Pas de données","{count} cells copied":{1:"{count} cellule copiée",default:"{count} cellules copiées"},"{count} rows selected":{1:"{count} ligne sélectionnée",default:"{count} lignes sélectionnées"}},Kn={Freeze:"Congelare",Unfreeze:"Dégeler","Sort Ascending":"Ordinamento ascendente","Sort Descending":"Ordinamento decrescente","Reset sorting":"Azzeramento ordinamento","Remove column":"Rimuovi colonna","No Data":"Nessun dato","{count} cells copied":{1:"Copiato {count} cella",default:"{count} celle copiate"},"{count} rows selected":{1:"{count} linea selezionata",default:"{count} linee selezionate"}};class Un{constructor(t){this.language=t,this.translations=pt()}addTranslations(t){this.translations=Object.assign(this.translations,t)}translate(t,e){let n=this.translations[this.language]&&this.translations[this.language][t]||t;return"object"==typeof n&&(n=e&&e.count?this.getPluralizedTranslation(n,e.count):t),mt(n,e||{})}getPluralizedTranslation(t,e){return t[e]||t.default}}let Zn={DataManager:Ln,CellManager:Dn,ColumnManager:zn,RowManager:Fn,BodyRenderer:An,Style:Wn,Keyboard:Pn};class Xn{constructor(t,e){if(Xn.instances++,"string"==typeof t&&(t=document.querySelector(t)),this.wrapper=t,!(this.wrapper instanceof HTMLElement))throw new Error("Invalid argument given for `wrapper`");this.initializeTranslations(e),this.setDefaultOptions(),this.buildOptions(e),this.prepare(),this.initializeComponents(),this.options.data&&(this.refresh(),this.columnmanager.applyDefaultSortOrder(),this.options.saveSorting&&(this.setupSaveSorting(),this.columnmanager.applySavedSortOrder()))}initializeTranslations(t){this.language=t.language||"en",this.translationManager=new Un(this.language),t.translations&&this.translationManager.addTranslations(t.translations)}setDefaultOptions(){this.DEFAULT_OPTIONS=Ct(this)}buildOptions(t){this.options=this.options||{},this.options=Object.assign({},this.DEFAULT_OPTIONS,this.options||{},t),t.headerDropdown=t.headerDropdown||[],this.options.headerDropdown=[...this.DEFAULT_OPTIONS.headerDropdown,...t.headerDropdown],this.events=Object.assign({},this.DEFAULT_OPTIONS.events,this.options.events||{},t.events||{}),this.fireEvent=this.fireEvent.bind(this)}prepare(){this.prepareDom(),this.unfreeze()}initializeComponents(){let t=Object.assign({},Zn,this.options.overrideComponents),{Style:Style$$1,Keyboard:Keyboard$$1,DataManager:DataManager$$1,RowManager:RowManager$$1,ColumnManager:ColumnManager$$1,CellManager:CellManager$$1,BodyRenderer:BodyRenderer$$1}=t;this.style=new Style$$1(this),this.keyboard=new Keyboard$$1(this.wrapper),this.datamanager=new DataManager$$1(this.options),this.rowmanager=new RowManager$$1(this),this.columnmanager=new ColumnManager$$1(this),this.cellmanager=new CellManager$$1(this),this.bodyRenderer=new BodyRenderer$$1(this)}prepareDom(){this.wrapper.innerHTML=`\n <div class="datatable" dir="${this.options.direction}">\n <div class="dt-header"></div>\n <div class="dt-scrollable"></div>\n <div class="dt-footer"></div>\n <div class="dt-freeze">\n <span class="dt-freeze__message">\n ${this.options.freezeMessage}\n </span>\n </div>\n <div class="dt-toast"></div>\n <div class="dt-dropdown-container"></div>\n <textarea class="dt-paste-target"></textarea>\n </div>\n `,this.datatableWrapper=e(".datatable",this.wrapper),this.header=e(".dt-header",this.wrapper),this.footer=e(".dt-footer",this.wrapper),this.bodyScrollable=e(".dt-scrollable",this.wrapper),this.freezeContainer=e(".dt-freeze",this.wrapper),this.toastMessage=e(".dt-toast",this.wrapper),this.pasteTarget=e(".dt-paste-target",this.wrapper),this.dropdownContainer=e(".dt-dropdown-container",this.wrapper)}refresh(t,e){this.datamanager.init(t,e),this.render(),this.setDimensions()}destroy(){this.wrapper.innerHTML="",this.style.destroy(),this.fireEvent("onDestroy")}appendRows(t){this.datamanager.appendRows(t),this.rowmanager.refreshRows()}refreshRow(t,e){this.rowmanager.refreshRow(t,e)}render(){this.renderHeader(),this.renderBody()}renderHeader(){this.columnmanager.renderHeader()}renderBody(){this.bodyRenderer.render()}setDimensions(){this.style.setDimensions()}showToastMessage(t,e){this.bodyRenderer.showToastMessage(t,e)}clearToastMessage(){this.bodyRenderer.clearToastMessage()}getColumn(t){return this.datamanager.getColumn(t)}getColumns(){return this.datamanager.getColumns()}getRows(){return this.datamanager.getRows()}getCell(t,e){return this.datamanager.getCell(t,e)}getColumnHeaderElement(t){return this.columnmanager.getColumnHeaderElement(t)}getViewportHeight(){return this.viewportHeight||(this.viewportHeight=e.style(this.bodyScrollable,"height")),this.viewportHeight}sortColumn(t,e){this.columnmanager.sortColumn(t,e)}saveSorting(t,e){this.columnmanager.saveSorting(t,e)}removeColumn(t){this.columnmanager.removeColumn(t)}setColumnSticky(t,e){this.columnmanager.setColumnSticky(t,e)}scrollToLastColumn(){this.datatableWrapper.scrollLeft=9999}freeze(){e.style(this.freezeContainer,{display:""})}unfreeze(){e.style(this.freezeContainer,{display:"none"})}updateOptions(t){this.buildOptions(t)}fireEvent(t,...e){const n=[...this._internalEventHandlers[t]||[],this.events[t]].filter(Boolean);for(let t of n)t.apply(this,e)}on(t,e){this._internalEventHandlers=this._internalEventHandlers||{},this._internalEventHandlers[t]=this._internalEventHandlers[t]||[],this._internalEventHandlers[t].push(e)}log(){this.options.logs&&console.log.apply(console,arguments)}translate(t,e){return this.translationManager.translate(t,e)}setupSaveSorting(){let t={label:this.translate("Save Sorting"),action:function(t){this.saveSorting(t.colIndex,t.sotOrder)},display:"hidden"};this.options.headerDropdown.push(t),this.columnmanager.bindDropdown(),this.on("onSortColumn",function(t){this.columnmanager.toggleDropdownItem(4),"none"===t.sortOrder&&localStorage.removeItem(this.columnmanager.sortingKey)})}}Xn.instances=0;var Gn={name:"melondtable",version:"0.0.0-development",description:"A modern datatable library for the web",main:"dist/melondtable.cjs.js",unpkg:"dist/melondtable.min.js",jsdelivr:"dist/melondtable.min.js",scripts:{start:"yarn run dev",build:"rollup -c && NODE_ENV=production rollup -c",dev:"rollup -c -w","cy:server":"http-server -p 8989","cy:open":"cypress open","cy:run":"cypress run",test:"start-server-and-test cy:server http://localhost:8989 cy:run","test-local":"start-server-and-test cy:server http://localhost:8989 cy:open","travis-deploy-once":"travis-deploy-once","semantic-release":"semantic-release",lint:"eslint src","lint-and-build":"yarn lint && yarn build",commit:"npx git-cz"},files:["dist","src"],devDependencies:{autoprefixer:"^9.0.0",chai:"3.5.0",cypress:"^9.2.0","cz-conventional-changelog":"^2.1.0",deepmerge:"^2.0.1",eslint:"^5.0.1","eslint-config-airbnb":"^16.1.0","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-import":"^2.11.0","http-server":"^0.11.1",mocha:"3.3.0","postcss-custom-properties":"^7.0.0","postcss-nested":"^3.0.0",rollup:"^0.59.4","rollup-plugin-commonjs":"^8.3.0","rollup-plugin-eslint":"^4.0.0","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.3","rollup-plugin-postcss":"^1.2.8","rollup-plugin-uglify-es":"^0.0.1","semantic-release":"^25.0.3","start-server-and-test":"^1.4.1","travis-deploy-once":"^5.0.1"},repository:{type:"git",url:"https://github.com/amonak/melondtable.git"},keywords:["datatable","data","grid","table"],author:"Alphamonak Solutions",license:"MIT",bugs:{url:"https://github.com/amonak/datatable/issues"},homepage:"https://devel.monakerp.com/datatable",dependencies:{hyperlist:"^1.0.0-beta",lodash:"^4.17.5",sortablejs:"^1.7.0"},config:{commitizen:{path:"cz-conventional-changelog"}}};return Xn.__version__=Gn.version,Xn}(Sortable);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melondtable",
3
- "version": "1.20.7",
3
+ "version": "1.21.2",
4
4
  "description": "A modern datatable library for the web",
5
5
  "main": "dist/melondtable.cjs.js",
6
6
  "unpkg": "dist/melondtable.min.js",
@@ -165,12 +165,6 @@ export default class ColumnManager {
165
165
  document.body.classList.remove('dt-resize');
166
166
  if (!$resizingCell) return;
167
167
  isDragging = false;
168
-
169
- const {
170
- colIndex
171
- } = $.data($resizingCell);
172
- this.setColumnWidth(colIndex);
173
- this.style.setBodyStyle();
174
168
  $resizingCell = null;
175
169
  };
176
170
  $.on(document.body, 'mouseup', onMouseup);
@@ -198,6 +192,9 @@ export default class ColumnManager {
198
192
  width: finalWidth
199
193
  });
200
194
  this.setColumnHeaderWidth(colIndex);
195
+ this.setColumnWidth(colIndex);
196
+ this.style.refreshStickyColumns();
197
+ this.style.setBodyStyle();
201
198
  };
202
199
  $.on(document.body, 'mousemove', onMouseMove);
203
200
  this.instance.on('onDestroy', () => {
@@ -234,6 +231,7 @@ export default class ColumnManager {
234
231
  this.datamanager.updateColumn(colIndex, { width });
235
232
  this.setColumnHeaderWidth(colIndex);
236
233
  this.setColumnWidth(colIndex);
234
+ this.style.refreshStickyColumns();
237
235
  });
238
236
  }
239
237
 
@@ -283,14 +283,18 @@ export default class DataManager {
283
283
  }
284
284
  }
285
285
 
286
+ const sortValue = cell => {
287
+ const hook = cell.column && cell.column.sortValue;
288
+ const value = hook ? hook(cell) : cell.content;
289
+ return value == null ? '' : value;
290
+ };
291
+
286
292
  this.rowViewOrder.sort((a, b) => {
287
293
  const aIndex = a;
288
294
  const bIndex = b;
289
295
 
290
- let aContent = this.getCell(colIndex, a).content;
291
- let bContent = this.getCell(colIndex, b).content;
292
- aContent = aContent == null ? '' : aContent;
293
- bContent = bContent == null ? '' : bContent;
296
+ const aContent = sortValue(this.getCell(colIndex, a));
297
+ const bContent = sortValue(this.getCell(colIndex, b));
294
298
 
295
299
  if (sortOrder === 'none') {
296
300
  return aIndex - bIndex;
package/src/style.js CHANGED
@@ -156,8 +156,7 @@ export default class Style {
156
156
  this.setupColumnWidth();
157
157
  this.distributeRemainingWidth();
158
158
  this.setColumnStyle();
159
- this.setStickyColumnStyle();
160
- this.updateStickyTopPositions(this.bodyScrollable.scrollLeft || 0);
159
+ this.refreshStickyColumns();
161
160
  this.setBodyStyle();
162
161
  }
163
162
 
@@ -315,6 +314,10 @@ export default class Style {
315
314
  this.columnmanager.setColumnHeaderWidth(column.colIndex);
316
315
  this.columnmanager.setColumnWidth(column.colIndex);
317
316
  });
317
+ this.refreshStickyColumns();
318
+ }
319
+
320
+ refreshStickyColumns() {
318
321
  this.setStickyColumnStyle();
319
322
  this.updateStickyTopPositions(this.bodyScrollable.scrollLeft || 0);
320
323
  }
@@ -381,11 +384,14 @@ export default class Style {
381
384
  setStickyColumnStyle() {
382
385
  if (!this.datamanager || !this.datamanager.getColumns) return;
383
386
 
387
+ const columns = this.datamanager.getColumns();
388
+ if (!columns.some(column => column.sticky) && !(this._stickySelectors || []).length) return;
389
+
384
390
  const stickySelectors = [];
385
391
  let stickyOffset = 0;
386
392
  let normalOffset = 0;
387
393
 
388
- this.datamanager.getColumns().forEach((column) => {
394
+ columns.forEach((column) => {
389
395
  const $headerCell = this.getColumnHeaderElement(column.colIndex);
390
396
  const renderedWidth = $headerCell ? $headerCell.offsetWidth : column.width;
391
397
 
@@ -0,0 +1,17 @@
1
+ {
2
+ "Sort Ascending": "Aufsteigend sortieren",
3
+ "Sort Descending": "Absteigend sortieren",
4
+ "Reset sorting": "Sortierung zurücksetzen",
5
+ "Remove column": "Spalte entfernen",
6
+ "Freeze": "Bevriezen",
7
+ "Unfreeze": "Ontdooien",
8
+ "No Data": "Keine Daten",
9
+ "{count} cells copied": {
10
+ "1": "{count} Zelle kopiert",
11
+ "default": "{count} Zellen kopiert"
12
+ },
13
+ "{count} rows selected": {
14
+ "1": "{count} Zeile ausgewählt",
15
+ "default": "{count} Zeilen ausgewählt"
16
+ }
17
+ }
@@ -1,13 +1,13 @@
1
- import en ptom './en.json';
2
- import fr ptom './fr.json';
3
- import pt ptom './pt.json';
4
- import sw ptom './sw.json';
1
+ import en from './en.json';
2
+ import de from './de.json';
3
+ import fr from './fr.json';
4
+ import it from './it.json';
5
5
 
6
- export frfault function getTranslations() {
6
+ export default function getTranslations() {
7
7
  return {
8
8
  en,
9
+ de,
9
10
  fr,
10
- pt,
11
- sw,
11
+ it,
12
12
  };
13
13
  };
@@ -0,0 +1,17 @@
1
+ {
2
+ "Sort Ascending": "Ordinamento ascendente",
3
+ "Sort Descending": "Ordinamento decrescente",
4
+ "Reset sorting": "Azzeramento ordinamento",
5
+ "Remove column": "Rimuovi colonna",
6
+ "Freeze": "Congelare",
7
+ "Unfreeze": "Dégeler",
8
+ "No Data": "Nessun dato",
9
+ "{count} cells copied": {
10
+ "1": "Copiato {count} cella",
11
+ "default": "{count} celle copiate"
12
+ },
13
+ "{count} rows selected": {
14
+ "1": "{count} linea selezionata",
15
+ "default": "{count} linee selezionate"
16
+ }
17
+ }
@@ -1,16 +0,0 @@
1
- {
2
- "Sort Ascending": "Ordernar Ascendente",
3
- "Sort Descending": "Classificar em Ordem Decrescente",
4
- "Reset sorting": "Redefinir classificação",
5
- "Remove column": "Remover coluna",
6
- "No Data": "Sem Dados",
7
- "{count} cells copied": {
8
- "1": "{count} Célula copiada",
9
- "default": "{count} Células copiadas"
10
- },
11
- "{count} rows selected": {
12
- "1": "{count} linha selecionada",
13
- "default": "{count} linhas selecionadas"
14
- }
15
- }
16
-
@@ -1,16 +0,0 @@
1
- {
2
- "Sort Ascending": "Panga kwa Kupanda",
3
- "Sort Descending": "Panga kwa Kushuka",
4
- "Reset sorting": "Weka upya kupanga",
5
- "Remove column": "Ondoa safu",
6
- "No Data": "Hakuna Data",
7
- "{count} cells copied": {
8
- "1": "{count} kisanduku kimenakiliwa",
9
- "default": "{count} seli zimenakiliwa"
10
- },
11
- "{count} rows selected": {
12
- "1": "{count} safu iliyochaguliwa",
13
- "default": "{count} safu zilizochaguliwa"
14
- }
15
- }
16
-