@cedx/ui 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,4 +61,37 @@ export type PaginationOptions = Partial<{
|
|
|
61
61
|
*/
|
|
62
62
|
totalItemCount: number;
|
|
63
63
|
}>;
|
|
64
|
+
/**
|
|
65
|
+
* A list with information relevant to the pagination of its items.
|
|
66
|
+
*/
|
|
67
|
+
export declare class PaginatedList<T> extends Array<T> {
|
|
68
|
+
/**
|
|
69
|
+
* The information relevant to the pagination of list items.
|
|
70
|
+
*/
|
|
71
|
+
pagination: Pagination;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new paginated list.
|
|
74
|
+
* @param options An object providing values to initialize this instance.
|
|
75
|
+
*/
|
|
76
|
+
constructor(options?: PaginatedListOptions<T>);
|
|
77
|
+
/**
|
|
78
|
+
* Creates an empty paginated list.
|
|
79
|
+
* @param itemsPerPage The number of items per page.
|
|
80
|
+
* @returns An empty paginated list with the specified number of items per page.
|
|
81
|
+
*/
|
|
82
|
+
static empty<T>(itemsPerPage: number): PaginatedList<T>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Defines the options of a {@link PaginatedList} instance.
|
|
86
|
+
*/
|
|
87
|
+
export type PaginatedListOptions<T> = Partial<{
|
|
88
|
+
/**
|
|
89
|
+
* The list items.
|
|
90
|
+
*/
|
|
91
|
+
items: T[];
|
|
92
|
+
/**
|
|
93
|
+
* The information relevant to the pagination of list items.
|
|
94
|
+
*/
|
|
95
|
+
pagination: Pagination;
|
|
96
|
+
}>;
|
|
64
97
|
//# sourceMappingURL=Pagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../Sources/Client/Pagination.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,UAAU;;IAiBtB;;;OAGG;gBACS,OAAO,GAAE,iBAAsB;IAM3C;;O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AM,CAE1B;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;IACD,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,EAE/B;CACD;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;IAEvC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEH;;GAEG;AACH,qBAAa,aAAa,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IAE7C;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;;OAGG;gBACS,OAAO,GAAE,oBAAoB,CAAC,CAAC,CAAM;IAMjD;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC;CAGvD;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,OAAO,CAAC;IAE7C;;OAEG;IACH,KAAK,EAAE,CAAC,EAAE,CAAC;IAEX;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;CACvB,CAAC,CAAC"}
|
|
@@ -81,3 +81,30 @@ export class Pagination {
|
|
|
81
81
|
this.#totalItemCount = Math.max(0, value);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* A list with information relevant to the pagination of its items.
|
|
86
|
+
*/
|
|
87
|
+
export class PaginatedList extends Array {
|
|
88
|
+
/**
|
|
89
|
+
* The information relevant to the pagination of list items.
|
|
90
|
+
*/
|
|
91
|
+
pagination;
|
|
92
|
+
/**
|
|
93
|
+
* Creates a new paginated list.
|
|
94
|
+
* @param options An object providing values to initialize this instance.
|
|
95
|
+
*/
|
|
96
|
+
constructor(options = {}) {
|
|
97
|
+
super();
|
|
98
|
+
for (const item of options.items ?? [])
|
|
99
|
+
this.push(item);
|
|
100
|
+
this.pagination = options.pagination ?? new Pagination;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Creates an empty paginated list.
|
|
104
|
+
* @param itemsPerPage The number of items per page.
|
|
105
|
+
* @returns An empty paginated list with the specified number of items per page.
|
|
106
|
+
*/
|
|
107
|
+
static empty(itemsPerPage) {
|
|
108
|
+
return new this({ pagination: new Pagination({ itemsPerPage }) });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -114,3 +114,49 @@ export type PaginationOptions = Partial<{
|
|
|
114
114
|
*/
|
|
115
115
|
totalItemCount: number;
|
|
116
116
|
}>;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A list with information relevant to the pagination of its items.
|
|
120
|
+
*/
|
|
121
|
+
export class PaginatedList<T> extends Array<T> {
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The information relevant to the pagination of list items.
|
|
125
|
+
*/
|
|
126
|
+
pagination: Pagination;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Creates a new paginated list.
|
|
130
|
+
* @param options An object providing values to initialize this instance.
|
|
131
|
+
*/
|
|
132
|
+
constructor(options: PaginatedListOptions<T> = {}) {
|
|
133
|
+
super();
|
|
134
|
+
for (const item of options.items ?? []) this.push(item);
|
|
135
|
+
this.pagination = options.pagination ?? new Pagination;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Creates an empty paginated list.
|
|
140
|
+
* @param itemsPerPage The number of items per page.
|
|
141
|
+
* @returns An empty paginated list with the specified number of items per page.
|
|
142
|
+
*/
|
|
143
|
+
static empty<T>(itemsPerPage: number): PaginatedList<T> {
|
|
144
|
+
return new this({pagination: new Pagination({itemsPerPage})});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Defines the options of a {@link PaginatedList} instance.
|
|
150
|
+
*/
|
|
151
|
+
export type PaginatedListOptions<T> = Partial<{
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The list items.
|
|
155
|
+
*/
|
|
156
|
+
items: T[];
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The information relevant to the pagination of list items.
|
|
160
|
+
*/
|
|
161
|
+
pagination: Pagination;
|
|
162
|
+
}>;
|