@redseed/redseed-ui-vue3 2.13.1 → 2.13.2

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": "@redseed/redseed-ui-vue3",
3
- "version": "2.13.1",
3
+ "version": "2.13.2",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -124,8 +124,11 @@ const range = computed(() => {
124
124
  if (goingNext.value) return startRange
125
125
  }
126
126
 
127
- // default to show start range
128
- return startRange
127
+ if (current.value <= scaleOffset + 1) return startRange
128
+
129
+ if (current.value == totalPages.value) return endRange
130
+
131
+ return middleRangeGoingNext
129
132
  })
130
133
 
131
134
  const showSingleScale = computed(() => hasOnePage.value || props.currentPageOnly)
@@ -150,7 +153,7 @@ const showCollapsedEnd = computed(() => totalPages.value > 6
150
153
  && !range.value.includes(totalPages.value)
151
154
  )
152
155
 
153
- const emit = defineEmits(['change'])
156
+ const emit = defineEmits(['change', 'first', 'last'])
154
157
 
155
158
  const goingPrevious = ref(false)
156
159
  const goingNext = ref(false)
@@ -176,6 +179,26 @@ function goToPage(page) {
176
179
  perPage: props.perPage,
177
180
  })
178
181
  }
182
+
183
+ function goToFirstPage(page) {
184
+ goToPage(page)
185
+
186
+ emit('first', {
187
+ currentPage: current.value,
188
+ totalPages: totalPages.value,
189
+ perPage: props.perPage,
190
+ })
191
+ }
192
+
193
+ function goToLastPage(page) {
194
+ goToPage(page)
195
+
196
+ emit('last', {
197
+ currentPage: current.value,
198
+ totalPages: totalPages.value,
199
+ perPage: props.perPage,
200
+ })
201
+ }
179
202
  </script>
180
203
  <template>
181
204
  <div class="rsui-pagination">
@@ -217,7 +240,7 @@ function goToPage(page) {
217
240
  <PaginationItem
218
241
  v-if="showCollapsedStart"
219
242
  :active="current == 1"
220
- @click="goToPage(1)"
243
+ @click="goToFirstPage(1)"
221
244
  >
222
245
  1
223
246
  </PaginationItem>
@@ -241,7 +264,7 @@ function goToPage(page) {
241
264
  <PaginationItem
242
265
  v-if="showCollapsedEnd"
243
266
  :active="totalPages == current"
244
- @click="goToPage(totalPages)"
267
+ @click="goToLastPage(totalPages)"
245
268
  >
246
269
  {{ totalPages }}
247
270
  </PaginationItem>