@empathyco/x-components 3.0.0-alpha.152 → 3.0.0-alpha.153

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/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.0-alpha.153](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.152...@empathyco/x-components@3.0.0-alpha.153) (2022-08-10)
7
+
8
+ ### Features
9
+
10
+ - **next-queries:** add `maxItemsToRender` prop to `NextQueryPreview` component (#646)
11
+ ([848427c](https://github.com/empathyco/x/commit/848427cb9dae85c72549ab026b3785194ec4adbd)),
12
+ closes [EX-6820](https://searchbroker.atlassian.net/browse/EX-6820)
13
+
14
+ # Change Log
15
+
16
+ All notable changes to this project will be documented in this file. See
17
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
18
+
6
19
  ## [3.0.0-alpha.152](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.151...@empathyco/x-components@3.0.0-alpha.152) (2022-08-10)
7
20
 
8
21
  ### ⚠ BREAKING CHANGES
@@ -677,6 +677,9 @@
677
677
  .x-dropdown.x-dropdown--m {
678
678
  --x-size-width-dropdown-toggle-default: var(--x-size-width-dropdown-m);
679
679
  }
680
+ :root {
681
+ --x-size-width-dropdown-m: 130px;
682
+ }
680
683
  .x-dropdown--pill {
681
684
  --x-size-gap-dropdown-default: var(--x-size-gap-dropdown-pill);
682
685
  --x-size-border-radius-top-left-dropdown-default: calc(
@@ -3068,9 +3071,6 @@
3068
3071
  --x-number-font-weight-option-list-button-default: var(--x-number-font-weight-base-regular);
3069
3072
  --x-number-font-weight-option-list-button-default-selected: var(--x-number-font-weight-base-bold);
3070
3073
  }
3071
- :root {
3072
- --x-size-width-dropdown-m: 130px;
3073
- }
3074
3074
  .x-picture--card.x-picture {
3075
3075
  --x-size-border-radius-picture-default: var(--x-size-border-radius-picture-card);
3076
3076
  --x-size-border-radius-top-picture-default: var(--x-size-border-radius-top-picture-card);
@@ -3526,6 +3526,14 @@
3526
3526
  .x-row--padding-06 {
3527
3527
  --x-size-padding-row: var(--x-size-padding-row-06);
3528
3528
  }
3529
+ /* @deprecated */
3530
+ :root {
3531
+ --x-size-padding-row-02: var(--x-size-base-02);
3532
+ --x-size-padding-row-03: var(--x-size-base-03);
3533
+ --x-size-padding-row-04: var(--x-size-base-04);
3534
+ --x-size-padding-row-05: var(--x-size-base-05);
3535
+ --x-size-padding-row-06: var(--x-size-base-06);
3536
+ }
3529
3537
  .x-scroll {
3530
3538
  overflow-y: var(--x-string-overflow-scroll);
3531
3539
  }
@@ -3552,14 +3560,6 @@
3552
3560
  --x-color-thumb-scroll-bar: var(--x-color-thumb-scroll-bar-hover);
3553
3561
  }
3554
3562
  }
3555
- /* @deprecated */
3556
- :root {
3557
- --x-size-padding-row-02: var(--x-size-base-02);
3558
- --x-size-padding-row-03: var(--x-size-base-03);
3559
- --x-size-padding-row-04: var(--x-size-base-04);
3560
- --x-size-padding-row-05: var(--x-size-base-05);
3561
- --x-size-padding-row-06: var(--x-size-base-06);
3562
- }
3563
3563
  :root {
3564
3564
  --x-string-overflow-scroll: auto;
3565
3565
  --x-color-background-scroll-bar: transparent;
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [NextQueryPreview](./x-components.nextquerypreview.md) &gt; [maxItemsToRender](./x-components.nextquerypreview.maxitemstorender.md)
4
+
5
+ ## NextQueryPreview.maxItemsToRender property
6
+
7
+ Number of suggestion results to be rendered.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ protected maxItemsToRender?: number;
13
+ ```
@@ -17,9 +17,10 @@ export default class NextQueryPreview extends Vue
17
17
 
18
18
  | Property | Modifiers | Type | Description |
19
19
  | --- | --- | --- | --- |
20
+ | [maxItemsToRender?](./x-components.nextquerypreview.maxitemstorender.md) | | number | <i>(Optional)</i> Number of suggestion results to be rendered. |
20
21
  | [previewResults](./x-components.nextquerypreview.previewresults.md) | | Dictionary&lt;PreviewResults&gt; | The results preview of the next queries mounted. It is a dictionary, indexed by the next query query. |
21
22
  | [suggestion](./x-components.nextquerypreview.suggestion.md) | | NextQuery | The next query to retrieve the results preview. |
22
- | [suggestionResults](./x-components.nextquerypreview.suggestionresults.md) | | PreviewResults | Gets from the state the results preview of the next query. |
23
+ | [suggestionResults](./x-components.nextquerypreview.suggestionresults.md) | | PreviewResults \| undefined | Gets from the state the results preview of the next query. |
23
24
 
24
25
  ## Methods
25
26
 
@@ -9,5 +9,5 @@ Gets from the state the results preview of the next query.
9
9
  <b>Signature:</b>
10
10
 
11
11
  ```typescript
12
- get suggestionResults(): PreviewResults;
12
+ get suggestionResults(): PreviewResults | undefined;
13
13
  ```
@@ -12,9 +12,10 @@ By default, it renders the names of the results.
12
12
 
13
13
  ## Props
14
14
 
15
- | Name | Description | Type | Default |
16
- | ----------------------- | ----------------------------------------------- | ---------------------- | ------------- |
17
- | <code>suggestion</code> | The next query to retrieve the results preview. | <code>NextQuery</code> | <code></code> |
15
+ | Name | Description | Type | Default |
16
+ | ----------------------------- | ----------------------------------------------- | ---------------------- | ------------- |
17
+ | <code>suggestion</code> | The next query to retrieve the results preview. | <code>NextQuery</code> | <code></code> |
18
+ | <code>maxItemsToRender</code> | Number of suggestion results to be rendered. | <code>number</code> | <code></code> |
18
19
 
19
20
  ## Slots
20
21
 
@@ -153,3 +154,52 @@ export default {
153
154
  };
154
155
  </script>
155
156
  ```
157
+
158
+ ### Play with props
159
+
160
+ In this example, the suggestions has been limited to render a maximum of 4 items.
161
+
162
+ ```vue
163
+ <template>
164
+ <NextQueryPreview
165
+ :maxItemsToRender="maxItemsToRender"
166
+ :suggestion="suggestion"
167
+ #default="{ results }"
168
+ >
169
+ <BaseGrid #default="{ item }" :items="results">
170
+ <BaseResultLink :result="item">
171
+ <BaseResultImage :result="item" />
172
+ </BaseResultLink>
173
+ </BaseGrid>
174
+ </NextQueryPreview>
175
+ </template>
176
+
177
+ <script>
178
+ import {
179
+ BaseGrid,
180
+ BaseResultImage,
181
+ BaseResultLink
182
+ } from "@empathyco/x-components";
183
+ import { NextQueryPreview } from "@empathyco/x-components/next-queries";
184
+
185
+ export default {
186
+ name: "NextQueryPreviewDemo",
187
+ components: {
188
+ BaseGrid,
189
+ BaseResultImage,
190
+ BaseResultLink,
191
+ NextQueryPreview
192
+ },
193
+ data() {
194
+ return {
195
+ maxItemsToRender: 4,
196
+ suggestion: {
197
+ modelName: "NextQuery",
198
+ query: "tshirt",
199
+ facets: []
200
+ }
201
+ };
202
+ }
203
+ };
204
+ </script>
205
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"next-query-preview.vue.js","sources":["../../../../../src/x-modules/next-queries/components/next-query-preview.vue"],"sourcesContent":["<template>\n <ul v-if=\"suggestionResults\" data-test=\"next-query-preview\" class=\"x-next-query-preview\">\n <!--\n @slot Next Query Preview default slot.\n @binding {NextQuery} suggestion - Next Query suggestion data\n @binding {Result[]} results - The results preview of the next query\n @binding {number} totalResults - The total results of the search request\n -->\n <slot\n :suggestion=\"suggestion\"\n :results=\"suggestionResults.items\"\n :totalResults=\"suggestionResults.totalResults\"\n >\n <li\n v-for=\"result in suggestionResults.items\"\n :key=\"result.id\"\n class=\"x-next-query-preview__item\"\n data-test=\"next-query-preview-item\"\n >\n <!--\n @slot Next Query Preview result slot.\n @binding {Result} result - A Next Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </slot>\n </ul>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { NextQuery, PreviewResults } from '@empathyco/x-types';\n import { Dictionary } from '@empathyco/x-utils';\n import { xComponentMixin } from '../../../components/x-component.mixin';\n import { nextQueriesXModule } from '../x-module';\n import { State } from '../../../components/decorators/store.decorators';\n\n /**\n * Retrieves a preview of the results of a next query and exposes them in the default slot,\n * along with the next query and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\n @Component({\n mixins: [xComponentMixin(nextQueriesXModule)]\n })\n export default class NextQueryPreview extends Vue {\n /**\n * The next query to retrieve the results preview.\n *\n * @public\n */\n @Prop({\n required: true\n })\n protected suggestion!: NextQuery;\n\n /**\n * The results preview of the next queries mounted.\n * It is a dictionary, indexed by the next query query.\n */\n @State('nextQueries', 'resultsPreview')\n public previewResults!: Dictionary<PreviewResults>;\n\n /**\n * The component emits the NextQueryPreviewMounted event to retrieve the results preview\n * of the next query.\n */\n mounted(): void {\n this.$x.emit('NextQueryPreviewMounted', this.suggestion.query);\n }\n\n /**\n * Gets from the state the results preview of the next query.\n *\n * @returns The results preview of the actual next query.\n */\n public get suggestionResults(): PreviewResults {\n return this.previewResults[this.suggestion.query];\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the `NextQueryPreviewMounted` when it is mounted.\n\n## See it in action\n\nHere you have a basic example of how the NextQueryPreview is rendered. Keep in mind that this\ncomponent is intended to be used overriding its default slot. By default it will only render the\nnames of the results.\n\n```vue live\n<template>\n <NextQueryPreview :suggestion=\"suggestion\" />\n</template>\n\n<script>\n import { NextQueryPreview } from '@empathyco/x-components/next-queries';\n\n export default {\n name: 'NextQueryPreviewDemo',\n components: {\n NextQueryPreview\n },\n data() {\n return {\n suggestion: {\n modelName: 'NextQuery',\n query: 'tshirt',\n facets: []\n }\n };\n }\n };\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <NextQueryPreview :suggestion=\"suggestion\" #default=\"{ totalResults, results }\">\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </NextQueryPreview>\n</template>\n\n<script>\n import { NextQueryPreview } from '@empathyco/x-components/next-queries';\n import { SlidingPanel, BaseResultLink, BaseResultImage } from '@empathyco/x-components';\n\n export default {\n name: 'NextQueryPreviewDemoOverridingSlot',\n components: {\n NextQueryPreview,\n SlidingPanel,\n BaseResultLink,\n BaseResultImage\n },\n data() {\n return {\n suggestion: {\n modelName: 'NextQuery',\n query: 'tshirt',\n facets: []\n }\n };\n }\n };\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <NextQueryPreview :suggestion=\"suggestion\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </NextQueryPreview>\n</template>\n\n<script>\n import { NextQueryPreview } from '@empathyco/x-components/next-queries';\n\n export default {\n name: 'NextQueryPreviewDemoOverridingResultSlot',\n components: {\n NextQueryPreview\n },\n data() {\n return {\n suggestion: {\n modelName: 'NextQuery',\n query: 'tshirt',\n facets: []\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"next-query-preview.vue.js","sources":["../../../../../src/x-modules/next-queries/components/next-query-preview.vue"],"sourcesContent":["<template>\n <ul v-if=\"suggestionResults\" data-test=\"next-query-preview\" class=\"x-next-query-preview\">\n <!--\n @slot Next Query Preview default slot.\n @binding {NextQuery} suggestion - Next Query suggestion data\n @binding {Result[]} results - The results preview of the next query\n @binding {number} totalResults - The total results of the search request\n -->\n <slot\n :suggestion=\"suggestion\"\n :results=\"suggestionResults.items\"\n :totalResults=\"suggestionResults.totalResults\"\n >\n <li\n v-for=\"result in suggestionResults.items\"\n :key=\"result.id\"\n class=\"x-next-query-preview__item\"\n data-test=\"next-query-preview-item\"\n >\n <!--\n @slot Next Query Preview result slot.\n @binding {Result} result - A Next Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </slot>\n </ul>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { NextQuery, PreviewResults } from '@empathyco/x-types';\n import { Dictionary } from '@empathyco/x-utils';\n import { xComponentMixin } from '../../../components/x-component.mixin';\n import { nextQueriesXModule } from '../x-module';\n import { State } from '../../../components/decorators/store.decorators';\n\n /**\n * Retrieves a preview of the results of a next query and exposes them in the default slot,\n * along with the next query and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\n @Component({\n mixins: [xComponentMixin(nextQueriesXModule)]\n })\n export default class NextQueryPreview extends Vue {\n /**\n * The next query to retrieve the results preview.\n *\n * @public\n */\n @Prop({\n required: true\n })\n protected suggestion!: NextQuery;\n\n /**\n * Number of suggestion results to be rendered.\n *\n * @public\n */\n @Prop()\n protected maxItemsToRender?: number;\n\n /**\n * The results preview of the next queries mounted.\n * It is a dictionary, indexed by the next query query.\n */\n @State('nextQueries', 'resultsPreview')\n public previewResults!: Dictionary<PreviewResults>;\n\n /**\n * The component emits the NextQueryPreviewMounted event to retrieve the results preview\n * of the next query.\n */\n mounted(): void {\n this.$x.emit('NextQueryPreviewMounted', this.suggestion.query);\n }\n\n /**\n * Gets from the state the results preview of the next query.\n *\n * @returns The results preview of the actual next query.\n */\n public get suggestionResults(): PreviewResults | undefined {\n const previewResults = this.previewResults[this.suggestion.query];\n\n return previewResults\n ? {\n ...previewResults,\n items: previewResults.items.slice(0, this.maxItemsToRender)\n }\n : undefined;\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the `NextQueryPreviewMounted` when it is mounted.\n\n## See it in action\n\nHere you have a basic example of how the NextQueryPreview is rendered. Keep in mind that this\ncomponent is intended to be used overriding its default slot. By default it will only render the\nnames of the results.\n\n```vue live\n<template>\n <NextQueryPreview :suggestion=\"suggestion\" />\n</template>\n\n<script>\n import { NextQueryPreview } from '@empathyco/x-components/next-queries';\n\n export default {\n name: 'NextQueryPreviewDemo',\n components: {\n NextQueryPreview\n },\n data() {\n return {\n suggestion: {\n modelName: 'NextQuery',\n query: 'tshirt',\n facets: []\n }\n };\n }\n };\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <NextQueryPreview :suggestion=\"suggestion\" #default=\"{ totalResults, results }\">\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </NextQueryPreview>\n</template>\n\n<script>\n import { NextQueryPreview } from '@empathyco/x-components/next-queries';\n import { SlidingPanel, BaseResultLink, BaseResultImage } from '@empathyco/x-components';\n\n export default {\n name: 'NextQueryPreviewDemoOverridingSlot',\n components: {\n NextQueryPreview,\n SlidingPanel,\n BaseResultLink,\n BaseResultImage\n },\n data() {\n return {\n suggestion: {\n modelName: 'NextQuery',\n query: 'tshirt',\n facets: []\n }\n };\n }\n };\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <NextQueryPreview :suggestion=\"suggestion\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </NextQueryPreview>\n</template>\n\n<script>\n import { NextQueryPreview } from '@empathyco/x-components/next-queries';\n\n export default {\n name: 'NextQueryPreviewDemoOverridingResultSlot',\n components: {\n NextQueryPreview\n },\n data() {\n return {\n suggestion: {\n modelName: 'NextQuery',\n query: 'tshirt',\n facets: []\n }\n };\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the suggestions has been limited to render a maximum of 4 items.\n\n```vue\n<template>\n <NextQueryPreview\n :maxItemsToRender=\"maxItemsToRender\"\n :suggestion=\"suggestion\"\n #default=\"{ results }\"\n >\n <BaseGrid #default=\"{ item }\" :items=\"results\">\n <BaseResultLink :result=\"item\">\n <BaseResultImage :result=\"item\" />\n </BaseResultLink>\n </BaseGrid>\n </NextQueryPreview>\n</template>\n\n<script>\n import { BaseGrid, BaseResultImage, BaseResultLink } from '@empathyco/x-components';\n import { NextQueryPreview } from '@empathyco/x-components/next-queries';\n\n export default {\n name: 'NextQueryPreviewDemo',\n components: {\n BaseGrid,\n BaseResultImage,\n BaseResultLink,\n NextQueryPreview\n },\n data() {\n return {\n maxItemsToRender: 4,\n suggestion: {\n modelName: 'NextQuery',\n query: 'tshirt',\n facets: []\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -26,7 +26,13 @@ let NextQueryPreview = class NextQueryPreview extends Vue {
26
26
  * @returns The results preview of the actual next query.
27
27
  */
28
28
  get suggestionResults() {
29
- return this.previewResults[this.suggestion.query];
29
+ const previewResults = this.previewResults[this.suggestion.query];
30
+ return previewResults
31
+ ? {
32
+ ...previewResults,
33
+ items: previewResults.items.slice(0, this.maxItemsToRender)
34
+ }
35
+ : undefined;
30
36
  }
31
37
  };
32
38
  __decorate([
@@ -34,6 +40,9 @@ __decorate([
34
40
  required: true
35
41
  })
36
42
  ], NextQueryPreview.prototype, "suggestion", void 0);
43
+ __decorate([
44
+ Prop()
45
+ ], NextQueryPreview.prototype, "maxItemsToRender", void 0);
37
46
  __decorate([
38
47
  State('nextQueries', 'resultsPreview')
39
48
  ], NextQueryPreview.prototype, "previewResults", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"next-query-preview.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../../src/x-modules/next-queries/components/next-query-preview.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { NextQuery, PreviewResults } from '@empathyco/x-types';\nimport { Dictionary } from '@empathyco/x-utils';\nimport { xComponentMixin } from '../../../components/x-component.mixin';\nimport { nextQueriesXModule } from '../x-module';\nimport { State } from '../../../components/decorators/store.decorators';\n\n/**\n * Retrieves a preview of the results of a next query and exposes them in the default slot,\n * along with the next query and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\n@Component({\n mixins: [xComponentMixin(nextQueriesXModule)]\n})\nexport default class NextQueryPreview extends Vue {\n /**\n * The next query to retrieve the results preview.\n *\n * @public\n */\n @Prop({\n required: true\n })\n protected suggestion!: NextQuery;\n\n /**\n * The results preview of the next queries mounted.\n * It is a dictionary, indexed by the next query query.\n */\n @State('nextQueries', 'resultsPreview')\n public previewResults!: Dictionary<PreviewResults>;\n\n /**\n * The component emits the NextQueryPreviewMounted event to retrieve the results preview\n * of the next query.\n */\n mounted(): void {\n this.$x.emit('NextQueryPreviewMounted', this.suggestion.query);\n }\n\n /**\n * Gets from the state the results preview of the next query.\n *\n * @returns The results preview of the actual next query.\n */\n public get suggestionResults(): PreviewResults {\n return this.previewResults[this.suggestion.query];\n }\n}\n"],"names":[],"mappings":";;;;;;;AAwCA;;;;;;;AAUA,IAAqB,gBAAgB,GAArC,MAAqB,gBAAiB,SAAQ,GAAG;;;;;IAsB/C,OAAO;QACL,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;KAChE;;;;;;IAOD,IAAW,iBAAiB;QAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;KACnD;CACF,CAAA;AAzBC;IAHC,IAAI,CAAC;QACJ,QAAQ,EAAE,IAAI;KACf,CAAC;oDAC+B;AAOjC;IADC,KAAK,CAAC,aAAa,EAAE,gBAAgB,CAAC;wDACY;AAhBhC,gBAAgB;IAHpC,SAAS,CAAC;QACT,MAAM,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;KAC9C,CAAC;GACmB,gBAAgB,CAkCpC;aAlCoB,gBAAgB;;;;"}
1
+ {"version":3,"file":"next-query-preview.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../../src/x-modules/next-queries/components/next-query-preview.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { NextQuery, PreviewResults } from '@empathyco/x-types';\nimport { Dictionary } from '@empathyco/x-utils';\nimport { xComponentMixin } from '../../../components/x-component.mixin';\nimport { nextQueriesXModule } from '../x-module';\nimport { State } from '../../../components/decorators/store.decorators';\n\n/**\n * Retrieves a preview of the results of a next query and exposes them in the default slot,\n * along with the next query and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\n@Component({\n mixins: [xComponentMixin(nextQueriesXModule)]\n})\nexport default class NextQueryPreview extends Vue {\n /**\n * The next query to retrieve the results preview.\n *\n * @public\n */\n @Prop({\n required: true\n })\n protected suggestion!: NextQuery;\n\n /**\n * Number of suggestion results to be rendered.\n *\n * @public\n */\n @Prop()\n protected maxItemsToRender?: number;\n\n /**\n * The results preview of the next queries mounted.\n * It is a dictionary, indexed by the next query query.\n */\n @State('nextQueries', 'resultsPreview')\n public previewResults!: Dictionary<PreviewResults>;\n\n /**\n * The component emits the NextQueryPreviewMounted event to retrieve the results preview\n * of the next query.\n */\n mounted(): void {\n this.$x.emit('NextQueryPreviewMounted', this.suggestion.query);\n }\n\n /**\n * Gets from the state the results preview of the next query.\n *\n * @returns The results preview of the actual next query.\n */\n public get suggestionResults(): PreviewResults | undefined {\n const previewResults = this.previewResults[this.suggestion.query];\n\n return previewResults\n ? {\n ...previewResults,\n items: previewResults.items.slice(0, this.maxItemsToRender)\n }\n : undefined;\n }\n}\n"],"names":[],"mappings":";;;;;;;AAwCA;;;;;;;AAUA,IAAqB,gBAAgB,GAArC,MAAqB,gBAAiB,SAAQ,GAAG;;;;;IA8B/C,OAAO;QACL,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;KAChE;;;;;;IAOD,IAAW,iBAAiB;QAC1B,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAElE,OAAO,cAAc;cACjB;gBACE,GAAG,cAAc;gBACjB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC;aAC5D;cACD,SAAS,CAAC;KACf;CACF,CAAA;AAxCC;IAHC,IAAI,CAAC;QACJ,QAAQ,EAAE,IAAI;KACf,CAAC;oDAC+B;AAQjC;IADC,IAAI,EAAE;0DAC6B;AAOpC;IADC,KAAK,CAAC,aAAa,EAAE,gBAAgB,CAAC;wDACY;AAxBhC,gBAAgB;IAHpC,SAAS,CAAC;QACT,MAAM,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;KAC9C,CAAC;GACmB,gBAAgB,CAiDpC;aAjDoB,gBAAgB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-components",
3
- "version": "3.0.0-alpha.152",
3
+ "version": "3.0.0-alpha.153",
4
4
  "description": "Empathy X Components",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -125,5 +125,5 @@
125
125
  "access": "public",
126
126
  "directory": "dist"
127
127
  },
128
- "gitHead": "478dd99614dd1a5b666df9193cb3666aa2d1b6c0"
128
+ "gitHead": "bd382b4a1cbf85f43f1a9091f63caa328edcf719"
129
129
  }
@@ -27845,6 +27845,33 @@
27845
27845
  "releaseTag": "Public",
27846
27846
  "name": "NextQueryPreview",
27847
27847
  "members": [
27848
+ {
27849
+ "kind": "Property",
27850
+ "canonicalReference": "@empathyco/x-components!NextQueryPreview#maxItemsToRender:member",
27851
+ "docComment": "/**\n * Number of suggestion results to be rendered.\n *\n * @public\n */\n",
27852
+ "excerptTokens": [
27853
+ {
27854
+ "kind": "Content",
27855
+ "text": "protected maxItemsToRender?: "
27856
+ },
27857
+ {
27858
+ "kind": "Content",
27859
+ "text": "number"
27860
+ },
27861
+ {
27862
+ "kind": "Content",
27863
+ "text": ";"
27864
+ }
27865
+ ],
27866
+ "isOptional": true,
27867
+ "releaseTag": "Public",
27868
+ "name": "maxItemsToRender",
27869
+ "propertyTypeTokenRange": {
27870
+ "startIndex": 1,
27871
+ "endIndex": 2
27872
+ },
27873
+ "isStatic": false
27874
+ },
27848
27875
  {
27849
27876
  "kind": "Method",
27850
27877
  "canonicalReference": "@empathyco/x-components!NextQueryPreview#mounted:member(1)",
@@ -27957,6 +27984,10 @@
27957
27984
  "text": "PreviewResults",
27958
27985
  "canonicalReference": "@empathyco/x-components!PreviewResults:interface"
27959
27986
  },
27987
+ {
27988
+ "kind": "Content",
27989
+ "text": " | undefined"
27990
+ },
27960
27991
  {
27961
27992
  "kind": "Content",
27962
27993
  "text": ";"
@@ -27967,7 +27998,7 @@
27967
27998
  "name": "suggestionResults",
27968
27999
  "propertyTypeTokenRange": {
27969
28000
  "startIndex": 1,
27970
- "endIndex": 2
28001
+ "endIndex": 3
27971
28002
  },
27972
28003
  "isStatic": false
27973
28004
  }
@@ -2600,10 +2600,11 @@ export class NextQuery extends Vue_2 {
2600
2600
 
2601
2601
  // @public
2602
2602
  export class NextQueryPreview extends Vue_2 {
2603
+ protected maxItemsToRender?: number;
2603
2604
  mounted(): void;
2604
2605
  previewResults: Dictionary<PreviewResults>;
2605
2606
  protected suggestion: NextQuery_2;
2606
- get suggestionResults(): PreviewResults;
2607
+ get suggestionResults(): PreviewResults | undefined;
2607
2608
  }
2608
2609
 
2609
2610
  // @public
@@ -15,6 +15,12 @@ export default class NextQueryPreview extends Vue {
15
15
  * @public
16
16
  */
17
17
  protected suggestion: NextQuery;
18
+ /**
19
+ * Number of suggestion results to be rendered.
20
+ *
21
+ * @public
22
+ */
23
+ protected maxItemsToRender?: number;
18
24
  /**
19
25
  * The results preview of the next queries mounted.
20
26
  * It is a dictionary, indexed by the next query query.
@@ -30,6 +36,6 @@ export default class NextQueryPreview extends Vue {
30
36
  *
31
37
  * @returns The results preview of the actual next query.
32
38
  */
33
- get suggestionResults(): PreviewResults;
39
+ get suggestionResults(): PreviewResults | undefined;
34
40
  }
35
41
  //# sourceMappingURL=next-query-preview.vue?rollup-plugin-vue=script.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-query-preview.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/next-queries/components/next-query-preview.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AAgCA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKhD;;;;;;GAMG;AAIH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,GAAG;IAC/C;;;;OAIG;IAIH,SAAS,CAAC,UAAU,EAAG,SAAS,CAAC;IAEjC;;;OAGG;IAEI,cAAc,EAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAEnD;;;OAGG;IACH,OAAO,IAAI,IAAI;IAIf;;;;OAIG;IACH,IAAW,iBAAiB,IAAI,cAAc,CAE7C;CACF"}
1
+ {"version":3,"file":"next-query-preview.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/next-queries/components/next-query-preview.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AAgCA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKhD;;;;;;GAMG;AAIH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,GAAG;IAC/C;;;;OAIG;IAIH,SAAS,CAAC,UAAU,EAAG,SAAS,CAAC;IAEjC;;;;OAIG;IAEH,SAAS,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAEpC;;;OAGG;IAEI,cAAc,EAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAEnD;;;OAGG;IACH,OAAO,IAAI,IAAI;IAIf;;;;OAIG;IACH,IAAW,iBAAiB,IAAI,cAAc,GAAG,SAAS,CASzD;CACF"}