devlab-one-dynamic-table 1.0.0 → 1.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
CHANGED
|
@@ -1,64 +1,369 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dynamic Table
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A powerful Angular Material-based Dynamic Table Library that provides configurable data tables with built-in support for:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
* Sorting
|
|
6
|
+
* Pagination
|
|
7
|
+
* Search
|
|
8
|
+
* CRUD Actions
|
|
9
|
+
* Export
|
|
10
|
+
* Row Selection
|
|
11
|
+
* Dynamic Columns
|
|
12
|
+
* Client-side and Server-side operations
|
|
13
|
+
* Angular Reactive Search Forms
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
* 🚀 Dynamic column generation
|
|
20
|
+
* 🔍 Built-in search support
|
|
21
|
+
* 📄 Pagination
|
|
22
|
+
* ↕️ Column sorting
|
|
23
|
+
* ✏️ Edit records
|
|
24
|
+
* 👁️ View records
|
|
25
|
+
* ➕ Create records
|
|
26
|
+
* 🗑️ Delete records
|
|
27
|
+
* 📤 Export table data
|
|
28
|
+
* ✅ Row selection support
|
|
29
|
+
* 🎨 Angular Material Design
|
|
30
|
+
* ⚡ Client-side and Server-side operations
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
8
35
|
|
|
9
36
|
```bash
|
|
10
|
-
|
|
37
|
+
npm install devlab-one/dynamic-table
|
|
11
38
|
```
|
|
12
39
|
|
|
13
|
-
|
|
40
|
+
---
|
|
14
41
|
|
|
15
|
-
|
|
16
|
-
|
|
42
|
+
## Component Usage
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<lib-dynamic-table
|
|
46
|
+
[dataset]="data"
|
|
47
|
+
[tableDetails]="tableDetail"
|
|
48
|
+
[search]="search"
|
|
49
|
+
(action)="onTableAction($event)"
|
|
50
|
+
></lib-dynamic-table>
|
|
17
51
|
```
|
|
18
52
|
|
|
19
|
-
|
|
53
|
+
---
|
|
20
54
|
|
|
21
|
-
|
|
55
|
+
## Dataset Structure
|
|
22
56
|
|
|
23
|
-
```
|
|
24
|
-
|
|
57
|
+
```typescript
|
|
58
|
+
public data = {
|
|
59
|
+
data: employeeData,
|
|
60
|
+
totalRecords: employeeData.length
|
|
61
|
+
};
|
|
25
62
|
```
|
|
26
63
|
|
|
27
|
-
|
|
64
|
+
| Property | Description |
|
|
65
|
+
| ------------ | ----------------------- |
|
|
66
|
+
| data | Array of records |
|
|
67
|
+
| totalRecords | Total available records |
|
|
28
68
|
|
|
29
|
-
|
|
69
|
+
---
|
|
30
70
|
|
|
31
|
-
|
|
71
|
+
## Search Configuration
|
|
32
72
|
|
|
33
|
-
|
|
73
|
+
The table supports dynamic search forms generated using the Dynamic Form library.
|
|
34
74
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
75
|
+
```typescript
|
|
76
|
+
public search: SearchModel = {
|
|
77
|
+
formElements: this.searchForm,
|
|
78
|
+
value: {},
|
|
79
|
+
searchOn: SearchOn.MatchingColumns,
|
|
80
|
+
searchAt: SearchAt.ClientSide
|
|
81
|
+
};
|
|
82
|
+
```
|
|
38
83
|
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm publish
|
|
42
|
-
```
|
|
84
|
+
### Search Modes
|
|
43
85
|
|
|
44
|
-
|
|
86
|
+
```typescript
|
|
87
|
+
SearchOn.MatchingColumns
|
|
88
|
+
SearchOn.AllColumns
|
|
89
|
+
```
|
|
45
90
|
|
|
46
|
-
|
|
91
|
+
### Search Locations
|
|
47
92
|
|
|
48
|
-
```
|
|
49
|
-
|
|
93
|
+
```typescript
|
|
94
|
+
SearchAt.ClientSide
|
|
95
|
+
SearchAt.ServerSide
|
|
50
96
|
```
|
|
51
97
|
|
|
52
|
-
|
|
98
|
+
---
|
|
53
99
|
|
|
54
|
-
|
|
100
|
+
## Table Configuration
|
|
55
101
|
|
|
56
|
-
```
|
|
57
|
-
|
|
102
|
+
```typescript
|
|
103
|
+
public tableDetail: TableDetails = {
|
|
104
|
+
paging: {
|
|
105
|
+
enabled: true,
|
|
106
|
+
pageSizeOptions: [5, 10, 25, 50, 100],
|
|
107
|
+
pageNumber: 0,
|
|
108
|
+
pageSize: 10
|
|
109
|
+
},
|
|
110
|
+
selectRequired: true,
|
|
111
|
+
tableButtons: {
|
|
112
|
+
add: true,
|
|
113
|
+
edit: true,
|
|
114
|
+
delete: true,
|
|
115
|
+
view: true,
|
|
116
|
+
export: true
|
|
117
|
+
},
|
|
118
|
+
columns: this.columnDetails()
|
|
119
|
+
};
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Column Configuration
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
public columnDetails() {
|
|
128
|
+
return [
|
|
129
|
+
{
|
|
130
|
+
columnDef: 'name',
|
|
131
|
+
header: 'Name',
|
|
132
|
+
sortRequired: true
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
columnDef: 'department',
|
|
136
|
+
header: 'Department',
|
|
137
|
+
sortRequired: true
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
columnDef: 'email',
|
|
141
|
+
header: 'Email',
|
|
142
|
+
sortRequired: true
|
|
143
|
+
}
|
|
144
|
+
];
|
|
145
|
+
}
|
|
58
146
|
```
|
|
59
147
|
|
|
60
|
-
|
|
148
|
+
### Column Properties
|
|
149
|
+
|
|
150
|
+
| Property | Description |
|
|
151
|
+
| ------------ | -------------------------- |
|
|
152
|
+
| columnDef | Property name from dataset |
|
|
153
|
+
| header | Display header |
|
|
154
|
+
| sortRequired | Enable sorting |
|
|
155
|
+
| isComplex | Nested object support |
|
|
156
|
+
| innerColumns | Child columns |
|
|
157
|
+
| cell | Custom value renderer |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Custom Cell Rendering
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
{
|
|
165
|
+
columnDef: 'projects',
|
|
166
|
+
header: 'Projects',
|
|
167
|
+
sortRequired: true,
|
|
168
|
+
cell: (record) => {
|
|
169
|
+
return record.projects;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Pagination Configuration
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
paging: {
|
|
180
|
+
enabled: true,
|
|
181
|
+
pageSizeOptions: [5,10,25,50,100],
|
|
182
|
+
pageNumber: 0,
|
|
183
|
+
pageSize: 10
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Table Buttons
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
tableButtons: {
|
|
193
|
+
add: true,
|
|
194
|
+
edit: true,
|
|
195
|
+
delete: true,
|
|
196
|
+
view: true,
|
|
197
|
+
export: true
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
| Button | Description |
|
|
202
|
+
| ------ | ---------------------- |
|
|
203
|
+
| add | Create new record |
|
|
204
|
+
| edit | Edit selected record |
|
|
205
|
+
| delete | Delete selected record |
|
|
206
|
+
| view | View selected record |
|
|
207
|
+
| export | Export table data |
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Events
|
|
212
|
+
|
|
213
|
+
All table interactions emit through a single action output.
|
|
214
|
+
|
|
215
|
+
```html
|
|
216
|
+
<lib-dynamic-table
|
|
217
|
+
(action)="onTableAction($event)"
|
|
218
|
+
></lib-dynamic-table>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Event Handler
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
public onTableAction(event: any) {
|
|
225
|
+
switch (event.name) {
|
|
226
|
+
case 'create':
|
|
227
|
+
break;
|
|
228
|
+
|
|
229
|
+
case 'edit':
|
|
230
|
+
break;
|
|
231
|
+
|
|
232
|
+
case 'delete':
|
|
233
|
+
break;
|
|
234
|
+
|
|
235
|
+
case 'view':
|
|
236
|
+
break;
|
|
237
|
+
|
|
238
|
+
case 'search':
|
|
239
|
+
break;
|
|
240
|
+
|
|
241
|
+
case 'pageChange':
|
|
242
|
+
break;
|
|
243
|
+
|
|
244
|
+
case 'sortChange':
|
|
245
|
+
break;
|
|
246
|
+
|
|
247
|
+
default:
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Available Events
|
|
256
|
+
|
|
257
|
+
### Create
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
{
|
|
261
|
+
name: 'create'
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Edit
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
{
|
|
269
|
+
name: 'edit',
|
|
270
|
+
data: selectedRow
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Delete
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
{
|
|
278
|
+
name: 'delete',
|
|
279
|
+
data: selectedRow
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### View
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
{
|
|
287
|
+
name: 'view',
|
|
288
|
+
data: selectedRow
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Search
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
{
|
|
296
|
+
name: 'search',
|
|
297
|
+
data: searchValues
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Pagination Change
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
{
|
|
305
|
+
name: 'pageChange',
|
|
306
|
+
pageIndex: 0,
|
|
307
|
+
pageSize: 10
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Sort Change
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
{
|
|
315
|
+
name: 'sortChange',
|
|
316
|
+
active: 'name',
|
|
317
|
+
direction: 'asc'
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Server-Side Pagination Example
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Search Form Example
|
|
328
|
+
|
|
329
|
+
```typescript
|
|
330
|
+
public searchForm: Form = {
|
|
331
|
+
controls: [
|
|
332
|
+
{
|
|
333
|
+
type: FieldType.text,
|
|
334
|
+
name: 'name',
|
|
335
|
+
label: 'Name'
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
type: FieldType.dropdown,
|
|
339
|
+
name: 'department',
|
|
340
|
+
label: 'Department',
|
|
341
|
+
options: [
|
|
342
|
+
{
|
|
343
|
+
key: 'Engineering',
|
|
344
|
+
label: 'Engineering'
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
key: 'Marketing',
|
|
348
|
+
label: 'Marketing'
|
|
349
|
+
}
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
};
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Built With
|
|
359
|
+
|
|
360
|
+
* Angular 21+
|
|
361
|
+
* Angular Material
|
|
362
|
+
* Reactive Forms
|
|
363
|
+
* TypeScript
|
|
364
|
+
|
|
365
|
+
---
|
|
61
366
|
|
|
62
|
-
##
|
|
367
|
+
## License
|
|
63
368
|
|
|
64
|
-
|
|
369
|
+
MIT License
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|