@afeefa/vue-app 0.0.331 → 0.0.332
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 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.332
|
package/package.json
CHANGED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-row
|
|
3
|
+
gap="3"
|
|
4
|
+
class="aPagination2"
|
|
5
|
+
>
|
|
6
|
+
<nav class="pagination-nav">
|
|
7
|
+
<ul>
|
|
8
|
+
<li>
|
|
9
|
+
<button
|
|
10
|
+
:disabled="value <= 1"
|
|
11
|
+
class="nav-btn"
|
|
12
|
+
title="Vorherige Seite"
|
|
13
|
+
@click="goTo(value - 1)"
|
|
14
|
+
>
|
|
15
|
+
<svg viewBox="0 0 24 24"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" /></svg>
|
|
16
|
+
</button>
|
|
17
|
+
</li>
|
|
18
|
+
|
|
19
|
+
<li
|
|
20
|
+
v-for="page in pageLinks"
|
|
21
|
+
:key="page"
|
|
22
|
+
>
|
|
23
|
+
<button
|
|
24
|
+
v-if="page === '...'"
|
|
25
|
+
class="page-btn ellipsis"
|
|
26
|
+
disabled
|
|
27
|
+
>
|
|
28
|
+
...
|
|
29
|
+
</button>
|
|
30
|
+
<button
|
|
31
|
+
v-else
|
|
32
|
+
:class="['page-btn', { active: page === value }]"
|
|
33
|
+
@click="goTo(page)"
|
|
34
|
+
>
|
|
35
|
+
{{ page }}
|
|
36
|
+
</button>
|
|
37
|
+
</li>
|
|
38
|
+
|
|
39
|
+
<li>
|
|
40
|
+
<button
|
|
41
|
+
:disabled="value >= length"
|
|
42
|
+
class="nav-btn"
|
|
43
|
+
title="Nächste Seite"
|
|
44
|
+
@click="goTo(value + 1)"
|
|
45
|
+
>
|
|
46
|
+
<svg viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" /></svg>
|
|
47
|
+
</button>
|
|
48
|
+
</li>
|
|
49
|
+
</ul>
|
|
50
|
+
</nav>
|
|
51
|
+
|
|
52
|
+
<slot />
|
|
53
|
+
</a-row>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<script>
|
|
58
|
+
import { Component, Vue } from '@a-vue'
|
|
59
|
+
|
|
60
|
+
@Component({
|
|
61
|
+
props: {
|
|
62
|
+
value: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 1
|
|
65
|
+
},
|
|
66
|
+
length: {
|
|
67
|
+
type: Number,
|
|
68
|
+
default: 0
|
|
69
|
+
},
|
|
70
|
+
totalVisible: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 5
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
export default class APagination2 extends Vue {
|
|
77
|
+
get pageLinks () {
|
|
78
|
+
const total = this.length
|
|
79
|
+
const current = this.value
|
|
80
|
+
const visible = Math.max(5, this.totalVisible)
|
|
81
|
+
|
|
82
|
+
if (total <= visible) {
|
|
83
|
+
return this.range(1, total)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const links = []
|
|
87
|
+
const sideCount = Math.floor((visible - 3) / 2)
|
|
88
|
+
|
|
89
|
+
let startPage = Math.max(2, current - sideCount)
|
|
90
|
+
let endPage = Math.min(total - 1, current + sideCount)
|
|
91
|
+
|
|
92
|
+
if (current <= sideCount + 2) {
|
|
93
|
+
endPage = Math.min(total - 1, visible - 2)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (current >= total - sideCount - 1) {
|
|
97
|
+
startPage = Math.max(2, total - visible + 3)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
links.push(1)
|
|
101
|
+
|
|
102
|
+
if (startPage > 2) {
|
|
103
|
+
links.push('...')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
for (let i = startPage; i <= endPage; i++) {
|
|
107
|
+
links.push(i)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (endPage < total - 1) {
|
|
111
|
+
links.push('...')
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (total > 1) {
|
|
115
|
+
links.push(total)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return links
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
range (start, end) {
|
|
122
|
+
const result = []
|
|
123
|
+
for (let i = start; i <= end; i++) {
|
|
124
|
+
result.push(i)
|
|
125
|
+
}
|
|
126
|
+
return result
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
goTo (page) {
|
|
130
|
+
const p = Math.max(1, Math.min(page, this.length))
|
|
131
|
+
if (p !== this.value) {
|
|
132
|
+
this.$emit('input', p)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
<style scoped lang="scss">
|
|
140
|
+
.pagination-nav ul {
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
gap: .3rem;
|
|
144
|
+
list-style: none;
|
|
145
|
+
padding: 0;
|
|
146
|
+
margin: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
button {
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
min-width: 28px;
|
|
154
|
+
height: 30px;
|
|
155
|
+
padding: 0 5px;
|
|
156
|
+
border: 1px solid #DDDDDD;
|
|
157
|
+
border-radius: 4px;
|
|
158
|
+
background: #FFFFFF;
|
|
159
|
+
color: #333333;
|
|
160
|
+
font-size: 13px;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
transition: background .15s, border-color .15s;
|
|
163
|
+
white-space: nowrap;
|
|
164
|
+
|
|
165
|
+
&:hover:not(:disabled):not(.active) {
|
|
166
|
+
background: #F0F0F0;
|
|
167
|
+
border-color: #BBBBBB;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&:disabled {
|
|
171
|
+
opacity: .4;
|
|
172
|
+
cursor: default;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&.active {
|
|
176
|
+
background: #1976D2;
|
|
177
|
+
border-color: #1976D2;
|
|
178
|
+
color: #FFFFFF;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&.ellipsis {
|
|
182
|
+
border: none;
|
|
183
|
+
background: none;
|
|
184
|
+
cursor: default;
|
|
185
|
+
min-width: 20px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
svg {
|
|
189
|
+
width: 18px;
|
|
190
|
+
height: 18px;
|
|
191
|
+
fill: currentColor;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<a-row gap="8">
|
|
3
|
-
<
|
|
3
|
+
<component
|
|
4
|
+
:is="paginationComponent"
|
|
4
5
|
v-if="$has.page && count && numPages > 1"
|
|
5
6
|
v-model="filter.value"
|
|
6
7
|
:length="numPages"
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
<span class="pageNumber">{{ filter.value }} / {{ numPages }}</span>
|
|
11
12
|
</template>
|
|
12
13
|
<span class="countLabel">{{ count }}</span>
|
|
13
|
-
</
|
|
14
|
+
</component>
|
|
14
15
|
|
|
15
16
|
<span
|
|
16
17
|
v-if="$has.page && count && numPages <= 1"
|
|
@@ -34,15 +35,22 @@
|
|
|
34
35
|
<script>
|
|
35
36
|
import { Component, Mixins } from '@a-vue'
|
|
36
37
|
import { ListFilterMixin } from '../ListFilterMixin'
|
|
38
|
+
import APagination from '../../APagination'
|
|
39
|
+
import APagination2 from '../../APagination2'
|
|
37
40
|
|
|
38
41
|
@Component({
|
|
39
|
-
props: ['totalVisible']
|
|
42
|
+
props: ['totalVisible', { v2: false }],
|
|
43
|
+
components: { APagination, APagination2 }
|
|
40
44
|
})
|
|
41
45
|
export default class ListFilterPage extends Mixins(ListFilterMixin) {
|
|
42
46
|
$hasOptions = ['page', 'page_size', {page_number: false}]
|
|
43
47
|
|
|
44
48
|
name_ = 'page'
|
|
45
49
|
|
|
50
|
+
get paginationComponent () {
|
|
51
|
+
return this.v2 ? APagination2 : APagination
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
get pageSizeFilter () {
|
|
47
55
|
return this.filters.page_size
|
|
48
56
|
}
|