melondtable 1.18.5 → 1.20.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -0
- package/dist/melondtable.cjs.js +267 -24
- package/dist/melondtable.css +38 -3
- package/dist/melondtable.js +362 -77
- package/dist/melondtable.min.css +1 -1
- package/dist/melondtable.min.js +1 -1
- package/package.json +3 -3
- package/src/body-renderer.js +15 -1
- package/src/cellmanager.js +40 -8
- package/src/columnmanager.js +85 -7
- package/src/datamanager.js +5 -6
- package/src/datatable.js +30 -0
- package/src/defaults.js +17 -0
- package/src/style.css +36 -3
- package/src/style.js +58 -1
- package/src/translations/en.json +2 -0
- package/src/translations/fr.json +2 -0
- package/src/translations/index.js +7 -7
- package/src/translations/pt.json +16 -0
- package/src/translations/sw.json +16 -0
- package/src/translations/de.json +0 -15
- package/src/translations/it.json +0 -15
package/LICENSE
CHANGED
package/dist/melondtable.cjs.js
CHANGED
|
@@ -1985,6 +1985,7 @@ class DataManager {
|
|
|
1985
1985
|
sortable: false,
|
|
1986
1986
|
focusable: false,
|
|
1987
1987
|
dropdown: false,
|
|
1988
|
+
sticky: true,
|
|
1988
1989
|
width: 32
|
|
1989
1990
|
};
|
|
1990
1991
|
this.columns.push(cell);
|
|
@@ -1993,16 +1994,14 @@ class DataManager {
|
|
|
1993
1994
|
if (this.options.serialNoColumn && !this.hasColumnById('_rowIndex')) {
|
|
1994
1995
|
let cell = {
|
|
1995
1996
|
id: '_rowIndex',
|
|
1996
|
-
content: '',
|
|
1997
|
+
content: this.options.serialNoColumnLabel || '',
|
|
1997
1998
|
align: 'center',
|
|
1998
1999
|
editable: false,
|
|
1999
|
-
resizable:
|
|
2000
|
+
resizable: true,
|
|
2000
2001
|
focusable: false,
|
|
2001
|
-
dropdown: false
|
|
2002
|
+
dropdown: false,
|
|
2003
|
+
sticky: true
|
|
2002
2004
|
};
|
|
2003
|
-
if (this.options.data.length > 1000) {
|
|
2004
|
-
cell.resizable = true;
|
|
2005
|
-
}
|
|
2006
2005
|
this.columns.push(cell);
|
|
2007
2006
|
}
|
|
2008
2007
|
}
|
|
@@ -2586,6 +2585,7 @@ class CellManager {
|
|
|
2586
2585
|
this.bindKeyboardSelection();
|
|
2587
2586
|
this.bindCopyCellContents();
|
|
2588
2587
|
this.bindMouseEvents();
|
|
2588
|
+
this.bindWheelEvents();
|
|
2589
2589
|
this.bindTreeEvents();
|
|
2590
2590
|
}
|
|
2591
2591
|
|
|
@@ -2634,6 +2634,7 @@ class CellManager {
|
|
|
2634
2634
|
}
|
|
2635
2635
|
|
|
2636
2636
|
this.focusCell($cell);
|
|
2637
|
+
sessionStorage.setItem('dt-last-nav-method', 'key');
|
|
2637
2638
|
return true;
|
|
2638
2639
|
};
|
|
2639
2640
|
|
|
@@ -2742,6 +2743,12 @@ class CellManager {
|
|
|
2742
2743
|
$.on(this.bodyScrollable, 'mousemove', '.dt-cell', throttle$1(selectArea, 50));
|
|
2743
2744
|
}
|
|
2744
2745
|
|
|
2746
|
+
bindWheelEvents() {
|
|
2747
|
+
$.on(this.bodyScrollable, 'wheel', (e) => {
|
|
2748
|
+
sessionStorage.setItem('dt-last-nav-method', 'scroll');
|
|
2749
|
+
});
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2745
2752
|
bindTreeEvents() {
|
|
2746
2753
|
$.on(this.bodyScrollable, 'click', '.dt-tree-node__toggle', (e, $toggle) => {
|
|
2747
2754
|
const $cell = $.closest('.dt-cell', $toggle);
|
|
@@ -2866,11 +2873,13 @@ class CellManager {
|
|
|
2866
2873
|
// this function is called after hyperlist renders the rows after scroll,
|
|
2867
2874
|
// focusCell calls clearSelection which resets the area selection
|
|
2868
2875
|
// so a flag to skip it
|
|
2869
|
-
// we
|
|
2870
|
-
// because it fights with the user scroll
|
|
2876
|
+
// we skip scroll to cell
|
|
2877
|
+
// and also skip DOM focus (if user is scrolling) because it fights with the user scroll
|
|
2878
|
+
const skipDOMFocus = sessionStorage.getItem('dt-last-nav-method') !== 'key';
|
|
2879
|
+
|
|
2871
2880
|
this.focusCell($cell, {
|
|
2881
|
+
skipDOMFocus,
|
|
2872
2882
|
skipClearSelection: 1,
|
|
2873
|
-
skipDOMFocus: 1,
|
|
2874
2883
|
skipScrollToCell: 1
|
|
2875
2884
|
});
|
|
2876
2885
|
}
|
|
@@ -2886,7 +2895,6 @@ class CellManager {
|
|
|
2886
2895
|
|
|
2887
2896
|
_selectArea($cell1, $cell2) {
|
|
2888
2897
|
if ($cell1 === $cell2) return false;
|
|
2889
|
-
|
|
2890
2898
|
const cells = this.getCellsInRange($cell1, $cell2);
|
|
2891
2899
|
if (!cells) return false;
|
|
2892
2900
|
|
|
@@ -2913,9 +2921,17 @@ class CellManager {
|
|
|
2913
2921
|
const cell2 = $.data($cell2);
|
|
2914
2922
|
|
|
2915
2923
|
colIndex1 = +cell1.colIndex;
|
|
2916
|
-
rowIndex1 = +cell1.rowIndex;
|
|
2917
2924
|
colIndex2 = +cell2.colIndex;
|
|
2918
|
-
|
|
2925
|
+
|
|
2926
|
+
if (this.columnmanager.sortState) {
|
|
2927
|
+
this.sortedColumn = true;
|
|
2928
|
+
rowIndex1 = this.datamanager.rowViewOrder.indexOf(parseInt(cell1.rowIndex, 10));
|
|
2929
|
+
rowIndex2 = this.datamanager.rowViewOrder.indexOf(parseInt(cell2.rowIndex, 10));
|
|
2930
|
+
} else {
|
|
2931
|
+
rowIndex1 = +cell1.rowIndex;
|
|
2932
|
+
rowIndex2 = +cell2.rowIndex;
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2919
2935
|
}
|
|
2920
2936
|
|
|
2921
2937
|
if (rowIndex1 > rowIndex2) {
|
|
@@ -2947,7 +2963,11 @@ class CellManager {
|
|
|
2947
2963
|
}
|
|
2948
2964
|
colIndex = colIndex1;
|
|
2949
2965
|
});
|
|
2950
|
-
|
|
2966
|
+
if (this.columnmanager.sortState) {
|
|
2967
|
+
cells.forEach(selectedCells => {
|
|
2968
|
+
selectedCells[1] = this.datamanager.rowViewOrder[selectedCells[1]];
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2951
2971
|
return cells;
|
|
2952
2972
|
}
|
|
2953
2973
|
|
|
@@ -3256,6 +3276,7 @@ class CellManager {
|
|
|
3256
3276
|
}
|
|
3257
3277
|
|
|
3258
3278
|
this.focusCell($cell);
|
|
3279
|
+
sessionStorage.setItem('dt-last-nav-method', 'key');
|
|
3259
3280
|
return true;
|
|
3260
3281
|
}
|
|
3261
3282
|
|
|
@@ -3354,8 +3375,15 @@ class CellManager {
|
|
|
3354
3375
|
});
|
|
3355
3376
|
|
|
3356
3377
|
const row = this.datamanager.getRow(rowIndex);
|
|
3378
|
+
const column = cell.column || this.datamanager.getColumn(colIndex) || {};
|
|
3357
3379
|
|
|
3358
3380
|
const isBodyCell = !(isHeader || isFilter || isTotalRow);
|
|
3381
|
+
const isSticky = Boolean(column.sticky);
|
|
3382
|
+
const stickyColumns = this.datamanager.getColumns().filter(col => col.sticky);
|
|
3383
|
+
const lastStickyColumn = stickyColumns[stickyColumns.length - 1];
|
|
3384
|
+
const isLastStickyColumn = isSticky &&
|
|
3385
|
+
lastStickyColumn &&
|
|
3386
|
+
lastStickyColumn.colIndex === colIndex;
|
|
3359
3387
|
|
|
3360
3388
|
const className = [
|
|
3361
3389
|
'dt-cell',
|
|
@@ -3365,7 +3393,10 @@ class CellManager {
|
|
|
3365
3393
|
isHeader ? 'dt-cell--header' : '',
|
|
3366
3394
|
isHeader ? `dt-cell--header-${colIndex}` : '',
|
|
3367
3395
|
isFilter ? 'dt-cell--filter' : '',
|
|
3368
|
-
isBodyCell && (row && row.meta.isTreeNodeClose) ? 'dt-cell--tree-close' : ''
|
|
3396
|
+
isBodyCell && (row && row.meta.isTreeNodeClose) ? 'dt-cell--tree-close' : '',
|
|
3397
|
+
isSticky ? 'dt-cell--sticky' : '',
|
|
3398
|
+
isSticky && !isBodyCell ? 'dt-cell--sticky-top' : '',
|
|
3399
|
+
isLastStickyColumn ? 'dt-cell--sticky-last' : ''
|
|
3369
3400
|
].join(' ');
|
|
3370
3401
|
|
|
3371
3402
|
return `
|
|
@@ -3563,7 +3594,7 @@ class ColumnManager {
|
|
|
3563
3594
|
});
|
|
3564
3595
|
|
|
3565
3596
|
$.on(this.$dropdownList, 'click', '.dt-dropdown__list-item', (e, $item) => {
|
|
3566
|
-
if (
|
|
3597
|
+
if (this._dropdownActiveColIndex == null) return;
|
|
3567
3598
|
const dropdownItems = this.options.headerDropdown;
|
|
3568
3599
|
const { index } = $.data($item);
|
|
3569
3600
|
const colIndex = this._dropdownActiveColIndex;
|
|
@@ -3578,6 +3609,11 @@ class ColumnManager {
|
|
|
3578
3609
|
_this.hideDropdown();
|
|
3579
3610
|
}
|
|
3580
3611
|
|
|
3612
|
+
this.stickDropdownIndex = this.options.headerDropdown
|
|
3613
|
+
.findIndex(item => item.stickyAction === 'stick');
|
|
3614
|
+
this.unstickDropdownIndex = this.options.headerDropdown
|
|
3615
|
+
.findIndex(item => item.stickyAction === 'unstick');
|
|
3616
|
+
|
|
3581
3617
|
this.hideDropdown();
|
|
3582
3618
|
}
|
|
3583
3619
|
|
|
@@ -3594,6 +3630,7 @@ class ColumnManager {
|
|
|
3594
3630
|
const $cell = $.closest('.dt-cell', e.target);
|
|
3595
3631
|
const { colIndex } = $.data($cell);
|
|
3596
3632
|
this._dropdownActiveColIndex = colIndex;
|
|
3633
|
+
this.updateStickyDropdownItems(this.getColumn(colIndex));
|
|
3597
3634
|
}
|
|
3598
3635
|
|
|
3599
3636
|
hideDropdown() {
|
|
@@ -3737,9 +3774,29 @@ class ColumnManager {
|
|
|
3737
3774
|
.then(() => this.instance.unfreeze())
|
|
3738
3775
|
.then(() => {
|
|
3739
3776
|
this.fireEvent('onSortColumn', this.getColumn(colIndex));
|
|
3777
|
+
this.setSortState();
|
|
3740
3778
|
});
|
|
3741
3779
|
}
|
|
3742
3780
|
|
|
3781
|
+
saveSorting(colIndex) {
|
|
3782
|
+
let currentColumn = this.getColumn(colIndex);
|
|
3783
|
+
let saveSorting = {
|
|
3784
|
+
[currentColumn.name]: {
|
|
3785
|
+
colIndex: colIndex,
|
|
3786
|
+
sortOrder: currentColumn.sortOrder
|
|
3787
|
+
}
|
|
3788
|
+
};
|
|
3789
|
+
this.sortingKey = this.options.sortingKey ? `${this.options.sortingKey}::sortedColumns` : 'sortedColumns' ;
|
|
3790
|
+
localStorage.setItem(this.sortingKey, JSON.stringify(saveSorting));
|
|
3791
|
+
}
|
|
3792
|
+
setSortState(sortOrder) {
|
|
3793
|
+
if (sortOrder === 'none') {
|
|
3794
|
+
this.sortState = false;
|
|
3795
|
+
} else {
|
|
3796
|
+
this.sortState = true;
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3743
3800
|
removeColumn(colIndex) {
|
|
3744
3801
|
const removedCol = this.getColumn(colIndex);
|
|
3745
3802
|
this.instance.freeze();
|
|
@@ -3754,6 +3811,20 @@ class ColumnManager {
|
|
|
3754
3811
|
});
|
|
3755
3812
|
}
|
|
3756
3813
|
|
|
3814
|
+
setColumnSticky(colIndex, sticky) {
|
|
3815
|
+
const column = this.getColumn(colIndex);
|
|
3816
|
+
if (!column || column.sticky === sticky) {
|
|
3817
|
+
return;
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
this.instance.freeze();
|
|
3821
|
+
this.datamanager.updateColumn(colIndex, { sticky });
|
|
3822
|
+
|
|
3823
|
+
this.refreshHeader();
|
|
3824
|
+
this.rowmanager.refreshRows()
|
|
3825
|
+
.then(() => this.instance.unfreeze());
|
|
3826
|
+
}
|
|
3827
|
+
|
|
3757
3828
|
switchColumn(oldIndex, newIndex) {
|
|
3758
3829
|
this.instance.freeze();
|
|
3759
3830
|
this.datamanager.switchColumn(oldIndex, newIndex)
|
|
@@ -3838,6 +3909,19 @@ class ColumnManager {
|
|
|
3838
3909
|
}
|
|
3839
3910
|
}
|
|
3840
3911
|
|
|
3912
|
+
applySavedSortOrder() {
|
|
3913
|
+
|
|
3914
|
+
let key = this.options.sortingKey ? `${this.options.sortingKey}::sortedColumns` : 'sortedColumns' ;
|
|
3915
|
+
let sortingConfig = JSON.parse(localStorage.getItem(key));
|
|
3916
|
+
if (sortingConfig) {
|
|
3917
|
+
const columnsToSort = Object.values(sortingConfig);
|
|
3918
|
+
for (let column of columnsToSort) {
|
|
3919
|
+
this.sortColumn(column.colIndex, column.sortOrder);
|
|
3920
|
+
this.sortState = true;
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
|
|
3841
3925
|
sortRows(colIndex, sortOrder) {
|
|
3842
3926
|
return this.datamanager.sortRows(colIndex, sortOrder);
|
|
3843
3927
|
}
|
|
@@ -3913,14 +3997,39 @@ class ColumnManager {
|
|
|
3913
3997
|
|
|
3914
3998
|
getDropdownListHTML() {
|
|
3915
3999
|
const { headerDropdown: dropdownItems } = this.options;
|
|
3916
|
-
|
|
3917
4000
|
return `
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
4001
|
+
<div class="dt-dropdown__list">
|
|
4002
|
+
${dropdownItems.map((d, i) => `
|
|
4003
|
+
<div
|
|
4004
|
+
class="dt-dropdown__list-item${d.display ? ' dt-hidden' : ''}"
|
|
4005
|
+
data-index="${i}"
|
|
4006
|
+
>
|
|
4007
|
+
${d.label}
|
|
3922
4008
|
</div>
|
|
3923
|
-
|
|
4009
|
+
`).join('')}
|
|
4010
|
+
</div>
|
|
4011
|
+
`;
|
|
4012
|
+
}
|
|
4013
|
+
|
|
4014
|
+
toggleDropdownItem(index) {
|
|
4015
|
+
$('.dt-dropdown__list', this.instance.dropdownContainer).children[index].classList.toggle('dt-hidden');
|
|
4016
|
+
}
|
|
4017
|
+
|
|
4018
|
+
updateStickyDropdownItems(column) {
|
|
4019
|
+
if (!column) return;
|
|
4020
|
+
if (this.stickDropdownIndex === -1 || this.unstickDropdownIndex === -1) return;
|
|
4021
|
+
|
|
4022
|
+
const stickItem = this.$dropdownList.children[this.stickDropdownIndex];
|
|
4023
|
+
const unstickItem = this.$dropdownList.children[this.unstickDropdownIndex];
|
|
4024
|
+
if (!(stickItem && unstickItem)) return;
|
|
4025
|
+
|
|
4026
|
+
if (column.sticky) {
|
|
4027
|
+
stickItem.classList.add('dt-hidden');
|
|
4028
|
+
unstickItem.classList.remove('dt-hidden');
|
|
4029
|
+
} else {
|
|
4030
|
+
stickItem.classList.remove('dt-hidden');
|
|
4031
|
+
unstickItem.classList.add('dt-hidden');
|
|
4032
|
+
}
|
|
3924
4033
|
}
|
|
3925
4034
|
}
|
|
3926
4035
|
|
|
@@ -4789,12 +4898,26 @@ class BodyRenderer {
|
|
|
4789
4898
|
}
|
|
4790
4899
|
|
|
4791
4900
|
render() {
|
|
4792
|
-
const rows = this.
|
|
4901
|
+
const rows = this.getRowsToRender();
|
|
4793
4902
|
this.renderRows(rows);
|
|
4794
4903
|
// setDimensions requires atleast 1 row to exist in dom
|
|
4795
4904
|
this.instance.setDimensions();
|
|
4796
4905
|
}
|
|
4797
4906
|
|
|
4907
|
+
// Keep the current tree expand/collapse state on a full re-render
|
|
4908
|
+
getRowsToRender() {
|
|
4909
|
+
const rows = this.datamanager.getRowsForView();
|
|
4910
|
+
let closedIndent = null;
|
|
4911
|
+
return rows.filter(row => {
|
|
4912
|
+
const { indent, isTreeNodeClose } = row.meta;
|
|
4913
|
+
if (closedIndent !== null && indent > closedIndent) {
|
|
4914
|
+
return false;
|
|
4915
|
+
}
|
|
4916
|
+
closedIndent = isTreeNodeClose ? indent : null;
|
|
4917
|
+
return true;
|
|
4918
|
+
});
|
|
4919
|
+
}
|
|
4920
|
+
|
|
4798
4921
|
renderFooter() {
|
|
4799
4922
|
if (!this.options.showTotalRow) return;
|
|
4800
4923
|
|
|
@@ -4924,6 +5047,7 @@ class Style {
|
|
|
4924
5047
|
|
|
4925
5048
|
bindScrollHeader() {
|
|
4926
5049
|
this._settingHeaderPosition = false;
|
|
5050
|
+
this.updateStickyTopPositions(0);
|
|
4927
5051
|
|
|
4928
5052
|
$.on(this.bodyScrollable, 'scroll', (e) => {
|
|
4929
5053
|
if (this._settingHeaderPosition) return;
|
|
@@ -4931,7 +5055,8 @@ class Style {
|
|
|
4931
5055
|
this._settingHeaderPosition = true;
|
|
4932
5056
|
|
|
4933
5057
|
requestAnimationFrame(() => {
|
|
4934
|
-
const
|
|
5058
|
+
const scrollLeft = e.target.scrollLeft;
|
|
5059
|
+
const left = -scrollLeft;
|
|
4935
5060
|
|
|
4936
5061
|
$.style(this.header, {
|
|
4937
5062
|
transform: `translateX(${left}px)`
|
|
@@ -4939,6 +5064,7 @@ class Style {
|
|
|
4939
5064
|
$.style(this.footer, {
|
|
4940
5065
|
transform: `translateX(${left}px)`
|
|
4941
5066
|
});
|
|
5067
|
+
this.updateStickyTopPositions(scrollLeft);
|
|
4942
5068
|
this._settingHeaderPosition = false;
|
|
4943
5069
|
if (this.instance.noData) {
|
|
4944
5070
|
$.style($('.no-data-message'), {
|
|
@@ -5036,6 +5162,8 @@ class Style {
|
|
|
5036
5162
|
this.setupColumnWidth();
|
|
5037
5163
|
this.distributeRemainingWidth();
|
|
5038
5164
|
this.setColumnStyle();
|
|
5165
|
+
this.setStickyColumnStyle();
|
|
5166
|
+
this.updateStickyTopPositions(this.bodyScrollable.scrollLeft || 0);
|
|
5039
5167
|
this.setBodyStyle();
|
|
5040
5168
|
}
|
|
5041
5169
|
|
|
@@ -5193,6 +5321,8 @@ class Style {
|
|
|
5193
5321
|
this.columnmanager.setColumnHeaderWidth(column.colIndex);
|
|
5194
5322
|
this.columnmanager.setColumnWidth(column.colIndex);
|
|
5195
5323
|
});
|
|
5324
|
+
this.setStickyColumnStyle();
|
|
5325
|
+
this.updateStickyTopPositions(this.bodyScrollable.scrollLeft || 0);
|
|
5196
5326
|
}
|
|
5197
5327
|
|
|
5198
5328
|
setBodyStyle() {
|
|
@@ -5254,6 +5384,56 @@ class Style {
|
|
|
5254
5384
|
return $(`.dt-cell--col-${colIndex}`, this.header);
|
|
5255
5385
|
}
|
|
5256
5386
|
|
|
5387
|
+
setStickyColumnStyle() {
|
|
5388
|
+
if (!this.datamanager || !this.datamanager.getColumns) return;
|
|
5389
|
+
|
|
5390
|
+
const stickySelectors = [];
|
|
5391
|
+
let stickyOffset = 0;
|
|
5392
|
+
let normalOffset = 0;
|
|
5393
|
+
|
|
5394
|
+
this.datamanager.getColumns().forEach((column) => {
|
|
5395
|
+
const $headerCell = this.getColumnHeaderElement(column.colIndex);
|
|
5396
|
+
const renderedWidth = $headerCell ? $headerCell.offsetWidth : column.width;
|
|
5397
|
+
|
|
5398
|
+
if (column.sticky) {
|
|
5399
|
+
const selector = `.dt-cell--col-${column.colIndex}.dt-cell--sticky`;
|
|
5400
|
+
const style = {
|
|
5401
|
+
left: `${stickyOffset}px`
|
|
5402
|
+
};
|
|
5403
|
+
|
|
5404
|
+
column.stickyLeft = stickyOffset;
|
|
5405
|
+
column.stickyScrollTrigger = normalOffset - stickyOffset;
|
|
5406
|
+
column.renderedWidth = renderedWidth;
|
|
5407
|
+
this.setStyle(selector, style);
|
|
5408
|
+
stickySelectors.push(selector);
|
|
5409
|
+
stickyOffset += renderedWidth;
|
|
5410
|
+
}
|
|
5411
|
+
normalOffset += renderedWidth;
|
|
5412
|
+
});
|
|
5413
|
+
|
|
5414
|
+
const staleSelectors = (this._stickySelectors || [])
|
|
5415
|
+
.filter(selector => !stickySelectors.includes(selector));
|
|
5416
|
+
|
|
5417
|
+
staleSelectors.forEach(selector => this.removeStyle(selector));
|
|
5418
|
+
this._stickySelectors = stickySelectors;
|
|
5419
|
+
}
|
|
5420
|
+
|
|
5421
|
+
updateStickyTopPositions(scrollLeft) {
|
|
5422
|
+
if (!this.datamanager || !this.datamanager.getColumns) return;
|
|
5423
|
+
|
|
5424
|
+
const stickyColumns = this.datamanager.getColumns().filter(column => column.sticky);
|
|
5425
|
+
|
|
5426
|
+
stickyColumns.forEach((column) => {
|
|
5427
|
+
const trigger = Math.max(0, column.stickyScrollTrigger || 0);
|
|
5428
|
+
const compensation = Math.max(0, scrollLeft - trigger);
|
|
5429
|
+
const cells = $.each(`.dt-cell--col-${column.colIndex}.dt-cell--sticky-top`, this.wrapper) || [];
|
|
5430
|
+
|
|
5431
|
+
$.style(cells, {
|
|
5432
|
+
transform: compensation ? `translateX(${compensation}px)` : ''
|
|
5433
|
+
});
|
|
5434
|
+
});
|
|
5435
|
+
}
|
|
5436
|
+
|
|
5257
5437
|
getRowIndexColumnWidth() {
|
|
5258
5438
|
const rowCount = this.datamanager.getRowCount();
|
|
5259
5439
|
const padding = 22;
|
|
@@ -5317,7 +5497,11 @@ class Keyboard {
|
|
|
5317
5497
|
}
|
|
5318
5498
|
}
|
|
5319
5499
|
|
|
5500
|
+
var Freeze = "Freeze";
|
|
5501
|
+
var Unfreeze = "Unfreeze";
|
|
5320
5502
|
var en = {
|
|
5503
|
+
Freeze: Freeze,
|
|
5504
|
+
Unfreeze: Unfreeze,
|
|
5321
5505
|
"Sort Ascending": "Sort Ascending",
|
|
5322
5506
|
"Sort Descending": "Sort Descending",
|
|
5323
5507
|
"Reset sorting": "Reset sorting",
|
|
@@ -5327,7 +5511,11 @@ var en = {
|
|
|
5327
5511
|
"{count} rows selected": {"1":"{count} row selected","default":"{count} rows selected"}
|
|
5328
5512
|
};
|
|
5329
5513
|
|
|
5514
|
+
var Freeze$1 = "Bevriezen";
|
|
5515
|
+
var Unfreeze$1 = "Ontdooien";
|
|
5330
5516
|
var de = {
|
|
5517
|
+
Freeze: Freeze$1,
|
|
5518
|
+
Unfreeze: Unfreeze$1,
|
|
5331
5519
|
"Sort Ascending": "Aufsteigend sortieren",
|
|
5332
5520
|
"Sort Descending": "Absteigend sortieren",
|
|
5333
5521
|
"Reset sorting": "Sortierung zurücksetzen",
|
|
@@ -5337,7 +5525,11 @@ var de = {
|
|
|
5337
5525
|
"{count} rows selected": {"1":"{count} Zeile ausgewählt","default":"{count} Zeilen ausgewählt"}
|
|
5338
5526
|
};
|
|
5339
5527
|
|
|
5528
|
+
var Freeze$2 = "Geler";
|
|
5529
|
+
var Unfreeze$2 = "Dégeler";
|
|
5340
5530
|
var fr = {
|
|
5531
|
+
Freeze: Freeze$2,
|
|
5532
|
+
Unfreeze: Unfreeze$2,
|
|
5341
5533
|
"Sort Ascending": "Trier par ordre croissant",
|
|
5342
5534
|
"Sort Descending": "Trier par ordre décroissant",
|
|
5343
5535
|
"Reset sorting": "Réinitialiser le tri",
|
|
@@ -5347,7 +5539,11 @@ var fr = {
|
|
|
5347
5539
|
"{count} rows selected": {"1":"{count} ligne sélectionnée","default":"{count} lignes sélectionnées"}
|
|
5348
5540
|
};
|
|
5349
5541
|
|
|
5542
|
+
var Freeze$3 = "Congelare";
|
|
5543
|
+
var Unfreeze$3 = "Dégeler";
|
|
5350
5544
|
var it = {
|
|
5545
|
+
Freeze: Freeze$3,
|
|
5546
|
+
Unfreeze: Unfreeze$3,
|
|
5351
5547
|
"Sort Ascending": "Ordinamento ascendente",
|
|
5352
5548
|
"Sort Descending": "Ordinamento decrescente",
|
|
5353
5549
|
"Reset sorting": "Azzeramento ordinamento",
|
|
@@ -5629,6 +5825,22 @@ function getDefaultOptions(instance) {
|
|
|
5629
5825
|
action: function (column) {
|
|
5630
5826
|
this.removeColumn(column.colIndex);
|
|
5631
5827
|
}
|
|
5828
|
+
},
|
|
5829
|
+
{
|
|
5830
|
+
label: instance.translate('Freeze'),
|
|
5831
|
+
stickyAction: 'stick',
|
|
5832
|
+
display: 'hidden',
|
|
5833
|
+
action: function (column) {
|
|
5834
|
+
this.setColumnSticky(column.colIndex, true);
|
|
5835
|
+
}
|
|
5836
|
+
},
|
|
5837
|
+
{
|
|
5838
|
+
label: instance.translate('Unfreeze'),
|
|
5839
|
+
stickyAction: 'unstick',
|
|
5840
|
+
display: 'hidden',
|
|
5841
|
+
action: function (column) {
|
|
5842
|
+
this.setColumnSticky(column.colIndex, false);
|
|
5843
|
+
}
|
|
5632
5844
|
}
|
|
5633
5845
|
],
|
|
5634
5846
|
events: {
|
|
@@ -5653,6 +5865,7 @@ function getDefaultOptions(instance) {
|
|
|
5653
5865
|
freezeMessage: '',
|
|
5654
5866
|
getEditor: null,
|
|
5655
5867
|
serialNoColumn: true,
|
|
5868
|
+
serialNoColumnLabel: '',
|
|
5656
5869
|
checkboxColumn: false,
|
|
5657
5870
|
clusterize: true,
|
|
5658
5871
|
logs: false,
|
|
@@ -5703,6 +5916,10 @@ class DataTable {
|
|
|
5703
5916
|
if (this.options.data) {
|
|
5704
5917
|
this.refresh();
|
|
5705
5918
|
this.columnmanager.applyDefaultSortOrder();
|
|
5919
|
+
if (this.options.saveSorting) {
|
|
5920
|
+
this.setupSaveSorting();
|
|
5921
|
+
this.columnmanager.applySavedSortOrder();
|
|
5922
|
+
}
|
|
5706
5923
|
}
|
|
5707
5924
|
}
|
|
5708
5925
|
|
|
@@ -5872,11 +6089,18 @@ class DataTable {
|
|
|
5872
6089
|
sortColumn(colIndex, sortOrder) {
|
|
5873
6090
|
this.columnmanager.sortColumn(colIndex, sortOrder);
|
|
5874
6091
|
}
|
|
6092
|
+
saveSorting(colIndex, nextSortOrder) {
|
|
6093
|
+
this.columnmanager.saveSorting(colIndex, nextSortOrder);
|
|
6094
|
+
}
|
|
5875
6095
|
|
|
5876
6096
|
removeColumn(colIndex) {
|
|
5877
6097
|
this.columnmanager.removeColumn(colIndex);
|
|
5878
6098
|
}
|
|
5879
6099
|
|
|
6100
|
+
setColumnSticky(colIndex, sticky) {
|
|
6101
|
+
this.columnmanager.setColumnSticky(colIndex, sticky);
|
|
6102
|
+
}
|
|
6103
|
+
|
|
5880
6104
|
scrollToLastColumn() {
|
|
5881
6105
|
this.datatableWrapper.scrollLeft = 9999;
|
|
5882
6106
|
}
|
|
@@ -5925,6 +6149,25 @@ class DataTable {
|
|
|
5925
6149
|
translate(str, args) {
|
|
5926
6150
|
return this.translationManager.translate(str, args);
|
|
5927
6151
|
}
|
|
6152
|
+
setupSaveSorting() {
|
|
6153
|
+
// add options in default headerdropdown
|
|
6154
|
+
let action = {
|
|
6155
|
+
label: this.translate('Save Sorting'),
|
|
6156
|
+
action: function (column) {
|
|
6157
|
+
this.saveSorting(column.colIndex, column.sotOrder);
|
|
6158
|
+
},
|
|
6159
|
+
display: 'hidden'
|
|
6160
|
+
};
|
|
6161
|
+
this.options.headerDropdown.push(action);
|
|
6162
|
+
this.columnmanager.bindDropdown();
|
|
6163
|
+
// add events for onSortColumn
|
|
6164
|
+
this.on('onSortColumn', function (column) {
|
|
6165
|
+
this.columnmanager.toggleDropdownItem(4);
|
|
6166
|
+
if (column.sortOrder === 'none') {
|
|
6167
|
+
localStorage.removeItem(this.columnmanager.sortingKey);
|
|
6168
|
+
}
|
|
6169
|
+
});
|
|
6170
|
+
}
|
|
5928
6171
|
}
|
|
5929
6172
|
|
|
5930
6173
|
DataTable.instances = 0;
|
|
@@ -5937,7 +6180,7 @@ var unpkg = "dist/melondtable.min.js";
|
|
|
5937
6180
|
var jsdelivr = "dist/melondtable.min.js";
|
|
5938
6181
|
var 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"};
|
|
5939
6182
|
var files = ["dist","src"];
|
|
5940
|
-
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":"^
|
|
6183
|
+
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":"^25.0.3","start-server-and-test":"^1.4.1","travis-deploy-once":"^5.0.1"};
|
|
5941
6184
|
var repository = {"type":"git","url":"https://github.com/amonak/melondtable.git"};
|
|
5942
6185
|
var keywords = ["datatable","data","grid","table"];
|
|
5943
6186
|
var author = "Alphamonak Solutions";
|
package/dist/melondtable.css
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
--dt-header-cell-bg: #fff;
|
|
20
20
|
--dt-header-cell-bg: var(--dt-cell-bg);
|
|
21
21
|
--dt-no-data-message-width: 90px;
|
|
22
|
+
--dt-scroll-left: 0px;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
.datatable *, .datatable *::after, .datatable *::before {
|
|
@@ -79,7 +80,7 @@
|
|
|
79
80
|
display: none;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
.dt-row:last-child:not(.dt-row-filter) {
|
|
83
|
+
.dt-row:last-child:not(.dt-row-filter) .dt-cell {
|
|
83
84
|
border-bottom: 1px solid #d1d8dd;
|
|
84
85
|
border-bottom: 1px solid var(--dt-border-color);
|
|
85
86
|
}
|
|
@@ -88,7 +89,7 @@
|
|
|
88
89
|
border: 1px solid #d1d8dd;
|
|
89
90
|
border: 1px solid var(--dt-border-color);
|
|
90
91
|
border-bottom: none;
|
|
91
|
-
border-
|
|
92
|
+
border-left: none;
|
|
92
93
|
position: relative;
|
|
93
94
|
outline: none;
|
|
94
95
|
padding: 0;
|
|
@@ -106,8 +107,14 @@
|
|
|
106
107
|
-moz-user-select: none;
|
|
107
108
|
-ms-user-select: none;
|
|
108
109
|
user-select: none;
|
|
110
|
+
|
|
109
111
|
}
|
|
110
112
|
|
|
113
|
+
.dt-cell:first-child {
|
|
114
|
+
border-left: 1px solid #d1d8dd;
|
|
115
|
+
border-left: 1px solid var(--dt-border-color);
|
|
116
|
+
}
|
|
117
|
+
|
|
111
118
|
.dt-cell__content {
|
|
112
119
|
padding: 0.5rem;
|
|
113
120
|
padding: var(--dt-spacer-2);
|
|
@@ -198,6 +205,29 @@
|
|
|
198
205
|
border-right: 1px solid var(--dt-border-color);
|
|
199
206
|
}
|
|
200
207
|
|
|
208
|
+
.dt-cell--sticky {
|
|
209
|
+
position: -webkit-sticky;
|
|
210
|
+
position: sticky;
|
|
211
|
+
left: 0;
|
|
212
|
+
z-index: 1;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.dt-cell--sticky-top {
|
|
216
|
+
z-index: 4;
|
|
217
|
+
will-change: transform;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.dt-cell--sticky-last::after {
|
|
221
|
+
content: '';
|
|
222
|
+
position: absolute;
|
|
223
|
+
top: 0;
|
|
224
|
+
right: -1px;
|
|
225
|
+
width: 8px;
|
|
226
|
+
height: 100%;
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
box-shadow: 4px 0 6px -4px rgba(15, 23, 42, 0.2);
|
|
229
|
+
}
|
|
230
|
+
|
|
201
231
|
.datatable[dir=rtl] .dt-cell__resize-handle {
|
|
202
232
|
right: unset;
|
|
203
233
|
left: -3px;
|
|
@@ -235,7 +265,7 @@
|
|
|
235
265
|
.dt-dropdown__list {
|
|
236
266
|
position: fixed;
|
|
237
267
|
min-width: 8rem;
|
|
238
|
-
z-index:
|
|
268
|
+
z-index: 10;
|
|
239
269
|
cursor: pointer;
|
|
240
270
|
background-color: #fff;
|
|
241
271
|
background-color: var(--dt-cell-bg);
|
|
@@ -279,6 +309,7 @@
|
|
|
279
309
|
left: 50%;
|
|
280
310
|
-webkit-transform: translateX(-50%);
|
|
281
311
|
transform: translateX(-50%);
|
|
312
|
+
z-index: 5;
|
|
282
313
|
}
|
|
283
314
|
|
|
284
315
|
.dt-toast__message {
|
|
@@ -335,6 +366,10 @@
|
|
|
335
366
|
left: -999em;
|
|
336
367
|
}
|
|
337
368
|
|
|
369
|
+
.dt-hidden{
|
|
370
|
+
display: none;
|
|
371
|
+
}
|
|
372
|
+
|
|
338
373
|
body.dt-resize {
|
|
339
374
|
cursor: col-resize;
|
|
340
375
|
}
|