@enki-tek/fms-web-components 0.1.64 → 0.1.65

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.
@@ -6,30 +6,30 @@ const dispatch = createEventDispatcher();
6
6
  export let PAGE_GUTTER = isMobile() ? 1 : 2;
7
7
  export let noOfItems;
8
8
  export let itemPerPage = 10;
9
- export let page = 1;
9
+ export let currentPage = 1;
10
10
  export let size = "md";
11
11
  $:
12
12
  pageCount = Math.ceil((noOfItems || 0) / itemPerPage);
13
13
  $:
14
14
  pages = range(
15
- page - PAGE_GUTTER > 0 ? page - PAGE_GUTTER : 1,
16
- page + (PAGE_GUTTER + 1) > pageCount ? pageCount + 1 : page + (PAGE_GUTTER + 1)
15
+ currentPage - PAGE_GUTTER > 0 ? currentPage - PAGE_GUTTER : 1,
16
+ currentPage + (PAGE_GUTTER + 1) > pageCount ? pageCount + 1 : currentPage + (PAGE_GUTTER + 1)
17
17
  ).filter((i) => i != 1 && i != pageCount);
18
18
  const goTo = (num) => {
19
- page = num;
20
- dispatch("pageChanged", page);
19
+ currentPage = num;
20
+ dispatch("pageChanged", currentPage);
21
21
  };
22
22
  </script>
23
23
 
24
24
  {#if 1 < pageCount}
25
25
  <Pagination {size}>
26
- <PaginationItem disabled={page == 1} class="d-none d-sm-block">
26
+ <PaginationItem disabled={currentPage == 1} class="d-none d-sm-block">
27
27
  <PaginationLink first href={'javascript:{}'} on:click={() => goTo(1)} />
28
28
  </PaginationItem>
29
- <PaginationItem disabled={page == 1}>
30
- <PaginationLink previous href={'javascript:{}'} on:click={() => goTo(page - 1)} />
29
+ <PaginationItem disabled={currentPage == 1}>
30
+ <PaginationLink previous href={'javascript:{}'} on:click={() => goTo(currentPage - 1)} />
31
31
  </PaginationItem>
32
- <PaginationItem active={1 == page}
32
+ <PaginationItem active={1 == currentPage}
33
33
  ><PaginationLink href={'javascript:{}'} on:click={() => goTo(1)}>1</PaginationLink
34
34
  ></PaginationItem
35
35
  >
@@ -41,7 +41,7 @@ const goTo = (num) => {
41
41
  >
42
42
  {/if}
43
43
  {#each pages as val, pg}
44
- <PaginationItem active={val == page}>
44
+ <PaginationItem active={val == currentPage}>
45
45
  <PaginationLink href={'javascript:{}'} on:click={() => goTo(val)}>{val}</PaginationLink>
46
46
  </PaginationItem>
47
47
  {/each}
@@ -53,16 +53,16 @@ const goTo = (num) => {
53
53
  >
54
54
  {/if}
55
55
  {#if pageCount > 1}
56
- <PaginationItem active={pageCount == page}
56
+ <PaginationItem active={pageCount == currentPage}
57
57
  ><PaginationLink href={'javascript:{}'} on:click={() => goTo(pageCount)}
58
58
  >{pageCount}</PaginationLink
59
59
  ></PaginationItem
60
60
  >
61
61
  {/if}
62
- <PaginationItem disabled={pageCount == page}>
63
- <PaginationLink next href={'javascript:{}'} on:click={() => goTo(page + 1)} />
62
+ <PaginationItem disabled={pageCount == currentPage}>
63
+ <PaginationLink next href={'javascript:{}'} on:click={() => goTo(currentPage + 1)} />
64
64
  </PaginationItem>
65
- <PaginationItem disabled={pageCount == page} class="d-none d-sm-block">
65
+ <PaginationItem disabled={pageCount == currentPage} class="d-none d-sm-block">
66
66
  <PaginationLink last href={'javascript:{}'} on:click={() => goTo(pageCount)} />
67
67
  </PaginationItem>
68
68
  </Pagination>
@@ -4,7 +4,7 @@ declare const __propDef: {
4
4
  PAGE_GUTTER?: number | undefined;
5
5
  noOfItems: number | undefined;
6
6
  itemPerPage?: number | undefined;
7
- page?: number | undefined;
7
+ currentPage?: number | undefined;
8
8
  size?: string | undefined;
9
9
  };
10
10
  events: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enki-tek/fms-web-components",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
4
4
  "devDependencies": {
5
5
  "@storybook/addon-essentials": "^7.6.14",
6
6
  "@storybook/addon-interactions": "^7.6.14",