@ditojs/ui 2.11.2 → 2.11.3

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": "@ditojs/ui",
3
- "version": "2.11.2",
3
+ "version": "2.11.3",
4
4
  "type": "module",
5
5
  "description": "Dito.js UI is a simple UI library, built with Vue.js for use in Dito.js Admin and elsewhere",
6
6
  "repository": "https://github.com/ditojs/dito/tree/master/packages/ui",
@@ -41,9 +41,9 @@
41
41
  "@vue/compiler-sfc": "^3.3.4",
42
42
  "pug": "^3.0.2",
43
43
  "sass": "1.64.2",
44
- "vite": "^4.4.8"
44
+ "vite": "^4.4.9"
45
45
  },
46
- "gitHead": "681f441e6d90931bbfa7dfb301fb480d7b6fc4cf",
46
+ "gitHead": "9a5406b3ce9575128e9432dfbe6a6d3177d96c3d",
47
47
  "scripts": {
48
48
  "build:icons": "yarn inline-assets src/icons/*.svg --template src/icons/template.js > src/styles/mixins/_icons.scss",
49
49
  "build:vue": "vite build",
@@ -6,12 +6,13 @@
6
6
  )
7
7
  template(
8
8
  v-if="total > 0"
9
- ) {{ first }} – {{ last }}
9
+ ) {{ first }} – {{ last }} / {{ total }}
10
10
  template(
11
11
  v-else
12
12
  ) 0
13
- | / {{ total }}
14
- .dito-buttons.dito-buttons-round
13
+ .dito-buttons.dito-buttons-round(
14
+ v-if="numPages > 1"
15
+ )
15
16
  button.dito-button(
16
17
  v-for="page in pageRange"
17
18
  :class="getPageClass(page)"
@@ -39,19 +40,21 @@ export default {
39
40
  pageRange: [],
40
41
  showPrev: true,
41
42
  showNext: true,
42
- numPages: 0,
43
- currentPageSize: this.pageSize,
44
43
  currentPage: this.page
45
44
  }
46
45
  },
47
46
 
48
47
  computed: {
49
48
  first() {
50
- return (this.currentPage - 1) * this.currentPageSize + 1
49
+ return (this.currentPage - 1) * this.pageSize + 1
51
50
  },
52
51
 
53
52
  last() {
54
- return Math.min(this.first + this.currentPageSize - 1, this.total)
53
+ return Math.min(this.first + this.pageSize - 1, this.total)
54
+ },
55
+
56
+ numPages() {
57
+ return Math.ceil(this.total / this.pageSize)
55
58
  }
56
59
  },
57
60
 
@@ -64,12 +67,7 @@ export default {
64
67
  this.currentPage = page
65
68
  },
66
69
 
67
- pageSize(pageSize) {
68
- this.currentPageSize = pageSize
69
- },
70
-
71
- currentPageSize(currentPageSize) {
72
- this.numPages = Math.ceil(this.total / currentPageSize)
70
+ pageSize() {
73
71
  if (this.currentPage > this.numPages) {
74
72
  this.currentPage = this.numPages
75
73
  }
@@ -86,7 +84,6 @@ export default {
86
84
 
87
85
  created() {
88
86
  this.currentPage = this.page
89
- this.currentPageSize = this.pageSize
90
87
  },
91
88
 
92
89
  mounted() {
@@ -111,9 +108,8 @@ export default {
111
108
  },
112
109
 
113
110
  updatePageRange() {
114
- const { showPrev, showNext, total, currentPageSize, currentPage } = this
111
+ const { showPrev, showNext, currentPage, numPages } = this
115
112
  const showLength = showPrev + showNext + 1
116
- const numPages = (this.numPages = Math.ceil(total / currentPageSize))
117
113
 
118
114
  let start = 1
119
115
  let end = 1