@eternalcodestudio/primeng-table 20.0.7 → 20.0.9
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/index.d.ts
CHANGED
|
@@ -5,15 +5,56 @@ import { Observable } from 'rxjs';
|
|
|
5
5
|
import { HttpResponse, HttpHeaders } from '@angular/common/http';
|
|
6
6
|
import { SortMeta, MenuItem } from 'primeng/api';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Abstract service for handling HTTP requests for **ECS Primeng table**.
|
|
10
|
+
*
|
|
11
|
+
* Provides a consistent interface for making GET and POST requests to the backend.
|
|
12
|
+
* Implementations must define how requests are executed, including error handling,
|
|
13
|
+
* headers, and response processing.
|
|
14
|
+
*/
|
|
8
15
|
declare abstract class ECSPrimengTableHttpService {
|
|
16
|
+
/**
|
|
17
|
+
* Performs a GET request to the specified service endpoint.
|
|
18
|
+
*
|
|
19
|
+
* @template T The expected response type.
|
|
20
|
+
* @param servicePoint The endpoint URL or path for the GET request.
|
|
21
|
+
* @param responseType Optional. The type of response expected, either `'json'` (default) or `'blob'`.
|
|
22
|
+
* @returns An Observable of `HttpResponse<T>`, containing the full HTTP response.
|
|
23
|
+
*/
|
|
9
24
|
abstract handleHttpGetRequest<T>(servicePoint: string, responseType?: 'json' | 'blob'): Observable<HttpResponse<T>>;
|
|
25
|
+
/**
|
|
26
|
+
* Performs a POST request to the specified service endpoint.
|
|
27
|
+
*
|
|
28
|
+
* @template T The expected response type.
|
|
29
|
+
* @param servicePoint The endpoint URL or path for the POST request.
|
|
30
|
+
* @param data The payload to send in the POST request body.
|
|
31
|
+
* @param httpOptions Optional HTTP headers to include in the request.
|
|
32
|
+
* @param responseType Optional. The type of response expected, either `'json'` (default) or `'blob'`.
|
|
33
|
+
* @returns An Observable of `HttpResponse<T>`, containing the full HTTP response.
|
|
34
|
+
*/
|
|
10
35
|
abstract handleHttpPostRequest<T>(servicePoint: string, data: any, httpOptions?: HttpHeaders | null, responseType?: 'json' | 'blob'): Observable<HttpResponse<T>>;
|
|
11
36
|
static ɵfac: i0.ɵɵFactoryDeclaration<ECSPrimengTableHttpService, never>;
|
|
12
37
|
static ɵprov: i0.ɵɵInjectableDeclaration<ECSPrimengTableHttpService>;
|
|
13
38
|
}
|
|
14
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Abstract service for handling notifications in **ECS Primeng table**.
|
|
42
|
+
*
|
|
43
|
+
* Provides a consistent interface for displaying and clearing toast notifications.
|
|
44
|
+
* Implementations must define how the notifications are managed.
|
|
45
|
+
*/
|
|
15
46
|
declare abstract class ECSPrimengTableNotificationService {
|
|
47
|
+
/**
|
|
48
|
+
* Displays a toast notification.
|
|
49
|
+
*
|
|
50
|
+
* @param severity The severity level of the notification (e.g., 'success', 'info', 'warn', 'error').
|
|
51
|
+
* @param title The title of the toast message.
|
|
52
|
+
* @param message The detailed message of the toast.
|
|
53
|
+
*/
|
|
16
54
|
abstract showToast(severity: string, title: string, message: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Clears all currently displayed toast notifications.
|
|
57
|
+
*/
|
|
17
58
|
abstract clearToasts(): void;
|
|
18
59
|
static ɵfac: i0.ɵɵFactoryDeclaration<ECSPrimengTableNotificationService, never>;
|
|
19
60
|
static ɵprov: i0.ɵɵInjectableDeclaration<ECSPrimengTableNotificationService>;
|
|
@@ -86,21 +127,12 @@ interface ITableButton {
|
|
|
86
127
|
tooltip?: string;
|
|
87
128
|
}
|
|
88
129
|
|
|
89
|
-
/**
|
|
90
|
-
* Interface representing the request structure for PrimeNG post requests.
|
|
91
|
-
*/
|
|
92
130
|
interface ITableQueryRequest {
|
|
93
|
-
/** Gets or sets the current page number.*/
|
|
94
131
|
page: number;
|
|
95
|
-
/** Gets or sets the number of items to display per page.*/
|
|
96
132
|
pageSize: number;
|
|
97
|
-
/** Gets or sets a list of sorting configurations for the table.*/
|
|
98
133
|
sort?: any;
|
|
99
|
-
/** Gets or sets a dictionary containing filter configurations for each column.*/
|
|
100
134
|
filter: any;
|
|
101
|
-
/** Gets or sets a global filter string applied to all columns.*/
|
|
102
135
|
globalFilter?: string | null;
|
|
103
|
-
/** Gets or sets a list of columns to be included in the response.*/
|
|
104
136
|
columns?: string[];
|
|
105
137
|
dateFormat: string;
|
|
106
138
|
dateTimezone: string;
|
|
@@ -366,11 +398,39 @@ interface ITableOptions {
|
|
|
366
398
|
* @default []
|
|
367
399
|
*/
|
|
368
400
|
data?: any[];
|
|
401
|
+
/**
|
|
402
|
+
* Configurations related to options that are at the header of the table.
|
|
403
|
+
*/
|
|
369
404
|
header?: {
|
|
405
|
+
/**
|
|
406
|
+
* A collection of `ITableButton` to be shown in the table header.
|
|
407
|
+
*
|
|
408
|
+
* @default []
|
|
409
|
+
*/
|
|
370
410
|
buttons?: ITableButton[];
|
|
411
|
+
/**
|
|
412
|
+
* When set to `false`, the **clear sorts** button will be hidden.
|
|
413
|
+
*
|
|
414
|
+
* @default true
|
|
415
|
+
*/
|
|
371
416
|
clearSortsEnabled?: boolean;
|
|
417
|
+
/**
|
|
418
|
+
* Allows customization of the **clear sorts** button icon. You may use any other icons from PrimeNG or third-party providers such as Material Icons or Font Awesome.
|
|
419
|
+
*
|
|
420
|
+
* @default "pi pi-sort-alt-slash"
|
|
421
|
+
*/
|
|
372
422
|
clearSortsIcon?: string;
|
|
423
|
+
/**
|
|
424
|
+
* When set to `false`, the **clear filters** button will be hidden.
|
|
425
|
+
*
|
|
426
|
+
* @default true
|
|
427
|
+
*/
|
|
373
428
|
clearFiltersEnabled?: boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Allows customization of the **clear filters** button icon. Other icons from PrimeNG or third-party libraries (e.g., Material Icons, Font Awesome) may also be used.
|
|
431
|
+
*
|
|
432
|
+
* @default "pi pi-filter-slash"
|
|
433
|
+
*/
|
|
374
434
|
clearFiltersIcon?: string;
|
|
375
435
|
};
|
|
376
436
|
/**
|
|
@@ -391,6 +451,12 @@ interface ITableOptions {
|
|
|
391
451
|
* @default true
|
|
392
452
|
*/
|
|
393
453
|
selectorEnabled?: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* Can be used to specifiy a different icon to be used by the column selector.
|
|
456
|
+
* You can replace it with any icon from PrimeNG or other libraries such as Font Awesome or Material Icons.
|
|
457
|
+
*
|
|
458
|
+
* @default "pi pi-pen-to-square"
|
|
459
|
+
*/
|
|
394
460
|
selectorIcon?: string;
|
|
395
461
|
/**
|
|
396
462
|
* The combination of non-selectable columns and user-selected columns
|
|
@@ -404,30 +470,151 @@ interface ITableOptions {
|
|
|
404
470
|
* Configurations related to the rows of the table.
|
|
405
471
|
*/
|
|
406
472
|
rows?: {
|
|
473
|
+
/**
|
|
474
|
+
* Function to dynamically assign CSS classes to a row.
|
|
475
|
+
*
|
|
476
|
+
* Receives the `rowData` object for the current row and returns:
|
|
477
|
+
* - A string with a single CSS class name
|
|
478
|
+
* - An array of class names
|
|
479
|
+
* - A Set of class names
|
|
480
|
+
* - An object with class keys and truthy/falsy values
|
|
481
|
+
*
|
|
482
|
+
* The returned classes are applied to the row in addition to any global or default styles.
|
|
483
|
+
* Useful for changing appearance of a row based on column values.
|
|
484
|
+
*
|
|
485
|
+
* Example:
|
|
486
|
+
* ```ts
|
|
487
|
+
* class: (rowData) => {
|
|
488
|
+
* const classes = [];
|
|
489
|
+
* if (rowData.status === "Unemployed") classes.push("unemployedRow");
|
|
490
|
+
* return classes;
|
|
491
|
+
* }
|
|
492
|
+
* ```
|
|
493
|
+
*/
|
|
407
494
|
class?: (rowData: any) => string | string[] | Set<string> | {
|
|
408
495
|
[klass: string]: any;
|
|
409
496
|
};
|
|
497
|
+
/**
|
|
498
|
+
* Function to dynamically assign inline styles to a row.
|
|
499
|
+
*
|
|
500
|
+
* Receives the `rowData` object for the current row and returns an object
|
|
501
|
+
* with CSS properties to apply inline. This allows dynamic styling based
|
|
502
|
+
* on the row's content or values.
|
|
503
|
+
*
|
|
504
|
+
* If not provided, no dynamic styles are applied.
|
|
505
|
+
*
|
|
506
|
+
* Example:
|
|
507
|
+
* ```ts
|
|
508
|
+
* style: (rowData) => {
|
|
509
|
+
* if (rowData.status === "Full-time") {
|
|
510
|
+
* return { fontWeight: "bold", fontStyle: "italic" };
|
|
511
|
+
* }
|
|
512
|
+
* return {};
|
|
513
|
+
* }
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
410
516
|
style?: (rowData: any) => {
|
|
411
517
|
[klass: string]: any;
|
|
412
518
|
};
|
|
519
|
+
/**
|
|
520
|
+
* Configurations related to the action column for the rows.
|
|
521
|
+
*/
|
|
413
522
|
action?: {
|
|
523
|
+
/**
|
|
524
|
+
* A collection of `ITableButton` to be shown by this column to perform actions over rows. At least one button needs to be enable the row actions column.
|
|
525
|
+
*
|
|
526
|
+
* @default []
|
|
527
|
+
*/
|
|
414
528
|
buttons?: ITableButton[];
|
|
529
|
+
/**
|
|
530
|
+
* The header label for the row actions column.
|
|
531
|
+
*
|
|
532
|
+
* @default "Actions"
|
|
533
|
+
*/
|
|
415
534
|
header?: string;
|
|
535
|
+
/**
|
|
536
|
+
* If `true`, the column will appear on the right side of the table. Otherwise, it will appear on the left.
|
|
537
|
+
*
|
|
538
|
+
* @default true
|
|
539
|
+
*/
|
|
416
540
|
alignmentRight?: boolean;
|
|
541
|
+
/**
|
|
542
|
+
* The fixed column width in pixels.
|
|
543
|
+
*
|
|
544
|
+
* @default 150
|
|
545
|
+
*/
|
|
417
546
|
width?: number;
|
|
547
|
+
/**
|
|
548
|
+
* If `true`, the column remains visible when horizontally scrolling the table.
|
|
549
|
+
*
|
|
550
|
+
* @default true
|
|
551
|
+
*/
|
|
418
552
|
frozen?: boolean;
|
|
553
|
+
/**
|
|
554
|
+
* If `true`, users can resize the column.
|
|
555
|
+
*
|
|
556
|
+
* @default false
|
|
557
|
+
*/
|
|
419
558
|
resizable?: boolean;
|
|
420
559
|
};
|
|
560
|
+
/**
|
|
561
|
+
* Configurations related to the row checkbox selector.
|
|
562
|
+
*/
|
|
421
563
|
checkboxSelector?: {
|
|
564
|
+
/**
|
|
565
|
+
* If `true`, a new column with checkboxes will be displayed. Users can select or unselect rows using these checkboxes. Additionally an option to filter by this column will be enabled.
|
|
566
|
+
*
|
|
567
|
+
* @default false
|
|
568
|
+
*/
|
|
422
569
|
enabled?: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* The header label for the checkbox selection column.
|
|
572
|
+
*
|
|
573
|
+
* @default "Selected"
|
|
574
|
+
*/
|
|
423
575
|
header?: string;
|
|
576
|
+
/**
|
|
577
|
+
* If `true`, the column will appear on the right side of the table. Otherwise, it will appear on the left.
|
|
578
|
+
*
|
|
579
|
+
* @default false
|
|
580
|
+
*/
|
|
424
581
|
alignmentRight?: boolean;
|
|
582
|
+
/**
|
|
583
|
+
* The fixed column width in pixels.
|
|
584
|
+
*
|
|
585
|
+
* @default 150
|
|
586
|
+
*/
|
|
425
587
|
width?: number;
|
|
588
|
+
/**
|
|
589
|
+
* If `true`, the column remains visible when horizontally scrolling the table.
|
|
590
|
+
*
|
|
591
|
+
* @default true
|
|
592
|
+
*/
|
|
426
593
|
frozen?: boolean;
|
|
594
|
+
/**
|
|
595
|
+
* If `true`, users can resize the column.
|
|
596
|
+
*
|
|
597
|
+
* @default false
|
|
598
|
+
*/
|
|
427
599
|
resizable?: boolean;
|
|
428
600
|
};
|
|
601
|
+
/**
|
|
602
|
+
* Configurations related to the single row selector.
|
|
603
|
+
*/
|
|
429
604
|
singleSelector?: {
|
|
605
|
+
/**
|
|
606
|
+
* If set to `true`, users can click a row to select it. You can then subscribe to selection events to execute custom actions.
|
|
607
|
+
*
|
|
608
|
+
* @default false
|
|
609
|
+
*/
|
|
430
610
|
enabled?: boolean;
|
|
611
|
+
/**
|
|
612
|
+
* When `true`, users must hold **CTRL** and click on a selected row to unselect it. When `false`, users can unselect a row simply by clicking it again.
|
|
613
|
+
*
|
|
614
|
+
* On mobile devices (phones or tablets), the **CTRL** key configuration is ignored. Users can unselect a previously selected row by simply clicking it, as mobile devices do not have a **CTRL** key.
|
|
615
|
+
*
|
|
616
|
+
* @default true
|
|
617
|
+
*/
|
|
431
618
|
metakey?: boolean;
|
|
432
619
|
};
|
|
433
620
|
};
|
|
@@ -439,14 +626,17 @@ interface ITableOptions {
|
|
|
439
626
|
* When set to `true`, the table will calculate the maximum height dynamically
|
|
440
627
|
* so that it exactly fits its container. This takes precedence over the `height` property.
|
|
441
628
|
*
|
|
629
|
+
* Ignored if a `cssFormula` has been provided.
|
|
630
|
+
*
|
|
442
631
|
* @default true
|
|
443
632
|
*/
|
|
444
633
|
fitToContainer?: boolean;
|
|
445
634
|
/**
|
|
446
635
|
* Fixed vertical height for the table when `fitToContainer` is `false`.
|
|
447
636
|
*
|
|
637
|
+
* - If a `cssFormula` has been provided, this property is ignored.
|
|
448
638
|
* - If `fitToContainer` from `verticalScroll` is `true`, this property is ignored.
|
|
449
|
-
* - If set to a value `<= 0`, this is ignored
|
|
639
|
+
* - If set to a value `<= 0`, this is ignored.
|
|
450
640
|
*
|
|
451
641
|
* Use this property to enable vertical scrolling with a fixed height when you do not want
|
|
452
642
|
* the table to dynamically fit its container.
|
|
@@ -454,6 +644,15 @@ interface ITableOptions {
|
|
|
454
644
|
* @default 0
|
|
455
645
|
*/
|
|
456
646
|
height?: number;
|
|
647
|
+
/**
|
|
648
|
+
* A CSS string used to define the table's vertical height.
|
|
649
|
+
*
|
|
650
|
+
* Can be a fixed value (e.g., `"500px"`) or a CSS formula (e.g., `"calc(100vh - 200px)"`).
|
|
651
|
+
* When provided, this value **overrides** both `fitToContainer` and `height`.
|
|
652
|
+
*
|
|
653
|
+
* @default undefined
|
|
654
|
+
*/
|
|
655
|
+
cssFormula?: string;
|
|
457
656
|
};
|
|
458
657
|
/** Configurations related to the global filter functionality of the table. */
|
|
459
658
|
globalFilter?: {
|
|
@@ -475,6 +674,15 @@ interface ITableOptions {
|
|
|
475
674
|
*/
|
|
476
675
|
maxLength?: number;
|
|
477
676
|
};
|
|
677
|
+
/**
|
|
678
|
+
* Predefined filters for table columns.
|
|
679
|
+
*
|
|
680
|
+
* Restricts filter options to a known set of values for a column.
|
|
681
|
+
* Suitable for columns with a limited number of distinct values.
|
|
682
|
+
* Supports plain text, tags, icons, and images. Works with `list` data types.
|
|
683
|
+
*
|
|
684
|
+
* @default {}
|
|
685
|
+
*/
|
|
478
686
|
predefinedFilters?: {
|
|
479
687
|
[key: string]: IPredefinedFilter[];
|
|
480
688
|
};
|
|
@@ -561,21 +769,19 @@ interface ITableOptions {
|
|
|
561
769
|
*/
|
|
562
770
|
titleAllowUserEdit?: boolean;
|
|
563
771
|
};
|
|
772
|
+
/**
|
|
773
|
+
* Defines the number of seconds the user must hold the mouse button on a cell before its content is copied to the clipboard. Set to a value <= 0 to turn off this feature entirely
|
|
774
|
+
*
|
|
775
|
+
* @default 0.5
|
|
776
|
+
*/
|
|
564
777
|
copyToClipboardTime?: number;
|
|
565
778
|
}
|
|
566
779
|
declare const DEFAULT_TABLE_OPTIONS: ITableOptions;
|
|
567
780
|
|
|
568
|
-
/**
|
|
569
|
-
* Interface representing the return structure for PrimeNG post requests when gathering data to represent in a table.
|
|
570
|
-
*/
|
|
571
781
|
interface ITablePagedResponse {
|
|
572
|
-
/** The current page number.*/
|
|
573
782
|
page: number;
|
|
574
|
-
/** Total number of records available from filter.*/
|
|
575
783
|
totalRecords: number;
|
|
576
|
-
/** Total number of records available (without filters).*/
|
|
577
784
|
totalRecordsNotFiltered: number;
|
|
578
|
-
/** Dynamic data representing the response content of data for the table.*/
|
|
579
785
|
data: any;
|
|
580
786
|
}
|
|
581
787
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eternalcodestudio/primeng-table",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.9",
|
|
4
4
|
"description": "ECS reusable Angular PrimeNG table component with advanced server-side filters. Designed to offload filtering logic to any backend API.",
|
|
5
5
|
"author": "ECS (Eternal CODE Studio)",
|
|
6
6
|
"license": "MIT",
|