melondtable 1.16.4 → 1.17.3
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 +68 -21
- package/dist/melondtable.js +87 -26
- package/dist/melondtable.min.js +1 -1
- package/package.json +3 -1
- package/src/cellmanager.js +32 -14
- package/src/filterRows.js +14 -4
- package/src/rowmanager.js +9 -3
- package/src/translations/index.js +3 -5
- package/src/translations/pt.json +9 -9
- package/src/translations/sw.json +9 -9
- package/src/translations/tr.json +9 -9
- package/src/utils.js +16 -0
package/dist/melondtable.cjs.js
CHANGED
|
@@ -1912,6 +1912,21 @@ function format(str, args) {
|
|
|
1912
1912
|
|
|
1913
1913
|
return str;
|
|
1914
1914
|
}
|
|
1915
|
+
function escapeHTML(txt) {
|
|
1916
|
+
if (!txt) return '';
|
|
1917
|
+
let escapeHtmlMapping = {
|
|
1918
|
+
'&': '&',
|
|
1919
|
+
'<': '<',
|
|
1920
|
+
'>': '>',
|
|
1921
|
+
'"': '"',
|
|
1922
|
+
"'": ''',
|
|
1923
|
+
'/': '/',
|
|
1924
|
+
'`': '`',
|
|
1925
|
+
'=': '=',
|
|
1926
|
+
};
|
|
1927
|
+
|
|
1928
|
+
return String(txt).replace(/[&<>"'`=/]/g, (char) => escapeHtmlMapping[char] || char);
|
|
1929
|
+
}
|
|
1915
1930
|
|
|
1916
1931
|
class DataManager {
|
|
1917
1932
|
constructor(options) {
|
|
@@ -3059,7 +3074,7 @@ class CellManager {
|
|
|
3059
3074
|
const done = editor.setValue(value, rowIndex, col);
|
|
3060
3075
|
|
|
3061
3076
|
// update cell immediately
|
|
3062
|
-
this.updateCell(colIndex, rowIndex, value);
|
|
3077
|
+
this.updateCell(colIndex, rowIndex, value, true);
|
|
3063
3078
|
$cell.focus();
|
|
3064
3079
|
|
|
3065
3080
|
if (done && done.then) {
|
|
@@ -3137,7 +3152,7 @@ class CellManager {
|
|
|
3137
3152
|
let rowIndex = i + focusedCell.rowIndex;
|
|
3138
3153
|
row.forEach((cell, j) => {
|
|
3139
3154
|
let colIndex = j + focusedCell.colIndex;
|
|
3140
|
-
this.updateCell(colIndex, rowIndex, cell);
|
|
3155
|
+
this.updateCell(colIndex, rowIndex, cell, true);
|
|
3141
3156
|
});
|
|
3142
3157
|
});
|
|
3143
3158
|
}
|
|
@@ -3152,16 +3167,16 @@ class CellManager {
|
|
|
3152
3167
|
}
|
|
3153
3168
|
}
|
|
3154
3169
|
|
|
3155
|
-
updateCell(colIndex, rowIndex, value) {
|
|
3170
|
+
updateCell(colIndex, rowIndex, value, refreshHtml = false) {
|
|
3156
3171
|
const cell = this.datamanager.updateCell(colIndex, rowIndex, {
|
|
3157
3172
|
content: value
|
|
3158
3173
|
});
|
|
3159
|
-
this.refreshCell(cell);
|
|
3174
|
+
this.refreshCell(cell, refreshHtml);
|
|
3160
3175
|
}
|
|
3161
3176
|
|
|
3162
|
-
refreshCell(cell) {
|
|
3177
|
+
refreshCell(cell, refreshHtml = false) {
|
|
3163
3178
|
const $cell = $(this.selector(cell.colIndex, cell.rowIndex), this.bodyScrollable);
|
|
3164
|
-
$cell.innerHTML = this.getCellContent(cell);
|
|
3179
|
+
$cell.innerHTML = this.getCellContent(cell, refreshHtml);
|
|
3165
3180
|
}
|
|
3166
3181
|
|
|
3167
3182
|
toggleTreeButton(rowIndex, flag) {
|
|
@@ -3336,7 +3351,7 @@ class CellManager {
|
|
|
3336
3351
|
`;
|
|
3337
3352
|
}
|
|
3338
3353
|
|
|
3339
|
-
getCellContent(cell) {
|
|
3354
|
+
getCellContent(cell, refreshHtml = false) {
|
|
3340
3355
|
const {
|
|
3341
3356
|
isHeader,
|
|
3342
3357
|
isFilter,
|
|
@@ -3359,15 +3374,18 @@ class CellManager {
|
|
|
3359
3374
|
const hasDropdown = isHeader && cell.dropdown !== false;
|
|
3360
3375
|
const dropdown = hasDropdown ? this.columnmanager.getDropdownHTML() : '';
|
|
3361
3376
|
|
|
3362
|
-
|
|
3363
|
-
|
|
3377
|
+
let customFormatter = CellManager.getCustomCellFormatter(cell);
|
|
3364
3378
|
let contentHTML;
|
|
3365
3379
|
if (isHeader || isFilter || !customFormatter) {
|
|
3366
3380
|
contentHTML = cell.content;
|
|
3367
3381
|
} else {
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3382
|
+
if (!cell.html || refreshHtml) {
|
|
3383
|
+
const row = this.datamanager.getRow(cell.rowIndex);
|
|
3384
|
+
const data = this.datamanager.getData(cell.rowIndex);
|
|
3385
|
+
contentHTML = customFormatter(cell.content, row, cell.column, data);
|
|
3386
|
+
} else {
|
|
3387
|
+
contentHTML = cell.html;
|
|
3388
|
+
}
|
|
3371
3389
|
}
|
|
3372
3390
|
|
|
3373
3391
|
cell.html = contentHTML;
|
|
@@ -3399,7 +3417,7 @@ class CellManager {
|
|
|
3399
3417
|
isHeader ? `dt-cell__content--header-${colIndex}` : `dt-cell__content--col-${colIndex}`
|
|
3400
3418
|
].join(' ');
|
|
3401
3419
|
|
|
3402
|
-
|
|
3420
|
+
let cellContentHTML = `
|
|
3403
3421
|
<div class="${className}">
|
|
3404
3422
|
${contentHTML}
|
|
3405
3423
|
${sortIndicator}
|
|
@@ -3408,6 +3426,16 @@ class CellManager {
|
|
|
3408
3426
|
</div>
|
|
3409
3427
|
${editCellHTML}
|
|
3410
3428
|
`;
|
|
3429
|
+
|
|
3430
|
+
let div = document.createElement('div');
|
|
3431
|
+
div.innerHTML = contentHTML;
|
|
3432
|
+
|
|
3433
|
+
let textContent = div.textContent;
|
|
3434
|
+
textContent = textContent.replace(/\s+/g, ' ').trim();
|
|
3435
|
+
|
|
3436
|
+
cellContentHTML = cellContentHTML.replace('>', ` title="${escapeHTML(textContent)}">`);
|
|
3437
|
+
|
|
3438
|
+
return cellContentHTML;
|
|
3411
3439
|
}
|
|
3412
3440
|
|
|
3413
3441
|
getEditCellHTML(colIndex) {
|
|
@@ -3417,6 +3445,10 @@ class CellManager {
|
|
|
3417
3445
|
selector(colIndex, rowIndex) {
|
|
3418
3446
|
return `.dt-cell--${colIndex}-${rowIndex}`;
|
|
3419
3447
|
}
|
|
3448
|
+
|
|
3449
|
+
static getCustomCellFormatter(cell) {
|
|
3450
|
+
return cell.format || (cell.column && cell.column.format) || null;
|
|
3451
|
+
}
|
|
3420
3452
|
}
|
|
3421
3453
|
|
|
3422
3454
|
class ColumnManager {
|
|
@@ -3927,7 +3959,7 @@ class RowManager {
|
|
|
3927
3959
|
const _row = this.datamanager.updateRow(row, rowIndex);
|
|
3928
3960
|
|
|
3929
3961
|
_row.forEach(cell => {
|
|
3930
|
-
this.cellmanager.refreshCell(cell);
|
|
3962
|
+
this.cellmanager.refreshCell(cell, true);
|
|
3931
3963
|
});
|
|
3932
3964
|
}
|
|
3933
3965
|
|
|
@@ -3973,7 +4005,13 @@ class RowManager {
|
|
|
3973
4005
|
|
|
3974
4006
|
// update internal map
|
|
3975
4007
|
if (toggle) {
|
|
3976
|
-
|
|
4008
|
+
if (this.datamanager._filteredRows) {
|
|
4009
|
+
this.datamanager._filteredRows.forEach(f => {
|
|
4010
|
+
this.checkRow(f, toggle);
|
|
4011
|
+
});
|
|
4012
|
+
} else {
|
|
4013
|
+
this.checkMap = Array.from(Array(this.getTotalRows())).map(c => value);
|
|
4014
|
+
}
|
|
3977
4015
|
} else {
|
|
3978
4016
|
this.checkMap = [];
|
|
3979
4017
|
}
|
|
@@ -4213,7 +4251,7 @@ class RowManager {
|
|
|
4213
4251
|
getFilterInput(props) {
|
|
4214
4252
|
let title = `title="Filter based on ${props.name || 'Index'}"`;
|
|
4215
4253
|
const dataAttr = makeDataAttributeString(props);
|
|
4216
|
-
return `<input class="dt-filter dt-input" type="text" ${dataAttr} tabindex="1"
|
|
4254
|
+
return `<input class="dt-filter dt-input" type="text" ${dataAttr} tabindex="1"
|
|
4217
4255
|
${props.colIndex === 0 ? 'disabled' : title} />`;
|
|
4218
4256
|
}
|
|
4219
4257
|
|
|
@@ -5325,7 +5363,7 @@ function filterRows(rows, filters) {
|
|
|
5325
5363
|
const cells = filteredRows.map(row => row[colIndex]);
|
|
5326
5364
|
|
|
5327
5365
|
let filter = guessFilter(keyword);
|
|
5328
|
-
let filterMethod = getFilterMethod(filter);
|
|
5366
|
+
let filterMethod = getFilterMethod(rows, filter);
|
|
5329
5367
|
|
|
5330
5368
|
if (filterMethod) {
|
|
5331
5369
|
filteredRowIndices = filterMethod(filter.text, cells);
|
|
@@ -5336,9 +5374,18 @@ function filterRows(rows, filters) {
|
|
|
5336
5374
|
|
|
5337
5375
|
return filteredRowIndices;
|
|
5338
5376
|
}
|
|
5339
|
-
function getFilterMethod(filter) {
|
|
5377
|
+
function getFilterMethod(rows, filter) {
|
|
5378
|
+
const getFormattedValue = cell => {
|
|
5379
|
+
let formatter = CellManager.getCustomCellFormatter(cell);
|
|
5380
|
+
if (formatter && cell.content) {
|
|
5381
|
+
cell.html = formatter(cell.content, rows[cell.rowIndex], cell.column, rows[cell.rowIndex], true);
|
|
5382
|
+
return stripHTML(cell.html);
|
|
5383
|
+
}
|
|
5384
|
+
return cell.content || '';
|
|
5385
|
+
};
|
|
5386
|
+
|
|
5340
5387
|
const stringCompareValue = cell =>
|
|
5341
|
-
String(stripHTML(cell.html || '') || cell
|
|
5388
|
+
String(stripHTML(cell.html || '') || getFormattedValue(cell)).toLowerCase();
|
|
5342
5389
|
|
|
5343
5390
|
const numberCompareValue = cell => parseFloat(cell.content);
|
|
5344
5391
|
|
|
@@ -5486,7 +5533,7 @@ function guessFilter(keyword = '') {
|
|
|
5486
5533
|
}
|
|
5487
5534
|
}
|
|
5488
5535
|
|
|
5489
|
-
if (keyword.split(':').length === 2) {
|
|
5536
|
+
if (keyword.split(':').length === 2 && keyword.split(':').every(v => isNumber(v.trim()))) {
|
|
5490
5537
|
compareString = keyword.split(':');
|
|
5491
5538
|
return {
|
|
5492
5539
|
type: 'range',
|
|
@@ -5840,7 +5887,7 @@ var files = ["dist","src"];
|
|
|
5840
5887
|
var 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"};
|
|
5841
5888
|
var repository = {"type":"git","url":"https://github.com/amonak/melondtable.git"};
|
|
5842
5889
|
var keywords = ["datatable","data","grid","table"];
|
|
5843
|
-
var author = "
|
|
5890
|
+
var author = "Alphamonak Solutions";
|
|
5844
5891
|
var license = "MIT";
|
|
5845
5892
|
var bugs = {"url":"https://github.com/amonak/datatable/issues"};
|
|
5846
5893
|
var homepage = "https://devel.monakerp.com/datatable";
|
package/dist/melondtable.js
CHANGED
|
@@ -320,6 +320,11 @@ var DataTable = (function (Sortable) {
|
|
|
320
320
|
|
|
321
321
|
var now_1 = now;
|
|
322
322
|
|
|
323
|
+
var now$1 = /*#__PURE__*/Object.freeze({
|
|
324
|
+
default: now_1,
|
|
325
|
+
__moduleExports: now_1
|
|
326
|
+
});
|
|
327
|
+
|
|
323
328
|
/** Built-in value references. */
|
|
324
329
|
var Symbol = _root.Symbol;
|
|
325
330
|
|
|
@@ -538,6 +543,15 @@ var DataTable = (function (Sortable) {
|
|
|
538
543
|
|
|
539
544
|
var toNumber_1 = toNumber;
|
|
540
545
|
|
|
546
|
+
var toNumber$1 = /*#__PURE__*/Object.freeze({
|
|
547
|
+
default: toNumber_1,
|
|
548
|
+
__moduleExports: toNumber_1
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
var now$2 = ( now$1 && now_1 ) || now$1;
|
|
552
|
+
|
|
553
|
+
var toNumber$2 = ( toNumber$1 && toNumber_1 ) || toNumber$1;
|
|
554
|
+
|
|
541
555
|
/** Error message constants. */
|
|
542
556
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
543
557
|
|
|
@@ -614,11 +628,11 @@ var DataTable = (function (Sortable) {
|
|
|
614
628
|
if (typeof func != 'function') {
|
|
615
629
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
616
630
|
}
|
|
617
|
-
wait =
|
|
631
|
+
wait = toNumber$2(wait) || 0;
|
|
618
632
|
if (isObject_1(options)) {
|
|
619
633
|
leading = !!options.leading;
|
|
620
634
|
maxing = 'maxWait' in options;
|
|
621
|
-
maxWait = maxing ? nativeMax(
|
|
635
|
+
maxWait = maxing ? nativeMax(toNumber$2(options.maxWait) || 0, wait) : maxWait;
|
|
622
636
|
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
623
637
|
}
|
|
624
638
|
|
|
@@ -663,7 +677,7 @@ var DataTable = (function (Sortable) {
|
|
|
663
677
|
}
|
|
664
678
|
|
|
665
679
|
function timerExpired() {
|
|
666
|
-
var time =
|
|
680
|
+
var time = now$2();
|
|
667
681
|
if (shouldInvoke(time)) {
|
|
668
682
|
return trailingEdge(time);
|
|
669
683
|
}
|
|
@@ -692,11 +706,11 @@ var DataTable = (function (Sortable) {
|
|
|
692
706
|
}
|
|
693
707
|
|
|
694
708
|
function flush() {
|
|
695
|
-
return timerId === undefined ? result : trailingEdge(
|
|
709
|
+
return timerId === undefined ? result : trailingEdge(now$2());
|
|
696
710
|
}
|
|
697
711
|
|
|
698
712
|
function debounced() {
|
|
699
|
-
var time =
|
|
713
|
+
var time = now$2(),
|
|
700
714
|
isInvoking = shouldInvoke(time);
|
|
701
715
|
|
|
702
716
|
lastArgs = arguments;
|
|
@@ -1911,6 +1925,21 @@ var DataTable = (function (Sortable) {
|
|
|
1911
1925
|
|
|
1912
1926
|
return str;
|
|
1913
1927
|
}
|
|
1928
|
+
function escapeHTML(txt) {
|
|
1929
|
+
if (!txt) return '';
|
|
1930
|
+
let escapeHtmlMapping = {
|
|
1931
|
+
'&': '&',
|
|
1932
|
+
'<': '<',
|
|
1933
|
+
'>': '>',
|
|
1934
|
+
'"': '"',
|
|
1935
|
+
"'": ''',
|
|
1936
|
+
'/': '/',
|
|
1937
|
+
'`': '`',
|
|
1938
|
+
'=': '=',
|
|
1939
|
+
};
|
|
1940
|
+
|
|
1941
|
+
return String(txt).replace(/[&<>"'`=/]/g, (char) => escapeHtmlMapping[char] || char);
|
|
1942
|
+
}
|
|
1914
1943
|
|
|
1915
1944
|
class DataManager {
|
|
1916
1945
|
constructor(options) {
|
|
@@ -3058,7 +3087,7 @@ var DataTable = (function (Sortable) {
|
|
|
3058
3087
|
const done = editor.setValue(value, rowIndex, col);
|
|
3059
3088
|
|
|
3060
3089
|
// update cell immediately
|
|
3061
|
-
this.updateCell(colIndex, rowIndex, value);
|
|
3090
|
+
this.updateCell(colIndex, rowIndex, value, true);
|
|
3062
3091
|
$cell.focus();
|
|
3063
3092
|
|
|
3064
3093
|
if (done && done.then) {
|
|
@@ -3136,7 +3165,7 @@ var DataTable = (function (Sortable) {
|
|
|
3136
3165
|
let rowIndex = i + focusedCell.rowIndex;
|
|
3137
3166
|
row.forEach((cell, j) => {
|
|
3138
3167
|
let colIndex = j + focusedCell.colIndex;
|
|
3139
|
-
this.updateCell(colIndex, rowIndex, cell);
|
|
3168
|
+
this.updateCell(colIndex, rowIndex, cell, true);
|
|
3140
3169
|
});
|
|
3141
3170
|
});
|
|
3142
3171
|
}
|
|
@@ -3151,16 +3180,16 @@ var DataTable = (function (Sortable) {
|
|
|
3151
3180
|
}
|
|
3152
3181
|
}
|
|
3153
3182
|
|
|
3154
|
-
updateCell(colIndex, rowIndex, value) {
|
|
3183
|
+
updateCell(colIndex, rowIndex, value, refreshHtml = false) {
|
|
3155
3184
|
const cell = this.datamanager.updateCell(colIndex, rowIndex, {
|
|
3156
3185
|
content: value
|
|
3157
3186
|
});
|
|
3158
|
-
this.refreshCell(cell);
|
|
3187
|
+
this.refreshCell(cell, refreshHtml);
|
|
3159
3188
|
}
|
|
3160
3189
|
|
|
3161
|
-
refreshCell(cell) {
|
|
3190
|
+
refreshCell(cell, refreshHtml = false) {
|
|
3162
3191
|
const $cell = $(this.selector(cell.colIndex, cell.rowIndex), this.bodyScrollable);
|
|
3163
|
-
$cell.innerHTML = this.getCellContent(cell);
|
|
3192
|
+
$cell.innerHTML = this.getCellContent(cell, refreshHtml);
|
|
3164
3193
|
}
|
|
3165
3194
|
|
|
3166
3195
|
toggleTreeButton(rowIndex, flag) {
|
|
@@ -3335,7 +3364,7 @@ var DataTable = (function (Sortable) {
|
|
|
3335
3364
|
`;
|
|
3336
3365
|
}
|
|
3337
3366
|
|
|
3338
|
-
getCellContent(cell) {
|
|
3367
|
+
getCellContent(cell, refreshHtml = false) {
|
|
3339
3368
|
const {
|
|
3340
3369
|
isHeader,
|
|
3341
3370
|
isFilter,
|
|
@@ -3358,15 +3387,18 @@ var DataTable = (function (Sortable) {
|
|
|
3358
3387
|
const hasDropdown = isHeader && cell.dropdown !== false;
|
|
3359
3388
|
const dropdown = hasDropdown ? this.columnmanager.getDropdownHTML() : '';
|
|
3360
3389
|
|
|
3361
|
-
|
|
3362
|
-
|
|
3390
|
+
let customFormatter = CellManager.getCustomCellFormatter(cell);
|
|
3363
3391
|
let contentHTML;
|
|
3364
3392
|
if (isHeader || isFilter || !customFormatter) {
|
|
3365
3393
|
contentHTML = cell.content;
|
|
3366
3394
|
} else {
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3395
|
+
if (!cell.html || refreshHtml) {
|
|
3396
|
+
const row = this.datamanager.getRow(cell.rowIndex);
|
|
3397
|
+
const data = this.datamanager.getData(cell.rowIndex);
|
|
3398
|
+
contentHTML = customFormatter(cell.content, row, cell.column, data);
|
|
3399
|
+
} else {
|
|
3400
|
+
contentHTML = cell.html;
|
|
3401
|
+
}
|
|
3370
3402
|
}
|
|
3371
3403
|
|
|
3372
3404
|
cell.html = contentHTML;
|
|
@@ -3398,7 +3430,7 @@ var DataTable = (function (Sortable) {
|
|
|
3398
3430
|
isHeader ? `dt-cell__content--header-${colIndex}` : `dt-cell__content--col-${colIndex}`
|
|
3399
3431
|
].join(' ');
|
|
3400
3432
|
|
|
3401
|
-
|
|
3433
|
+
let cellContentHTML = `
|
|
3402
3434
|
<div class="${className}">
|
|
3403
3435
|
${contentHTML}
|
|
3404
3436
|
${sortIndicator}
|
|
@@ -3407,6 +3439,16 @@ var DataTable = (function (Sortable) {
|
|
|
3407
3439
|
</div>
|
|
3408
3440
|
${editCellHTML}
|
|
3409
3441
|
`;
|
|
3442
|
+
|
|
3443
|
+
let div = document.createElement('div');
|
|
3444
|
+
div.innerHTML = contentHTML;
|
|
3445
|
+
|
|
3446
|
+
let textContent = div.textContent;
|
|
3447
|
+
textContent = textContent.replace(/\s+/g, ' ').trim();
|
|
3448
|
+
|
|
3449
|
+
cellContentHTML = cellContentHTML.replace('>', ` title="${escapeHTML(textContent)}">`);
|
|
3450
|
+
|
|
3451
|
+
return cellContentHTML;
|
|
3410
3452
|
}
|
|
3411
3453
|
|
|
3412
3454
|
getEditCellHTML(colIndex) {
|
|
@@ -3416,6 +3458,10 @@ var DataTable = (function (Sortable) {
|
|
|
3416
3458
|
selector(colIndex, rowIndex) {
|
|
3417
3459
|
return `.dt-cell--${colIndex}-${rowIndex}`;
|
|
3418
3460
|
}
|
|
3461
|
+
|
|
3462
|
+
static getCustomCellFormatter(cell) {
|
|
3463
|
+
return cell.format || (cell.column && cell.column.format) || null;
|
|
3464
|
+
}
|
|
3419
3465
|
}
|
|
3420
3466
|
|
|
3421
3467
|
class ColumnManager {
|
|
@@ -3926,7 +3972,7 @@ var DataTable = (function (Sortable) {
|
|
|
3926
3972
|
const _row = this.datamanager.updateRow(row, rowIndex);
|
|
3927
3973
|
|
|
3928
3974
|
_row.forEach(cell => {
|
|
3929
|
-
this.cellmanager.refreshCell(cell);
|
|
3975
|
+
this.cellmanager.refreshCell(cell, true);
|
|
3930
3976
|
});
|
|
3931
3977
|
}
|
|
3932
3978
|
|
|
@@ -3972,7 +4018,13 @@ var DataTable = (function (Sortable) {
|
|
|
3972
4018
|
|
|
3973
4019
|
// update internal map
|
|
3974
4020
|
if (toggle) {
|
|
3975
|
-
|
|
4021
|
+
if (this.datamanager._filteredRows) {
|
|
4022
|
+
this.datamanager._filteredRows.forEach(f => {
|
|
4023
|
+
this.checkRow(f, toggle);
|
|
4024
|
+
});
|
|
4025
|
+
} else {
|
|
4026
|
+
this.checkMap = Array.from(Array(this.getTotalRows())).map(c => value);
|
|
4027
|
+
}
|
|
3976
4028
|
} else {
|
|
3977
4029
|
this.checkMap = [];
|
|
3978
4030
|
}
|
|
@@ -4212,7 +4264,7 @@ var DataTable = (function (Sortable) {
|
|
|
4212
4264
|
getFilterInput(props) {
|
|
4213
4265
|
let title = `title="Filter based on ${props.name || 'Index'}"`;
|
|
4214
4266
|
const dataAttr = makeDataAttributeString(props);
|
|
4215
|
-
return `<input class="dt-filter dt-input" type="text" ${dataAttr} tabindex="1"
|
|
4267
|
+
return `<input class="dt-filter dt-input" type="text" ${dataAttr} tabindex="1"
|
|
4216
4268
|
${props.colIndex === 0 ? 'disabled' : title} />`;
|
|
4217
4269
|
}
|
|
4218
4270
|
|
|
@@ -5324,7 +5376,7 @@ var DataTable = (function (Sortable) {
|
|
|
5324
5376
|
const cells = filteredRows.map(row => row[colIndex]);
|
|
5325
5377
|
|
|
5326
5378
|
let filter = guessFilter(keyword);
|
|
5327
|
-
let filterMethod = getFilterMethod(filter);
|
|
5379
|
+
let filterMethod = getFilterMethod(rows, filter);
|
|
5328
5380
|
|
|
5329
5381
|
if (filterMethod) {
|
|
5330
5382
|
filteredRowIndices = filterMethod(filter.text, cells);
|
|
@@ -5335,9 +5387,18 @@ var DataTable = (function (Sortable) {
|
|
|
5335
5387
|
|
|
5336
5388
|
return filteredRowIndices;
|
|
5337
5389
|
}
|
|
5338
|
-
function getFilterMethod(filter) {
|
|
5390
|
+
function getFilterMethod(rows, filter) {
|
|
5391
|
+
const getFormattedValue = cell => {
|
|
5392
|
+
let formatter = CellManager.getCustomCellFormatter(cell);
|
|
5393
|
+
if (formatter && cell.content) {
|
|
5394
|
+
cell.html = formatter(cell.content, rows[cell.rowIndex], cell.column, rows[cell.rowIndex], true);
|
|
5395
|
+
return stripHTML(cell.html);
|
|
5396
|
+
}
|
|
5397
|
+
return cell.content || '';
|
|
5398
|
+
};
|
|
5399
|
+
|
|
5339
5400
|
const stringCompareValue = cell =>
|
|
5340
|
-
String(stripHTML(cell.html || '') || cell
|
|
5401
|
+
String(stripHTML(cell.html || '') || getFormattedValue(cell)).toLowerCase();
|
|
5341
5402
|
|
|
5342
5403
|
const numberCompareValue = cell => parseFloat(cell.content);
|
|
5343
5404
|
|
|
@@ -5485,7 +5546,7 @@ var DataTable = (function (Sortable) {
|
|
|
5485
5546
|
}
|
|
5486
5547
|
}
|
|
5487
5548
|
|
|
5488
|
-
if (keyword.split(':').length === 2) {
|
|
5549
|
+
if (keyword.split(':').length === 2 && keyword.split(':').every(v => isNumber(v.trim()))) {
|
|
5489
5550
|
compareString = keyword.split(':');
|
|
5490
5551
|
return {
|
|
5491
5552
|
type: 'range',
|
|
@@ -5839,7 +5900,7 @@ var DataTable = (function (Sortable) {
|
|
|
5839
5900
|
var 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"};
|
|
5840
5901
|
var repository = {"type":"git","url":"https://github.com/amonak/melondtable.git"};
|
|
5841
5902
|
var keywords = ["datatable","data","grid","table"];
|
|
5842
|
-
var author = "
|
|
5903
|
+
var author = "Alphamonak Solutions";
|
|
5843
5904
|
var license = "MIT";
|
|
5844
5905
|
var bugs = {"url":"https://github.com/amonak/datatable/issues"};
|
|
5845
5906
|
var homepage = "https://devel.monakerp.com/datatable";
|
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=Tt.call(t,kt),n=t[kt];try{t[kt]=void 0}catch(t){}var i=Et.call(t);return e?t[kt]=n:delete t[kt],i}function r(t){return Lt.call(t)}function l(t){return null==t?void 0===t?Ft:Ot:jt&&jt in Object(t)?Mt(t):$t(t)}function a(t){return null!=t&&"object"==typeof t}function c(t){return"symbol"==typeof t||Dt(t)&&At(t)==Wt}function u(t){if("number"==typeof t)return t;if(zt(t))return Nt;if(Ct(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ct(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Pt,"");var n=Vt.test(t);return n||qt.test(t)?Kt(t.slice(2),n?2:8):Bt.test(t)?Nt:+t}function h(t,e,n){function i(e){var n=d,i=f;return d=f=void 0,y=e,m=t.apply(i,n)}function o(t){return y=t,g=setTimeout(l,e),b?i(t):m}function s(t){var n=t-y,i=e-(t-w);return C?Gt(i,p-n):i}function r(t){var n=t-w,i=t-y;return void 0===w||n>=e||n<0||C&&i>=p}function l(){var t=It();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,m)}function c(){void 0!==g&&clearTimeout(g),y=0,d=w=f=g=void 0}function u(){return void 0===g?m:a(It())}function h(){var t=It(),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)),m}var d,f,p,m,g,w,y=0,b=!1,C=!1,v=!0;if("function"!=typeof t)throw new TypeError(Zt);return e=Ut(e)||0,Ct(n)&&(b=!!n.leading,p=(C="maxWait"in n)?Xt(Ut(n.maxWait)||0,e):p,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(Jt);return Ct(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Yt(t,e,{leading:i,maxWait:e,trailing:o})}function f(t){if(!Ct(t))return!1;var e=At(t);return e==ee||e==ne||e==te||e==ie}function p(t){return!!re&&re in t}function m(t){if(null!=t){try{return ae.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function g(t){return!(!Ct(t)||le(t))&&(oe(t)?me:ue).test(ce(t))}function w(t,e){return null==t?void 0:t[e]}function y(t,e){var n=we(t,e);return ge(n)?n:void 0}function b(){this.__data__=be?be(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(be){var n=e[t];return n===_e?void 0:n}return xe.call(e,t)?e[t]:void 0}function _(t){var e=this.__data__;return be?void 0!==e[t]:Ie.call(e,t)}function x(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=be&&void 0===e?He: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 H(t,e){for(var n=t.length;n--;)if(Me(t[n][0],e))return n;return-1}function T(t){var e=this.__data__,n=Le(e,t);return!(n<0)&&(n==e.length-1?e.pop():$e.call(e,n,1),--this.size,!0)}function E(t){var e=this.__data__,n=Le(e,t);return n<0?void 0:e[n][1]}function k(t){return Le(this.__data__,t)>-1}function M(t,e){var n=this.__data__,i=Le(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 Ee,map:new(We||De),string:new Ee}}function O(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function F(t,e){var n=t.__data__;return Ne(e)?n["string"==typeof e?"string":"hash"]:n.map}function j(t){var e=Pe(this,t).delete(t);return this.size-=e?1:0,e}function A(t){return Pe(this,t).get(t)}function D(t){return Pe(this,t).has(t)}function W(t,e){var n=Pe(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,Ze),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 Ue;++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?tn(t,e,n):Je(t,Qe,n)}function Z(t,e){return!!(null==t?0:t.length)&&en(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=nn,s=t.length,r=!0,l=[],a=l;if(n)r=!1,o=on;else if(s>=un){var c=e?null:cn(t);if(c)return an(c);r=!1,o=sn,a=new Ye}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?hn(t):[]}function et(t){return t.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`)}function nt(t){return Object.keys(t).map(e=>{const n=et(e);const i=t[e];if(void 0===i)return"";return`data-${n}="${i}" `}).join("").trim()}function it(t){var e=document.createElement("textarea");e.style.position="fixed",e.style.top=0,e.style.left=0,e.style.width="2em",e.style.height="2em",e.style.padding=0,e.style.border="none",e.style.outline="none",e.style.boxShadow="none",e.style.background="transparent",e.value=t,document.body.appendChild(e),e.select();try{document.execCommand("copy")}catch(t){console.log("Oops, unable to copy")}document.body.removeChild(e)}function ot(t){return!isNaN(t)}function st(t,e=null){return(...n)=>new Promise(i=>{const o=()=>{const o=t.apply(e,n);i(o)};setTimeout(o)})}function rt(t,e,n){const i=n.reduce((t,n)=>{t[n]={get(){return e[n]}};return t},{});Object.defineProperties(t,i)}function lt(t){return void 0!==t||null!==t}function at(t){return!lt(t)}function ct(t){return!isNaN(t)}function ut(t){return Array.isArray(t)?t:[t]}function ht(t){return dn(t)}function dt(t,e){return t-e}function ft(t){return t.replace(/<[^>]*>/g,"")}function pt(t,e){return t?(Object.keys(e).forEach(n=>{let i=new RegExp(`{(${n})}`,"g");t=t.replace(i,e[n])}),t):t}function mt(){return{en:Sn,de:Hn,fr:Tn,it:En}}function gt(t,e){let n=[];if(0===Object.keys(e).length)return t.map(t=>t.meta.rowIndex);for(let i in e){const o=e[i],s=n.length?n.map(e=>t[e]):t,r=s.map(t=>t[i]);let l=yt(o),a=wt(l);n=a?a(l.text,r):r.map(t=>t.rowIndex)}return n}function wt(t){const e=t=>String(ft(t.html||"")||t.content||"").toLowerCase(),n=t=>parseFloat(t.content),i=(t,i)=>{if(t.column.compareValue){const e=t.column.compareValue(t,i);if(e&&Array.isArray(e))return e}const o=n(t);if(!isNaN(o))return[o,i];return[e(t),i]};return{contains(t,n){return n.filter(n=>{const i=e(n);const o=(t||"").toLowerCase();return!o||i.includes(o)}).map(t=>t.rowIndex)},greaterThan(t,e){return e.filter(e=>{const[n,o]=i(e,t);return n>o}).map(t=>t.rowIndex)},lessThan(t,e){return e.filter(e=>{const[n,o]=i(e,t);return n<o}).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=i(e,t[0]);const o=i(e,t[1]);const s=n[0];return s>=n[1]&&s<=o[1]}).map(t=>t.rowIndex)},containsNumber(t,i){return i.filter(i=>{let o=parseFloat(t,10);let s=t;let r=n(i);let l=e(i);return o===r||l.includes(s)}).map(t=>t.rowIndex)}}[t.type]}function yt(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?(e=t.split(":"),{type:"range",text:e.map(t=>t.trim())}):{type:"contains",text:e.toLowerCase()}}function bt(t){return{columns:[],data:[],dropdownButton:wn.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:gt,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 Ct=i,vt="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},_t="object"==typeof vt&&vt&&vt.Object===Object&&vt,xt="object"==typeof self&&self&&self.Object===Object&&self,Rt=_t||xt||Function("return this")(),It=function(){return Rt.Date.now()},St=Rt.Symbol,Ht=Object.prototype,Tt=Ht.hasOwnProperty,Et=Ht.toString,kt=St?St.toStringTag:void 0,Mt=s,Lt=Object.prototype.toString,$t=r,Ot="[object Null]",Ft="[object Undefined]",jt=St?St.toStringTag:void 0,At=l,Dt=a,Wt="[object Symbol]",zt=c,Nt=NaN,Pt=/^\s+|\s+$/g,Bt=/^[-+]0x[0-9a-f]+$/i,Vt=/^0b[01]+$/i,qt=/^0o[0-7]+$/i,Kt=parseInt,Ut=u,Zt="Expected a function",Xt=Math.max,Gt=Math.min,Yt=h,Jt="Expected a function",Qt=d,te="[object AsyncFunction]",ee="[object Function]",ne="[object GeneratorFunction]",ie="[object Proxy]",oe=f,se=Rt["__core-js_shared__"],re=function(){var t=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),le=p,ae=Function.prototype.toString,ce=m,ue=/^\[object .+?Constructor\]$/,he=Function.prototype,de=Object.prototype,fe=he.toString,pe=de.hasOwnProperty,me=RegExp("^"+fe.call(pe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ge=g,we=w,ye=y,be=ye(Object,"create"),Ce=b,ve=C,_e="__lodash_hash_undefined__",xe=Object.prototype.hasOwnProperty,Re=v,Ie=Object.prototype.hasOwnProperty,Se=_,He="__lodash_hash_undefined__",Te=x;R.prototype.clear=Ce,R.prototype.delete=ve,R.prototype.get=Re,R.prototype.has=Se,R.prototype.set=Te;var Ee=R,ke=I,Me=S,Le=H,$e=Array.prototype.splice,Oe=T,Fe=E,je=k,Ae=M;L.prototype.clear=ke,L.prototype.delete=Oe,L.prototype.get=Fe,L.prototype.has=je,L.prototype.set=Ae;var De=L,We=ye(Rt,"Map"),ze=$,Ne=O,Pe=F,Be=j,Ve=A,qe=D,Ke=W;z.prototype.clear=ze,z.prototype.delete=Be,z.prototype.get=Ve,z.prototype.has=qe,z.prototype.set=Ke;var Ue=z,Ze="__lodash_hash_undefined__",Xe=N,Ge=P;B.prototype.add=B.prototype.push=Xe,B.prototype.has=Ge;var Ye=B,Je=V,Qe=q,tn=K,en=U,nn=Z,on=X,sn=G,rn=ye(Rt,"Set"),ln=Y,an=J,cn=rn&&1/an(new rn([,-0]))[1]==1/0?function(t){return new rn(t)}:ln,un=200,hn=Q,dn=tt;let fn=Qt,pn=Yt;class mn{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.prepareRows(),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(){this.validateData(this.data),this.rows=this.data.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 gn("`columns` must be an array");t.forEach((t,e)=>{if("string"!=typeof t&&"object"!=typeof t)throw new gn(`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 gn("`data` must be an array of arrays or objects")}appendRows(t){this.validateData(t),this.rows.push(...this.prepareRows(t))}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).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 gn extends TypeError{}let wn={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 yn{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",fn(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);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)})})}}activateFilter(t){this.columnmanager.toggleFilter(),this.columnmanager.focusFilter(t),this.columnmanager.isFilterShown||this.$focusedCell&&this.$focusedCell.focus()}updateCell(t,e,n){const i=this.datamanager.updateCell(t,e,{content:n});this.refreshCell(i)}refreshCell(t){e(this.selector(t.colIndex,t.rowIndex),this.bodyScrollable).innerHTML=this.getCellContent(t)}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){const{isHeader:isHeader,isFilter:isFilter,colIndex:colIndex}=t,e=!isHeader&&!1!==t.editable?this.getEditCellHTML(colIndex):"",n=isHeader&&!1!==t.sortable?`<span class="sort-indicator">\n ${this.options.sortIndicator[t.sortOrder]}\n </span>`:"",i=isHeader&&!1!==t.resizable?'<span class="dt-cell__resize-handle"></span>':"",o=isHeader&&!1!==t.dropdown?this.columnmanager.getDropdownHTML():"",s=t.format||t.column&&t.column.format||null;let r;if(isHeader||isFilter||!s)r=t.content;else{const e=this.datamanager.getRow(t.rowIndex),n=this.datamanager.getData(t.rowIndex);r=s(t.content,e,t.column,n)}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">${wn.chevronDown}</span>\n <span class="icon-close">${wn.chevronRight}</span>\n </span>`:"";r=`<span class="dt-tree-node" style="padding-left: ${e}px">\n ${i}\n <span>${r}</span>\n </span>`}}return`\n <div class="${["dt-cell__content",isHeader?`dt-cell__content--header-${colIndex}`:`dt-cell__content--col-${colIndex}`].join(" ")}">\n ${r}\n ${n}\n ${i}\n ${o}\n </div>\n ${e}\n `}getEditCellHTML(t){return`<div class="dt-cell__edit dt-cell__edit--col-${t}"></div>`}selector(t,e){return`.dt-cell--${t}-${e}`}}class bn{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",pn(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 Cn{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)})}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;this.checkMap=t?Array.from(Array(this.getTotalRows())).map(t=>n):[],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 vn=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());const e=this.datamanager.rowViewOrder.map(t=>{if(this.visibleRowIndices.includes(t))return t;return null}).filter(t=>null!==t),n=getComputedStyle(this.bodyScrollable);let i={width:n.width,height:n.height,itemHeight:this.options.cellHeight,total:t.length,generate:t=>{const n=document.createElement("div");const i=e[t];const o=this.datamanager.getRow(i);const s=this.rowmanager.getRowHTML(o,o.meta);n.innerHTML=s;return n.children[0]},afterRender:()=>{this.restoreState()}};this.hyperlist?this.hyperlist.refresh(this.bodyScrollable,i):this.hyperlist=new vn(this.bodyScrollable,i),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 xn{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=fn(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: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 Rn={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 In{constructor(t){this.listeners={},e.on(t,"keydown",this.handler.bind(this))}handler(t){let e=Rn[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 Sn={"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"}},Hn={"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"}},Tn={"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"}},En={"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 kn{constructor(t){this.language=t,this.translations=mt()}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),pt(n,e||{})}getPluralizedTranslation(t,e){return t[e]||t.default}}let Mn={DataManager:mn,CellManager:yn,ColumnManager:bn,RowManager:Cn,BodyRenderer:_n,Style:xn,Keyboard:In};class Ln{constructor(t,e){if(Ln.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 kn(this.language),t.translations&&this.translationManager.addTranslations(t.translations)}setDefaultOptions(){this.DEFAULT_OPTIONS=bt(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({},Mn,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)}}Ln.instances=0;var $n={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:"Faris Ansari",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 Ln.__version__=$n.version,Ln}(Sortable);
|
|
1
|
+
var DataTable=function(t){"use strict";function e(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function n(){const t=document.createElement("div");e.style(t,{width:"100px",height:"100px",overflow:"scroll",position:"absolute",top:"-9999px"}),document.body.appendChild(t);const n=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),n}function i(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function o(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function s(t){var e=Et.call(t,Mt),n=t[Mt];try{t[Mt]=void 0}catch(t){}var i=kt.call(t);return e?t[Mt]=n:delete t[Mt],i}function r(t){return $t.call(t)}function l(t){return null==t?void 0===t?jt:Ft:At&&At in Object(t)?Lt(t):Ot(t)}function a(t){return null!=t&&"object"==typeof t}function c(t){return"symbol"==typeof t||Wt(t)&&Dt(t)==zt}function u(t){if("number"==typeof t)return t;if(Nt(t))return Pt;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(Bt,"");var n=qt.test(t);return n||Kt.test(t)?Ut(t.slice(2),n?2:8):Vt.test(t)?Pt:+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?Yt(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=St();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(St())}function h(){var t=St(),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(Xt);return e=Zt(e)||0,vt(n)&&(b=!!n.leading,m=(C="maxWait"in n)?Gt(Zt(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(Qt);return vt(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Jt(t,e,{leading:i,maxWait:e,trailing:o})}function f(t){if(!vt(t))return!1;var e=Dt(t);return e==ne||e==ie||e==ee||e==oe}function m(t){return!!le&&le in t}function p(t){if(null!=t){try{return ce.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function g(t){return!(!vt(t)||ae(t))&&(se(t)?ge:he).test(ue(t))}function w(t,e){return null==t?void 0:t[e]}function y(t,e){var n=ye(t,e);return we(n)?n:void 0}function b(){this.__data__=Ce?Ce(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(Ce){var n=e[t];return n===xe?void 0:n}return Re.call(e,t)?e[t]:void 0}function _(t){var e=this.__data__;return Ce?void 0!==e[t]:Se.call(e,t)}function x(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ce&&void 0===e?Te: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 H(t,e){for(var n=t.length;n--;)if(Le(t[n][0],e))return n;return-1}function T(t){var e=this.__data__,n=$e(e,t);return!(n<0)&&(n==e.length-1?e.pop():Oe.call(e,n,1),--this.size,!0)}function E(t){var e=this.__data__,n=$e(e,t);return n<0?void 0:e[n][1]}function k(t){return $e(this.__data__,t)>-1}function M(t,e){var n=this.__data__,i=$e(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 ke,map:new(ze||We),string:new ke}}function O(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function F(t,e){var n=t.__data__;return Pe(e)?n["string"==typeof e?"string":"hash"]:n.map}function j(t){var e=Be(this,t).delete(t);return this.size-=e?1:0,e}function A(t){return Be(this,t).get(t)}function D(t){return Be(this,t).has(t)}function W(t,e){var n=Be(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,Xe),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 Ze;++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?en(t,e,n):Qe(t,tn,n)}function Z(t,e){return!!(null==t?0:t.length)&&nn(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=on,s=t.length,r=!0,l=[],a=l;if(n)r=!1,o=sn;else if(s>=hn){var c=e?null:un(t);if(c)return cn(c);r=!1,o=rn,a=new Je}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?dn(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 fn(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:Hn,de:Tn,fr:En,it:kn}}function wt(t,e){let n=[];if(0===Object.keys(e).length)return t.map(t=>t.meta.rowIndex);for(let i in e){const o=e[i],s=n.length?n.map(e=>t[e]):t,r=s.map(t=>t[i]);let l=bt(o),a=yt(t,l);n=a?a(l.text,r):r.map(t=>t.rowIndex)}return n}function yt(t,e){const n=e=>{let n=bn.getCustomCellFormatter(e);if(n&&e.content)return e.html=n(e.content,t[e.rowIndex],e.column,t[e.rowIndex],!0),ft(e.html);return e.content||""},i=t=>String(ft(t.html||"")||n(t)).toLowerCase(),o=t=>parseFloat(t.content),s=(t,e)=>{if(t.column.compareValue){const n=t.column.compareValue(t,e);if(n&&Array.isArray(n))return n}const n=o(t);if(!isNaN(n))return[n,e];return[i(t),e]};return{contains(t,e){return e.filter(e=>{const n=i(e);const o=(t||"").toLowerCase();return!o||n.includes(o)}).map(t=>t.rowIndex)},greaterThan(t,e){return e.filter(e=>{const[n,i]=s(e,t);return n>i}).map(t=>t.rowIndex)},lessThan(t,e){return e.filter(e=>{const[n,i]=s(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=s(e,t[0]);const i=s(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 s=t;let r=o(e);let l=i(e);return n===r||l.includes(s)}).map(t=>t.rowIndex)}}[e.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:yn.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=function(){return It.Date.now()},Ht=It.Symbol,Tt=Object.prototype,Et=Tt.hasOwnProperty,kt=Tt.toString,Mt=Ht?Ht.toStringTag:void 0,Lt=s,$t=Object.prototype.toString,Ot=r,Ft="[object Null]",jt="[object Undefined]",At=Ht?Ht.toStringTag:void 0,Dt=l,Wt=a,zt="[object Symbol]",Nt=c,Pt=NaN,Bt=/^\s+|\s+$/g,Vt=/^[-+]0x[0-9a-f]+$/i,qt=/^0b[01]+$/i,Kt=/^0o[0-7]+$/i,Ut=parseInt,Zt=u,Xt="Expected a function",Gt=Math.max,Yt=Math.min,Jt=h,Qt="Expected a function",te=d,ee="[object AsyncFunction]",ne="[object Function]",ie="[object GeneratorFunction]",oe="[object Proxy]",se=f,re=It["__core-js_shared__"],le=function(){var t=/[^.]+$/.exec(re&&re.keys&&re.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ae=m,ce=Function.prototype.toString,ue=p,he=/^\[object .+?Constructor\]$/,de=Function.prototype,fe=Object.prototype,me=de.toString,pe=fe.hasOwnProperty,ge=RegExp("^"+me.call(pe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),we=g,ye=w,be=y,Ce=be(Object,"create"),ve=b,_e=C,xe="__lodash_hash_undefined__",Re=Object.prototype.hasOwnProperty,Ie=v,Se=Object.prototype.hasOwnProperty,He=_,Te="__lodash_hash_undefined__",Ee=x;R.prototype.clear=ve,R.prototype.delete=_e,R.prototype.get=Ie,R.prototype.has=He,R.prototype.set=Ee;var ke=R,Me=I,Le=S,$e=H,Oe=Array.prototype.splice,Fe=T,je=E,Ae=k,De=M;L.prototype.clear=Me,L.prototype.delete=Fe,L.prototype.get=je,L.prototype.has=Ae,L.prototype.set=De;var We=L,ze=be(It,"Map"),Ne=$,Pe=O,Be=F,Ve=j,qe=A,Ke=D,Ue=W;z.prototype.clear=Ne,z.prototype.delete=Ve,z.prototype.get=qe,z.prototype.has=Ke,z.prototype.set=Ue;var Ze=z,Xe="__lodash_hash_undefined__",Ge=N,Ye=P;B.prototype.add=B.prototype.push=Ge,B.prototype.has=Ye;var Je=B,Qe=V,tn=q,en=K,nn=U,on=Z,sn=X,rn=G,ln=be(It,"Set"),an=Y,cn=J,un=ln&&1/cn(new ln([,-0]))[1]==1/0?function(t){return new ln(t)}:an,hn=200,dn=Q,fn=tt;let mn=te,pn=Jt;class gn{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.prepareRows(),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(){this.validateData(this.data),this.rows=this.data.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 wn("`columns` must be an array");t.forEach((t,e)=>{if("string"!=typeof t&&"object"!=typeof t)throw new wn(`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 wn("`data` must be an array of arrays or objects")}appendRows(t){this.validateData(t),this.rows.push(...this.prepareRows(t))}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).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 wn extends TypeError{}let yn={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 bn{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",mn(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=bn.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">${yn.chevronDown}</span>\n <span class="icon-close">${yn.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 Cn{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",pn(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 vn{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 xn{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());const e=this.datamanager.rowViewOrder.map(t=>{if(this.visibleRowIndices.includes(t))return t;return null}).filter(t=>null!==t),n=getComputedStyle(this.bodyScrollable);let i={width:n.width,height:n.height,itemHeight:this.options.cellHeight,total:t.length,generate:t=>{const n=document.createElement("div");const i=e[t];const o=this.datamanager.getRow(i);const s=this.rowmanager.getRowHTML(o,o.meta);n.innerHTML=s;return n.children[0]},afterRender:()=>{this.restoreState()}};this.hyperlist?this.hyperlist.refresh(this.bodyScrollable,i):this.hyperlist=new _n(this.bodyScrollable,i),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 Rn{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=mn(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: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 In={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 Sn{constructor(t){this.listeners={},e.on(t,"keydown",this.handler.bind(this))}handler(t){let e=In[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 Hn={"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"}},Tn={"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"}},En={"Sort Ascending":"Trier par ordre croissant","Sort Descending":"Trier par ordre décroissant","Reset sorting":"Réinitialiser le tri","Remove column":"Supprimer colonne","No Data":"Pas de données","{count} cells copied":{1:"{count} cellule copiée",default:"{count} cellules copiées"},"{count} rows selected":{1:"{count} ligne sélectionnée",default:"{count} lignes sélectionnées"}},kn={"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 Mn{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 Ln={DataManager:gn,CellManager:bn,ColumnManager:Cn,RowManager:vn,BodyRenderer:xn,Style:Rn,Keyboard:Sn};class $n{constructor(t,e){if($n.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 Mn(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({},Ln,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)}}$n.instances=0;var On={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 $n.__version__=On.version,$n}(Sortable);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melondtable",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.3",
|
|
4
4
|
"description": "A modern datatable library for the web",
|
|
5
5
|
"main": "dist/melondtable.cjs.js",
|
|
6
6
|
"unpkg": "dist/melondtable.min.js",
|
|
@@ -59,6 +59,8 @@
|
|
|
59
59
|
"grid",
|
|
60
60
|
"table"
|
|
61
61
|
],
|
|
62
|
+
"author": "Alphamonak Solutions",
|
|
63
|
+
"homepage": "https://devel.monakerp.com/datatable",
|
|
62
64
|
"dependencies": {
|
|
63
65
|
"hyperlist": "^1.0.0-beta",
|
|
64
66
|
"lodash": "^4.17.5",
|
package/src/cellmanager.js
CHANGED
|
@@ -2,7 +2,8 @@ import {
|
|
|
2
2
|
copyTextToClipboard,
|
|
3
3
|
makeDataAttributeString,
|
|
4
4
|
throttle,
|
|
5
|
-
linkProperties
|
|
5
|
+
linkProperties,
|
|
6
|
+
escapeHTML,
|
|
6
7
|
} from './utils';
|
|
7
8
|
import $ from './dom';
|
|
8
9
|
import icons from './icons';
|
|
@@ -527,7 +528,7 @@ export default class CellManager {
|
|
|
527
528
|
const done = editor.setValue(value, rowIndex, col);
|
|
528
529
|
|
|
529
530
|
// update cell immediately
|
|
530
|
-
this.updateCell(colIndex, rowIndex, value);
|
|
531
|
+
this.updateCell(colIndex, rowIndex, value, true);
|
|
531
532
|
$cell.focus();
|
|
532
533
|
|
|
533
534
|
if (done && done.then) {
|
|
@@ -605,7 +606,7 @@ export default class CellManager {
|
|
|
605
606
|
let rowIndex = i + focusedCell.rowIndex;
|
|
606
607
|
row.forEach((cell, j) => {
|
|
607
608
|
let colIndex = j + focusedCell.colIndex;
|
|
608
|
-
this.updateCell(colIndex, rowIndex, cell);
|
|
609
|
+
this.updateCell(colIndex, rowIndex, cell, true);
|
|
609
610
|
});
|
|
610
611
|
});
|
|
611
612
|
}
|
|
@@ -620,16 +621,16 @@ export default class CellManager {
|
|
|
620
621
|
}
|
|
621
622
|
}
|
|
622
623
|
|
|
623
|
-
updateCell(colIndex, rowIndex, value) {
|
|
624
|
+
updateCell(colIndex, rowIndex, value, refreshHtml = false) {
|
|
624
625
|
const cell = this.datamanager.updateCell(colIndex, rowIndex, {
|
|
625
626
|
content: value
|
|
626
627
|
});
|
|
627
|
-
this.refreshCell(cell);
|
|
628
|
+
this.refreshCell(cell, refreshHtml);
|
|
628
629
|
}
|
|
629
630
|
|
|
630
|
-
refreshCell(cell) {
|
|
631
|
+
refreshCell(cell, refreshHtml = false) {
|
|
631
632
|
const $cell = $(this.selector(cell.colIndex, cell.rowIndex), this.bodyScrollable);
|
|
632
|
-
$cell.innerHTML = this.getCellContent(cell);
|
|
633
|
+
$cell.innerHTML = this.getCellContent(cell, refreshHtml);
|
|
633
634
|
}
|
|
634
635
|
|
|
635
636
|
toggleTreeButton(rowIndex, flag) {
|
|
@@ -804,7 +805,7 @@ export default class CellManager {
|
|
|
804
805
|
`;
|
|
805
806
|
}
|
|
806
807
|
|
|
807
|
-
getCellContent(cell) {
|
|
808
|
+
getCellContent(cell, refreshHtml = false) {
|
|
808
809
|
const {
|
|
809
810
|
isHeader,
|
|
810
811
|
isFilter,
|
|
@@ -827,15 +828,18 @@ export default class CellManager {
|
|
|
827
828
|
const hasDropdown = isHeader && cell.dropdown !== false;
|
|
828
829
|
const dropdown = hasDropdown ? this.columnmanager.getDropdownHTML() : '';
|
|
829
830
|
|
|
830
|
-
|
|
831
|
-
|
|
831
|
+
let customFormatter = CellManager.getCustomCellFormatter(cell);
|
|
832
832
|
let contentHTML;
|
|
833
833
|
if (isHeader || isFilter || !customFormatter) {
|
|
834
834
|
contentHTML = cell.content;
|
|
835
835
|
} else {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
836
|
+
if (!cell.html || refreshHtml) {
|
|
837
|
+
const row = this.datamanager.getRow(cell.rowIndex);
|
|
838
|
+
const data = this.datamanager.getData(cell.rowIndex);
|
|
839
|
+
contentHTML = customFormatter(cell.content, row, cell.column, data);
|
|
840
|
+
} else {
|
|
841
|
+
contentHTML = cell.html;
|
|
842
|
+
}
|
|
839
843
|
}
|
|
840
844
|
|
|
841
845
|
cell.html = contentHTML;
|
|
@@ -867,7 +871,7 @@ export default class CellManager {
|
|
|
867
871
|
isHeader ? `dt-cell__content--header-${colIndex}` : `dt-cell__content--col-${colIndex}`
|
|
868
872
|
].join(' ');
|
|
869
873
|
|
|
870
|
-
|
|
874
|
+
let cellContentHTML = `
|
|
871
875
|
<div class="${className}">
|
|
872
876
|
${contentHTML}
|
|
873
877
|
${sortIndicator}
|
|
@@ -876,6 +880,16 @@ export default class CellManager {
|
|
|
876
880
|
</div>
|
|
877
881
|
${editCellHTML}
|
|
878
882
|
`;
|
|
883
|
+
|
|
884
|
+
let div = document.createElement('div');
|
|
885
|
+
div.innerHTML = contentHTML;
|
|
886
|
+
|
|
887
|
+
let textContent = div.textContent;
|
|
888
|
+
textContent = textContent.replace(/\s+/g, ' ').trim();
|
|
889
|
+
|
|
890
|
+
cellContentHTML = cellContentHTML.replace('>', ` title="${escapeHTML(textContent)}">`);
|
|
891
|
+
|
|
892
|
+
return cellContentHTML;
|
|
879
893
|
}
|
|
880
894
|
|
|
881
895
|
getEditCellHTML(colIndex) {
|
|
@@ -885,4 +899,8 @@ export default class CellManager {
|
|
|
885
899
|
selector(colIndex, rowIndex) {
|
|
886
900
|
return `.dt-cell--${colIndex}-${rowIndex}`;
|
|
887
901
|
}
|
|
902
|
+
|
|
903
|
+
static getCustomCellFormatter(cell) {
|
|
904
|
+
return cell.format || (cell.column && cell.column.format) || null;
|
|
905
|
+
}
|
|
888
906
|
}
|
package/src/filterRows.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isNumber, stripHTML } from './utils';
|
|
2
|
+
import CellManager from './cellmanager';
|
|
2
3
|
|
|
3
4
|
export default function filterRows(rows, filters) {
|
|
4
5
|
let filteredRowIndices = [];
|
|
@@ -17,7 +18,7 @@ export default function filterRows(rows, filters) {
|
|
|
17
18
|
const cells = filteredRows.map(row => row[colIndex]);
|
|
18
19
|
|
|
19
20
|
let filter = guessFilter(keyword);
|
|
20
|
-
let filterMethod = getFilterMethod(filter);
|
|
21
|
+
let filterMethod = getFilterMethod(rows, filter);
|
|
21
22
|
|
|
22
23
|
if (filterMethod) {
|
|
23
24
|
filteredRowIndices = filterMethod(filter.text, cells);
|
|
@@ -29,9 +30,18 @@ export default function filterRows(rows, filters) {
|
|
|
29
30
|
return filteredRowIndices;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
function getFilterMethod(filter) {
|
|
33
|
+
function getFilterMethod(rows, filter) {
|
|
34
|
+
const getFormattedValue = cell => {
|
|
35
|
+
let formatter = CellManager.getCustomCellFormatter(cell);
|
|
36
|
+
if (formatter && cell.content) {
|
|
37
|
+
cell.html = formatter(cell.content, rows[cell.rowIndex], cell.column, rows[cell.rowIndex], true);
|
|
38
|
+
return stripHTML(cell.html);
|
|
39
|
+
}
|
|
40
|
+
return cell.content || '';
|
|
41
|
+
};
|
|
42
|
+
|
|
33
43
|
const stringCompareValue = cell =>
|
|
34
|
-
String(stripHTML(cell.html || '') || cell
|
|
44
|
+
String(stripHTML(cell.html || '') || getFormattedValue(cell)).toLowerCase();
|
|
35
45
|
|
|
36
46
|
const numberCompareValue = cell => parseFloat(cell.content);
|
|
37
47
|
|
|
@@ -179,7 +189,7 @@ function guessFilter(keyword = '') {
|
|
|
179
189
|
}
|
|
180
190
|
}
|
|
181
191
|
|
|
182
|
-
if (keyword.split(':').length === 2) {
|
|
192
|
+
if (keyword.split(':').length === 2 && keyword.split(':').every(v => isNumber(v.trim()))) {
|
|
183
193
|
compareString = keyword.split(':');
|
|
184
194
|
return {
|
|
185
195
|
type: 'range',
|
package/src/rowmanager.js
CHANGED
|
@@ -67,7 +67,7 @@ export default class RowManager {
|
|
|
67
67
|
const _row = this.datamanager.updateRow(row, rowIndex);
|
|
68
68
|
|
|
69
69
|
_row.forEach(cell => {
|
|
70
|
-
this.cellmanager.refreshCell(cell);
|
|
70
|
+
this.cellmanager.refreshCell(cell, true);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -113,7 +113,13 @@ export default class RowManager {
|
|
|
113
113
|
|
|
114
114
|
// update internal map
|
|
115
115
|
if (toggle) {
|
|
116
|
-
|
|
116
|
+
if (this.datamanager._filteredRows) {
|
|
117
|
+
this.datamanager._filteredRows.forEach(f => {
|
|
118
|
+
this.checkRow(f, toggle);
|
|
119
|
+
});
|
|
120
|
+
} else {
|
|
121
|
+
this.checkMap = Array.from(Array(this.getTotalRows())).map(c => value);
|
|
122
|
+
}
|
|
117
123
|
} else {
|
|
118
124
|
this.checkMap = [];
|
|
119
125
|
}
|
|
@@ -353,7 +359,7 @@ export default class RowManager {
|
|
|
353
359
|
getFilterInput(props) {
|
|
354
360
|
let title = `title="Filter based on ${props.name || 'Index'}"`;
|
|
355
361
|
const dataAttr = makeDataAttributeString(props);
|
|
356
|
-
return `<input class="dt-filter dt-input" type="text" ${dataAttr} tabindex="1"
|
|
362
|
+
return `<input class="dt-filter dt-input" type="text" ${dataAttr} tabindex="1"
|
|
357
363
|
${props.colIndex === 0 ? 'disabled' : title} />`;
|
|
358
364
|
}
|
|
359
365
|
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import en from './en.json';
|
|
2
|
-
import fr from './fr.json';
|
|
3
2
|
import pt from './pt.json';
|
|
3
|
+
import fr from './fr.json';
|
|
4
4
|
import sw from './sw.json';
|
|
5
|
-
import tr from './tr.json';
|
|
6
5
|
|
|
7
|
-
export
|
|
6
|
+
export ptfault function getTranslations() {
|
|
8
7
|
return {
|
|
9
8
|
en,
|
|
10
|
-
fr,
|
|
11
9
|
pt,
|
|
10
|
+
fr,
|
|
12
11
|
sw,
|
|
13
|
-
tr,
|
|
14
12
|
};
|
|
15
13
|
};
|
package/src/translations/pt.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"Sort Ascending": "
|
|
3
|
-
"Sort Descending": "
|
|
4
|
-
"Reset sorting": "
|
|
5
|
-
"Remove column": "
|
|
6
|
-
"No Data": "
|
|
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
7
|
"{count} cells copied": {
|
|
8
|
-
"1": "{count}
|
|
9
|
-
"default": "{count}
|
|
8
|
+
"1": "{count} Zelle kopiert",
|
|
9
|
+
"default": "{count} Zellen kopiert"
|
|
10
10
|
},
|
|
11
11
|
"{count} rows selected": {
|
|
12
|
-
"1": "{count}
|
|
13
|
-
"default": "{count}
|
|
12
|
+
"1": "{count} Zeile ausgewählt",
|
|
13
|
+
"default": "{count} Zeilen ausgewählt"
|
|
14
14
|
}
|
|
15
15
|
}
|
package/src/translations/sw.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"Sort Ascending": "
|
|
3
|
-
"Sort Descending": "
|
|
4
|
-
"Reset sorting": "
|
|
5
|
-
"Remove column": "
|
|
6
|
-
"No Data": "
|
|
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
7
|
"{count} cells copied": {
|
|
8
|
-
"1": "{count}
|
|
9
|
-
"default": "{count}
|
|
8
|
+
"1": "{count} Zelle kopiert",
|
|
9
|
+
"default": "{count} Zellen kopiert"
|
|
10
10
|
},
|
|
11
11
|
"{count} rows selected": {
|
|
12
|
-
"1": "{count}
|
|
13
|
-
"default": "{count}
|
|
12
|
+
"1": "{count} Zeile ausgewählt",
|
|
13
|
+
"default": "{count} Zeilen ausgewählt"
|
|
14
14
|
}
|
|
15
15
|
}
|
package/src/translations/tr.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"Sort Ascending": "
|
|
3
|
-
"Sort Descending": "
|
|
4
|
-
"Reset sorting": "
|
|
5
|
-
"Remove column": "
|
|
6
|
-
"No Data": "
|
|
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
7
|
"{count} cells copied": {
|
|
8
|
-
"1": "{count}
|
|
9
|
-
"default": "{count}
|
|
8
|
+
"1": "Copiato {count} cella",
|
|
9
|
+
"default": "{count} celle copiate"
|
|
10
10
|
},
|
|
11
11
|
"{count} rows selected": {
|
|
12
|
-
"1": "{count}
|
|
13
|
-
"default": "{count}
|
|
12
|
+
"1": "{count} linea selezionata",
|
|
13
|
+
"default": "{count} linee selezionate"
|
|
14
14
|
}
|
|
15
15
|
}
|
package/src/utils.js
CHANGED
|
@@ -149,3 +149,19 @@ export function format(str, args) {
|
|
|
149
149
|
|
|
150
150
|
return str;
|
|
151
151
|
};
|
|
152
|
+
|
|
153
|
+
export function escapeHTML(txt) {
|
|
154
|
+
if (!txt) return '';
|
|
155
|
+
let escapeHtmlMapping = {
|
|
156
|
+
'&': '&',
|
|
157
|
+
'<': '<',
|
|
158
|
+
'>': '>',
|
|
159
|
+
'"': '"',
|
|
160
|
+
"'": ''',
|
|
161
|
+
'/': '/',
|
|
162
|
+
'`': '`',
|
|
163
|
+
'=': '=',
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
return String(txt).replace(/[&<>"'`=/]/g, (char) => escapeHtmlMapping[char] || char);
|
|
167
|
+
};
|