ngx-deebodata 0.0.2 → 0.0.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.
Files changed (76) hide show
  1. package/fesm2022/ngx-deebodata.mjs +6863 -0
  2. package/fesm2022/ngx-deebodata.mjs.map +1 -0
  3. package/package.json +35 -16
  4. package/types/ngx-deebodata.d.ts +439 -0
  5. package/ng-package.json +0 -7
  6. package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.css +0 -156
  7. package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.html +0 -29
  8. package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.spec.ts +0 -23
  9. package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.ts +0 -286
  10. package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.css +0 -27
  11. package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.html +0 -53
  12. package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.spec.ts +0 -23
  13. package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.ts +0 -214
  14. package/src/lib/data-table/charts/column-chart/column-chart.css +0 -19
  15. package/src/lib/data-table/charts/column-chart/column-chart.html +0 -47
  16. package/src/lib/data-table/charts/column-chart/column-chart.spec.ts +0 -23
  17. package/src/lib/data-table/charts/column-chart/column-chart.ts +0 -178
  18. package/src/lib/data-table/charts/line-graph-component/line-graph-component.css +0 -33
  19. package/src/lib/data-table/charts/line-graph-component/line-graph-component.html +0 -59
  20. package/src/lib/data-table/charts/line-graph-component/line-graph-component.spec.ts +0 -23
  21. package/src/lib/data-table/charts/line-graph-component/line-graph-component.ts +0 -661
  22. package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.css +0 -61
  23. package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.html +0 -27
  24. package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.spec.ts +0 -23
  25. package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.ts +0 -210
  26. package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.css +0 -0
  27. package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.html +0 -15
  28. package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.spec.ts +0 -23
  29. package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.ts +0 -197
  30. package/src/lib/data-table/data-table-module/data-cell/data-cell.css +0 -0
  31. package/src/lib/data-table/data-table-module/data-cell/data-cell.html +0 -6
  32. package/src/lib/data-table/data-table-module/data-cell/data-cell.spec.ts +0 -23
  33. package/src/lib/data-table/data-table-module/data-cell/data-cell.ts +0 -271
  34. package/src/lib/data-table/data-table-module/data-table-header/data-table-header.css +0 -25
  35. package/src/lib/data-table/data-table-module/data-table-header/data-table-header.html +0 -55
  36. package/src/lib/data-table/data-table-module/data-table-header/data-table-header.spec.ts +0 -23
  37. package/src/lib/data-table/data-table-module/data-table-header/data-table-header.ts +0 -261
  38. package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.css +0 -69
  39. package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.html +0 -24
  40. package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.spec.ts +0 -23
  41. package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.ts +0 -125
  42. package/src/lib/data-table/data-table-module/export-component/export-component.css +0 -91
  43. package/src/lib/data-table/data-table-module/export-component/export-component.html +0 -16
  44. package/src/lib/data-table/data-table-module/export-component/export-component.spec.ts +0 -23
  45. package/src/lib/data-table/data-table-module/export-component/export-component.ts +0 -206
  46. package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.css +0 -91
  47. package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.html +0 -193
  48. package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.spec.ts +0 -23
  49. package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.ts +0 -2226
  50. package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.css +0 -14
  51. package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.html +0 -27
  52. package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.spec.ts +0 -23
  53. package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.ts +0 -58
  54. package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.css +0 -23
  55. package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.html +0 -48
  56. package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.spec.ts +0 -23
  57. package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.ts +0 -599
  58. package/src/lib/data-table/data-table-module/worker.worker.ts +0 -44
  59. package/src/lib/interfaces/cell-edit.ts +0 -5
  60. package/src/lib/interfaces/column-header.ts +0 -10
  61. package/src/lib/interfaces/column-styles.ts +0 -14
  62. package/src/lib/interfaces/column-symbol.ts +0 -4
  63. package/src/lib/interfaces/data-cell.ts +0 -14
  64. package/src/lib/interfaces/data-row.ts +0 -11
  65. package/src/lib/interfaces/row-number.ts +0 -4
  66. package/src/lib/services/common-service.spec.ts +0 -16
  67. package/src/lib/services/common-service.ts +0 -336
  68. package/src/lib/services/data-table-service.spec.ts +0 -16
  69. package/src/lib/services/data-table-service.ts +0 -597
  70. package/src/lib/services/table-drag-service.spec.ts +0 -16
  71. package/src/lib/services/table-drag-service.ts +0 -347
  72. package/src/lib/styles.css +0 -1065
  73. package/src/public-api.ts +0 -8
  74. package/tsconfig.lib.json +0 -17
  75. package/tsconfig.lib.prod.json +0 -11
  76. package/tsconfig.spec.json +0 -15
@@ -1,599 +0,0 @@
1
- import { Component, ElementRef, Input, Output, ViewChild, EventEmitter, SimpleChanges, HostListener, input, signal } from '@angular/core';
2
- import { CommonService } from '../../../services/common-service';
3
- import { CommonModule, DecimalPipe } from '@angular/common';
4
- import { DataTableService } from '../../../services/data-table-service';
5
- import { DataRow } from '../../../interfaces/data-row';
6
- import { DataCellComponent } from '../data-cell/data-cell';
7
- import { DataCell } from '../../../interfaces/data-cell';
8
- import { TableDragService } from '../../../services/table-drag-service';
9
-
10
- @Component({
11
- selector: 'app-row-group-panel',
12
- imports: [CommonModule, DecimalPipe, DataCellComponent],
13
- templateUrl: './row-group-panel.html',
14
- styleUrls: ['./row-group-panel.css', '../../../styles.css']
15
- })
16
- export class RowGroupPanel {
17
-
18
- @HostListener('window:mouseup', ['$event'])
19
- onWindowMouseUp(e: MouseEvent) {
20
- if(this.open()){
21
- setTimeout( () => {
22
- const pEl = this.panelDataGrid?.nativeElement
23
- if(pEl){
24
- pEl.scrollBy(0, 1);
25
- pEl.scrollBy(0, -1);
26
- }
27
- } )
28
- }
29
- }
30
-
31
- init = true
32
- count: number = 0
33
- verticalRest = 0
34
- isScrolling = false;
35
- open = signal<boolean>(false)
36
- uiGroupValue: string = ""
37
- elifyGrouping: string = ""
38
- rows: DataRow[] = [];
39
- panelData: any[] = []
40
- tblTop: number = 0
41
- tblBot: number = 0
42
- aboveHgt: number = 0;
43
- belowHgt: number = 0;
44
- rowNums: number[] = []
45
- changedIds: string[] = []
46
- scrollDir: string = "down"
47
- lastElRowIndex: number = 0;
48
- horizRest = input<number>(0)
49
- colOfInt = input<string>("")
50
- @Input() groupValue: string = ""
51
- @Input() useRowWid: string = ""
52
- @Input() maxCols: number = 0
53
- @Input() editable: boolean = false
54
- @Input() columns: string[] = []
55
- @Input() showRowNumbers: boolean = true
56
- @Output("openEvt") openEvt: EventEmitter<string> = new EventEmitter()
57
- @Output("horizPos") horizPos: EventEmitter<number> = new EventEmitter()
58
- @Output("cellEdit") cellEdit: EventEmitter<any> = new EventEmitter()
59
- @ViewChild("panelDataGrid") panelDataGrid!: ElementRef<HTMLElement>;
60
- @ViewChild("aboveArea") aboveArea!: ElementRef<HTMLElement>;
61
- @ViewChild("belowArea") belowArea!: ElementRef<HTMLElement>;
62
-
63
- constructor(public common: CommonService,
64
- private tblDragService: TableDragService,
65
- public dataTableService: DataTableService,
66
- ) {}
67
-
68
- ngOnChanges(changes: SimpleChanges) {
69
- if(!this.init && this.open() && changes){
70
- if(changes["horizRest"]?.currentValue)
71
- this.setHorizScrPos()
72
- }
73
- }
74
-
75
- ngOnInit() {
76
- this.uiGroupValue = this.common.titleCase(this.groupValue)
77
- this.elifyGrouping = this.common.elifyCol(this.groupValue)
78
- this.count = this.dataTableService.currFilData.filter( d => d[this.dataTableService.currGroup] === this.groupValue).length
79
- this.dataTableService.gridScrollEndWhileGrouped.subscribe( e => { this.setTblBot() })
80
- this.dataTableService.gridEventWhileGrouped.subscribe( e => {
81
- const nowOpen = this.open()
82
- this.rows = []
83
- this.panelData = []
84
- this.open.set(false)
85
- this.rowNums = []
86
- this.count = this.dataTableService.currFilData.filter( d => d[this.dataTableService.currGroup] === this.groupValue).length
87
- if(nowOpen)
88
- setTimeout( () => { this.openGroup() })
89
- })//just close
90
- this.dataTableService.mouseupWhileGrouped.subscribe( e => {
91
- if(this.open()){
92
- setTimeout( () => {
93
- const pEl = this.panelDataGrid?.nativeElement
94
- if(pEl){
95
- pEl.scrollBy(0, 1);
96
- pEl.scrollBy(0, -1);
97
- }
98
- } )
99
- }
100
- })
101
- this.init = false;
102
- }
103
-
104
- openGroup() {
105
- this.open.set(!this.open())
106
- setTimeout( () => {
107
- if(!this.open()){
108
- this.rows = []
109
- this.panelData = []
110
- this.aboveHgt = 0;
111
- this.belowHgt = 0;
112
- this.rowNums = []
113
- } else {
114
- this.panelData = this.dataTableService.currFilData.filter( d => d[this.dataTableService.currGroup] === this.groupValue)
115
- this.count = this.panelData.length
116
- let n = 0
117
- const defNum = parseInt(this.dataTableService.defltRHgt.replace(/[ ]?px/g, ""))
118
- const init = Math.max(this.dataTableService.dTblHeight/defNum);
119
- const addCell = (text: any, prop: string | null, row: DataRow | null, visible: boolean) => {
120
- if(prop && row){
121
- const useProp = this.dataTableService.dataFilSrtTracker[prop]
122
- const notNum = (this.dataTableService.figureFilterType(prop) != "number" || /(year|yr|fy)/g.test(prop.toLocaleLowerCase())) ? true : false
123
- const useTxt = this.dataTableService.figureCellText(text, notNum, useProp["colCellSymbol"])
124
- const colStyle = this.dataTableService.getColumnStyle(prop)
125
- row.cells?.push({
126
- column: prop,
127
- rawText: text,
128
- visible: visible,
129
- freeze: useProp.freeze,
130
- minimized: useProp.minimize,
131
- editable: false,
132
- width: useProp.colWidth || this.dataTableService.useColWid,
133
- dataType: this.dataTableService.figureFilterType(prop),
134
- text: (useTxt.prop === "textContent" ? useTxt.value : ""),
135
- html: (useTxt.prop !== "textContent" ? useTxt.value : ""),
136
- specialColClass: (colStyle ? (colStyle + this.common.elifyCol(useTxt.value)) : ""),
137
- })
138
- }
139
- }
140
- const limit = Math.min(init, this.count)
141
- const colLen = this.columns.length
142
- let horizLim = Math.min(this.maxCols, colLen)
143
- if(this.colOfInt()){
144
- let indOfScrl: number = this.columns.indexOf(this.colOfInt()) + 1
145
- const vlen: number =this.dataTableService.visibleCols.length
146
- const indInVis: number = this.dataTableService.visibleCols.indexOf(this.colOfInt())
147
- const diff = vlen - indInVis
148
- if(diff > 0)
149
- indOfScrl += diff
150
- horizLim = indOfScrl
151
- } else {
152
- if(this.horizRest() > 0){
153
- const vCollen = this.dataTableService.visibleCols.length
154
- const lvis = this.dataTableService.visibleCols[(vCollen - 1)]
155
- horizLim = this.columns.indexOf(lvis) + 1
156
- }
157
- }
158
- for(n; n < limit; n++){
159
- const item = this.panelData[n]
160
- const index = this.dataTableService.currMapping[n] || this.dataTableService.findObjIndxInData(item)
161
- if(index > -1){
162
- this.rows.push({ id: "dataTableRow" + index, index: index, width: this.useRowWid, cells: [], height: this.dataTableService.defltRHgt })
163
- let k = 0
164
- for(k; k < colLen; k++){
165
- const col = this.columns?.[k]
166
- if(col)
167
- addCell(item[col], col, this.rows[n], (k <= horizLim))
168
- }
169
- }
170
- }
171
- this.setLastRowIndex()
172
- setTimeout( () => {
173
- this.setRowNums()
174
- if(this.count > init){
175
- let total = 0
176
- let z = this.lastElRowIndex + 1
177
- for(z; z < this.count; z++)
178
- total += 1
179
- this.belowHgt = total*defNum
180
- }
181
- this.setHorizScrPos()
182
- this.openEvt.emit("row-group-panel-" + this.elifyGrouping)
183
- setTimeout( () => {
184
- this.setTblBot();
185
- const pEl = this.panelDataGrid?.nativeElement
186
- if(pEl){
187
- pEl.scrollBy(1, 1);
188
- pEl.scrollBy(0, -1);
189
- }
190
- this.setRowNumPlacement()
191
- })
192
- }, 250)
193
- }
194
- })
195
- }
196
-
197
- setTblBot() {
198
- if(this.panelDataGrid)
199
- this.tblBot = (this.panelDataGrid.nativeElement.getBoundingClientRect().bottom || 0)// + 250
200
- const panelTop = document.getElementsByClassName("row-group-panel-" + this.elifyGrouping)[0]
201
- if(panelTop)
202
- this.tblTop = (panelTop.getBoundingClientRect().bottom || 0)// - 200
203
- setTimeout( () => { this.setRowNumPlacement() })
204
- }
205
-
206
- setHorizScrPos() {
207
- const body = this.panelDataGrid?.nativeElement
208
- if(body)
209
- body.scrollLeft = this.horizRest()
210
- }
211
-
212
- setLastRowIndex() {
213
- const realMax = this.panelData.length - 1
214
- const defNum = parseInt(this.dataTableService.defltRHgt.replace(/[ ]?px/g, ""))
215
- const wannabeMax = (this.rows.length - 1) + Math.floor(this.aboveHgt/defNum)
216
- this.lastElRowIndex = Math.min(wannabeMax, realMax)
217
- return this.lastElRowIndex;
218
- }
219
-
220
- setColsOnVisScreen() {
221
- let i = 0
222
- let vCols = []
223
- const len = this.columns.length
224
- for(i; i < len; i++){
225
- const col = this.columns[i]
226
- const el = document.getElementById("columnHeader" + this.common.elifyCol(col))
227
- if(el){
228
- const elbds = el.getBoundingClientRect()
229
- if(elbds.left >= this.dataTableService.tblLeft && elbds.right < this.dataTableService.tblRight)
230
- vCols.push(col)
231
- }
232
- }
233
- this.dataTableService.visibleCols = [...vCols]
234
- }
235
-
236
- setRowNums() {//only on initial
237
- if(this.showRowNumbers){
238
- const rlen = this.rows.length
239
- if(rlen){
240
- let n = (this.lastElRowIndex + 1) - rlen
241
- for(n; n <= this.lastElRowIndex; n++)
242
- this.rowNums.push(n + 1)
243
- }
244
- }
245
- }
246
-
247
- setRowNumPlacement() {
248
- if(this.showRowNumbers){
249
- let i = 0
250
- const radd = 2
251
- const els = document.getElementsByClassName("row-nums-" + this.elifyGrouping)
252
- const len = els.length
253
- const dtBody = this.panelDataGrid?.nativeElement
254
- if(dtBody){
255
- const tbds = dtBody.getBoundingClientRect()
256
- const col1Frozen = document.getElementsByClassName("col-item-freeze").length
257
- for(i; i < len; i++){
258
- const num = <HTMLElement>els[i]
259
- const row = this.rows[i]
260
- if(row){
261
- const tTop = tbds.top
262
- const rbds = document.querySelector("#panelDataGrid" + this.elifyGrouping + " #" + row.id)?.getBoundingClientRect()
263
- if(rbds){
264
- const hh = (rbds.height/2)
265
- const top = Math.floor(((rbds.bottom - (hh+radd)) - tTop))
266
- num.style.top = top + "px"
267
- if(rbds.top < (tTop-2) || (rbds.bottom > (tTop + tbds.height+1)) || (dtBody.scrollLeft > 35 && !col1Frozen)){
268
- num.classList.add("hide")
269
- continue
270
- }
271
- num.classList.remove("hide")
272
- num.classList.remove("invisible")
273
- }
274
- }
275
- }
276
- }
277
- }
278
- }
279
-
280
- handleScroll(event: any) {
281
- const top = event.target.scrollTop
282
- const left = event.target.scrollLeft
283
- /*horiz scroll*/
284
- requestAnimationFrame( () => { this.execHorizScroll(left) })
285
- /*horiz scroll*/
286
- /*vert scroll*/
287
- if(top === this.verticalRest){
288
- this.isScrolling = false
289
- return this.setRowNumPlacement();
290
- }
291
- this.isScrolling = true
292
- requestAnimationFrame( () => { this.execVertScroll(top) })
293
- /*vert scroll*/
294
- }
295
-
296
- execHorizScroll(left: number, reverse?: boolean) {
297
- this.setColsOnVisScreen()
298
- if(reverse || left !== this.horizRest()){
299
- this.execHorizBodyScroll()
300
- this.horizPos.emit(left)
301
- this.setColsOnVisScreen()
302
- }
303
- }
304
-
305
- execVertScroll(top: number) {
306
- if(top >= this.verticalRest){
307
- this.execVertScrollDown(this.columns, this.columns.length)
308
- this.clearAboveFoldRows()
309
- this.scrollDir = "down"
310
- } else {//scrolling back up
311
- this.execVertScrollUp(this.columns, this.columns.length)
312
- this.clearBelowFoldRows()
313
- this.scrollDir = "up"
314
- }
315
- this.verticalRest = top
316
- this.setRowNumPlacement()
317
- }
318
-
319
- handleScrollEnd(): any {
320
- this.isScrolling = false
321
- setTimeout( () => {
322
- this.setColsOnVisScreen()
323
- this.setRowNumPlacement()
324
- setTimeout( () => { this.cleanUpPossibles() })
325
- })
326
- }
327
-
328
- addCell(text: any, prop: string, visible: boolean): DataCell {
329
- const useProp = this.dataTableService.dataFilSrtTracker[prop]
330
- const notNum = (this.dataTableService.figureFilterType(prop) != "number" || /(year|yr|fy)/g.test(prop.toLocaleLowerCase())) ? true : false
331
- const useTxt = this.dataTableService.figureCellText(text, notNum, useProp["colCellSymbol"])
332
- const colStyle = this.dataTableService.getColumnStyle(prop)
333
- return {
334
- column: prop,
335
- rawText: text,
336
- visible: visible,
337
- editable: false,
338
- dataType: this.dataTableService.figureFilterType(prop),
339
- freeze: useProp.freeze,
340
- minimized: useProp.minimize,
341
- width: useProp.colWidth,
342
- text: useTxt.prop === "textContent" ? useTxt.value : "",
343
- html: useTxt.prop !== "textContent" ? useTxt.value : "",
344
- specialColClass: (colStyle ? (colStyle + this.common.elifyCol(useTxt.value)) : ""),
345
- }
346
- }
347
-
348
- execHorizBodyScroll() {
349
- let i = 0;
350
- const clen = this.columns.length
351
- const rlen = this.rows.length
352
- let positions: any = []
353
- const row0 = this.rows[0]
354
- for(let p = (clen-1); p >= 0; p--){
355
- const col = this.columns[p]
356
- const elcol = this.common.elifyCol(col)
357
- const head = document.getElementById("columnHeader" + elcol)
358
- if(head){
359
- const bds = head.getBoundingClientRect()
360
- if(bds.left > this.dataTableService.tblRight)
361
- continue
362
- const cell = row0?.cells?.find( c => c.column === col)
363
- if(cell){
364
- if(!cell.visible && (this.dataTableService.visibleCols.includes(col) || (bds.left >= (this.dataTableService.tblLeft) && bds.right < (this.dataTableService.tblRight))))//visible
365
- positions.push({ col: col, vis: true })
366
- if(cell.visible && !this.dataTableService.visibleCols.includes(col) && !positions.find( (p: any) => p.col === col))
367
- positions.push({ col: col, vis: false })
368
- }
369
- }
370
- }
371
- const plen = positions.length
372
- for(i; i < rlen; i++){
373
- let c = 0
374
- const row = this.rows[i]
375
- for(c; c < plen; c++){
376
- const pos = positions[c]
377
- if(pos){
378
- if(pos.vis){
379
- row.cells = row.cells?.map( c => {
380
- if(c.column === pos.col)
381
- return this.addCell(c.rawText, pos.col, true)
382
- return c
383
- })
384
- } else {
385
- const rCell: DataCell | undefined = row.cells?.find( c => c.column === pos.col)
386
- if(rCell){
387
- rCell.visible = false
388
- }
389
- }
390
- }
391
- }
392
- }
393
- setTimeout( () => {
394
- this.dataTableService.setIdealColumnWidth.next(true);
395
- this.setColsOnVisScreen()
396
- setTimeout( () => { this.cleanUpPossibles() }, 100)
397
- }, 50)
398
- }
399
-
400
- cleanUpPossibles() {
401
- let i = 0
402
- const len = this.rows.length
403
- for(i; i < len; i++){
404
- const row = this.rows[i]
405
- if(row){
406
- let p = 0
407
- if(row.cells?.length){
408
- const rclen = row.cells.length
409
- for(p; p < rclen; p++){
410
- const cell = row.cells[p]
411
- if(cell){
412
- const ccol = cell.column
413
- const el = document.querySelector("#panelDataGrid" + this.elifyGrouping + " #" + row.id + " .data-cell-" + this.common.elifyCol(ccol))
414
- if((el && el.getBoundingClientRect().right < this.dataTableService.tblLeft) && (!el?.innerHTML || !el.getAttribute("style"))){
415
- row.cells[p].visible = true
416
- row.cells[p] = {...this.addCell(cell.rawText, ccol, true)}
417
- }
418
- }
419
- }
420
- }
421
- }
422
- }
423
- }
424
-
425
- execVertScrollDown(cols: string[], colLen: number) {
426
- let canAdd = 0
427
- const vlen = this.dataTableService.visibleCols.length
428
- const lastVisInd = this.columns.indexOf(this.dataTableService.visibleCols[(vlen-1)]) + 1
429
- const bel = this.belowArea?.nativeElement
430
- const bbds = bel?.getBoundingClientRect()
431
- if(!bbds)
432
- return
433
- const rTop = (bbds?.top - this.verticalRest)
434
- const gap = this.tblBot - rTop
435
- const defNum = parseInt(this.dataTableService.defltRHgt.replace(/[ ]?px/g, ""))
436
- if(gap > 0){
437
- let h = 0
438
- let z = this.lastElRowIndex + 1
439
- const last = <HTMLElement>document.querySelector("#panelDataGrid" + this.elifyGrouping + " #dataTableRow" + this.lastElRowIndex)
440
- if(last && this.dataTableService.elIsBelowFold(last, this.tblBot))
441
- return;
442
- let bhToSub = 0
443
- let ahToAdd = 0
444
- const rowsInGap = Math.ceil(gap/defNum)
445
- canAdd = z+(rowsInGap)
446
- let numsToAdd: number[] = []
447
- let rowsToAdd: DataRow[] = []
448
- const goTo = Math.min(this.panelData.length, canAdd)
449
- for(z; z < goTo; z++){
450
- const wldBeElTop = bbds.top + (defNum*h);
451
- const wldBeElBot = wldBeElTop+defNum
452
- if(wldBeElBot < this.tblTop){
453
- ahToAdd += defNum
454
- bhToSub += defNum
455
- } else {
456
- if(wldBeElTop <= this.tblBot){
457
- const item = this.panelData[z]
458
- const index = this.dataTableService.currMapping[z] || this.dataTableService.findObjIndxInData(item)
459
- if(index > -1 && !this.rows.find( r => r.index === index)){
460
- const nRow: DataRow = { id: "dataTableRow" + index, index: index, width: this.useRowWid, cells: [], height: this.dataTableService.defltRHgt }
461
- let k = 0
462
- let cells: DataCell[] = []
463
- for(k; k < colLen; k++){
464
- const col = cols[k]
465
- const cell = this.addCell(item[col], col, (k <= lastVisInd))
466
- if(typeof cell !== "string")
467
- cells.push(cell)
468
- }
469
- nRow.cells = [...cells]
470
- rowsToAdd.push(nRow)
471
- numsToAdd.push((z+1))//just do it
472
- bhToSub += defNum
473
- }
474
- }
475
- }
476
- h += 1
477
- }
478
- if(rowsToAdd.length)
479
- this.rows = [...this.rows, ...rowsToAdd]
480
- if(bhToSub)
481
- this.belowHgt -= bhToSub
482
- if(this.showRowNumbers)
483
- this.rowNums = [...this.rowNums, ...numsToAdd]
484
- if(ahToAdd)
485
- this.aboveHgt += ahToAdd
486
- this.setLastRowIndex()
487
- }
488
- }
489
-
490
- execVertScrollUp(cols: string[], colLen: number) {
491
- const vlen = this.dataTableService.visibleCols.length
492
- const lastVisInd = this.columns.indexOf(this.dataTableService.visibleCols[(vlen-1)]) + 1;
493
- const ael = this.aboveArea?.nativeElement
494
- const abds = ael?.getBoundingClientRect()
495
- const defNum = parseInt(this.dataTableService.defltRHgt.replace(/[ ]?px/g, ""))
496
- const rbot = abds?.bottom || 0
497
- const gap = rbot - this.tblTop
498
- if(gap > 0){
499
- let h = 0
500
- const rlen = this.rows.length
501
- let z = (this.lastElRowIndex - rlen)
502
- if(z < 0)
503
- return
504
- let bhToAdd = 0
505
- let ahToSub = 0
506
- const rowsInGap = Math.ceil(gap/defNum)
507
- const min = Math.max(0, (z-rowsInGap))
508
- for(z; z >= min; z--){
509
- const wldBeElBot = rbot - (defNum*h);
510
- const wldBeElTop = wldBeElBot-defNum
511
- if(wldBeElTop > this.tblBot){
512
- bhToAdd += defNum
513
- ahToSub += defNum
514
- } else {
515
- if(wldBeElBot > this.tblTop){
516
- const item = this.panelData[z]
517
- const index = this.dataTableService.currMapping[z] || this.dataTableService.findObjIndxInData(item)
518
- if(index > -1){
519
- let k = 0
520
- const nRow: DataRow = { id: "dataTableRow" + index, index: index, width: this.useRowWid, cells: [], height: this.dataTableService.defltRHgt }
521
- let cells: DataCell[] = []
522
- for(k; k < colLen; k++){
523
- const col = cols[k]
524
- const cell = this.addCell(item[col], col, (k <= lastVisInd))
525
- if(typeof cell !== "string")
526
- cells.push(cell)
527
- }
528
- nRow.cells = [...cells]
529
- this.rows = [nRow, ...this.rows]
530
- if(this.showRowNumbers)
531
- this.rowNums = [(z+1), ...this.rowNums]
532
- ahToSub += defNum
533
- }
534
- }
535
- }
536
- h += 1
537
- }
538
- if(ahToSub){
539
- this.aboveHgt -= ahToSub
540
- }
541
- if(bhToAdd)
542
- this.belowHgt += bhToAdd
543
- }
544
- }
545
-
546
- clearAboveFoldRows() {
547
- const els = this.rows.filter( r => this.dataTableService.elIsAboveFold(document.getElementById(r.id), this.tblTop))
548
- const justids = els.map( e => e.id)
549
- const changes = justids.length
550
- if(changes > 0){
551
- const justindx = els.map( (e, i) => i)
552
- const defNum = parseInt(this.dataTableService.defltRHgt.replace(/[ ]?px/g, ""))
553
- this.rows = this.rows.filter( r => !justids.includes(r.id))
554
- if(this.showRowNumbers)
555
- this.rowNums = this.rowNums.filter( (c, i) => !justindx.includes(i))
556
- const item = this.dataTableService.mainData[(this.rows[0]?.index || -1)]
557
- if(item)
558
- this.aboveHgt = this.dataTableService.findObjIndxInData(item, this.panelData)*defNum
559
- }
560
- }
561
-
562
- clearBelowFoldRows() {
563
- const els = this.rows.filter( r => this.dataTableService.elIsBelowFold(document.getElementById(r.id), this.tblBot))
564
- const justids = els.map( e => e.id)
565
- let changes = justids.length
566
- if(changes > 0){
567
- const defNum = parseInt(this.dataTableService.defltRHgt.replace(/[ ]?px/g, ""))
568
- this.rows = this.rows.filter( r => !justids.includes(r.id))
569
- if(this.showRowNumbers){
570
- for(let p = (changes-1); p >= 0; p--)
571
- this.rowNums.pop()
572
- }
573
- const rlen = this.rows.length
574
- const item = this.dataTableService.mainData[(this.rows[(rlen-1)]?.index || -1)]
575
- if(item)
576
- this.belowHgt = ((this.panelData.length-1)-this.dataTableService.findObjIndxInData(item, this.panelData))*defNum
577
- this.setLastRowIndex()
578
- }
579
- }
580
-
581
- // execCellEdit(event: any) {//{ element: el, column: this.cell.column, value: val }
582
- // this.cellEdit.emit(event)
583
- // }
584
-
585
- setSingleRowHgt(val: any, row?: any) {
586
- if(val && typeof val === "string")
587
- val = Math.ceil(parseInt(val))
588
- const rHgt = val
589
- const useHgt = Math.floor(rHgt) + "px";
590
- if(typeof row === "string" && this.tblDragService.colDragStartFrmCellTracker.row && this.tblDragService.colDragStartFrmCellTracker.ystart){
591
- const drow = this.rows.find( r => r.id === row)
592
- if(drow)
593
- drow.height = useHgt
594
- }
595
- setTimeout( () => { this.setRowNumPlacement() })
596
- }
597
-
598
-
599
- }
@@ -1,44 +0,0 @@
1
- /// <reference lib="webworker" />
2
-
3
-
4
- addEventListener('message', ({ data }) => {
5
- // {id: someid, pk: primKey, main: this.dataTableService.mainData, curr: this.dataTableService.currFilData}
6
- let i = 0
7
- let map: any = {}
8
- let sendBack = { id: data.id, map: {} }
9
- const clen = data.curr.length
10
- const findObjIndxInData = (item: any) => {
11
- try{
12
- if(data.pk)
13
- return data.main.indexOf( data.main.find( (d: any) => d[data.pk] === item[data.pk]) )
14
- let i = 0; let eq = 0;
15
- const propLen = Object.keys(item).length
16
- const len = data.main?.length
17
- for(i; i < len; i++){
18
- eq = 0
19
- const mD = data.main[i]
20
- for(const prop in item){
21
- if(item[prop] === mD[prop])
22
- eq += 1
23
- if(eq === propLen)//they all equal
24
- return i
25
- }
26
- }
27
- return -1
28
- } catch(e) { return -1 }
29
- }
30
- const incr = 5000
31
- const withUpdates = clen > incr
32
- for(i; i < clen; i++){
33
- const item = data.curr[i]
34
- const index = findObjIndxInData(item)
35
- if(index > -1)
36
- map[i] = index
37
- if(withUpdates && (i%incr === 0)){
38
- sendBack.map = {...map}
39
- postMessage(sendBack);
40
- }
41
- }
42
- sendBack.map = {...map}
43
- postMessage(sendBack);
44
- });
@@ -1,5 +0,0 @@
1
- export interface CellEdit {
2
- value: any;
3
- row: number;
4
- column: string;
5
- }
@@ -1,10 +0,0 @@
1
- export interface ColumnHeader {
2
- column: string;
3
- width?: string;
4
- height?: string;
5
- lineHeight?: string;
6
- dataType: string;
7
- freeze: boolean;
8
- minimized: boolean;
9
- hideMinCol: boolean;
10
- }
@@ -1,14 +0,0 @@
1
- export interface ColumnStyles {
2
- column: string;
3
- css: ValueCss[];
4
- }
5
-
6
- export interface ValueCss {
7
- value: string;
8
- color?: string;
9
- font_size?: string;
10
- text_decoration?: string;
11
- font_weight?: string;
12
- /*add more valid css properties (sub underscore for a dash) as keys to suit your application's needs*/
13
- }
14
-
@@ -1,4 +0,0 @@
1
- export interface ColumnSymbol {
2
- column: string;
3
- symbol?: string;
4
- }