@avoraui/av-data-table 0.0.5 → 0.0.6

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.
@@ -0,0 +1,19 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/lib",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "inlineSources": true,
10
+ "sourceMap": true,
11
+ "types": []
12
+ },
13
+ "include": [
14
+ "src/**/*.ts"
15
+ ],
16
+ "exclude": [
17
+ "**/*.spec.ts"
18
+ ]
19
+ }
@@ -0,0 +1,11 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "./tsconfig.lib.json",
5
+ "compilerOptions": {
6
+ "declarationMap": false
7
+ },
8
+ "angularCompilerOptions": {
9
+ "compilationMode": "partial"
10
+ }
11
+ }
@@ -0,0 +1,14 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/spec",
7
+ "types": [
8
+ "jasmine"
9
+ ]
10
+ },
11
+ "include": [
12
+ "src/**/*.ts"
13
+ ]
14
+ }
Binary file
@@ -1,464 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, forwardRef, Input, Output, Component } from '@angular/core';
3
- import { MatCard, MatCardContent } from '@angular/material/card';
4
- import { MatIcon } from '@angular/material/icon';
5
- import { MatIconButton } from '@angular/material/button';
6
- import { NgClass, NgStyle } from '@angular/common';
7
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
8
- import { MatPaginator } from '@angular/material/paginator';
9
-
10
- class AvDataTable {
11
- PageSize = 5;
12
- PageSizeOptions = [];
13
- currentPage = 0;
14
- TableHeaders = [];
15
- TableColumns = [];
16
- TableData = [];
17
- Data = [];
18
- EnableActionColumn = false;
19
- EnableButtonDelete = false;
20
- EnableButtonModify = false;
21
- onModify = new EventEmitter();
22
- onNewItemAdded = new EventEmitter();
23
- onItemRemoved = new EventEmitter();
24
- DisableRemove = false;
25
- DisableModify = false;
26
- gridTemplateColumns = '';
27
- onChange = () => { };
28
- onTouched = () => { };
29
- constructor() {
30
- }
31
- /**
32
- * Lifecycle hook that is called after Angular has initialized all data-bound properties of a directive.
33
- * This method is used to perform initialization logic for the component.
34
- *
35
- * It executes the following:
36
- * - Initializes the paginator for managing paginated data display.
37
- * - Calculates the grid template for layout adjustments.
38
- * - Synchronizes data sources to ensure the component has up-to-date data.
39
- *
40
- * @return {void} This method does not return any value.
41
- */
42
- ngOnInit() {
43
- this.initializePaginator();
44
- this.calculateGridTemplate();
45
- this.syncDataSources();
46
- }
47
- /**
48
- * Initializes the paginator configuration. Sets default values for PageSize, PageSizeOptions,
49
- * and currentPage if they are undefined, null, or invalid. Ensures the PageSize is included
50
- * in the PageSizeOptions array and sorts the options in ascending order.
51
- *
52
- * @return {void} Does not return a value.
53
- */
54
- initializePaginator() {
55
- if (this.PageSize === undefined || this.PageSize === null || this.PageSize <= 0) {
56
- this.PageSize = 5;
57
- }
58
- if (this.PageSizeOptions === undefined || this.PageSizeOptions === null || this.PageSizeOptions.length === 0) {
59
- this.PageSizeOptions = [5, 10, 20, 50];
60
- }
61
- if (this.currentPage === undefined || this.currentPage === null || this.currentPage < 0) {
62
- this.currentPage = 0;
63
- }
64
- // Ensure PageSize is included in PageSizeOptions if not already present
65
- if (!this.PageSizeOptions.includes(this.PageSize)) {
66
- this.PageSizeOptions = [...this.PageSizeOptions, this.PageSize].sort((a, b) => a - b);
67
- }
68
- }
69
- /**
70
- * Handles changes to the component's input properties during the lifecycle of the component.
71
- *
72
- * This method is triggered whenever an input property bound to the component changes. It processes
73
- * updates to properties such as `Data`, `PageSize`, `PageSizeOptions`, and `currentPage`, and
74
- * ensures the internal state is kept in sync with the new inputs. Additionally, it updates the paginator
75
- * and adjusts the current page as necessary.
76
- *
77
- * @param {SimpleChanges} changes - A collection of SimpleChange objects representing the changed properties.
78
- * Each `SimpleChange` object provides information like the current and previous values as well as a flag
79
- * indicating if it is the first change to this input.
80
- * @return {void} - This method does not return any value.
81
- */
82
- ngOnChanges(changes) {
83
- // Listen for changes in the external Data input
84
- if (changes['Data'] && !changes['Data'].firstChange) {
85
- this.syncDataSources();
86
- // Reset to first page when data changes
87
- this.currentPage = 0;
88
- }
89
- // Handle changes in pagination settings
90
- if (changes['PageSize'] || changes['PageSizeOptions'] || changes['currentPage']) {
91
- this.initializePaginator();
92
- // Validate current page doesn't exceed available pages
93
- const totalPages = Math.ceil(this.TableData.length / this.PageSize);
94
- if (this.currentPage >= totalPages && totalPages > 0) {
95
- this.currentPage = totalPages - 1;
96
- }
97
- }
98
- }
99
- /**
100
- * Retrieves a subset of data from the full dataset based on the current page and page size.
101
- *
102
- * @return {Array} A portion of the TableData array corresponding to the current page.
103
- */
104
- getPaginatedData() {
105
- const startIndex = this.currentPage * this.PageSize;
106
- const endIndex = startIndex + this.PageSize;
107
- return this.TableData.slice(startIndex, endIndex);
108
- }
109
- /**
110
- * Handles changes in the pagination state, such as changing the current page or the page size.
111
- *
112
- * @param {PageEvent} event - The event triggered by a pagination action that contains the updated page index and page size.
113
- * @return {void} This method does not return anything.
114
- */
115
- pageChange(event) {
116
- this.currentPage = event.pageIndex;
117
- this.PageSize = event.pageSize;
118
- }
119
- /**
120
- * Calculates the actual index in the dataset based on the paginated index.
121
- *
122
- * @param {number} paginatedIndex - The index within the current page of paginated data.
123
- * @return {number} The actual index in the entire dataset.
124
- */
125
- getActualIndex(paginatedIndex) {
126
- return (this.currentPage * this.PageSize) + paginatedIndex;
127
- }
128
- /**
129
- * Synchronizes external data source with the internal TableData.
130
- * If the external Data differs from the current TableData, the TableData
131
- * is updated with the values from Data and a change notification is triggered.
132
- *
133
- * @return {void} This method does not return a value.
134
- */
135
- syncDataSources() {
136
- // If external Data is provided and differs from TableData, update TableData
137
- if (this.Data && this.Data.length > 0) {
138
- // Check if Data and TableData are different
139
- const dataString = JSON.stringify(this.Data);
140
- const tableDataString = JSON.stringify(this.TableData);
141
- if (dataString !== tableDataString) {
142
- this.TableData = [...this.Data];
143
- // console.log("Changed Data : " + this.Data);
144
- // Notify the form about the change
145
- this.onChange(this.TableData);
146
- }
147
- }
148
- }
149
- /**
150
- * Updates the form value by notifying changes and updating external data if available.
151
- * This method triggers the onChange callback with the current table data
152
- * and notifies that the form field has been touched. Additionally, it updates
153
- * the external data reference to ensure proper change detection in the parent components.
154
- *
155
- * @return {void} No return value.
156
- */
157
- updateFormValue() {
158
- // Notify the form about the change
159
- if (this.onChange) {
160
- this.onChange(this.TableData);
161
- this.onTouched();
162
- }
163
- // Also update the external Data if it exists
164
- if (this.Data) {
165
- // Create a new reference to trigger OnChanges in parent components
166
- this.Data = [...this.TableData];
167
- }
168
- }
169
- /**
170
- * Calculates and sets the grid template for a layout based on the number of displayed headers
171
- * and the presence of an action column. The grid template determines the column structure with
172
- * equal fractions for data columns and a fixed width for the action column if enabled.
173
- *
174
- * @return {void} Does not return a value. Sets the `gridTemplateColumns` property to the calculated template.
175
- */
176
- calculateGridTemplate() {
177
- // Calculate grid template based on columns count
178
- const displayedHeaders = this.getDisplayedHeaders();
179
- const columnsCount = displayedHeaders.length;
180
- if (columnsCount === 0)
181
- return;
182
- // Create grid template with equal fractions for data columns
183
- // and fixed width for action column if enabled
184
- if (this.EnableActionColumn) {
185
- const dataColumns = columnsCount - 1; // Subtract action column
186
- this.gridTemplateColumns = dataColumns > 0
187
- ? `repeat(${dataColumns}, 1fr) 100px`
188
- : '100px';
189
- }
190
- else {
191
- this.gridTemplateColumns = `repeat(${columnsCount}, 1fr)`;
192
- }
193
- }
194
- /**
195
- * Retrieves the headers that should be displayed in the table.
196
- * The method includes or excludes the "action" column based on the value of `EnableActionColumn`.
197
- *
198
- * @return {TableProp[]} An array of headers to be displayed in the table. If `EnableActionColumn` is false, the "action" column is excluded.
199
- */
200
- getDisplayedHeaders() {
201
- return this.EnableActionColumn
202
- ? this.TableHeaders
203
- : this.TableHeaders.filter(h => h.label.toLowerCase() !== 'action');
204
- }
205
- /**
206
- * Generates and returns an object representing CSS classes for a header based on its alignment property.
207
- *
208
- * @param {TableProp} header - An object containing header properties, including an alignment property ('center', 'right', or 'left').
209
- * @return {Object} An object mapping class names to a boolean indicating their applicability based on the alignment of the header.
210
- */
211
- getHeaderFieldClasses(header) {
212
- return {
213
- 'header-text-center': header.align === 'center',
214
- 'header-text-right': header.align === 'right',
215
- 'header-text-left': header.align === 'left',
216
- };
217
- }
218
- /**
219
- * Generates a mapping of CSS classes for a data field based on the alignment property of the given column.
220
- *
221
- * @param {Columns} column - The column object containing alignment information.
222
- * @return {Object} An object where the keys are class names, and the values are booleans indicating whether each class applies.
223
- */
224
- getDataFieldClasses(column) {
225
- return {
226
- 'text-center': column.align === 'center',
227
- 'text-right': column.align === 'right',
228
- 'text-left': column.align === 'left',
229
- };
230
- }
231
- /**
232
- * Retrieves the color property from the given column object.
233
- *
234
- * @param {Columns} column - The column object containing the color property.
235
- * @return {string} The color associated with the column.
236
- */
237
- getDataFiledColor(column) {
238
- return column.color;
239
- }
240
- /**
241
- * Retrieves the value of a specified column from the given item.
242
- *
243
- * @param {any} item - The object containing the data to extract the value from.
244
- * @param {Columns} column - The column definition, including the field name or path.
245
- * @return {string} The value of the specified column for the given item. If the field is not found, an empty string is returned.
246
- */
247
- getValueForColumn(item, column) {
248
- if (!item || !column || !column.field)
249
- return '';
250
- // Check if the field has dot notation (e.g., 'gender.name')
251
- if (column.field.includes('.')) {
252
- return this.getNestedValue(item, column.field);
253
- }
254
- else {
255
- // Handle standard fields
256
- return column.field in item ? item[column.field] : '';
257
- }
258
- }
259
- /**
260
- * Retrieves a nested value from a given object based on a dot-separated path string.
261
- * If the path does not exist or the value is undefined/null, it returns a placeholder '-'.
262
- * If accessing an array, it maps the values at the given key and processes them.
263
- *
264
- * @param {any} object - The object from which the nested value is extracted.
265
- * @param {string} path - The dot-separated string representing the path to the desired value.
266
- * @return {any} The value found at the given path, an array joined into a string, or '-' if not found.
267
- */
268
- getNestedValue(object, path) {
269
- // Return early if object is null or undefined
270
- if (!object)
271
- return '-';
272
- // Split the path into individual keys (e.g., "gender.name" → ["gender", "name"])
273
- const keys = path.split('.');
274
- let value = object;
275
- // Navigate through the object hierarchy
276
- for (const key of keys) {
277
- if (value === null || value === undefined) {
278
- return '-';
279
- }
280
- if (Array.isArray(value)) {
281
- // If we encounter an array, map over its items to extract the property
282
- value = value.map(item => item[key]).filter(Boolean);
283
- }
284
- else {
285
- // Access the next property level
286
- value = value[key];
287
- }
288
- }
289
- // Format the final result
290
- if (Array.isArray(value)) {
291
- return value.length > 0 ? value.join(', ') : '-';
292
- }
293
- return value !== null && value !== undefined ? value : '-';
294
- }
295
- /**
296
- * Removes an item from the data table at the specified index.
297
- *
298
- * @param {number} actualIndex - The index of the item to remove from the data table.
299
- * @return {void} This method does not return a value.
300
- */
301
- removeItem(actualIndex) {
302
- // Check disable condition FIRST - before touching any data
303
- if (this.DisableRemove) {
304
- // Don't remove from TableData, just emit event for parent to handle
305
- this.onItemRemoved.emit({
306
- index: actualIndex,
307
- dataSize: this.TableData.length,
308
- removedItem: this.TableData[actualIndex], // Get the item that would be removed
309
- disabled: true
310
- });
311
- return; // Exit early - don't modify TableData
312
- }
313
- else {
314
- // Only proceed with actual removal if not disabled
315
- const newData = [...this.TableData];
316
- const removedData = newData[actualIndex]; // Get the item being removed
317
- newData.splice(actualIndex, 1);
318
- this.TableData = newData;
319
- // Rest of your existing logic...
320
- const totalPages = Math.ceil(this.TableData.length / this.PageSize);
321
- if (this.currentPage >= totalPages && this.currentPage > 0) {
322
- this.currentPage = totalPages - 1;
323
- }
324
- if (this.TableData.length === 0) {
325
- this.onChange([removedData]);
326
- }
327
- else {
328
- this.updateFormValue();
329
- }
330
- this.onItemRemoved.emit({
331
- index: actualIndex,
332
- dataSize: this.TableData.length,
333
- removedItem: removedData,
334
- disabled: false
335
- });
336
- }
337
- }
338
- /**
339
- * Modifies an item at the specified index in the dataset. If the modification is disabled, emits an event without making any changes.
340
- *
341
- * @param {number} actualIndex - The index of the item to be modified in the dataset.
342
- * @return {void} This method does not return a value.
343
- */
344
- modifyItem(actualIndex) {
345
- // Check disable condition FIRST - before any modification logic
346
- if (this.DisableModify) {
347
- // Emit event for parent to handle the disabled state
348
- this.onModify.emit({
349
- index: actualIndex,
350
- modifiedItem: this.TableData[actualIndex],
351
- disabled: true
352
- });
353
- return; // Exit early - don't proceed with modification
354
- }
355
- // Only proceed with modification if not disabled
356
- const modifiedItem = this.TableData[actualIndex];
357
- this.onModify.emit({
358
- index: actualIndex,
359
- modifiedItem,
360
- disabled: false
361
- });
362
- }
363
- // ControlValueAccessor interface implementation
364
- /**
365
- * Registers a callback function to be called whenever the value changes.
366
- *
367
- * @param {any} fn - The function to be executed on a value change.
368
- * @return {void} This method does not return a value.
369
- */
370
- registerOnChange(fn) {
371
- this.onChange = fn;
372
- }
373
- /**
374
- * Registers a callback function that should be called when the control is touched.
375
- *
376
- * @param {any} fn - The callback function to execute when the control is touched.
377
- * @return {void} This method does not return a value.
378
- */
379
- registerOnTouched(fn) {
380
- this.onTouched = fn;
381
- }
382
- /**
383
- * Writes a new value to the table data and resets to the first page.
384
- *
385
- * @param {any[]} value - The array of data to be written to the table.
386
- * @return {void} Does not return a value.
387
- */
388
- writeValue(value) {
389
- if (value) {
390
- this.TableData = [...value];
391
- // Reset to first page when new data is written
392
- this.currentPage = 0;
393
- }
394
- else {
395
- this.TableData = [];
396
- this.currentPage = 0;
397
- }
398
- }
399
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AvDataTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
400
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.2", type: AvDataTable, isStandalone: true, selector: "av-data-table", inputs: { PageSize: "PageSize", PageSizeOptions: "PageSizeOptions", currentPage: "currentPage", TableHeaders: "TableHeaders", TableColumns: "TableColumns", Data: "Data", EnableActionColumn: "EnableActionColumn", EnableButtonDelete: "EnableButtonDelete", EnableButtonModify: "EnableButtonModify", DisableRemove: "DisableRemove", DisableModify: "DisableModify" }, outputs: { onModify: "onModify", onNewItemAdded: "onNewItemAdded", onItemRemoved: "onItemRemoved" }, providers: [
401
- {
402
- provide: NG_VALUE_ACCESSOR,
403
- useExisting: forwardRef(() => AvDataTable),
404
- multi: true
405
- }
406
- ], usesOnChanges: true, ngImport: i0, template: "@if (TableData.length > 0) {\r\n <div class=\"item-header-row\" [ngStyle]=\"{'grid-template-columns': gridTemplateColumns}\">\r\n @for (header of getDisplayedHeaders(); track $index) {\r\n <strong [ngClass]=\"getHeaderFieldClasses(header)\">\r\n {{ header.label }}\r\n </strong>\r\n }\r\n </div>\r\n\r\n <!-- Display only the paginated items -->\r\n @for (item of getPaginatedData(); track $index) {\r\n <mat-card>\r\n <mat-card-content>\r\n <div class=\"item-details\">\r\n <div class=\"item-row\" [ngStyle]=\"{'grid-template-columns': gridTemplateColumns}\">\r\n @for (column of TableColumns; track column) {\r\n <span [ngClass]=\"getDataFieldClasses(column)\"\r\n [ngStyle]=\"{ color: getDataFiledColor(column) }\"\r\n >{{ getValueForColumn(item, column) }}</span>\r\n }\r\n @if (EnableActionColumn) {\r\n <div class=\"action-buttons\">\r\n @if (EnableButtonModify) {\r\n <button\r\n class=\"item-action-edit\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"modifyItem(getActualIndex($index))\">\r\n <mat-icon style=\"color:#ffffff;\">edit</mat-icon>\r\n </button>\r\n }\r\n @if (EnableButtonDelete) {\r\n <button\r\n class=\"item-action-delete\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeItem(getActualIndex($index))\">\r\n <mat-icon style=\"color:#ffffff;\">delete</mat-icon>\r\n </button>\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </mat-card-content>\r\n </mat-card>\r\n }\r\n\r\n <!-- Move paginator outside the loop -->\r\n <div class=\"paginator-container\">\r\n <mat-paginator\r\n [pageSize]=\"PageSize\"\r\n [length]=\"TableData.length\"\r\n [pageSizeOptions]=\"PageSizeOptions\"\r\n [pageIndex]=\"currentPage\"\r\n (page)=\"pageChange($event)\"\r\n showFirstLastButtons>\r\n </mat-paginator>\r\n </div>\r\n}\r\n", styles: [".mat-header-cell{font-weight:700}mat-card{width:100%;background:none;border:unset;box-shadow:unset;margin:.2rem}mat-card-header{border-top-left-radius:10px;border-top-right-radius:10px;padding-bottom:15px;border-bottom:black solid 1px}mat-card-content{border-radius:unset!important;padding-top:15px;background:unset;overflow:hidden;height:100%}button:disabled{opacity:.5;cursor:not-allowed!important}mat-icon{color:#fff!important;font-size:18px;width:18px;height:18px}.item-header-row{display:grid;padding:12px 20px;background:#f5f7fa;border-bottom:2px solid #e0e4e8;border-top:2px solid #e0e4e8;margin-top:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;letter-spacing:.3px}.item-header-row strong{font-weight:600;color:#4a5568;font-size:14px;text-transform:uppercase}.header-text-left{text-align:left;padding-left:16px!important}.header-text-center{text-align:center}.header-text-right{text-align:right}.text-left{text-align:left;padding-left:5px!important;font-weight:500}.text-center{text-align:center;font-weight:500}.text-right{text-align:right}.item-details{width:100%;margin-bottom:-13px!important;background-color:#fff;box-shadow:0 2px 8px #0000000d;overflow:hidden;transition:all .2s ease}.item-row{width:100%;display:grid;align-items:center;padding:10px}.action-buttons{display:flex;flex-direction:row;align-items:center;justify-content:center;margin-left:25px;align-self:center;gap:5px}.item-action-delete{text-align:right!important;margin-right:60px!important;background-color:#f56565!important;height:36px!important;width:36px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important;box-shadow:0 2px 4px #f5656533!important}.item-action-edit{justify-self:center;text-align:right!important;background-color:#65a0f6!important;height:36px!important;width:36px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important;box-shadow:0 2px 4px #f5656533!important}.item-action-edit mat-icon{color:#fff!important}.item-action{text-align:right!important;margin-right:60px!important;background-color:#f56565!important;height:36px!important;width:36px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important;box-shadow:0 2px 4px #f5656533!important}.paginator-container mat-paginator{background:transparent!important;border-top:1px solid #f1f1f1!important}\n"], dependencies: [{ kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }] });
407
- }
408
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AvDataTable, decorators: [{
409
- type: Component,
410
- args: [{ selector: 'av-data-table', providers: [
411
- {
412
- provide: NG_VALUE_ACCESSOR,
413
- useExisting: forwardRef(() => AvDataTable),
414
- multi: true
415
- }
416
- ], imports: [
417
- MatCard,
418
- MatCardContent,
419
- MatIcon,
420
- MatIconButton,
421
- NgClass,
422
- NgStyle,
423
- MatPaginator,
424
- ], standalone: true, template: "@if (TableData.length > 0) {\r\n <div class=\"item-header-row\" [ngStyle]=\"{'grid-template-columns': gridTemplateColumns}\">\r\n @for (header of getDisplayedHeaders(); track $index) {\r\n <strong [ngClass]=\"getHeaderFieldClasses(header)\">\r\n {{ header.label }}\r\n </strong>\r\n }\r\n </div>\r\n\r\n <!-- Display only the paginated items -->\r\n @for (item of getPaginatedData(); track $index) {\r\n <mat-card>\r\n <mat-card-content>\r\n <div class=\"item-details\">\r\n <div class=\"item-row\" [ngStyle]=\"{'grid-template-columns': gridTemplateColumns}\">\r\n @for (column of TableColumns; track column) {\r\n <span [ngClass]=\"getDataFieldClasses(column)\"\r\n [ngStyle]=\"{ color: getDataFiledColor(column) }\"\r\n >{{ getValueForColumn(item, column) }}</span>\r\n }\r\n @if (EnableActionColumn) {\r\n <div class=\"action-buttons\">\r\n @if (EnableButtonModify) {\r\n <button\r\n class=\"item-action-edit\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"modifyItem(getActualIndex($index))\">\r\n <mat-icon style=\"color:#ffffff;\">edit</mat-icon>\r\n </button>\r\n }\r\n @if (EnableButtonDelete) {\r\n <button\r\n class=\"item-action-delete\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeItem(getActualIndex($index))\">\r\n <mat-icon style=\"color:#ffffff;\">delete</mat-icon>\r\n </button>\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </mat-card-content>\r\n </mat-card>\r\n }\r\n\r\n <!-- Move paginator outside the loop -->\r\n <div class=\"paginator-container\">\r\n <mat-paginator\r\n [pageSize]=\"PageSize\"\r\n [length]=\"TableData.length\"\r\n [pageSizeOptions]=\"PageSizeOptions\"\r\n [pageIndex]=\"currentPage\"\r\n (page)=\"pageChange($event)\"\r\n showFirstLastButtons>\r\n </mat-paginator>\r\n </div>\r\n}\r\n", styles: [".mat-header-cell{font-weight:700}mat-card{width:100%;background:none;border:unset;box-shadow:unset;margin:.2rem}mat-card-header{border-top-left-radius:10px;border-top-right-radius:10px;padding-bottom:15px;border-bottom:black solid 1px}mat-card-content{border-radius:unset!important;padding-top:15px;background:unset;overflow:hidden;height:100%}button:disabled{opacity:.5;cursor:not-allowed!important}mat-icon{color:#fff!important;font-size:18px;width:18px;height:18px}.item-header-row{display:grid;padding:12px 20px;background:#f5f7fa;border-bottom:2px solid #e0e4e8;border-top:2px solid #e0e4e8;margin-top:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;letter-spacing:.3px}.item-header-row strong{font-weight:600;color:#4a5568;font-size:14px;text-transform:uppercase}.header-text-left{text-align:left;padding-left:16px!important}.header-text-center{text-align:center}.header-text-right{text-align:right}.text-left{text-align:left;padding-left:5px!important;font-weight:500}.text-center{text-align:center;font-weight:500}.text-right{text-align:right}.item-details{width:100%;margin-bottom:-13px!important;background-color:#fff;box-shadow:0 2px 8px #0000000d;overflow:hidden;transition:all .2s ease}.item-row{width:100%;display:grid;align-items:center;padding:10px}.action-buttons{display:flex;flex-direction:row;align-items:center;justify-content:center;margin-left:25px;align-self:center;gap:5px}.item-action-delete{text-align:right!important;margin-right:60px!important;background-color:#f56565!important;height:36px!important;width:36px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important;box-shadow:0 2px 4px #f5656533!important}.item-action-edit{justify-self:center;text-align:right!important;background-color:#65a0f6!important;height:36px!important;width:36px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important;box-shadow:0 2px 4px #f5656533!important}.item-action-edit mat-icon{color:#fff!important}.item-action{text-align:right!important;margin-right:60px!important;background-color:#f56565!important;height:36px!important;width:36px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important;box-shadow:0 2px 4px #f5656533!important}.paginator-container mat-paginator{background:transparent!important;border-top:1px solid #f1f1f1!important}\n"] }]
425
- }], ctorParameters: () => [], propDecorators: { PageSize: [{
426
- type: Input
427
- }], PageSizeOptions: [{
428
- type: Input
429
- }], currentPage: [{
430
- type: Input
431
- }], TableHeaders: [{
432
- type: Input
433
- }], TableColumns: [{
434
- type: Input
435
- }], Data: [{
436
- type: Input
437
- }], EnableActionColumn: [{
438
- type: Input
439
- }], EnableButtonDelete: [{
440
- type: Input
441
- }], EnableButtonModify: [{
442
- type: Input
443
- }], onModify: [{
444
- type: Output
445
- }], onNewItemAdded: [{
446
- type: Output
447
- }], onItemRemoved: [{
448
- type: Output
449
- }], DisableRemove: [{
450
- type: Input
451
- }], DisableModify: [{
452
- type: Input
453
- }] } });
454
-
455
- /*
456
- * Public API Surface of data-table
457
- */
458
-
459
- /**
460
- * Generated bundle index. Do not edit.
461
- */
462
-
463
- export { AvDataTable };
464
- //# sourceMappingURL=avoraui-av-data-table.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"avoraui-av-data-table.mjs","sources":["../../../projects/av-data-table/src/lib/av-data-table.ts","../../../projects/av-data-table/src/lib/av-data-table.html","../../../projects/av-data-table/src/public-api.ts","../../../projects/av-data-table/src/avoraui-av-data-table.ts"],"sourcesContent":["import {Component, EventEmitter, forwardRef, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';\r\nimport {MatCard, MatCardContent} from \"@angular/material/card\";\r\nimport {MatIcon} from \"@angular/material/icon\";\r\nimport {MatIconButton} from \"@angular/material/button\";\r\nimport {NgClass, NgStyle} from \"@angular/common\";\r\nimport {ControlValueAccessor, NG_VALUE_ACCESSOR} from \"@angular/forms\";\r\nimport {MatPaginator, PageEvent} from \"@angular/material/paginator\";\r\nimport {Headers, Columns} from './table-prop';\r\n\r\n@Component({\r\n selector: 'av-data-table',\r\n providers: [\r\n {\r\n provide: NG_VALUE_ACCESSOR,\r\n useExisting: forwardRef(() => AvDataTable),\r\n multi: true\r\n }\r\n ],\r\n imports: [\r\n MatCard,\r\n MatCardContent,\r\n MatIcon,\r\n MatIconButton,\r\n NgClass,\r\n NgStyle,\r\n MatPaginator,\r\n ],\r\n templateUrl: './av-data-table.html',\r\n styleUrl: './av-data-table.css',\r\n standalone: true\r\n})\r\nexport class AvDataTable implements OnInit, OnChanges, ControlValueAccessor {\r\n\r\n @Input() PageSize: number = 5;\r\n @Input() PageSizeOptions: Array<number> = [];\r\n @Input() currentPage: number = 0;\r\n @Input() TableHeaders: Headers[] = [];\r\n @Input() TableColumns: Columns[] = [];\r\n protected TableData: any[] = [];\r\n @Input() Data: any[] = [];\r\n @Input() EnableActionColumn: boolean = false;\r\n @Input() EnableButtonDelete: boolean = false;\r\n @Input() EnableButtonModify: boolean = false;\r\n @Output() onModify = new EventEmitter<{ index: number; modifiedItem: any, disabled: boolean }>();\r\n @Output() onNewItemAdded = new EventEmitter<{index: number, dataSize: number, removedItem: any}>();\r\n @Output() onItemRemoved = new EventEmitter<{index: number, dataSize: number, removedItem: any, disabled: boolean}>();\r\n @Input() DisableRemove: boolean = false;\r\n @Input() DisableModify: boolean = false;\r\n gridTemplateColumns: string = '';\r\n private onChange: (value: any) => void = () => {};\r\n private onTouched: () => void = () => {};\r\n\r\n constructor(\r\n ) {\r\n }\r\n\r\n /**\r\n * Lifecycle hook that is called after Angular has initialized all data-bound properties of a directive.\r\n * This method is used to perform initialization logic for the component.\r\n *\r\n * It executes the following:\r\n * - Initializes the paginator for managing paginated data display.\r\n * - Calculates the grid template for layout adjustments.\r\n * - Synchronizes data sources to ensure the component has up-to-date data.\r\n *\r\n * @return {void} This method does not return any value.\r\n */\r\n ngOnInit(): void {\r\n this.initializePaginator();\r\n this.calculateGridTemplate();\r\n this.syncDataSources();\r\n }\r\n\r\n /**\r\n * Initializes the paginator configuration. Sets default values for PageSize, PageSizeOptions,\r\n * and currentPage if they are undefined, null, or invalid. Ensures the PageSize is included\r\n * in the PageSizeOptions array and sorts the options in ascending order.\r\n *\r\n * @return {void} Does not return a value.\r\n */\r\n initializePaginator(): void {\r\n if (this.PageSize === undefined || this.PageSize === null || this.PageSize <= 0) {\r\n this.PageSize = 5;\r\n }\r\n if (this.PageSizeOptions === undefined || this.PageSizeOptions === null || this.PageSizeOptions.length === 0) {\r\n this.PageSizeOptions = [5, 10, 20, 50];\r\n }\r\n if (this.currentPage === undefined || this.currentPage === null || this.currentPage < 0) {\r\n this.currentPage = 0;\r\n }\r\n\r\n // Ensure PageSize is included in PageSizeOptions if not already present\r\n if (!this.PageSizeOptions.includes(this.PageSize)) {\r\n this.PageSizeOptions = [...this.PageSizeOptions, this.PageSize].sort((a, b) => a - b);\r\n }\r\n }\r\n\r\n /**\r\n * Handles changes to the component's input properties during the lifecycle of the component.\r\n *\r\n * This method is triggered whenever an input property bound to the component changes. It processes\r\n * updates to properties such as `Data`, `PageSize`, `PageSizeOptions`, and `currentPage`, and\r\n * ensures the internal state is kept in sync with the new inputs. Additionally, it updates the paginator\r\n * and adjusts the current page as necessary.\r\n *\r\n * @param {SimpleChanges} changes - A collection of SimpleChange objects representing the changed properties.\r\n * Each `SimpleChange` object provides information like the current and previous values as well as a flag\r\n * indicating if it is the first change to this input.\r\n * @return {void} - This method does not return any value.\r\n */\r\n ngOnChanges(changes: SimpleChanges): void {\r\n // Listen for changes in the external Data input\r\n if (changes['Data'] && !changes['Data'].firstChange) {\r\n this.syncDataSources();\r\n // Reset to first page when data changes\r\n this.currentPage = 0;\r\n }\r\n\r\n // Handle changes in pagination settings\r\n if (changes['PageSize'] || changes['PageSizeOptions'] || changes['currentPage']) {\r\n this.initializePaginator();\r\n\r\n // Validate current page doesn't exceed available pages\r\n const totalPages = Math.ceil(this.TableData.length / this.PageSize);\r\n if (this.currentPage >= totalPages && totalPages > 0) {\r\n this.currentPage = totalPages - 1;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves a subset of data from the full dataset based on the current page and page size.\r\n *\r\n * @return {Array} A portion of the TableData array corresponding to the current page.\r\n */\r\n getPaginatedData(): Array<any> {\r\n const startIndex = this.currentPage * this.PageSize;\r\n const endIndex = startIndex + this.PageSize;\r\n return this.TableData.slice(startIndex, endIndex);\r\n }\r\n\r\n /**\r\n * Handles changes in the pagination state, such as changing the current page or the page size.\r\n *\r\n * @param {PageEvent} event - The event triggered by a pagination action that contains the updated page index and page size.\r\n * @return {void} This method does not return anything.\r\n */\r\n pageChange(event: PageEvent): void {\r\n this.currentPage = event.pageIndex;\r\n this.PageSize = event.pageSize;\r\n }\r\n\r\n /**\r\n * Calculates the actual index in the dataset based on the paginated index.\r\n *\r\n * @param {number} paginatedIndex - The index within the current page of paginated data.\r\n * @return {number} The actual index in the entire dataset.\r\n */\r\n getActualIndex(paginatedIndex: number): number {\r\n return (this.currentPage * this.PageSize) + paginatedIndex;\r\n }\r\n\r\n /**\r\n * Synchronizes external data source with the internal TableData.\r\n * If the external Data differs from the current TableData, the TableData\r\n * is updated with the values from Data and a change notification is triggered.\r\n *\r\n * @return {void} This method does not return a value.\r\n */\r\n syncDataSources(): void {\r\n // If external Data is provided and differs from TableData, update TableData\r\n if (this.Data && this.Data.length > 0) {\r\n // Check if Data and TableData are different\r\n const dataString = JSON.stringify(this.Data);\r\n const tableDataString = JSON.stringify(this.TableData);\r\n\r\n if (dataString !== tableDataString) {\r\n this.TableData = [...this.Data];\r\n // console.log(\"Changed Data : \" + this.Data);\r\n // Notify the form about the change\r\n this.onChange(this.TableData);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Updates the form value by notifying changes and updating external data if available.\r\n * This method triggers the onChange callback with the current table data\r\n * and notifies that the form field has been touched. Additionally, it updates\r\n * the external data reference to ensure proper change detection in the parent components.\r\n *\r\n * @return {void} No return value.\r\n */\r\n updateFormValue(): void {\r\n // Notify the form about the change\r\n if (this.onChange) {\r\n this.onChange(this.TableData);\r\n this.onTouched();\r\n }\r\n\r\n // Also update the external Data if it exists\r\n if (this.Data) {\r\n // Create a new reference to trigger OnChanges in parent components\r\n this.Data = [...this.TableData];\r\n }\r\n }\r\n\r\n /**\r\n * Calculates and sets the grid template for a layout based on the number of displayed headers\r\n * and the presence of an action column. The grid template determines the column structure with\r\n * equal fractions for data columns and a fixed width for the action column if enabled.\r\n *\r\n * @return {void} Does not return a value. Sets the `gridTemplateColumns` property to the calculated template.\r\n */\r\n calculateGridTemplate(): void {\r\n // Calculate grid template based on columns count\r\n const displayedHeaders = this.getDisplayedHeaders();\r\n const columnsCount = displayedHeaders.length;\r\n\r\n if (columnsCount === 0) return;\r\n\r\n // Create grid template with equal fractions for data columns\r\n // and fixed width for action column if enabled\r\n if (this.EnableActionColumn) {\r\n const dataColumns = columnsCount - 1; // Subtract action column\r\n this.gridTemplateColumns = dataColumns > 0\r\n ? `repeat(${dataColumns}, 1fr) 100px`\r\n : '100px';\r\n } else {\r\n this.gridTemplateColumns = `repeat(${columnsCount}, 1fr)`;\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves the headers that should be displayed in the table.\r\n * The method includes or excludes the \"action\" column based on the value of `EnableActionColumn`.\r\n *\r\n * @return {TableProp[]} An array of headers to be displayed in the table. If `EnableActionColumn` is false, the \"action\" column is excluded.\r\n */\r\n getDisplayedHeaders(): Headers[] {\r\n return this.EnableActionColumn\r\n ? this.TableHeaders\r\n : this.TableHeaders.filter(h => h.label.toLowerCase() !== 'action');\r\n }\r\n\r\n /**\r\n * Generates and returns an object representing CSS classes for a header based on its alignment property.\r\n *\r\n * @param {TableProp} header - An object containing header properties, including an alignment property ('center', 'right', or 'left').\r\n * @return {Object} An object mapping class names to a boolean indicating their applicability based on the alignment of the header.\r\n */\r\n getHeaderFieldClasses(header: Headers): object {\r\n return {\r\n 'header-text-center': header.align === 'center',\r\n 'header-text-right': header.align === 'right',\r\n 'header-text-left': header.align === 'left',\r\n };\r\n }\r\n\r\n /**\r\n * Generates a mapping of CSS classes for a data field based on the alignment property of the given column.\r\n *\r\n * @param {Columns} column - The column object containing alignment information.\r\n * @return {Object} An object where the keys are class names, and the values are booleans indicating whether each class applies.\r\n */\r\n getDataFieldClasses(column: Columns): object {\r\n return {\r\n 'text-center': column.align === 'center',\r\n 'text-right': column.align === 'right',\r\n 'text-left': column.align === 'left',\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves the color property from the given column object.\r\n *\r\n * @param {Columns} column - The column object containing the color property.\r\n * @return {string} The color associated with the column.\r\n */\r\n getDataFiledColor(column: Columns): any {\r\n return column.color;\r\n }\r\n\r\n /**\r\n * Retrieves the value of a specified column from the given item.\r\n *\r\n * @param {any} item - The object containing the data to extract the value from.\r\n * @param {Columns} column - The column definition, including the field name or path.\r\n * @return {string} The value of the specified column for the given item. If the field is not found, an empty string is returned.\r\n */\r\n getValueForColumn(item: any, column: Columns): string {\r\n if (!item || !column || !column.field) return '';\r\n\r\n // Check if the field has dot notation (e.g., 'gender.name')\r\n if (column.field.includes('.')) {\r\n return this.getNestedValue(item, column.field);\r\n } else {\r\n // Handle standard fields\r\n return column.field in item ? item[column.field] : '';\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves a nested value from a given object based on a dot-separated path string.\r\n * If the path does not exist or the value is undefined/null, it returns a placeholder '-'.\r\n * If accessing an array, it maps the values at the given key and processes them.\r\n *\r\n * @param {any} object - The object from which the nested value is extracted.\r\n * @param {string} path - The dot-separated string representing the path to the desired value.\r\n * @return {any} The value found at the given path, an array joined into a string, or '-' if not found.\r\n */\r\n getNestedValue(object: any, path: string): any {\r\n // Return early if object is null or undefined\r\n if (!object) return '-';\r\n\r\n // Split the path into individual keys (e.g., \"gender.name\" → [\"gender\", \"name\"])\r\n const keys = path.split('.');\r\n let value = object;\r\n\r\n // Navigate through the object hierarchy\r\n for (const key of keys) {\r\n if (value === null || value === undefined) {\r\n return '-';\r\n }\r\n\r\n if (Array.isArray(value)) {\r\n // If we encounter an array, map over its items to extract the property\r\n value = value.map(item => item[key]).filter(Boolean);\r\n } else {\r\n // Access the next property level\r\n value = value[key];\r\n }\r\n }\r\n\r\n // Format the final result\r\n if (Array.isArray(value)) {\r\n return value.length > 0 ? value.join(', ') : '-';\r\n }\r\n\r\n return value !== null && value !== undefined ? value : '-';\r\n }\r\n\r\n /**\r\n * Removes an item from the data table at the specified index.\r\n *\r\n * @param {number} actualIndex - The index of the item to remove from the data table.\r\n * @return {void} This method does not return a value.\r\n */\r\n removeItem(actualIndex: number): void {\r\n // Check disable condition FIRST - before touching any data\r\n if (this.DisableRemove) {\r\n // Don't remove from TableData, just emit event for parent to handle\r\n this.onItemRemoved.emit({\r\n index: actualIndex,\r\n dataSize: this.TableData.length,\r\n removedItem: this.TableData[actualIndex], // Get the item that would be removed\r\n disabled: true\r\n });\r\n return; // Exit early - don't modify TableData\r\n } else {\r\n // Only proceed with actual removal if not disabled\r\n const newData = [...this.TableData];\r\n const removedData = newData[actualIndex]; // Get the item being removed\r\n newData.splice(actualIndex, 1);\r\n this.TableData = newData;\r\n\r\n // Rest of your existing logic...\r\n const totalPages = Math.ceil(this.TableData.length / this.PageSize);\r\n if (this.currentPage >= totalPages && this.currentPage > 0) {\r\n this.currentPage = totalPages - 1;\r\n }\r\n\r\n if (this.TableData.length === 0) {\r\n this.onChange([removedData]);\r\n } else {\r\n this.updateFormValue();\r\n }\r\n\r\n this.onItemRemoved.emit({\r\n index: actualIndex,\r\n dataSize: this.TableData.length,\r\n removedItem: removedData,\r\n disabled: false\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Modifies an item at the specified index in the dataset. If the modification is disabled, emits an event without making any changes.\r\n *\r\n * @param {number} actualIndex - The index of the item to be modified in the dataset.\r\n * @return {void} This method does not return a value.\r\n */\r\n modifyItem(actualIndex: number): void {\r\n // Check disable condition FIRST - before any modification logic\r\n if (this.DisableModify) {\r\n // Emit event for parent to handle the disabled state\r\n this.onModify.emit({\r\n index: actualIndex,\r\n modifiedItem: this.TableData[actualIndex],\r\n disabled: true\r\n });\r\n return; // Exit early - don't proceed with modification\r\n }\r\n\r\n // Only proceed with modification if not disabled\r\n const modifiedItem = this.TableData[actualIndex];\r\n this.onModify.emit({\r\n index: actualIndex,\r\n modifiedItem,\r\n disabled: false\r\n });\r\n }\r\n\r\n // ControlValueAccessor interface implementation\r\n /**\r\n * Registers a callback function to be called whenever the value changes.\r\n *\r\n * @param {any} fn - The function to be executed on a value change.\r\n * @return {void} This method does not return a value.\r\n */\r\n registerOnChange(fn: any): void {\r\n this.onChange = fn;\r\n }\r\n\r\n /**\r\n * Registers a callback function that should be called when the control is touched.\r\n *\r\n * @param {any} fn - The callback function to execute when the control is touched.\r\n * @return {void} This method does not return a value.\r\n */\r\n registerOnTouched(fn: any): void {\r\n this.onTouched = fn;\r\n }\r\n\r\n /**\r\n * Writes a new value to the table data and resets to the first page.\r\n *\r\n * @param {any[]} value - The array of data to be written to the table.\r\n * @return {void} Does not return a value.\r\n */\r\n writeValue(value: any[]): void {\r\n if (value) {\r\n this.TableData = [...value];\r\n // Reset to first page when new data is written\r\n this.currentPage = 0;\r\n } else {\r\n this.TableData = [];\r\n this.currentPage = 0;\r\n }\r\n }\r\n\r\n}\r\n","@if (TableData.length > 0) {\r\n <div class=\"item-header-row\" [ngStyle]=\"{'grid-template-columns': gridTemplateColumns}\">\r\n @for (header of getDisplayedHeaders(); track $index) {\r\n <strong [ngClass]=\"getHeaderFieldClasses(header)\">\r\n {{ header.label }}\r\n </strong>\r\n }\r\n </div>\r\n\r\n <!-- Display only the paginated items -->\r\n @for (item of getPaginatedData(); track $index) {\r\n <mat-card>\r\n <mat-card-content>\r\n <div class=\"item-details\">\r\n <div class=\"item-row\" [ngStyle]=\"{'grid-template-columns': gridTemplateColumns}\">\r\n @for (column of TableColumns; track column) {\r\n <span [ngClass]=\"getDataFieldClasses(column)\"\r\n [ngStyle]=\"{ color: getDataFiledColor(column) }\"\r\n >{{ getValueForColumn(item, column) }}</span>\r\n }\r\n @if (EnableActionColumn) {\r\n <div class=\"action-buttons\">\r\n @if (EnableButtonModify) {\r\n <button\r\n class=\"item-action-edit\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"modifyItem(getActualIndex($index))\">\r\n <mat-icon style=\"color:#ffffff;\">edit</mat-icon>\r\n </button>\r\n }\r\n @if (EnableButtonDelete) {\r\n <button\r\n class=\"item-action-delete\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeItem(getActualIndex($index))\">\r\n <mat-icon style=\"color:#ffffff;\">delete</mat-icon>\r\n </button>\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </mat-card-content>\r\n </mat-card>\r\n }\r\n\r\n <!-- Move paginator outside the loop -->\r\n <div class=\"paginator-container\">\r\n <mat-paginator\r\n [pageSize]=\"PageSize\"\r\n [length]=\"TableData.length\"\r\n [pageSizeOptions]=\"PageSizeOptions\"\r\n [pageIndex]=\"currentPage\"\r\n (page)=\"pageChange($event)\"\r\n showFirstLastButtons>\r\n </mat-paginator>\r\n </div>\r\n}\r\n","/*\r\n * Public API Surface of data-table\r\n */\r\n\r\nexport * from './lib/av-data-table';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MA+Ba,WAAW,CAAA;IAEb,QAAQ,GAAW,CAAC;IACpB,eAAe,GAAkB,EAAE;IACnC,WAAW,GAAW,CAAC;IACvB,YAAY,GAAc,EAAE;IAC5B,YAAY,GAAc,EAAE;IAC3B,SAAS,GAAU,EAAE;IACtB,IAAI,GAAU,EAAE;IAChB,kBAAkB,GAAY,KAAK;IACnC,kBAAkB,GAAY,KAAK;IACnC,kBAAkB,GAAY,KAAK;AAClC,IAAA,QAAQ,GAAG,IAAI,YAAY,EAA2D;AACtF,IAAA,cAAc,GAAG,IAAI,YAAY,EAAuD;AACxF,IAAA,aAAa,GAAG,IAAI,YAAY,EAA0E;IAC3G,aAAa,GAAY,KAAK;IAC9B,aAAa,GAAY,KAAK;IACvC,mBAAmB,GAAW,EAAE;AACxB,IAAA,QAAQ,GAAyB,MAAK,GAAG;AACzC,IAAA,SAAS,GAAe,MAAK,GAAG;AAExC,IAAA,WAAA,GAAA;;AAIA;;;;;;;;;;AAU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