Skip to content

Commit 579f23d

Browse files
committed
- move group rows refresh to correct module
refs #4219 refs #4525
1 parent c272b0f commit 579f23d

File tree

6 files changed

+161
-95
lines changed

6 files changed

+161
-95
lines changed

dist/js/tabulator_esm.js

Lines changed: 79 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Tabulator v6.3.0 (c) Oliver Folkerd 2025 */
1+
/* Tabulator v6.3.1 (c) Oliver Folkerd 2025 */
22
class CoreFeature{
33

44
constructor(table){
@@ -2968,10 +2968,15 @@ class Column extends CoreFeature{
29682968

29692969
if(maxWidth){
29702970
var setTo = maxWidth + 1;
2971-
if (this.maxInitialWidth && !force) {
2972-
setTo = Math.min(setTo, this.maxInitialWidth);
2971+
2972+
if(force){
2973+
this.setWidth(setTo);
2974+
}else {
2975+
if (this.maxInitialWidth && !force) {
2976+
setTo = Math.min(setTo, this.maxInitialWidth);
2977+
}
2978+
this.setWidthActual(setTo);
29732979
}
2974-
this.setWidthActual(setTo);
29752980
}
29762981
}
29772982
}
@@ -4395,6 +4400,7 @@ class DataTree extends Module{
43954400

43964401
this.subscribe("row-init", this.initializeRow.bind(this));
43974402
this.subscribe("row-layout-after", this.layoutRow.bind(this));
4403+
this.subscribe("row-deleting", this.rowDeleting.bind(this));
43984404
this.subscribe("row-deleted", this.rowDelete.bind(this),0);
43994405
this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
44004406
this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
@@ -4734,6 +4740,18 @@ class DataTree extends Module{
47344740
return output;
47354741
}
47364742

4743+
rowDeleting(row){
4744+
var config = row.modules.dataTree;
4745+
4746+
if (config && config.children && Array.isArray(config.children)){
4747+
config.children.forEach((childRow) => {
4748+
if(childRow instanceof Row){
4749+
childRow.wipe();
4750+
}
4751+
});
4752+
}
4753+
}
4754+
47374755
rowDelete(row){
47384756
var parent = row.modules.dataTree.parent,
47394757
childIndex;
@@ -5250,7 +5268,6 @@ class Download extends Module{
52505268
this.registerTableOption("downloadEncoder", function(data, mimeType){
52515269
return new Blob([data],{type:mimeType});
52525270
}); //function to manipulate download data
5253-
// this.registerTableOption("downloadReady", undefined); //warn of function deprecation
52545271
this.registerTableOption("downloadConfig", {}); //download config
52555272
this.registerTableOption("downloadRowRange", "active"); //restrict download to active rows only
52565273

@@ -5266,7 +5283,7 @@ class Download extends Module{
52665283
}
52675284

52685285
deprecatedOptionsCheck(){
5269-
// this.deprecationCheck("downloadReady", "downloadEncoder");
5286+
52705287
}
52715288

52725289
///////////////////////////////////
@@ -12352,6 +12369,7 @@ class GroupRows extends Module{
1235212369
this.subscribe("rows-sample", this.rowSample.bind(this));
1235312370

1235412371
this.subscribe("render-virtual-fill", this.virtualRenderFill.bind(this));
12372+
this.subscribe("table-layout", this.virtualRenderFill.bind(this));
1235512373

1235612374
this.registerDisplayHandler(this.displayHandler, 20);
1235712375

@@ -17826,7 +17844,7 @@ class ReactiveData extends Module{
1782617844
enumerable: true,
1782717845
configurable:true,
1782817846
writable:true,
17829-
value: this.origFuncs.key,
17847+
value: this.origFuncs[key],
1783017848
});
1783117849
}
1783217850
}
@@ -18614,7 +18632,7 @@ class ResizeTable extends Module{
1861418632

1861518633
initializeVisibilityObserver(){
1861618634
this.visibilityObserver = new IntersectionObserver((entries) => {
18617-
this.visible = entries[0].isIntersecting;
18635+
this.visible = entries[entries.length - 1].isIntersecting;
1861818636

1861918637
if(!this.initialized){
1862018638
this.initialized = true;
@@ -19736,8 +19754,8 @@ class Range extends CoreFeature{
1973619754
this.right = 0;
1973719755

1973819756
this.table = table;
19739-
this.start = {row:0, col:0};
19740-
this.end = {row:0, col:0};
19757+
this.start = {row:undefined, col:undefined};
19758+
this.end = {row:undefined, col:undefined};
1974119759

1974219760
if(this.rangeManager.rowHeader){
1974319761
this.left = 1;
@@ -20668,13 +20686,15 @@ class SelectRange extends Module {
2066820686
///////////////////////////////////
2066920687

2067020688
keyNavigate(dir, e){
20671-
if(this.navigate(false, false, dir));
20672-
e.preventDefault();
20689+
if(this.navigate(false, false, dir)){
20690+
e.preventDefault();
20691+
}
2067320692
}
2067420693

2067520694
keyNavigateRange(e, dir, jump, expand){
20676-
if(this.navigate(jump, expand, dir));
20677-
e.preventDefault();
20695+
if(this.navigate(jump, expand, dir)){
20696+
e.preventDefault();
20697+
}
2067820698
}
2067920699

2068020700
navigate(jump, expand, dir) {
@@ -20792,9 +20812,8 @@ class SelectRange extends Module {
2079220812
}
2079320813

2079420814
this.layoutElement();
20795-
20796-
return true;
2079720815
}
20816+
return true;
2079820817
}
2079920818

2080020819
rangeRemoved(removed){
@@ -20808,7 +20827,7 @@ class SelectRange extends Module {
2080820827
}
2080920828
}
2081020829

20811-
this.layoutElement();
20830+
this.layoutElement(true);
2081220831
}
2081320832

2081420833
findJumpRow(column, rows, reverse, emptyStart, emptySide){
@@ -20950,11 +20969,11 @@ class SelectRange extends Module {
2095020969
}
2095120970

2095220971
if (event.shiftKey) {
20953-
this.activeRange.setBounds(false, element);
20972+
this.activeRange.setBounds(false, element, true);
2095420973
} else if (event.ctrlKey) {
20955-
this.addRange().setBounds(element);
20974+
this.addRange().setBounds(element, undefined, true);
2095620975
} else {
20957-
this.resetRanges().setBounds(element);
20976+
this.resetRanges().setBounds(element, undefined, true);
2095820977
}
2095920978
}
2096020979

@@ -23737,7 +23756,7 @@ class VirtualDomHorizontal extends Renderer{
2373723756
if(column.visible){
2373823757
if(!column.modules.frozen){
2373923758
width = column.getWidth();
23740-
23759+
2374123760
config.leftPos = colPos;
2374223761
config.rightPos = colPos + width;
2374323762

@@ -23795,7 +23814,7 @@ class VirtualDomHorizontal extends Renderer{
2379523814
rowFrag.appendChild(cell.getElement());
2379623815
});
2379723816
row.element.appendChild(rowFrag);
23798-
23817+
2379923818
row.cells.forEach((cell) => {
2380023819
cell.cellRendered();
2380123820
});
@@ -23808,7 +23827,11 @@ class VirtualDomHorizontal extends Renderer{
2380823827

2380923828
reinitializeColumnWidths(columns){
2381023829
for(let i = this.leftCol; i <= this.rightCol; i++){
23811-
this.columns[i].reinitializeWidth();
23830+
let col = this.columns[i];
23831+
23832+
if(col){
23833+
col.reinitializeWidth();
23834+
}
2381223835
}
2381323836
}
2381423837

@@ -23896,11 +23919,11 @@ class VirtualDomHorizontal extends Renderer{
2389623919
reinitializeRows(){
2389723920
var visibleRows = this.getVisibleRows(),
2389823921
otherRows = this.table.rowManager.getRows().filter(row => !visibleRows.includes(row));
23899-
23922+
2390023923
visibleRows.forEach((row) => {
2390123924
this.reinitializeRow(row, true);
2390223925
});
23903-
23926+
2390423927
otherRows.forEach((row) =>{
2390523928
row.deinitialize();
2390623929
});
@@ -23947,7 +23970,7 @@ class VirtualDomHorizontal extends Renderer{
2394723970
working = true;
2394823971

2394923972
while(working){
23950-
23973+
2395123974
let column = this.columns[this.rightCol + 1];
2395223975

2395323976
if(column){
@@ -23965,7 +23988,7 @@ class VirtualDomHorizontal extends Renderer{
2396523988
this.fitDataColActualWidthCheck(column);
2396623989

2396723990
this.rightCol++; // Don't move this below the >= check below
23968-
23991+
2396923992
this.getVisibleRows().forEach((row) => {
2397023993
if(row.type !== "group"){
2397123994
row.modules.vdomHoz.rightCol = this.rightCol;
@@ -24010,7 +24033,7 @@ class VirtualDomHorizontal extends Renderer{
2401024033
});
2401124034

2401224035
this.leftCol--; // don't move this below the <= check below
24013-
24036+
2401424037
this.getVisibleRows().forEach((row) => {
2401524038
if(row.type !== "group"){
2401624039
row.modules.vdomHoz.leftCol = this.leftCol;
@@ -24068,7 +24091,7 @@ class VirtualDomHorizontal extends Renderer{
2406824091

2406924092
this.vDomPadRight += column.getWidth();
2407024093
this.rightCol --;
24071-
24094+
2407224095
this.getVisibleRows().forEach((row) => {
2407324096
if(row.type !== "group"){
2407424097
row.modules.vdomHoz.rightCol = this.rightCol;
@@ -24090,7 +24113,7 @@ class VirtualDomHorizontal extends Renderer{
2409024113
removeColLeft(){
2409124114
var changes = false,
2409224115
working = true;
24093-
24116+
2409424117
while(working){
2409524118
let column = this.columns[this.leftCol];
2409624119

@@ -24112,7 +24135,7 @@ class VirtualDomHorizontal extends Renderer{
2411224135

2411324136
this.vDomPadLeft += column.getWidth();
2411424137
this.leftCol ++;
24115-
24138+
2411624139
this.getVisibleRows().forEach((row) => {
2411724140
if(row.type !== "group"){
2411824141
row.modules.vdomHoz.leftCol = this.leftCol;
@@ -24158,17 +24181,17 @@ class VirtualDomHorizontal extends Renderer{
2415824181
leftCol:this.leftCol,
2415924182
rightCol:this.rightCol,
2416024183
};
24161-
24184+
2416224185
if(this.table.modules.frozenColumns){
2416324186
this.table.modules.frozenColumns.leftColumns.forEach((column) => {
2416424187
this.appendCell(row, column);
2416524188
});
2416624189
}
24167-
24190+
2416824191
for(let i = this.leftCol; i <= this.rightCol; i++){
2416924192
this.appendCell(row, this.columns[i]);
2417024193
}
24171-
24194+
2417224195
if(this.table.modules.frozenColumns){
2417324196
this.table.modules.frozenColumns.rightColumns.forEach((column) => {
2417424197
this.appendCell(row, column);
@@ -24192,7 +24215,7 @@ class VirtualDomHorizontal extends Renderer{
2419224215

2419324216
var rowEl = row.getElement();
2419424217
while(rowEl.firstChild) rowEl.removeChild(rowEl.firstChild);
24195-
24218+
2419624219
this.initializeRow(row);
2419724220
}
2419824221
}
@@ -26640,9 +26663,9 @@ class RowManager extends CoreFeature{
2664026663
this.layoutRefresh(true);
2664126664

2664226665
// handle resized columns
26643-
if(this.table.modExists("groupRows")) {
26644-
this.table.modules.groupRows.virtualRenderFill();
26645-
}
26666+
// if(this.table.modExists("groupRows")) {
26667+
// this.table.modules.groupRows.virtualRenderFill();
26668+
// }
2664626669
}
2664726670
}else {
2664826671
this.renderEmptyScroll();
@@ -26777,10 +26800,14 @@ class RowManager extends CoreFeature{
2677726800
//check if the table has changed size when dealing with variable height tables
2677826801
if(!this.fixedHeight && initialHeight != this.element.clientHeight){
2677926802
resized = true;
26780-
if(this.subscribed("table-resize")){
26781-
this.dispatch("table-resize");
26782-
}else {
26783-
this.redraw();
26803+
if(!this.redrawing){ // prevent recursive redraws
26804+
this.redrawing = true;
26805+
if(this.subscribed("table-resize")){
26806+
this.dispatch("table-resize");
26807+
}else {
26808+
this.redraw();
26809+
}
26810+
this.redrawing = false;
2678426811
}
2678526812
}
2678626813

@@ -27187,8 +27214,9 @@ class InteractionManager extends CoreFeature {
2718727214
var keys = Object.keys(targets).reverse(),
2718827215
listener = this.listeners[type],
2718927216
matches = {},
27217+
output = {},
2719027218
targetMatches = {};
27191-
27219+
2719227220
for(let key of keys){
2719327221
let component,
2719427222
target = targets[key],
@@ -27243,8 +27271,14 @@ class InteractionManager extends CoreFeature {
2724327271
}
2724427272

2724527273
this.previousTargets = targetMatches;
27274+
27275+
//reverse order keys are set in so events trigger in correct sequence
27276+
Object.keys(targets).forEach((key) => {
27277+
let value = matches[key];
27278+
output[key] = value;
27279+
});
2724627280

27247-
return matches;
27281+
return output;
2724827282
}
2724927283

2725027284
triggerEvents(type, e, targets){
@@ -28985,6 +29019,7 @@ class Tabulator extends ModuleBinder{
2898529019
//clear DOM
2898629020
while(element.firstChild) element.removeChild(element.firstChild);
2898729021
element.classList.remove("tabulator");
29022+
element.removeAttribute("tabulator-layout");
2898829023

2898929024
this.externalEvents.dispatch("tableDestroyed");
2899029025
}

dist/js/tabulator_esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)