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.
- package/fesm2022/ngx-deebodata.mjs +6863 -0
- package/fesm2022/ngx-deebodata.mjs.map +1 -0
- package/package.json +35 -16
- package/types/ngx-deebodata.d.ts +439 -0
- package/ng-package.json +0 -7
- package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.css +0 -156
- package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.html +0 -29
- package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.spec.ts +0 -23
- package/src/lib/data-table/charts/bar-graph-component/bar-graph-component.ts +0 -286
- package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.css +0 -27
- package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.html +0 -53
- package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.spec.ts +0 -23
- package/src/lib/data-table/charts/charts-and-graphs/charts-and-graphs.ts +0 -214
- package/src/lib/data-table/charts/column-chart/column-chart.css +0 -19
- package/src/lib/data-table/charts/column-chart/column-chart.html +0 -47
- package/src/lib/data-table/charts/column-chart/column-chart.spec.ts +0 -23
- package/src/lib/data-table/charts/column-chart/column-chart.ts +0 -178
- package/src/lib/data-table/charts/line-graph-component/line-graph-component.css +0 -33
- package/src/lib/data-table/charts/line-graph-component/line-graph-component.html +0 -59
- package/src/lib/data-table/charts/line-graph-component/line-graph-component.spec.ts +0 -23
- package/src/lib/data-table/charts/line-graph-component/line-graph-component.ts +0 -661
- package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.css +0 -61
- package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.html +0 -27
- package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.spec.ts +0 -23
- package/src/lib/data-table/charts/num-value-distro-component/num-value-distro-component.ts +0 -210
- package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.css +0 -0
- package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.html +0 -15
- package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.spec.ts +0 -23
- package/src/lib/data-table/charts/pie-graph-component/pie-graph-component.ts +0 -197
- package/src/lib/data-table/data-table-module/data-cell/data-cell.css +0 -0
- package/src/lib/data-table/data-table-module/data-cell/data-cell.html +0 -6
- package/src/lib/data-table/data-table-module/data-cell/data-cell.spec.ts +0 -23
- package/src/lib/data-table/data-table-module/data-cell/data-cell.ts +0 -271
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.css +0 -25
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.html +0 -55
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.spec.ts +0 -23
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.ts +0 -261
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.css +0 -69
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.html +0 -24
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.spec.ts +0 -23
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.ts +0 -125
- package/src/lib/data-table/data-table-module/export-component/export-component.css +0 -91
- package/src/lib/data-table/data-table-module/export-component/export-component.html +0 -16
- package/src/lib/data-table/data-table-module/export-component/export-component.spec.ts +0 -23
- package/src/lib/data-table/data-table-module/export-component/export-component.ts +0 -206
- package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.css +0 -91
- package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.html +0 -193
- package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.spec.ts +0 -23
- package/src/lib/data-table/data-table-module/ngx-deebodata/ngx-deebodata.ts +0 -2226
- package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.css +0 -14
- package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.html +0 -27
- package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.spec.ts +0 -23
- package/src/lib/data-table/data-table-module/row-group-menu/row-group-menu.ts +0 -58
- package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.css +0 -23
- package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.html +0 -48
- package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.spec.ts +0 -23
- package/src/lib/data-table/data-table-module/row-group-panel/row-group-panel.ts +0 -599
- package/src/lib/data-table/data-table-module/worker.worker.ts +0 -44
- package/src/lib/interfaces/cell-edit.ts +0 -5
- package/src/lib/interfaces/column-header.ts +0 -10
- package/src/lib/interfaces/column-styles.ts +0 -14
- package/src/lib/interfaces/column-symbol.ts +0 -4
- package/src/lib/interfaces/data-cell.ts +0 -14
- package/src/lib/interfaces/data-row.ts +0 -11
- package/src/lib/interfaces/row-number.ts +0 -4
- package/src/lib/services/common-service.spec.ts +0 -16
- package/src/lib/services/common-service.ts +0 -336
- package/src/lib/services/data-table-service.spec.ts +0 -16
- package/src/lib/services/data-table-service.ts +0 -597
- package/src/lib/services/table-drag-service.spec.ts +0 -16
- package/src/lib/services/table-drag-service.ts +0 -347
- package/src/lib/styles.css +0 -1065
- package/src/public-api.ts +0 -8
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { Component, ElementRef, EventEmitter, Input, Output, SimpleChanges, ViewChild } from '@angular/core';
|
|
2
|
-
import { DataCell } from '../../../interfaces/data-cell';
|
|
3
|
-
import { CommonService } from '../../../services/common-service';
|
|
4
|
-
import { TableDragService } from '../../../services/table-drag-service';
|
|
5
|
-
import { CommonModule } from '@angular/common';
|
|
6
|
-
import { DataTableService } from '../../../services/data-table-service';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'app-data-cell',
|
|
10
|
-
imports: [CommonModule],
|
|
11
|
-
templateUrl: './data-cell.html',
|
|
12
|
-
styleUrl: '../../../styles.css'
|
|
13
|
-
})
|
|
14
|
-
export class DataCellComponent {
|
|
15
|
-
|
|
16
|
-
constructor(public tblDragService: TableDragService,
|
|
17
|
-
public dataTableService: DataTableService,
|
|
18
|
-
private common: CommonService,) {
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
init = true
|
|
23
|
-
ready = false
|
|
24
|
-
canEdit = false
|
|
25
|
-
elCol: string = ""
|
|
26
|
-
cellStyle: any = {}
|
|
27
|
-
setCellEditScrlActionTO: any = null;
|
|
28
|
-
@Input() rawText: any;
|
|
29
|
-
@Input() cell!: DataCell;
|
|
30
|
-
@Input() rowId: string = "";//starts with dataTableRow
|
|
31
|
-
@Input() colWid: string = "";
|
|
32
|
-
@Input() rowHeight: string = "";
|
|
33
|
-
@Input() noColResize: boolean = false;
|
|
34
|
-
@Input() columnValClass: string = "";
|
|
35
|
-
@Output("width") width: EventEmitter<number> = new EventEmitter()
|
|
36
|
-
@Output("height") height: EventEmitter<any> = new EventEmitter()
|
|
37
|
-
@Output("edit") edit: EventEmitter<any> = new EventEmitter()
|
|
38
|
-
@Output("dragListen") dragListen: EventEmitter<any> = new EventEmitter()
|
|
39
|
-
@Output("validateEditFocus") validateEditFocus: EventEmitter<any> = new EventEmitter()
|
|
40
|
-
@Output("clearVEditFocus") clearVEditFocus: EventEmitter<any> = new EventEmitter()
|
|
41
|
-
@ViewChild('cellEl', { static: true }) cellElem!: ElementRef<HTMLElement>
|
|
42
|
-
rightAlign: string = "";//for numbers, always add a space in front
|
|
43
|
-
symbolCls: string = "";//also for numbers only, always add a space in front
|
|
44
|
-
|
|
45
|
-
ngOnChanges(changes: SimpleChanges) {
|
|
46
|
-
if(!this.init){
|
|
47
|
-
if(this.cell.visible || changes["rowHeight"]){
|
|
48
|
-
if(typeof changes !== "undefined" && (changes["cell"] || changes["rowHeight"] || changes["colWid"]))
|
|
49
|
-
this.applyDimensions()
|
|
50
|
-
if(this.cell.visible && !this.ready)
|
|
51
|
-
this.handleSettingText()
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
ngOnInit() {
|
|
57
|
-
if(this.cell.visible)
|
|
58
|
-
this.applyDimensions()
|
|
59
|
-
if(this.cell.column)
|
|
60
|
-
this.elCol = this.common.elifyCol(this.cell.column)
|
|
61
|
-
this.rightAlign = this.cell.dataType === "number" ? " data-cell-riiight" : "";
|
|
62
|
-
this.applySymbol()
|
|
63
|
-
this.canEdit = this.cell.editable && !this.validateEdit()//to see if free text edit
|
|
64
|
-
this.init = false
|
|
65
|
-
this.tblDragService.cellDims.subscribe( d => { this.updateUiColCellTheme(d.prop, d.value) })
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
ngAfterViewInit() {
|
|
69
|
-
if(this.cell.visible)
|
|
70
|
-
this.handleSettingText()
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
validateEdit(): boolean {
|
|
74
|
-
if(!this.cell.html && (["number", "date"].includes(this.cell.dataType) || this.dataTableService.dataFilSrtTracker[this.cell.column].selDDVals))
|
|
75
|
-
return true
|
|
76
|
-
return false
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
applySymbol() {
|
|
80
|
-
const sym = this.dataTableService.dataFilSrtTracker[this.cell.column]["colCellSymbol"];
|
|
81
|
-
if(sym){
|
|
82
|
-
this.symbolCls = ["$","€","£","¥","₣","₹"].indexOf(sym) > -1 ? " has-symbol-b" : " has-symbol";
|
|
83
|
-
this.cellElem.nativeElement.setAttribute("data-symbol", sym)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
handleSettingText() {
|
|
88
|
-
if(this.cell.text || (this.cell.html && !/<img/g.test(this.cell.html)))
|
|
89
|
-
return this.setCellText()
|
|
90
|
-
if(this.cell.html)
|
|
91
|
-
setTimeout( () => { this.setCellText() }, 100)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setCellText() {
|
|
95
|
-
const cell = this.cellElem.nativeElement
|
|
96
|
-
if(this.cell.text && !cell.textContent)
|
|
97
|
-
cell.textContent = this.cell.text
|
|
98
|
-
if(this.cell.html && !cell.innerHTML)
|
|
99
|
-
cell.innerHTML = this.cell.html
|
|
100
|
-
this.ready = true
|
|
101
|
-
if(this.cell.html){
|
|
102
|
-
setTimeout( () => {
|
|
103
|
-
const ancOIm = (document.querySelector("#" + this.rowId + " .data-cell-" + this.elCol + " a") ||
|
|
104
|
-
document.querySelector("#" + this.rowId + " .data-cell-" + this.elCol + " img"))
|
|
105
|
-
if(ancOIm){
|
|
106
|
-
ancOIm.addEventListener("mousemove", e => { e && e.stopPropagation() })
|
|
107
|
-
ancOIm.addEventListener("mousedown", e => { e && e.stopPropagation() })
|
|
108
|
-
ancOIm.addEventListener("mouseup", e => { e && e.stopPropagation() })
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
applyDimensions() {
|
|
115
|
-
this.cellStyle = { "width": (this.cell.width || this.colWid), "height": this.rowHeight }
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
updateUiColCellTheme(cssProp: string, val: number) {
|
|
119
|
-
const rProp = this.common.replaceUniSep(this.tblDragService.currColForDataRow)
|
|
120
|
-
if(cssProp === "height" && (this.cell.column === this.tblDragService.currColForDataRow || this.cell.column === rProp) &&
|
|
121
|
-
this.tblDragService.currDataRow.id === this.rowId)
|
|
122
|
-
this.height.emit(val)
|
|
123
|
-
const prop = this.common.replaceUniSep(this.dataTableService.currColumnEdit)
|
|
124
|
-
if(prop && this.dataTableService.dataFilSrtTracker[prop]){
|
|
125
|
-
if(cssProp === "width"){
|
|
126
|
-
this.dataTableService.dataFilSrtTracker[prop].colWidth = (val || parseInt(this.colWid)).toString() + "px"
|
|
127
|
-
this.width.emit(val || parseInt(this.colWid))
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
handleColResDblClick(prop: string) {
|
|
133
|
-
if(this.dataTableService.dataFilSrtTracker[prop]){
|
|
134
|
-
let i = 0
|
|
135
|
-
let wids = []
|
|
136
|
-
let useWid = 50
|
|
137
|
-
const elCol = this.common.elifyCol(prop)
|
|
138
|
-
const els = document.getElementsByClassName("data-cell-" + elCol)
|
|
139
|
-
const nw = els[0]?.getBoundingClientRect().width || 0
|
|
140
|
-
const len = els.length
|
|
141
|
-
for(i; i < len; i++)
|
|
142
|
-
wids.push(els[i].scrollWidth)
|
|
143
|
-
useWid =wids.sort()[(len-1)]
|
|
144
|
-
if(useWid && useWid > nw){
|
|
145
|
-
const cswid = (Math.ceil(useWid+1))
|
|
146
|
-
this.dataTableService.currColumnEdit = elCol
|
|
147
|
-
this.updateUiColCellTheme("width", cswid)
|
|
148
|
-
setTimeout( () => this.dataTableService.currColumnEdit = null)
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
validateRawText(text: string, col: string, dataType: string): string {
|
|
154
|
-
if(this.dataTableService.dataFilSrtTracker[col].selDDVals){
|
|
155
|
-
if(this.dataTableService.dataFilSrtTracker[col].selDDVals.map( (d: any) => d.value).includes(text))
|
|
156
|
-
return text
|
|
157
|
-
return "";
|
|
158
|
-
}
|
|
159
|
-
if(dataType === "number" && (!text || /[a-zA-Z \/]/g.test(text)))
|
|
160
|
-
return ""
|
|
161
|
-
return text
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
setToEditAfterTO() {
|
|
165
|
-
this.setCellEditScrlActionTO = setTimeout( () => {
|
|
166
|
-
if(this.dataTableService.currEditCol === this.cell.column)
|
|
167
|
-
this.setCellToEdit(true)
|
|
168
|
-
}, 100)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
setCellToEdit(noHScrl?: boolean) {
|
|
172
|
-
if(this.tblDragService.didResizeOnEvent || !this.cell.editable){
|
|
173
|
-
if(!this.cell.editable){
|
|
174
|
-
this.dataTableService.clearAllFocused()
|
|
175
|
-
this.dataTableService.clearDCellFcsd()
|
|
176
|
-
this.clearVEditFocus.emit("")
|
|
177
|
-
this.dataTableService.currEditCol = ""
|
|
178
|
-
this.setCellEditScrlActionTO = null;
|
|
179
|
-
this.dataTableService.autoScrollOnEdit = false
|
|
180
|
-
this.dataTableService.currEditIndex = -1
|
|
181
|
-
}
|
|
182
|
-
return//not editable or was really a drag event, not click
|
|
183
|
-
}
|
|
184
|
-
this.dataTableService.currEditCol = this.cell.column
|
|
185
|
-
this.dataTableService.currEditIndex = parseInt(this.rowId.replace(/^dataTableRow/, ""))
|
|
186
|
-
const cell = this.cellElem.nativeElement
|
|
187
|
-
const cellWid = parseInt(this.dataTableService.useColWid?.replace(/px/g, "") || "250")
|
|
188
|
-
if(cell.getBoundingClientRect().right+cellWid >= this.dataTableService.tblRight){
|
|
189
|
-
if(!noHScrl){
|
|
190
|
-
this.dataTableService.autoScrollOnEdit = true
|
|
191
|
-
const grid = <HTMLElement>document.getElementById("dataTableBody")
|
|
192
|
-
grid.scrollBy((cellWid+1), 0)
|
|
193
|
-
}
|
|
194
|
-
if(!this.setCellEditScrlActionTO){
|
|
195
|
-
return this.setToEditAfterTO()
|
|
196
|
-
} else {
|
|
197
|
-
window.clearTimeout(this.setCellEditScrlActionTO)
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const ddReClick = cell.classList.contains("focused-el")
|
|
201
|
-
this.dataTableService.clearAllFocused()
|
|
202
|
-
this.dataTableService.clearDCellFcsd()
|
|
203
|
-
this.setCellEditScrlActionTO = null;
|
|
204
|
-
setTimeout( () => this.dataTableService.autoScrollOnEdit = false)
|
|
205
|
-
if(this.needsVal()){
|
|
206
|
-
const okText = this.validateRawText(this.cell.rawText, this.cell.column, this.cell.dataType)
|
|
207
|
-
if(this.cell.rawText && !okText)
|
|
208
|
-
return;
|
|
209
|
-
this.validateEditFocus.emit({type: this.cell.dataType, value: okText})
|
|
210
|
-
if(this.dataTableService.dataFilSrtTracker[this.cell.column].selDDVals){//only for sel dds
|
|
211
|
-
if(ddReClick){
|
|
212
|
-
cell.blur()
|
|
213
|
-
return this.dataTableService.clearAllFocused()
|
|
214
|
-
}
|
|
215
|
-
setTimeout( () => {if(this.dataTableService.currEditCol === this.cell.column) cell.focus() }, 45)
|
|
216
|
-
setTimeout( () => {if(this.dataTableService.currEditCol === this.cell.column) cell.classList.add("focused-el") }, 150)
|
|
217
|
-
}
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
this.clearVEditFocus.emit("")
|
|
221
|
-
setTimeout( () => {
|
|
222
|
-
const fCellDragger = <HTMLElement>document.getElementsByClassName("focused-cell-dragger")[0]
|
|
223
|
-
const par = fCellDragger?.parentElement
|
|
224
|
-
if(fCellDragger && par){
|
|
225
|
-
const cbds = cell.getBoundingClientRect()
|
|
226
|
-
const rbds = par.getBoundingClientRect()
|
|
227
|
-
fCellDragger.style.left = (Math.ceil(cbds.left-rbds.left) + cbds.width - 4) + "px";
|
|
228
|
-
fCellDragger.style.top = (Math.ceil(cbds.bottom-rbds.top) - 4) + "px";
|
|
229
|
-
}
|
|
230
|
-
})
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
needsVal(): boolean {
|
|
234
|
-
if(!this.cell.html && (["number", "date"].includes(this.cell.dataType) || this.dataTableService.dataFilSrtTracker[this.cell.column].selDDVals))
|
|
235
|
-
return true
|
|
236
|
-
return false
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
emitEdit(event: any) {
|
|
240
|
-
if(!this.cell.editable || this.needsVal()/*only for validated edits*/ ||
|
|
241
|
-
(event.relatedTarget && event.relatedTarget.classList.contains("edit-input")))
|
|
242
|
-
return;
|
|
243
|
-
this.execFreeEdit()
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
execFreeEdit() {
|
|
247
|
-
const el = this.cellElem.nativeElement
|
|
248
|
-
const val = el.textContent
|
|
249
|
-
if(val !== this.rawText)
|
|
250
|
-
this.edit.emit({ column: this.cell.column, value: val })
|
|
251
|
-
else{
|
|
252
|
-
setTimeout( () => {
|
|
253
|
-
const actEl = document.activeElement
|
|
254
|
-
if(actEl && actEl.id === "fCellDragger"){
|
|
255
|
-
el.classList.add("dragger-cell-focused")
|
|
256
|
-
this.dragListen.emit(true)
|
|
257
|
-
} else {
|
|
258
|
-
if(!actEl || (actEl && !/data-cell/g.test(actEl?.className))){
|
|
259
|
-
this.dataTableService.currEditIndex = -1
|
|
260
|
-
const fCellDragger = <HTMLElement>document.getElementsByClassName("focused-cell-dragger")[0]
|
|
261
|
-
if(fCellDragger && !this.dataTableService.autoScrollOnEdit){
|
|
262
|
-
fCellDragger.style.removeProperty("top")
|
|
263
|
-
fCellDragger.style.removeProperty("left")
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
})
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.btn-x-filter{
|
|
2
|
-
padding: 0;
|
|
3
|
-
float: left;
|
|
4
|
-
border: none;
|
|
5
|
-
color: maroon;
|
|
6
|
-
background: none;
|
|
7
|
-
font-weight: 600;
|
|
8
|
-
font-size: x-large;
|
|
9
|
-
line-height: 16px;
|
|
10
|
-
margin: 17px 0 0 3px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.btn-x-filter:hover{
|
|
14
|
-
background: #fdf3f3;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.span-disabled{
|
|
18
|
-
opacity: 0.5;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.not-licensed{
|
|
22
|
-
background-image: url("https://d2ffvluimla00s.cloudfront.net/deebo-water.webp") !important;
|
|
23
|
-
background-position: right !important;
|
|
24
|
-
background-repeat: no-repeat !important
|
|
25
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<div #colHeader [id]="'columnHeader' + elCol" class="col-header" (dblclick)="handleColResDblClick(columnHeader.column)"
|
|
2
|
-
[ngClass]="{ 'col-item-freeze': columnHeader.freeze, 'col-header-minimized': columnHeader.minimized, 'not-licensed': !common.goodLs() }"
|
|
3
|
-
[ngStyle]="{'width': columnHeader.width, 'height': columnHeader.height, 'lineHeight': columnHeader.lineHeight}"
|
|
4
|
-
(mousedown)="tblDragService.handleHeaderSizeAdjust($event)" (mouseup)="tblDragService.handleColResMouseUp($event)"
|
|
5
|
-
(mousemove)="tblDragService.checkItemBorderCursor($event)" (mousemove)="tblDragService.handleHeaderSizeAdjust($event)">
|
|
6
|
-
<span (mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)"
|
|
7
|
-
(click)="doSortOnClick($event, columnHeader.column)" [class.span-disabled]="dataTableService.isSorting()">{{text}}</span>
|
|
8
|
-
<button [id]="'btnSort' + elCol" type="button" [disabled]="dataTableService.isSorting()" (click)="doSortOnClick($event, columnHeader.column)" class="data-sort-arr"
|
|
9
|
-
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="preventTabScroll()" (mouseup)="common.unbindMouseEvent($event)"
|
|
10
|
-
(focus)="emitTabFocus(elCol)">
|
|
11
|
-
<i class="material-icons v-mid">{{dataTableService.dataFilSrtTracker[columnHeader.column].sort === "asc" ? "arrow_downward" : "arrow_upward"}}</i>
|
|
12
|
-
</button>
|
|
13
|
-
@if(dataTableService.sortOrder.indexOf(columnHeader.column) > -1){
|
|
14
|
-
<sup [class.prevent]="dataTableService.isSorting()" (click)="doSortOnClick($event, columnHeader.column)"
|
|
15
|
-
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)"
|
|
16
|
-
class="sort-order-indicator">{{(dataTableService.sortOrder.indexOf(columnHeader.column)+1) | number}}</sup>
|
|
17
|
-
}
|
|
18
|
-
@if(common.goodLs()){
|
|
19
|
-
<button [id]="'btnMin' + elCol" type="button" (click)="minimizeColumn(columnHeader.column)" class="btn-min-col" [class.btn-min-col-hide]="hideMinCol"
|
|
20
|
-
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="preventTabScroll()" (mouseup)="common.unbindMouseEvent($event)"
|
|
21
|
-
(focus)="emitTabFocus(elCol)">
|
|
22
|
-
<i class="material-icons">minimize</i>
|
|
23
|
-
</button>
|
|
24
|
-
}
|
|
25
|
-
@if(canFreeze){
|
|
26
|
-
<button type="button" (click)="freezeColOnClick($event, columnHeader.column)" class="btn-freeze-col"
|
|
27
|
-
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" >
|
|
28
|
-
<i class="material-icons">featured_play_list</i>
|
|
29
|
-
</button>
|
|
30
|
-
}
|
|
31
|
-
<br>
|
|
32
|
-
@if(dataTableService.dataFilSrtTracker[columnHeader.column].filter || dataTableService.hasUnchkdDDVals(dataTableService.dataFilSrtTracker[columnHeader.column]) > 0){
|
|
33
|
-
<button type="button" class="btn-x-filter" (click)="resetColFilter($event, columnHeader.column)"
|
|
34
|
-
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" >×</button>
|
|
35
|
-
}
|
|
36
|
-
<input #filterInput [name]="'filter' + elCol" [class.select-filter]="isSelect" [id]="'filter' + elCol"
|
|
37
|
-
(input)="filterOnKeyUp($event, columnHeader.column, $any($event).target.value)" maxlength="255" autocomplete="off"
|
|
38
|
-
(keyup)="filterOnKeyUp($event, columnHeader.column, $any($event).target.value)" [attr.type]="columnHeader.dataType"
|
|
39
|
-
(focus)="emitFilterFocus($any($event).target, columnHeader.column)" (click)="emitFilterClick($any($event).target, columnHeader.column)"
|
|
40
|
-
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" />
|
|
41
|
-
<select #compSelect [id]="'selectComp' + elCol" [name]="'selectComp' + elCol" [(ngModel)]="dataTableService.dataFilSrtTracker[columnHeader.column].comparator"
|
|
42
|
-
(change)="handleComparatorChange(columnHeader.column, $any($event).target.value)" class="select-filter-comparator" (focus)="handleCompFocus()"
|
|
43
|
-
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" >
|
|
44
|
-
<option value="">Comparison?</option>
|
|
45
|
-
@for(opt of compOpts; track opt){
|
|
46
|
-
<option [value]="opt" [attr.selected]="isSelect && opt === 'Equals'" >{{opt}}</option>
|
|
47
|
-
}
|
|
48
|
-
</select>
|
|
49
|
-
<div class="inline relly" style="z-index: 1;">
|
|
50
|
-
<button class="btn-fil-comp" type="button"
|
|
51
|
-
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" >
|
|
52
|
-
<i class="material-icons" aria-hidden="false">filter_list</i>
|
|
53
|
-
</button>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { DataTableHeader } from './data-table-header';
|
|
4
|
-
|
|
5
|
-
describe('DataTableHeader', () => {
|
|
6
|
-
let component: DataTableHeader;
|
|
7
|
-
let fixture: ComponentFixture<DataTableHeader>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [DataTableHeader]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(DataTableHeader);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output, ViewChild, ElementRef, } from '@angular/core';
|
|
2
|
-
import { ColumnHeader } from '../../../interfaces/column-header';
|
|
3
|
-
import { CommonService } from '../../../services/common-service';
|
|
4
|
-
import { DataTableService } from '../../../services/data-table-service';
|
|
5
|
-
import { FormsModule } from '@angular/forms';
|
|
6
|
-
import { TableDragService } from '../../../services/table-drag-service';
|
|
7
|
-
import { CommonModule, DecimalPipe } from '@angular/common';
|
|
8
|
-
|
|
9
|
-
export interface columnWidthResize{
|
|
10
|
-
column: string
|
|
11
|
-
value: number
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'app-data-table-header',
|
|
16
|
-
imports: [CommonModule, FormsModule, DecimalPipe, ],
|
|
17
|
-
templateUrl: './data-table-header.html',
|
|
18
|
-
styleUrls: ['./data-table-header.css', '../../../styles.css']
|
|
19
|
-
})
|
|
20
|
-
export class DataTableHeader {
|
|
21
|
-
|
|
22
|
-
constructor(public common: CommonService,
|
|
23
|
-
public tblDragService: TableDragService,
|
|
24
|
-
public dataTableService: DataTableService,){
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
init = false;
|
|
29
|
-
showBtnX = false;
|
|
30
|
-
isSelect = false
|
|
31
|
-
autoMaxed = false
|
|
32
|
-
text: string = ""
|
|
33
|
-
elCol: string = "";
|
|
34
|
-
canTabScroll = true
|
|
35
|
-
compOpts: string[] = []
|
|
36
|
-
filterBuildUp: any[] = []
|
|
37
|
-
@Input() colWid: string = "";
|
|
38
|
-
@Input() canFreeze: boolean = false;
|
|
39
|
-
@Input() hideMinCol: boolean = false;
|
|
40
|
-
@Input() columnHeader!: ColumnHeader;
|
|
41
|
-
@Output("sort") sort: EventEmitter<string> = new EventEmitter()
|
|
42
|
-
@Output("render") render: EventEmitter<any> = new EventEmitter()
|
|
43
|
-
@Output("width") width: EventEmitter<columnWidthResize> = new EventEmitter()
|
|
44
|
-
@Output("height") height: EventEmitter<number> = new EventEmitter()
|
|
45
|
-
@Output("reset") reset: EventEmitter<string> = new EventEmitter()
|
|
46
|
-
@Output("freeze") freeze: EventEmitter<string> = new EventEmitter()
|
|
47
|
-
@Output("filFocus") filFocus: EventEmitter<any> = new EventEmitter()
|
|
48
|
-
@Output("filSelClick") filSelClick: EventEmitter<any> = new EventEmitter()
|
|
49
|
-
@Output("minimize") minimize: EventEmitter<string> = new EventEmitter()
|
|
50
|
-
@Output("emitCompFocus") emitCompFocus: EventEmitter<boolean> = new EventEmitter()
|
|
51
|
-
@Output("scrollOnFocus") scrollOnFocus: EventEmitter<string> = new EventEmitter()
|
|
52
|
-
@ViewChild('colHeader', { static: true }) colHeaderEl!: ElementRef<HTMLElement>
|
|
53
|
-
@ViewChild('filterInput', { static: true }) filterInputEl!: ElementRef<HTMLInputElement>
|
|
54
|
-
@ViewChild('compSelect', { static: true }) compSelectEl!: ElementRef<HTMLSelectElement>
|
|
55
|
-
|
|
56
|
-
ngOnInit() {
|
|
57
|
-
this.elCol = this.common.elifyCol(this.columnHeader.column)
|
|
58
|
-
this.text = this.common.titleCase(this.columnHeader.column)
|
|
59
|
-
this.isSelect = this.dataTableService.dataFilSrtTracker[this.columnHeader.column]?.["selDDVals"]?.length
|
|
60
|
-
if(this.isSelect){
|
|
61
|
-
const canComp = ["Equals", "Not Equal", "Empty", "Not Empty",]
|
|
62
|
-
this.compOpts = this.dataTableService.comparatorOpts[this.columnHeader.dataType].
|
|
63
|
-
filter( (co: string) => canComp.indexOf(co) > -1 );
|
|
64
|
-
} else {
|
|
65
|
-
this.compOpts = [...this.dataTableService.comparatorOpts[this.columnHeader.dataType]]
|
|
66
|
-
}
|
|
67
|
-
this.tblDragService.headDims.subscribe( d => { this.updateUiColCellTheme(d.prop, d.value) })
|
|
68
|
-
this.dataTableService.setIdealColumnWidth.subscribe( c => { this.handleColResDblClick(this.columnHeader.column, true) })
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
ngAfterViewInit() {
|
|
72
|
-
if(this.isSelect){
|
|
73
|
-
setTimeout( () => {
|
|
74
|
-
this.filterInputEl?.nativeElement.setAttribute("readonly", "true")
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
if(this.columnHeader.dataType === "date"){
|
|
78
|
-
setTimeout( () => {
|
|
79
|
-
this.filterInputEl?.nativeElement.addEventListener("change", e => { this.filterDateOnKeyUp(e) })
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
preventTabScroll() {
|
|
85
|
-
this.canTabScroll = false
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
emitTabFocus(col: string) {
|
|
89
|
-
if(this.canTabScroll)
|
|
90
|
-
this.scrollOnFocus.emit(col)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
handleCompFocus() {
|
|
94
|
-
this.emitCompFocus.emit(true)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
freezeColOnClick(e: any, prop: string) {
|
|
98
|
-
e && e.stopPropagation()
|
|
99
|
-
try{
|
|
100
|
-
const currCol = this.dataTableService.dataFilSrtTracker[prop]
|
|
101
|
-
if(currCol){
|
|
102
|
-
this.dataTableService.dataFilSrtTracker[prop].freeze = !currCol.freeze
|
|
103
|
-
const nowVal = this.dataTableService.dataFilSrtTracker[prop].freeze
|
|
104
|
-
if(nowVal)
|
|
105
|
-
this.columnHeader.freeze = true
|
|
106
|
-
else
|
|
107
|
-
this.columnHeader.freeze = false
|
|
108
|
-
this.freeze.emit(prop)
|
|
109
|
-
}
|
|
110
|
-
}catch(e){}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
minimizeColumn(col: string) {
|
|
114
|
-
this.canTabScroll = true
|
|
115
|
-
this.dataTableService.dataFilSrtTracker[col].minimize = true
|
|
116
|
-
this.dataTableService.sortOrder = this.dataTableService.sortOrder.filter( (s: any) => s !== col )
|
|
117
|
-
this.minimize.emit(col)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
doSortOnClick(e: any, col: string) {
|
|
121
|
-
e && e.stopPropagation()
|
|
122
|
-
this.canTabScroll = true
|
|
123
|
-
if(!this.dataTableService.isSorting()){
|
|
124
|
-
this.dataTableService.isSorting.set(true)
|
|
125
|
-
setTimeout( () => {
|
|
126
|
-
this.dataTableService.doSortOnField(col)
|
|
127
|
-
this.render.emit({value: (this.dataTableService.dataFilSrtTracker[col].filter || ""), field: col})
|
|
128
|
-
if(!this.dataTableService.currSelRows.length && this.dataTableService.arefilSrtTrkPropsDefault())
|
|
129
|
-
this.reset.emit(col)
|
|
130
|
-
this.dataTableService.isSorting.set(false)
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
resetColFilter(event: any, field: string) {
|
|
136
|
-
event && event.stopPropagation()
|
|
137
|
-
const fil = this.filterInputEl.nativeElement
|
|
138
|
-
const comp = this.compSelectEl.nativeElement
|
|
139
|
-
if(fil){
|
|
140
|
-
fil.value = "";
|
|
141
|
-
if(this.isSelect){
|
|
142
|
-
comp.value = "Equals"
|
|
143
|
-
this.recheckAllDDOpts(field)
|
|
144
|
-
this.dataTableService.dataFilSrtTracker[field].comparator = "Equals"
|
|
145
|
-
} else {
|
|
146
|
-
comp.value = ""
|
|
147
|
-
this.dataTableService.dataFilSrtTracker[field].comparator = null
|
|
148
|
-
}
|
|
149
|
-
this.filterOnKeyUp(event, field, "", true)
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
recheckAllDDOpts(prop: string) {
|
|
154
|
-
this.dataTableService.dataFilSrtTracker[prop]["selDDVals"] = this.dataTableService.dataFilSrtTracker[prop]["selDDVals"].
|
|
155
|
-
map( function(v: any) {v.checked = true; return v})
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
filterDateOnKeyUp(event: any) {
|
|
159
|
-
const elId: string = event.target?.id?.replace(/filter/g, "")
|
|
160
|
-
const field: string = this.common.replaceUniSep(elId)
|
|
161
|
-
this.filterOnKeyUp(event, field, event.target.value)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
filTO: any = null;
|
|
165
|
-
|
|
166
|
-
filterOnKeyUp(event:any, field: string, val: any, manual?: any) {
|
|
167
|
-
const filObj = {value: val, field: field}
|
|
168
|
-
if(field && !this.dataTableService.isFiltering()){
|
|
169
|
-
if(!manual && event && event.type !== "change" && !this.common.keyCanSearch(event))
|
|
170
|
-
return;
|
|
171
|
-
this.dataTableService.isFiltering.set(true)
|
|
172
|
-
this.dataTableService.dataFilSrtTracker[field].filter = val || ""
|
|
173
|
-
this.dataTableService.columnFilter(this.dataTableService.mainData, field, this.dataTableService.dataFilSrtTracker, this.dataTableService.sortOrder, manual)
|
|
174
|
-
this.render.emit(filObj)
|
|
175
|
-
if(this.filTO){
|
|
176
|
-
clearTimeout(this.filTO)
|
|
177
|
-
this.filTO = null
|
|
178
|
-
}
|
|
179
|
-
this.filTO = setTimeout( () => {
|
|
180
|
-
this.dataTableService.isFiltering.set(false)
|
|
181
|
-
const buildUpLen = this.filterBuildUp.length
|
|
182
|
-
if(buildUpLen){
|
|
183
|
-
const filBld = this.filterBuildUp[(buildUpLen-1)]
|
|
184
|
-
this.filterOnKeyUp(null, filBld.field, filBld.value, true)
|
|
185
|
-
this.filterBuildUp = []
|
|
186
|
-
if((this.dataTableService.dataFilSrtTracker[field].filter ||
|
|
187
|
-
(this.dataTableService.dataFilSrtTracker[field].comparator && this.dataTableService.dataFilSrtTracker[field].comparator != "Equals")
|
|
188
|
-
)){
|
|
189
|
-
this.showBtnX = true
|
|
190
|
-
} else {
|
|
191
|
-
this.showBtnX = false
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}, 500)
|
|
195
|
-
if((this.dataTableService.dataFilSrtTracker[field].filter ||
|
|
196
|
-
(this.dataTableService.dataFilSrtTracker[field].comparator && this.dataTableService.dataFilSrtTracker[field].comparator != "Equals")
|
|
197
|
-
)){
|
|
198
|
-
this.showBtnX = true
|
|
199
|
-
} else {
|
|
200
|
-
this.showBtnX = false
|
|
201
|
-
}
|
|
202
|
-
const tlFil = <HTMLInputElement>document.getElementsByName("topLevelDataFilter")[0]
|
|
203
|
-
if(tlFil)
|
|
204
|
-
tlFil.value = ""
|
|
205
|
-
} else {
|
|
206
|
-
if(!this.filterBuildUp.find( f => f.value === val && f.field === field))
|
|
207
|
-
this.filterBuildUp.push(filObj)
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
handleComparatorChange(col: string, comp: string) {
|
|
212
|
-
if(col){
|
|
213
|
-
const value = this.dataTableService.dataFilSrtTracker[col].filter
|
|
214
|
-
this.dataTableService.dataFilSrtTracker[col].comparator = comp
|
|
215
|
-
this.filterOnKeyUp(null, col, (value || ""), true)
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
updateUiColCellTheme(cssProp: string, val: number, col?: string) {
|
|
220
|
-
if(cssProp === "height")
|
|
221
|
-
this.height.emit(val)
|
|
222
|
-
const prop = col || this.common.replaceUniSep(this.dataTableService.currColumnEdit)
|
|
223
|
-
if(prop && this.dataTableService.dataFilSrtTracker[prop]){
|
|
224
|
-
if(cssProp === "width"){
|
|
225
|
-
this.dataTableService.dataFilSrtTracker[prop].colWidth = (val || parseInt(this.colWid)).toString()
|
|
226
|
-
this.width.emit({column: prop, value: val || parseInt(this.colWid)})
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
handleColResDblClick(prop: string, auto?: boolean) {
|
|
232
|
-
if(this.dataTableService.dataFilSrtTracker[prop] && (!auto || (!this.autoMaxed && this.dataTableService.visibleCols.includes(prop)))){
|
|
233
|
-
let i = 0
|
|
234
|
-
let wids = []
|
|
235
|
-
let useWid = 50
|
|
236
|
-
const els = document.getElementsByClassName("data-cell-" + this.common.elifyCol(prop))
|
|
237
|
-
const nw = els[0]?.getBoundingClientRect().width || 0
|
|
238
|
-
const len = els.length
|
|
239
|
-
if(len){
|
|
240
|
-
for(i; i < len; i++)
|
|
241
|
-
wids.push(els[i].scrollWidth)
|
|
242
|
-
useWid =wids.sort()[(len-1)]
|
|
243
|
-
if(useWid && useWid > nw){
|
|
244
|
-
const cswid = Math.ceil(Math.max((useWid+1), parseInt(this.dataTableService.useColWid.replace(/[ ]?px/g, ""))))
|
|
245
|
-
this.updateUiColCellTheme("width", cswid, prop)
|
|
246
|
-
this.autoMaxed = true
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
emitFilterFocus(target: HTMLInputElement, col: string) {
|
|
253
|
-
this.filFocus.emit({ target: target, col: col, select: this.isSelect })
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
emitFilterClick(target: HTMLInputElement, col: string) {
|
|
257
|
-
if(this.isSelect)
|
|
258
|
-
this.filSelClick.emit({ target: target, col: col})
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
}
|