@empathyco/x-components
Version:
Empathy X Components
68 lines (65 loc) • 1.94 kB
JavaScript
import { defineComponent, computed } from 'vue';
import '../composables/create-use-device.js';
import { use$x } from '../composables/use-_x.js';
import 'vuex';
import '@vue/devtools-api';
import '../plugins/devtools/timeline.devtools.js';
import '@empathyco/x-utils';
import 'rxjs/operators';
import 'rxjs';
import '../plugins/devtools/colors.utils.js';
import '../plugins/x-bus.js';
import '../plugins/x-plugin.js';
import '@vueuse/core';
import BaseEventButton from './base-event-button.vue.js';
/**
* Component that renders a text with the number of rendered results and
* the remaining ones and a `<BaseEventButton>` with the logic of emitting
* the event "UserReachedResultsListEnd" to load more results on click.
*
* @public
*/
var _sfc_main = defineComponent({
name: 'PageLoaderButton',
components: { BaseEventButton },
props: {
/**
* CSS classes to customize the loader button.
*
* @internal
*/
buttonClasses: {
type: String,
default: '',
},
/**
* Events to customize what will be emitted by the loader button.
*
* @internal
*/
buttonEvents: {
type: Object,
},
},
setup(props) {
const $x = use$x();
const resultsLength = computed(() => $x.results.length);
const totalResults = computed(() => $x.totalResults);
/**
* The events that will be emitted when clicking on the loader button.
*
* @returns The {@link XEvent} to emit.
* @public
*/
const events = computed(() => {
return { UserReachedResultsListEnd: undefined, ...props.buttonEvents };
});
return {
resultsLength,
totalResults,
events,
};
},
});
export { _sfc_main as default };
//# sourceMappingURL=page-loader-button.vue2.js.map