diff --git a/packages/x-components/src/x-modules/history-queries/components/clear-history-queries.vue b/packages/x-components/src/x-modules/history-queries/components/clear-history-queries.vue
index dfa8de8c27..ea4a64350a 100644
--- a/packages/x-components/src/x-modules/history-queries/components/clear-history-queries.vue
+++ b/packages/x-components/src/x-modules/history-queries/components/clear-history-queries.vue
@@ -13,15 +13,12 @@
diff --git a/packages/x-components/src/x-modules/history-queries/components/history-queries-switch.vue b/packages/x-components/src/x-modules/history-queries/components/history-queries-switch.vue
index f32ea08109..7ea07c5739 100644
--- a/packages/x-components/src/x-modules/history-queries/components/history-queries-switch.vue
+++ b/packages/x-components/src/x-modules/history-queries/components/history-queries-switch.vue
@@ -3,14 +3,11 @@
diff --git a/packages/x-components/src/x-modules/history-queries/components/history-queries.vue b/packages/x-components/src/x-modules/history-queries/components/history-queries.vue
index fd5fd310a5..6979a83cb6 100644
--- a/packages/x-components/src/x-modules/history-queries/components/history-queries.vue
+++ b/packages/x-components/src/x-modules/history-queries/components/history-queries.vue
@@ -47,13 +47,10 @@
diff --git a/packages/x-components/src/x-modules/history-queries/components/history-query.vue b/packages/x-components/src/x-modules/history-queries/components/history-query.vue
index 05736a0649..98e897c1d7 100644
--- a/packages/x-components/src/x-modules/history-queries/components/history-query.vue
+++ b/packages/x-components/src/x-modules/history-queries/components/history-query.vue
@@ -7,7 +7,7 @@
@property {MouseEvent} event - The original mouse event
-->
import { HistoryQuery as HistoryQueryModel } from '@empathyco/x-types';
- import { Component, Mixins, Prop } from 'vue-property-decorator';
- import { Getter } from '../../../components/decorators/store.decorators';
- import Highlight from '../../../components/highlight.vue';
+ import { computed, defineComponent, PropType } from 'vue';
import BaseSuggestion from '../../../components/suggestions/base-suggestion.vue';
- import { xComponentMixin } from '../../../components/x-component.mixin';
import { XEventsTypes } from '../../../wiring/events.types';
import { historyQueriesXModule } from '../x-module';
- import { dynamicPropsMixin } from '../../../components/dynamic-props.mixin';
+ import { useGetter, useRegisterXModule } from '../../../composables/index';
import RemoveHistoryQuery from './remove-history-query.vue';
/**
@@ -57,41 +54,57 @@
*
* @public
*/
- @Component({
- mixins: [xComponentMixin(historyQueriesXModule)],
- components: { Highlight, RemoveHistoryQuery, BaseSuggestion }
- })
- export default class HistoryQuery extends Mixins(
- dynamicPropsMixin(['removeButtonClass', 'suggestionClass'])
- ) {
- /**
- * The history query suggestion to render.
- *
- * @public
- */
- @Prop({ required: true })
- protected suggestion!: HistoryQueryModel;
-
- /**
- * The normalized query of the history-queries module.
- *
- * @internal
- */
- @Getter('historyQueries', 'normalizedQuery')
- public query!: string;
-
- /**
- * The list of events that are going to be emitted when the suggestion button is pressed.
- *
- * @internal
- * @returns The {@link XEvent} to emit.
- */
- protected get suggestionSelectedEvents(): Partial {
+ export default defineComponent({
+ name: 'HistoryQuery',
+ xModule: historyQueriesXModule.name,
+ components: { RemoveHistoryQuery, BaseSuggestion },
+ props: {
+ /**
+ * The history query suggestion to render.
+ *
+ * @public
+ */
+ suggestion: {
+ type: Object as PropType,
+ required: true
+ },
+ /** Class inherited by content element. */
+ removeButtonClass: String,
+ /** Class inherited by content element. */
+ suggestionClass: String
+ },
+ emits: ['click'],
+ setup(props, { emit }) {
+ useRegisterXModule(historyQueriesXModule);
+
+ /**
+ * The normalized query of the history-queries module.
+ *
+ * @internal
+ */
+ const query = useGetter('historyQueries', ['normalizedQuery']).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((): Partial => {
+ return {
+ UserSelectedAHistoryQuery: props.suggestion
+ };
+ });
+
+ const clickHistoryQuery = () => emit('click', props.suggestion, event);
+
return {
- UserSelectedAHistoryQuery: this.suggestion
+ query,
+ suggestionSelectedEvents,
+ clickHistoryQuery
};
}
- }
+ });
diff --git a/packages/x-components/src/x-modules/history-queries/components/my-history.vue b/packages/x-components/src/x-modules/history-queries/components/my-history.vue
index 8f7135c2ec..c1a7c3fe4b 100644
--- a/packages/x-components/src/x-modules/history-queries/components/my-history.vue
+++ b/packages/x-components/src/x-modules/history-queries/components/my-history.vue
@@ -59,15 +59,13 @@