@pocketprep/ui-kit 3.4.26 → 3.4.27

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.
@@ -10,6 +10,7 @@
10
10
  <IconHelp v-else-if="type === 'help'" :title="title" />
11
11
  <IconArrow v-else-if="type === 'arrow'" :title="title" />
12
12
  <IconPaginationArrow v-else-if="type === 'paginationArrow'" :title="title" />
13
+ <IconPaginationArrowDouble v-else-if="type === 'paginationArrowDouble'" :title="title" />
13
14
  <IconAccordionArrow v-else-if="type === 'accordionArrow'" :title="title" />
14
15
  <IconQuestions v-else-if="type === 'questions'" :title="title" />
15
16
  <IconSubject v-else-if="type === 'subject'" :title="title" />
@@ -88,6 +89,7 @@ import IconHelp from './IconHelp.vue'
88
89
  import IconArrow from './IconArrow.vue'
89
90
  import IconAccordionArrow from './IconAccordionArrow.vue'
90
91
  import IconPaginationArrow from './IconPaginationArrow.vue'
92
+ import IconPaginationArrowDouble from './IconPaginationArrowDouble.vue'
91
93
  import IconQuestions from './IconQuestions.vue'
92
94
  import IconSubject from './IconSubject.vue'
93
95
  import IconFlag from './IconFlag.vue'
@@ -157,6 +159,7 @@ import IconPresent from './IconPresent.vue'
157
159
  IconArrow,
158
160
  IconCheck,
159
161
  IconPaginationArrow,
162
+ IconPaginationArrowDouble,
160
163
  IconQuestions,
161
164
  IconSubject,
162
165
  IconFlag,
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <!-- eslint-disable -->
3
+ <svg width="16" height="20" viewBox="0 0 16 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
4
+ <title>{{ title }}</title>
5
+ <g clip-path="url(#clip0_1238_216)">
6
+ <path d="M0.888889 9.11111C0.433035 9.56697 0.400474 10.2858 0.791206 10.7792L0.888889 10.8889L7.11111 17.1111C7.60203 17.602 8.39797 17.602 8.88889 17.1111C9.34474 16.6553 9.3773 15.9364 8.98657 15.443L8.88889 15.3333L3.55489 9.99934L8.88889 4.66667C9.34474 4.21081 9.3773 3.49196 8.98657 2.99853L8.88889 2.88889C8.43303 2.43303 7.71418 2.40047 7.22075 2.79121L7.11111 2.88889L0.888889 9.11111Z"/>
7
+ <path d="M7.38889 9.11111C6.93303 9.56697 6.90047 10.2858 7.29121 10.7792L7.38889 10.8889L13.6111 17.1111C14.102 17.602 14.898 17.602 15.3889 17.1111C15.8447 16.6553 15.8773 15.9364 15.4866 15.443L15.3889 15.3333L10.0549 9.99934L15.3889 4.66667C15.8447 4.21081 15.8773 3.49196 15.4866 2.99853L15.3889 2.88889C14.933 2.43303 14.2142 2.40047 13.7208 2.79121L13.6111 2.88889L7.38889 9.11111Z"/>
8
+ </g>
9
+ <defs>
10
+ <clipPath id="clip0_1238_216">
11
+ <rect width="16" height="20" fill="white"/>
12
+ </clipPath>
13
+ </defs>
14
+ </svg>
15
+ <!-- eslint-enable -->
16
+ </template>
17
+
18
+ <script lang="ts">
19
+ import { Component, Vue, Prop } from 'vue-facing-decorator'
20
+
21
+ @Component
22
+ export default class IconPaginationArrowDouble extends Vue {
23
+ @Prop() title!: string
24
+ }
25
+ </script>
@@ -11,6 +11,7 @@ export type TIconType =
11
11
  | 'help'
12
12
  | 'arrow'
13
13
  | 'paginationArrow'
14
+ | 'paginationArrowDouble'
14
15
  | 'questions'
15
16
  | 'subject'
16
17
  | 'flag'
@@ -13,6 +13,20 @@
13
13
  {{ nextPageDisabled ? total : (currentPage * perPage) + perPage }}
14
14
  of {{ total }} {{ unit }} <slot />
15
15
  </div>
16
+ <div
17
+ v-if="showAdvancedPagination"
18
+ v-dark="isDarkMode"
19
+ class="uikit-table-pagination__first-page"
20
+ :class="{ 'uikit-table-pagination__first-page--disabled': currentPage === 0 }"
21
+ :tabindex="currentPage === 0 ? -1 : 0"
22
+ aria-label="First Page"
23
+ :aria-disabled="currentPage === 0"
24
+ @keydown.enter="changePage('previous')"
25
+ @click="changePage('first')"
26
+ @mousedown.prevent
27
+ >
28
+ <Icon type="paginationArrowDouble" />
29
+ </div>
16
30
  <div
17
31
  v-dark="isDarkMode"
18
32
  class="uikit-table-pagination__previous"
@@ -39,6 +53,20 @@
39
53
  >
40
54
  <Icon type="accordionArrow" />
41
55
  </div>
56
+ <div
57
+ v-if="showAdvancedPagination"
58
+ v-dark="isDarkMode"
59
+ class="uikit-table-pagination__last-page"
60
+ :class="{ 'uikit-table-pagination__first-page--disabled': nextPageDisabled }"
61
+ :tabindex="currentPage === 0 ? -1 : 0"
62
+ aria-label="First Page"
63
+ :aria-disabled="currentPage === 0"
64
+ @keydown.enter="changePage('previous')"
65
+ @click="changePage('last')"
66
+ @mousedown.prevent
67
+ >
68
+ <Icon type="paginationArrowDouble" />
69
+ </div>
42
70
  </div>
43
71
  </template>
44
72
 
@@ -61,17 +89,30 @@ export default class TablePagination extends Vue {
61
89
  @Prop() total!: number
62
90
  @Prop() unit!: string
63
91
  @Prop({ default: false }) isDarkMode!: boolean
92
+ @Prop({ default: false }) showFirstAndLastBtn!: boolean
64
93
 
65
94
  get nextPageDisabled () {
66
95
  return this.currentPage >= Math.floor((this.total - 1) / this.perPage)
67
96
  }
68
97
 
98
+ get showAdvancedPagination () {
99
+ if (!this.showFirstAndLastBtn) {
100
+ return false
101
+ } else {
102
+ return Math.floor((this.total - 1) / this.perPage) >= 3
103
+ }
104
+ }
105
+
69
106
  @Emit('changePage')
70
- changePage (direction: 'next' | 'previous') {
107
+ changePage (direction: 'next' | 'previous' | 'first' | 'last') {
71
108
  const paginationInfo = this.$refs['pagination_info'] as HTMLElement
72
109
  paginationInfo.focus()
73
110
  if (direction === 'next') {
74
111
  return this.nextPageDisabled ? this.currentPage : this.currentPage + 1
112
+ } else if (direction === 'first') {
113
+ return 0
114
+ } else if (direction === 'last') {
115
+ return Math.floor((this.total - 1) / this.perPage)
75
116
  } else {
76
117
  return Math.max(0, this.currentPage - 1)
77
118
  }
@@ -149,5 +190,48 @@ export default class TablePagination extends Vue {
149
190
  &__next {
150
191
  transform: rotate(-90deg);
151
192
  }
193
+
194
+ &__first-page {
195
+ color: $brand-blue;
196
+ cursor: pointer;
197
+ user-select: none;
198
+ width: 16px;
199
+ height: 20px;
200
+ outline: none;
201
+ position: relative;
202
+ margin-right: 10px;
203
+
204
+ &--disabled {
205
+ opacity: 0.35;
206
+ cursor: default;
207
+ }
208
+
209
+ svg {
210
+ width: 100%;
211
+ height: 100%;
212
+ }
213
+ }
214
+
215
+ &__last-page {
216
+ color: $brand-blue;
217
+ cursor: pointer;
218
+ user-select: none;
219
+ width: 16px;
220
+ height: 20px;
221
+ outline: none;
222
+ position: relative;
223
+ margin-left: 10px;
224
+ transform: rotate(180deg);
225
+
226
+ &--disabled {
227
+ opacity: 0.35;
228
+ cursor: default;
229
+ }
230
+
231
+ svg {
232
+ width: 100%;
233
+ height: 100%;
234
+ }
235
+ }
152
236
  }
153
237
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.26",
3
+ "version": "3.4.27",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {