@bootkit/ng0 0.0.0-alpha.50 → 0.0.0-alpha.52
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/components/pagination/index.d.ts +16 -10
- package/components/select/index.d.ts +2 -3
- package/components/table/index.d.ts +89 -83
- package/fesm2022/bootkit-ng0-components-pagination.mjs +17 -15
- package/fesm2022/bootkit-ng0-components-pagination.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-select.mjs +7 -6
- package/fesm2022/bootkit-ng0-components-select.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-table.mjs +93 -92
- package/fesm2022/bootkit-ng0-components-table.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-http.mjs +4 -4
- package/fesm2022/bootkit-ng0-http.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-icons.mjs +22 -0
- package/fesm2022/bootkit-ng0-icons.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-localization-locales.mjs +7 -1
- package/fesm2022/bootkit-ng0-localization-locales.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-localization.mjs +36 -11
- package/fesm2022/bootkit-ng0-localization.mjs.map +1 -1
- package/icons/index.d.ts +11 -0
- package/localization/index.d.ts +5 -1
- package/package.json +5 -1
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { EventEmitter } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Pagination component for displaying page numbers and navigation controls.
|
|
6
|
+
* It calculates the total number of pages based on the total records and page size,
|
|
7
|
+
* and determines which page numbers to display based on the selected page and maximum visible pages.
|
|
8
|
+
*/
|
|
4
9
|
declare class PaginationComponent {
|
|
5
10
|
/**
|
|
6
11
|
* Total number of records.
|
|
7
12
|
*/
|
|
8
|
-
readonly totalRecords: _angular_core.
|
|
13
|
+
readonly totalRecords: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
9
14
|
/**
|
|
10
15
|
* Page size. Number of items in each page.
|
|
16
|
+
* @default 10
|
|
11
17
|
*/
|
|
12
|
-
readonly pageSize: _angular_core.
|
|
18
|
+
readonly pageSize: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
13
19
|
/**
|
|
14
20
|
* Zero-based index of the selected page.
|
|
21
|
+
* @default 0
|
|
15
22
|
*/
|
|
16
|
-
readonly selectedPage: _angular_core.
|
|
23
|
+
readonly selectedPage: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
17
24
|
/**
|
|
18
25
|
* Maximum number of visible pages.
|
|
19
|
-
*
|
|
26
|
+
* @default 10
|
|
20
27
|
*/
|
|
21
|
-
readonly maxVisiblePages: _angular_core.
|
|
28
|
+
readonly maxVisiblePages: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
22
29
|
/**
|
|
23
30
|
* Show first and last buttons.
|
|
24
|
-
*
|
|
31
|
+
* @default true
|
|
25
32
|
*/
|
|
26
|
-
readonly showNextPreviousButtons: _angular_core.
|
|
33
|
+
readonly showNextPreviousButtons: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
27
34
|
/**
|
|
28
35
|
* Show first and last buttons.
|
|
29
|
-
*
|
|
36
|
+
* @default true
|
|
30
37
|
*/
|
|
31
|
-
readonly showFirstLastButtons: _angular_core.
|
|
38
|
+
readonly showFirstLastButtons: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
32
39
|
/**
|
|
33
40
|
* Total number of pages.
|
|
34
41
|
* This is a computed property based on totalRecords and pageSize.
|
|
@@ -42,7 +49,6 @@ declare class PaginationComponent {
|
|
|
42
49
|
readonly itemClick: EventEmitter<number>;
|
|
43
50
|
protected _totalPagesCount: number;
|
|
44
51
|
protected _visiblePages: _angular_core.Signal<number[]>;
|
|
45
|
-
_onPageChange(pageIndex: number): void;
|
|
46
52
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PaginationComponent, never>;
|
|
47
53
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PaginationComponent, "ng0-pagination", ["ng0Pagination"], { "totalRecords": { "alias": "totalRecords"; "required": true; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "selectedPage": { "alias": "selectedPage"; "required": false; "isSignal": true; }; "maxVisiblePages": { "alias": "maxVisiblePages"; "required": false; "isSignal": true; }; "showNextPreviousButtons": { "alias": "showNextPreviousButtons"; "required": false; "isSignal": true; }; "showFirstLastButtons": { "alias": "showFirstLastButtons"; "required": false; "isSignal": true; }; }, { "itemClick": "itemClick"; }, never, ["first", "previous", "next", "last"], true, never>;
|
|
48
54
|
}
|
|
@@ -4,7 +4,7 @@ import * as _angular_core from '@angular/core';
|
|
|
4
4
|
import { ElementRef, TemplateRef, EventEmitter } from '@angular/core';
|
|
5
5
|
import { DataSource, DataSourceLike } from '@bootkit/ng0/data';
|
|
6
6
|
import { ControlValueAccessor } from '@angular/forms';
|
|
7
|
-
import {
|
|
7
|
+
import { ScrollStrategy, ConnectedPosition } from '@angular/cdk/overlay';
|
|
8
8
|
import { ListItemSelectEvent } from '@bootkit/ng0/components/list';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -20,10 +20,9 @@ declare class SelectComponent implements ControlValueAccessor {
|
|
|
20
20
|
protected readonly _sourceItems: _angular_core.WritableSignal<any[] | undefined>;
|
|
21
21
|
protected readonly _selectedItems: Set<any>;
|
|
22
22
|
protected readonly _isDisabled: _angular_core.WritableSignal<boolean>;
|
|
23
|
-
protected _positionStrategy: FlexibleConnectedPositionStrategy;
|
|
24
23
|
protected _scrollStrategy: ScrollStrategy;
|
|
24
|
+
protected _positions: ConnectedPosition[];
|
|
25
25
|
private readonly _overlay;
|
|
26
|
-
private readonly _localizationService;
|
|
27
26
|
protected readonly _elementRef: ElementRef<any>;
|
|
28
27
|
protected readonly _filterValue: _angular_core.WritableSignal<string>;
|
|
29
28
|
private readonly _renderer;
|
|
@@ -1,56 +1,17 @@
|
|
|
1
|
+
import * as _bootkit_ng0_localization from '@bootkit/ng0/localization';
|
|
2
|
+
import { LocalizationService, TableComponentPagingFormatter } from '@bootkit/ng0/localization';
|
|
1
3
|
import * as _angular_core from '@angular/core';
|
|
2
4
|
import { OnInit, TemplateRef, AfterContentInit, OnDestroy, QueryList } from '@angular/core';
|
|
3
5
|
import { formatString } from '@bootkit/ng0/common';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
+
import { DataResult, DataSource, DataSourceLike } from '@bootkit/ng0/data';
|
|
7
|
+
import { ItemSelectEvent } from '@bootkit/ng0/components/select';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
interface TablePagingOptions {
|
|
11
|
-
/**
|
|
12
|
-
* If true, the table will show pagination controls at the bottom.
|
|
13
|
-
* This will allow users to navigate between pages of data.
|
|
14
|
-
* Default is true.
|
|
15
|
-
*/
|
|
16
|
-
showPagingControls?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Initial page index to load when the table is initialized.
|
|
19
|
-
* This is only used if pagable is true.
|
|
20
|
-
* The index starts from 1.
|
|
21
|
-
* Default is 1.
|
|
22
|
-
*/
|
|
23
|
-
pageIndex?: number;
|
|
24
|
-
pageSize?: number;
|
|
25
|
-
/**
|
|
26
|
-
* Array of page size options to display in the page size selector.
|
|
27
|
-
* If not provided, the default page size options will be used.
|
|
28
|
-
*/
|
|
29
|
-
pageSizeOptions?: number[];
|
|
30
|
-
/**
|
|
31
|
-
* If true, the table will show a page size selector.
|
|
32
|
-
*/
|
|
33
|
-
showPageSizeOptions?: boolean;
|
|
34
|
-
showPageSizeSelectorLabel?: boolean;
|
|
35
|
-
showNextPreviousButtons?: boolean;
|
|
36
|
-
showFirstLastButtons?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Maximum number of visible pages.
|
|
39
|
-
* Default is 10.
|
|
40
|
-
*/
|
|
41
|
-
maxVisiblePages?: number;
|
|
42
|
-
/**
|
|
43
|
-
* If true, the table will show paging info at the bottom.
|
|
44
|
-
* This will show the number of records displayed and total records.
|
|
45
|
-
*/
|
|
46
|
-
showPagingInfo?: boolean;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Type of the table cell.
|
|
10
|
+
* Type of the table column.
|
|
50
11
|
* This can be a primitive type like 'number', 'currency', 'date', 'time',
|
|
51
12
|
* or an object with specific formatting options.
|
|
52
13
|
*/
|
|
53
|
-
type
|
|
14
|
+
type TableColumnType = 'text' | 'number' | 'currency' | 'date' | 'time' | {
|
|
54
15
|
/** Enum formatting options */
|
|
55
16
|
enum?: {
|
|
56
17
|
/** The name of the enum to use for translation */
|
|
@@ -66,74 +27,77 @@ type TableCellType = 'text' | 'number' | 'currency' | 'date' | 'time' | {
|
|
|
66
27
|
};
|
|
67
28
|
|
|
68
29
|
declare class TableColumnDirective implements OnInit {
|
|
30
|
+
private readonly _injector;
|
|
69
31
|
/**
|
|
70
32
|
* The field in the data source to bind to. If not set, the column will not display any data.
|
|
33
|
+
* @deprecated Use formatBy input.
|
|
71
34
|
*/
|
|
72
|
-
field: _angular_core.InputSignal<string | undefined>;
|
|
35
|
+
readonly field: _angular_core.InputSignal<string | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* A fromatter to convert each item to a string for display.
|
|
38
|
+
* This can be a function, a string (field name), or an array of formatters.
|
|
39
|
+
* If not set, the default formatter will be used, which simply calls toString() on the value.
|
|
40
|
+
*/
|
|
41
|
+
readonly formatBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_localization.ObjectFormatter, _bootkit_ng0_localization.ObjectFormatterLike>;
|
|
73
42
|
/**
|
|
74
43
|
* The title of the column. This will be displayed in the header row.
|
|
75
44
|
*/
|
|
76
|
-
title: _angular_core.InputSignal<string | undefined>;
|
|
45
|
+
readonly title: _angular_core.InputSignal<string | undefined>;
|
|
77
46
|
/**
|
|
78
47
|
* Text to display in the cell if the value is null or undefined.
|
|
79
48
|
*/
|
|
80
|
-
emptyCellText: _angular_core.InputSignal<string | undefined>;
|
|
49
|
+
readonly emptyCellText: _angular_core.InputSignal<string | undefined>;
|
|
81
50
|
/**
|
|
82
51
|
* Type of the table cell.
|
|
83
52
|
*/
|
|
84
|
-
type: _angular_core.InputSignal<
|
|
53
|
+
readonly type: _angular_core.InputSignal<TableColumnType>;
|
|
85
54
|
/**
|
|
86
55
|
* CSS class(es) to apply to the table cell.
|
|
87
56
|
*/
|
|
88
|
-
cellClass: _angular_core.InputSignal<string | {
|
|
57
|
+
readonly cellClass: _angular_core.InputSignal<string | {
|
|
89
58
|
[klass: string]: any;
|
|
90
59
|
} | string[] | null | undefined>;
|
|
91
60
|
/**
|
|
92
61
|
* @deprecated Use `cellClass` instead.
|
|
93
62
|
*/
|
|
94
|
-
bold: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
63
|
+
readonly bold: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
95
64
|
/**
|
|
96
65
|
* @deprecated Use `cellClass` instead.
|
|
97
66
|
*/
|
|
98
|
-
shrink: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
67
|
+
readonly shrink: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
99
68
|
/**
|
|
100
69
|
* If true, the column will support filtering.
|
|
101
70
|
*/
|
|
102
|
-
filterable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
71
|
+
readonly filterable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
103
72
|
/**
|
|
104
73
|
* The current filter value of the column.
|
|
105
74
|
*/
|
|
106
|
-
filterValue: _angular_core.ModelSignal<any>;
|
|
107
|
-
/**
|
|
108
|
-
* The field to use for filtering. If not set, the `field` property will be used.
|
|
109
|
-
* @deprecated Use `fieldName` instead.
|
|
110
|
-
*/
|
|
111
|
-
filterField: _angular_core.InputSignal<string | undefined>;
|
|
75
|
+
readonly filterValue: _angular_core.ModelSignal<any>;
|
|
112
76
|
/**
|
|
113
77
|
* The current filter operator of the column.
|
|
114
78
|
*/
|
|
115
|
-
filterOperator: _angular_core.ModelSignal<string | undefined>;
|
|
79
|
+
readonly filterOperator: _angular_core.ModelSignal<string | undefined>;
|
|
116
80
|
/**
|
|
117
81
|
* The list of filter operators to show in the filter dropdown. If not set, a default list will be used based on the column type.
|
|
118
82
|
*/
|
|
119
|
-
filterOperators: _angular_core.InputSignal<string[] | undefined>;
|
|
83
|
+
readonly filterOperators: _angular_core.InputSignal<string[] | undefined>;
|
|
120
84
|
/**
|
|
121
85
|
* If true, the filter operators dropdown will be shown.
|
|
122
86
|
*/
|
|
123
|
-
showFilterOperators: _angular_core.WritableSignal<boolean>;
|
|
87
|
+
readonly showFilterOperators: _angular_core.WritableSignal<boolean>;
|
|
124
88
|
/**
|
|
125
89
|
* The name of the field in the data source. If not set, the `field` property will be used.
|
|
126
90
|
*/
|
|
127
|
-
fieldName: _angular_core.InputSignal<string | undefined>;
|
|
91
|
+
readonly fieldName: _angular_core.InputSignal<string | undefined>;
|
|
128
92
|
/**
|
|
129
93
|
* If true, the column will support sorting.
|
|
130
94
|
*/
|
|
131
|
-
sortable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
95
|
+
readonly sortable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
132
96
|
/**
|
|
133
97
|
* The current sort direction of the column.
|
|
134
98
|
*/
|
|
135
|
-
sortDirection: _angular_core.ModelSignal<"none" | "asc" | "desc">;
|
|
136
|
-
template?: TemplateRef<any>;
|
|
99
|
+
readonly sortDirection: _angular_core.ModelSignal<"none" | "asc" | "desc">;
|
|
100
|
+
readonly template?: TemplateRef<any>;
|
|
137
101
|
constructor();
|
|
138
102
|
ngOnInit(): void;
|
|
139
103
|
/**
|
|
@@ -146,7 +110,7 @@ declare class TableColumnDirective implements OnInit {
|
|
|
146
110
|
*/
|
|
147
111
|
toggleSortDirection(): void;
|
|
148
112
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TableColumnDirective, never>;
|
|
149
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TableColumnDirective, "ng0-table-col", never, { "field": { "alias": "field"; "required": false; "isSignal": true; }; "
|
|
113
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TableColumnDirective, "ng0-table-col", never, { "field": { "alias": "field"; "required": false; "isSignal": true; }; "formatBy": { "alias": "formatBy"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "emptyCellText": { "alias": "emptyCellText"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "cellClass": { "alias": "cellClass"; "required": false; "isSignal": true; }; "bold": { "alias": "bold"; "required": false; "isSignal": true; }; "shrink": { "alias": "shrink"; "required": false; "isSignal": true; }; "filterable": { "alias": "filterable"; "required": false; "isSignal": true; }; "filterValue": { "alias": "filterValue"; "required": false; "isSignal": true; }; "filterOperator": { "alias": "filterOperator"; "required": false; "isSignal": true; }; "filterOperators": { "alias": "filterOperators"; "required": false; "isSignal": true; }; "fieldName": { "alias": "fieldName"; "required": false; "isSignal": true; }; "sortable": { "alias": "sortable"; "required": false; "isSignal": true; }; "sortDirection": { "alias": "sortDirection"; "required": false; "isSignal": true; }; }, { "filterValue": "filterValueChange"; "filterOperator": "filterOperatorChange"; "sortDirection": "sortDirectionChange"; }, ["template"], never, true, never>;
|
|
150
114
|
}
|
|
151
115
|
|
|
152
116
|
declare class TableDetailRowDirective {
|
|
@@ -163,27 +127,24 @@ declare class TableDetailRowDirective {
|
|
|
163
127
|
* It can be used with any data source that implements the DataSource interface.
|
|
164
128
|
*/
|
|
165
129
|
declare class TableComponent implements AfterContentInit, OnDestroy {
|
|
166
|
-
protected _ls: LocalizationService;
|
|
167
|
-
private _destroyRef;
|
|
130
|
+
protected readonly _ls: LocalizationService;
|
|
131
|
+
private readonly _destroyRef;
|
|
168
132
|
private _changeSubscription?;
|
|
169
133
|
protected _columns: QueryList<TableColumnDirective>;
|
|
170
134
|
protected _detailRow?: TableDetailRowDirective;
|
|
171
|
-
protected _dataResult: _angular_core.WritableSignal<DataResult<any> | undefined>;
|
|
172
|
-
protected
|
|
173
|
-
protected _loadingRequest?: DataRequest;
|
|
135
|
+
protected readonly _dataResult: _angular_core.WritableSignal<DataResult<any> | undefined>;
|
|
136
|
+
protected readonly _error: _angular_core.WritableSignal<undefined>;
|
|
174
137
|
protected _rowStates: Map<any, {
|
|
175
138
|
expanded: boolean;
|
|
176
139
|
}>;
|
|
177
140
|
protected _formatString: typeof formatString;
|
|
178
|
-
protected _dataSource: DataSource;
|
|
179
141
|
protected _pagingFormatter: TableComponentPagingFormatter;
|
|
180
|
-
protected _lastError?: any;
|
|
181
142
|
/**
|
|
182
143
|
* The data source for the table.
|
|
183
144
|
* This can be an array of data, a function that returns an observable of data,
|
|
184
145
|
* or an instance of DataSource.
|
|
185
146
|
*/
|
|
186
|
-
readonly source: _angular_core.
|
|
147
|
+
readonly source: _angular_core.InputSignalWithTransform<DataSource<any>, DataSourceLike<any>>;
|
|
187
148
|
/**
|
|
188
149
|
* If true, the table will automatically load data when initialized.
|
|
189
150
|
* This is useful for tables that need to display data immediately without user interaction.
|
|
@@ -200,16 +161,58 @@ declare class TableComponent implements AfterContentInit, OnDestroy {
|
|
|
200
161
|
readonly showHeader: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
201
162
|
/**
|
|
202
163
|
* If true, the table will support pagination.
|
|
203
|
-
* If false, the table will load all records at once.
|
|
204
164
|
*/
|
|
205
|
-
readonly pageable: _angular_core.InputSignalWithTransform<
|
|
165
|
+
readonly pageable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
166
|
+
/**
|
|
167
|
+
* The currently selected page in the table.
|
|
168
|
+
* @default 0
|
|
169
|
+
*/
|
|
170
|
+
readonly pageIndex: _angular_core.ModelSignal<number>;
|
|
171
|
+
/**
|
|
172
|
+
* The number of records to display per page.
|
|
173
|
+
* @default 10
|
|
174
|
+
*/
|
|
175
|
+
readonly pageSize: _angular_core.ModelSignal<number>;
|
|
176
|
+
/**
|
|
177
|
+
* Maximum number of visible pages in the pagination controls.
|
|
178
|
+
* @default 10
|
|
179
|
+
*/
|
|
180
|
+
readonly maxVisiblePages: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
181
|
+
/**
|
|
182
|
+
* If true, the table will show pagination controls at the bottom.
|
|
183
|
+
* This will allow users to navigate between pages of data.
|
|
184
|
+
* @default true
|
|
185
|
+
*/
|
|
186
|
+
readonly showPagingControls: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
187
|
+
/**
|
|
188
|
+
* Whether to show the first and last buttons in the pagination controls.
|
|
189
|
+
* @default true
|
|
190
|
+
*/
|
|
191
|
+
readonly showFirstLastButtons: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
192
|
+
/**
|
|
193
|
+
* Whetheer to show the next and previous buttons in the pagination controls.
|
|
194
|
+
* @default true
|
|
195
|
+
*/
|
|
196
|
+
readonly showNextPreviousButtons: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
197
|
+
/**
|
|
198
|
+
* Array of page size options to display in the page size selector.
|
|
199
|
+
* If not provided, the default page size options will be used.
|
|
200
|
+
* @default true
|
|
201
|
+
*/
|
|
202
|
+
readonly pageSizeOptions: _angular_core.InputSignal<number[] | undefined>;
|
|
203
|
+
/**
|
|
204
|
+
* Whether to show paging info at the bottom of the table.
|
|
205
|
+
* This will show the number of records displayed and total records.
|
|
206
|
+
* @default true
|
|
207
|
+
*/
|
|
208
|
+
readonly showPagingInfo: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
206
209
|
/**
|
|
207
210
|
* If true, the table will support sorting.
|
|
208
211
|
* This will add a sort icon to each column header.
|
|
209
212
|
*/
|
|
210
213
|
readonly sortable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
211
214
|
/**
|
|
212
|
-
* The CSS class to apply to the table element.
|
|
215
|
+
* The CSS class to apply to the internal table element.
|
|
213
216
|
* This can be used to apply custom styles to the table.
|
|
214
217
|
*/
|
|
215
218
|
readonly tableClass: _angular_core.InputSignal<string | string[] | undefined>;
|
|
@@ -234,17 +237,19 @@ declare class TableComponent implements AfterContentInit, OnDestroy {
|
|
|
234
237
|
/**
|
|
235
238
|
* The indicator to show while the table is loading data for the first time.
|
|
236
239
|
*/
|
|
237
|
-
readonly loadingIndicator: _angular_core.
|
|
240
|
+
readonly loadingIndicator: _angular_core.InputSignal<"none" | "simple" | "spinner">;
|
|
238
241
|
/** If true, the table will show a loading cover while data is being loaded.
|
|
239
242
|
* This can be used to prevent user interaction with the table while loading.
|
|
240
243
|
* This cover is not displayed when the table is loading for the first time.
|
|
241
244
|
* Instead, the table will show a loading based on loadingIndicator settings.
|
|
242
245
|
*/
|
|
243
|
-
readonly loadingCover: _angular_core.
|
|
246
|
+
readonly loadingCover: _angular_core.InputSignal<"none" | "simple" | "spinner">;
|
|
244
247
|
ngAfterContentInit(): void;
|
|
245
248
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
249
|
+
* Loads data from the data source based on the current state of the table (pagination, sorting, filtering).
|
|
250
|
+
* This method can be called manually to refresh the data in the table.
|
|
251
|
+
* It will construct a DataRequest object based on the current pagination, sorting, and filtering settings,
|
|
252
|
+
* and then call the load method of the data source with that request.
|
|
248
253
|
*/
|
|
249
254
|
load(pageIndex?: number): void;
|
|
250
255
|
/**
|
|
@@ -257,9 +262,10 @@ declare class TableComponent implements AfterContentInit, OnDestroy {
|
|
|
257
262
|
protected isRowExpanded(row: any): boolean;
|
|
258
263
|
protected _onToggleFilterOperator(col: TableColumnDirective): void;
|
|
259
264
|
protected _onSelectFilterOperator(col: TableColumnDirective, filterOperator: string): void;
|
|
265
|
+
_onPageSizeOptionsItemSelect(e: ItemSelectEvent): void;
|
|
260
266
|
ngOnDestroy(): void;
|
|
261
267
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TableComponent, never>;
|
|
262
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TableComponent, "ng0-table", ["ng0Table"], { "source": { "alias": "source"; "required": true; "isSignal": true; }; "autoLoad": { "alias": "autoLoad"; "required": false; "isSignal": true; }; "showRowNumbers": { "alias": "showRowNumbers"; "required": false; "isSignal": true; }; "showHeader": { "alias": "showHeader"; "required": false; "isSignal": true; }; "pageable": { "alias": "pageable"; "required": false; "isSignal": true; }; "sortable": { "alias": "sortable"; "required": false; "isSignal": true; }; "tableClass": { "alias": "tableClass"; "required": false; "isSignal": true; }; "headerClass": { "alias": "headerClass"; "required": false; "isSignal": true; }; "caption": { "alias": "caption"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "filterable": { "alias": "filterable"; "required": false; "isSignal": true; }; "loadingIndicator": { "alias": "loadingIndicator"; "required": false; "isSignal": true; }; "loadingCover": { "alias": "loadingCover"; "required": false; "isSignal": true; }; }, {}, ["_detailRow", "_columns"], ["paging-first", "paging-last", "paging-next", "paging-previous", "paging-info"], true, never>;
|
|
268
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TableComponent, "ng0-table", ["ng0Table"], { "source": { "alias": "source"; "required": true; "isSignal": true; }; "autoLoad": { "alias": "autoLoad"; "required": false; "isSignal": true; }; "showRowNumbers": { "alias": "showRowNumbers"; "required": false; "isSignal": true; }; "showHeader": { "alias": "showHeader"; "required": false; "isSignal": true; }; "pageable": { "alias": "pageable"; "required": false; "isSignal": true; }; "pageIndex": { "alias": "pageIndex"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "maxVisiblePages": { "alias": "maxVisiblePages"; "required": false; "isSignal": true; }; "showPagingControls": { "alias": "showPagingControls"; "required": false; "isSignal": true; }; "showFirstLastButtons": { "alias": "showFirstLastButtons"; "required": false; "isSignal": true; }; "showNextPreviousButtons": { "alias": "showNextPreviousButtons"; "required": false; "isSignal": true; }; "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; "isSignal": true; }; "showPagingInfo": { "alias": "showPagingInfo"; "required": false; "isSignal": true; }; "sortable": { "alias": "sortable"; "required": false; "isSignal": true; }; "tableClass": { "alias": "tableClass"; "required": false; "isSignal": true; }; "headerClass": { "alias": "headerClass"; "required": false; "isSignal": true; }; "caption": { "alias": "caption"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "filterable": { "alias": "filterable"; "required": false; "isSignal": true; }; "loadingIndicator": { "alias": "loadingIndicator"; "required": false; "isSignal": true; }; "loadingCover": { "alias": "loadingCover"; "required": false; "isSignal": true; }; }, { "pageIndex": "pageIndexChange"; "pageSize": "pageSizeChange"; }, ["_detailRow", "_columns"], ["paging-first", "paging-last", "paging-next", "paging-previous", "paging-info"], true, never>;
|
|
263
269
|
}
|
|
264
270
|
|
|
265
271
|
declare class TableModule {
|
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { input, EventEmitter, computed, Output, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
3
|
+
import { input, numberAttribute, booleanAttribute, EventEmitter, computed, Output, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
4
4
|
import { TranslatePipe } from '@bootkit/ng0/localization';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Pagination component for displaying page numbers and navigation controls.
|
|
8
|
+
* It calculates the total number of pages based on the total records and page size,
|
|
9
|
+
* and determines which page numbers to display based on the selected page and maximum visible pages.
|
|
10
|
+
*/
|
|
6
11
|
class PaginationComponent {
|
|
7
12
|
/**
|
|
8
13
|
* Total number of records.
|
|
9
14
|
*/
|
|
10
|
-
totalRecords = input.required(...(ngDevMode ? [{ debugName: "totalRecords" }] : []));
|
|
15
|
+
totalRecords = input.required(...(ngDevMode ? [{ debugName: "totalRecords", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
11
16
|
/**
|
|
12
17
|
* Page size. Number of items in each page.
|
|
18
|
+
* @default 10
|
|
13
19
|
*/
|
|
14
|
-
pageSize = input(10, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
|
|
20
|
+
pageSize = input(10, ...(ngDevMode ? [{ debugName: "pageSize", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
15
21
|
/**
|
|
16
22
|
* Zero-based index of the selected page.
|
|
23
|
+
* @default 0
|
|
17
24
|
*/
|
|
18
|
-
selectedPage = input(0, ...(ngDevMode ? [{ debugName: "selectedPage" }] : []));
|
|
25
|
+
selectedPage = input(0, ...(ngDevMode ? [{ debugName: "selectedPage", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
19
26
|
/**
|
|
20
27
|
* Maximum number of visible pages.
|
|
21
|
-
*
|
|
28
|
+
* @default 10
|
|
22
29
|
*/
|
|
23
|
-
maxVisiblePages = input(10, ...(ngDevMode ? [{ debugName: "maxVisiblePages" }] : []));
|
|
30
|
+
maxVisiblePages = input(10, ...(ngDevMode ? [{ debugName: "maxVisiblePages", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
24
31
|
/**
|
|
25
32
|
* Show first and last buttons.
|
|
26
|
-
*
|
|
33
|
+
* @default true
|
|
27
34
|
*/
|
|
28
|
-
showNextPreviousButtons = input(true, ...(ngDevMode ? [{ debugName: "showNextPreviousButtons" }] : []));
|
|
35
|
+
showNextPreviousButtons = input(true, ...(ngDevMode ? [{ debugName: "showNextPreviousButtons", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
29
36
|
/**
|
|
30
37
|
* Show first and last buttons.
|
|
31
|
-
*
|
|
38
|
+
* @default true
|
|
32
39
|
*/
|
|
33
|
-
showFirstLastButtons = input(true, ...(ngDevMode ? [{ debugName: "showFirstLastButtons" }] : []));
|
|
40
|
+
showFirstLastButtons = input(true, ...(ngDevMode ? [{ debugName: "showFirstLastButtons", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
34
41
|
/**
|
|
35
42
|
* Total number of pages.
|
|
36
43
|
* This is a computed property based on totalRecords and pageSize.
|
|
@@ -77,11 +84,6 @@ class PaginationComponent {
|
|
|
77
84
|
}
|
|
78
85
|
return indices;
|
|
79
86
|
}, ...(ngDevMode ? [{ debugName: "_visiblePages" }] : []));
|
|
80
|
-
_onPageChange(pageIndex) {
|
|
81
|
-
debugger;
|
|
82
|
-
console.log('click');
|
|
83
|
-
this.itemClick.emit(pageIndex);
|
|
84
|
-
}
|
|
85
87
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: PaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
86
88
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", type: PaginationComponent, isStandalone: true, selector: "ng0-pagination", inputs: { totalRecords: { classPropertyName: "totalRecords", publicName: "totalRecords", isSignal: true, isRequired: true, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, selectedPage: { classPropertyName: "selectedPage", publicName: "selectedPage", isSignal: true, isRequired: false, transformFunction: null }, maxVisiblePages: { classPropertyName: "maxVisiblePages", publicName: "maxVisiblePages", isSignal: true, isRequired: false, transformFunction: null }, showNextPreviousButtons: { classPropertyName: "showNextPreviousButtons", publicName: "showNextPreviousButtons", isSignal: true, isRequired: false, transformFunction: null }, showFirstLastButtons: { classPropertyName: "showFirstLastButtons", publicName: "showFirstLastButtons", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick" }, exportAs: ["ng0Pagination"], ngImport: i0, template: "@let _selectedPage = selectedPage();\n\n<nav>\n <ul class=\"pagination\">\n @if(showFirstLastButtons() || showFirstLastButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage <= 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(1)\">\n <ng-content select=\"first\">\n {{'first' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n\n @if(showNextPreviousButtons() || showNextPreviousButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage <= 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(_selectedPage! - 1)\">\n <ng-content select=\"previous\">\n {{'previous' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n\n @for (page of _visiblePages(); track page) {\n <li class=\"page-item\" [class.active]=\"_selectedPage === page\">\n <button class=\"page-link\" (click)=\"itemClick.emit(page)\">\n {{page + 1}}\n </button>\n </li>\n }\n\n @if(showNextPreviousButtons() || showNextPreviousButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage >= _totalPagesCount - 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(_selectedPage! + 1)\">\n <ng-content select=\"next\">\n {{'next' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n\n @if(showFirstLastButtons() || showFirstLastButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage >= _totalPagesCount - 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(_totalPagesCount)\">\n <ng-content select=\"last\">\n {{'last' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n </ul>\n</nav>\n\n<style>\n .pagination {\n margin: 0;\n }\n</style>", styles: [".pagination{margin:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: TranslatePipe, name: "ng0Translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
87
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootkit-ng0-components-pagination.mjs","sources":["../../../projects/ng0/components/pagination/pagination.component.ts","../../../projects/ng0/components/pagination/pagination.component.html","../../../projects/ng0/components/pagination/pagination.module.ts","../../../projects/ng0/components/pagination/bootkit-ng0-components-pagination.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, ChangeDetectionStrategy, input, computed, Output, EventEmitter } from '@angular/core';\nimport { TranslatePipe } from '@bootkit/ng0/localization';\n\n@Component({\n selector: 'ng0-pagination',\n exportAs: 'ng0Pagination',\n templateUrl: './pagination.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n TranslatePipe\n ]\n})\nexport class PaginationComponent {\n /**\n * Total number of records.\n */\n public readonly totalRecords = input.required<number>();\n\n /**\n * Page size. Number of items in each page.\n */\n public readonly pageSize = input<number>(10);\n\n /** \n * Zero-based index of the selected page.\n */\n public readonly selectedPage = input<number>(0);\n\n /**\n * Maximum number of visible pages.\n * Default is 10.\n */\n public readonly maxVisiblePages = input<number>(10);\n\n /**\n * Show first and last buttons.\n * Default is true.\n */\n public readonly showNextPreviousButtons = input<boolean | undefined>(true);\n\n /**\n * Show first and last buttons.\n * Default is true.\n */\n public readonly showFirstLastButtons = input<boolean | undefined>(true);\n\n /**\n * Total number of pages.\n * This is a computed property based on totalRecords and pageSize.\n * It is not an input property.\n */\n public get totalPagesCount() { return this._totalPagesCount; }\n\n /** \n * Emits the selected page index when a page is clicked.\n * The index starts from 1.\n */\n @Output() public readonly itemClick = new EventEmitter<number>();\n\n protected _totalPagesCount!: number;\n\n protected _visiblePages = computed(() => {\n let selectedPage = this.selectedPage();\n let totalRecords = this.totalRecords();\n let pageSize = this.pageSize();\n\n if (!Number.isInteger(totalRecords) || totalRecords < 0) {\n throw new Error('Total items must be a posotive integer.');\n }\n\n if (!Number.isInteger(pageSize) || pageSize <= 0) {\n throw new Error('Page size must be a posotive integer.');\n }\n\n this._totalPagesCount = Math.ceil(totalRecords / pageSize);\n\n if (selectedPage < 0 || selectedPage > this._totalPagesCount) {\n throw new Error(`Selected page index must be between 0 and ${this._totalPagesCount - 1}.`);\n }\n\n let indices = [];\n let firstVisiblePage = selectedPage;\n let lastVisiblePage = firstVisiblePage;\n let maxVisiblePages = this.maxVisiblePages();\n indices.push(firstVisiblePage);\n\n for (let i = 0; i < maxVisiblePages; i++) {\n if (lastVisiblePage < this._totalPagesCount - 1) {\n lastVisiblePage++;\n indices.push(lastVisiblePage);\n }\n\n if (indices.length >= maxVisiblePages) {\n break;\n }\n\n if (firstVisiblePage > 0) {\n firstVisiblePage--;\n indices.unshift(firstVisiblePage);\n }\n }\n\n return indices;\n });\n\n public _onPageChange(pageIndex: number) {\n debugger\n console.log('click')\n this.itemClick.emit(pageIndex);\n }\n\n}\n","@let _selectedPage = selectedPage();\n\n<nav>\n <ul class=\"pagination\">\n @if(showFirstLastButtons() || showFirstLastButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage <= 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(1)\">\n <ng-content select=\"first\">\n {{'first' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n\n @if(showNextPreviousButtons() || showNextPreviousButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage <= 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(_selectedPage! - 1)\">\n <ng-content select=\"previous\">\n {{'previous' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n\n @for (page of _visiblePages(); track page) {\n <li class=\"page-item\" [class.active]=\"_selectedPage === page\">\n <button class=\"page-link\" (click)=\"itemClick.emit(page)\">\n {{page + 1}}\n </button>\n </li>\n }\n\n @if(showNextPreviousButtons() || showNextPreviousButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage >= _totalPagesCount - 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(_selectedPage! + 1)\">\n <ng-content select=\"next\">\n {{'next' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n\n @if(showFirstLastButtons() || showFirstLastButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage >= _totalPagesCount - 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(_totalPagesCount)\">\n <ng-content select=\"last\">\n {{'last' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n </ul>\n</nav>\n\n<style>\n .pagination {\n margin: 0;\n }\n</style>","import { NgModule } from '@angular/core';\nimport { PaginationComponent } from './pagination.component';\n\n@NgModule({\n imports: [\n PaginationComponent\n ],\n exports: [\n PaginationComponent\n ]\n})\nexport class PaginationModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAea,mBAAmB,CAAA;AAC9B;;AAEG;AACa,IAAA,YAAY,GAAG,KAAK,CAAC,QAAQ,uDAAU;AAEvD;;AAEG;AACa,IAAA,QAAQ,GAAG,KAAK,CAAS,EAAE,oDAAC;AAE5C;;AAEG;AACa,IAAA,YAAY,GAAG,KAAK,CAAS,CAAC,wDAAC;AAE/C;;;AAGG;AACa,IAAA,eAAe,GAAG,KAAK,CAAS,EAAE,2DAAC;AAEnD;;;AAGG;AACa,IAAA,uBAAuB,GAAG,KAAK,CAAsB,IAAI,mEAAC;AAE1E;;;AAGG;AACa,IAAA,oBAAoB,GAAG,KAAK,CAAsB,IAAI,gEAAC;AAEvE;;;;AAIG;IACH,IAAW,eAAe,KAAK,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAE7D;;;AAGG;AACuB,IAAA,SAAS,GAAG,IAAI,YAAY,EAAU;AAEtD,IAAA,gBAAgB;AAEhB,IAAA,aAAa,GAAG,QAAQ,CAAC,MAAK;AACtC,QAAA,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE;AACtC,QAAA,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE;AACtC,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE;AAE9B,QAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE;AACvD,YAAA,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC;QAC5D;AAEA,QAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE;AAChD,YAAA,MAAM,IAAI,KAAK,CAAC,uCAAuC,C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0DQ,EAAA,MAAA,EAAA,CAAA,yBAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,ED/CJ,YAAY,0BACZ,aAAa,EAAA,IAAA,EAAA,cAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAGJ,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAX/B,SAAS;+BACE,gBAAgB,EAAA,QAAA,EAChB,eAAe,EAAA,eAAA,EAER,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EAAA,OAAA,EACP;wBACP,YAAY;wBACZ;AACD,qBAAA,EAAA,QAAA,EAAA,y9DAAA,EAAA;;sBA+CA;;;MEjDU,gBAAgB,CAAA;wGAAhB,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;yGAAhB,gBAAgB,EAAA,OAAA,EAAA,CANrB,mBAAmB,CAAA,EAAA,OAAA,EAAA,CAGnB,mBAAmB,CAAA,EAAA,CAAA;AAGd,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YANrB,mBAAmB,CAAA,EAAA,CAAA;;4FAMd,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAR5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE;wBACL;AACH,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACL;AACH;AACJ,iBAAA;;;ACVD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bootkit-ng0-components-pagination.mjs","sources":["../../../projects/ng0/components/pagination/pagination.component.ts","../../../projects/ng0/components/pagination/pagination.component.html","../../../projects/ng0/components/pagination/pagination.module.ts","../../../projects/ng0/components/pagination/bootkit-ng0-components-pagination.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, ChangeDetectionStrategy, input, computed, Output, EventEmitter, booleanAttribute, numberAttribute } from '@angular/core';\nimport { TranslatePipe } from '@bootkit/ng0/localization';\n\n/**\n * Pagination component for displaying page numbers and navigation controls.\n * It calculates the total number of pages based on the total records and page size,\n * and determines which page numbers to display based on the selected page and maximum visible pages.\n */\n@Component({\n selector: 'ng0-pagination',\n exportAs: 'ng0Pagination',\n templateUrl: './pagination.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n TranslatePipe\n ]\n})\nexport class PaginationComponent {\n /**\n * Total number of records.\n */\n public readonly totalRecords = input.required({ transform: numberAttribute });\n\n /**\n * Page size. Number of items in each page.\n * @default 10\n */\n public readonly pageSize = input(10, { transform: numberAttribute });\n\n /** \n * Zero-based index of the selected page.\n * @default 0\n */\n public readonly selectedPage = input(0, { transform: numberAttribute });\n\n /**\n * Maximum number of visible pages.\n * @default 10\n */\n public readonly maxVisiblePages = input(10, { transform: numberAttribute });\n\n /**\n * Show first and last buttons.\n * @default true\n */\n public readonly showNextPreviousButtons = input(true, { transform: booleanAttribute });\n\n /**\n * Show first and last buttons.\n * @default true\n */\n public readonly showFirstLastButtons = input(true, { transform: booleanAttribute });\n\n /**\n * Total number of pages.\n * This is a computed property based on totalRecords and pageSize.\n * It is not an input property.\n */\n public get totalPagesCount() { return this._totalPagesCount; }\n\n /** \n * Emits the selected page index when a page is clicked.\n * The index starts from 1.\n */\n @Output() public readonly itemClick = new EventEmitter<number>();\n\n protected _totalPagesCount!: number;\n\n protected _visiblePages = computed(() => {\n let selectedPage = this.selectedPage();\n let totalRecords = this.totalRecords();\n let pageSize = this.pageSize();\n\n if (!Number.isInteger(totalRecords) || totalRecords < 0) {\n throw new Error('Total items must be a posotive integer.');\n }\n\n if (!Number.isInteger(pageSize) || pageSize <= 0) {\n throw new Error('Page size must be a posotive integer.');\n }\n\n this._totalPagesCount = Math.ceil(totalRecords / pageSize);\n\n if (selectedPage < 0 || selectedPage > this._totalPagesCount) {\n throw new Error(`Selected page index must be between 0 and ${this._totalPagesCount - 1}.`);\n }\n\n let indices = [];\n let firstVisiblePage = selectedPage;\n let lastVisiblePage = firstVisiblePage;\n let maxVisiblePages = this.maxVisiblePages();\n indices.push(firstVisiblePage);\n\n for (let i = 0; i < maxVisiblePages; i++) {\n if (lastVisiblePage < this._totalPagesCount - 1) {\n lastVisiblePage++;\n indices.push(lastVisiblePage);\n }\n\n if (indices.length >= maxVisiblePages) {\n break;\n }\n\n if (firstVisiblePage > 0) {\n firstVisiblePage--;\n indices.unshift(firstVisiblePage);\n }\n }\n\n return indices;\n });\n}\n","@let _selectedPage = selectedPage();\n\n<nav>\n <ul class=\"pagination\">\n @if(showFirstLastButtons() || showFirstLastButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage <= 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(1)\">\n <ng-content select=\"first\">\n {{'first' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n\n @if(showNextPreviousButtons() || showNextPreviousButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage <= 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(_selectedPage! - 1)\">\n <ng-content select=\"previous\">\n {{'previous' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n\n @for (page of _visiblePages(); track page) {\n <li class=\"page-item\" [class.active]=\"_selectedPage === page\">\n <button class=\"page-link\" (click)=\"itemClick.emit(page)\">\n {{page + 1}}\n </button>\n </li>\n }\n\n @if(showNextPreviousButtons() || showNextPreviousButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage >= _totalPagesCount - 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(_selectedPage! + 1)\">\n <ng-content select=\"next\">\n {{'next' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n\n @if(showFirstLastButtons() || showFirstLastButtons() == undefined) {\n <li class=\"page-item\" [class.disabled]=\"_selectedPage == undefined || _selectedPage >= _totalPagesCount - 1\">\n <button class=\"page-link\" (click)=\"itemClick.emit(_totalPagesCount)\">\n <ng-content select=\"last\">\n {{'last' | ng0Translate}}\n </ng-content>\n </button>\n </li>\n }\n </ul>\n</nav>\n\n<style>\n .pagination {\n margin: 0;\n }\n</style>","import { NgModule } from '@angular/core';\nimport { PaginationComponent } from './pagination.component';\n\n@NgModule({\n imports: [\n PaginationComponent\n ],\n exports: [\n PaginationComponent\n ]\n})\nexport class PaginationModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAIA;;;;AAIG;MAYU,mBAAmB,CAAA;AAC9B;;AAEG;AACa,IAAA,YAAY,GAAG,KAAK,CAAC,QAAQ,+CAAG,SAAS,EAAE,eAAe,EAAA,CAAA,GAAA,CAA5B,EAAE,SAAS,EAAE,eAAe,EAAE,GAAC;AAE7E;;;AAGG;AACa,IAAA,QAAQ,GAAG,KAAK,CAAC,EAAE,4CAAI,SAAS,EAAE,eAAe,EAAA,CAAA,GAAA,CAA5B,EAAE,SAAS,EAAE,eAAe,EAAE,GAAC;AAEpE;;;AAGG;AACa,IAAA,YAAY,GAAG,KAAK,CAAC,CAAC,gDAAI,SAAS,EAAE,eAAe,EAAA,CAAA,GAAA,CAA5B,EAAE,SAAS,EAAE,eAAe,EAAE,GAAC;AAEvE;;;AAGG;AACa,IAAA,eAAe,GAAG,KAAK,CAAC,EAAE,mDAAI,SAAS,EAAE,eAAe,EAAA,CAAA,GAAA,CAA5B,EAAE,SAAS,EAAE,eAAe,EAAE,GAAC;AAE3E;;;AAGG;AACa,IAAA,uBAAuB,GAAG,KAAK,CAAC,IAAI,2DAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAA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