@redseed/redseed-ui-vue3 2.13.14 → 2.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "2.13.14",
3
+ "version": "2.14.0",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -81,6 +81,7 @@ const showNotFoundMessage = computed(() => !props.totalItems && props.controlApp
81
81
  <div v-if="totalItems" class="rsui-card-group__cards">
82
82
  <slot></slot>
83
83
  </div>
84
+
84
85
  <div v-if="showEmptyMessage" class="rsui-card-group__empty">
85
86
  <Empty
86
87
  @clickPrimaryAction="$emit('clickEmptyAction')"
@@ -144,5 +144,8 @@ function controlChanged(event) {
144
144
  &__empty {
145
145
  @apply mt-6;
146
146
  }
147
+ &___control {
148
+ @apply mt-3;
149
+ }
147
150
  }
148
151
  </style>
@@ -168,7 +168,7 @@ function fireLastPageEvent() {
168
168
  :perPage="perPage"
169
169
  :currentPage="currentPage"
170
170
  @change="pagination = $event"
171
- @fitst="paginationFirst = $event"
171
+ @first="paginationFirst = $event"
172
172
  @last="paginationLast = $event"
173
173
  ></Pagination>
174
174
  </div>
@@ -4,6 +4,7 @@ import PaginationItem from './PaginationItem.vue'
4
4
  import PaginationItemCollapsed from './PaginationItemCollapsed.vue'
5
5
  import PaginationItemNext from './PaginationItemNext.vue'
6
6
  import PaginationItemPrevious from './PaginationItemPrevious.vue'
7
+ import RecordCount from './RecordCount.vue'
7
8
 
8
9
  const props = defineProps({
9
10
  totalItems: {
@@ -25,6 +26,10 @@ const props = defineProps({
25
26
  currentPageOnly: {
26
27
  type: Boolean,
27
28
  default: false
29
+ },
30
+ recordCount: {
31
+ type: Boolean,
32
+ default: true
28
33
  }
29
34
  })
30
35
 
@@ -201,90 +206,109 @@ function goToLastPage(page) {
201
206
  perPage: props.perPage,
202
207
  })
203
208
  }
209
+
210
+ const firstItemIndex = computed(() => {
211
+ return (props.currentPage - 1) * props.perPage + 1
212
+ })
213
+
214
+ const lastItemIndex = computed(() => {
215
+ const lastIndex = props.currentPage * props.perPage
216
+ return lastIndex > props.totalItems ? props.totalItems : lastIndex
217
+ })
218
+
204
219
  </script>
205
220
  <template>
206
- <div class="rsui-pagination">
221
+ <div class="rsui-pagination-parent">
222
+ <div class="rsui-pagination">
207
223
  <!-- Previous button -->
208
- <div class="rsui-pagination__previous">
209
- <PaginationItemPrevious
210
- :disabled="disabledPrevious"
211
- @click="goToPage(current - 1)"
212
- ></PaginationItemPrevious>
213
- </div>
214
- <!-- Page items if not arrows only -->
215
- <div v-if="!arrowsOnly"
216
- class="rsui-pagination__items"
217
- >
218
- <!-- Single scale for current page only -->
219
- <div v-if="showSingleScale"
220
- class="rsui-pagination__items-group"
221
- >
222
- <PaginationItem freeze>
223
- {{ current }}
224
- </PaginationItem>
224
+ <div class="rsui-pagination__previous">
225
+ <PaginationItemPrevious
226
+ :disabled="disabledPrevious"
227
+ @click="goToPage(current - 1)"
228
+ ></PaginationItemPrevious>
225
229
  </div>
226
- <!-- Full scale if total pages equals to scale max -->
227
- <div v-if="showFullScale"
228
- class="rsui-pagination__items-group"
230
+ <!-- Page items if not arrows only -->
231
+ <div v-if="!arrowsOnly"
232
+ class="rsui-pagination__items"
229
233
  >
230
- <PaginationItem v-for="page in totalPages"
231
- :key="page"
232
- :active="page == current"
233
- @click="goToPage(page)"
234
+ <!-- Single scale for current page only -->
235
+ <div v-if="showSingleScale"
236
+ class="rsui-pagination__items-group"
234
237
  >
235
- {{ page }}
236
- </PaginationItem>
237
- </div>
238
- <!-- Ranged scale if total pages is greater than scale max -->
239
- <div v-if="showRangedScale"
240
- class="rsui-pagination__items-group"
241
- >
242
- <PaginationItem
243
- v-if="showCollapsedStart"
244
- :active="current == 1"
245
- @click="goToFirstPage(1)"
238
+ <PaginationItem freeze>
239
+ {{ current }}
240
+ </PaginationItem>
241
+ </div>
242
+ <!-- Full scale if total pages equals to scale max -->
243
+ <div v-if="showFullScale"
244
+ class="rsui-pagination__items-group"
246
245
  >
247
- 1
248
- </PaginationItem>
249
-
250
- <PaginationItemCollapsed
251
- v-if="showCollapsedStart"
252
- ></PaginationItemCollapsed>
253
-
254
- <PaginationItem v-for="page in range"
255
- :key="page"
256
- :active="page == current"
257
- @click="goToPage(page)"
246
+ <PaginationItem v-for="page in totalPages"
247
+ :key="page"
248
+ :active="page == current"
249
+ @click="goToPage(page)"
250
+ >
251
+ {{ page }}
252
+ </PaginationItem>
253
+ </div>
254
+ <!-- Ranged scale if total pages is greater than scale max -->
255
+ <div v-if="showRangedScale"
256
+ class="rsui-pagination__items-group"
258
257
  >
259
- {{ page }}
260
- </PaginationItem>
261
-
262
- <PaginationItemCollapsed
263
- v-if="showCollapsedEnd"
264
- ></PaginationItemCollapsed>
265
-
266
- <PaginationItem
267
- v-if="showCollapsedEnd"
268
- :active="totalPages == current"
269
- @click="goToLastPage(totalPages)"
270
- >
271
- {{ totalPages }}
272
- </PaginationItem>
258
+ <PaginationItem
259
+ v-if="showCollapsedStart"
260
+ :active="current == 1"
261
+ @click="goToFirstPage(1)"
262
+ >
263
+ 1
264
+ </PaginationItem>
265
+
266
+ <PaginationItemCollapsed
267
+ v-if="showCollapsedStart"
268
+ ></PaginationItemCollapsed>
269
+
270
+ <PaginationItem v-for="page in range"
271
+ :key="page"
272
+ :active="page == current"
273
+ @click="goToPage(page)"
274
+ >
275
+ {{ page }}
276
+ </PaginationItem>
277
+
278
+ <PaginationItemCollapsed
279
+ v-if="showCollapsedEnd"
280
+ ></PaginationItemCollapsed>
281
+
282
+ <PaginationItem
283
+ v-if="showCollapsedEnd"
284
+ :active="totalPages == current"
285
+ @click="goToLastPage(totalPages)"
286
+ >
287
+ {{ totalPages }}
288
+ </PaginationItem>
289
+ </div>
290
+ </div>
291
+ <!-- Next button -->
292
+ <div class="rsui-pagination__next">
293
+ <PaginationItemNext
294
+ :disabled="disabledNext"
295
+ @click="goToPage(current + 1)"
296
+ ></PaginationItemNext>
273
297
  </div>
274
298
  </div>
275
- <!-- Next button -->
276
- <div class="rsui-pagination__next">
277
- <PaginationItemNext
278
- :disabled="disabledNext"
279
- @click="goToPage(current + 1)"
280
- ></PaginationItemNext>
299
+ <div class="rsui-pagination-parent__record-count">
300
+ <RecordCount v-if="recordCount"
301
+ :firstItemIndex="firstItemIndex"
302
+ :lastItemIndex="lastItemIndex"
303
+ :totalItems="totalItems"
304
+ ></RecordCount>
281
305
  </div>
282
306
  </div>
283
307
  </template>
284
308
  <style lang="scss" scoped>
285
309
  .rsui-pagination {
286
310
  @apply flex flex-nowrap items-center;
287
- @apply w-fit border border-rsui-grey-200 rounded-full p-1;
311
+ @apply w-fit border border-rsui-grey-200 rounded-full p-1 bg-white;
288
312
  @apply divide-x;
289
313
  &__previous {
290
314
  @apply size-full flex items-center pr-1;
@@ -299,4 +323,10 @@ function goToLastPage(page) {
299
323
  @apply size-full flex items-center pl-1;
300
324
  }
301
325
  }
326
+ .rsui-pagination-parent {
327
+ @apply flex flex-col items-center;
328
+ &__record-count {
329
+ @apply size-full flex items-center justify-center;
330
+ }
331
+ }
302
332
  </style>
@@ -0,0 +1,26 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ firstItemIndex: {
4
+ type: Number,
5
+ required: true
6
+ },
7
+ lastItemIndex: {
8
+ type: Number,
9
+ required: true
10
+ },
11
+ totalItems: {
12
+ type: Number,
13
+ required: true
14
+ }
15
+ })
16
+ </script>
17
+ <template>
18
+ <div class="record-count">
19
+ Showing {{ firstItemIndex }} - {{ lastItemIndex }} of {{ totalItems }}
20
+ </div>
21
+ </template>
22
+ <style lang="scss" scoped>
23
+ .record-count {
24
+ @apply my-2 text-sm text-rsui-medium
25
+ }
26
+ </style>