@angular-generic-table/core 5.0.0-rc.15 → 5.0.0-rc.17
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/esm2020/lib/core.component.mjs +167 -57
- package/esm2020/lib/core.module.mjs +4 -4
- package/esm2020/lib/core.service.mjs +3 -3
- package/esm2020/lib/gt-delta/gt-delta.component.mjs +13 -13
- package/esm2020/lib/models/gt-pagination.mjs +1 -1
- package/esm2020/lib/models/table-config.interface.mjs +1 -1
- package/esm2020/lib/models/table-events.interface.mjs +1 -1
- package/esm2020/lib/models/table-info.interface.mjs +1 -1
- package/esm2020/lib/models/table-sort.interface.mjs +1 -1
- package/esm2020/lib/pagination/pagination.component.mjs +88 -29
- package/esm2020/lib/pagination/pagination.module.mjs +4 -4
- package/esm2020/lib/pipes/capital-case.pipe.mjs +3 -3
- package/esm2020/lib/pipes/dash-case.pipe.mjs +3 -3
- package/esm2020/lib/pipes/dynamic.pipe.mjs +3 -3
- package/esm2020/lib/pipes/highlight.pipe.mjs +3 -3
- package/esm2020/lib/pipes/sort-class.pipe.mjs +29 -12
- package/esm2020/lib/utilities/utilities.mjs +58 -1
- package/esm2020/public-api.mjs +8 -1
- package/fesm2015/angular-generic-table-core.mjs +371 -137
- package/fesm2015/angular-generic-table-core.mjs.map +1 -1
- package/fesm2020/angular-generic-table-core.mjs +372 -134
- package/fesm2020/angular-generic-table-core.mjs.map +1 -1
- package/lib/core.component.d.ts +31 -11
- package/lib/gt-delta/gt-delta.component.d.ts +1 -1
- package/lib/models/gt-pagination.d.ts +8 -0
- package/lib/models/table-column.interface.d.ts +1 -1
- package/lib/models/table-config.interface.d.ts +6 -2
- package/lib/models/table-events.interface.d.ts +11 -0
- package/lib/models/table-info.interface.d.ts +3 -1
- package/lib/models/table-sort.interface.d.ts +6 -4
- package/lib/pagination/pagination.component.d.ts +49 -11
- package/lib/pipes/sort-class.pipe.d.ts +2 -5
- package/lib/utilities/utilities.d.ts +26 -0
- package/package.json +3 -3
- package/public-api.d.ts +7 -0
- package/scss/index.scss +26 -4
- package/esm2020/lib/enums/order.enum.mjs +0 -6
- package/lib/enums/order.enum.d.ts +0 -4
|
@@ -1,24 +1,62 @@
|
|
|
1
|
-
import { ReplaySubject } from 'rxjs';
|
|
2
1
|
import { CoreComponent } from '../core.component';
|
|
3
|
-
import { GtPaginationAriaLabels, GtPaginationClasses } from '../models/gt-pagination';
|
|
2
|
+
import { GtPaginationAriaLabels, GtPaginationClasses, GtPaginationInfo } from '../models/gt-pagination';
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
4
|
export declare class PaginationComponent {
|
|
5
|
+
get pagingInfo(): GtPaginationInfo;
|
|
6
|
+
/** pagingInfo
|
|
7
|
+
* @description when provided, pagination component will use this information to render pagination instead of data from table. Use this option when pagination is handled by backend (server side).
|
|
8
|
+
* @type info - metadata for pagination component
|
|
9
|
+
*/
|
|
10
|
+
set pagingInfo(info: GtPaginationInfo);
|
|
6
11
|
get paginationLength(): number;
|
|
7
|
-
|
|
12
|
+
/** paginationLength
|
|
13
|
+
* @description number of buttons to show in pagination
|
|
14
|
+
* @type length - number of buttons to show. Defaults to: `5`
|
|
15
|
+
*/
|
|
16
|
+
set paginationLength(length: number);
|
|
8
17
|
get classes(): GtPaginationClasses;
|
|
9
|
-
|
|
18
|
+
/** classes
|
|
19
|
+
* @description classes that should be used within pagination component for different elements
|
|
20
|
+
* @type classes - classes to be used. Defaults to: `{
|
|
21
|
+
* ul: 'pagination',
|
|
22
|
+
* li: 'page-item',
|
|
23
|
+
* button: 'page-link',
|
|
24
|
+
* }`
|
|
25
|
+
*/
|
|
26
|
+
set classes(classes: GtPaginationClasses);
|
|
10
27
|
get ariaLabels(): GtPaginationAriaLabels;
|
|
11
|
-
|
|
28
|
+
/** ariaLabels
|
|
29
|
+
* @description aria labels that describe pagination component
|
|
30
|
+
* @type labels - aria labels for pagination. Defaults to: `{
|
|
31
|
+
* nav: 'Table pagination',
|
|
32
|
+
* button: 'Go to page ',
|
|
33
|
+
* }`
|
|
34
|
+
*/
|
|
35
|
+
set ariaLabels(labels: GtPaginationAriaLabels);
|
|
12
36
|
get table(): CoreComponent;
|
|
13
|
-
|
|
14
|
-
|
|
37
|
+
/** table
|
|
38
|
+
* @description table component to which pagination is attached
|
|
39
|
+
* @type tableRef - table component
|
|
40
|
+
*/
|
|
41
|
+
set table(tableRef: CoreComponent);
|
|
42
|
+
private _pagingInfo;
|
|
43
|
+
private _table$;
|
|
15
44
|
private _table;
|
|
16
45
|
private _ariaLabels;
|
|
17
46
|
private _classes;
|
|
18
47
|
private _paginationLength;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
48
|
+
/** paginationListItems$ - observable for page numbers to show based on number of pages and current position */
|
|
49
|
+
paginationListItems$: import("rxjs").Observable<number[]>;
|
|
50
|
+
/** generate list - generate an array with page numbers to show based on number of pages and current position
|
|
51
|
+
* @param numberOfPages number of pages to show
|
|
52
|
+
* @param currentPosition current position (page index) being shown in table
|
|
53
|
+
* @returns Array<number> array of page numbers to show
|
|
54
|
+
*/
|
|
55
|
+
private _generateList;
|
|
56
|
+
/** go to page
|
|
57
|
+
* @param index - page index to go to
|
|
58
|
+
*/
|
|
59
|
+
goToPage(index: number): void;
|
|
22
60
|
static ɵfac: i0.ɵɵFactoryDeclaration<PaginationComponent, never>;
|
|
23
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PaginationComponent, "angular-generic-table-pagination", never, { "paginationLength": "paginationLength"; "classes": "classes"; "ariaLabels": "ariaLabels"; "table": "table"; }, {}, never, never, true>;
|
|
61
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PaginationComponent, "angular-generic-table-pagination", never, { "pagingInfo": "pagingInfo"; "paginationLength": "paginationLength"; "classes": "classes"; "ariaLabels": "ariaLabels"; "table": "table"; }, {}, never, never, true, never>;
|
|
24
62
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { GtSortOrder } from '../models/table-sort.interface';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class SortClassPipe implements PipeTransform {
|
|
5
|
-
transform(
|
|
6
|
-
sortBy: string;
|
|
7
|
-
sortByOrder: Order;
|
|
8
|
-
} | any, property: string, aria?: boolean): string | null;
|
|
5
|
+
transform(sortOrder: GtSortOrder | null, key: string, context?: 'class' | 'aria' | 'order'): string | null;
|
|
9
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<SortClassPipe, never>;
|
|
10
7
|
static ɵpipe: i0.ɵɵPipeDeclaration<SortClassPipe, "sortClass", true>;
|
|
11
8
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TableRow } from '../models/table-row.interface';
|
|
2
2
|
import { TableConfig } from '../models/table-config.interface';
|
|
3
|
+
import { GtSortConfig, GtSortOrder } from '../models/table-sort.interface';
|
|
4
|
+
import { GtSortEvent } from '../models/table-events.interface';
|
|
3
5
|
export declare let dashed: (s: string) => string;
|
|
4
6
|
export declare let capitalize: (s: string) => string;
|
|
5
7
|
export declare let chunk: (array: Array<any>, chunkSize: number) => Array<Array<TableRow>>;
|
|
@@ -9,3 +11,27 @@ export declare let calculate: (data: Array<TableRow>, config: TableConfig) => {
|
|
|
9
11
|
calculations: string[];
|
|
10
12
|
calculatedColumnsCount: number;
|
|
11
13
|
};
|
|
14
|
+
/** sortOnMultipleKeys
|
|
15
|
+
* @description Sort data on multiple keys
|
|
16
|
+
* @param {GtSortOrder} keys - array with sort config objects to sort on, data will be sorted according to array order
|
|
17
|
+
* @returns sort function
|
|
18
|
+
*/
|
|
19
|
+
export declare const sortOnMultipleKeys: (keys: GtSortOrder<TableRow>) => (a: TableRow, b: TableRow) => number;
|
|
20
|
+
/** parseSortOrderParams
|
|
21
|
+
* @description Convert sort order query param to array with sort config objects
|
|
22
|
+
* @param sortParams - Query param string where each sort config object is separated by comma and order is indicated by + (ascending) or - (descending), e.g. _'name,-age'_
|
|
23
|
+
* @returns GtSortOrder - Array with sort config objects
|
|
24
|
+
*/
|
|
25
|
+
export declare const parseSortOrderParams: (sortParams: string) => GtSortOrder<TableRow>;
|
|
26
|
+
/** sortOrderConfigToParam
|
|
27
|
+
* @description Convert sort config object to string that can be used as query param when sorting is implemented server side
|
|
28
|
+
* @param sortConfig - Sort config object
|
|
29
|
+
* @returns string - Query param string where order is indicated by + (ascending) or - (descending), e.g. _'-name'_
|
|
30
|
+
*/
|
|
31
|
+
export declare const sortOrderConfigToParam: (sortConfig: GtSortEvent | GtSortConfig) => string;
|
|
32
|
+
/** sortOrderToParams
|
|
33
|
+
* @description Convert sort order array to string that can be used as query param when sorting is implemented server side
|
|
34
|
+
* @param sortOrder - Array with sort config objects
|
|
35
|
+
* @returns string - Query param string where each sort config object is separated by comma and order is indicated by + (ascending) or - (descending), e.g. _'name,-age'_
|
|
36
|
+
*/
|
|
37
|
+
export declare const sortOrderToParams: (sortOrder: GtSortOrder<TableRow>) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-generic-table/core",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.17",
|
|
4
4
|
"author": "Robert Hjalmers <opensource@rhj.se> (http://www.linkedin.com/in/robert-hjalmers/)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"url": "https://github.com/hjalmers/angular-generic-table.git"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@angular/common": "^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
12
|
-
"@angular/core": "^12.0.0 || ^13.0.0 || ^14.0.0"
|
|
11
|
+
"@angular/common": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
12
|
+
"@angular/core": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"tslib": "^2.0.0"
|
package/public-api.d.ts
CHANGED
|
@@ -11,3 +11,10 @@ export * from './lib/models/table-row.interface';
|
|
|
11
11
|
export * from './lib/models/table-sort.interface';
|
|
12
12
|
export * from './lib/models/table-meta.interface';
|
|
13
13
|
export * from './lib/models/table-events.interface';
|
|
14
|
+
export * from './lib/models/gt-pagination';
|
|
15
|
+
export * from './lib/utilities/utilities';
|
|
16
|
+
export * from './lib/pipes/capital-case.pipe';
|
|
17
|
+
export * from './lib/pipes/dash-case.pipe';
|
|
18
|
+
export * from './lib/pipes/dynamic.pipe';
|
|
19
|
+
export * from './lib/pipes/highlight.pipe';
|
|
20
|
+
export * from './lib/pipes/sort-class.pipe';
|
package/scss/index.scss
CHANGED
|
@@ -49,8 +49,10 @@ $descending-sort-gradient: linear-gradient(0.75turn,
|
|
|
49
49
|
|
|
50
50
|
$skeleton-loader-highlight-color: var(--bs-gray-300, rgb(200,200,200)) !default;
|
|
51
51
|
$skeleton-loader-background-color: var(--bs-gray-200, rgb(240,240,240)) !default;
|
|
52
|
-
$skeleton-loader-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'
|
|
52
|
+
$skeleton-loader-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' id='a' viewBox='0 0 768 135'%3E%3Cdefs/%3E%3Cpath fill='%23FFF' d='M114 10h100v24H114V10ZM114 55h120v24H114V55ZM114 100h130v24H114v-24ZM268 10h100v24H268V10ZM268 55h80v24h-80V55ZM268 100h100v24H268v-24ZM402 10h90v24h-90V10ZM402 55h70v24h-70V55ZM402 100h80v24h-80v-24ZM516 10h90v24h-90V10ZM516 55h110v24H516V55ZM516 100h120v24H516v-24ZM660 100h74v24h-74v-24ZM660 55h64v24h-64V55ZM660 10h84v24h-84V10ZM0 100h80v24H0v-24ZM0 55h70v24H0V55ZM0 10h90v24H0V10ZM0 134h768v1H0v-1ZM0 89h768v1H0v-1ZM0 44h768v1H0v-1Z' class='b'/%3E%3C/svg%3E") !default;
|
|
53
|
+
$skeleton-loader-mask-size: 768px 135px !default;
|
|
53
54
|
|
|
55
|
+
$skeleton-height: var(--gt-skeleton-height, 169px) !default;
|
|
54
56
|
@mixin styles() {
|
|
55
57
|
@include default-style;
|
|
56
58
|
@include footer-style;
|
|
@@ -83,6 +85,14 @@ $skeleton-loader-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2
|
|
|
83
85
|
align-items: center;
|
|
84
86
|
justify-content: inherit;
|
|
85
87
|
transition: box-shadow 0.25s ease-in-out;
|
|
88
|
+
&[data-sort-order]::before {
|
|
89
|
+
content: attr(data-sort-order);
|
|
90
|
+
order: 2;
|
|
91
|
+
font-variant: diagonal-fractions;
|
|
92
|
+
font-weight: normal;
|
|
93
|
+
align-self: flex-start;
|
|
94
|
+
line-height: initial;
|
|
95
|
+
}
|
|
86
96
|
&::after {
|
|
87
97
|
content: '';
|
|
88
98
|
background: $sort-icon-color;
|
|
@@ -182,7 +192,7 @@ $skeleton-loader-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2
|
|
|
182
192
|
}
|
|
183
193
|
}
|
|
184
194
|
}
|
|
185
|
-
tbody {
|
|
195
|
+
tbody, tfoot {
|
|
186
196
|
tr {
|
|
187
197
|
display: flex;
|
|
188
198
|
flex-direction: column;
|
|
@@ -206,6 +216,17 @@ $skeleton-loader-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2
|
|
|
206
216
|
}
|
|
207
217
|
}
|
|
208
218
|
}
|
|
219
|
+
tfoot {
|
|
220
|
+
td:first-child::before {
|
|
221
|
+
font-weight: $mobile-style-header-font-weight;
|
|
222
|
+
}
|
|
223
|
+
td::before {
|
|
224
|
+
font-weight: normal;
|
|
225
|
+
}
|
|
226
|
+
td:not(:first-child).gt-no-content {
|
|
227
|
+
display: none;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
209
230
|
}
|
|
210
231
|
}
|
|
211
232
|
}
|
|
@@ -268,7 +289,7 @@ $skeleton-loader-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2
|
|
|
268
289
|
|
|
269
290
|
@mixin skeleton-loader-styles() {
|
|
270
291
|
.gt-skeleton-loader {
|
|
271
|
-
margin: 0.625rem 0;
|
|
292
|
+
margin:0 0 0.625rem 0;
|
|
272
293
|
--gt-skeleton-loader-mask: #{$skeleton-loader-mask};
|
|
273
294
|
--gt-skeleton-loader-highlight-color: #{$skeleton-loader-highlight-color};
|
|
274
295
|
--gt-skeleton-loader-bg-color: #{$skeleton-loader-background-color};
|
|
@@ -281,8 +302,9 @@ $skeleton-loader-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2
|
|
|
281
302
|
background-position: 200vw 0;
|
|
282
303
|
}
|
|
283
304
|
}
|
|
284
|
-
height:
|
|
305
|
+
height: $skeleton-height;
|
|
285
306
|
mask-image: var(--gt-skeleton-loader-mask);
|
|
307
|
+
mask-size: $skeleton-loader-mask-size;
|
|
286
308
|
background: linear-gradient(
|
|
287
309
|
280deg,
|
|
288
310
|
$skeleton-loader-background-color 12.5%,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export var Order;
|
|
2
|
-
(function (Order) {
|
|
3
|
-
Order["ASC"] = "asc";
|
|
4
|
-
Order["DESC"] = "desc";
|
|
5
|
-
})(Order || (Order = {}));
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JkZXIuZW51bS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvcmUvc3JjL2xpYi9lbnVtcy9vcmRlci5lbnVtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sQ0FBTixJQUFZLEtBR1g7QUFIRCxXQUFZLEtBQUs7SUFDZixvQkFBVyxDQUFBO0lBQ1gsc0JBQWEsQ0FBQTtBQUNmLENBQUMsRUFIVyxLQUFLLEtBQUwsS0FBSyxRQUdoQiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBlbnVtIE9yZGVyIHtcbiAgQVNDID0gJ2FzYycsXG4gIERFU0MgPSAnZGVzYycsXG59XG4iXX0=
|