@enki-tek/fms-web-components 0.1.67 → 0.1.69

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.
@@ -1,13 +1,16 @@
1
1
  <script>import { Pagination, PaginationItem, PaginationLink, Icon } from "sveltestrap";
2
- import { createEventDispatcher } from "svelte";
2
+ import { createEventDispatcher, onMount } from "svelte";
3
3
  import { first, last, range } from "lodash";
4
4
  import { isMobile } from "../../lib/common";
5
5
  const dispatch = createEventDispatcher();
6
- export let PAGE_GUTTER = isMobile() ? 1 : 2;
6
+ export let PAGE_GUTTER = 2;
7
7
  export let noOfItems;
8
8
  export let itemPerPage = 10;
9
9
  export let currentPage = 1;
10
10
  export let size = "md";
11
+ onMount(() => {
12
+ PAGE_GUTTER = isMobile() ? 1 : 2;
13
+ });
11
14
  $:
12
15
  pageCount = Math.ceil((noOfItems || 0) / itemPerPage);
13
16
  $:
@@ -23,14 +26,14 @@ const goTo = (num) => {
23
26
 
24
27
  {#if 1 < pageCount}
25
28
  <Pagination {size}>
26
- <PaginationItem disabled={currentPage == 1} class="d-none d-sm-block">
29
+ <PaginationItem disabled={currentPage == 1} >
27
30
  <PaginationLink first href={'javascript:{}'} on:click={() => goTo(1)} />
28
31
  </PaginationItem>
29
32
  <PaginationItem disabled={currentPage == 1}>
30
33
  <PaginationLink previous href={'javascript:{}'} on:click={() => goTo(currentPage - 1)} />
31
34
  </PaginationItem>
32
35
  <PaginationItem active={1 == currentPage}
33
- ><PaginationLink href={'javascript:{}'} on:click={() => goTo(1)}>1</PaginationLink
36
+ class="d-none d-sm-block"><PaginationLink href={'javascript:{}'} on:click={() => goTo(1)}>1</PaginationLink
34
37
  ></PaginationItem
35
38
  >
36
39
  {#if !!first(pages) && (first(pages) || 0) > 2}
@@ -41,10 +44,13 @@ const goTo = (num) => {
41
44
  >
42
45
  {/if}
43
46
  {#each pages as val, pg}
44
- <PaginationItem active={val == currentPage}>
47
+ <PaginationItem active={val == currentPage} class="d-none d-sm-block">
45
48
  <PaginationLink href={'javascript:{}'} on:click={() => goTo(val)}>{val}</PaginationLink>
46
49
  </PaginationItem>
47
50
  {/each}
51
+ <PaginationItem class="d-block d-sm-none m-2">
52
+ {currentPage} / {pageCount}
53
+ </PaginationItem>
48
54
  {#if !!last(pages) && (last(pages) || 0) < pageCount - 1}
49
55
  <PaginationItem
50
56
  class="d-none d-sm-block"><PaginationLink href={'javascript:{}'} on:click={() => goTo((last(pages) || 0) + 1)}
@@ -54,7 +60,7 @@ const goTo = (num) => {
54
60
  {/if}
55
61
  {#if pageCount > 1}
56
62
  <PaginationItem active={pageCount == currentPage}
57
- ><PaginationLink href={'javascript:{}'} on:click={() => goTo(pageCount)}
63
+ class="d-none d-sm-block"><PaginationLink href={'javascript:{}'} on:click={() => goTo(pageCount)}
58
64
  >{pageCount}</PaginationLink
59
65
  ></PaginationItem
60
66
  >
@@ -62,7 +68,7 @@ const goTo = (num) => {
62
68
  <PaginationItem disabled={pageCount == currentPage}>
63
69
  <PaginationLink next href={'javascript:{}'} on:click={() => goTo(currentPage + 1)} />
64
70
  </PaginationItem>
65
- <PaginationItem disabled={pageCount == currentPage} class="d-none d-sm-block">
71
+ <PaginationItem disabled={pageCount == currentPage} >
66
72
  <PaginationLink last href={'javascript:{}'} on:click={() => goTo(pageCount)} />
67
73
  </PaginationItem>
68
74
  </Pagination>
@@ -115,6 +115,7 @@ ul, .icon-sidebar-content ul li, .icon-sidebar-content .toggle-button {
115
115
  z-index: 1000;
116
116
  position: fixed;
117
117
  top: 90px;
118
+ width: fit-content;
118
119
  }
119
120
  #margin-alignment {
120
121
  height: calc(100vh - 146px);
@@ -128,6 +128,7 @@ ul, .icon-sidebar-content ul li, .icon-sidebar-content .toggle-button {
128
128
  z-index: 1000;
129
129
  position: fixed;
130
130
  top: 90px;
131
+ width: fit-content;
131
132
  }
132
133
  #margin-alignment {
133
134
  height: calc(100vh - 146px);
@@ -187,6 +187,7 @@ ul, .icon-sidebar-content ul li, .icon-sidebar-content .toggle-button {
187
187
  z-index: 1000;
188
188
  position: fixed;
189
189
  top: 90px;
190
+ width: fit-content;
190
191
  }
191
192
  #margin-alignment {
192
193
  height: calc(100vh - 146px);
@@ -159,6 +159,7 @@ ul {
159
159
  z-index: 1000 ;
160
160
  position: fixed ;
161
161
  top: 90px ;
162
+ width: fit-content;
162
163
  }
163
164
 
164
165
  #margin-alignment {
@@ -191,6 +191,7 @@ ul, .icon-sidebar-content ul li, .icon-sidebar-content .toggle-button {
191
191
  z-index: 1000;
192
192
  position: fixed;
193
193
  top: 90px;
194
+ width: fit-content;
194
195
  }
195
196
  #margin-alignment {
196
197
  height: calc(100vh - 146px);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enki-tek/fms-web-components",
3
- "version": "0.1.67",
3
+ "version": "0.1.69",
4
4
  "devDependencies": {
5
5
  "@storybook/addon-essentials": "^7.6.14",
6
6
  "@storybook/addon-interactions": "^7.6.14",