ng-dynamic-datatable 0.0.0 → 0.0.1
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 +109 -34
- package/fesm2022/ng-dynamic-datatable.mjs +469 -0
- package/fesm2022/ng-dynamic-datatable.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/dynamic-datatable.component.d.ts +79 -0
- package/lib/dynamic-datatable.types.d.ts +4 -0
- package/lib/models.d.ts +45 -0
- package/package.json +35 -38
- package/{projects/dynamic-datatable/src/public-api.ts → public-api.d.ts} +2 -6
- package/.editorconfig +0 -17
- package/.vscode/extensions.json +0 -4
- package/.vscode/launch.json +0 -20
- package/.vscode/tasks.json +0 -42
- package/angular.json +0 -44
- package/projects/dynamic-datatable/README.md +0 -134
- package/projects/dynamic-datatable/ng-package.json +0 -7
- package/projects/dynamic-datatable/package.json +0 -24
- package/projects/dynamic-datatable/src/lib/dynamic-datatable.component.html +0 -137
- package/projects/dynamic-datatable/src/lib/dynamic-datatable.component.scss +0 -237
- package/projects/dynamic-datatable/src/lib/dynamic-datatable.component.spec.ts +0 -23
- package/projects/dynamic-datatable/src/lib/dynamic-datatable.component.ts +0 -556
- package/projects/dynamic-datatable/src/lib/dynamic-datatable.service.spec.ts +0 -16
- package/projects/dynamic-datatable/src/lib/dynamic-datatable.service.ts +0 -9
- package/projects/dynamic-datatable/src/lib/dynamic-datatable.types.ts +0 -4
- package/projects/dynamic-datatable/src/lib/models.ts +0 -52
- package/projects/dynamic-datatable/tsconfig.lib.json +0 -15
- package/projects/dynamic-datatable/tsconfig.lib.prod.json +0 -11
- package/projects/dynamic-datatable/tsconfig.spec.json +0 -15
- package/tsconfig.json +0 -32
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
<div class="ndt-card">
|
|
2
|
-
<div class="ndt-header">
|
|
3
|
-
<h3 class="ndt-title">{{ mergedConfig.title }}</h3>
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
|
-
<div class="ndt-toolbar">
|
|
7
|
-
<div class="ndt-left-tools">
|
|
8
|
-
<ng-container *ngIf="isFeatureOn('export')">
|
|
9
|
-
<button class="ndt-btn" type="button" (click)="exportCSV()" *ngIf="isExportFormatEnabled('csv')">
|
|
10
|
-
Export CSV
|
|
11
|
-
</button>
|
|
12
|
-
<button class="ndt-btn" type="button" (click)="exportExcel()" *ngIf="isExportFormatEnabled('excel')">
|
|
13
|
-
Export Excel
|
|
14
|
-
</button>
|
|
15
|
-
</ng-container>
|
|
16
|
-
|
|
17
|
-
<label class="ndt-inline-label" *ngIf="isFeatureOn('rowsPerPage') && isFeatureOn('pagination')">
|
|
18
|
-
Rows per page:
|
|
19
|
-
<select [value]="rowsPerPage" (change)="onRowsPerPageChange($event)">
|
|
20
|
-
<option *ngFor="let option of mergedConfig.rowsPerPageOptions || []" [value]="option">{{ option }}</option>
|
|
21
|
-
</select>
|
|
22
|
-
</label>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div class="ndt-right-tools" *ngIf="isFeatureOn('searching')">
|
|
26
|
-
<input
|
|
27
|
-
type="search"
|
|
28
|
-
placeholder="Search records"
|
|
29
|
-
[value]="searchTerm"
|
|
30
|
-
(input)="onSearchInput($event)"
|
|
31
|
-
/>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
<div class="ndt-table-wrap">
|
|
36
|
-
<table class="ndt-table">
|
|
37
|
-
<colgroup>
|
|
38
|
-
<col *ngIf="isFeatureOn('checkboxSelection')" style="width: 44px" />
|
|
39
|
-
<col *ngFor="let column of mergedColumns" [style.width]="toColumnWidth(column.width)" />
|
|
40
|
-
<col *ngIf="isFeatureOn('actions')" style="width: 78px" />
|
|
41
|
-
</colgroup>
|
|
42
|
-
|
|
43
|
-
<thead>
|
|
44
|
-
<tr>
|
|
45
|
-
<th *ngIf="isFeatureOn('checkboxSelection')">
|
|
46
|
-
<input
|
|
47
|
-
type="checkbox"
|
|
48
|
-
[checked]="isCurrentPageFullySelected()"
|
|
49
|
-
(change)="toggleSelectAllCurrentPage($event)"
|
|
50
|
-
/>
|
|
51
|
-
</th>
|
|
52
|
-
<th
|
|
53
|
-
*ngFor="let column of mergedColumns"
|
|
54
|
-
[class.ndt-sortable]="isFeatureOn('sorting') && !!column.sortable"
|
|
55
|
-
(click)="toggleSort(column)"
|
|
56
|
-
>
|
|
57
|
-
<span class="ndt-th-content">
|
|
58
|
-
<span class="ndt-th-label">{{ column.label }}</span>
|
|
59
|
-
<span class="ndt-sort-indicator" *ngIf="isFeatureOn('sorting') && column.sortable">
|
|
60
|
-
{{ getSortIndicator(column.key.toString()) }}
|
|
61
|
-
</span>
|
|
62
|
-
</span>
|
|
63
|
-
</th>
|
|
64
|
-
<th *ngIf="isFeatureOn('actions')">Actions</th>
|
|
65
|
-
</tr>
|
|
66
|
-
</thead>
|
|
67
|
-
|
|
68
|
-
<tbody>
|
|
69
|
-
<tr *ngIf="!pagedRows.length">
|
|
70
|
-
<td [attr.colspan]="getColumnCount()" class="ndt-empty">No records found.</td>
|
|
71
|
-
</tr>
|
|
72
|
-
|
|
73
|
-
<tr *ngFor="let row of pagedRows; let rowIndex = index" [class.ndt-selected]="isRowSelected(row.id)">
|
|
74
|
-
<td *ngIf="isFeatureOn('checkboxSelection')">
|
|
75
|
-
<input
|
|
76
|
-
type="checkbox"
|
|
77
|
-
[checked]="isRowSelected(row.id)"
|
|
78
|
-
(change)="toggleRowSelection(row, $event)"
|
|
79
|
-
/>
|
|
80
|
-
</td>
|
|
81
|
-
|
|
82
|
-
<td *ngFor="let column of mergedColumns" [innerHTML]="getRenderedCell(row.data, column)"></td>
|
|
83
|
-
|
|
84
|
-
<td *ngIf="isFeatureOn('actions')" class="ndt-actions-cell">
|
|
85
|
-
<div class="ndt-dropdown" (click)="$event.stopPropagation()">
|
|
86
|
-
<button
|
|
87
|
-
type="button"
|
|
88
|
-
class="ndt-actions-btn"
|
|
89
|
-
(click)="toggleActionMenu(row.id, $event)"
|
|
90
|
-
[attr.aria-expanded]="isActionMenuOpen(row.id)"
|
|
91
|
-
>
|
|
92
|
-
<span class="ndt-dots">...</span>
|
|
93
|
-
</button>
|
|
94
|
-
|
|
95
|
-
<ul class="ndt-dropdown-menu" *ngIf="isActionMenuOpen(row.id)">
|
|
96
|
-
<li *ngFor="let action of mergedConfig.actions || []; let i = index">
|
|
97
|
-
<button
|
|
98
|
-
type="button"
|
|
99
|
-
class="ndt-dropdown-item"
|
|
100
|
-
[class.ndt-danger]="!!action.danger"
|
|
101
|
-
(click)="onActionItemClick(i, row)"
|
|
102
|
-
>
|
|
103
|
-
<i *ngIf="action.icon" [class]="action.icon"></i>
|
|
104
|
-
<span>{{ action.label }}</span>
|
|
105
|
-
</button>
|
|
106
|
-
</li>
|
|
107
|
-
</ul>
|
|
108
|
-
</div>
|
|
109
|
-
</td>
|
|
110
|
-
</tr>
|
|
111
|
-
</tbody>
|
|
112
|
-
</table>
|
|
113
|
-
</div>
|
|
114
|
-
|
|
115
|
-
<div class="ndt-footer">
|
|
116
|
-
<div>
|
|
117
|
-
{{ selectedRows.size }} selected
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<div>
|
|
121
|
-
Showing {{ getStartEntry() }} to {{ getEndEntry() }} of {{ filteredRows.length }} entries
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
<div class="ndt-pagination" *ngIf="isFeatureOn('pagination') && totalPages > 1">
|
|
125
|
-
<button type="button" (click)="goToPage(currentPage - 1)" [disabled]="currentPage <= 1">Prev</button>
|
|
126
|
-
<button
|
|
127
|
-
type="button"
|
|
128
|
-
*ngFor="let page of getPaginationPages()"
|
|
129
|
-
[class.active]="page === currentPage"
|
|
130
|
-
(click)="goToPage(page)"
|
|
131
|
-
>
|
|
132
|
-
{{ page }}
|
|
133
|
-
</button>
|
|
134
|
-
<button type="button" (click)="goToPage(currentPage + 1)" [disabled]="currentPage >= totalPages">Next</button>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
display: block;
|
|
3
|
-
--ndt-primary: #4f46e5;
|
|
4
|
-
--ndt-primary-soft: #eef2ff;
|
|
5
|
-
--ndt-border: #dbe4ff;
|
|
6
|
-
--ndt-text: #1f2a44;
|
|
7
|
-
--ndt-muted: #6d7895;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.ndt-card {
|
|
11
|
-
border: 1px solid var(--ndt-border);
|
|
12
|
-
border-radius: 14px;
|
|
13
|
-
background: #fff;
|
|
14
|
-
box-shadow: 0 10px 30px rgba(45, 72, 145, 0.08);
|
|
15
|
-
overflow: hidden;
|
|
16
|
-
color: var(--ndt-text);
|
|
17
|
-
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.ndt-header,
|
|
21
|
-
.ndt-toolbar,
|
|
22
|
-
.ndt-footer {
|
|
23
|
-
padding: 0.9rem 1rem;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.ndt-header {
|
|
27
|
-
border-bottom: 1px solid #edf1ff;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.ndt-title {
|
|
31
|
-
margin: 0;
|
|
32
|
-
font-size: 1.1rem;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.ndt-toolbar {
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: space-between;
|
|
38
|
-
gap: 0.75rem;
|
|
39
|
-
flex-wrap: wrap;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.ndt-left-tools,
|
|
43
|
-
.ndt-right-tools {
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
gap: 0.5rem;
|
|
47
|
-
flex-wrap: wrap;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.ndt-btn,
|
|
51
|
-
.ndt-pagination button,
|
|
52
|
-
.ndt-actions-cell select,
|
|
53
|
-
.ndt-toolbar select,
|
|
54
|
-
.ndt-toolbar input {
|
|
55
|
-
border: 1px solid #cfd9fb;
|
|
56
|
-
background: #fff;
|
|
57
|
-
color: #33446e;
|
|
58
|
-
border-radius: 8px;
|
|
59
|
-
padding: 0.35rem 0.6rem;
|
|
60
|
-
font-size: 0.85rem;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.ndt-btn:hover,
|
|
64
|
-
.ndt-pagination button:hover,
|
|
65
|
-
.ndt-pagination button.active {
|
|
66
|
-
border-color: var(--ndt-primary);
|
|
67
|
-
background: var(--ndt-primary-soft);
|
|
68
|
-
color: var(--ndt-primary);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.ndt-inline-label {
|
|
72
|
-
display: inline-flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: 0.4rem;
|
|
75
|
-
color: var(--ndt-muted);
|
|
76
|
-
font-size: 0.85rem;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.ndt-table-wrap {
|
|
80
|
-
overflow-x: auto;
|
|
81
|
-
border-top: 1px solid #edf1ff;
|
|
82
|
-
border-bottom: 1px solid #edf1ff;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.ndt-table {
|
|
86
|
-
width: 100%;
|
|
87
|
-
min-width: 860px;
|
|
88
|
-
border-collapse: collapse;
|
|
89
|
-
table-layout: fixed;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.ndt-table th,
|
|
93
|
-
.ndt-table td {
|
|
94
|
-
padding: 0.72rem;
|
|
95
|
-
text-align: left;
|
|
96
|
-
border-bottom: 1px solid #edf1ff;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.ndt-table th {
|
|
100
|
-
color: #4a577f;
|
|
101
|
-
font-size: 0.8rem;
|
|
102
|
-
text-transform: uppercase;
|
|
103
|
-
letter-spacing: 0.03em;
|
|
104
|
-
background: #f8faff;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.ndt-th-content {
|
|
108
|
-
display: flex;
|
|
109
|
-
align-items: center;
|
|
110
|
-
justify-content: space-between;
|
|
111
|
-
gap: 0.4rem;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.ndt-th-label {
|
|
115
|
-
overflow: hidden;
|
|
116
|
-
text-overflow: ellipsis;
|
|
117
|
-
white-space: nowrap;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.ndt-sortable {
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.ndt-sort-indicator {
|
|
125
|
-
font-size: 0.75rem;
|
|
126
|
-
color: #8a98c2;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.ndt-table tbody tr:hover {
|
|
130
|
-
background: #f5f8ff;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.ndt-selected {
|
|
134
|
-
background: #ebf1ff;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.ndt-actions-cell {
|
|
138
|
-
text-align: center;
|
|
139
|
-
position: relative;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.ndt-dropdown {
|
|
143
|
-
position: relative;
|
|
144
|
-
display: inline-block;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.ndt-actions-btn {
|
|
148
|
-
border: 1px solid #cfd9fb;
|
|
149
|
-
background: #fff;
|
|
150
|
-
color: #33446e;
|
|
151
|
-
border-radius: 8px;
|
|
152
|
-
width: 34px;
|
|
153
|
-
height: 30px;
|
|
154
|
-
padding: 0;
|
|
155
|
-
cursor: pointer;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.ndt-actions-btn:hover {
|
|
159
|
-
border-color: var(--ndt-primary);
|
|
160
|
-
color: var(--ndt-primary);
|
|
161
|
-
background: var(--ndt-primary-soft);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.ndt-dots {
|
|
165
|
-
font-size: 1rem;
|
|
166
|
-
line-height: 1;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.ndt-dropdown-menu {
|
|
170
|
-
position: absolute;
|
|
171
|
-
right: 0;
|
|
172
|
-
top: calc(100% + 0.35rem);
|
|
173
|
-
list-style: none;
|
|
174
|
-
margin: 0;
|
|
175
|
-
padding: 0.35rem 0;
|
|
176
|
-
min-width: 150px;
|
|
177
|
-
border: 1px solid #dbe4ff;
|
|
178
|
-
border-radius: 10px;
|
|
179
|
-
background: #fff;
|
|
180
|
-
box-shadow: 0 12px 24px rgba(45, 72, 145, 0.14);
|
|
181
|
-
z-index: 20;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.ndt-dropdown-item {
|
|
185
|
-
width: 100%;
|
|
186
|
-
border: 0;
|
|
187
|
-
background: #fff;
|
|
188
|
-
color: #33446e;
|
|
189
|
-
display: flex;
|
|
190
|
-
align-items: center;
|
|
191
|
-
gap: 0.45rem;
|
|
192
|
-
text-align: left;
|
|
193
|
-
padding: 0.42rem 0.72rem;
|
|
194
|
-
font-size: 0.84rem;
|
|
195
|
-
cursor: pointer;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.ndt-dropdown-item:hover {
|
|
199
|
-
background: #f5f8ff;
|
|
200
|
-
color: var(--ndt-primary);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.ndt-dropdown-item.ndt-danger {
|
|
204
|
-
color: #dc3545;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.ndt-dropdown-item.ndt-danger:hover {
|
|
208
|
-
background: #fff1f3;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.ndt-empty {
|
|
212
|
-
text-align: center;
|
|
213
|
-
color: var(--ndt-muted);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.ndt-footer {
|
|
217
|
-
display: flex;
|
|
218
|
-
justify-content: space-between;
|
|
219
|
-
gap: 0.75rem;
|
|
220
|
-
flex-wrap: wrap;
|
|
221
|
-
color: #55658f;
|
|
222
|
-
font-size: 0.86rem;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.ndt-pagination {
|
|
226
|
-
display: flex;
|
|
227
|
-
align-items: center;
|
|
228
|
-
gap: 0.35rem;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
@media (max-width: 900px) {
|
|
232
|
-
.ndt-toolbar,
|
|
233
|
-
.ndt-footer {
|
|
234
|
-
flex-direction: column;
|
|
235
|
-
align-items: flex-start;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { DynamicDatatableComponent } from './dynamic-datatable.component';
|
|
4
|
-
|
|
5
|
-
describe('DynamicDatatableComponent', () => {
|
|
6
|
-
let component: DynamicDatatableComponent;
|
|
7
|
-
let fixture: ComponentFixture<DynamicDatatableComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [DynamicDatatableComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(DynamicDatatableComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|