ngx-deebodata-community 0.3.1 → 0.3.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.
@@ -1005,7 +1005,6 @@ var TableDragService = class TableDragService {
1005
1005
  const tblWant = Math.min(this.dataTableService.dTblHeight() + useHgt, max);
1006
1006
  const finalHgt = Math.floor(Math.max(tblWant, 100));
1007
1007
  this.tblHgtDiff += finalHgt - this.dataTableService.dTblHeight();
1008
- this.dataTableService.dTblHeight.set(finalHgt);
1009
1008
  this.dTblHeightOutput.next(finalHgt);
1010
1009
  } catch (err) {}
1011
1010
  }
@@ -2150,22 +2149,25 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
2150
2149
  } catch (e) {}
2151
2150
  }
2152
2151
  setTableHeight(h, manual) {
2153
- this.dataTableService.dTblHeight.set(h);
2154
- setTimeout(() => {
2152
+ if (this.tableHgtTO) this.tableHgtTO.unsubscribe();
2153
+ this.tableHgtTO = timer(0).subscribe(() => {
2154
+ this.dataTableService.listenForScroll.set(false);
2155
+ this.dataTableService.dTblHeight.set(h);
2155
2156
  this.dataTableService.setTblBounds();
2156
2157
  this.dataTableBody?.nativeElement.scrollBy(0, this.scrollDir === "down" ? 1 : -1);
2157
- setTimeout(() => {
2158
+ timer(0).subscribe(() => {
2158
2159
  this.setRowSelChecksPlacement();
2159
2160
  });
2160
2161
  if (manual) {
2161
- this.dataTableService.listenForScroll.set(false);
2162
- if (this.tblDragService.handleTblHtTO) clearTimeout(this.tblDragService.handleTblHtTO);
2163
- this.tblDragService.handleTblHtTO = setTimeout(() => {
2162
+ if (this.tblDragService.handleTblHtTO) this.tblDragService.handleTblHtTO.unsubscribe();
2163
+ this.tblDragService.handleTblHtTO = timer(250).subscribe(() => {
2164
+ this.dataTableService.listenForScroll.set(false);
2164
2165
  this.handleRowsOnHeightIncrease();
2165
- }, 250);
2166
- }
2166
+ });
2167
+ } else setTimeout(() => this.dataTableService.listenForScroll.set(true));
2167
2168
  });
2168
2169
  }
2170
+ tableHgtTO = null;
2169
2171
  handleRowsOnHeightIncrease() {
2170
2172
  const len = this.rows.length;
2171
2173
  const defNum = this.dataTableService.defltRHgtNum;
@@ -2251,13 +2253,15 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
2251
2253
  }
2252
2254
  if (bhToAdd) this.belowHgt.set(this.belowHgt() + bhToAdd);
2253
2255
  }
2254
- setTimeout(() => {
2255
- this.dataTableService.setTblVertBounds();
2256
+ if (this.rowIncreaseTO) this.rowIncreaseTO.unsubscribe();
2257
+ this.rowIncreaseTO = timer(10).subscribe(() => {
2258
+ this.dataTableService.setTblBounds();
2256
2259
  this.dataTableService.listenForScroll.set(true);
2257
2260
  this.setRowNumbers();
2258
2261
  this.tblDragService.tblHgtDiff = 0;
2259
2262
  });
2260
2263
  }
2264
+ rowIncreaseTO = null;
2261
2265
  processColMove(event) {
2262
2266
  let lfts = event.ls;
2263
2267
  let nwColLft = event.nl;
@@ -2794,7 +2798,8 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
2794
2798
  const dtb = this.dataTableBody?.nativeElement;
2795
2799
  if (dtb) {
2796
2800
  const lfs = this.dataTableService.listenForScroll();
2797
- this.execVertScrollUp(this.columnNames, this.columnNames.length, dtb.scrollTop, true);
2801
+ if (this.scrollDir === "down") this.execVertScrollUp(this.columnNames, this.columnNames.length, dtb.scrollTop, true);
2802
+ else this.execVertScrollDown(this.columnNames, this.columnNames.length, dtb.scrollTop, true);
2798
2803
  this.execHorizScroll(dtb.scrollLeft);
2799
2804
  if (lfs && this.rows.some((r) => r.height !== this.dataTableService.defltRHgt)) this.setAllRowsDefHgt();
2800
2805
  if (!lfs) timer(0).subscribe(() => {
@@ -2853,6 +2858,12 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
2853
2858
  if (this.listenToCellDraggerMouseMove) this.settleCellDragger();
2854
2859
  timer(0).subscribe(() => {
2855
2860
  this.cleanUpPossibles();
2861
+ if (this.transY() === 0) {
2862
+ if (this.cleanAbvTO) this.cleanAbvTO.unsubscribe();
2863
+ this.cleanAbvTO = timer(5).subscribe(() => {
2864
+ this.cleanAbove();
2865
+ });
2866
+ }
2856
2867
  });
2857
2868
  });
2858
2869
  }
@@ -3036,9 +3047,9 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3036
3047
  }
3037
3048
  getLastRowBot() {
3038
3049
  const els = document.getElementsByClassName("data-table-row");
3039
- return els[els.length - 1].getBoundingClientRect()?.bottom || this.dataTableService.tblBot;
3050
+ return els[els.length - 1]?.getBoundingClientRect()?.bottom || this.dataTableService.tblBot;
3040
3051
  }
3041
- execVertScrollDown(cols, colLen, currTop) {
3052
+ execVertScrollDown(cols, colLen, currTop, force) {
3042
3053
  let gap = this.dataTableService.tblBot - this.getLastRowBot();
3043
3054
  this.fixRowContainer(gap);
3044
3055
  timer(0).subscribe(() => {
@@ -3046,7 +3057,7 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3046
3057
  let rows = [];
3047
3058
  let canAdd = 0;
3048
3059
  const maxRows = this.rows.length;
3049
- const doRows = !this.isScrolling && (gap == 0 || !this.mouseIsDown) || currTop % this.doRowsMod === 0;
3060
+ const doRows = force || !this.isScrolling && (gap == 0 || !this.mouseIsDown) || currTop % this.doRowsMod === 0 || this.belowHgt() === 0;
3050
3061
  const btop = this.belowArea.nativeElement.getBoundingClientRect().top - gap;
3051
3062
  const defNum = this.dataTableService.defltRHgtNum;
3052
3063
  let z = this.lastElRowIndex + 1;
@@ -3071,7 +3082,7 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3071
3082
  }
3072
3083
  h += 1;
3073
3084
  }
3074
- if (bhToSub) this.belowHgt.set(this.belowHgt() - bhToSub);
3085
+ if (bhToSub) this.belowHgt.set(Math.max(0, this.belowHgt() - bhToSub));
3075
3086
  if (ahToAdd) this.aboveHgt.set(this.aboveHgt() + ahToAdd);
3076
3087
  const repl = [...rows].length;
3077
3088
  const needsToFill = maxRows - repl;
@@ -3089,25 +3100,25 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3089
3100
  }
3090
3101
  const vlen = this.dataTableService.visibleCols.length;
3091
3102
  const lastVisInd = cols.indexOf(this.dataTableService.visibleCols[vlen - 1]) + 1;
3092
- this.applyToDomRows(rows, cols, colLen, lastVisInd, "down", defNum, repl);
3103
+ this.applyToDomRows(rows, cols, colLen, lastVisInd, "down", defNum, repl, force);
3093
3104
  });
3094
3105
  }
3095
3106
  getFirstRowTop() {
3096
3107
  return document.getElementsByClassName("data-table-row")[0]?.getBoundingClientRect().top || this.dataTableService.tblTop;
3097
3108
  }
3098
3109
  execVertScrollUp(cols, colLen, currTop, force) {
3099
- const maxRows = this.rows.length;
3100
3110
  let gap = this.getFirstRowTop() - this.dataTableService.tblTop;
3101
3111
  this.fixRowContainer(-gap);
3102
3112
  timer(0).subscribe(() => {
3103
3113
  let h = 0;
3104
3114
  let rows = [];
3105
3115
  const rbot = this.aboveArea.nativeElement.getBoundingClientRect().bottom + gap;
3116
+ const maxRows = this.rows.length;
3106
3117
  const defNum = this.dataTableService.defltRHgtNum;
3107
3118
  let z = this.lastElRowIndex - maxRows;
3108
3119
  let bhToAdd = 0;
3109
3120
  let ahToSub = 0;
3110
- const doRows = force || !this.isScrolling && (gap == 0 || !this.mouseIsDown) || currTop % this.doRowsMod === 0;
3121
+ const doRows = force || !this.isScrolling && (gap == 0 || !this.mouseIsDown) || currTop % this.doRowsMod === 0 || this.aboveHgt() === 0;
3111
3122
  const rowsInGap = Math.ceil(gap / defNum);
3112
3123
  const min = Math.max(0, z - rowsInGap);
3113
3124
  for (; z >= min; z--) {
@@ -3126,7 +3137,7 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3126
3137
  }
3127
3138
  h += 1;
3128
3139
  }
3129
- if (ahToSub) this.aboveHgt.set(this.aboveHgt() - ahToSub);
3140
+ if (ahToSub) this.aboveHgt.set(Math.max(0, this.aboveHgt() - ahToSub));
3130
3141
  if (bhToAdd) this.belowHgt.set(this.belowHgt() + bhToAdd);
3131
3142
  const repl = [...rows].length;
3132
3143
  const needsToFill = maxRows - repl;
@@ -3148,12 +3159,24 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3148
3159
  });
3149
3160
  }
3150
3161
  finishApplyingDomRows(newRows, force) {
3151
- this.setRowNumbers();
3152
3162
  this.fixRowContainer(0);
3163
+ this.setRowSelChecksPlacement();
3153
3164
  this.setLastRowIndex();
3154
3165
  this.cleanRowChecks();
3155
3166
  if (force && !this.isScrolling) this.handleScrollEnd();
3156
3167
  }
3168
+ cleanAbvTO = null;
3169
+ cleanAbove() {
3170
+ const abv = this.aboveArea.nativeElement;
3171
+ const head = this.dataTableHeaders.nativeElement;
3172
+ const diff = (abv?.getBoundingClientRect().bottom || 0) - (head?.getBoundingClientRect().bottom || 0);
3173
+ if (diff > 0) {
3174
+ this.aboveHgt.set(this.aboveHgt() - diff);
3175
+ this.setRowSelChecksPlacement();
3176
+ this.setLastRowIndex();
3177
+ this.cleanRowChecks();
3178
+ }
3179
+ }
3157
3180
  handleValidatedCellEditFocus(cellData) {
3158
3181
  this.validatedEditType = cellData.type;
3159
3182
  if (this.valEditFocusTo) {
@@ -3449,8 +3472,9 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3449
3472
  c.height = useHgt;
3450
3473
  });
3451
3474
  if (this.rowNumbers && this.rowNumHeader) this.rowNumHeader.nativeElement.style.height = useHgt;
3452
- setTimeout(() => {
3453
- this.dataTableService.setTblVertBounds();
3475
+ if (this.rowIncreaseTO) this.rowIncreaseTO.unsubscribe();
3476
+ this.rowIncreaseTO = timer(10).subscribe(() => {
3477
+ this.dataTableService.setTblBounds();
3454
3478
  this.setRowSelChecksPlacement();
3455
3479
  });
3456
3480
  }