@mackin.com/styleguide 9.9.1 → 9.10.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.
package/index.d.ts CHANGED
@@ -440,6 +440,51 @@ interface OmniLinkProps extends LinkProps {
440
440
  }
441
441
  declare const OmniLink: (props: OmniLinkProps) => JSX.Element;
442
442
 
443
+ interface PagedResultDto<T> {
444
+ total: number;
445
+ /** The zero-based page index. */
446
+ page: number;
447
+ limit: number;
448
+ items: T[];
449
+ }
450
+
451
+ /** A page of data with helpers props. */
452
+ declare class PagedResult<T> {
453
+ constructor(items?: T[], total?: number, page?: number, limit?: number);
454
+ /** @deprecated Use fromPagedResultDto going forward. */
455
+ static fromDto<T>(dto: {
456
+ [key: string]: any;
457
+ }): PagedResult<T>;
458
+ static fromPagedResultDto<TDto, TDomain>(dto: PagedResultDto<TDto>, convert?: (dto: TDto) => TDomain): PagedResult<TDomain>;
459
+ total: number;
460
+ /** The zero-based page index. */
461
+ page: number;
462
+ limit: number;
463
+ items: T[];
464
+ /** Helper for items.length */
465
+ get length(): number;
466
+ get hasItems(): boolean;
467
+ get previousPage(): number;
468
+ get hasPrevious(): boolean;
469
+ get nextPage(): number;
470
+ get hasNext(): boolean;
471
+ get lastPage(): number;
472
+ get totalPages(): number;
473
+ get minPageItemIndex(): number;
474
+ get maxPageItemIndex(): number;
475
+ /** Returns the first item on the current page. */
476
+ get firstPageItem(): T;
477
+ /** Returns the last item on the current page */
478
+ get lastPageItem(): T;
479
+ getPageRelativeItemIndex(item: T): number;
480
+ getResultRelativeItemIndex(item: T): number | undefined;
481
+ getPreviousItem(fromItem: T): T | undefined;
482
+ getNextItem(fromItem: T): T | undefined;
483
+ getPagingRange(radius: number): number[];
484
+ toJSON(): PagedResultDto<T>;
485
+ clone(newItems?: T[]): PagedResult<T>;
486
+ }
487
+
443
488
  declare type SortDirection = 'asc' | 'desc';
444
489
  interface PagerSortOption<TItem> {
445
490
  id: string;
@@ -492,6 +537,8 @@ declare class ItemPager<TItem> {
492
537
  * @param sortId The ID or partial ID (no '-asc' or '-desc') of a sort option created through addToggleSortOption
493
538
  */
494
539
  toggleSort(sortId: string): void;
540
+ /** Filters the current results by the filtering function ONCE.
541
+ * You will need to re-add the filter if the contents of the filtering function changes. */
495
542
  applyFilter(filter?: (item: TItem) => boolean, keepPage?: boolean): void;
496
543
  next(): void;
497
544
  previous(): void;
@@ -501,6 +548,8 @@ declare class ItemPager<TItem> {
501
548
  /** Removes the matched item(s). */
502
549
  remove(comparer: (item: TItem) => boolean, keepPage?: boolean): void;
503
550
  replace(newItem: TItem, comparer: (item: TItem) => boolean): void;
551
+ /** Returns a clone of the underlying PagedResult. */
552
+ toPagedResult(): PagedResult<TItem>;
504
553
  private _allItems;
505
554
  private _page;
506
555
  private _limit;
@@ -572,51 +621,6 @@ interface Props<T> extends PagerStyleProps {
572
621
  }
573
622
  declare const BoundStaticPager: <T>(p: Props<T>) => JSX.Element;
574
623
 
575
- interface PagedResultDto<T> {
576
- total: number;
577
- /** The zero-based page index. */
578
- page: number;
579
- limit: number;
580
- items: T[];
581
- }
582
-
583
- /** A page of data with helpers props. */
584
- declare class PagedResult<T> {
585
- constructor(items?: T[], total?: number, page?: number, limit?: number);
586
- /** @deprecated Use fromPagedResultDto going forward. */
587
- static fromDto<T>(dto: {
588
- [key: string]: any;
589
- }): PagedResult<T>;
590
- static fromPagedResultDto<TDto, TDomain>(dto: PagedResultDto<TDto>, convert?: (dto: TDto) => TDomain): PagedResult<TDomain>;
591
- total: number;
592
- /** The zero-based page index. */
593
- page: number;
594
- limit: number;
595
- items: T[];
596
- /** Helper for items.length */
597
- get length(): number;
598
- get hasItems(): boolean;
599
- get previousPage(): number;
600
- get hasPrevious(): boolean;
601
- get nextPage(): number;
602
- get hasNext(): boolean;
603
- get lastPage(): number;
604
- get totalPages(): number;
605
- get minPageItemIndex(): number;
606
- get maxPageItemIndex(): number;
607
- /** Returns the first item on the current page. */
608
- get firstPageItem(): T;
609
- /** Returns the last item on the current page */
610
- get lastPageItem(): T;
611
- getPageRelativeItemIndex(item: T): number;
612
- getResultRelativeItemIndex(item: T): number | undefined;
613
- getPreviousItem(fromItem: T): T | undefined;
614
- getNextItem(fromItem: T): T | undefined;
615
- getPagingRange(radius: number): number[];
616
- toJSON(): PagedResultDto<T>;
617
- clone(newItems?: T[]): PagedResult<T>;
618
- }
619
-
620
624
  declare type PickerValue = string | number;
621
625
  declare type PickerOption<T> = T | {
622
626
  id: T;
package/index.esm.js CHANGED
@@ -3481,6 +3481,8 @@ class ItemPager {
3481
3481
  }
3482
3482
  this.sort = nextSort;
3483
3483
  }
3484
+ /** Filters the current results by the filtering function ONCE.
3485
+ * You will need to re-add the filter if the contents of the filtering function changes. */
3484
3486
  applyFilter(filter, keepPage) {
3485
3487
  this._currentFilter = filter;
3486
3488
  if (!this._currentFilter) {
@@ -3541,6 +3543,10 @@ class ItemPager {
3541
3543
  });
3542
3544
  this.applyFilter(this._currentFilter, true);
3543
3545
  }
3546
+ /** Returns a clone of the underlying PagedResult. */
3547
+ toPagedResult() {
3548
+ return this.createPageResult();
3549
+ }
3544
3550
  createPageResult() {
3545
3551
  const page = new PagedResult([], this._filteredItems.length, this.page, this.limit);
3546
3552
  page.items = this._filteredItems.slice(page.minPageItemIndex, page.maxPageItemIndex + 1) || [];
package/index.js CHANGED
@@ -3508,6 +3508,8 @@ class ItemPager {
3508
3508
  }
3509
3509
  this.sort = nextSort;
3510
3510
  }
3511
+ /** Filters the current results by the filtering function ONCE.
3512
+ * You will need to re-add the filter if the contents of the filtering function changes. */
3511
3513
  applyFilter(filter, keepPage) {
3512
3514
  this._currentFilter = filter;
3513
3515
  if (!this._currentFilter) {
@@ -3568,6 +3570,10 @@ class ItemPager {
3568
3570
  });
3569
3571
  this.applyFilter(this._currentFilter, true);
3570
3572
  }
3573
+ /** Returns a clone of the underlying PagedResult. */
3574
+ toPagedResult() {
3575
+ return this.createPageResult();
3576
+ }
3571
3577
  createPageResult() {
3572
3578
  const page = new PagedResult([], this._filteredItems.length, this.page, this.limit);
3573
3579
  page.items = this._filteredItems.slice(page.minPageItemIndex, page.maxPageItemIndex + 1) || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "9.9.1",
3
+ "version": "9.10.0",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "module": "./index.esm.js",