@webitel/ui-sdk 24.10.32 → 24.10.33
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/dist/ui-sdk.js +1 -1
- package/dist/ui-sdk.umd.cjs +1 -1
- package/package.json +1 -1
- package/src/components/wt-intersection-observer/__tests__/WtIntersectionObserver.spec.js +12 -0
- package/src/components/wt-intersection-observer/wt-intersection-observer.vue +56 -0
- package/src/modules/Filters/classes/BaseFilterSchema.js +14 -3
- package/src/modules/Filters/components/filter-select.vue +2 -2
- package/src/modules/Filters/store/FiltersStoreModule.js +4 -1
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import WtIntersectionObserver from '../wt-intersection-observer.vue';
|
|
3
|
+
|
|
4
|
+
describe('WtIntersectionObserver', () => {
|
|
5
|
+
const next = () => true;
|
|
6
|
+
it('renders a component', () => {
|
|
7
|
+
const wrapper = shallowMount(WtIntersectionObserver, {
|
|
8
|
+
props: { next }
|
|
9
|
+
});
|
|
10
|
+
expect(wrapper.exists()).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-loader
|
|
3
|
+
v-if="loading"
|
|
4
|
+
size="sm"
|
|
5
|
+
/>
|
|
6
|
+
<div ref="intersectionTarget" />
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup>
|
|
10
|
+
import { useIntersectionObserver } from '@vueuse/core';
|
|
11
|
+
import { onMounted, onUnmounted, ref } from 'vue';
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
next: {
|
|
15
|
+
type: Function,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
loading: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits([
|
|
25
|
+
'next',
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const intersectionTarget = ref(null);
|
|
29
|
+
|
|
30
|
+
let stopObs;
|
|
31
|
+
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* Note, observer triggers at init, so it should be used also as init function
|
|
36
|
+
* however, current filters module version is initializing list by itself, so we need to refactor filters ASAP
|
|
37
|
+
*/
|
|
38
|
+
const { stop } = useIntersectionObserver(intersectionTarget.value, ([{ isIntersecting }]) => {
|
|
39
|
+
if (isIntersecting && props.next) {
|
|
40
|
+
emit('next');
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
stopObs = stop;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
onUnmounted(() => {
|
|
48
|
+
stopObs();
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style scoped lang="scss">
|
|
53
|
+
.wt-loader {
|
|
54
|
+
margin: var(--spacing-lg) auto;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
localStorageGetter,
|
|
3
|
+
queryGetter,
|
|
4
|
+
valueGetter,
|
|
5
|
+
} from '../scripts/getters/index.js';
|
|
6
|
+
import {
|
|
7
|
+
localStorageRestore,
|
|
8
|
+
queryRestore,
|
|
9
|
+
} from '../scripts/restores/index.js';
|
|
10
|
+
import {
|
|
11
|
+
localStorageSetter,
|
|
12
|
+
querySetter,
|
|
13
|
+
valueSetter,
|
|
14
|
+
} from '../scripts/setters/index.js';
|
|
4
15
|
|
|
5
16
|
const convertGetterArray = (context) => (getters) => {
|
|
6
17
|
const availableGetters = ['value', 'query', 'localStorage'];
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
:close-on-select="!filterSchema.multiple"
|
|
4
4
|
:multiple="filterSchema.multiple"
|
|
5
5
|
:options="options"
|
|
6
|
+
:search-method="search"
|
|
6
7
|
:track-by="trackBy"
|
|
7
8
|
:value="value"
|
|
8
|
-
:search-method="search"
|
|
9
9
|
v-bind="attrs"
|
|
10
10
|
@input="setValue"
|
|
11
11
|
/>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
<script setup>
|
|
15
15
|
|
|
16
|
-
import { computed, reactive,
|
|
16
|
+
import { computed, reactive, useAttrs } from 'vue';
|
|
17
17
|
import { useI18n } from 'vue-i18n';
|
|
18
18
|
import { useStore } from 'vuex';
|
|
19
19
|
import isEmpty from '../../../scripts/isEmpty.js';
|
|
@@ -166,7 +166,10 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
166
166
|
const wildcardListeners = context.state._emitter.all.get('*');
|
|
167
167
|
const eventListeners = context.state._emitter.all.get(event);
|
|
168
168
|
|
|
169
|
-
const listeners = [
|
|
169
|
+
const listeners = [
|
|
170
|
+
...(wildcardListeners || []),
|
|
171
|
+
...(eventListeners || []),
|
|
172
|
+
];
|
|
170
173
|
|
|
171
174
|
if (!listeners) {
|
|
172
175
|
console.info(`No listeners for ${event} event`);
|