vue-instantsearch 4.10.10 → 4.10.11
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/README.md +4 -12
- package/package.json +5 -5
- package/src/__tests__/common-widgets.test.js +36 -0
- package/src/components/CurrentRefinements.vue +4 -6
- package/src/components/Pagination.vue +13 -10
- package/src/components/__tests__/CurrentRefinements.js +0 -210
- package/src/components/__tests__/InstantSearch.js +1 -1
- package/src/components/__tests__/__snapshots__/CurrentRefinements.js.snap +0 -165
- package/src/util/createInstantSearchComponent.js +2 -2
- package/vue2/cjs/index.js +1 -1
- package/vue2/cjs/index.js.map +1 -1
- package/vue2/es/package.json.js +1 -1
- package/vue2/es/src/components/CurrentRefinements.vue.js +1 -1
- package/vue2/es/src/components/Pagination.vue.js +1 -1
- package/vue2/es/src/util/createInstantSearchComponent.js +1 -1
- package/vue2/es/src/util/createInstantSearchComponent.js.map +1 -1
- package/vue2/umd/index.js +1 -1
- package/vue2/umd/index.js.map +1 -1
- package/vue3/cjs/index.js +1 -1
- package/vue3/cjs/index.js.map +1 -1
- package/vue3/es/package.json.js +1 -1
- package/vue3/es/src/components/CurrentRefinements.vue.js +1 -1
- package/vue3/es/src/components/CurrentRefinements.vue_vue&type=script&lang.js.map +1 -1
- package/vue3/es/src/components/CurrentRefinements.vue_vue&type=template&id=5584328f&lang.js +2 -0
- package/vue3/es/src/components/CurrentRefinements.vue_vue&type=template&id=5584328f&lang.js.map +1 -0
- package/vue3/es/src/components/Pagination.vue.js +1 -1
- package/vue3/es/src/components/Pagination.vue_vue&type=script&lang.js.map +1 -1
- package/vue3/es/src/components/Pagination.vue_vue&type=template&id=36adea52&lang.js +2 -0
- package/vue3/es/src/components/Pagination.vue_vue&type=template&id=36adea52&lang.js.map +1 -0
- package/vue3/es/src/util/createInstantSearchComponent.js +1 -1
- package/vue3/es/src/util/createInstantSearchComponent.js.map +1 -1
- package/vue3/umd/index.js +1 -1
- package/vue3/umd/index.js.map +1 -1
- package/src/components/__tests__/Pagination.js +0 -225
- package/src/components/__tests__/__snapshots__/Pagination.js.snap +0 -282
- package/vue3/es/src/components/CurrentRefinements.vue_vue&type=template&id=3ffbec3c&lang.js +0 -2
- package/vue3/es/src/components/CurrentRefinements.vue_vue&type=template&id=3ffbec3c&lang.js.map +0 -1
- package/vue3/es/src/components/Pagination.vue_vue&type=template&id=5a680db4&lang.js +0 -2
- package/vue3/es/src/components/Pagination.vue_vue&type=template&id=5a680db4&lang.js.map +0 -1
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { mount } from '../../../test/utils';
|
|
6
|
-
import { __setState } from '../../mixins/widget';
|
|
7
|
-
import Pagination from '../Pagination.vue';
|
|
8
|
-
import '../../../test/utils/sortedHtmlSerializer';
|
|
9
|
-
|
|
10
|
-
jest.mock('../../mixins/widget');
|
|
11
|
-
jest.mock('../../mixins/panel');
|
|
12
|
-
|
|
13
|
-
const defaultState = {
|
|
14
|
-
createURL: () => '#',
|
|
15
|
-
refine: jest.fn(),
|
|
16
|
-
pages: [0, 1, 2, 3, 4, 5, 6],
|
|
17
|
-
nbPages: 20,
|
|
18
|
-
currentRefinement: 0,
|
|
19
|
-
isFirstPage: true,
|
|
20
|
-
isLastPage: false,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
it('accepts a padding prop', () => {
|
|
24
|
-
__setState({
|
|
25
|
-
...defaultState,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const wrapper = mount(Pagination, {
|
|
29
|
-
propsData: {
|
|
30
|
-
padding: 5,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
expect(wrapper.vm.widgetParams.padding).toBe(5);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('accepts a totalPages prop', () => {
|
|
38
|
-
__setState({
|
|
39
|
-
...defaultState,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const wrapper = mount(Pagination, {
|
|
43
|
-
propsData: {
|
|
44
|
-
totalPages: 10,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
expect(wrapper.vm.widgetParams.totalPages).toBe(10);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('renders correctly first page', () => {
|
|
52
|
-
__setState(defaultState);
|
|
53
|
-
const wrapper = mount(Pagination);
|
|
54
|
-
|
|
55
|
-
expect(wrapper.html()).toMatchSnapshot();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('renders correctly another page', () => {
|
|
59
|
-
__setState({
|
|
60
|
-
...defaultState,
|
|
61
|
-
pages: [3, 4, 5, 6, 7, 8, 9],
|
|
62
|
-
nbPages: 20,
|
|
63
|
-
currentRefinement: 6,
|
|
64
|
-
isFirstPage: false,
|
|
65
|
-
isLastPage: false,
|
|
66
|
-
});
|
|
67
|
-
const wrapper = mount(Pagination);
|
|
68
|
-
|
|
69
|
-
expect(wrapper.html()).toMatchSnapshot();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('renders correctly last page', () => {
|
|
73
|
-
__setState({
|
|
74
|
-
...defaultState,
|
|
75
|
-
pages: [3, 4, 5, 6, 7, 8, 9],
|
|
76
|
-
nbPages: 9,
|
|
77
|
-
currentRefinement: 9,
|
|
78
|
-
isFirstPage: false,
|
|
79
|
-
isLastPage: true,
|
|
80
|
-
});
|
|
81
|
-
const wrapper = mount(Pagination);
|
|
82
|
-
|
|
83
|
-
expect(wrapper.html()).toMatchSnapshot();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('Moves to the first page on that button', async () => {
|
|
87
|
-
__setState({
|
|
88
|
-
...defaultState,
|
|
89
|
-
isFirstPage: false,
|
|
90
|
-
});
|
|
91
|
-
const wrapper = mount(Pagination);
|
|
92
|
-
|
|
93
|
-
const firstPage = wrapper.find(
|
|
94
|
-
'.ais-Pagination-item--firstPage .ais-Pagination-link'
|
|
95
|
-
);
|
|
96
|
-
await firstPage.trigger('click');
|
|
97
|
-
expect(wrapper.vm.state.refine).toHaveBeenLastCalledWith(0);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('Moves to the next page on that button', async () => {
|
|
101
|
-
const currentRefinement = 5;
|
|
102
|
-
__setState({
|
|
103
|
-
...defaultState,
|
|
104
|
-
currentRefinement,
|
|
105
|
-
});
|
|
106
|
-
const wrapper = mount(Pagination);
|
|
107
|
-
|
|
108
|
-
const nextPage = wrapper.find(
|
|
109
|
-
'.ais-Pagination-item--nextPage .ais-Pagination-link'
|
|
110
|
-
);
|
|
111
|
-
await nextPage.trigger('click');
|
|
112
|
-
expect(wrapper.vm.state.refine).toHaveBeenLastCalledWith(
|
|
113
|
-
currentRefinement + 1
|
|
114
|
-
);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('Moves to the last page on that button', async () => {
|
|
118
|
-
const nbPages = 1000;
|
|
119
|
-
__setState({
|
|
120
|
-
...defaultState,
|
|
121
|
-
isLastPage: false,
|
|
122
|
-
nbPages,
|
|
123
|
-
});
|
|
124
|
-
const wrapper = mount(Pagination);
|
|
125
|
-
|
|
126
|
-
const lastPage = wrapper.find(
|
|
127
|
-
'.ais-Pagination-item--lastPage .ais-Pagination-link'
|
|
128
|
-
);
|
|
129
|
-
await lastPage.trigger('click');
|
|
130
|
-
expect(wrapper.vm.state.refine).toHaveBeenLastCalledWith(nbPages - 1);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('Moves to the previous page on that button', async () => {
|
|
134
|
-
const currentRefinement = 5;
|
|
135
|
-
__setState({
|
|
136
|
-
...defaultState,
|
|
137
|
-
isFirstPage: false,
|
|
138
|
-
currentRefinement,
|
|
139
|
-
});
|
|
140
|
-
const wrapper = mount(Pagination);
|
|
141
|
-
|
|
142
|
-
const previousPage = wrapper.find(
|
|
143
|
-
'.ais-Pagination-item--previousPage .ais-Pagination-link'
|
|
144
|
-
);
|
|
145
|
-
await previousPage.trigger('click');
|
|
146
|
-
expect(wrapper.vm.state.refine).toHaveBeenLastCalledWith(
|
|
147
|
-
currentRefinement - 1
|
|
148
|
-
);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('implements showFirst', async () => {
|
|
152
|
-
__setState({ ...defaultState });
|
|
153
|
-
|
|
154
|
-
const wrapper = mount(Pagination, {
|
|
155
|
-
propsData: {
|
|
156
|
-
showFirst: false,
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
expect(wrapper.find('.ais-Pagination-item--firstPage').exists()).toBe(false);
|
|
161
|
-
|
|
162
|
-
await wrapper.setProps({
|
|
163
|
-
showFirst: true,
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
expect(wrapper.find('.ais-Pagination-item--firstPage').exists()).toBe(true);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it('implements showPrevious', async () => {
|
|
170
|
-
__setState({ ...defaultState });
|
|
171
|
-
|
|
172
|
-
const wrapper = mount(Pagination, {
|
|
173
|
-
propsData: {
|
|
174
|
-
showPrevious: false,
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
expect(wrapper.find('.ais-Pagination-item--previousPage').exists()).toBe(
|
|
179
|
-
false
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
await wrapper.setProps({
|
|
183
|
-
showPrevious: true,
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
expect(wrapper.find('.ais-Pagination-item--previousPage').exists()).toBe(
|
|
187
|
-
true
|
|
188
|
-
);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it('implements showLast', async () => {
|
|
192
|
-
__setState({ ...defaultState });
|
|
193
|
-
|
|
194
|
-
const wrapper = mount(Pagination, {
|
|
195
|
-
propsData: {
|
|
196
|
-
showLast: false,
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
expect(wrapper.find('.ais-Pagination-item--lastPage').exists()).toBe(false);
|
|
201
|
-
|
|
202
|
-
await wrapper.setProps({
|
|
203
|
-
showLast: true,
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
expect(wrapper.find('.ais-Pagination-item--lastPage').exists()).toBe(true);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it('implements showNext', async () => {
|
|
210
|
-
__setState({ ...defaultState });
|
|
211
|
-
|
|
212
|
-
const wrapper = mount(Pagination, {
|
|
213
|
-
propsData: {
|
|
214
|
-
showNext: false,
|
|
215
|
-
},
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
expect(wrapper.find('.ais-Pagination-item--nextPage').exists()).toBe(false);
|
|
219
|
-
|
|
220
|
-
await wrapper.setProps({
|
|
221
|
-
showNext: true,
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
expect(wrapper.find('.ais-Pagination-item--nextPage').exists()).toBe(true);
|
|
225
|
-
});
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`renders correctly another page 1`] = `
|
|
4
|
-
<div class="ais-Pagination">
|
|
5
|
-
<ul class="ais-Pagination-list">
|
|
6
|
-
<li class="ais-Pagination-item ais-Pagination-item--firstPage">
|
|
7
|
-
<a aria-label="First"
|
|
8
|
-
class="ais-Pagination-link"
|
|
9
|
-
href="#"
|
|
10
|
-
>
|
|
11
|
-
‹‹
|
|
12
|
-
</a>
|
|
13
|
-
</li>
|
|
14
|
-
<li class="ais-Pagination-item ais-Pagination-item--previousPage">
|
|
15
|
-
<a aria-label="Previous"
|
|
16
|
-
class="ais-Pagination-link"
|
|
17
|
-
href="#"
|
|
18
|
-
>
|
|
19
|
-
‹
|
|
20
|
-
</a>
|
|
21
|
-
</li>
|
|
22
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
23
|
-
<a aria-label="Page 4"
|
|
24
|
-
class="ais-Pagination-link"
|
|
25
|
-
href="#"
|
|
26
|
-
>
|
|
27
|
-
4
|
|
28
|
-
</a>
|
|
29
|
-
</li>
|
|
30
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
31
|
-
<a aria-label="Page 5"
|
|
32
|
-
class="ais-Pagination-link"
|
|
33
|
-
href="#"
|
|
34
|
-
>
|
|
35
|
-
5
|
|
36
|
-
</a>
|
|
37
|
-
</li>
|
|
38
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
39
|
-
<a aria-label="Page 6"
|
|
40
|
-
class="ais-Pagination-link"
|
|
41
|
-
href="#"
|
|
42
|
-
>
|
|
43
|
-
6
|
|
44
|
-
</a>
|
|
45
|
-
</li>
|
|
46
|
-
<li class="ais-Pagination-item ais-Pagination-item--page ais-Pagination-item--selected">
|
|
47
|
-
<a aria-label="Page 7"
|
|
48
|
-
class="ais-Pagination-link"
|
|
49
|
-
href="#"
|
|
50
|
-
>
|
|
51
|
-
7
|
|
52
|
-
</a>
|
|
53
|
-
</li>
|
|
54
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
55
|
-
<a aria-label="Page 8"
|
|
56
|
-
class="ais-Pagination-link"
|
|
57
|
-
href="#"
|
|
58
|
-
>
|
|
59
|
-
8
|
|
60
|
-
</a>
|
|
61
|
-
</li>
|
|
62
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
63
|
-
<a aria-label="Page 9"
|
|
64
|
-
class="ais-Pagination-link"
|
|
65
|
-
href="#"
|
|
66
|
-
>
|
|
67
|
-
9
|
|
68
|
-
</a>
|
|
69
|
-
</li>
|
|
70
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
71
|
-
<a aria-label="Page 10"
|
|
72
|
-
class="ais-Pagination-link"
|
|
73
|
-
href="#"
|
|
74
|
-
>
|
|
75
|
-
10
|
|
76
|
-
</a>
|
|
77
|
-
</li>
|
|
78
|
-
<li class="ais-Pagination-item ais-Pagination-item--nextPage">
|
|
79
|
-
<a aria-label="Next"
|
|
80
|
-
class="ais-Pagination-link"
|
|
81
|
-
href="#"
|
|
82
|
-
>
|
|
83
|
-
›
|
|
84
|
-
</a>
|
|
85
|
-
</li>
|
|
86
|
-
<li class="ais-Pagination-item ais-Pagination-item--lastPage">
|
|
87
|
-
<a aria-label="Last"
|
|
88
|
-
class="ais-Pagination-link"
|
|
89
|
-
href="#"
|
|
90
|
-
>
|
|
91
|
-
››
|
|
92
|
-
</a>
|
|
93
|
-
</li>
|
|
94
|
-
</ul>
|
|
95
|
-
</div>
|
|
96
|
-
`;
|
|
97
|
-
|
|
98
|
-
exports[`renders correctly first page 1`] = `
|
|
99
|
-
<div class="ais-Pagination">
|
|
100
|
-
<ul class="ais-Pagination-list">
|
|
101
|
-
<li class="ais-Pagination-item ais-Pagination-item--firstPage ais-Pagination-item--disabled">
|
|
102
|
-
<span aria-label="First"
|
|
103
|
-
class="ais-Pagination-link"
|
|
104
|
-
>
|
|
105
|
-
‹‹
|
|
106
|
-
</span>
|
|
107
|
-
</li>
|
|
108
|
-
<li class="ais-Pagination-item ais-Pagination-item--previousPage ais-Pagination-item--disabled">
|
|
109
|
-
<span aria-label="Previous"
|
|
110
|
-
class="ais-Pagination-link"
|
|
111
|
-
>
|
|
112
|
-
‹
|
|
113
|
-
</span>
|
|
114
|
-
</li>
|
|
115
|
-
<li class="ais-Pagination-item ais-Pagination-item--page ais-Pagination-item--selected">
|
|
116
|
-
<a aria-label="Page 1"
|
|
117
|
-
class="ais-Pagination-link"
|
|
118
|
-
href="#"
|
|
119
|
-
>
|
|
120
|
-
1
|
|
121
|
-
</a>
|
|
122
|
-
</li>
|
|
123
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
124
|
-
<a aria-label="Page 2"
|
|
125
|
-
class="ais-Pagination-link"
|
|
126
|
-
href="#"
|
|
127
|
-
>
|
|
128
|
-
2
|
|
129
|
-
</a>
|
|
130
|
-
</li>
|
|
131
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
132
|
-
<a aria-label="Page 3"
|
|
133
|
-
class="ais-Pagination-link"
|
|
134
|
-
href="#"
|
|
135
|
-
>
|
|
136
|
-
3
|
|
137
|
-
</a>
|
|
138
|
-
</li>
|
|
139
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
140
|
-
<a aria-label="Page 4"
|
|
141
|
-
class="ais-Pagination-link"
|
|
142
|
-
href="#"
|
|
143
|
-
>
|
|
144
|
-
4
|
|
145
|
-
</a>
|
|
146
|
-
</li>
|
|
147
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
148
|
-
<a aria-label="Page 5"
|
|
149
|
-
class="ais-Pagination-link"
|
|
150
|
-
href="#"
|
|
151
|
-
>
|
|
152
|
-
5
|
|
153
|
-
</a>
|
|
154
|
-
</li>
|
|
155
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
156
|
-
<a aria-label="Page 6"
|
|
157
|
-
class="ais-Pagination-link"
|
|
158
|
-
href="#"
|
|
159
|
-
>
|
|
160
|
-
6
|
|
161
|
-
</a>
|
|
162
|
-
</li>
|
|
163
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
164
|
-
<a aria-label="Page 7"
|
|
165
|
-
class="ais-Pagination-link"
|
|
166
|
-
href="#"
|
|
167
|
-
>
|
|
168
|
-
7
|
|
169
|
-
</a>
|
|
170
|
-
</li>
|
|
171
|
-
<li class="ais-Pagination-item ais-Pagination-item--nextPage">
|
|
172
|
-
<a aria-label="Next"
|
|
173
|
-
class="ais-Pagination-link"
|
|
174
|
-
href="#"
|
|
175
|
-
>
|
|
176
|
-
›
|
|
177
|
-
</a>
|
|
178
|
-
</li>
|
|
179
|
-
<li class="ais-Pagination-item ais-Pagination-item--lastPage">
|
|
180
|
-
<a aria-label="Last"
|
|
181
|
-
class="ais-Pagination-link"
|
|
182
|
-
href="#"
|
|
183
|
-
>
|
|
184
|
-
››
|
|
185
|
-
</a>
|
|
186
|
-
</li>
|
|
187
|
-
</ul>
|
|
188
|
-
</div>
|
|
189
|
-
`;
|
|
190
|
-
|
|
191
|
-
exports[`renders correctly last page 1`] = `
|
|
192
|
-
<div class="ais-Pagination">
|
|
193
|
-
<ul class="ais-Pagination-list">
|
|
194
|
-
<li class="ais-Pagination-item ais-Pagination-item--firstPage">
|
|
195
|
-
<a aria-label="First"
|
|
196
|
-
class="ais-Pagination-link"
|
|
197
|
-
href="#"
|
|
198
|
-
>
|
|
199
|
-
‹‹
|
|
200
|
-
</a>
|
|
201
|
-
</li>
|
|
202
|
-
<li class="ais-Pagination-item ais-Pagination-item--previousPage">
|
|
203
|
-
<a aria-label="Previous"
|
|
204
|
-
class="ais-Pagination-link"
|
|
205
|
-
href="#"
|
|
206
|
-
>
|
|
207
|
-
‹
|
|
208
|
-
</a>
|
|
209
|
-
</li>
|
|
210
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
211
|
-
<a aria-label="Page 4"
|
|
212
|
-
class="ais-Pagination-link"
|
|
213
|
-
href="#"
|
|
214
|
-
>
|
|
215
|
-
4
|
|
216
|
-
</a>
|
|
217
|
-
</li>
|
|
218
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
219
|
-
<a aria-label="Page 5"
|
|
220
|
-
class="ais-Pagination-link"
|
|
221
|
-
href="#"
|
|
222
|
-
>
|
|
223
|
-
5
|
|
224
|
-
</a>
|
|
225
|
-
</li>
|
|
226
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
227
|
-
<a aria-label="Page 6"
|
|
228
|
-
class="ais-Pagination-link"
|
|
229
|
-
href="#"
|
|
230
|
-
>
|
|
231
|
-
6
|
|
232
|
-
</a>
|
|
233
|
-
</li>
|
|
234
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
235
|
-
<a aria-label="Page 7"
|
|
236
|
-
class="ais-Pagination-link"
|
|
237
|
-
href="#"
|
|
238
|
-
>
|
|
239
|
-
7
|
|
240
|
-
</a>
|
|
241
|
-
</li>
|
|
242
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
243
|
-
<a aria-label="Page 8"
|
|
244
|
-
class="ais-Pagination-link"
|
|
245
|
-
href="#"
|
|
246
|
-
>
|
|
247
|
-
8
|
|
248
|
-
</a>
|
|
249
|
-
</li>
|
|
250
|
-
<li class="ais-Pagination-item ais-Pagination-item--page">
|
|
251
|
-
<a aria-label="Page 9"
|
|
252
|
-
class="ais-Pagination-link"
|
|
253
|
-
href="#"
|
|
254
|
-
>
|
|
255
|
-
9
|
|
256
|
-
</a>
|
|
257
|
-
</li>
|
|
258
|
-
<li class="ais-Pagination-item ais-Pagination-item--page ais-Pagination-item--selected">
|
|
259
|
-
<a aria-label="Page 10"
|
|
260
|
-
class="ais-Pagination-link"
|
|
261
|
-
href="#"
|
|
262
|
-
>
|
|
263
|
-
10
|
|
264
|
-
</a>
|
|
265
|
-
</li>
|
|
266
|
-
<li class="ais-Pagination-item ais-Pagination-item--nextPage ais-Pagination-item--disabled">
|
|
267
|
-
<span aria-label="Next"
|
|
268
|
-
class="ais-Pagination-link"
|
|
269
|
-
>
|
|
270
|
-
›
|
|
271
|
-
</span>
|
|
272
|
-
</li>
|
|
273
|
-
<li class="ais-Pagination-item ais-Pagination-item--lastPage ais-Pagination-item--disabled">
|
|
274
|
-
<span aria-label="Last"
|
|
275
|
-
class="ais-Pagination-link"
|
|
276
|
-
>
|
|
277
|
-
››
|
|
278
|
-
</span>
|
|
279
|
-
</li>
|
|
280
|
-
</ul>
|
|
281
|
-
</div>
|
|
282
|
-
`;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{openBlock as e,createElementBlock as t,normalizeClass as n,renderSlot as i,createElementVNode as s,Fragment as r,renderList as a,toDisplayString as l,createTextVNode as u,createCommentVNode as c}from"vue";var f={key:0},o=["onClick"];function m(m,y,b,R,k,L){return m.state?(e(),t("div",{key:0,class:n([m.suit(),L.noRefinement&&m.suit("","noRefinement")])},[i(m.$slots,"default",{refine:m.state.refine,items:m.state.items,createURL:m.state.createURL},function(){return[s("ul",{class:n(m.suit("list"))},[(e(!0),t(r,null,a(m.state.items,function(c){return e(),t("li",{key:c.attribute,class:n(m.suit("item"))},[i(m.$slots,"item",{refine:c.refine,item:c,createURL:m.state.createURL},function(){return[s("span",{class:n(m.suit("label"))},l(L.capitalize(c.label))+": ",3),(e(!0),t(r,null,a(c.refinements,function(a){return e(),t("span",{key:L.createItemKey(a),class:n(m.suit("category"))},[i(m.$slots,"refinement",{refine:c.refine,refinement:a,createURL:m.state.createURL},function(){return[s("span",{class:n(m.suit("categoryLabel"))},["query"===a.attribute?(e(),t("q",f,l(a.label),1)):(e(),t(r,{key:1},[u(l(a.label),1)],64))],2),s("button",{class:n(m.suit("delete")),onClick:function(e){return c.refine(a)}}," ✕ ",10,o)]})],2)}),128))]})],2)}),128))],2)]})],2)):c("",!0)}export{m as render};
|
|
2
|
-
//# sourceMappingURL=CurrentRefinements.vue_vue&type=template&id=3ffbec3c&lang.js.map
|
package/vue3/es/src/components/CurrentRefinements.vue_vue&type=template&id=3ffbec3c&lang.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CurrentRefinements.vue_vue&type=template&id=3ffbec3c&lang.js","sources":["../../../../src/components/CurrentRefinements.vue?vue&type=template&id=3ffbec3c&lang.js"],"sourcesContent":["<template>\n <div :class=\"[suit(), noRefinement && suit('', 'noRefinement')]\" v-if=\"state\">\n <slot\n :refine=\"state.refine\"\n :items=\"state.items\"\n :createURL=\"state.createURL\"\n >\n <ul :class=\"suit('list')\">\n <li\n v-for=\"item in state.items\"\n :key=\"item.attribute\"\n :class=\"suit('item')\"\n >\n <slot\n name=\"item\"\n :refine=\"item.refine\"\n :item=\"item\"\n :createURL=\"state.createURL\"\n >\n <span :class=\"suit('label')\">{{ capitalize(item.label) }}: </span>\n <span\n v-for=\"refinement in item.refinements\"\n :key=\"createItemKey(refinement)\"\n :class=\"suit('category')\"\n >\n <slot\n name=\"refinement\"\n :refine=\"item.refine\"\n :refinement=\"refinement\"\n :createURL=\"state.createURL\"\n >\n <span :class=\"suit('categoryLabel')\">\n <q v-if=\"refinement.attribute === 'query'\">{{\n refinement.label\n }}</q>\n <template v-else>\n {{ refinement.label }}\n </template>\n </span>\n <button\n :class=\"suit('delete')\"\n @click=\"item.refine(refinement)\"\n >\n ✕\n </button>\n </slot>\n </span>\n </slot>\n </li>\n </ul>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectCurrentRefinements } from 'instantsearch.js/es/connectors';\n\nimport { createPanelConsumerMixin } from '../mixins/panel';\nimport { createSuitMixin } from '../mixins/suit';\nimport { createWidgetMixin } from '../mixins/widget';\n\nexport default {\n name: 'AisCurrentRefinements',\n mixins: [\n createSuitMixin({ name: 'CurrentRefinements' }),\n createWidgetMixin(\n {\n connector: connectCurrentRefinements,\n },\n {\n $$widgetType: 'ais.currentRefinements',\n }\n ),\n createPanelConsumerMixin(),\n ],\n props: {\n includedAttributes: {\n type: Array,\n default: undefined,\n },\n excludedAttributes: {\n type: Array,\n default: undefined,\n },\n transformItems: {\n type: Function,\n default: undefined,\n },\n },\n computed: {\n noRefinement() {\n return this.state && this.state.items.length === 0;\n },\n widgetParams() {\n return {\n includedAttributes: this.includedAttributes,\n excludedAttributes: this.excludedAttributes,\n transformItems: this.transformItems,\n };\n },\n },\n methods: {\n createItemKey({ attribute, value, type, operator }) {\n return [attribute, type, value, operator].join(':');\n },\n capitalize(value) {\n if (!value) return '';\n return (\n value.toString().charAt(0).toLocaleUpperCase() +\n value.toString().slice(1)\n );\n },\n },\n};\n</script>\n"],"names":["_ctx","_createElementBlock","class","$options","_renderSlot","refine","items","createURL","_createElementVNode","item","key","attribute","label","refinements","refinement","onClick"],"mappings":"+QACyEA,aAAvEC,eAAMC,SAAQF,SAAQG,gBAAgBH,8BACpCI,sBACGC,OAAQL,QAAMK,OACdC,MAAON,QAAMM,MACbC,UAAWP,QAAMO,6BAElBC,QAAKN,QAAOF,yBACVC,WACiBD,QAAMM,eAAdG,cADTR,QAEGS,IAAKD,EAAKE,UACVT,QAAOF,kBAERI,mBAEGC,OAAQI,EAAKJ,OACbI,KAAMA,EACNF,UAAWP,QAAMO,6BAElBC,UAAON,QAAOF,oBAAkBG,aAAWM,EAAKG,QAAS,eACzDX,WACuBQ,EAAKI,qBAAnBC,cADTb,UAEGS,IAAKP,gBAAcW,GACnBZ,QAAOF,sBAERI,yBAEGC,OAAQI,EAAKJ,OACbS,WAAYA,EACZP,UAAWP,QAAMO,6BAElBC,UAAON,QAAOF,qCACHc,EAAWH,eAApBV,UACEa,EAAWF,gBAEbX,iBACKa,EAAWF,oBAGlBJ,YACGN,QAAOF,kBACPe,2BAAON,EAAKJ,OAAOS"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{openBlock as e,createElementBlock as t,normalizeClass as s,renderSlot as a,createElementVNode as i,withModifiers as r,createCommentVNode as n,Fragment as u,renderList as c,toDisplayString as l}from"vue";var f=["href"],o=["href"],g=["href","aria-label","onClick"],P=["href"],L=["href"];function k(k,m,R,b,p,U){return k.state?(e(),t("div",{key:0,class:s(k.suit())},[a(k.$slots,"default",{refine:U.refine,createURL:k.state.createURL,currentRefinement:k.state.currentRefinement,nbHits:k.state.nbHits,nbPages:k.state.nbPages,pages:k.state.pages,isFirstPage:k.state.isFirstPage,isLastPage:k.state.isLastPage},function(){var b,p,v,F;return[i("ul",{class:s(k.suit("list"))},[R.showFirst?(e(),t("li",{key:0,class:s((b={},b[k.suit("item")]=!0,b[k.suit("item","firstPage")]=!0,b[k.suit("item","disabled")]=k.state.isFirstPage,b))},[a(k.$slots,"first",{createURL:function(){return k.state.createURL(0)},isFirstPage:k.state.isFirstPage,refine:function(){return U.refine(0)}},function(){return[k.state.isFirstPage?(e(),t("span",{key:1,class:s(k.suit("link")),"aria-label":"First"},"‹‹",2)):(e(),t("a",{key:0,class:s(k.suit("link")),"aria-label":"First",href:k.state.createURL(0),onClick:m[0]||(m[0]=r(function(e){return U.refine(0)},["prevent"]))},"‹‹",10,f))]})],2)):n("",!0),R.showPrevious?(e(),t("li",{key:1,class:s((p={},p[k.suit("item")]=!0,p[k.suit("item","previousPage")]=!0,p[k.suit("item","disabled")]=k.state.isFirstPage,p))},[a(k.$slots,"previous",{createURL:function(){return k.state.createURL(k.state.currentRefinement-1)},isFirstPage:k.state.isFirstPage,refine:function(){return U.refine(k.state.currentRefinement-1)}},function(){return[k.state.isFirstPage?(e(),t("span",{key:1,class:s(k.suit("link")),"aria-label":"Previous"},"‹",2)):(e(),t("a",{key:0,class:s(k.suit("link")),"aria-label":"Previous",href:k.state.createURL(k.state.currentRefinement-1),onClick:m[1]||(m[1]=r(function(e){return U.refine(k.state.currentRefinement-1)},["prevent"]))},"‹",10,o))]})],2)):n("",!0),(e(!0),t(u,null,c(k.state.pages,function(n){var u;return e(),t("li",{class:s((u={},u[k.suit("item")]=!0,u[k.suit("item","page")]=!0,u[k.suit("item","selected")]=k.state.currentRefinement===n,u)),key:n},[a(k.$slots,"item",{page:n,createURL:function(){return k.state.createURL(n)},isFirstPage:k.state.isFirstPage,isLastPage:k.state.isLastPage,refine:function(){return U.refine(n)}},function(){return[i("a",{class:s(k.suit("link")),href:k.state.createURL(n),"aria-label":"Page "+(n+1),onClick:r(function(e){return U.refine(n)},["prevent"])},l(n+1),11,g)]})],2)}),128)),R.showNext?(e(),t("li",{key:2,class:s((v={},v[k.suit("item")]=!0,v[k.suit("item","nextPage")]=!0,v[k.suit("item","disabled")]=k.state.isLastPage,v))},[a(k.$slots,"next",{createURL:function(){return k.state.createURL(k.state.currentRefinement+1)},isLastPage:k.state.isLastPage,refine:function(){return U.refine(k.state.currentRefinement+1)}},function(){return[k.state.isLastPage?(e(),t("span",{key:1,class:s(k.suit("link")),"aria-label":"Next"},"›",2)):(e(),t("a",{key:0,class:s(k.suit("link")),"aria-label":"Next",href:k.state.createURL(k.state.currentRefinement+1),onClick:m[2]||(m[2]=r(function(e){return U.refine(k.state.currentRefinement+1)},["prevent"]))},"›",10,P))]})],2)):n("",!0),R.showLast?(e(),t("li",{key:3,class:s((F={},F[k.suit("item")]=!0,F[k.suit("item","lastPage")]=!0,F[k.suit("item","disabled")]=k.state.isLastPage,F))},[a(k.$slots,"last",{createURL:function(){return k.state.createURL(k.state.nbPages-1)},isLastPage:k.state.isLastPage,refine:function(){return U.refine(k.state.nbPages-1)}},function(){return[k.state.isLastPage?(e(),t("span",{key:1,class:s(k.suit("link")),"aria-label":"Last"},"››",2)):(e(),t("a",{key:0,class:s(k.suit("link")),"aria-label":"Last",href:k.state.createURL(k.state.nbPages-1),onClick:m[3]||(m[3]=r(function(e){return U.refine(k.state.nbPages-1)},["prevent"]))},"››",10,L))]})],2)):n("",!0)],2)]})],2)):n("",!0)}export{k as render};
|
|
2
|
-
//# sourceMappingURL=Pagination.vue_vue&type=template&id=5a680db4&lang.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.vue_vue&type=template&id=5a680db4&lang.js","sources":["../../../../src/components/Pagination.vue?vue&type=template&id=5a680db4&lang.js"],"sourcesContent":["<template>\n <div v-if=\"state\" :class=\"suit()\">\n <slot\n :refine=\"refine\"\n :createURL=\"state.createURL\"\n :current-refinement=\"state.currentRefinement\"\n :nb-hits=\"state.nbHits\"\n :nb-pages=\"state.nbPages\"\n :pages=\"state.pages\"\n :is-first-page=\"state.isFirstPage\"\n :is-last-page=\"state.isLastPage\"\n >\n <ul :class=\"suit('list')\">\n <li\n :class=\"{\n [suit('item')]: true,\n [suit('item', 'firstPage')]: true,\n [suit('item', 'disabled')]: state.isFirstPage,\n }\"\n v-if=\"showFirst\"\n >\n <slot\n name=\"first\"\n :createURL=\"() => state.createURL(0)\"\n :is-first-page=\"state.isFirstPage\"\n :refine=\"() => refine(0)\"\n >\n <template v-if=\"!state.isFirstPage\">\n <a\n :class=\"suit('link')\"\n aria-label=\"First\"\n :href=\"state.createURL(0)\"\n @click.prevent=\"refine(0)\"\n >‹‹</a\n >\n </template>\n <template v-else>\n <span :class=\"suit('link')\" aria-label=\"First\">‹‹</span>\n </template>\n </slot>\n </li>\n <li\n :class=\"{\n [suit('item')]: true,\n [suit('item', 'previousPage')]: true,\n [suit('item', 'disabled')]: state.isFirstPage,\n }\"\n v-if=\"showPrevious\"\n >\n <slot\n name=\"previous\"\n :createURL=\"() => state.createURL(state.currentRefinement - 1)\"\n :is-first-page=\"state.isFirstPage\"\n :refine=\"() => refine(state.currentRefinement - 1)\"\n >\n <template v-if=\"!state.isFirstPage\">\n <a\n :class=\"suit('link')\"\n aria-label=\"Previous\"\n :href=\"state.createURL(state.currentRefinement - 1)\"\n @click.prevent=\"refine(state.currentRefinement - 1)\"\n >‹</a\n >\n </template>\n <template v-else>\n <span :class=\"suit('link')\" aria-label=\"Previous\">‹</span>\n </template>\n </slot>\n </li>\n\n <li\n :class=\"{\n [suit('item')]: true,\n [suit('item', 'page')]: true,\n [suit('item', 'selected')]: state.currentRefinement === page,\n }\"\n v-for=\"page in state.pages\"\n :key=\"page\"\n >\n <slot\n name=\"item\"\n :page=\"page\"\n :createURL=\"() => state.createURL(page)\"\n :is-first-page=\"state.isFirstPage\"\n :is-last-page=\"state.isLastPage\"\n :refine=\"() => refine(page)\"\n >\n <a\n :class=\"suit('link')\"\n :href=\"state.createURL(page)\"\n :aria-label=\"`Page ${page + 1}`\"\n @click.prevent=\"refine(page)\"\n >{{ page + 1 }}</a\n >\n </slot>\n </li>\n\n <li\n :class=\"{\n [suit('item')]: true,\n [suit('item', 'nextPage')]: true,\n [suit('item', 'disabled')]: state.isLastPage,\n }\"\n v-if=\"showNext\"\n >\n <slot\n name=\"next\"\n :createURL=\"() => state.createURL(state.currentRefinement + 1)\"\n :is-last-page=\"state.isLastPage\"\n :refine=\"() => refine(state.currentRefinement + 1)\"\n >\n <template v-if=\"!state.isLastPage\">\n <a\n :class=\"suit('link')\"\n aria-label=\"Next\"\n :href=\"state.createURL(state.currentRefinement + 1)\"\n @click.prevent=\"refine(state.currentRefinement + 1)\"\n >›</a\n >\n </template>\n <template v-else>\n <span :class=\"suit('link')\" aria-label=\"Next\">›</span>\n </template>\n </slot>\n </li>\n <li\n :class=\"{\n [suit('item')]: true,\n [suit('item', 'lastPage')]: true,\n [suit('item', 'disabled')]: state.isLastPage,\n }\"\n v-if=\"showLast\"\n >\n <slot\n name=\"last\"\n :createURL=\"() => state.createURL(state.nbPages - 1)\"\n :is-last-page=\"state.isLastPage\"\n :refine=\"() => refine(state.nbPages - 1)\"\n >\n <template v-if=\"!state.isLastPage\">\n <a\n :class=\"suit('link')\"\n aria-label=\"Last\"\n :href=\"state.createURL(state.nbPages - 1)\"\n @click.prevent=\"refine(state.nbPages - 1)\"\n >››</a\n >\n </template>\n <template v-else>\n <span :class=\"suit('link')\" aria-label=\"Last\">››</span>\n </template>\n </slot>\n </li>\n </ul>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectPagination } from 'instantsearch.js/es/connectors';\n\nimport { createPanelConsumerMixin } from '../mixins/panel';\nimport { createSuitMixin } from '../mixins/suit';\nimport { createWidgetMixin } from '../mixins/widget';\n\nexport default {\n name: 'AisPagination',\n mixins: [\n createSuitMixin({ name: 'Pagination' }),\n createWidgetMixin(\n {\n connector: connectPagination,\n },\n {\n $$widgetType: 'ais.pagination',\n }\n ),\n createPanelConsumerMixin(),\n ],\n props: {\n padding: {\n type: Number,\n default: undefined,\n validator(value) {\n return value > 0;\n },\n },\n totalPages: {\n type: Number,\n default: undefined,\n validator(value) {\n return value > 0;\n },\n },\n showFirst: {\n type: Boolean,\n default: true,\n },\n showLast: {\n type: Boolean,\n default: true,\n },\n showNext: {\n type: Boolean,\n default: true,\n },\n showPrevious: {\n type: Boolean,\n default: true,\n },\n },\n computed: {\n widgetParams() {\n return {\n padding: this.padding,\n totalPages: this.totalPages,\n };\n },\n },\n emits: ['page-change'],\n methods: {\n refine(page) {\n const p = Math.min(Math.max(page, 0), this.state.nbPages - 1);\n this.state.refine(p);\n // TODO: do this in a general way\n this.$emit('page-change', p);\n },\n },\n};\n</script>\n"],"names":["_ctx","_createElementBlock","class","_renderSlot","refine","$options","createURL","currentRefinement","nbHits","nbPages","pages","isFirstPage","isLastPage","_createElementVNode","$props","aria-label","href","onClick","page","key"],"mappings":"mUACaA,aAAXC,eAAmBC,QAAOF,YACxBG,sBACGC,OAAQC,SACRC,UAAWN,QAAMM,UACjBC,kBAAoBP,QAAMO,kBAC1BC,OAASR,QAAMQ,OACfC,QAAUT,QAAMS,QAChBC,MAAOV,QAAMU,MACbC,YAAeX,QAAMW,YACrBC,WAAcZ,QAAMY,0CAErBC,QAAKX,QAAOF,kBAOFc,iBANRb,cACGC,2HAODC,oBAEGG,4BAAiBN,QAAMM,cACvBK,YAAeX,QAAMW,YACrBP,yBAAcC,gCAEEL,QAAMW,iBAUrBV,gBAAOC,QAAOF,gBAAce,aAAW,SAAQ,cAT/Cd,aACGC,QAAOF,gBACRe,aAAW,QACVC,KAAMhB,QAAMM,aACZW,yCAAeZ,4BACf,6BAcDS,oBANRb,cACGC,8HAODC,uBAEGG,4BAAiBN,QAAMM,UAAUN,QAAMO,sBACvCI,YAAeX,QAAMW,YACrBP,yBAAcC,SAAOL,QAAMO,yCAEXP,QAAMW,iBAUrBV,gBAAOC,QAAOF,gBAAce,aAAW,YAAW,aATlDd,aACGC,QAAOF,gBACRe,aAAW,WACVC,KAAMhB,QAAMM,UAAUN,QAAMO,qBAC5BU,yCAAeZ,SAAOL,QAAMO,qCAC5B,mCASTN,WAMiBD,QAAMU,eAAdQ,oBANTjB,QACGC,8HAMAiB,IAAKD,IAENf,mBAEGe,KAAMA,EACNZ,4BAAiBN,QAAMM,UAAUY,IACjCP,YAAeX,QAAMW,YACrBC,WAAcZ,QAAMY,WACpBR,yBAAcC,SAAOa,uBAEtBL,OACGX,QAAOF,gBACPgB,KAAMhB,QAAMM,UAAUY,GACtBH,sBAAoBG,KACpBD,6BAAeZ,SAAOa,oBACnBA,0BAWFJ,gBANRb,cACGC,yHAODC,mBAEGG,4BAAiBN,QAAMM,UAAUN,QAAMO,sBACvCK,WAAcZ,QAAMY,WACpBR,yBAAcC,SAAOL,QAAMO,yCAEXP,QAAMY,gBAUrBX,gBAAOC,QAAOF,gBAAce,aAAW,QAAO,aAT9Cd,aACGC,QAAOF,gBACRe,aAAW,OACVC,KAAMhB,QAAMM,UAAUN,QAAMO,qBAC5BU,yCAAeZ,SAAOL,QAAMO,qCAC5B,4BAcDO,gBANRb,cACGC,yHAODC,mBAEGG,4BAAiBN,QAAMM,UAAUN,QAAMS,YACvCG,WAAcZ,QAAMY,WACpBR,yBAAcC,SAAOL,QAAMS,+BAEXT,QAAMY,gBAUrBX,gBAAOC,QAAOF,gBAAce,aAAW,QAAO,cAT9Cd,aACGC,QAAOF,gBACRe,aAAW,OACVC,KAAMhB,QAAMM,UAAUN,QAAMS,WAC5BQ,yCAAeZ,SAAOL,QAAMS,2BAC5B"}
|