mat-table-ext 0.0.0 → 0.0.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.
- package/README.md +48 -27
- package/{projects/mat-table-ext/assets → assets}/pinIcon.svg +0 -0
- package/{projects/mat-table-ext/assets → assets}/pinLeft.svg +0 -0
- package/{projects/mat-table-ext/assets → assets}/pinNone.svg +0 -0
- package/{projects/mat-table-ext/assets → assets}/pinRight.svg +0 -0
- package/{projects/mat-table-ext/assets → assets}/pinned.svg +0 -0
- package/esm2020/lib/components/column-pinning/column-pinning.component.mjs +58 -0
- package/esm2020/lib/components/editing/editing.component.mjs +122 -0
- package/esm2020/lib/components/filter-columns-component/filter-columns-component.component.mjs +68 -0
- package/esm2020/lib/directives/resize-column.directive.mjs +99 -0
- package/esm2020/lib/mat-table-ext.component.mjs +1021 -0
- package/esm2020/lib/mat-table-ext.module.mjs +237 -0
- package/esm2020/lib/mat-table-ext.service.mjs +20 -0
- package/esm2020/lib/models/tableExtModels.mjs +2 -0
- package/esm2020/mat-table-ext.mjs +5 -0
- package/esm2020/public-api.mjs +11 -0
- package/fesm2015/mat-table-ext.mjs +1585 -0
- package/fesm2015/mat-table-ext.mjs.map +1 -0
- package/fesm2020/mat-table-ext.mjs +1582 -0
- package/fesm2020/mat-table-ext.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/column-pinning/column-pinning.component.d.ts +27 -0
- package/lib/components/editing/editing.component.d.ts +42 -0
- package/lib/components/filter-columns-component/filter-columns-component.component.d.ts +26 -0
- package/lib/directives/resize-column.directive.d.ts +27 -0
- package/lib/mat-table-ext.component.d.ts +348 -0
- package/lib/mat-table-ext.module.d.ts +58 -0
- package/lib/mat-table-ext.service.d.ts +11 -0
- package/lib/models/tableExtModels.d.ts +76 -0
- package/package.json +54 -45
- package/{projects/mat-table-ext/src/public-api.ts → public-api.d.ts} +1 -5
- package/.editorconfig +0 -16
- package/.vscode/extensions.json +0 -4
- package/.vscode/launch.json +0 -20
- package/.vscode/tasks.json +0 -42
- package/angular.json +0 -150
- package/projects/mat-table-ext/.browserslistrc +0 -16
- package/projects/mat-table-ext/README.md +0 -24
- package/projects/mat-table-ext/karma.conf.js +0 -44
- package/projects/mat-table-ext/ng-package.json +0 -9
- package/projects/mat-table-ext/package.json +0 -34
- package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.html +0 -7
- package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.scss +0 -9
- package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.spec.ts +0 -23
- package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.ts +0 -48
- package/projects/mat-table-ext/src/lib/components/editing/editing.component.html +0 -55
- package/projects/mat-table-ext/src/lib/components/editing/editing.component.scss +0 -19
- package/projects/mat-table-ext/src/lib/components/editing/editing.component.spec.ts +0 -23
- package/projects/mat-table-ext/src/lib/components/editing/editing.component.ts +0 -110
- package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.html +0 -26
- package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.scss +0 -0
- package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.spec.ts +0 -23
- package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.ts +0 -54
- package/projects/mat-table-ext/src/lib/directives/resize-column.directive.ts +0 -103
- package/projects/mat-table-ext/src/lib/mat-table-ext.component.html +0 -285
- package/projects/mat-table-ext/src/lib/mat-table-ext.component.spec.ts +0 -25
- package/projects/mat-table-ext/src/lib/mat-table-ext.component.ts +0 -985
- package/projects/mat-table-ext/src/lib/mat-table-ext.module.ts +0 -127
- package/projects/mat-table-ext/src/lib/mat-table-ext.scss +0 -189
- package/projects/mat-table-ext/src/lib/mat-table-ext.service.spec.ts +0 -16
- package/projects/mat-table-ext/src/lib/mat-table-ext.service.ts +0 -12
- package/projects/mat-table-ext/src/lib/models/tableExtModels.ts +0 -85
- package/projects/mat-table-ext/src/test.ts +0 -27
- package/projects/mat-table-ext/tsconfig.lib.json +0 -15
- package/projects/mat-table-ext/tsconfig.lib.prod.json +0 -10
- package/projects/mat-table-ext/tsconfig.spec.json +0 -17
- package/projects/mat-table-ext-example/.browserslistrc +0 -16
- package/projects/mat-table-ext-example/karma.conf.js +0 -44
- package/projects/mat-table-ext-example/src/app/app.component.html +0 -577
- package/projects/mat-table-ext-example/src/app/app.component.scss +0 -0
- package/projects/mat-table-ext-example/src/app/app.component.spec.ts +0 -31
- package/projects/mat-table-ext-example/src/app/app.component.ts +0 -173
- package/projects/mat-table-ext-example/src/app/app.module.ts +0 -40
- package/projects/mat-table-ext-example/src/app/service/custom-table.service.spec.ts +0 -16
- package/projects/mat-table-ext-example/src/app/service/custom-table.service.ts +0 -18
- package/projects/mat-table-ext-example/src/assets/.gitkeep +0 -0
- package/projects/mat-table-ext-example/src/assets/data.json +0 -100003
- package/projects/mat-table-ext-example/src/environments/environment.prod.ts +0 -3
- package/projects/mat-table-ext-example/src/environments/environment.ts +0 -16
- package/projects/mat-table-ext-example/src/favicon.ico +0 -0
- package/projects/mat-table-ext-example/src/index.html +0 -14
- package/projects/mat-table-ext-example/src/main.ts +0 -12
- package/projects/mat-table-ext-example/src/polyfills.ts +0 -53
- package/projects/mat-table-ext-example/src/styles.scss +0 -1
- package/projects/mat-table-ext-example/src/test.ts +0 -26
- package/projects/mat-table-ext-example/tsconfig.app.json +0 -15
- package/projects/mat-table-ext-example/tsconfig.spec.json +0 -18
- package/tsconfig.json +0 -38
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { Component, TemplateRef, ViewChild } from '@angular/core';
|
|
2
|
-
import { MatTableDataSource } from '@angular/material/table';
|
|
3
|
-
import { CustomTableService } from './service/custom-table.service';
|
|
4
|
-
import { MTExColumn } from '../../../mat-table-ext/src/lib/models/tableExtModels';
|
|
5
|
-
export const EXAMPLE_DATA: any[] = [
|
|
6
|
-
{
|
|
7
|
-
position: 1,
|
|
8
|
-
name: 'Boron',
|
|
9
|
-
weight: 10.811,
|
|
10
|
-
symbol: 'B',
|
|
11
|
-
gender: 'male',
|
|
12
|
-
mobile: '13198765432',
|
|
13
|
-
tele: '567891234',
|
|
14
|
-
city: 'Berlin',
|
|
15
|
-
address: 'Bernauer Str.111,13355',
|
|
16
|
-
date: '1423456765768',
|
|
17
|
-
website: 'www.matero.com',
|
|
18
|
-
company: 'matero',
|
|
19
|
-
email: 'Boron@gmail.com',
|
|
20
|
-
status: false,
|
|
21
|
-
cost: 4,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
position: 2,
|
|
25
|
-
name: 'Helium',
|
|
26
|
-
weight: 8.0026,
|
|
27
|
-
symbol: 'He',
|
|
28
|
-
gender: 'female',
|
|
29
|
-
mobile: '13034676675',
|
|
30
|
-
tele: '80675432',
|
|
31
|
-
city: 'Shanghai',
|
|
32
|
-
address: '88 Songshan Road',
|
|
33
|
-
date: '1423456765768',
|
|
34
|
-
website: 'www.matero.com',
|
|
35
|
-
company: 'matero',
|
|
36
|
-
email: 'Helium@gmail.com',
|
|
37
|
-
status: true,
|
|
38
|
-
cost: 5,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
position: 3,
|
|
42
|
-
name: 'Nitrogen',
|
|
43
|
-
weight: 14.0067,
|
|
44
|
-
symbol: 'N',
|
|
45
|
-
gender: 'male',
|
|
46
|
-
mobile: '15811112222',
|
|
47
|
-
tele: '345678912',
|
|
48
|
-
city: 'Sydney',
|
|
49
|
-
address: 'Circular Quay, Sydney NSW 2000',
|
|
50
|
-
date: '1423456765768',
|
|
51
|
-
website: 'www.matero.com',
|
|
52
|
-
company: 'matero',
|
|
53
|
-
email: 'Nitrogen@gmail.com',
|
|
54
|
-
status: true,
|
|
55
|
-
cost: 2,
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
@Component({
|
|
59
|
-
selector: 'app-root',
|
|
60
|
-
templateUrl: './app.component.html',
|
|
61
|
-
styleUrls: ['./app.component.scss'],
|
|
62
|
-
})
|
|
63
|
-
export class AppComponent {
|
|
64
|
-
title = 'mat-table-ext-example';
|
|
65
|
-
isLoading: boolean = false;
|
|
66
|
-
public dataSource: any = new MatTableDataSource(EXAMPLE_DATA);
|
|
67
|
-
stickyColumn: any = false;
|
|
68
|
-
columnResizable: any = false;
|
|
69
|
-
stickyFooter: any = false;
|
|
70
|
-
stickyHeader: any = false;
|
|
71
|
-
inlineRowEditing: any = false;
|
|
72
|
-
popupRowEditing: any = false;
|
|
73
|
-
inCellEditing: any = false;
|
|
74
|
-
deleteRow: any = false;
|
|
75
|
-
stripedRows: any = false;
|
|
76
|
-
rowSelection: any = false;
|
|
77
|
-
multiRowSelection: any = false;
|
|
78
|
-
simpleFilter: any = true;
|
|
79
|
-
selectionFilter: any = false;
|
|
80
|
-
toolbarToggle: any = true;
|
|
81
|
-
toolbarHeight: string = '';
|
|
82
|
-
showFirstLastButtons: any = false;
|
|
83
|
-
columnPinnable: any = false;
|
|
84
|
-
columnHidable: any = false;
|
|
85
|
-
exportButtonEnable: any = true;
|
|
86
|
-
@ViewChild('cellTemplate1') cellTemplate1!: TemplateRef<any>;
|
|
87
|
-
@ViewChild('cellTemplate2') cellTemplate2!: TemplateRef<any>;
|
|
88
|
-
|
|
89
|
-
public columns: MTExColumn[] = [
|
|
90
|
-
{ header: 'Position', field: 'position', width: '200px',type:'string' },
|
|
91
|
-
{ header: 'Name', field: 'name', width: '200px', pinned: 'left', type: 'string' },
|
|
92
|
-
{ header: 'Weight', field: 'weight', width: '200px', pinned: 'left', type: 'string' },
|
|
93
|
-
{ header: 'Symbol', field: 'symbol', width: '200px', type: 'string' },
|
|
94
|
-
{ header: 'Gender', field: 'gender', width: '200px', type: 'selection',options:['male','female'] }
|
|
95
|
-
];
|
|
96
|
-
multiSelectRow: any = true;
|
|
97
|
-
topSearchFilter: any = false;
|
|
98
|
-
tableHeight: string = '';
|
|
99
|
-
tableWidth: string = '';
|
|
100
|
-
isExpandEnable: any = false;
|
|
101
|
-
dragEnable: any = false;
|
|
102
|
-
sorting: any = false;
|
|
103
|
-
infiniteScroll: any = false;
|
|
104
|
-
scrollbarH: any = false;
|
|
105
|
-
paginationEnable: any = true;
|
|
106
|
-
headerTemplateRefCtrl: any = false;
|
|
107
|
-
cellTemplateRefCtrl: any = false;
|
|
108
|
-
toolbarTemplateRefCtrl: any = false;
|
|
109
|
-
popupTemplateRefCtrl: any = false;
|
|
110
|
-
inlineTemplateRefCtrl: any = false;
|
|
111
|
-
cellEditingTemplateRefCtrl: any = false;
|
|
112
|
-
constructor(public service: CustomTableService) {
|
|
113
|
-
// this.loadPage(10);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
ngOnInit(): void {}
|
|
117
|
-
|
|
118
|
-
showhidecolumn(op: string) {
|
|
119
|
-
switch (op) {
|
|
120
|
-
case 'inlineRowEditing': {
|
|
121
|
-
this.inlineRowEditing = !this.inlineRowEditing;
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
case 'popupRowEditing': {
|
|
125
|
-
this.popupRowEditing = !this.popupRowEditing;
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
case 'enableDelete': {
|
|
129
|
-
this.deleteRow = !this.deleteRow;
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
case 'select': {
|
|
133
|
-
this.multiRowSelection = !this.multiRowSelection;
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
showData(event: any, property: string) {
|
|
140
|
-
console.log(property, event);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
onScroll(event: any) {
|
|
144
|
-
let pageLimit: number = 10;
|
|
145
|
-
let scrollHeight = event.target.scrollHeight;
|
|
146
|
-
let scrollTop = event.target.scrollTop;
|
|
147
|
-
let clientHeight = event.target.clientHeight;
|
|
148
|
-
let scrollPosition = scrollHeight - (scrollTop + clientHeight);
|
|
149
|
-
console.log('scrollPosition', scrollPosition);
|
|
150
|
-
if (scrollPosition <= 5 && this.infiniteScroll) {
|
|
151
|
-
this.loadPage(pageLimit);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
loadPage(limit: number) {
|
|
156
|
-
this.isLoading = true;
|
|
157
|
-
let offset = this.dataSource ? this.dataSource.data.length : 0;
|
|
158
|
-
this.service.getResults(offset, limit).subscribe((results: any) => {
|
|
159
|
-
if (this.dataSource) {
|
|
160
|
-
const rows = [...this.dataSource.data, ...results.data];
|
|
161
|
-
this.dataSource = new MatTableDataSource(rows);
|
|
162
|
-
} else {
|
|
163
|
-
const rows = [...results.data];
|
|
164
|
-
this.dataSource = new MatTableDataSource(rows);
|
|
165
|
-
}
|
|
166
|
-
this.isLoading = false;
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
onSelectionChange(event: any) {
|
|
171
|
-
console.log('Selection Change: ', event);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
3
|
-
import { AppComponent } from './app.component';
|
|
4
|
-
import { MatTableExtModule } from 'mat-table-ext';
|
|
5
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
6
|
-
import { MatDialogModule } from '@angular/material/dialog';
|
|
7
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
8
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
10
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
11
|
-
import { MatDividerModule } from '@angular/material/divider';
|
|
12
|
-
import { MatCardModule } from '@angular/material/card';
|
|
13
|
-
import { MatInputModule } from '@angular/material/input';
|
|
14
|
-
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
15
|
-
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
16
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
17
|
-
|
|
18
|
-
@NgModule({
|
|
19
|
-
declarations: [AppComponent],
|
|
20
|
-
imports: [
|
|
21
|
-
BrowserModule,
|
|
22
|
-
BrowserAnimationsModule,
|
|
23
|
-
MatTableExtModule,
|
|
24
|
-
MatCheckboxModule,
|
|
25
|
-
MatDialogModule,
|
|
26
|
-
ReactiveFormsModule,
|
|
27
|
-
FormsModule,
|
|
28
|
-
MatSelectModule,
|
|
29
|
-
HttpClientModule,
|
|
30
|
-
MatIconModule,
|
|
31
|
-
MatDividerModule,
|
|
32
|
-
MatCardModule,
|
|
33
|
-
MatFormFieldModule,
|
|
34
|
-
MatInputModule,
|
|
35
|
-
MatSlideToggleModule,
|
|
36
|
-
],
|
|
37
|
-
providers: [],
|
|
38
|
-
bootstrap: [AppComponent],
|
|
39
|
-
})
|
|
40
|
-
export class AppModule {}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { CustomTableService } from './custom-table.service';
|
|
4
|
-
|
|
5
|
-
describe('CustomTableService', () => {
|
|
6
|
-
let service: CustomTableService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(CustomTableService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { BehaviorSubject, delay, map, Observable, of } from 'rxjs';
|
|
3
|
-
import data from '../../assets/data.json';
|
|
4
|
-
const companyData = data as any[];
|
|
5
|
-
@Injectable({
|
|
6
|
-
providedIn: 'root',
|
|
7
|
-
})
|
|
8
|
-
export class CustomTableService {
|
|
9
|
-
public selectedRow = new BehaviorSubject<any>(null);
|
|
10
|
-
public selectedRowIndex = new BehaviorSubject<any>(null);
|
|
11
|
-
constructor() {}
|
|
12
|
-
getResults(offset: number, limit: number): Observable<any> {
|
|
13
|
-
return of(companyData.slice(offset, offset + limit)).pipe(
|
|
14
|
-
delay(new Date(Date.now() + 250)),
|
|
15
|
-
map((d) => ({ data: d }))
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
File without changes
|