@empathyco/x-components
Version:
Empathy X Components
65 lines (62 loc) • 2.01 kB
JavaScript
import { defineComponent, provide, computed } from 'vue';
import { identifierResultsXModule } from '../x-module.js';
import { AnimationProp } from '../../../types/animation-prop.js';
import { useState } from '../../../composables/use-state.js';
/**
* Paints the list of identifier results stored in the state. Each identifier result should be
* represented by a {@link IdentifierResult} component besides any
* other component.
*
* @public
*/
var _sfc_main = defineComponent({
name: 'IdentifierResults',
xModule: identifierResultsXModule.name,
props: {
/**
* Animation component that will be used to animate the identifier results.
*
* @public
*/
animation: {
type: AnimationProp,
default: 'ul'
},
/**
* Number of identifier results to render.
*
* @public
*/
maxItemsToRender: Number
},
setup: function (props) {
/**
* The module's list of identifier results.
*
* @public
*/
const { identifierResults } = useState('identifierResults', ['identifierResults']);
/**
* The additional events to be emitted by the mandatory {@link BaseResultLink} component.
*
* @public
*/
provide('resultClickExtraEvents', [
'UserClickedAIdentifierResult'
]);
/**
* Slices the identifier results from the state.
*
* @returns - The list of identifier results sliced by the number of items to render.
*
* @internal
*/
const identifierResultsToRender = computed(() => identifierResults.value.slice(0, props.maxItemsToRender));
return {
identifierResults,
identifierResultsToRender
};
}
});
export { _sfc_main as default };
//# sourceMappingURL=identifier-results.vue2.js.map