melondtable 1.17.16 → 1.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/melondtable.cjs.js +58 -13
- package/dist/melondtable.css +10 -0
- package/dist/melondtable.js +117 -58
- package/dist/melondtable.min.css +1 -1
- package/dist/melondtable.min.js +1 -1
- package/package.json +5 -2
- package/src/body-renderer.js +19 -2
- package/src/cellmanager.js +22 -5
- package/src/datamanager.js +11 -6
- package/src/style.css +8 -0
- package/src/style.js +6 -0
- package/src/translations/de.json +15 -0
- package/src/translations/index.js +7 -7
- package/src/translations/it.json +15 -0
- package/src/translations/pt.json +0 -15
- package/src/translations/sw.json +0 -15
package/dist/melondtable.cjs.js
CHANGED
|
@@ -2128,14 +2128,19 @@ class DataManager {
|
|
|
2128
2128
|
}
|
|
2129
2129
|
|
|
2130
2130
|
prepareRow(row, meta) {
|
|
2131
|
-
const baseRowCell = {
|
|
2132
|
-
rowIndex: meta.rowIndex,
|
|
2133
|
-
indent: meta.indent
|
|
2134
|
-
};
|
|
2135
|
-
|
|
2136
2131
|
row = row
|
|
2137
2132
|
.map((cell, i) => this.prepareCell(cell, i))
|
|
2138
|
-
.map(cell =>
|
|
2133
|
+
.map(cell => {
|
|
2134
|
+
// Following code is equivalent but avoids memory allocation and copying.
|
|
2135
|
+
// return Object.assign({rowIndex: meta.rowIndex, indent: meta.indent}, cell)
|
|
2136
|
+
if (cell.rowIndex == null) {
|
|
2137
|
+
cell.rowIndex = meta.rowIndex;
|
|
2138
|
+
}
|
|
2139
|
+
if (cell.indent == null) {
|
|
2140
|
+
cell.indent = meta.indent;
|
|
2141
|
+
}
|
|
2142
|
+
return cell;
|
|
2143
|
+
});
|
|
2139
2144
|
|
|
2140
2145
|
// monkey patched in array object
|
|
2141
2146
|
row.meta = meta;
|
|
@@ -2566,7 +2571,8 @@ class CellManager {
|
|
|
2566
2571
|
'columnmanager',
|
|
2567
2572
|
'rowmanager',
|
|
2568
2573
|
'datamanager',
|
|
2569
|
-
'keyboard'
|
|
2574
|
+
'keyboard',
|
|
2575
|
+
'footer'
|
|
2570
2576
|
]);
|
|
2571
2577
|
|
|
2572
2578
|
this.bindEvents();
|
|
@@ -2718,6 +2724,14 @@ class CellManager {
|
|
|
2718
2724
|
mouseDown = false;
|
|
2719
2725
|
});
|
|
2720
2726
|
|
|
2727
|
+
if (this.options.showTotalRow) {
|
|
2728
|
+
$.on(this.footer, 'click', '.dt-cell', (e) => {
|
|
2729
|
+
|
|
2730
|
+
this.focusCell($(e.delegatedTarget));
|
|
2731
|
+
});
|
|
2732
|
+
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2721
2735
|
const selectArea = (e) => {
|
|
2722
2736
|
if (!mouseDown) return;
|
|
2723
2737
|
this.selectArea($(e.delegatedTarget));
|
|
@@ -3098,10 +3112,18 @@ class CellManager {
|
|
|
3098
3112
|
// copy only focusedCell
|
|
3099
3113
|
const {
|
|
3100
3114
|
colIndex,
|
|
3101
|
-
rowIndex
|
|
3115
|
+
rowIndex,
|
|
3116
|
+
isTotalRow
|
|
3102
3117
|
} = $.data($cell1);
|
|
3103
|
-
|
|
3104
|
-
|
|
3118
|
+
let copiedContent = '';
|
|
3119
|
+
if (isTotalRow) {
|
|
3120
|
+
let choosenFooterCell = this.$focusedCell;
|
|
3121
|
+
copiedContent = choosenFooterCell.children[0].title;
|
|
3122
|
+
} else {
|
|
3123
|
+
const cell = this.getCell(colIndex, rowIndex);
|
|
3124
|
+
copiedContent = cell.content;
|
|
3125
|
+
}
|
|
3126
|
+
copyTextToClipboard(copiedContent);
|
|
3105
3127
|
return 1;
|
|
3106
3128
|
}
|
|
3107
3129
|
const cells = this.getCellsInRange($cell1, $cell2);
|
|
@@ -3300,7 +3322,7 @@ class CellManager {
|
|
|
3300
3322
|
}
|
|
3301
3323
|
|
|
3302
3324
|
scrollToCell($cell) {
|
|
3303
|
-
if ($.inViewport($cell, this.bodyScrollable)) return false;
|
|
3325
|
+
if ($.inViewport($cell, this.bodyScrollable) || $.inViewport($cell, this.footer)) return false;
|
|
3304
3326
|
|
|
3305
3327
|
const {
|
|
3306
3328
|
rowIndex
|
|
@@ -4717,9 +4739,11 @@ class BodyRenderer {
|
|
|
4717
4739
|
renderRows(rows) {
|
|
4718
4740
|
this.visibleRows = rows;
|
|
4719
4741
|
this.visibleRowIndices = rows.map(row => row.meta.rowIndex);
|
|
4720
|
-
|
|
4742
|
+
this.instance.noData = false;
|
|
4721
4743
|
if (rows.length === 0) {
|
|
4722
4744
|
this.bodyScrollable.innerHTML = this.getNoDataHTML();
|
|
4745
|
+
this.instance.noData = true;
|
|
4746
|
+
this.footer.innerHTML = '';
|
|
4723
4747
|
return;
|
|
4724
4748
|
}
|
|
4725
4749
|
|
|
@@ -4841,7 +4865,22 @@ class BodyRenderer {
|
|
|
4841
4865
|
}
|
|
4842
4866
|
|
|
4843
4867
|
getNoDataHTML() {
|
|
4844
|
-
|
|
4868
|
+
const style = window.getComputedStyle(this.instance.header);
|
|
4869
|
+
const matrix = new DOMMatrixReadOnly(style.transform);
|
|
4870
|
+
const width = (-matrix.m41) + this.instance.header.clientWidth;
|
|
4871
|
+
console.log(width);
|
|
4872
|
+
const height = this.bodyScrollable.clientHeight;
|
|
4873
|
+
console.log(width);
|
|
4874
|
+
return `
|
|
4875
|
+
<div
|
|
4876
|
+
class="dt-scrollable__no-data"
|
|
4877
|
+
style="width: ${width}px; height: ${height}px"
|
|
4878
|
+
>
|
|
4879
|
+
<div class="dt-scrollable__no-data no-data-message">
|
|
4880
|
+
${this.options.noDataMessage}
|
|
4881
|
+
</div>
|
|
4882
|
+
</div>
|
|
4883
|
+
`;
|
|
4845
4884
|
}
|
|
4846
4885
|
|
|
4847
4886
|
getToastMessageHTML(message) {
|
|
@@ -4901,6 +4940,12 @@ class Style {
|
|
|
4901
4940
|
transform: `translateX(${left}px)`
|
|
4902
4941
|
});
|
|
4903
4942
|
this._settingHeaderPosition = false;
|
|
4943
|
+
if (this.instance.noData) {
|
|
4944
|
+
$.style($('.no-data-message'), {
|
|
4945
|
+
left: `${this.instance.wrapper.clientWidth / 2 - (left)}px`
|
|
4946
|
+
});
|
|
4947
|
+
}
|
|
4948
|
+
this._settingHeaderPosition = false;
|
|
4904
4949
|
});
|
|
4905
4950
|
});
|
|
4906
4951
|
}
|
package/dist/melondtable.css
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
--dt-toast-message-border: none;
|
|
19
19
|
--dt-header-cell-bg: #fff;
|
|
20
20
|
--dt-header-cell-bg: var(--dt-cell-bg);
|
|
21
|
+
--dt-no-data-message-width: 90px;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
.datatable *, .datatable *::after, .datatable *::before {
|
|
@@ -51,6 +52,15 @@
|
|
|
51
52
|
border-right: 1px solid var(--dt-border-color);
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
.dt-scrollable__no-data .no-data-message{
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 100px;
|
|
58
|
+
left: 50px;
|
|
59
|
+
border: none;
|
|
60
|
+
width: 90px;
|
|
61
|
+
width: var(--dt-no-data-message-width);
|
|
62
|
+
}
|
|
63
|
+
|
|
54
64
|
.dt-row {
|
|
55
65
|
display: flex;
|
|
56
66
|
}
|
package/dist/melondtable.js
CHANGED
|
@@ -417,6 +417,11 @@ var DataTable = (function (Sortable) {
|
|
|
417
417
|
|
|
418
418
|
var _baseGetTag = baseGetTag;
|
|
419
419
|
|
|
420
|
+
var _baseGetTag$1 = /*#__PURE__*/Object.freeze({
|
|
421
|
+
default: _baseGetTag,
|
|
422
|
+
__moduleExports: _baseGetTag
|
|
423
|
+
});
|
|
424
|
+
|
|
420
425
|
/**
|
|
421
426
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
422
427
|
* and has a `typeof` result of "object".
|
|
@@ -447,6 +452,8 @@ var DataTable = (function (Sortable) {
|
|
|
447
452
|
|
|
448
453
|
var isObjectLike_1 = isObjectLike;
|
|
449
454
|
|
|
455
|
+
var baseGetTag$1 = ( _baseGetTag$1 && _baseGetTag ) || _baseGetTag$1;
|
|
456
|
+
|
|
450
457
|
/** `Object#toString` result references. */
|
|
451
458
|
var symbolTag = '[object Symbol]';
|
|
452
459
|
|
|
@@ -469,18 +476,11 @@ var DataTable = (function (Sortable) {
|
|
|
469
476
|
*/
|
|
470
477
|
function isSymbol(value) {
|
|
471
478
|
return typeof value == 'symbol' ||
|
|
472
|
-
(isObjectLike_1(value) &&
|
|
479
|
+
(isObjectLike_1(value) && baseGetTag$1(value) == symbolTag);
|
|
473
480
|
}
|
|
474
481
|
|
|
475
482
|
var isSymbol_1 = isSymbol;
|
|
476
483
|
|
|
477
|
-
var isSymbol$1 = /*#__PURE__*/Object.freeze({
|
|
478
|
-
default: isSymbol_1,
|
|
479
|
-
__moduleExports: isSymbol_1
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
var isSymbol$2 = ( isSymbol$1 && isSymbol_1 ) || isSymbol$1;
|
|
483
|
-
|
|
484
484
|
/** Used as references for various `Number` constants. */
|
|
485
485
|
var NAN = 0 / 0;
|
|
486
486
|
|
|
@@ -526,7 +526,7 @@ var DataTable = (function (Sortable) {
|
|
|
526
526
|
if (typeof value == 'number') {
|
|
527
527
|
return value;
|
|
528
528
|
}
|
|
529
|
-
if (
|
|
529
|
+
if (isSymbol_1(value)) {
|
|
530
530
|
return NAN;
|
|
531
531
|
}
|
|
532
532
|
if (isObject_1(value)) {
|
|
@@ -828,7 +828,7 @@ var DataTable = (function (Sortable) {
|
|
|
828
828
|
}
|
|
829
829
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
830
830
|
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
831
|
-
var tag =
|
|
831
|
+
var tag = baseGetTag$1(value);
|
|
832
832
|
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
833
833
|
}
|
|
834
834
|
|
|
@@ -839,9 +839,16 @@ var DataTable = (function (Sortable) {
|
|
|
839
839
|
|
|
840
840
|
var _coreJsData = coreJsData;
|
|
841
841
|
|
|
842
|
+
var _coreJsData$1 = /*#__PURE__*/Object.freeze({
|
|
843
|
+
default: _coreJsData,
|
|
844
|
+
__moduleExports: _coreJsData
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
var coreJsData$1 = ( _coreJsData$1 && _coreJsData ) || _coreJsData$1;
|
|
848
|
+
|
|
842
849
|
/** Used to detect methods masquerading as native. */
|
|
843
850
|
var maskSrcKey = (function() {
|
|
844
|
-
var uid = /[^.]+$/.exec(
|
|
851
|
+
var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || '');
|
|
845
852
|
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
846
853
|
}());
|
|
847
854
|
|
|
@@ -947,8 +954,15 @@ var DataTable = (function (Sortable) {
|
|
|
947
954
|
|
|
948
955
|
var _getValue = getValue;
|
|
949
956
|
|
|
957
|
+
var _getValue$1 = /*#__PURE__*/Object.freeze({
|
|
958
|
+
default: _getValue,
|
|
959
|
+
__moduleExports: _getValue
|
|
960
|
+
});
|
|
961
|
+
|
|
950
962
|
var baseIsNative$1 = ( _baseIsNative$1 && _baseIsNative ) || _baseIsNative$1;
|
|
951
963
|
|
|
964
|
+
var getValue$1 = ( _getValue$1 && _getValue ) || _getValue$1;
|
|
965
|
+
|
|
952
966
|
/**
|
|
953
967
|
* Gets the native function at `key` of `object`.
|
|
954
968
|
*
|
|
@@ -958,7 +972,7 @@ var DataTable = (function (Sortable) {
|
|
|
958
972
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
959
973
|
*/
|
|
960
974
|
function getNative(object, key) {
|
|
961
|
-
var value =
|
|
975
|
+
var value = getValue$1(object, key);
|
|
962
976
|
return baseIsNative$1(value) ? value : undefined;
|
|
963
977
|
}
|
|
964
978
|
|
|
@@ -969,6 +983,13 @@ var DataTable = (function (Sortable) {
|
|
|
969
983
|
|
|
970
984
|
var _nativeCreate = nativeCreate;
|
|
971
985
|
|
|
986
|
+
var _nativeCreate$1 = /*#__PURE__*/Object.freeze({
|
|
987
|
+
default: _nativeCreate,
|
|
988
|
+
__moduleExports: _nativeCreate
|
|
989
|
+
});
|
|
990
|
+
|
|
991
|
+
var nativeCreate$1 = ( _nativeCreate$1 && _nativeCreate ) || _nativeCreate$1;
|
|
992
|
+
|
|
972
993
|
/**
|
|
973
994
|
* Removes all key-value entries from the hash.
|
|
974
995
|
*
|
|
@@ -977,7 +998,7 @@ var DataTable = (function (Sortable) {
|
|
|
977
998
|
* @memberOf Hash
|
|
978
999
|
*/
|
|
979
1000
|
function hashClear() {
|
|
980
|
-
this.__data__ =
|
|
1001
|
+
this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
|
|
981
1002
|
this.size = 0;
|
|
982
1003
|
}
|
|
983
1004
|
|
|
@@ -1021,7 +1042,7 @@ var DataTable = (function (Sortable) {
|
|
|
1021
1042
|
*/
|
|
1022
1043
|
function hashGet(key) {
|
|
1023
1044
|
var data = this.__data__;
|
|
1024
|
-
if (
|
|
1045
|
+
if (nativeCreate$1) {
|
|
1025
1046
|
var result = data[key];
|
|
1026
1047
|
return result === HASH_UNDEFINED ? undefined : result;
|
|
1027
1048
|
}
|
|
@@ -1047,7 +1068,7 @@ var DataTable = (function (Sortable) {
|
|
|
1047
1068
|
*/
|
|
1048
1069
|
function hashHas(key) {
|
|
1049
1070
|
var data = this.__data__;
|
|
1050
|
-
return
|
|
1071
|
+
return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
|
|
1051
1072
|
}
|
|
1052
1073
|
|
|
1053
1074
|
var _hashHas = hashHas;
|
|
@@ -1068,7 +1089,7 @@ var DataTable = (function (Sortable) {
|
|
|
1068
1089
|
function hashSet(key, value) {
|
|
1069
1090
|
var data = this.__data__;
|
|
1070
1091
|
this.size += this.has(key) ? 0 : 1;
|
|
1071
|
-
data[key] = (
|
|
1092
|
+
data[key] = (nativeCreate$1 && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
1072
1093
|
return this;
|
|
1073
1094
|
}
|
|
1074
1095
|
|
|
@@ -1153,13 +1174,6 @@ var DataTable = (function (Sortable) {
|
|
|
1153
1174
|
|
|
1154
1175
|
var eq_1 = eq;
|
|
1155
1176
|
|
|
1156
|
-
var eq$1 = /*#__PURE__*/Object.freeze({
|
|
1157
|
-
default: eq_1,
|
|
1158
|
-
__moduleExports: eq_1
|
|
1159
|
-
});
|
|
1160
|
-
|
|
1161
|
-
var eq$2 = ( eq$1 && eq_1 ) || eq$1;
|
|
1162
|
-
|
|
1163
1177
|
/**
|
|
1164
1178
|
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1165
1179
|
*
|
|
@@ -1171,7 +1185,7 @@ var DataTable = (function (Sortable) {
|
|
|
1171
1185
|
function assocIndexOf(array, key) {
|
|
1172
1186
|
var length = array.length;
|
|
1173
1187
|
while (length--) {
|
|
1174
|
-
if (
|
|
1188
|
+
if (eq_1(array[length][0], key)) {
|
|
1175
1189
|
return length;
|
|
1176
1190
|
}
|
|
1177
1191
|
}
|
|
@@ -1355,13 +1369,6 @@ var DataTable = (function (Sortable) {
|
|
|
1355
1369
|
|
|
1356
1370
|
var _getMapData = getMapData;
|
|
1357
1371
|
|
|
1358
|
-
var _getMapData$1 = /*#__PURE__*/Object.freeze({
|
|
1359
|
-
default: _getMapData,
|
|
1360
|
-
__moduleExports: _getMapData
|
|
1361
|
-
});
|
|
1362
|
-
|
|
1363
|
-
var getMapData$1 = ( _getMapData$1 && _getMapData ) || _getMapData$1;
|
|
1364
|
-
|
|
1365
1372
|
/**
|
|
1366
1373
|
* Removes `key` and its value from the map.
|
|
1367
1374
|
*
|
|
@@ -1372,7 +1379,7 @@ var DataTable = (function (Sortable) {
|
|
|
1372
1379
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1373
1380
|
*/
|
|
1374
1381
|
function mapCacheDelete(key) {
|
|
1375
|
-
var result =
|
|
1382
|
+
var result = _getMapData(this, key)['delete'](key);
|
|
1376
1383
|
this.size -= result ? 1 : 0;
|
|
1377
1384
|
return result;
|
|
1378
1385
|
}
|
|
@@ -1389,7 +1396,7 @@ var DataTable = (function (Sortable) {
|
|
|
1389
1396
|
* @returns {*} Returns the entry value.
|
|
1390
1397
|
*/
|
|
1391
1398
|
function mapCacheGet(key) {
|
|
1392
|
-
return
|
|
1399
|
+
return _getMapData(this, key).get(key);
|
|
1393
1400
|
}
|
|
1394
1401
|
|
|
1395
1402
|
var _mapCacheGet = mapCacheGet;
|
|
@@ -1404,7 +1411,7 @@ var DataTable = (function (Sortable) {
|
|
|
1404
1411
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1405
1412
|
*/
|
|
1406
1413
|
function mapCacheHas(key) {
|
|
1407
|
-
return
|
|
1414
|
+
return _getMapData(this, key).has(key);
|
|
1408
1415
|
}
|
|
1409
1416
|
|
|
1410
1417
|
var _mapCacheHas = mapCacheHas;
|
|
@@ -1420,7 +1427,7 @@ var DataTable = (function (Sortable) {
|
|
|
1420
1427
|
* @returns {Object} Returns the map cache instance.
|
|
1421
1428
|
*/
|
|
1422
1429
|
function mapCacheSet(key, value) {
|
|
1423
|
-
var data =
|
|
1430
|
+
var data = _getMapData(this, key),
|
|
1424
1431
|
size = data.size;
|
|
1425
1432
|
|
|
1426
1433
|
data.set(key, value);
|
|
@@ -1430,6 +1437,13 @@ var DataTable = (function (Sortable) {
|
|
|
1430
1437
|
|
|
1431
1438
|
var _mapCacheSet = mapCacheSet;
|
|
1432
1439
|
|
|
1440
|
+
var _mapCacheSet$1 = /*#__PURE__*/Object.freeze({
|
|
1441
|
+
default: _mapCacheSet,
|
|
1442
|
+
__moduleExports: _mapCacheSet
|
|
1443
|
+
});
|
|
1444
|
+
|
|
1445
|
+
var mapCacheSet$1 = ( _mapCacheSet$1 && _mapCacheSet ) || _mapCacheSet$1;
|
|
1446
|
+
|
|
1433
1447
|
/**
|
|
1434
1448
|
* Creates a map cache object to store key-value pairs.
|
|
1435
1449
|
*
|
|
@@ -1453,7 +1467,7 @@ var DataTable = (function (Sortable) {
|
|
|
1453
1467
|
MapCache.prototype['delete'] = _mapCacheDelete;
|
|
1454
1468
|
MapCache.prototype.get = _mapCacheGet;
|
|
1455
1469
|
MapCache.prototype.has = _mapCacheHas;
|
|
1456
|
-
MapCache.prototype.set =
|
|
1470
|
+
MapCache.prototype.set = mapCacheSet$1;
|
|
1457
1471
|
|
|
1458
1472
|
var _MapCache = MapCache;
|
|
1459
1473
|
|
|
@@ -1595,6 +1609,13 @@ var DataTable = (function (Sortable) {
|
|
|
1595
1609
|
|
|
1596
1610
|
var _baseIndexOf = baseIndexOf;
|
|
1597
1611
|
|
|
1612
|
+
var _baseIndexOf$1 = /*#__PURE__*/Object.freeze({
|
|
1613
|
+
default: _baseIndexOf,
|
|
1614
|
+
__moduleExports: _baseIndexOf
|
|
1615
|
+
});
|
|
1616
|
+
|
|
1617
|
+
var baseIndexOf$1 = ( _baseIndexOf$1 && _baseIndexOf ) || _baseIndexOf$1;
|
|
1618
|
+
|
|
1598
1619
|
/**
|
|
1599
1620
|
* A specialized version of `_.includes` for arrays without support for
|
|
1600
1621
|
* specifying an index to search from.
|
|
@@ -1606,7 +1627,7 @@ var DataTable = (function (Sortable) {
|
|
|
1606
1627
|
*/
|
|
1607
1628
|
function arrayIncludes(array, value) {
|
|
1608
1629
|
var length = array == null ? 0 : array.length;
|
|
1609
|
-
return !!length &&
|
|
1630
|
+
return !!length && baseIndexOf$1(array, value, 0) > -1;
|
|
1610
1631
|
}
|
|
1611
1632
|
|
|
1612
1633
|
var _arrayIncludes = arrayIncludes;
|
|
@@ -1772,13 +1793,6 @@ var DataTable = (function (Sortable) {
|
|
|
1772
1793
|
|
|
1773
1794
|
var _baseUniq = baseUniq;
|
|
1774
1795
|
|
|
1775
|
-
var _baseUniq$1 = /*#__PURE__*/Object.freeze({
|
|
1776
|
-
default: _baseUniq,
|
|
1777
|
-
__moduleExports: _baseUniq
|
|
1778
|
-
});
|
|
1779
|
-
|
|
1780
|
-
var baseUniq$1 = ( _baseUniq$1 && _baseUniq ) || _baseUniq$1;
|
|
1781
|
-
|
|
1782
1796
|
/**
|
|
1783
1797
|
* Creates a duplicate-free version of an array, using
|
|
1784
1798
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
@@ -1798,7 +1812,7 @@ var DataTable = (function (Sortable) {
|
|
|
1798
1812
|
* // => [2, 1]
|
|
1799
1813
|
*/
|
|
1800
1814
|
function uniq(array) {
|
|
1801
|
-
return (array && array.length) ?
|
|
1815
|
+
return (array && array.length) ? _baseUniq(array) : [];
|
|
1802
1816
|
}
|
|
1803
1817
|
|
|
1804
1818
|
var uniq_1 = uniq;
|
|
@@ -2162,14 +2176,19 @@ var DataTable = (function (Sortable) {
|
|
|
2162
2176
|
}
|
|
2163
2177
|
|
|
2164
2178
|
prepareRow(row, meta) {
|
|
2165
|
-
const baseRowCell = {
|
|
2166
|
-
rowIndex: meta.rowIndex,
|
|
2167
|
-
indent: meta.indent
|
|
2168
|
-
};
|
|
2169
|
-
|
|
2170
2179
|
row = row
|
|
2171
2180
|
.map((cell, i) => this.prepareCell(cell, i))
|
|
2172
|
-
.map(cell =>
|
|
2181
|
+
.map(cell => {
|
|
2182
|
+
// Following code is equivalent but avoids memory allocation and copying.
|
|
2183
|
+
// return Object.assign({rowIndex: meta.rowIndex, indent: meta.indent}, cell)
|
|
2184
|
+
if (cell.rowIndex == null) {
|
|
2185
|
+
cell.rowIndex = meta.rowIndex;
|
|
2186
|
+
}
|
|
2187
|
+
if (cell.indent == null) {
|
|
2188
|
+
cell.indent = meta.indent;
|
|
2189
|
+
}
|
|
2190
|
+
return cell;
|
|
2191
|
+
});
|
|
2173
2192
|
|
|
2174
2193
|
// monkey patched in array object
|
|
2175
2194
|
row.meta = meta;
|
|
@@ -2600,7 +2619,8 @@ var DataTable = (function (Sortable) {
|
|
|
2600
2619
|
'columnmanager',
|
|
2601
2620
|
'rowmanager',
|
|
2602
2621
|
'datamanager',
|
|
2603
|
-
'keyboard'
|
|
2622
|
+
'keyboard',
|
|
2623
|
+
'footer'
|
|
2604
2624
|
]);
|
|
2605
2625
|
|
|
2606
2626
|
this.bindEvents();
|
|
@@ -2752,6 +2772,14 @@ var DataTable = (function (Sortable) {
|
|
|
2752
2772
|
mouseDown = false;
|
|
2753
2773
|
});
|
|
2754
2774
|
|
|
2775
|
+
if (this.options.showTotalRow) {
|
|
2776
|
+
$.on(this.footer, 'click', '.dt-cell', (e) => {
|
|
2777
|
+
|
|
2778
|
+
this.focusCell($(e.delegatedTarget));
|
|
2779
|
+
});
|
|
2780
|
+
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2755
2783
|
const selectArea = (e) => {
|
|
2756
2784
|
if (!mouseDown) return;
|
|
2757
2785
|
this.selectArea($(e.delegatedTarget));
|
|
@@ -3132,10 +3160,18 @@ var DataTable = (function (Sortable) {
|
|
|
3132
3160
|
// copy only focusedCell
|
|
3133
3161
|
const {
|
|
3134
3162
|
colIndex,
|
|
3135
|
-
rowIndex
|
|
3163
|
+
rowIndex,
|
|
3164
|
+
isTotalRow
|
|
3136
3165
|
} = $.data($cell1);
|
|
3137
|
-
|
|
3138
|
-
|
|
3166
|
+
let copiedContent = '';
|
|
3167
|
+
if (isTotalRow) {
|
|
3168
|
+
let choosenFooterCell = this.$focusedCell;
|
|
3169
|
+
copiedContent = choosenFooterCell.children[0].title;
|
|
3170
|
+
} else {
|
|
3171
|
+
const cell = this.getCell(colIndex, rowIndex);
|
|
3172
|
+
copiedContent = cell.content;
|
|
3173
|
+
}
|
|
3174
|
+
copyTextToClipboard(copiedContent);
|
|
3139
3175
|
return 1;
|
|
3140
3176
|
}
|
|
3141
3177
|
const cells = this.getCellsInRange($cell1, $cell2);
|
|
@@ -3334,7 +3370,7 @@ var DataTable = (function (Sortable) {
|
|
|
3334
3370
|
}
|
|
3335
3371
|
|
|
3336
3372
|
scrollToCell($cell) {
|
|
3337
|
-
if ($.inViewport($cell, this.bodyScrollable)) return false;
|
|
3373
|
+
if ($.inViewport($cell, this.bodyScrollable) || $.inViewport($cell, this.footer)) return false;
|
|
3338
3374
|
|
|
3339
3375
|
const {
|
|
3340
3376
|
rowIndex
|
|
@@ -4751,9 +4787,11 @@ var DataTable = (function (Sortable) {
|
|
|
4751
4787
|
renderRows(rows) {
|
|
4752
4788
|
this.visibleRows = rows;
|
|
4753
4789
|
this.visibleRowIndices = rows.map(row => row.meta.rowIndex);
|
|
4754
|
-
|
|
4790
|
+
this.instance.noData = false;
|
|
4755
4791
|
if (rows.length === 0) {
|
|
4756
4792
|
this.bodyScrollable.innerHTML = this.getNoDataHTML();
|
|
4793
|
+
this.instance.noData = true;
|
|
4794
|
+
this.footer.innerHTML = '';
|
|
4757
4795
|
return;
|
|
4758
4796
|
}
|
|
4759
4797
|
|
|
@@ -4875,7 +4913,22 @@ var DataTable = (function (Sortable) {
|
|
|
4875
4913
|
}
|
|
4876
4914
|
|
|
4877
4915
|
getNoDataHTML() {
|
|
4878
|
-
|
|
4916
|
+
const style = window.getComputedStyle(this.instance.header);
|
|
4917
|
+
const matrix = new DOMMatrixReadOnly(style.transform);
|
|
4918
|
+
const width = (-matrix.m41) + this.instance.header.clientWidth;
|
|
4919
|
+
console.log(width);
|
|
4920
|
+
const height = this.bodyScrollable.clientHeight;
|
|
4921
|
+
console.log(width);
|
|
4922
|
+
return `
|
|
4923
|
+
<div
|
|
4924
|
+
class="dt-scrollable__no-data"
|
|
4925
|
+
style="width: ${width}px; height: ${height}px"
|
|
4926
|
+
>
|
|
4927
|
+
<div class="dt-scrollable__no-data no-data-message">
|
|
4928
|
+
${this.options.noDataMessage}
|
|
4929
|
+
</div>
|
|
4930
|
+
</div>
|
|
4931
|
+
`;
|
|
4879
4932
|
}
|
|
4880
4933
|
|
|
4881
4934
|
getToastMessageHTML(message) {
|
|
@@ -4935,6 +4988,12 @@ var DataTable = (function (Sortable) {
|
|
|
4935
4988
|
transform: `translateX(${left}px)`
|
|
4936
4989
|
});
|
|
4937
4990
|
this._settingHeaderPosition = false;
|
|
4991
|
+
if (this.instance.noData) {
|
|
4992
|
+
$.style($('.no-data-message'), {
|
|
4993
|
+
left: `${this.instance.wrapper.clientWidth / 2 - (left)}px`
|
|
4994
|
+
});
|
|
4995
|
+
}
|
|
4996
|
+
this._settingHeaderPosition = false;
|
|
4938
4997
|
});
|
|
4939
4998
|
});
|
|
4940
4999
|
}
|
package/dist/melondtable.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--dt-border-color:#d1d8dd;--dt-primary-color:#5292f7;--dt-light-bg:#f5f7fa;--dt-light-red:#fd8b8b;--dt-light-yellow:#fffce7;--dt-orange:#ffa00a;--dt-text-color:#000;--dt-text-light:#dfe2e5;--dt-spacer-1:0.25rem;--dt-spacer-2:0.5rem;--dt-spacer-3:1rem;--dt-border-radius:3px;--dt-cell-bg:#fff;--dt-focus-border-width:2px;--dt-selection-highlight-color:#fffce7;--dt-selection-highlight-color:var(--dt-light-yellow);--dt-toast-message-border:none;--dt-header-cell-bg:#fff;--dt-header-cell-bg:var(--dt-cell-bg)}.datatable *,.datatable :after,.datatable :before{box-sizing:border-box}.datatable{position:relative;overflow:hidden}.dt-scrollable{height:40vw;overflow:auto;border-top:2px solid #d1d8dd;border-top:2px solid var(--dt-border-color)}.dt-scrollable--highlight-all{background-color:#fffce7;background-color:var(--dt-selection-highlight-color)}.dt-scrollable__no-data{text-align:center;padding:1rem;padding:var(--dt-spacer-3);border-left:1px solid #d1d8dd;border-left:1px solid var(--dt-border-color);border-right:1px solid #d1d8dd;border-right:1px solid var(--dt-border-color)}.dt-row{display:flex}.dt-row--highlight .dt-cell{background-color:#fffce7;background-color:var(--dt-selection-highlight-color)}.dt-row--unhighlight .dt-cell{background-color:#fff;background-color:var(--dt-cell-bg)}.dt-row--hide{display:none}.dt-row:last-child:not(.dt-row-filter){border-bottom:1px solid #d1d8dd;border-bottom:1px solid var(--dt-border-color)}.dt-cell{border:1px solid #d1d8dd;border:1px solid var(--dt-border-color);border-bottom:none;border-right:none;position:relative;outline:none;padding:0;background-color:#fff;background-color:var(--dt-cell-bg);color:#000;color:var(--dt-text-color);background-clip:padding-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.dt-cell__content{border:2px solid transparent;border:var(--dt-focus-border-width) solid transparent;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.dt-cell__content,.dt-cell__edit{padding:.5rem;padding:var(--dt-spacer-2);height:100%}.dt-cell__edit{display:none;background-color:#fff;background-color:var(--dt-cell-bg);border:2px solid #ffa00a;border:var(--dt-focus-border-width) solid var(--dt-orange);z-index:1}.dt-cell__resize-handle{opacity:0;position:absolute;right:-3px;top:0;width:5px;height:100%;cursor:col-resize;z-index:1}.dt-cell--editing .dt-cell__content{display:none}.dt-cell--editing .dt-cell__edit{display:block}.dt-cell--focus .dt-cell__content{border-color:#5292f7;border-color:var(--dt-primary-color)}.dt-cell--dragging,.dt-cell--highlight{background-color:#f5f7fa;background-color:var(--dt-light-bg)}.dt-cell--header{background-color:#fff;background-color:var(--dt-header-cell-bg)}.dt-cell--header:last-child{border-right:1px solid #d1d8dd;border-right:1px solid var(--dt-border-color)}.dt-cell--header .dt-cell__content{padding-right:1rem;padding-right:var(--dt-spacer-3);font-weight:700}.dt-cell--header:hover .dt-dropdown__toggle{opacity:1}.dt-cell--tree-close .icon-open{display:none}.dt-cell--tree-close .icon-close{display:flex}.dt-cell:last-child{border-right:1px solid #d1d8dd;border-right:1px solid var(--dt-border-color)}.datatable[dir=rtl] .dt-cell__resize-handle{right:unset;left:-3px}.icon-close,.icon-open{width:16px;height:16px}.icon-open{display:flex}.icon-close{display:none}.dt-dropdown{position:absolute;right:10px;display:inline-flex;vertical-align:top;text-align:left;font-weight:400;cursor:pointer}.dt-dropdown__toggle{opacity:0;background-color:#fff;background-color:var(--dt-header-cell-bg)}.dt-dropdown__list{position:fixed;min-width:8rem;z-index:1;cursor:pointer;background-color:#fff;background-color:var(--dt-cell-bg);border-radius:3px;border-radius:var(--dt-border-radius);padding:.5rem 0;padding:var(--dt-spacer-2) 0;box-shadow:0 2px 3px hsla(0,0%,4%,.1),0 0 0 1px hsla(0,0%,4%,.1)}.dt-dropdown__list-item{padding:.5rem 1rem;padding:var(--dt-spacer-2) var(--dt-spacer-3)}.dt-dropdown__list-item:hover{background-color:#f5f7fa;background-color:var(--dt-light-bg)}.dt-dropdown--active .dt-dropdown__list{display:block}.dt-tree-node{display:flex;align-items:center;position:relative}.dt-tree-node__toggle{display:inline-block;cursor:pointer;margin-right:.2rem}.dt-toast{position:absolute;bottom:1rem;bottom:var(--dt-spacer-3);left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.dt-toast__message{display:inline-block;background-color:rgba(0,0,0,.8);color:#dfe2e5;color:var(--dt-text-light);border-radius:3px;border-radius:var(--dt-border-radius);padding:.5rem 1rem;padding:var(--dt-spacer-2) var(--dt-spacer-3);border:none;border:var(--dt-toast-message-border)}.dt-input{outline:none;width:100%;border:none;overflow:visible;font-family:inherit;font-size:inherit;line-height:inherit;background-color:inherit;color:inherit;margin:0;padding:0}.dt-freeze{display:flex;justify-content:center;align-content:center;position:absolute;left:0;right:0;top:0;bottom:0;background-color:#f5f7fa;background-color:var(--dt-light-bg);opacity:.5;font-size:2em}.dt-freeze__message{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.dt-paste-target{position:fixed;left:-999em}body.dt-resize{cursor:col-resize}
|
|
1
|
+
:root{--dt-border-color:#d1d8dd;--dt-primary-color:#5292f7;--dt-light-bg:#f5f7fa;--dt-light-red:#fd8b8b;--dt-light-yellow:#fffce7;--dt-orange:#ffa00a;--dt-text-color:#000;--dt-text-light:#dfe2e5;--dt-spacer-1:0.25rem;--dt-spacer-2:0.5rem;--dt-spacer-3:1rem;--dt-border-radius:3px;--dt-cell-bg:#fff;--dt-focus-border-width:2px;--dt-selection-highlight-color:#fffce7;--dt-selection-highlight-color:var(--dt-light-yellow);--dt-toast-message-border:none;--dt-header-cell-bg:#fff;--dt-header-cell-bg:var(--dt-cell-bg);--dt-no-data-message-width:90px}.datatable *,.datatable :after,.datatable :before{box-sizing:border-box}.datatable{position:relative;overflow:hidden}.dt-scrollable{height:40vw;overflow:auto;border-top:2px solid #d1d8dd;border-top:2px solid var(--dt-border-color)}.dt-scrollable--highlight-all{background-color:#fffce7;background-color:var(--dt-selection-highlight-color)}.dt-scrollable__no-data{text-align:center;padding:1rem;padding:var(--dt-spacer-3);border-left:1px solid #d1d8dd;border-left:1px solid var(--dt-border-color);border-right:1px solid #d1d8dd;border-right:1px solid var(--dt-border-color)}.dt-scrollable__no-data .no-data-message{position:absolute;top:100px;left:50px;border:none;width:90px;width:var(--dt-no-data-message-width)}.dt-row{display:flex}.dt-row--highlight .dt-cell{background-color:#fffce7;background-color:var(--dt-selection-highlight-color)}.dt-row--unhighlight .dt-cell{background-color:#fff;background-color:var(--dt-cell-bg)}.dt-row--hide{display:none}.dt-row:last-child:not(.dt-row-filter){border-bottom:1px solid #d1d8dd;border-bottom:1px solid var(--dt-border-color)}.dt-cell{border:1px solid #d1d8dd;border:1px solid var(--dt-border-color);border-bottom:none;border-right:none;position:relative;outline:none;padding:0;background-color:#fff;background-color:var(--dt-cell-bg);color:#000;color:var(--dt-text-color);background-clip:padding-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.dt-cell__content{border:2px solid transparent;border:var(--dt-focus-border-width) solid transparent;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.dt-cell__content,.dt-cell__edit{padding:.5rem;padding:var(--dt-spacer-2);height:100%}.dt-cell__edit{display:none;background-color:#fff;background-color:var(--dt-cell-bg);border:2px solid #ffa00a;border:var(--dt-focus-border-width) solid var(--dt-orange);z-index:1}.dt-cell__resize-handle{opacity:0;position:absolute;right:-3px;top:0;width:5px;height:100%;cursor:col-resize;z-index:1}.dt-cell--editing .dt-cell__content{display:none}.dt-cell--editing .dt-cell__edit{display:block}.dt-cell--focus .dt-cell__content{border-color:#5292f7;border-color:var(--dt-primary-color)}.dt-cell--dragging,.dt-cell--highlight{background-color:#f5f7fa;background-color:var(--dt-light-bg)}.dt-cell--header{background-color:#fff;background-color:var(--dt-header-cell-bg)}.dt-cell--header:last-child{border-right:1px solid #d1d8dd;border-right:1px solid var(--dt-border-color)}.dt-cell--header .dt-cell__content{padding-right:1rem;padding-right:var(--dt-spacer-3);font-weight:700}.dt-cell--header:hover .dt-dropdown__toggle{opacity:1}.dt-cell--tree-close .icon-open{display:none}.dt-cell--tree-close .icon-close{display:flex}.dt-cell:last-child{border-right:1px solid #d1d8dd;border-right:1px solid var(--dt-border-color)}.datatable[dir=rtl] .dt-cell__resize-handle{right:unset;left:-3px}.icon-close,.icon-open{width:16px;height:16px}.icon-open{display:flex}.icon-close{display:none}.dt-dropdown{position:absolute;right:10px;display:inline-flex;vertical-align:top;text-align:left;font-weight:400;cursor:pointer}.dt-dropdown__toggle{opacity:0;background-color:#fff;background-color:var(--dt-header-cell-bg)}.dt-dropdown__list{position:fixed;min-width:8rem;z-index:1;cursor:pointer;background-color:#fff;background-color:var(--dt-cell-bg);border-radius:3px;border-radius:var(--dt-border-radius);padding:.5rem 0;padding:var(--dt-spacer-2) 0;box-shadow:0 2px 3px hsla(0,0%,4%,.1),0 0 0 1px hsla(0,0%,4%,.1)}.dt-dropdown__list-item{padding:.5rem 1rem;padding:var(--dt-spacer-2) var(--dt-spacer-3)}.dt-dropdown__list-item:hover{background-color:#f5f7fa;background-color:var(--dt-light-bg)}.dt-dropdown--active .dt-dropdown__list{display:block}.dt-tree-node{display:flex;align-items:center;position:relative}.dt-tree-node__toggle{display:inline-block;cursor:pointer;margin-right:.2rem}.dt-toast{position:absolute;bottom:1rem;bottom:var(--dt-spacer-3);left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.dt-toast__message{display:inline-block;background-color:rgba(0,0,0,.8);color:#dfe2e5;color:var(--dt-text-light);border-radius:3px;border-radius:var(--dt-border-radius);padding:.5rem 1rem;padding:var(--dt-spacer-2) var(--dt-spacer-3);border:none;border:var(--dt-toast-message-border)}.dt-input{outline:none;width:100%;border:none;overflow:visible;font-family:inherit;font-size:inherit;line-height:inherit;background-color:inherit;color:inherit;margin:0;padding:0}.dt-freeze{display:flex;justify-content:center;align-content:center;position:absolute;left:0;right:0;top:0;bottom:0;background-color:#f5f7fa;background-color:var(--dt-light-bg);opacity:.5;font-size:2em}.dt-freeze__message{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.dt-paste-target{position:fixed;left:-999em}body.dt-resize{cursor:col-resize}
|
package/dist/melondtable.min.js
CHANGED
|
@@ -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=Mt.call(t,$t),n=t[$t];try{t[$t]=void 0}catch(t){}var i=Lt.call(t);return e?t[$t]=n:delete t[$t],i}function r(t){return jt.call(t)}function l(t){return null==t?void 0===t?Wt:zt:Nt&&Nt in Object(t)?Ot(t):Dt(t)}function a(t){return null!=t&&"object"==typeof t}function c(t){return"symbol"==typeof t||Bt(t)&&Pt(t)==Vt}function u(t){if("number"==typeof t)return t;if(Ut(t))return Zt;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(Xt,"");var n=Yt.test(t);return n||Jt.test(t)?Qt(t.slice(2),n?2:8):Gt.test(t)?Zt:+t}function h(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?ie(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=Ht();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 u(){return void 0===g?p:a(Ht())}function h(){var t=Ht(),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(ee);return e=te(e)||0,vt(n)&&(b=!!n.leading,m=(C="maxWait"in n)?ne(te(n.maxWait)||0,e):m,v="trailing"in n?!!n.trailing:v),h.cancel=c,h.flush=u,h}function d(t,e,n){var i=!0,o=!0;if("function"!=typeof t)throw new TypeError(se);return vt(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),oe(t,e,{leading:i,maxWait:e,trailing:o})}function f(t){if(!vt(t))return!1;var e=Pt(t);return e==ae||e==ce||e==le||e==ue}function m(t){return!!fe&&fe in t}function p(t){if(null!=t){try{return pe.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function g(t){return!(!vt(t)||me(t))&&(he(t)?_e:we).test(ge(t))}function w(t,e){return null==t?void 0:t[e]}function y(t,e){var n=Re(t,e);return xe(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===Ee?void 0:n}return ke.call(e,t)?e[t]:void 0}function _(t){var e=this.__data__;return Se?void 0!==e[t]:Le.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?Oe:e,this}function R(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 S(t,e){return t===e||t!==t&&e!==e}function T(t,e){for(var n=t.length;n--;)if(De(t[n][0],e))return n;return-1}function H(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 k(t){return Ne(this.__data__,t)>-1}function M(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 $(){this.size=0,this.__data__={hash:new Fe,map:new(Ze||Ue),string:new Fe}}function O(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function j(t,e){var n=t.__data__;return Ge(e)?n["string"==typeof e?"string":"hash"]:n.map}function F(t){var e=Qe(this,t).delete(t);return this.size-=e?1:0,e}function A(t){return Qe(this,t).get(t)}function D(t){return Qe(this,t).has(t)}function z(t,e){var n=Qe(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,rn),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 sn;++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?dn(t,e,n):un(t,hn,n)}function Z(t,e){return!!(null==t?0:t.length)&&fn(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 Y(){}function J(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=mn,s=t.length,r=!0,l=[],a=l;if(n)r=!1,o=pn;else if(s>=vn){var c=e?null:Cn(t);if(c)return bn(c);r=!1,o=gn,a=new cn}else a=e?[]:l;t:for(;++i<s;){var u=t[i],h=e?e(u):u;if(u=n||0!==u?u:0,r&&h===h){for(var d=a.length;d--;)if(a[d]===h)continue t;e&&a.push(h),l.push(u)}else o(a,h,n)||(a!==l&&a.push(h),l.push(u))}return l}function tt(t){return t&&t.length?_n(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 ut(t){return Array.isArray(t)?t:[t]}function ht(t){return xn(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={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(t).replace(/[&<>"'`=/]/g,t=>e[t]||t)}function gt(){return{en:An,de:Dn,fr:zn,it:Wn}}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=En.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:Hn.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)}}],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,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,Rt=Object.freeze({default:xt,__moduleExports:xt}),It=Rt&&xt||Rt,St="object"==typeof self&&self&&self.Object===Object&&self,Tt=It||St||Function("return this")(),Ht=function(){return Tt.Date.now()},Et=Tt.Symbol,kt=Object.prototype,Mt=kt.hasOwnProperty,Lt=kt.toString,$t=Et?Et.toStringTag:void 0,Ot=s,jt=Object.prototype.toString,Ft=r,At=Object.freeze({default:Ft,__moduleExports:Ft}),Dt=At&&Ft||At,zt="[object Null]",Wt="[object Undefined]",Nt=Et?Et.toStringTag:void 0,Pt=l,Bt=a,Vt="[object Symbol]",qt=c,Kt=Object.freeze({default:qt,__moduleExports:qt}),Ut=Kt&&qt||Kt,Zt=NaN,Xt=/^\s+|\s+$/g,Gt=/^[-+]0x[0-9a-f]+$/i,Yt=/^0b[01]+$/i,Jt=/^0o[0-7]+$/i,Qt=parseInt,te=u,ee="Expected a function",ne=Math.max,ie=Math.min,oe=h,se="Expected a function",re=d,le="[object AsyncFunction]",ae="[object Function]",ce="[object GeneratorFunction]",ue="[object Proxy]",he=f,de=Tt["__core-js_shared__"],fe=function(){var t=/[^.]+$/.exec(de&&de.keys&&de.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),me=m,pe=Function.prototype.toString,ge=p,we=/^\[object .+?Constructor\]$/,ye=Function.prototype,be=Object.prototype,Ce=ye.toString,ve=be.hasOwnProperty,_e=RegExp("^"+Ce.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=g,Re=w,Ie=y,Se=Ie(Object,"create"),Te=b,He=C,Ee="__lodash_hash_undefined__",ke=Object.prototype.hasOwnProperty,Me=v,Le=Object.prototype.hasOwnProperty,$e=_,Oe="__lodash_hash_undefined__",je=x;R.prototype.clear=Te,R.prototype.delete=He,R.prototype.get=Me,R.prototype.has=$e,R.prototype.set=je;var Fe=R,Ae=I,De=S,ze=T,We=Object.freeze({default:ze,__moduleExports:ze}),Ne=We&&ze||We,Pe=Array.prototype.splice,Be=H,Ve=E,qe=k,Ke=M;L.prototype.clear=Ae,L.prototype.delete=Be,L.prototype.get=Ve,L.prototype.has=qe,L.prototype.set=Ke;var Ue=L,Ze=Ie(Tt,"Map"),Xe=$,Ge=O,Ye=j,Je=Object.freeze({default:Ye,__moduleExports:Ye}),Qe=Je&&Ye||Je,tn=F,en=A,nn=D,on=z;W.prototype.clear=Xe,W.prototype.delete=tn,W.prototype.get=en,W.prototype.has=nn,W.prototype.set=on;var sn=W,rn="__lodash_hash_undefined__",ln=N,an=P;B.prototype.add=B.prototype.push=ln,B.prototype.has=an;var cn=B,un=V,hn=q,dn=K,fn=U,mn=Z,pn=X,gn=G,wn=Ie(Tt,"Set"),yn=Y,bn=J,Cn=wn&&1/bn(new wn([,-0]))[1]==1/0?function(t){return new wn(t)}:yn,vn=200,_n=Q,xn=tt;let Rn=re,In=oe;class Sn{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,width:32};this.columns.push(t)}if(this.options.serialNoColumn&&!this.hasColumnById("_rowIndex")){let t={id:"_rowIndex",content:"",align:"center",editable:!1,resizable:!1,focusable:!1,dropdown:!1};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){const n={rowIndex:e.rowIndex,indent:e.indent};return t=t.map((t,e)=>this.prepareCell(t,e)).map(t=>Object.assign({},n,t)),t.meta=e,t}validateColumns(){const t=this.options.columns;if(!Array.isArray(t))throw new Tn("`columns` must be an array");t.forEach((t,e)=>{if("string"!=typeof t&&"object"!=typeof t)throw new Tn(`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 Tn("`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 Tn extends TypeError{}let Hn={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 En{constructor(t){this.instance=t,rt(this,this.instance,["wrapper","options","style","header","bodyScrollable","columnmanager","rowmanager","datamanager","keyboard"]),this.bindEvents()}bindEvents(){this.bindFocusCell(),this.bindEditCell(),this.bindKeyboardSelection(),this.bindCopyCellContents(),this.bindMouseEvents(),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);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});const n=n=>{if(!t)return;this.selectArea(e(n.delegatedTarget))};e.on(this.bodyScrollable,"mousemove",".dt-cell",Rn(n,50))}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);t&&this.focusCell(t,{skipClearSelection:1,skipDOMFocus: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,o=+l.rowIndex,s=+a.colIndex,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 u=[];for(;c<=r;)u.push(c),c+=1;return u.map(t=>{for(;a<=s;)l.push([a,t]),a++;a=i}),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}=e.data(t),n=this.getCell(colIndex,rowIndex);return it(n.content),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),!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))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=!(isHeader||isFilter||isTotalRow);return`\n <div class="${["dt-cell","dt-cell--col-"+colIndex,i?`dt-cell--${colIndex}-${rowIndex}`:"",i?"dt-cell--row-"+rowIndex:"",isHeader?"dt-cell--header":"",isHeader?`dt-cell--header-${colIndex}`:"",isFilter?"dt-cell--filter":"",i&&n&&n.meta.isTreeNodeClose?"dt-cell--tree-close":""].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=En.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">${Hn.chevronDown}</span>\n <span class="icon-close">${Hn.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 u=c.textContent;return u=u.replace(/\s+/g," ").trim(),a=a.replace(">",` title="${pt(u)}">`)}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 kn{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(!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.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}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))})}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)})}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",In(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)}}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 class="dt-dropdown__list-item" data-index="${e}">${t.label}</div>\n `).join("")}\n </div>\n `}}class Mn{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=ut(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=ht([...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=ht([...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 Ln=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 u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var h=n[l]={exports:{}};e[l][0].call(h.exports,function(t){var n=e[l][1][t];return s(n||t)},h,h.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,u=this._maxElementHeight;c>u&&console.warn(["HyperList: The maximum element height",u+"px has","been exceeded; please reduce your item height."].join(" "));var h={opacity:"0",position:"absolute",width:"1px",height:c+"px"};t.mergeStyle(l,h),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 u=this._getRow(c);l[e.useFragment?"appendChild":"push"](u)}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 $n{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),0===t.length)return void(this.bodyScrollable.innerHTML=this.getNoDataHTML());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 Ln(this.bodyScrollable,o),this.renderFooter()}render(){const t=this.datamanager.getRowsForView();this.renderRows(t),this.instance.setDimensions()}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(){return`<div class="dt-scrollable__no-data">${this.options.noDataMessage}</div>`}getToastMessageHTML(t){return`<span class="dt-toast__message">${t}</span>`}}class On{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=Rn(this.onWindowResize,300),"fluid"===this.options.layout&&e.on(window,"resize",this.onWindowResize)}bindScrollHeader(){this._settingHeaderPosition=!1,e.on(this.bodyScrollable,"scroll",t=>{if(this._settingHeaderPosition)return;this._settingHeaderPosition=!0;requestAnimationFrame(()=>{const n=-t.target.scrollLeft;e.style(this.header,{transform:`translateX(${n}px)`});e.style(this.footer,{transform:`translateX(${n}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.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)})}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)}getRowIndexColumnWidth(){const t=this.datamanager.getRowCount();return e.measureTextWidth(t+"")+22}}const jn={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 Fn{constructor(t){this.listeners={},e.on(t,"keydown",this.handler.bind(this))}handler(t){let e=jn[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 An={"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"}},Dn={"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"}},zn={"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"}},Wn={"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 Nn{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 Pn={DataManager:Sn,CellManager:En,ColumnManager:kn,RowManager:Mn,BodyRenderer:$n,Style:On,Keyboard:Fn};class Bn{constructor(t,e){if(Bn.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())}initializeTranslations(t){this.language=t.language||"en",this.translationManager=new Nn(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({},Pn,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)}removeColumn(t){this.columnmanager.removeColumn(t)}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)}}Bn.instances=0;var Vn={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":"^17.1.1","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 Bn.__version__=Vn.version,Bn}(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=Lt.call(t,$t),n=t[$t];try{t[$t]=void 0}catch(t){}var i=Ot.call(t);return e?t[$t]=n:delete t[$t],i}function r(t){return Ft.call(t)}function l(t){return null==t?void 0===t?Wt:At:zt&&zt in Object(t)?jt(t):Dt(t)}function a(t){return null!=t&&"object"==typeof t}function c(t){return"symbol"==typeof t||Pt(t)&&Nt(t)==Bt}function u(t){if("number"==typeof t)return t;if(Vt(t))return qt;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(Kt,"");var n=Zt.test(t);return n||Xt.test(t)?Gt(t.slice(2),n?2:8):Ut.test(t)?qt:+t}function h(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=Jt();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 u(){return void 0===g?p:a(Jt())}function h(){var t=Jt(),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),h.cancel=c,h.flush=u,h}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=Nt(t);return e==re||e==le||e==se||e==ae}function m(t){return!!fe&&fe in t}function p(t){if(null!=t){try{return pe.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function g(t){return!(!vt(t)||me(t))&&(ce(t)?_e:we).test(ge(t))}function w(t,e){return null==t?void 0:t[e]}function y(t,e){var n=Re(t,e);return xe(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===Ee?void 0:n}return ke.call(e,t)?e[t]:void 0}function _(t){var e=this.__data__;return Se?void 0!==e[t]:Le.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?$e:e,this}function R(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 S(t,e){return t===e||t!==t&&e!==e}function T(t,e){for(var n=t.length;n--;)if(Ae(t[n][0],e))return n;return-1}function H(t){var e=this.__data__,n=We(e,t);return!(n<0)&&(n==e.length-1?e.pop():ze.call(e,n,1),--this.size,!0)}function E(t){var e=this.__data__,n=We(e,t);return n<0?void 0:e[n][1]}function k(t){return We(this.__data__,t)>-1}function M(t,e){var n=this.__data__,i=We(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 O(){this.size=0,this.__data__={hash:new Fe,map:new(Ue||Ze),string:new Fe}}function $(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function j(t,e){var n=t.__data__;return Ge(e)?n["string"==typeof e?"string":"hash"]:n.map}function F(t){var e=Qe(this,t).delete(t);return this.size-=e?1:0,e}function D(t){return Qe(this,t).get(t)}function A(t){return Qe(this,t).has(t)}function W(t,e){var n=Qe(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}function z(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,rn),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 sn;++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?fn(t,e,n):mn(t,dn,n)}function Z(t,e){return!!(null==t?0:t.length)&&pn(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 Y(){}function J(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=gn,s=t.length,r=!0,l=[],a=l;if(n)r=!1,o=wn;else if(s>=xn){var c=e?null:_n(t);if(c)return vn(c);r=!1,o=yn,a=new cn}else a=e?[]:l;t:for(;++i<s;){var u=t[i],h=e?e(u):u;if(u=n||0!==u?u:0,r&&h===h){for(var d=a.length;d--;)if(a[d]===h)continue t;e&&a.push(h),l.push(u)}else o(a,h,n)||(a!==l&&a.push(h),l.push(u))}return l}function tt(t){return t&&t.length?Rn(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 ut(t){return Array.isArray(t)?t:[t]}function ht(t){return In(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={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(t).replace(/[&<>"'`=/]/g,t=>e[t]||t)}function gt(){return{en:Wn,de:zn,fr:Nn,it:Pn}}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=Mn.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:kn.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)}}],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,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,Rt="object"==typeof self&&self&&self.Object===Object&&self,It=xt||Rt||Function("return this")(),St=Object.freeze({default:It,__moduleExports:It}),Tt=St&&It||St,Ht=function(){return Tt.Date.now()},Et=Object.freeze({default:Ht,__moduleExports:Ht}),kt=Tt.Symbol,Mt=Object.prototype,Lt=Mt.hasOwnProperty,Ot=Mt.toString,$t=kt?kt.toStringTag:void 0,jt=s,Ft=Object.prototype.toString,Dt=r,At="[object Null]",Wt="[object Undefined]",zt=kt?kt.toStringTag:void 0,Nt=l,Pt=a,Bt="[object Symbol]",Vt=c,qt=NaN,Kt=/^\s+|\s+$/g,Ut=/^[-+]0x[0-9a-f]+$/i,Zt=/^0b[01]+$/i,Xt=/^0o[0-7]+$/i,Gt=parseInt,Yt=u,Jt=Et&&Ht||Et,Qt="Expected a function",te=Math.max,ee=Math.min,ne=h,ie="Expected a function",oe=d,se="[object AsyncFunction]",re="[object Function]",le="[object GeneratorFunction]",ae="[object Proxy]",ce=f,ue=Tt["__core-js_shared__"],he=Object.freeze({default:ue,__moduleExports:ue}),de=he&&ue||he,fe=function(){var t=/[^.]+$/.exec(de&&de.keys&&de.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),me=m,pe=Function.prototype.toString,ge=p,we=/^\[object .+?Constructor\]$/,ye=Function.prototype,be=Object.prototype,Ce=ye.toString,ve=be.hasOwnProperty,_e=RegExp("^"+Ce.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=g,Re=w,Ie=y,Se=Ie(Object,"create"),Te=b,He=C,Ee="__lodash_hash_undefined__",ke=Object.prototype.hasOwnProperty,Me=v,Le=Object.prototype.hasOwnProperty,Oe=_,$e="__lodash_hash_undefined__",je=x;R.prototype.clear=Te,R.prototype.delete=He,R.prototype.get=Me,R.prototype.has=Oe,R.prototype.set=je;var Fe=R,De=I,Ae=S,We=T,ze=Array.prototype.splice,Ne=H,Pe=E,Be=k,Ve=M;L.prototype.clear=De,L.prototype.delete=Ne,L.prototype.get=Pe,L.prototype.has=Be,L.prototype.set=Ve;var qe=L,Ke=Object.freeze({default:qe,__moduleExports:qe}),Ue=Ie(Tt,"Map"),Ze=Ke&&qe||Ke,Xe=O,Ge=$,Ye=j,Je=Object.freeze({default:Ye,__moduleExports:Ye}),Qe=Je&&Ye||Je,tn=F,en=D,nn=A,on=W;z.prototype.clear=Xe,z.prototype.delete=tn,z.prototype.get=en,z.prototype.has=nn,z.prototype.set=on;var sn=z,rn="__lodash_hash_undefined__",ln=N,an=P;B.prototype.add=B.prototype.push=ln,B.prototype.has=an;var cn=B,un=V,hn=Object.freeze({default:un,__moduleExports:un}),dn=q,fn=K,mn=hn&&un||hn,pn=U,gn=Z,wn=X,yn=G,bn=Ie(Tt,"Set"),Cn=Y,vn=J,_n=bn&&1/vn(new bn([,-0]))[1]==1/0?function(t){return new bn(t)}:Cn,xn=200,Rn=Q,In=tt;let Sn=oe,Tn=ne;class Hn{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,width:32};this.columns.push(t)}if(this.options.serialNoColumn&&!this.hasColumnById("_rowIndex")){let t={id:"_rowIndex",content:"",align:"center",editable:!1,resizable:!1,focusable:!1,dropdown:!1};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 En("`columns` must be an array");t.forEach((t,e)=>{if("string"!=typeof t&&"object"!=typeof t)throw new En(`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 En("`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 En extends TypeError{}let kn={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 Mn{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.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);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",Sn(n,50))}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);t&&this.focusCell(t,{skipClearSelection:1,skipDOMFocus: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,o=+l.rowIndex,s=+a.colIndex,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 u=[];for(;c<=r;)u.push(c),c+=1;return u.map(t=>{for(;a<=s;)l.push([a,t]),a++;a=i}),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),!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=!(isHeader||isFilter||isTotalRow);return`\n <div class="${["dt-cell","dt-cell--col-"+colIndex,i?`dt-cell--${colIndex}-${rowIndex}`:"",i?"dt-cell--row-"+rowIndex:"",isHeader?"dt-cell--header":"",isHeader?`dt-cell--header-${colIndex}`:"",isFilter?"dt-cell--filter":"",i&&n&&n.meta.isTreeNodeClose?"dt-cell--tree-close":""].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=Mn.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">${kn.chevronDown}</span>\n <span class="icon-close">${kn.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 u=c.textContent;return u=u.replace(/\s+/g," ").trim(),a=a.replace(">",` title="${pt(u)}">`)}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 Ln{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(!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.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}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))})}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)})}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",Tn(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)}}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 class="dt-dropdown__list-item" data-index="${e}">${t.label}</div>\n `).join("")}\n </div>\n `}}class On{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=ut(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=ht([...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=ht([...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 $n=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 u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var h=n[l]={exports:{}};e[l][0].call(h.exports,function(t){var n=e[l][1][t];return s(n||t)},h,h.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,u=this._maxElementHeight;c>u&&console.warn(["HyperList: The maximum element height",u+"px has","been exceeded; please reduce your item height."].join(" "));var h={opacity:"0",position:"absolute",width:"1px",height:c+"px"};t.mergeStyle(l,h),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 u=this._getRow(c);l[e.useFragment?"appendChild":"push"](u)}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 jn{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 $n(this.bodyScrollable,o),this.renderFooter()}render(){const t=this.datamanager.getRowsForView();this.renderRows(t),this.instance.setDimensions()}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),e=-new DOMMatrixReadOnly(t.transform).m41+this.instance.header.clientWidth;console.log(e);const n=this.bodyScrollable.clientHeight;return console.log(e),`\n <div \n class="dt-scrollable__no-data" \n style="width: ${e}px; height: ${n}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 Fn{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=Sn(this.onWindowResize,300),"fluid"===this.options.layout&&e.on(window,"resize",this.onWindowResize)}bindScrollHeader(){this._settingHeaderPosition=!1,e.on(this.bodyScrollable,"scroll",t=>{if(this._settingHeaderPosition)return;this._settingHeaderPosition=!0;requestAnimationFrame(()=>{const n=-t.target.scrollLeft;e.style(this.header,{transform:`translateX(${n}px)`});e.style(this.footer,{transform:`translateX(${n}px)`});this._settingHeaderPosition=!1;this.instance.noData&&e.style(e(".no-data-message"),{left:`${this.instance.wrapper.clientWidth/2-n}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.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)})}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)}getRowIndexColumnWidth(){const t=this.datamanager.getRowCount();return e.measureTextWidth(t+"")+22}}const Dn={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 An{constructor(t){this.listeners={},e.on(t,"keydown",this.handler.bind(this))}handler(t){let e=Dn[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 Wn={"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"}},zn={"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"}},Nn={"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"}},Pn={"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 Bn{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 Vn={DataManager:Hn,CellManager:Mn,ColumnManager:Ln,RowManager:On,BodyRenderer:jn,Style:Fn,Keyboard:An};class qn{constructor(t,e){if(qn.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())}initializeTranslations(t){this.language=t.language||"en",this.translationManager=new Bn(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({},Vn,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)}removeColumn(t){this.columnmanager.removeColumn(t)}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)}}qn.instances=0;var Kn={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":"^17.1.1","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 qn.__version__=Kn.version,qn}(Sortable);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melondtable",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.4",
|
|
4
4
|
"description": "A modern datatable library for the web",
|
|
5
5
|
"main": "dist/melondtable.cjs.js",
|
|
6
6
|
"unpkg": "dist/melondtable.min.js",
|
|
@@ -61,7 +61,10 @@
|
|
|
61
61
|
],
|
|
62
62
|
"author": "Alphamonak Solutions",
|
|
63
63
|
"license": "",
|
|
64
|
-
"
|
|
64
|
+
"bugs": {
|
|
65
|
+
"url": "https://github.com/amonak/datatable/issues"
|
|
66
|
+
},
|
|
67
|
+
"homepage": "https://devel.monakerp.com/datatable",
|
|
65
68
|
"dependencies": {
|
|
66
69
|
"hyperlist": "^1.0.0-beta",
|
|
67
70
|
"lodash": "^4.17.5",
|
package/src/body-renderer.js
CHANGED
|
@@ -15,9 +15,11 @@ export default class BodyRenderer {
|
|
|
15
15
|
renderRows(rows) {
|
|
16
16
|
this.visibleRows = rows;
|
|
17
17
|
this.visibleRowIndices = rows.map(row => row.meta.rowIndex);
|
|
18
|
-
|
|
18
|
+
this.instance.noData = false;
|
|
19
19
|
if (rows.length === 0) {
|
|
20
20
|
this.bodyScrollable.innerHTML = this.getNoDataHTML();
|
|
21
|
+
this.instance.noData = true;
|
|
22
|
+
this.footer.innerHTML = '';
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -139,7 +141,22 @@ export default class BodyRenderer {
|
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
getNoDataHTML() {
|
|
142
|
-
|
|
144
|
+
const style = window.getComputedStyle(this.instance.header);
|
|
145
|
+
const matrix = new DOMMatrixReadOnly(style.transform);
|
|
146
|
+
const width = (-matrix.m41) + this.instance.header.clientWidth;
|
|
147
|
+
console.log(width);
|
|
148
|
+
const height = this.bodyScrollable.clientHeight;
|
|
149
|
+
console.log(width);
|
|
150
|
+
return `
|
|
151
|
+
<div
|
|
152
|
+
class="dt-scrollable__no-data"
|
|
153
|
+
style="width: ${width}px; height: ${height}px"
|
|
154
|
+
>
|
|
155
|
+
<div class="dt-scrollable__no-data no-data-message">
|
|
156
|
+
${this.options.noDataMessage}
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
`;
|
|
143
160
|
}
|
|
144
161
|
|
|
145
162
|
getToastMessageHTML(message) {
|
package/src/cellmanager.js
CHANGED
|
@@ -20,7 +20,8 @@ export default class CellManager {
|
|
|
20
20
|
'columnmanager',
|
|
21
21
|
'rowmanager',
|
|
22
22
|
'datamanager',
|
|
23
|
-
'keyboard'
|
|
23
|
+
'keyboard',
|
|
24
|
+
'footer'
|
|
24
25
|
]);
|
|
25
26
|
|
|
26
27
|
this.bindEvents();
|
|
@@ -172,6 +173,14 @@ export default class CellManager {
|
|
|
172
173
|
mouseDown = false;
|
|
173
174
|
});
|
|
174
175
|
|
|
176
|
+
if (this.options.showTotalRow) {
|
|
177
|
+
$.on(this.footer, 'click', '.dt-cell', (e) => {
|
|
178
|
+
|
|
179
|
+
this.focusCell($(e.delegatedTarget));
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
|
|
175
184
|
const selectArea = (e) => {
|
|
176
185
|
if (!mouseDown) return;
|
|
177
186
|
this.selectArea($(e.delegatedTarget));
|
|
@@ -552,10 +561,18 @@ export default class CellManager {
|
|
|
552
561
|
// copy only focusedCell
|
|
553
562
|
const {
|
|
554
563
|
colIndex,
|
|
555
|
-
rowIndex
|
|
564
|
+
rowIndex,
|
|
565
|
+
isTotalRow
|
|
556
566
|
} = $.data($cell1);
|
|
557
|
-
|
|
558
|
-
|
|
567
|
+
let copiedContent = '';
|
|
568
|
+
if (isTotalRow) {
|
|
569
|
+
let choosenFooterCell = this.$focusedCell;
|
|
570
|
+
copiedContent = choosenFooterCell.children[0].title;
|
|
571
|
+
} else {
|
|
572
|
+
const cell = this.getCell(colIndex, rowIndex);
|
|
573
|
+
copiedContent = cell.content;
|
|
574
|
+
}
|
|
575
|
+
copyTextToClipboard(copiedContent);
|
|
559
576
|
return 1;
|
|
560
577
|
}
|
|
561
578
|
const cells = this.getCellsInRange($cell1, $cell2);
|
|
@@ -754,7 +771,7 @@ export default class CellManager {
|
|
|
754
771
|
}
|
|
755
772
|
|
|
756
773
|
scrollToCell($cell) {
|
|
757
|
-
if ($.inViewport($cell, this.bodyScrollable)) return false;
|
|
774
|
+
if ($.inViewport($cell, this.bodyScrollable) || $.inViewport($cell, this.footer)) return false;
|
|
758
775
|
|
|
759
776
|
const {
|
|
760
777
|
rowIndex
|
package/src/datamanager.js
CHANGED
|
@@ -205,14 +205,19 @@ export default class DataManager {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
prepareRow(row, meta) {
|
|
208
|
-
const baseRowCell = {
|
|
209
|
-
rowIndex: meta.rowIndex,
|
|
210
|
-
indent: meta.indent
|
|
211
|
-
};
|
|
212
|
-
|
|
213
208
|
row = row
|
|
214
209
|
.map((cell, i) => this.prepareCell(cell, i))
|
|
215
|
-
.map(cell =>
|
|
210
|
+
.map(cell => {
|
|
211
|
+
// Following code is equivalent but avoids memory allocation and copying.
|
|
212
|
+
// return Object.assign({rowIndex: meta.rowIndex, indent: meta.indent}, cell)
|
|
213
|
+
if (cell.rowIndex == null) {
|
|
214
|
+
cell.rowIndex = meta.rowIndex;
|
|
215
|
+
}
|
|
216
|
+
if (cell.indent == null) {
|
|
217
|
+
cell.indent = meta.indent;
|
|
218
|
+
}
|
|
219
|
+
return cell;
|
|
220
|
+
});
|
|
216
221
|
|
|
217
222
|
// monkey patched in array object
|
|
218
223
|
row.meta = meta;
|
package/src/style.css
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
--dt-selection-highlight-color: var(--dt-light-yellow);
|
|
17
17
|
--dt-toast-message-border: none;
|
|
18
18
|
--dt-header-cell-bg: var(--dt-cell-bg);
|
|
19
|
+
--dt-no-data-message-width: 90px;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
.datatable {
|
|
@@ -43,6 +44,13 @@
|
|
|
43
44
|
padding: var(--dt-spacer-3);
|
|
44
45
|
border-left: 1px solid var(--dt-border-color);
|
|
45
46
|
border-right: 1px solid var(--dt-border-color);
|
|
47
|
+
.no-data-message{
|
|
48
|
+
position: absolute;
|
|
49
|
+
top: 100px;
|
|
50
|
+
left: 50px;
|
|
51
|
+
border: none;
|
|
52
|
+
width: var(--dt-no-data-message-width);
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
|
package/src/style.js
CHANGED
|
@@ -57,6 +57,12 @@ export default class Style {
|
|
|
57
57
|
transform: `translateX(${left}px)`
|
|
58
58
|
});
|
|
59
59
|
this._settingHeaderPosition = false;
|
|
60
|
+
if (this.instance.noData) {
|
|
61
|
+
$.style($('.no-data-message'), {
|
|
62
|
+
left: `${this.instance.wrapper.clientWidth / 2 - (left)}px`
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
this._settingHeaderPosition = false;
|
|
60
66
|
});
|
|
61
67
|
});
|
|
62
68
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Sort Ascending": "Aufsteigend sortieren",
|
|
3
|
+
"Sort Descending": "Absteigend sortieren",
|
|
4
|
+
"Reset sorting": "Sortierung zurücksetzen",
|
|
5
|
+
"Remove column": "Spalte entfernen",
|
|
6
|
+
"No Data": "Keine Daten",
|
|
7
|
+
"{count} cells copied": {
|
|
8
|
+
"1": "{count} Zelle kopiert",
|
|
9
|
+
"default": "{count} Zellen kopiert"
|
|
10
|
+
},
|
|
11
|
+
"{count} rows selected": {
|
|
12
|
+
"1": "{count} Zeile ausgewählt",
|
|
13
|
+
"default": "{count} Zeilen ausgewählt"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import en
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
6
|
+
export default function getTranslations() {
|
|
7
7
|
return {
|
|
8
8
|
en,
|
|
9
|
+
de,
|
|
9
10
|
fr,
|
|
10
|
-
|
|
11
|
-
sw,
|
|
11
|
+
it,
|
|
12
12
|
};
|
|
13
13
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Sort Ascending": "Ordinamento ascendente",
|
|
3
|
+
"Sort Descending": "Ordinamento decrescente",
|
|
4
|
+
"Reset sorting": "Azzeramento ordinamento",
|
|
5
|
+
"Remove column": "Rimuovi colonna",
|
|
6
|
+
"No Data": "Nessun dato",
|
|
7
|
+
"{count} cells copied": {
|
|
8
|
+
"1": "Copiato {count} cella",
|
|
9
|
+
"default": "{count} celle copiate"
|
|
10
|
+
},
|
|
11
|
+
"{count} rows selected": {
|
|
12
|
+
"1": "{count} linea selezionata",
|
|
13
|
+
"default": "{count} linee selezionate"
|
|
14
|
+
}
|
|
15
|
+
}
|
package/src/translations/pt.json
DELETED
|
@@ -1,15 +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
|
-
}
|
package/src/translations/sw.json
DELETED
|
@@ -1,15 +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
|
-
}
|