mat-table-ext 0.0.0
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/.editorconfig +16 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +27 -0
- package/angular.json +150 -0
- package/package.json +45 -0
- package/projects/mat-table-ext/.browserslistrc +16 -0
- package/projects/mat-table-ext/README.md +24 -0
- package/projects/mat-table-ext/assets/pinIcon.svg +1 -0
- package/projects/mat-table-ext/assets/pinLeft.svg +11 -0
- package/projects/mat-table-ext/assets/pinNone.svg +5 -0
- package/projects/mat-table-ext/assets/pinRight.svg +11 -0
- package/projects/mat-table-ext/assets/pinned.svg +2 -0
- package/projects/mat-table-ext/karma.conf.js +44 -0
- package/projects/mat-table-ext/ng-package.json +9 -0
- package/projects/mat-table-ext/package.json +34 -0
- package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.html +7 -0
- package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.scss +9 -0
- package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.spec.ts +23 -0
- package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.ts +48 -0
- package/projects/mat-table-ext/src/lib/components/editing/editing.component.html +55 -0
- package/projects/mat-table-ext/src/lib/components/editing/editing.component.scss +19 -0
- package/projects/mat-table-ext/src/lib/components/editing/editing.component.spec.ts +23 -0
- package/projects/mat-table-ext/src/lib/components/editing/editing.component.ts +110 -0
- package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.html +26 -0
- 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 +23 -0
- package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.ts +54 -0
- package/projects/mat-table-ext/src/lib/directives/resize-column.directive.ts +103 -0
- package/projects/mat-table-ext/src/lib/mat-table-ext.component.html +285 -0
- package/projects/mat-table-ext/src/lib/mat-table-ext.component.spec.ts +25 -0
- package/projects/mat-table-ext/src/lib/mat-table-ext.component.ts +985 -0
- package/projects/mat-table-ext/src/lib/mat-table-ext.module.ts +127 -0
- package/projects/mat-table-ext/src/lib/mat-table-ext.scss +189 -0
- package/projects/mat-table-ext/src/lib/mat-table-ext.service.spec.ts +16 -0
- package/projects/mat-table-ext/src/lib/mat-table-ext.service.ts +12 -0
- package/projects/mat-table-ext/src/lib/models/tableExtModels.ts +85 -0
- package/projects/mat-table-ext/src/public-api.ts +11 -0
- package/projects/mat-table-ext/src/test.ts +27 -0
- package/projects/mat-table-ext/tsconfig.lib.json +15 -0
- package/projects/mat-table-ext/tsconfig.lib.prod.json +10 -0
- package/projects/mat-table-ext/tsconfig.spec.json +17 -0
- package/projects/mat-table-ext-example/.browserslistrc +16 -0
- package/projects/mat-table-ext-example/karma.conf.js +44 -0
- package/projects/mat-table-ext-example/src/app/app.component.html +577 -0
- 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 +31 -0
- package/projects/mat-table-ext-example/src/app/app.component.ts +173 -0
- package/projects/mat-table-ext-example/src/app/app.module.ts +40 -0
- package/projects/mat-table-ext-example/src/app/service/custom-table.service.spec.ts +16 -0
- package/projects/mat-table-ext-example/src/app/service/custom-table.service.ts +18 -0
- package/projects/mat-table-ext-example/src/assets/.gitkeep +0 -0
- package/projects/mat-table-ext-example/src/assets/data.json +100003 -0
- package/projects/mat-table-ext-example/src/environments/environment.prod.ts +3 -0
- package/projects/mat-table-ext-example/src/environments/environment.ts +16 -0
- package/projects/mat-table-ext-example/src/favicon.ico +0 -0
- package/projects/mat-table-ext-example/src/index.html +14 -0
- package/projects/mat-table-ext-example/src/main.ts +12 -0
- package/projects/mat-table-ext-example/src/polyfills.ts +53 -0
- package/projects/mat-table-ext-example/src/styles.scss +1 -0
- package/projects/mat-table-ext-example/src/test.ts +26 -0
- package/projects/mat-table-ext-example/tsconfig.app.json +15 -0
- package/projects/mat-table-ext-example/tsconfig.spec.json +18 -0
- package/tsconfig.json +38 -0
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
<!-- <mat-form-field appearance="legacy">
|
|
2
|
+
<mat-label>Legacy form field</mat-label>
|
|
3
|
+
<input matInput placeholder="Placeholder">
|
|
4
|
+
<mat-icon matSuffix>sentiment_very_satisfied</mat-icon>
|
|
5
|
+
<mat-hint>Hint</mat-hint>
|
|
6
|
+
</mat-form-field> -->
|
|
7
|
+
<mat-card class="result">
|
|
8
|
+
<h2 class="example-h2">Table</h2>
|
|
9
|
+
<mat-card-content style="display: flex; gap: 50px">
|
|
10
|
+
<div style="display: flex; flex-direction: column">
|
|
11
|
+
<section class="example-section">
|
|
12
|
+
<mat-slide-toggle [(ngModel)]="popupRowEditing" [disabled]="false">
|
|
13
|
+
Popup Editing
|
|
14
|
+
</mat-slide-toggle>
|
|
15
|
+
</section>
|
|
16
|
+
<section class="example-section">
|
|
17
|
+
<mat-slide-toggle [(ngModel)]="inlineRowEditing" [disabled]="false">
|
|
18
|
+
Inline Editing
|
|
19
|
+
</mat-slide-toggle>
|
|
20
|
+
</section>
|
|
21
|
+
<section class="example-section">
|
|
22
|
+
<mat-slide-toggle [(ngModel)]="inCellEditing" [disabled]="false">
|
|
23
|
+
Cell Editing
|
|
24
|
+
</mat-slide-toggle>
|
|
25
|
+
</section>
|
|
26
|
+
<section class="example-section">
|
|
27
|
+
<mat-slide-toggle [(ngModel)]="deleteRow" [disabled]="false">
|
|
28
|
+
Delete Row
|
|
29
|
+
</mat-slide-toggle>
|
|
30
|
+
</section>
|
|
31
|
+
<section class="example-section">
|
|
32
|
+
<mat-slide-toggle [(ngModel)]="stripedRows" [disabled]="false">
|
|
33
|
+
Striped Rows
|
|
34
|
+
</mat-slide-toggle>
|
|
35
|
+
</section>
|
|
36
|
+
<section class="example-section">
|
|
37
|
+
<mat-slide-toggle [(ngModel)]="rowSelection" [disabled]="false">
|
|
38
|
+
Row Selection
|
|
39
|
+
</mat-slide-toggle>
|
|
40
|
+
</section>
|
|
41
|
+
<section class="example-section">
|
|
42
|
+
<mat-slide-toggle [(ngModel)]="multiRowSelection" [disabled]="false">
|
|
43
|
+
Multi Row Selection
|
|
44
|
+
</mat-slide-toggle>
|
|
45
|
+
</section>
|
|
46
|
+
<section class="example-section">
|
|
47
|
+
<mat-slide-toggle [(ngModel)]="columnResizable" [disabled]="false">
|
|
48
|
+
Column Resizable
|
|
49
|
+
</mat-slide-toggle>
|
|
50
|
+
</section>
|
|
51
|
+
<section class="example-section">
|
|
52
|
+
<mat-slide-toggle [(ngModel)]="stickyHeader" [disabled]="false">
|
|
53
|
+
Sticky Header
|
|
54
|
+
</mat-slide-toggle>
|
|
55
|
+
</section>
|
|
56
|
+
<section class="example-section">
|
|
57
|
+
<mat-slide-toggle [(ngModel)]="stickyFooter" [disabled]="false">
|
|
58
|
+
Sticky Footer
|
|
59
|
+
</mat-slide-toggle>
|
|
60
|
+
</section>
|
|
61
|
+
</div>
|
|
62
|
+
<div style="display: flex; flex-direction: column">
|
|
63
|
+
<section class="example-section">
|
|
64
|
+
<mat-slide-toggle [(ngModel)]="toolbarToggle" [disabled]="false">
|
|
65
|
+
Table Toolbar
|
|
66
|
+
</mat-slide-toggle>
|
|
67
|
+
</section>
|
|
68
|
+
<section class="example-section" style="padding-left: 15px">
|
|
69
|
+
<mat-slide-toggle
|
|
70
|
+
[(ngModel)]="exportButtonEnable"
|
|
71
|
+
[disabled]="!toolbarToggle"
|
|
72
|
+
>
|
|
73
|
+
Export Button
|
|
74
|
+
</mat-slide-toggle>
|
|
75
|
+
</section>
|
|
76
|
+
<section class="example-section" style="padding-left: 15px">
|
|
77
|
+
<mat-slide-toggle
|
|
78
|
+
[(ngModel)]="columnPinnable"
|
|
79
|
+
[disabled]="!toolbarToggle"
|
|
80
|
+
>
|
|
81
|
+
Column Pinnable
|
|
82
|
+
</mat-slide-toggle>
|
|
83
|
+
</section>
|
|
84
|
+
<section class="example-section" style="padding-left: 15px">
|
|
85
|
+
<mat-slide-toggle
|
|
86
|
+
[(ngModel)]="columnHidable"
|
|
87
|
+
[disabled]="!toolbarToggle"
|
|
88
|
+
>
|
|
89
|
+
Column Hide/Show
|
|
90
|
+
</mat-slide-toggle>
|
|
91
|
+
</section>
|
|
92
|
+
<section class="example-section">
|
|
93
|
+
<mat-slide-toggle [(ngModel)]="topSearchFilter" [disabled]="false">
|
|
94
|
+
Global Search
|
|
95
|
+
</mat-slide-toggle>
|
|
96
|
+
</section>
|
|
97
|
+
<section class="example-section">
|
|
98
|
+
<mat-slide-toggle [(ngModel)]="isExpandEnable" [disabled]="false">
|
|
99
|
+
Row Expandable
|
|
100
|
+
</mat-slide-toggle>
|
|
101
|
+
</section>
|
|
102
|
+
|
|
103
|
+
<section class="example-section">
|
|
104
|
+
<mat-slide-toggle [(ngModel)]="dragEnable" [disabled]="false">
|
|
105
|
+
Drag & Drop Columns
|
|
106
|
+
</mat-slide-toggle>
|
|
107
|
+
</section>
|
|
108
|
+
<section class="example-section">
|
|
109
|
+
<mat-slide-toggle [(ngModel)]="isLoading" [disabled]="false">
|
|
110
|
+
Loading Indicator
|
|
111
|
+
</mat-slide-toggle>
|
|
112
|
+
</section>
|
|
113
|
+
<section class="example-section">
|
|
114
|
+
<mat-slide-toggle [(ngModel)]="paginationEnable" [disabled]="false">
|
|
115
|
+
Pagination
|
|
116
|
+
</mat-slide-toggle>
|
|
117
|
+
</section>
|
|
118
|
+
<section class="example-section" style="padding-left: 15px">
|
|
119
|
+
<mat-slide-toggle
|
|
120
|
+
[(ngModel)]="showFirstLastButtons"
|
|
121
|
+
[disabled]="!paginationEnable"
|
|
122
|
+
>
|
|
123
|
+
Show First Last Page Buttons
|
|
124
|
+
</mat-slide-toggle>
|
|
125
|
+
</section>
|
|
126
|
+
</div>
|
|
127
|
+
<div style="display: flex; flex-direction: column">
|
|
128
|
+
<section class="example-section">
|
|
129
|
+
<mat-slide-toggle [(ngModel)]="simpleFilter" [disabled]="false">
|
|
130
|
+
Columns Filter
|
|
131
|
+
</mat-slide-toggle>
|
|
132
|
+
</section>
|
|
133
|
+
<section class="example-section">
|
|
134
|
+
<mat-slide-toggle [(ngModel)]="sorting" [disabled]="false">
|
|
135
|
+
Sorting
|
|
136
|
+
</mat-slide-toggle>
|
|
137
|
+
</section>
|
|
138
|
+
<section class="example-section">
|
|
139
|
+
<mat-slide-toggle [(ngModel)]="infiniteScroll" [disabled]="false">
|
|
140
|
+
Infinite Scroll
|
|
141
|
+
</mat-slide-toggle>
|
|
142
|
+
</section>
|
|
143
|
+
<section class="example-section">
|
|
144
|
+
<mat-slide-toggle [(ngModel)]="scrollbarH" [disabled]="false">
|
|
145
|
+
Horizontal Scroll
|
|
146
|
+
</mat-slide-toggle>
|
|
147
|
+
</section>
|
|
148
|
+
<section class="example-section">
|
|
149
|
+
<mat-slide-toggle
|
|
150
|
+
[(ngModel)]="headerTemplateRefCtrl"
|
|
151
|
+
[disabled]="false"
|
|
152
|
+
>
|
|
153
|
+
Header TemplateRef
|
|
154
|
+
</mat-slide-toggle>
|
|
155
|
+
</section>
|
|
156
|
+
<section class="example-section">
|
|
157
|
+
<mat-slide-toggle [(ngModel)]="cellTemplateRefCtrl" [disabled]="false">
|
|
158
|
+
Cell TemplateRef
|
|
159
|
+
</mat-slide-toggle>
|
|
160
|
+
</section>
|
|
161
|
+
<section class="example-section">
|
|
162
|
+
<mat-slide-toggle
|
|
163
|
+
[(ngModel)]="toolbarTemplateRefCtrl"
|
|
164
|
+
[disabled]="!toolbarToggle"
|
|
165
|
+
>
|
|
166
|
+
Toolbar TemplateRef
|
|
167
|
+
</mat-slide-toggle>
|
|
168
|
+
</section>
|
|
169
|
+
<section class="example-section">
|
|
170
|
+
<mat-slide-toggle [(ngModel)]="popupTemplateRefCtrl">
|
|
171
|
+
Popup Editing TemplateRef
|
|
172
|
+
</mat-slide-toggle>
|
|
173
|
+
</section>
|
|
174
|
+
<section class="example-section">
|
|
175
|
+
<mat-slide-toggle [(ngModel)]="inlineTemplateRefCtrl">
|
|
176
|
+
Inline Editing TemplateRef
|
|
177
|
+
</mat-slide-toggle>
|
|
178
|
+
</section>
|
|
179
|
+
<section class="example-section">
|
|
180
|
+
<mat-slide-toggle [(ngModel)]="cellEditingTemplateRefCtrl">
|
|
181
|
+
Cell Editing TemplateRef
|
|
182
|
+
</mat-slide-toggle>
|
|
183
|
+
</section>
|
|
184
|
+
</div>
|
|
185
|
+
<div style="display: flex; flex-direction: column">
|
|
186
|
+
<section class="example-section">
|
|
187
|
+
<mat-form-field class="example-full-width" appearance="outline">
|
|
188
|
+
<mat-label>Table Height</mat-label>
|
|
189
|
+
<input
|
|
190
|
+
matInput
|
|
191
|
+
placeholder="Default is 500px"
|
|
192
|
+
[(ngModel)]="tableHeight"
|
|
193
|
+
[disabled]="false"
|
|
194
|
+
/>
|
|
195
|
+
</mat-form-field>
|
|
196
|
+
</section>
|
|
197
|
+
<mat-divider></mat-divider>
|
|
198
|
+
<section class="example-section">
|
|
199
|
+
<mat-form-field class="example-full-width" appearance="outline">
|
|
200
|
+
<mat-label>Table Width</mat-label>
|
|
201
|
+
<input
|
|
202
|
+
matInput
|
|
203
|
+
placeholder="Default is 100%"
|
|
204
|
+
[(ngModel)]="tableWidth"
|
|
205
|
+
[disabled]="false"
|
|
206
|
+
/>
|
|
207
|
+
</mat-form-field>
|
|
208
|
+
</section>
|
|
209
|
+
<mat-divider></mat-divider>
|
|
210
|
+
<section class="example-section">
|
|
211
|
+
<mat-form-field
|
|
212
|
+
class="example-full-width"
|
|
213
|
+
appearance="outline"
|
|
214
|
+
disabled
|
|
215
|
+
>
|
|
216
|
+
<mat-label>Toolbar Height</mat-label>
|
|
217
|
+
<input
|
|
218
|
+
matInput
|
|
219
|
+
placeholder="Default is 50px"
|
|
220
|
+
[(ngModel)]="toolbarHeight"
|
|
221
|
+
[disabled]="!toolbarToggle"
|
|
222
|
+
/>
|
|
223
|
+
</mat-form-field>
|
|
224
|
+
</section>
|
|
225
|
+
<mat-divider></mat-divider>
|
|
226
|
+
</div>
|
|
227
|
+
</mat-card-content>
|
|
228
|
+
</mat-card>
|
|
229
|
+
|
|
230
|
+
<mat-table-ext
|
|
231
|
+
style="margin: 15px"
|
|
232
|
+
[dataSource]="dataSource"
|
|
233
|
+
[columns]="columns"
|
|
234
|
+
[columnResizable]="columnResizable"
|
|
235
|
+
[inlineRowEditing]="inlineRowEditing"
|
|
236
|
+
[inCellEditing]="inCellEditing"
|
|
237
|
+
[popupRowEditing]="popupRowEditing"
|
|
238
|
+
[enableDelete]="deleteRow"
|
|
239
|
+
[rowSelection]="rowSelection"
|
|
240
|
+
[multiRowSelection]="multiRowSelection"
|
|
241
|
+
[stickyHeader]="stickyHeader"
|
|
242
|
+
[stickyFooter]="stickyFooter"
|
|
243
|
+
[columnFilter]="simpleFilter"
|
|
244
|
+
[showToolbar]="toolbarToggle"
|
|
245
|
+
[toolbarHeight]="toolbarHeight"
|
|
246
|
+
[globalSearch]="topSearchFilter"
|
|
247
|
+
[expandRows]="isExpandEnable"
|
|
248
|
+
[expansionTemplateRef]="ex"
|
|
249
|
+
[dndColumns]="dragEnable"
|
|
250
|
+
[showPaginator]="paginationEnable"
|
|
251
|
+
[pageSizeOptions]="[10, 25, 100]"
|
|
252
|
+
[showFirstLastButtons]="showFirstLastButtons"
|
|
253
|
+
[columnPinnable]="columnPinnable"
|
|
254
|
+
[columnHidable]="columnHidable"
|
|
255
|
+
[exportButtonEnable]="exportButtonEnable"
|
|
256
|
+
[stripedRows]="stripedRows"
|
|
257
|
+
[loadingIndicator]="isLoading"
|
|
258
|
+
[sorting]="sorting"
|
|
259
|
+
[tableHeight]="tableHeight"
|
|
260
|
+
[tableWidth]="tableWidth"
|
|
261
|
+
[scrollbarH]="scrollbarH"
|
|
262
|
+
(inlineChange)="showData($event, 'inline change')"
|
|
263
|
+
(popupChange)="showData($event, 'popup change')"
|
|
264
|
+
(cellChange)="showData($event, 'Cell change')"
|
|
265
|
+
(scroll)="onScroll($event)"
|
|
266
|
+
(selectionChanged)="onSelectionChange($event)"
|
|
267
|
+
(rowDeleted)="showData($event, 'Delete change')"
|
|
268
|
+
[headerTemplateRef]="headerTemplateRefCtrl ? headerTemplate : undefined"
|
|
269
|
+
[cellTemplateRef]="cellTemplateRefCtrl ? cellTemplateRef : undefined"
|
|
270
|
+
[cellTemplateRefMap]="{ id: cellTemplateID }"
|
|
271
|
+
[toolbarTemplateRef]="toolbarTemplateRefCtrl ? toolbarTemplate : undefined"
|
|
272
|
+
[popupEditingTemplateRef]="popupTemplateRefCtrl ? popupEditing : undefined"
|
|
273
|
+
[inlineEditingTemplateRef]="inlineTemplateRefCtrl ? inlineEditing : undefined"
|
|
274
|
+
[cellEditingTemplateRef]="
|
|
275
|
+
cellEditingTemplateRefCtrl ? cellEditing : undefined
|
|
276
|
+
"
|
|
277
|
+
></mat-table-ext>
|
|
278
|
+
<ng-template #headerTemplate let-data="data">
|
|
279
|
+
<div style="display: flex">
|
|
280
|
+
<mat-icon style="color: purple">bolt</mat-icon
|
|
281
|
+
><span style="font-size: 15px; font-style: italic">{{ data.header }}</span>
|
|
282
|
+
</div>
|
|
283
|
+
</ng-template>
|
|
284
|
+
<ng-template #cellTemplateRef let-column="column" let-row="row">
|
|
285
|
+
<div style="display: flex">
|
|
286
|
+
<mat-icon style="color: blue">bolt</mat-icon
|
|
287
|
+
><span style="font-size: 15px; font-style: italic">{{
|
|
288
|
+
row[column.field]
|
|
289
|
+
}}</span>
|
|
290
|
+
</div>
|
|
291
|
+
</ng-template>
|
|
292
|
+
<ng-template #cellTemplate1 let-column="column" let-row="row">
|
|
293
|
+
<div style="display: flex">
|
|
294
|
+
<mat-icon style="color: green">bolt</mat-icon
|
|
295
|
+
><span style="font-size: 15px; font-style: italic">{{
|
|
296
|
+
row[column.field]
|
|
297
|
+
}}</span>
|
|
298
|
+
</div>
|
|
299
|
+
</ng-template>
|
|
300
|
+
<ng-template #cellTemplate2 let-column="column" let-row="row">
|
|
301
|
+
<div style="display: flex">
|
|
302
|
+
<mat-icon style="color: yellow">folder</mat-icon
|
|
303
|
+
><span style="font-size: 15px; font-style: italic">{{
|
|
304
|
+
row[column.field]
|
|
305
|
+
}}</span>
|
|
306
|
+
</div>
|
|
307
|
+
</ng-template>
|
|
308
|
+
<ng-template #cellTemplateID let-column="column" let-row="row">
|
|
309
|
+
<div style="display: flex">
|
|
310
|
+
<mat-icon style="color: yellow">folder</mat-icon
|
|
311
|
+
><span style="font-size: 15px; font-style: italic">{{
|
|
312
|
+
row[column.field]
|
|
313
|
+
}}</span>
|
|
314
|
+
</div>
|
|
315
|
+
</ng-template>
|
|
316
|
+
<ng-template #toolbarTemplate>
|
|
317
|
+
<div style="display: flex">
|
|
318
|
+
<button mat-button>
|
|
319
|
+
<mat-icon style="color: green">sync</mat-icon>
|
|
320
|
+
</button>
|
|
321
|
+
</div>
|
|
322
|
+
</ng-template>
|
|
323
|
+
<ng-template
|
|
324
|
+
#popupEditing
|
|
325
|
+
let-row="data.row"
|
|
326
|
+
let-column="data.columns"
|
|
327
|
+
let-keys="data.columnKeys"
|
|
328
|
+
let-types="data.columnTypes"
|
|
329
|
+
let-close="data.closeDialog"
|
|
330
|
+
>
|
|
331
|
+
<div style="height: 100%" class="main-dialog-container">
|
|
332
|
+
<div mat-dialog-title class="dialog-title-container" style="display: flex">
|
|
333
|
+
<h2 style="margin: 0">Edit Row</h2>
|
|
334
|
+
<span class="example-spacer"></span>
|
|
335
|
+
<button
|
|
336
|
+
mat-icon-button
|
|
337
|
+
aria-label="Example icon button with a vertical three dot icon"
|
|
338
|
+
>
|
|
339
|
+
<mat-icon mat-dialog-close style="cursor: pointer" fxFlex="5"
|
|
340
|
+
>close</mat-icon
|
|
341
|
+
>
|
|
342
|
+
</button>
|
|
343
|
+
</div>
|
|
344
|
+
<mat-dialog-content style="margin-right: 20px">
|
|
345
|
+
<div style="display: flex; flex-direction: column">
|
|
346
|
+
<ng-container *ngFor="let key of keys">
|
|
347
|
+
<mat-form-field
|
|
348
|
+
*ngIf="types[key] == 'number'"
|
|
349
|
+
color="accent"
|
|
350
|
+
appearance="outline"
|
|
351
|
+
class="inline-editing-field"
|
|
352
|
+
>
|
|
353
|
+
<mat-label>{{ key | titlecase }}</mat-label>
|
|
354
|
+
<input
|
|
355
|
+
matInput
|
|
356
|
+
type="number"
|
|
357
|
+
[(ngModel)]="row[key]"
|
|
358
|
+
color="accent"
|
|
359
|
+
[ngModelOptions]="{ standalone: true }"
|
|
360
|
+
/>
|
|
361
|
+
</mat-form-field>
|
|
362
|
+
|
|
363
|
+
<mat-form-field
|
|
364
|
+
*ngIf="types[key] == 'string'"
|
|
365
|
+
appearance="outline"
|
|
366
|
+
color="accent"
|
|
367
|
+
class="inline-editing-field"
|
|
368
|
+
>
|
|
369
|
+
<mat-label>{{ key | titlecase }}</mat-label>
|
|
370
|
+
<input
|
|
371
|
+
matInput
|
|
372
|
+
type="text"
|
|
373
|
+
[(ngModel)]="row[key]"
|
|
374
|
+
color="accent"
|
|
375
|
+
[ngModelOptions]="{ standalone: true }"
|
|
376
|
+
/>
|
|
377
|
+
</mat-form-field>
|
|
378
|
+
<mat-form-field
|
|
379
|
+
*ngIf="types[key] == 'date'"
|
|
380
|
+
appearance="outline"
|
|
381
|
+
color="accent"
|
|
382
|
+
class="inline-editing-field"
|
|
383
|
+
>
|
|
384
|
+
<mat-label>{{ key | titlecase }}</mat-label>
|
|
385
|
+
<input
|
|
386
|
+
matInput
|
|
387
|
+
type="text"
|
|
388
|
+
[(ngModel)]="row[key]"
|
|
389
|
+
[ngModelOptions]="{ standalone: true }"
|
|
390
|
+
/>
|
|
391
|
+
</mat-form-field>
|
|
392
|
+
<mat-form-field
|
|
393
|
+
*ngIf="types[key] == 'selection'"
|
|
394
|
+
appearance="outline"
|
|
395
|
+
color="accent"
|
|
396
|
+
class="inline-editing-field"
|
|
397
|
+
>
|
|
398
|
+
<mat-label>{{ key | titlecase }}</mat-label>
|
|
399
|
+
<mat-select [value]="row[key].value" [(ngModel)]="row[key].value">
|
|
400
|
+
<mat-option
|
|
401
|
+
*ngFor="let option of row[key].options"
|
|
402
|
+
[value]="option"
|
|
403
|
+
>
|
|
404
|
+
{{ option }}
|
|
405
|
+
</mat-option>
|
|
406
|
+
</mat-select>
|
|
407
|
+
</mat-form-field>
|
|
408
|
+
<p>
|
|
409
|
+
<mat-checkbox
|
|
410
|
+
*ngIf="types[key] == 'boolean'"
|
|
411
|
+
color="accent"
|
|
412
|
+
[(ngModel)]="row[key]"
|
|
413
|
+
>
|
|
414
|
+
<mat-label>{{ key | titlecase }}</mat-label>
|
|
415
|
+
</mat-checkbox>
|
|
416
|
+
</p>
|
|
417
|
+
</ng-container>
|
|
418
|
+
</div>
|
|
419
|
+
</mat-dialog-content>
|
|
420
|
+
<div class="spacer"></div>
|
|
421
|
+
<mat-dialog-actions style="margin-top: 20px" align="end">
|
|
422
|
+
<button mat-raised-button color="accent" mat-dialog-close>Cancel</button>
|
|
423
|
+
<button mat-raised-button color="primary" [mat-dialog-close]="row">
|
|
424
|
+
Save
|
|
425
|
+
</button>
|
|
426
|
+
</mat-dialog-actions>
|
|
427
|
+
</div>
|
|
428
|
+
</ng-template>
|
|
429
|
+
<ng-template
|
|
430
|
+
#inlineEditing
|
|
431
|
+
let-row="data.row"
|
|
432
|
+
let-column="data.column"
|
|
433
|
+
let-updateData="data.updateFunc"
|
|
434
|
+
>
|
|
435
|
+
<mat-form-field
|
|
436
|
+
*ngIf="column.type == 'number'"
|
|
437
|
+
appearance="outline"
|
|
438
|
+
class="inline-editing-field"
|
|
439
|
+
>
|
|
440
|
+
<input
|
|
441
|
+
matInput
|
|
442
|
+
type="number"
|
|
443
|
+
[(ngModel)]="row[column.field]"
|
|
444
|
+
[ngModelOptions]="{ standalone: true }"
|
|
445
|
+
(ngModelChange)="updateData(row)"
|
|
446
|
+
/>
|
|
447
|
+
</mat-form-field>
|
|
448
|
+
<mat-form-field
|
|
449
|
+
*ngIf="column.type == 'string'"
|
|
450
|
+
appearance="outline"
|
|
451
|
+
class="inline-editing-field"
|
|
452
|
+
>
|
|
453
|
+
<input
|
|
454
|
+
matInput
|
|
455
|
+
type="text"
|
|
456
|
+
[(ngModel)]="row[column.field]"
|
|
457
|
+
[ngModelOptions]="{ standalone: true }"
|
|
458
|
+
(ngModelChange)="updateData(row)"
|
|
459
|
+
/>
|
|
460
|
+
</mat-form-field>
|
|
461
|
+
<mat-form-field
|
|
462
|
+
*ngIf="column.type == 'date'"
|
|
463
|
+
appearance="outline"
|
|
464
|
+
class="inline-editing-field"
|
|
465
|
+
>
|
|
466
|
+
<input
|
|
467
|
+
matInput
|
|
468
|
+
type="date"
|
|
469
|
+
[(ngModel)]="row[column.field]"
|
|
470
|
+
[ngModelOptions]="{ standalone: true }"
|
|
471
|
+
(ngModelChange)="updateData(row)"
|
|
472
|
+
/>
|
|
473
|
+
</mat-form-field>
|
|
474
|
+
<mat-form-field
|
|
475
|
+
*ngIf="column.type == 'selection'"
|
|
476
|
+
appearance="outline"
|
|
477
|
+
class="inline-editing-field"
|
|
478
|
+
>
|
|
479
|
+
<mat-select
|
|
480
|
+
[value]="row[column.field]"
|
|
481
|
+
[(ngModel)]="row[column.field]"
|
|
482
|
+
(ngModelChange)="updateData(row)"
|
|
483
|
+
[ngModelOptions]="{ standalone: true }"
|
|
484
|
+
>
|
|
485
|
+
<mat-option *ngFor="let option of column.options" [value]="option">
|
|
486
|
+
{{ option }}
|
|
487
|
+
</mat-option>
|
|
488
|
+
</mat-select>
|
|
489
|
+
</mat-form-field>
|
|
490
|
+
<mat-checkbox
|
|
491
|
+
(click)="$event.stopPropagation()"
|
|
492
|
+
(ngModelChange)="updateData(row)"
|
|
493
|
+
*ngIf="column.type == 'boolean'"
|
|
494
|
+
color="primary"
|
|
495
|
+
[(ngModel)]="row[column.field]"
|
|
496
|
+
></mat-checkbox>
|
|
497
|
+
</ng-template>
|
|
498
|
+
<ng-template
|
|
499
|
+
#cellEditing
|
|
500
|
+
let-row="data.row"
|
|
501
|
+
let-column="data.column"
|
|
502
|
+
let-updateData="data.updateFunc"
|
|
503
|
+
>
|
|
504
|
+
<mat-form-field
|
|
505
|
+
*ngIf="column.type == 'number'"
|
|
506
|
+
color="accent"
|
|
507
|
+
appearance="outline"
|
|
508
|
+
class="inline-editing-field"
|
|
509
|
+
>
|
|
510
|
+
<input
|
|
511
|
+
matInput
|
|
512
|
+
type="number"
|
|
513
|
+
[(ngModel)]="row[column.field]"
|
|
514
|
+
[ngModelOptions]="{ standalone: true }"
|
|
515
|
+
(ngModelChange)="updateData(row)"
|
|
516
|
+
/>
|
|
517
|
+
</mat-form-field>
|
|
518
|
+
|
|
519
|
+
<mat-form-field
|
|
520
|
+
*ngIf="column.type == 'string'"
|
|
521
|
+
color="accent"
|
|
522
|
+
appearance="outline"
|
|
523
|
+
class="inline-editing-field"
|
|
524
|
+
>
|
|
525
|
+
<input
|
|
526
|
+
matInput
|
|
527
|
+
type="text"
|
|
528
|
+
[(ngModel)]="row[column.field]"
|
|
529
|
+
[ngModelOptions]="{ standalone: true }"
|
|
530
|
+
(ngModelChange)="updateData(row)"
|
|
531
|
+
/>
|
|
532
|
+
</mat-form-field>
|
|
533
|
+
<mat-form-field
|
|
534
|
+
*ngIf="column.type == 'date'"
|
|
535
|
+
color="accent"
|
|
536
|
+
appearance="outline"
|
|
537
|
+
class="inline-editing-field"
|
|
538
|
+
>
|
|
539
|
+
<input
|
|
540
|
+
matInput
|
|
541
|
+
type="date"
|
|
542
|
+
[(ngModel)]="row[column.field]"
|
|
543
|
+
[ngModelOptions]="{ standalone: true }"
|
|
544
|
+
(ngModelChange)="updateData(row)"
|
|
545
|
+
/>
|
|
546
|
+
</mat-form-field>
|
|
547
|
+
<mat-form-field
|
|
548
|
+
*ngIf="column.type == 'selection'"
|
|
549
|
+
color="accent"
|
|
550
|
+
appearance="outline"
|
|
551
|
+
class="inline-editing-field"
|
|
552
|
+
>
|
|
553
|
+
<mat-select
|
|
554
|
+
[value]="row[column.field]"
|
|
555
|
+
[(ngModel)]="row[column.field]"
|
|
556
|
+
(ngModelChange)="updateData(row)"
|
|
557
|
+
[ngModelOptions]="{ standalone: true }"
|
|
558
|
+
>
|
|
559
|
+
<mat-option *ngFor="let option of column.options" [value]="option">
|
|
560
|
+
{{ option }}
|
|
561
|
+
</mat-option>
|
|
562
|
+
</mat-select>
|
|
563
|
+
</mat-form-field>
|
|
564
|
+
<mat-checkbox
|
|
565
|
+
(click)="$event.stopPropagation()"
|
|
566
|
+
color="accent"
|
|
567
|
+
(ngModelChange)="updateData(row)"
|
|
568
|
+
*ngIf="column.type == 'boolean'"
|
|
569
|
+
color="primary"
|
|
570
|
+
[(ngModel)]="row[column.field]"
|
|
571
|
+
></mat-checkbox>
|
|
572
|
+
</ng-template>
|
|
573
|
+
<ng-template #ex>
|
|
574
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus accusantium
|
|
575
|
+
quod corrupti? Beatae minima natus tempora iure doloremque magnam excepturi
|
|
576
|
+
consequatur? Odit ullam eius ea necessitatibus autem aliquam, qui nulla.
|
|
577
|
+
</ng-template>
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
import { AppComponent } from './app.component';
|
|
3
|
+
|
|
4
|
+
describe('AppComponent', () => {
|
|
5
|
+
beforeEach(async () => {
|
|
6
|
+
await TestBed.configureTestingModule({
|
|
7
|
+
declarations: [
|
|
8
|
+
AppComponent
|
|
9
|
+
],
|
|
10
|
+
}).compileComponents();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should create the app', () => {
|
|
14
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
15
|
+
const app = fixture.componentInstance;
|
|
16
|
+
expect(app).toBeTruthy();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it(`should have as title 'mat-table-ext-example'`, () => {
|
|
20
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
21
|
+
const app = fixture.componentInstance;
|
|
22
|
+
expect(app.title).toEqual('mat-table-ext-example');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should render title', () => {
|
|
26
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
27
|
+
fixture.detectChanges();
|
|
28
|
+
const compiled = fixture.nativeElement as HTMLElement;
|
|
29
|
+
expect(compiled.querySelector('.content span')?.textContent).toContain('mat-table-ext-example app is running!');
|
|
30
|
+
});
|
|
31
|
+
});
|