mn-angular-lib 1.0.3 → 1.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mn-angular-lib",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3"
@@ -1848,7 +1848,7 @@ interface TableDataSource<T> {
1848
1848
  searchPlaceholder?: string;
1849
1849
  isInSearch?: (row: T, searchValue: string) => boolean;
1850
1850
  searchForAdditionalItems?: (searchValue: string) => Promise<T[]>;
1851
- paginationMode?: 'none' | 'load-more' | 'paginated' | 'infinite-scroll';
1851
+ paginationMode?: 'none' | 'load-more' | 'paginated' | 'client-side-pagination' | 'infinite-scroll';
1852
1852
  paginationStrategy?: PaginationStrategy;
1853
1853
  loadAdditionalRows?: () => Promise<T[]>;
1854
1854
  /** Number of rows per page when paginationMode is 'paginated'. Defaults to 10. */
@@ -1857,6 +1857,28 @@ interface TableDataSource<T> {
1857
1857
  pageSizeOptions?: number[];
1858
1858
  /** Callback invoked when the user changes the page size via the dropdown. */
1859
1859
  onPageSizeChange?: (newSize: number) => void;
1860
+ /**
1861
+ * Total number of items on the server.
1862
+ * When set, pagination and infinite-scroll use this instead of filteredItems.length.
1863
+ */
1864
+ totalItems?: number;
1865
+ /**
1866
+ * Callback invoked when the user navigates to a different page.
1867
+ * When provided, the table delegates pagination to the consumer (server-side).
1868
+ * The consumer is responsible for fetching the new page data and updating dataRows.
1869
+ */
1870
+ onPageChange?: (page: number) => void;
1871
+ /**
1872
+ * Callback invoked when the user types in the search box (server-side search).
1873
+ * When provided, the table skips client-side filtering and delegates to the consumer.
1874
+ */
1875
+ onServerSearch?: (searchValue: string) => void;
1876
+ /**
1877
+ * Callback invoked when the user scrolls to the bottom in infinite-scroll mode.
1878
+ * When provided, the table delegates loading more rows to the consumer (server-side).
1879
+ * The consumer is responsible for appending new data to dataRows.
1880
+ */
1881
+ onLoadMore?: () => void;
1860
1882
  defaultSort?: SortState;
1861
1883
  selectionMode?: 'none' | 'single' | 'multi';
1862
1884
  selectedRows?: BehaviorSubject<T[]>;
@@ -3163,9 +3185,9 @@ declare class MnTable<T = any> implements OnInit, OnDestroy, DoCheck {
3163
3185
  * by Angular's default change detection (e.g. toolbarTemplate).
3164
3186
  */
3165
3187
  ngDoCheck(): void;
3166
- ngOnInit(): void;
3188
+ get showLoadMore(): boolean;
3167
3189
  ngOnDestroy(): void;
3168
- onSearch(searchString: string): void;
3190
+ get isPaginated(): boolean;
3169
3191
  /** Whether any column has filtering enabled. */
3170
3192
  get hasColumnFilters(): boolean;
3171
3193
  /** Updates a column filter value and re-applies filtering. */
@@ -3180,10 +3202,16 @@ declare class MnTable<T = any> implements OnInit, OnDestroy, DoCheck {
3180
3202
  get hasSelection(): boolean;
3181
3203
  get isMultiSelect(): boolean;
3182
3204
  onRowClick(row: T): void;
3183
- loadMoreRows(): void;
3184
- get showLoadMore(): boolean;
3185
- get isPaginated(): boolean;
3205
+ /** Whether the table delegates pagination to the consumer (server-side). */
3206
+ get isServerPaginated(): boolean;
3207
+ /** Whether the table delegates search to the consumer (server-side). */
3208
+ get isServerSearched(): boolean;
3209
+ /** Total number of items, accounting for server-side pagination. */
3210
+ get totalItemCount(): number;
3186
3211
  get totalPages(): number;
3212
+ ngOnInit(): void;
3213
+ onSearch(searchString: string): void;
3214
+ loadMoreRows(): void;
3187
3215
  get resolvedPageSizeOptions(): number[];
3188
3216
  goToPage(page: number): void;
3189
3217
  onPageSizeChange(newSize: number): void;
@@ -3199,6 +3227,7 @@ declare class MnTable<T = any> implements OnInit, OnDestroy, DoCheck {
3199
3227
  private applyFilterAndSort;
3200
3228
  private applySorting;
3201
3229
  private processLoadedRows;
3230
+ private validateDataSource;
3202
3231
  private emitSelection;
3203
3232
  static ɵfac: i0.ɵɵFactoryDeclaration<MnTable<any>, never>;
3204
3233
  static ɵcmp: i0.ɵɵComponentDeclaration<MnTable<any>, "mn-table", never, { "dataSource": { "alias": "dataSource"; "required": false; }; }, { "sortChange": "sortChange"; "selectionChange": "selectionChange"; "rowClick": "rowClick"; }, never, never, true, never>;
@@ -3247,13 +3276,35 @@ interface ListDataSource<T> {
3247
3276
  searchPlaceholder?: string;
3248
3277
  isInSearch?: (row: T, searchValue: string) => boolean;
3249
3278
  searchForAdditionalItems?: (searchValue: string) => Promise<T[]>;
3250
- paginationMode?: 'none' | 'load-more' | 'paginated' | 'infinite-scroll';
3279
+ paginationMode?: 'none' | 'load-more' | 'paginated' | 'client-side-pagination' | 'infinite-scroll';
3251
3280
  paginationStrategy?: PaginationStrategy;
3252
3281
  loadAdditionalRows?: () => Promise<T[]>;
3253
3282
  /** Number of items per page when paginationMode is 'paginated'. Defaults to 10. */
3254
3283
  pageSize?: number;
3255
3284
  /** Options for the page-size selector dropdown. Defaults to [5, 10, 25, 50]. */
3256
3285
  pageSizeOptions?: number[];
3286
+ /** Callback invoked when the user changes the page size via the dropdown. */
3287
+ onPageSizeChange?: (newSize: number) => void;
3288
+ /**
3289
+ * Total number of items on the server.
3290
+ * When set, pagination and infinite-scroll use this instead of filteredItems.length.
3291
+ */
3292
+ totalItems?: number;
3293
+ /**
3294
+ * Callback invoked when the user navigates to a different page.
3295
+ * When provided, the list delegates pagination to the consumer (server-side).
3296
+ */
3297
+ onPageChange?: (page: number) => void;
3298
+ /**
3299
+ * Callback invoked when the user types in the search box (server-side search).
3300
+ * When provided, the list skips client-side filtering and delegates to the consumer.
3301
+ */
3302
+ onServerSearch?: (searchValue: string) => void;
3303
+ /**
3304
+ * Callback invoked when the user scrolls to the bottom in infinite-scroll mode.
3305
+ * When provided, the list delegates loading more rows to the consumer (server-side).
3306
+ */
3307
+ onLoadMore?: () => void;
3257
3308
  selectionMode?: 'none' | 'single' | 'multi';
3258
3309
  selectedRows?: BehaviorSubject<T[]>;
3259
3310
  /** IDs to pre-select when the list initializes. */
@@ -3286,9 +3337,9 @@ declare class MnList<T = any> implements OnInit, OnDestroy, DoCheck {
3286
3337
  /** Tracks the previous toolbar template reference for change detection. */
3287
3338
  private previousToolbarTemplate?;
3288
3339
  ngDoCheck(): void;
3289
- ngOnInit(): void;
3340
+ get showLoadMore(): boolean;
3290
3341
  ngOnDestroy(): void;
3291
- onSearch(searchString: string): void;
3342
+ get isPaginated(): boolean;
3292
3343
  isSelected(item: T): boolean;
3293
3344
  toggleItem(item: T): void;
3294
3345
  toggleAll(): void;
@@ -3296,10 +3347,14 @@ declare class MnList<T = any> implements OnInit, OnDestroy, DoCheck {
3296
3347
  get hasSelection(): boolean;
3297
3348
  get isMultiSelect(): boolean;
3298
3349
  onItemClick(item: T): void;
3299
- loadMoreRows(): void;
3300
- get showLoadMore(): boolean;
3301
- get isPaginated(): boolean;
3350
+ /** Whether the list is in server-side paginated mode (always true when paginated or load-more). */
3351
+ get isServerPaginated(): boolean;
3352
+ /** Total number of items, accounting for server-side pagination. */
3353
+ get totalItemCount(): number;
3302
3354
  get totalPages(): number;
3355
+ ngOnInit(): void;
3356
+ onSearch(searchString: string): void;
3357
+ loadMoreRows(): void;
3303
3358
  get resolvedPageSizeOptions(): number[];
3304
3359
  goToPage(page: number): void;
3305
3360
  onPageSizeChange(newSize: number): void;
@@ -3309,6 +3364,7 @@ declare class MnList<T = any> implements OnInit, OnDestroy, DoCheck {
3309
3364
  private applyPagination;
3310
3365
  private applyFilter;
3311
3366
  private processLoadedRows;
3367
+ private validateDataSource;
3312
3368
  private emitSelection;
3313
3369
  static ɵfac: i0.ɵɵFactoryDeclaration<MnList<any>, never>;
3314
3370
  static ɵcmp: i0.ɵɵComponentDeclaration<MnList<any>, "mn-list", never, { "dataSource": { "alias": "dataSource"; "required": false; }; }, { "selectionChange": "selectionChange"; "itemClick": "itemClick"; }, never, never, true, never>;