ngx-deebodata-community 0.1.2 → 0.1.4
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/README.md +1 -1
- package/ng-package.json +7 -0
- package/package.json +20 -38
- 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 +6 -0
- package/src/lib/data-table/data-table-module/data-cell/data-cell.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/data-cell/data-cell.ts +276 -0
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.css +19 -0
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.html +47 -0
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/data-table-header/data-table-header.ts +206 -0
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.css +65 -0
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.html +10 -0
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/data-table-paginator/data-table-paginator.ts +45 -0
- package/src/lib/data-table/data-table-module/ngx-deebodata-community/ngx-deebodata-community-component.css +75 -0
- package/src/lib/data-table/data-table-module/ngx-deebodata-community/ngx-deebodata-community-component.html +106 -0
- package/src/lib/data-table/data-table-module/ngx-deebodata-community/ngx-deebodata-community.spec.ts +23 -0
- package/src/lib/data-table/data-table-module/ngx-deebodata-community/ngx-deebodata-community.ts +1776 -0
- package/src/lib/data-table/data-table-module/worker.worker.ts +44 -0
- package/src/lib/interfaces/cell-edit.ts +7 -0
- package/src/lib/interfaces/column-header.ts +10 -0
- package/src/lib/interfaces/column-symbol.ts +4 -0
- package/src/lib/interfaces/data-cell.ts +13 -0
- package/src/lib/interfaces/data-row.ts +11 -0
- package/src/lib/interfaces/row-number.ts +4 -0
- package/src/lib/services/common-service.spec.ts +16 -0
- package/src/lib/services/common-service.ts +331 -0
- package/src/lib/services/data-table-service.spec.ts +16 -0
- package/src/lib/services/data-table-service.ts +513 -0
- package/src/lib/services/table-drag-service.spec.ts +16 -0
- package/src/lib/services/table-drag-service.ts +347 -0
- package/src/lib/styles.css +714 -0
- package/src/public-api.ts +7 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/fesm2022/ngx-deebodata-community.mjs +0 -3539
- package/fesm2022/ngx-deebodata-community.mjs.map +0 -1
- package/types/ngx-deebodata-community.d.ts +0 -363
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# NgxDeebodataCommunity
|
|
2
2
|
|
|
3
|
-
Open-source data grid with virtual scroll, column resizing, cell editing, tab accessibility, sorting, and filtering.
|
|
3
|
+
Open-source data grid with virtual scroll, column resizing, cell editing, tab accessibility, row selection, sorting, and filtering.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,38 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ngx-deebodata-community",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"peerDependencies": {
|
|
6
|
-
"@angular/common": "^21.2.0",
|
|
7
|
-
"@angular/core": "^21.2.0",
|
|
8
|
-
"@angular/forms": "^21.2.0",
|
|
9
|
-
"@angular/platform-browser": "^21.2.0"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"virtual-scroll",
|
|
22
|
-
"accessibility",
|
|
23
|
-
"free",
|
|
24
|
-
"MIT"
|
|
25
|
-
],
|
|
26
|
-
"module": "fesm2022/ngx-deebodata-community.mjs",
|
|
27
|
-
"typings": "types/ngx-deebodata-community.d.ts",
|
|
28
|
-
"exports": {
|
|
29
|
-
"./package.json": {
|
|
30
|
-
"default": "./package.json"
|
|
31
|
-
},
|
|
32
|
-
".": {
|
|
33
|
-
"types": "./types/ngx-deebodata-community.d.ts",
|
|
34
|
-
"default": "./fesm2022/ngx-deebodata-community.mjs"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"type": "module"
|
|
38
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ngx-deebodata-community",
|
|
3
|
+
"description": "Angular data grid that solves data analysis problems with virtual scroll, column resizing, cell editing, tab accessibility, sorting, and filtering.",
|
|
4
|
+
"version": "0.1.4",
|
|
5
|
+
"peerDependencies": {
|
|
6
|
+
"@angular/common": "^21.2.0",
|
|
7
|
+
"@angular/core": "^21.2.0",
|
|
8
|
+
"@angular/forms": "^21.2.0",
|
|
9
|
+
"@angular/platform-browser": "^21.2.0",
|
|
10
|
+
"rxjs": "^7.8.0"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"tslib": "^2.3.0"
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": { "url": "https://github.com/briannick1991/ngx-deebodata-community" },
|
|
18
|
+
"homepage": "https://deebodata.com/ngx-deebodata-documentation/ngx-deebodata-community",
|
|
19
|
+
"keywords": ["grid", "data-grid", "angular", "open-source", "datagrid", "virtual-scroll", "accessibility", "free", "MIT"]
|
|
20
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<div #cellEl [attr.contenteditable]="canEdit" [ngStyle]="cellStyle" class="data-cell data-cell-{{elCol}}{{rightAlign}}{{symbolCls}}"
|
|
2
|
+
[ngClass]="{ 'col-item-freeze': cell.freeze, 'holding-check': cell.column === dataTableService.firstCol }" tabindex="0"
|
|
3
|
+
(mousemove)="tblDragService.checkItemBorderCursor($event, noColResize)" (mousemove)="tblDragService.handleCellSizeAdjust($event, elCol)"
|
|
4
|
+
(mousedown)="tblDragService.handleCellSizeAdjust($event, elCol)" (focus)="setCellToEdit()" (blur)="emitEdit($event)"
|
|
5
|
+
[attr.data-index]="rowId" (dblclick)="handleColResDblClick(cell.column)" (keydown.tab)="checkNeedsSroll()"
|
|
6
|
+
></div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { DataCell } from './data-cell';
|
|
4
|
+
|
|
5
|
+
describe('DataCell', () => {
|
|
6
|
+
let component: DataCell;
|
|
7
|
+
let fixture: ComponentFixture<DataCell>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [DataCell]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(DataCell);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,276 @@
|
|
|
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
|
+
inlineLink = false;
|
|
28
|
+
scrollOnTab: boolean = false;
|
|
29
|
+
setCellEditScrlActionTO: any = null;
|
|
30
|
+
@Input() rawText: any;
|
|
31
|
+
@Input() cell!: DataCell;
|
|
32
|
+
@Input() rowId: string = "";//starts with dataTableRow
|
|
33
|
+
@Input() colWid: string = "";
|
|
34
|
+
@Input() rowHeight: string = "";
|
|
35
|
+
@Input() noColResize: boolean = false;
|
|
36
|
+
@Output("width") width: EventEmitter<number> = new EventEmitter()
|
|
37
|
+
@Output("height") height: EventEmitter<any> = new EventEmitter()
|
|
38
|
+
@Output("edit") edit: EventEmitter<any> = new EventEmitter()
|
|
39
|
+
@Output("dragListen") dragListen: EventEmitter<any> = new EventEmitter()
|
|
40
|
+
@Output("validateEditFocus") validateEditFocus: EventEmitter<any> = new EventEmitter()
|
|
41
|
+
@Output("clearVEditFocus") clearVEditFocus: EventEmitter<any> = new EventEmitter()
|
|
42
|
+
@ViewChild('cellEl', { static: true }) cellElem!: ElementRef<HTMLElement>
|
|
43
|
+
rightAlign: string = "";//for numbers, always add a space in front
|
|
44
|
+
symbolCls: string = "";//also for numbers only, always add a space in front
|
|
45
|
+
|
|
46
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
47
|
+
if(!this.init){
|
|
48
|
+
if(this.cell.visible || changes["rowHeight"]){
|
|
49
|
+
if(typeof changes !== "undefined" && (changes["cell"] || changes["rowHeight"] || changes["colWid"]))
|
|
50
|
+
this.applyDimensions()
|
|
51
|
+
if(this.cell.visible && !this.ready)
|
|
52
|
+
this.handleSettingText()
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ngOnInit() {
|
|
58
|
+
if(this.cell.visible)
|
|
59
|
+
this.applyDimensions()
|
|
60
|
+
if(this.cell.column)
|
|
61
|
+
this.elCol = this.common.elifyCol(this.cell.column)
|
|
62
|
+
this.rightAlign = this.cell.dataType === "number" ? " data-cell-riiight" : "";
|
|
63
|
+
this.applySymbol()
|
|
64
|
+
this.canEdit = this.cell.editable && !this.validateEdit()//to see if free text edit
|
|
65
|
+
this.init = false
|
|
66
|
+
this.tblDragService.cellDims.subscribe( d => { this.updateUiColCellTheme(d.prop, d.value) })
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
ngAfterViewInit() {
|
|
70
|
+
if(this.cell.visible)
|
|
71
|
+
this.handleSettingText()
|
|
72
|
+
this.isLastCellInRow()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
validateEdit(): boolean {
|
|
76
|
+
if(!this.cell.html && (["number", "date"].includes(this.cell.dataType)))
|
|
77
|
+
return true
|
|
78
|
+
return false
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
applySymbol() {
|
|
82
|
+
const sym = this.dataTableService.dataFilSrtTracker[this.cell.column]["colCellSymbol"];
|
|
83
|
+
if(sym){
|
|
84
|
+
this.symbolCls = ["$","€","£","¥","₣","₹"].indexOf(sym) > -1 ? " has-symbol-b" : " has-symbol";
|
|
85
|
+
this.cellElem.nativeElement.setAttribute("data-symbol", sym)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
handleSettingText() {
|
|
90
|
+
if(this.cell.text || (this.cell.html && !/<img/g.test(this.cell.html)))
|
|
91
|
+
return this.setCellText()
|
|
92
|
+
if(this.cell.html)
|
|
93
|
+
setTimeout( () => { this.setCellText() }, 100)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
isLastCellInRow(): boolean {
|
|
97
|
+
const nxtCell: HTMLElement = <HTMLElement>this.cellElem.nativeElement?.parentElement?.nextElementSibling
|
|
98
|
+
if(!nxtCell)
|
|
99
|
+
this.scrollOnTab = true
|
|
100
|
+
return this.scrollOnTab
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
setCellText() {
|
|
104
|
+
const cell = this.cellElem.nativeElement
|
|
105
|
+
if(this.cell.text && !cell.textContent)
|
|
106
|
+
cell.textContent = this.cell.text
|
|
107
|
+
if(this.cell.html && !cell.innerHTML){
|
|
108
|
+
cell.innerHTML = this.cell.html
|
|
109
|
+
if(/[A-Za-z0-9][ ]?\<a/g.test(this.cell.html) || /a\>[ ]?[A-Za-z0-9]/g.test(this.cell.html))
|
|
110
|
+
cell.style.display = "inline-block"
|
|
111
|
+
}
|
|
112
|
+
this.ready = true
|
|
113
|
+
if(this.cell.html){
|
|
114
|
+
setTimeout( () => {
|
|
115
|
+
const ancOIm = (document.querySelector("#" + this.rowId + " .data-cell-" + this.elCol + " a") ||
|
|
116
|
+
document.querySelector("#" + this.rowId + " .data-cell-" + this.elCol + " img"))
|
|
117
|
+
if(ancOIm){
|
|
118
|
+
ancOIm.addEventListener("mousemove", e => { e && e.stopPropagation() })
|
|
119
|
+
ancOIm.addEventListener("mousedown", e => { e && e.stopPropagation() })
|
|
120
|
+
ancOIm.addEventListener("mouseup", e => { e && e.stopPropagation() })
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
applyDimensions() {
|
|
127
|
+
this.cellStyle = { "width": (this.cell.width || this.colWid), "height": this.rowHeight }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
updateUiColCellTheme(cssProp: string, val: number) {
|
|
131
|
+
const rProp = this.common.replaceUniSep(this.tblDragService.currColForDataRow)
|
|
132
|
+
if(cssProp === "height" && (this.cell.column === this.tblDragService.currColForDataRow || this.cell.column === rProp) &&
|
|
133
|
+
this.tblDragService.currDataRow.id === this.rowId)
|
|
134
|
+
this.height.emit(val)
|
|
135
|
+
const prop = this.common.replaceUniSep(this.dataTableService.currColumnEdit)
|
|
136
|
+
if(prop && this.dataTableService.dataFilSrtTracker[prop]){
|
|
137
|
+
if(cssProp === "width"){
|
|
138
|
+
this.dataTableService.dataFilSrtTracker[prop].colWidth = (val || parseInt(this.colWid)).toString() + "px"
|
|
139
|
+
this.width.emit(val || parseInt(this.colWid))
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
handleColResDblClick(prop: string) {
|
|
145
|
+
if(this.dataTableService.dataFilSrtTracker[prop]){
|
|
146
|
+
let i = 0
|
|
147
|
+
let wids = []
|
|
148
|
+
let useWid = 50
|
|
149
|
+
const elCol = this.common.elifyCol(prop)
|
|
150
|
+
const els = document.getElementsByClassName("data-cell-" + elCol)
|
|
151
|
+
const nw = els[0]?.getBoundingClientRect().width || 0
|
|
152
|
+
const len = els.length
|
|
153
|
+
for(i; i < len; i++)
|
|
154
|
+
wids.push(els[i].scrollWidth)
|
|
155
|
+
useWid =wids.sort()[(len-1)]
|
|
156
|
+
if(useWid && useWid > nw){
|
|
157
|
+
const cswid = (Math.ceil(useWid+1))
|
|
158
|
+
this.dataTableService.currColumnEdit = elCol
|
|
159
|
+
this.updateUiColCellTheme("width", cswid)
|
|
160
|
+
setTimeout( () => this.dataTableService.currColumnEdit = null)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
validateRawText(text: string, dataType: string): string {
|
|
166
|
+
if(dataType === "number" && (!text || /[a-zA-Z \/]/g.test(text)))
|
|
167
|
+
return ""
|
|
168
|
+
return text
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
setToEditAfterTO() {
|
|
172
|
+
this.setCellEditScrlActionTO = setTimeout( () => {
|
|
173
|
+
if(this.dataTableService.currEditCol === this.cell.column)
|
|
174
|
+
this.setCellToEdit(true)
|
|
175
|
+
}, 100)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
setCellToEdit(noHScrl?: boolean) {
|
|
179
|
+
if(this.tblDragService.didResizeOnEvent || !this.cell.editable){
|
|
180
|
+
if(!this.cell.editable){
|
|
181
|
+
this.dataTableService.clearAllFocused()
|
|
182
|
+
this.dataTableService.clearDCellFcsd()
|
|
183
|
+
this.clearVEditFocus.emit("")
|
|
184
|
+
this.dataTableService.currEditCol = ""
|
|
185
|
+
this.setCellEditScrlActionTO = null;
|
|
186
|
+
this.dataTableService.autoScrollOnEdit = false
|
|
187
|
+
this.dataTableService.currEditIndex = -1
|
|
188
|
+
}
|
|
189
|
+
return//not editable or was really a drag event, not click
|
|
190
|
+
}
|
|
191
|
+
this.dataTableService.currEditCol = this.cell.column
|
|
192
|
+
this.dataTableService.currEditIndex = parseInt(this.rowId.replace(/^dataTableRow/, ""))
|
|
193
|
+
const cell = this.cellElem.nativeElement
|
|
194
|
+
const cellWid = parseInt(this.dataTableService.useColWid?.replace(/px/g, "") || "250")
|
|
195
|
+
if(cell.getBoundingClientRect().right+cellWid >= this.dataTableService.tblRight){
|
|
196
|
+
if(!noHScrl){
|
|
197
|
+
this.dataTableService.autoScrollOnEdit = true
|
|
198
|
+
const grid = <HTMLElement>document.getElementById("dataTableBody")
|
|
199
|
+
grid.scrollBy((cellWid+1), 0)
|
|
200
|
+
}
|
|
201
|
+
if(!this.setCellEditScrlActionTO){
|
|
202
|
+
return this.setToEditAfterTO()
|
|
203
|
+
} else {
|
|
204
|
+
window.clearTimeout(this.setCellEditScrlActionTO)
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
this.dataTableService.clearAllFocused()
|
|
208
|
+
this.dataTableService.clearDCellFcsd()
|
|
209
|
+
this.setCellEditScrlActionTO = null;
|
|
210
|
+
setTimeout( () => this.dataTableService.autoScrollOnEdit = false)
|
|
211
|
+
if(this.needsVal()){
|
|
212
|
+
const okText = this.validateRawText(this.cell.rawText, this.cell.dataType)
|
|
213
|
+
if(this.cell.rawText && !okText)
|
|
214
|
+
return;
|
|
215
|
+
this.validateEditFocus.emit({type: this.cell.dataType, value: okText})
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
this.clearVEditFocus.emit("")
|
|
219
|
+
setTimeout( () => {
|
|
220
|
+
const fCellDragger = <HTMLElement>document.getElementsByClassName("focused-cell-dragger")[0]
|
|
221
|
+
const par = fCellDragger?.parentElement
|
|
222
|
+
if(fCellDragger && par){
|
|
223
|
+
const cbds = cell.getBoundingClientRect()
|
|
224
|
+
const rbds = par.getBoundingClientRect()
|
|
225
|
+
fCellDragger.style.left = (Math.ceil(cbds.left-rbds.left) + cbds.width - 4) + "px";
|
|
226
|
+
fCellDragger.style.top = (Math.ceil(cbds.bottom-rbds.top) - 4) + "px";
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
needsVal(): boolean {
|
|
232
|
+
if(!this.cell.html && (["number", "date"].includes(this.cell.dataType)))
|
|
233
|
+
return true
|
|
234
|
+
return false
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
emitEdit(event: any) {
|
|
238
|
+
if(!this.cell.editable || this.needsVal()/*only for validated edits*/ ||
|
|
239
|
+
(event.relatedTarget && event.relatedTarget.classList.contains("edit-input")))
|
|
240
|
+
return;
|
|
241
|
+
this.execFreeEdit()
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
checkNeedsSroll() {
|
|
245
|
+
if(this.scrollOnTab){
|
|
246
|
+
this.dataTableService.autoScrollOnEdit = true
|
|
247
|
+
this.dataTableService.scrollBodyForTabbing()
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
execFreeEdit() {
|
|
252
|
+
const el = this.cellElem.nativeElement
|
|
253
|
+
const val = el.textContent
|
|
254
|
+
if(val !== this.rawText)
|
|
255
|
+
this.edit.emit({ column: this.cell.column, value: val })
|
|
256
|
+
else{
|
|
257
|
+
setTimeout( () => {
|
|
258
|
+
const actEl = document.activeElement
|
|
259
|
+
if(actEl && actEl.id === "fCellDragger"){
|
|
260
|
+
el.classList.add("dragger-cell-focused")
|
|
261
|
+
this.dragListen.emit(true)
|
|
262
|
+
} else {
|
|
263
|
+
if(!actEl || (actEl && !/data-cell/g.test(actEl?.className))){
|
|
264
|
+
this.dataTableService.currEditIndex = -1
|
|
265
|
+
const fCellDragger = <HTMLElement>document.getElementsByClassName("focused-cell-dragger")[0]
|
|
266
|
+
if(fCellDragger && !this.dataTableService.autoScrollOnEdit){
|
|
267
|
+
fCellDragger.style.removeProperty("top")
|
|
268
|
+
fCellDragger.style.removeProperty("left")
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<div #colHeader [id]="'columnHeader' + elCol" class="col-header" (dblclick)="handleColResDblClick(columnHeader.column)"
|
|
2
|
+
[ngClass]="{ 'col-item-freeze': columnHeader.freeze, }"
|
|
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(canFreeze){
|
|
19
|
+
<button type="button" (click)="freezeColOnClick($event, columnHeader.column)" class="btn-freeze-col"
|
|
20
|
+
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" >
|
|
21
|
+
<i class="material-icons">featured_play_list</i>
|
|
22
|
+
</button>
|
|
23
|
+
}
|
|
24
|
+
<br>
|
|
25
|
+
@if(dataTableService.dataFilSrtTracker[columnHeader.column].filter){
|
|
26
|
+
<button type="button" class="btn-x-filter" (click)="resetColFilter($event, columnHeader.column)"
|
|
27
|
+
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" >×</button>
|
|
28
|
+
}
|
|
29
|
+
<input #filterInput [name]="'filter' + elCol" [id]="'filter' + elCol"
|
|
30
|
+
(input)="filterOnKeyUp($event, columnHeader.column, $any($event).target.value)" maxlength="255" autocomplete="off"
|
|
31
|
+
(keyup)="filterOnKeyUp($event, columnHeader.column, $any($event).target.value)" [attr.type]="columnHeader.dataType"
|
|
32
|
+
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" />
|
|
33
|
+
<select #compSelect [id]="'selectComp' + elCol" [name]="'selectComp' + elCol" [(ngModel)]="dataTableService.dataFilSrtTracker[columnHeader.column].comparator"
|
|
34
|
+
(change)="handleComparatorChange(columnHeader.column, $any($event).target.value)" class="select-filter-comparator"
|
|
35
|
+
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" >
|
|
36
|
+
<option value="">Comparison?</option>
|
|
37
|
+
@for(opt of compOpts; track opt){
|
|
38
|
+
<option [value]="opt" >{{opt}}</option>
|
|
39
|
+
}
|
|
40
|
+
</select>
|
|
41
|
+
<div class="inline relly" style="z-index: 1;">
|
|
42
|
+
<button class="btn-fil-comp" type="button"
|
|
43
|
+
(mousemove)="common.unbindMouseEvent($event)" (mousedown)="common.unbindMouseEvent($event)" (mouseup)="common.unbindMouseEvent($event)" >
|
|
44
|
+
<i class="material-icons" aria-hidden="false">filter_list</i>
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
});
|