ngx-deebodata-community 0.3.0 → 0.3.2

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,12 +2253,15 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
2251
2253
  }
2252
2254
  if (bhToAdd) this.belowHgt.set(this.belowHgt() + bhToAdd);
2253
2255
  }
2254
- setTimeout(() => {
2256
+ if (this.rowIncreaseTO) this.rowIncreaseTO.unsubscribe();
2257
+ this.rowIncreaseTO = timer(10).subscribe(() => {
2258
+ this.dataTableService.setTblBounds();
2255
2259
  this.dataTableService.listenForScroll.set(true);
2256
2260
  this.setRowNumbers();
2257
2261
  this.tblDragService.tblHgtDiff = 0;
2258
2262
  });
2259
2263
  }
2264
+ rowIncreaseTO = null;
2260
2265
  processColMove(event) {
2261
2266
  let lfts = event.ls;
2262
2267
  let nwColLft = event.nl;
@@ -2793,7 +2798,8 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
2793
2798
  const dtb = this.dataTableBody?.nativeElement;
2794
2799
  if (dtb) {
2795
2800
  const lfs = this.dataTableService.listenForScroll();
2796
- 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);
2797
2803
  this.execHorizScroll(dtb.scrollLeft);
2798
2804
  if (lfs && this.rows.some((r) => r.height !== this.dataTableService.defltRHgt)) this.setAllRowsDefHgt();
2799
2805
  if (!lfs) timer(0).subscribe(() => {
@@ -2852,6 +2858,12 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
2852
2858
  if (this.listenToCellDraggerMouseMove) this.settleCellDragger();
2853
2859
  timer(0).subscribe(() => {
2854
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
+ }
2855
2867
  });
2856
2868
  });
2857
2869
  }
@@ -3035,9 +3047,9 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3035
3047
  }
3036
3048
  getLastRowBot() {
3037
3049
  const els = document.getElementsByClassName("data-table-row");
3038
- return els[els.length - 1].getBoundingClientRect()?.bottom || this.dataTableService.tblBot;
3050
+ return els[els.length - 1]?.getBoundingClientRect()?.bottom || this.dataTableService.tblBot;
3039
3051
  }
3040
- execVertScrollDown(cols, colLen, currTop) {
3052
+ execVertScrollDown(cols, colLen, currTop, force) {
3041
3053
  let gap = this.dataTableService.tblBot - this.getLastRowBot();
3042
3054
  this.fixRowContainer(gap);
3043
3055
  timer(0).subscribe(() => {
@@ -3045,7 +3057,7 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3045
3057
  let rows = [];
3046
3058
  let canAdd = 0;
3047
3059
  const maxRows = this.rows.length;
3048
- 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;
3049
3061
  const btop = this.belowArea.nativeElement.getBoundingClientRect().top - gap;
3050
3062
  const defNum = this.dataTableService.defltRHgtNum;
3051
3063
  let z = this.lastElRowIndex + 1;
@@ -3070,7 +3082,7 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3070
3082
  }
3071
3083
  h += 1;
3072
3084
  }
3073
- if (bhToSub) this.belowHgt.set(this.belowHgt() - bhToSub);
3085
+ if (bhToSub) this.belowHgt.set(Math.max(0, this.belowHgt() - bhToSub));
3074
3086
  if (ahToAdd) this.aboveHgt.set(this.aboveHgt() + ahToAdd);
3075
3087
  const repl = [...rows].length;
3076
3088
  const needsToFill = maxRows - repl;
@@ -3088,25 +3100,25 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3088
3100
  }
3089
3101
  const vlen = this.dataTableService.visibleCols.length;
3090
3102
  const lastVisInd = cols.indexOf(this.dataTableService.visibleCols[vlen - 1]) + 1;
3091
- this.applyToDomRows(rows, cols, colLen, lastVisInd, "down", defNum, repl);
3103
+ this.applyToDomRows(rows, cols, colLen, lastVisInd, "down", defNum, repl, force);
3092
3104
  });
3093
3105
  }
3094
3106
  getFirstRowTop() {
3095
3107
  return document.getElementsByClassName("data-table-row")[0]?.getBoundingClientRect().top || this.dataTableService.tblTop;
3096
3108
  }
3097
3109
  execVertScrollUp(cols, colLen, currTop, force) {
3098
- const maxRows = this.rows.length;
3099
3110
  let gap = this.getFirstRowTop() - this.dataTableService.tblTop;
3100
3111
  this.fixRowContainer(-gap);
3101
3112
  timer(0).subscribe(() => {
3102
3113
  let h = 0;
3103
3114
  let rows = [];
3104
3115
  const rbot = this.aboveArea.nativeElement.getBoundingClientRect().bottom + gap;
3116
+ const maxRows = this.rows.length;
3105
3117
  const defNum = this.dataTableService.defltRHgtNum;
3106
3118
  let z = this.lastElRowIndex - maxRows;
3107
3119
  let bhToAdd = 0;
3108
3120
  let ahToSub = 0;
3109
- 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;
3110
3122
  const rowsInGap = Math.ceil(gap / defNum);
3111
3123
  const min = Math.max(0, z - rowsInGap);
3112
3124
  for (; z >= min; z--) {
@@ -3125,7 +3137,7 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3125
3137
  }
3126
3138
  h += 1;
3127
3139
  }
3128
- if (ahToSub) this.aboveHgt.set(this.aboveHgt() - ahToSub);
3140
+ if (ahToSub) this.aboveHgt.set(Math.max(0, this.aboveHgt() - ahToSub));
3129
3141
  if (bhToAdd) this.belowHgt.set(this.belowHgt() + bhToAdd);
3130
3142
  const repl = [...rows].length;
3131
3143
  const needsToFill = maxRows - repl;
@@ -3147,12 +3159,24 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3147
3159
  });
3148
3160
  }
3149
3161
  finishApplyingDomRows(newRows, force) {
3150
- this.setRowNumbers();
3151
3162
  this.fixRowContainer(0);
3163
+ this.setRowNumbers();
3152
3164
  this.setLastRowIndex();
3153
3165
  this.cleanRowChecks();
3154
3166
  if (force && !this.isScrolling) this.handleScrollEnd();
3155
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
+ }
3156
3180
  handleValidatedCellEditFocus(cellData) {
3157
3181
  this.validatedEditType = cellData.type;
3158
3182
  if (this.valEditFocusTo) {
@@ -3448,8 +3472,9 @@ var NgxDeebodataCommunity = class NgxDeebodataCommunity {
3448
3472
  c.height = useHgt;
3449
3473
  });
3450
3474
  if (this.rowNumbers && this.rowNumHeader) this.rowNumHeader.nativeElement.style.height = useHgt;
3451
- setTimeout(() => {
3452
- this.dataTableService.setTblVertBounds();
3475
+ if (this.rowIncreaseTO) this.rowIncreaseTO.unsubscribe();
3476
+ this.rowIncreaseTO = timer(10).subscribe(() => {
3477
+ this.dataTableService.setTblBounds();
3453
3478
  this.setRowSelChecksPlacement();
3454
3479
  });
3455
3480
  }