@empathyco/x-components
Version:
Empathy X Components
59 lines (56 loc) • 1.83 kB
JavaScript
import { defineComponent, computed } from 'vue';
import BaseSuggestion from '../../../components/suggestions/base-suggestion.vue.js';
import { useGetter } from '../../../composables/use-getter.js';
import { historyQueriesXModule } from '../x-module.js';
import RemoveHistoryQuery from './remove-history-query.vue.js';
/**
* This component renders a history query suggestion combining two buttons: one for selecting this
* suggestion as the search query, and another one to remove this query suggestion from the
* history queries.
*
* @public
*/
var _sfc_main = defineComponent({
name: 'HistoryQuery',
xModule: historyQueriesXModule.name,
components: { RemoveHistoryQuery, BaseSuggestion },
props: {
/**
* The history query suggestion to render.
*
* @public
*/
suggestion: {
type: Object,
required: true,
},
/** Class inherited by content element. */
removeButtonClass: String,
/** Class inherited by content element. */
suggestionClass: String,
},
emits: ['click'],
setup(props) {
/**
* The normalized query of the history-queries module.
*
* @internal
*/
const query = useGetter('historyQueries').normalizedQuery;
/**
* The list of events that are going to be emitted when the suggestion button is pressed.
*
* @internal
* @returns The {@link XEvent} to emit.
*/
const suggestionSelectedEvents = computed(() => ({
UserSelectedAHistoryQuery: props.suggestion,
}));
return {
query,
suggestionSelectedEvents,
};
},
});
export { _sfc_main as default };
//# sourceMappingURL=history-query.vue2.js.map