@empathyco/x-components 3.0.0-alpha.147 → 3.0.0-alpha.148
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 +13 -0
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/design-system/full-theme.css +59 -58
- package/docs/API-reference/api/x-components.md +1 -0
- package/docs/API-reference/api/x-components.nextquerieslist.injectedquery.md +13 -0
- package/docs/API-reference/api/x-components.nextquerieslist.md +1 -0
- package/docs/API-reference/api/x-components.nextquerypreview.md +29 -0
- package/docs/API-reference/api/x-components.nextquerypreview.mounted.md +17 -0
- package/docs/API-reference/api/x-components.nextquerypreview.previewresults.md +13 -0
- package/docs/API-reference/api/x-components.nextquerypreview.suggestion.md +13 -0
- package/docs/API-reference/api/x-components.nextquerypreview.suggestionresults.md +13 -0
- package/docs/API-reference/api/x-components.resultslist.md +9 -0
- package/docs/API-reference/api/x-components.resultslist.providedquery.md +13 -0
- package/docs/API-reference/api/x-components.resultslist.searchquery.md +13 -0
- package/docs/API-reference/api/x-components.resultslist.searchstatus.md +13 -0
- package/docs/API-reference/api/x-components.resultslist.updatequery.md +24 -0
- package/docs/API-reference/components/next-queries/x-components.next-query-preview.md +155 -0
- package/js/components/base-grid.vue.js +2 -2
- package/js/components/base-grid.vue.js.map +1 -1
- package/js/components/decorators/injection.consts.js +8 -2
- package/js/components/decorators/injection.consts.js.map +1 -1
- package/js/index.js +3 -2
- package/js/index.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries-list.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries-list.vue_rollup-plugin-vue_script.vue.js +19 -0
- package/js/x-modules/next-queries/components/next-queries-list.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query-preview.vue.js +94 -0
- package/js/x-modules/next-queries/components/next-query-preview.vue.js.map +1 -0
- package/js/x-modules/next-queries/components/next-query-preview.vue_rollup-plugin-vue_script.vue.js +48 -0
- package/js/x-modules/next-queries/components/next-query-preview.vue_rollup-plugin-vue_script.vue.js.map +1 -0
- package/js/x-modules/next-queries/store/actions/fetch-and-save-next-query-preview.action.js.map +1 -1
- package/js/x-modules/search/components/results-list.vue.js.map +1 -1
- package/js/x-modules/search/components/results-list.vue_rollup-plugin-vue_script.vue.js +33 -2
- package/js/x-modules/search/components/results-list.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/next-queries/index.js +2 -1
- package/package.json +2 -2
- package/report/x-components.api.json +310 -0
- package/report/x-components.api.md +18 -0
- package/types/components/decorators/injection.consts.d.ts +6 -0
- package/types/components/decorators/injection.consts.d.ts.map +1 -1
- package/types/x-modules/next-queries/components/index.d.ts +2 -1
- package/types/x-modules/next-queries/components/index.d.ts.map +1 -1
- package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts +11 -0
- package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts.map +1 -1
- package/types/x-modules/next-queries/components/next-query-preview.vue.d.ts +35 -0
- package/types/x-modules/next-queries/components/next-query-preview.vue.d.ts.map +1 -0
- package/types/x-modules/search/components/results-list.vue.d.ts +21 -0
- package/types/x-modules/search/components/results-list.vue.d.ts.map +1 -1
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.148](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.147...@empathyco/x-components@3.0.0-alpha.148) (2022-08-04)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **next-queries:** add next query preview component (#631)
|
|
11
|
+
([1513ab1](https://github.com/empathyco/x/commit/1513ab1ef0cbcf42d72f483d99815eba76b5eaad)),
|
|
12
|
+
closes [EX-6646](https://searchbroker.atlassian.net/browse/EX-6646)
|
|
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.147](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.146...@empathyco/x-components@3.0.0-alpha.147) (2022-08-03)
|
|
7
20
|
|
|
8
21
|
### ⚠ BREAKING CHANGES
|
package/core/index.js
CHANGED
|
@@ -118,7 +118,7 @@ export { default as SlidingPanel } from '../js/components/sliding-panel.vue.js';
|
|
|
118
118
|
export { default as SnippetCallbacks } from '../js/components/snippet-callbacks.vue.js';
|
|
119
119
|
export { XEmit, XOn } from '../js/components/decorators/bus.decorators.js';
|
|
120
120
|
export { Debounce } from '../js/components/decorators/debounce.decorators.js';
|
|
121
|
-
export { LIST_ITEMS_KEY } from '../js/components/decorators/injection.consts.js';
|
|
121
|
+
export { LIST_ITEMS_KEY, QUERY_KEY } from '../js/components/decorators/injection.consts.js';
|
|
122
122
|
export { XInject, XProvide } from '../js/components/decorators/injection.decorators.js';
|
|
123
123
|
export { Getter, State } from '../js/components/decorators/store.decorators.js';
|
|
124
124
|
export { ItemsListInjectionMixin } from '../js/components/items-list-injection.mixin.js';
|
package/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1445,64 +1445,6 @@
|
|
|
1445
1445
|
--x-size-border-radius-bottom-right-input-card: var(--x-size-border-radius-input-card);
|
|
1446
1446
|
--x-size-border-radius-bottom-left-input-card: var(--x-size-border-radius-input-card);
|
|
1447
1447
|
}
|
|
1448
|
-
[dir="ltr"] .x-input {
|
|
1449
|
-
padding-left: var(--x-size-padding-left-input-default);
|
|
1450
|
-
}
|
|
1451
|
-
[dir="rtl"] .x-input {
|
|
1452
|
-
padding-right: var(--x-size-padding-left-input-default);
|
|
1453
|
-
}
|
|
1454
|
-
[dir="ltr"] .x-input {
|
|
1455
|
-
padding-right: var(--x-size-padding-right-input-default);
|
|
1456
|
-
}
|
|
1457
|
-
[dir="rtl"] .x-input {
|
|
1458
|
-
padding-left: var(--x-size-padding-right-input-default);
|
|
1459
|
-
}
|
|
1460
|
-
[dir="ltr"] .x-input {
|
|
1461
|
-
border-right-width: var(--x-size-border-width-right-input-default);
|
|
1462
|
-
}
|
|
1463
|
-
[dir="rtl"] .x-input {
|
|
1464
|
-
border-left-width: var(--x-size-border-width-right-input-default);
|
|
1465
|
-
}
|
|
1466
|
-
[dir="ltr"] .x-input {
|
|
1467
|
-
border-left-width: var(--x-size-border-width-left-input-default);
|
|
1468
|
-
}
|
|
1469
|
-
[dir="rtl"] .x-input {
|
|
1470
|
-
border-right-width: var(--x-size-border-width-left-input-default);
|
|
1471
|
-
}
|
|
1472
|
-
.x-input {
|
|
1473
|
-
box-sizing: border-box;
|
|
1474
|
-
margin: 0;
|
|
1475
|
-
min-width: 0;
|
|
1476
|
-
height: var(--x-size-height-input-default);
|
|
1477
|
-
padding-top: 0;
|
|
1478
|
-
padding-bottom: 0;
|
|
1479
|
-
background-color: var(--x-color-background-input-default);
|
|
1480
|
-
border-color: var(--x-color-border-input-default);
|
|
1481
|
-
color: var(--x-color-text-input-default);
|
|
1482
|
-
border-top-width: var(--x-size-border-width-top-input-default);
|
|
1483
|
-
border-bottom-width: var(--x-size-border-width-bottom-input-default);
|
|
1484
|
-
border-radius: var(--x-size-border-radius-top-left-input-default) var(--x-size-border-radius-top-right-input-default) var(--x-size-border-radius-bottom-right-input-default) var(--x-size-border-radius-bottom-left-input-default);
|
|
1485
|
-
border-style: solid;
|
|
1486
|
-
font-family: var(--x-font-family-input-default);
|
|
1487
|
-
font-size: var(--x-size-font-input-default);
|
|
1488
|
-
font-weight: var(--x-number-font-weight-input-default);
|
|
1489
|
-
line-height: var(--x-size-line-height-input-default);
|
|
1490
|
-
}
|
|
1491
|
-
@media not all and (min-resolution: 0.001dpcm) {
|
|
1492
|
-
.x-input {
|
|
1493
|
-
-webkit-appearance: none;
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
.x-input:focus {
|
|
1497
|
-
border-color: var(--x-color-border-input-default-focus);
|
|
1498
|
-
}
|
|
1499
|
-
.x-input::placeholder {
|
|
1500
|
-
color: var(--x-color-text-input-placeholder-default);
|
|
1501
|
-
font-family: var(--x-font-family-input-placeholder-default);
|
|
1502
|
-
font-size: var(--x-size-font-input-placeholder-default);
|
|
1503
|
-
font-weight: var(--x-number-font-weight-input-placeholder-default);
|
|
1504
|
-
line-height: var(--x-size-line-height-input-placeholder-default);
|
|
1505
|
-
}
|
|
1506
1448
|
:root {
|
|
1507
1449
|
--x-color-background-input-default: var(--x-color-base-neutral-100);
|
|
1508
1450
|
--x-color-border-input-default: var(--x-color-base-neutral-70);
|
|
@@ -7593,3 +7535,62 @@
|
|
|
7593
7535
|
.x-normal-case {
|
|
7594
7536
|
text-transform: none;
|
|
7595
7537
|
}
|
|
7538
|
+
|
|
7539
|
+
[dir="ltr"] .x-input {
|
|
7540
|
+
padding-left: var(--x-size-padding-left-input-default);
|
|
7541
|
+
}
|
|
7542
|
+
[dir="rtl"] .x-input {
|
|
7543
|
+
padding-right: var(--x-size-padding-left-input-default);
|
|
7544
|
+
}
|
|
7545
|
+
[dir="ltr"] .x-input {
|
|
7546
|
+
padding-right: var(--x-size-padding-right-input-default);
|
|
7547
|
+
}
|
|
7548
|
+
[dir="rtl"] .x-input {
|
|
7549
|
+
padding-left: var(--x-size-padding-right-input-default);
|
|
7550
|
+
}
|
|
7551
|
+
[dir="ltr"] .x-input {
|
|
7552
|
+
border-right-width: var(--x-size-border-width-right-input-default);
|
|
7553
|
+
}
|
|
7554
|
+
[dir="rtl"] .x-input {
|
|
7555
|
+
border-left-width: var(--x-size-border-width-right-input-default);
|
|
7556
|
+
}
|
|
7557
|
+
[dir="ltr"] .x-input {
|
|
7558
|
+
border-left-width: var(--x-size-border-width-left-input-default);
|
|
7559
|
+
}
|
|
7560
|
+
[dir="rtl"] .x-input {
|
|
7561
|
+
border-right-width: var(--x-size-border-width-left-input-default);
|
|
7562
|
+
}
|
|
7563
|
+
.x-input {
|
|
7564
|
+
box-sizing: border-box;
|
|
7565
|
+
margin: 0;
|
|
7566
|
+
min-width: 0;
|
|
7567
|
+
height: var(--x-size-height-input-default);
|
|
7568
|
+
padding-top: 0;
|
|
7569
|
+
padding-bottom: 0;
|
|
7570
|
+
background-color: var(--x-color-background-input-default);
|
|
7571
|
+
border-color: var(--x-color-border-input-default);
|
|
7572
|
+
color: var(--x-color-text-input-default);
|
|
7573
|
+
border-top-width: var(--x-size-border-width-top-input-default);
|
|
7574
|
+
border-bottom-width: var(--x-size-border-width-bottom-input-default);
|
|
7575
|
+
border-radius: var(--x-size-border-radius-top-left-input-default) var(--x-size-border-radius-top-right-input-default) var(--x-size-border-radius-bottom-right-input-default) var(--x-size-border-radius-bottom-left-input-default);
|
|
7576
|
+
border-style: solid;
|
|
7577
|
+
font-family: var(--x-font-family-input-default);
|
|
7578
|
+
font-size: var(--x-size-font-input-default);
|
|
7579
|
+
font-weight: var(--x-number-font-weight-input-default);
|
|
7580
|
+
line-height: var(--x-size-line-height-input-default);
|
|
7581
|
+
}
|
|
7582
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
7583
|
+
.x-input {
|
|
7584
|
+
-webkit-appearance: none;
|
|
7585
|
+
}
|
|
7586
|
+
}
|
|
7587
|
+
.x-input:focus {
|
|
7588
|
+
border-color: var(--x-color-border-input-default-focus);
|
|
7589
|
+
}
|
|
7590
|
+
.x-input::placeholder {
|
|
7591
|
+
color: var(--x-color-text-input-placeholder-default);
|
|
7592
|
+
font-family: var(--x-font-family-input-placeholder-default);
|
|
7593
|
+
font-size: var(--x-size-font-input-placeholder-default);
|
|
7594
|
+
font-weight: var(--x-number-font-weight-input-placeholder-default);
|
|
7595
|
+
line-height: var(--x-size-line-height-input-placeholder-default);
|
|
7596
|
+
}
|
|
@@ -94,6 +94,7 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
94
94
|
| [NextQueries](./x-components.nextqueries.md) | Simple next-queries component that renders a list of suggestions, allowing the user to select one of them, and emitting the needed events. A next query is a suggestion for a new search, related to your previous query. I.e. If people normally search for <code>shirts</code>, and then <code>trousers</code>, <code>trousers</code> would be a next query of <code>shirts</code>. |
|
|
95
95
|
| [NextQueriesList](./x-components.nextquerieslist.md) | Component that inserts groups of next queries in different positions of the injected search items list, based on the provided configuration. |
|
|
96
96
|
| [NextQuery](./x-components.nextquery.md) | Renders a next query item which receives the suggestion that will be rendered as a prop. It exposes a default slot to change the next query content. If the slot is not overridden, it will render the suggestion query by default. |
|
|
97
|
+
| [NextQueryPreview](./x-components.nextquerypreview.md) | Retrieves a preview of the results of a next query and exposes them in the default slot, along with the next query and the totalResults of the search request. By default, it renders the names of the results. |
|
|
97
98
|
| [NumberRangeFilter](./x-components.numberrangefilter.md) | Renders a number range filter, emitting the needed events when clicked. |
|
|
98
99
|
| [OpenMainModal](./x-components.openmainmodal.md) | Button to open the [MainModal](./x-components.mainmodal.md)<!-- -->. |
|
|
99
100
|
| [PartialQueryButton](./x-components.partialquerybutton.md) | A button that when pressed emits the [XEventsTypes.UserAcceptedAQuery](./x-components.xeventstypes.useracceptedaquery.md) and [SearchXEvents.UserClickedPartialQuery](./x-components.searchxevents.userclickedpartialquery.md) events, expressing the user intention to set the partial query. |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [NextQueriesList](./x-components.nextquerieslist.md) > [injectedQuery](./x-components.nextquerieslist.injectedquery.md)
|
|
4
|
+
|
|
5
|
+
## NextQueriesList.injectedQuery property
|
|
6
|
+
|
|
7
|
+
Injected query, updated when the related request(s) have succeeded.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
injectedQuery: string | undefined;
|
|
13
|
+
```
|
|
@@ -19,6 +19,7 @@ export default class NextQueriesList extends NextQueriesList_base
|
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
20
|
| [animation?](./x-components.nextquerieslist.animation.md) | | Vue \| string | <i>(Optional)</i> Animation component that will be used to animate the next queries groups. |
|
|
21
21
|
| [frequency](./x-components.nextquerieslist.frequency.md) | | number | The items cycle size to keep inserting next queries groups at. |
|
|
22
|
+
| [injectedQuery](./x-components.nextquerieslist.injectedquery.md) | | string \| undefined | Injected query, updated when the related request(s) have succeeded. |
|
|
22
23
|
| [maxGroups](./x-components.nextquerieslist.maxgroups.md) | | number | The maximum number of groups to insert into the injected list items list. |
|
|
23
24
|
| [maxNextQueriesPerGroup](./x-components.nextquerieslist.maxnextqueriespergroup.md) | | number | The maximum amount of next queries to add in a single group. |
|
|
24
25
|
| [offset](./x-components.nextquerieslist.offset.md) | | number | The first index to insert a group of next queries at. |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [NextQueryPreview](./x-components.nextquerypreview.md)
|
|
4
|
+
|
|
5
|
+
## NextQueryPreview class
|
|
6
|
+
|
|
7
|
+
Retrieves a preview of the results of a next query and exposes them in the default slot, along with the next query and the totalResults of the search request. By default, it renders the names of the results.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export default class NextQueryPreview extends Vue
|
|
13
|
+
```
|
|
14
|
+
<b>Extends:</b> Vue
|
|
15
|
+
|
|
16
|
+
## Properties
|
|
17
|
+
|
|
18
|
+
| Property | Modifiers | Type | Description |
|
|
19
|
+
| --- | --- | --- | --- |
|
|
20
|
+
| [previewResults](./x-components.nextquerypreview.previewresults.md) | | Dictionary<PreviewResults> | The results preview of the next queries mounted. It is a dictionary, indexed by the next query query. |
|
|
21
|
+
| [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
|
+
|
|
24
|
+
## Methods
|
|
25
|
+
|
|
26
|
+
| Method | Modifiers | Description |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| [mounted()](./x-components.nextquerypreview.mounted.md) | | The component emits the NextQueryPreviewMounted event to retrieve the results preview of the next query. |
|
|
29
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [NextQueryPreview](./x-components.nextquerypreview.md) > [mounted](./x-components.nextquerypreview.mounted.md)
|
|
4
|
+
|
|
5
|
+
## NextQueryPreview.mounted() method
|
|
6
|
+
|
|
7
|
+
The component emits the NextQueryPreviewMounted event to retrieve the results preview of the next query.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
mounted(): void;
|
|
13
|
+
```
|
|
14
|
+
<b>Returns:</b>
|
|
15
|
+
|
|
16
|
+
void
|
|
17
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [NextQueryPreview](./x-components.nextquerypreview.md) > [previewResults](./x-components.nextquerypreview.previewresults.md)
|
|
4
|
+
|
|
5
|
+
## NextQueryPreview.previewResults property
|
|
6
|
+
|
|
7
|
+
The results preview of the next queries mounted. It is a dictionary, indexed by the next query query.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
previewResults: Dictionary<PreviewResults>;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [NextQueryPreview](./x-components.nextquerypreview.md) > [suggestion](./x-components.nextquerypreview.suggestion.md)
|
|
4
|
+
|
|
5
|
+
## NextQueryPreview.suggestion property
|
|
6
|
+
|
|
7
|
+
The next query to retrieve the results preview.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
protected suggestion: NextQuery;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [NextQueryPreview](./x-components.nextquerypreview.md) > [suggestionResults](./x-components.nextquerypreview.suggestionresults.md)
|
|
4
|
+
|
|
5
|
+
## NextQueryPreview.suggestionResults property
|
|
6
|
+
|
|
7
|
+
Gets from the state the results preview of the next query.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
get suggestionResults(): PreviewResults;
|
|
13
|
+
```
|
|
@@ -25,4 +25,13 @@ export default class ResultsList extends Vue implements InfiniteScroll
|
|
|
25
25
|
| --- | --- | --- | --- |
|
|
26
26
|
| [animation](./x-components.resultslist.animation.md) | | Vue \| string | Animation component that will be used to animate the results. |
|
|
27
27
|
| [items](./x-components.resultslist.items.md) | | Result\[\] | The results to render from the state. |
|
|
28
|
+
| [providedQuery](./x-components.resultslist.providedquery.md) | | string | It provides the search query. This query is updated only when the search request has succeeded. |
|
|
29
|
+
| [searchQuery](./x-components.resultslist.searchquery.md) | | string | The query of the search request, taken from the state. |
|
|
30
|
+
| [searchStatus](./x-components.resultslist.searchstatus.md) | | [RequestStatus](./x-components.requeststatus.md) | The status of the search request, taken from the state. |
|
|
31
|
+
|
|
32
|
+
## Methods
|
|
33
|
+
|
|
34
|
+
| Method | Modifiers | Description |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| [updateQuery(status)](./x-components.resultslist.updatequery.md) | | Updates the query to be provided to the child components when the search request has succeeded. |
|
|
28
37
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [ResultsList](./x-components.resultslist.md) > [providedQuery](./x-components.resultslist.providedquery.md)
|
|
4
|
+
|
|
5
|
+
## ResultsList.providedQuery property
|
|
6
|
+
|
|
7
|
+
It provides the search query. This query is updated only when the search request has succeeded.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
providedQuery: string;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [ResultsList](./x-components.resultslist.md) > [searchQuery](./x-components.resultslist.searchquery.md)
|
|
4
|
+
|
|
5
|
+
## ResultsList.searchQuery property
|
|
6
|
+
|
|
7
|
+
The query of the search request, taken from the state.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
searchQuery: string;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [ResultsList](./x-components.resultslist.md) > [searchStatus](./x-components.resultslist.searchstatus.md)
|
|
4
|
+
|
|
5
|
+
## ResultsList.searchStatus property
|
|
6
|
+
|
|
7
|
+
The status of the search request, taken from the state.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
searchStatus: RequestStatus;
|
|
13
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [ResultsList](./x-components.resultslist.md) > [updateQuery](./x-components.resultslist.updatequery.md)
|
|
4
|
+
|
|
5
|
+
## ResultsList.updateQuery() method
|
|
6
|
+
|
|
7
|
+
Updates the query to be provided to the child components when the search request has succeeded.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
updateQuery(status: RequestStatus): void;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| status | [RequestStatus](./x-components.requeststatus.md) | The status of the search request. |
|
|
20
|
+
|
|
21
|
+
<b>Returns:</b>
|
|
22
|
+
|
|
23
|
+
void
|
|
24
|
+
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
title: NextQueryPreview
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# NextQueryPreview
|
|
8
|
+
|
|
9
|
+
Retrieves a preview of the results of a next query and exposes them in the default slot,
|
|
10
|
+
along with the next query and the totalResults of the search request.
|
|
11
|
+
By default, it renders the names of the results.
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| Name | Description | Type | Default |
|
|
16
|
+
| ----------------------- | ----------------------------------------------- | ---------------------- | ------------- |
|
|
17
|
+
| <code>suggestion</code> | The next query to retrieve the results preview. | <code>NextQuery</code> | <code></code> |
|
|
18
|
+
|
|
19
|
+
## Slots
|
|
20
|
+
|
|
21
|
+
| Name | Description | Bindings<br />(name - type - description) |
|
|
22
|
+
| -------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| <code>default</code> | Next Query Preview default slot. | **suggestion** <code>NextQuery</code> - Next Query suggestion data<br />**results** <code>Result[]</code> - The results preview of the next query<br />**totalResults** <code>number</code> - The total results of the search request |
|
|
24
|
+
| <code>result</code> | Next Query Preview result slot. | **result** <code>Result</code> - A Next Query Preview result |
|
|
25
|
+
|
|
26
|
+
## Events
|
|
27
|
+
|
|
28
|
+
This component emits the `NextQueryPreviewMounted` when it is mounted.
|
|
29
|
+
|
|
30
|
+
## See it in action
|
|
31
|
+
|
|
32
|
+
Here you have a basic example of how the NextQueryPreview is rendered. Keep in mind that this
|
|
33
|
+
component is intended to be used overriding its default slot. By default it will only render the
|
|
34
|
+
names of the results.
|
|
35
|
+
|
|
36
|
+
```vue live
|
|
37
|
+
<template>
|
|
38
|
+
<NextQueryPreview :suggestion="suggestion" />
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import { NextQueryPreview } from "@empathyco/x-components/next-queries";
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
name: "NextQueryPreviewDemo",
|
|
46
|
+
components: {
|
|
47
|
+
NextQueryPreview
|
|
48
|
+
},
|
|
49
|
+
data() {
|
|
50
|
+
return {
|
|
51
|
+
suggestion: {
|
|
52
|
+
modelName: "NextQuery",
|
|
53
|
+
query: "tshirt",
|
|
54
|
+
facets: []
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
</script>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Play with the default slot
|
|
63
|
+
|
|
64
|
+
In this example, the results will be rendered inside a sliding panel.
|
|
65
|
+
|
|
66
|
+
```vue live
|
|
67
|
+
<template>
|
|
68
|
+
<NextQueryPreview
|
|
69
|
+
:suggestion="suggestion"
|
|
70
|
+
#default="{ totalResults, results }"
|
|
71
|
+
>
|
|
72
|
+
<p>Total results: {{ totalResults }}</p>
|
|
73
|
+
<SlidingPanel :resetOnContentChange="false">
|
|
74
|
+
<article
|
|
75
|
+
v-for="result in results"
|
|
76
|
+
:key="result.id"
|
|
77
|
+
class="x-result"
|
|
78
|
+
style="max-width: 300px; overflow: hidden"
|
|
79
|
+
>
|
|
80
|
+
<BaseResultLink :result="result">
|
|
81
|
+
<BaseResultImage :result="result" class="x-result__picture" />
|
|
82
|
+
</BaseResultLink>
|
|
83
|
+
<div class="x-result__description">
|
|
84
|
+
<BaseResultLink :result="result">
|
|
85
|
+
<h1 class="x-title3">{{ result.name }}</h1>
|
|
86
|
+
</BaseResultLink>
|
|
87
|
+
</div>
|
|
88
|
+
</article>
|
|
89
|
+
</SlidingPanel>
|
|
90
|
+
</NextQueryPreview>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<script>
|
|
94
|
+
import { NextQueryPreview } from "@empathyco/x-components/next-queries";
|
|
95
|
+
import {
|
|
96
|
+
SlidingPanel,
|
|
97
|
+
BaseResultLink,
|
|
98
|
+
BaseResultImage
|
|
99
|
+
} from "@empathyco/x-components";
|
|
100
|
+
|
|
101
|
+
export default {
|
|
102
|
+
name: "NextQueryPreviewDemoOverridingSlot",
|
|
103
|
+
components: {
|
|
104
|
+
NextQueryPreview,
|
|
105
|
+
SlidingPanel,
|
|
106
|
+
BaseResultLink,
|
|
107
|
+
BaseResultImage
|
|
108
|
+
},
|
|
109
|
+
data() {
|
|
110
|
+
return {
|
|
111
|
+
suggestion: {
|
|
112
|
+
modelName: "NextQuery",
|
|
113
|
+
query: "tshirt",
|
|
114
|
+
facets: []
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
</script>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Play with the result slot
|
|
123
|
+
|
|
124
|
+
The component exposes a slot to override the result content, without modifying the list.
|
|
125
|
+
|
|
126
|
+
In this example, the ID of the results will be rendered along with the name.
|
|
127
|
+
|
|
128
|
+
```vue
|
|
129
|
+
<template>
|
|
130
|
+
<NextQueryPreview :suggestion="suggestion" #result="{ result }">
|
|
131
|
+
<span>{{ result.id }}</span>
|
|
132
|
+
<span>{{ result.name }}</span>
|
|
133
|
+
</NextQueryPreview>
|
|
134
|
+
</template>
|
|
135
|
+
|
|
136
|
+
<script>
|
|
137
|
+
import { NextQueryPreview } from "@empathyco/x-components/next-queries";
|
|
138
|
+
|
|
139
|
+
export default {
|
|
140
|
+
name: "NextQueryPreviewDemoOverridingResultSlot",
|
|
141
|
+
components: {
|
|
142
|
+
NextQueryPreview
|
|
143
|
+
},
|
|
144
|
+
data() {
|
|
145
|
+
return {
|
|
146
|
+
suggestion: {
|
|
147
|
+
modelName: "NextQuery",
|
|
148
|
+
query: "tshirt",
|
|
149
|
+
facets: []
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
</script>
|
|
155
|
+
```
|
|
@@ -57,11 +57,11 @@ __vue_render__._withStripped = true;
|
|
|
57
57
|
/* style */
|
|
58
58
|
const __vue_inject_styles__ = function (inject) {
|
|
59
59
|
if (!inject) return
|
|
60
|
-
inject("data-v-
|
|
60
|
+
inject("data-v-604592d3_0", { source: ".x-base-grid[data-v-604592d3] {\n padding: var(--x-size-padding-grid, 0);\n margin: 0;\n display: grid;\n grid-auto-flow: dense;\n list-style: none;\n}\n.x-base-grid__banner[data-v-604592d3], .x-base-grid__next-queries-group[data-v-604592d3] {\n grid-column-start: 1;\n grid-column-end: -1;\n}", map: undefined, media: undefined });
|
|
61
61
|
|
|
62
62
|
};
|
|
63
63
|
/* scoped */
|
|
64
|
-
const __vue_scope_id__ = "data-v-
|
|
64
|
+
const __vue_scope_id__ = "data-v-604592d3";
|
|
65
65
|
/* module identifier */
|
|
66
66
|
const __vue_module_identifier__ = undefined;
|
|
67
67
|
/* functional template */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-grid.vue.js","sources":["../../../src/components/base-grid.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n :style=\"style\"\n class=\"x-grid x-base-grid\"\n :class=\"cssClasses\"\n tag=\"ul\"\n data-test=\"grid\"\n >\n <li\n v-for=\"{ slotName, item, cssClass } in gridItems\"\n :key=\"item.id\"\n :class=\"cssClass\"\n class=\"x-grid__item x-base-grid__item\"\n >\n <!--\n @slot Customized item rendering. Specifying a slot with the item's modelName will result in\n the item using that slot composition to render.\n @binding {item} item - Item to render\n -->\n <slot v-if=\"$scopedSlots[slotName]\" :name=\"slotName\" :item=\"item\" />\n <!--\n @slot (required) Default item rendering. This slot will be used by default for rendering\n the item without an specific slot implementation.\n @binding {item} item - Item to render\n -->\n <slot v-else :item=\"item\">{{ item.name || item.modelName || item.id || item }}</slot>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { toKebabCase } from '../utils/string';\n import { ListItem, VueCSSClasses } from '../utils/types';\n import { XInject } from './decorators/injection.decorators';\n import { LIST_ITEMS_KEY } from './decorators/injection.consts';\n\n /**\n * The type returned by the gridItems function. Basically it's a list of items with its CSS\n * classes and a slotName.\n *\n * @internal\n */\n interface GridItem {\n slotName: string;\n item: ListItem;\n cssClass: VueCSSClasses;\n }\n\n /**\n * Grid component that is able to render different items based on their modelName value. In order\n * to achieve this, it exposes a scopedSlot for each different modelName. In case the items used\n * do not have modelName property, the default slot is used instead. It has a required property:\n * the `items` to render; and an optional one: the number `columns` the grid is divided in. If the\n * number of columns is not specified, the grid automatically fills the rows with as many columns\n * as it can fit.\n *\n * @public\n */\n @Component({})\n export default class BaseGrid extends Vue {\n /**\n * Animation component that will be used to animate the base grid.\n *\n * @public\n */\n @Prop({ default: 'ul' })\n protected animation!: Vue | string;\n\n /**\n * Number of columns the grid is divided into. By default, its value is 0, setting the grid\n * columns mode to auto-fill.\n *\n * @public\n */\n @Prop({ default: 0 })\n protected columns!: number;\n\n /**\n * The list of items to be rendered.\n *\n * @remarks The items must have an id property.\n *\n * @public\n */\n @Prop()\n protected items!: ListItem[];\n\n /**\n * It injects {@link ListItem} provided by an ancestor.\n *\n * @internal\n */\n @XInject(LIST_ITEMS_KEY)\n public injectedListItems!: ListItem[];\n\n /**\n * It returns the items passed as props or the injected ones.\n *\n * @returns List of grid items.\n *\n * @public\n */\n protected get computedItems(): ListItem[] {\n return (\n this.items ??\n this.injectedListItems ??\n //TODO: add here logger\n //eslint-disable-next-line no-console\n console.warn('It is necessary to pass a prop or inject the list of filters')\n );\n }\n\n /**\n * CSS class based on the column property value so items inside the grid can fill different\n * amount of columns or rows based on how many columns the grid is divided into.\n *\n * @returns CSS class with the column property value.\n *\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return this.columns ? `x-grid--cols-${this.columns}` : 'x-grid--cols-auto';\n }\n\n /**\n * CSSStyleDeclaration object specifying the number of columns the grid is divided into based on\n * the column property value.\n *\n * @returns A CSSStyleDeclaration to use as the style attribute.\n *\n * @internal\n */\n protected get style(): Partial<CSSStyleDeclaration> {\n return {\n gridTemplateColumns: this.columns\n ? `repeat(${this.columns}, minmax(0, 1fr))`\n : 'repeat(auto-fill, minmax(var(--x-size-min-width-grid-item, 150px), 1fr))'\n };\n }\n\n /**\n * Maps the item to an object containing: the `item`, its `CSS class` and its slot name.\n *\n * @returns An array of objects containing the item and its CSS class.\n *\n * @internal\n */\n protected get gridItems(): GridItem[] {\n return this.computedItems.map(item => {\n const slotName = toKebabCase(item.modelName);\n return {\n slotName,\n item,\n cssClass: `x-base-grid__${slotName}`\n };\n });\n }\n }\n</script>\n\n<style lang=\"scss\" scoped>\n .x-base-grid {\n padding: var(--x-size-padding-grid, 0);\n margin: 0;\n display: grid;\n grid-auto-flow: dense;\n list-style: none;\n\n &__banner {\n grid-column-start: 1;\n grid-column-end: -1;\n }\n }\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nThis component renders a list of elements in different slots depending on their modelName. In order\nto achieve this, it exposes a scopedSlot for each different modelName. In case the items used do not\nhave modelName property, the default slot is used instead. It has a required property, the `items`\nto render, and an optional one, the number of `columns` the grid is divided in. If the number of\ncolumns is not specified, the grid automatically fills the rows with as many columns as it can fit.\n\n### Basic example\n\nIt renders a list of items using the default slot:\n\n```vue\n<template>\n <BaseGrid :items=\"items\">\n <template #default=\"{ item }\">\n {{ `Default slot content: ${item.id}` }}\n </template>\n </BaseGrid>\n</template>\n```\n\n### Configuring the number of columns\n\nIt renders a grid with 12 columns instead of 6, which is the default value:\n\n```vue\n<template>\n <BaseGrid :items=\"items\" :columns=\"12\">\n <template #default=\"{ item }\">\n {{ `Default slot content: ${item.id}` }}\n </template>\n </BaseGrid>\n</template>\n```\n\n### Rendering usage\n\nConfiguring the number of columns.\n\nIt renders a list of items using the different scopedSlots created by the item's modelName. For\nexample, if you want to use this component as the search grid, you pass the search results (results,\nbanners, promoted, next queries...etc) as items. Each of these results have a different modelName\nand are rendered in different slots.\n\n```vue\n<template>\n <BaseGrid :animation=\"animation\" :items=\"items\">\n <template #banner=\"{ item }\">\n <span class=\"banner\">\n {{ `${item.title} banner` }}\n </span>\n </template>\n <template #next-queries=\"{ item }\">\n <span>\n {{ `${item.totalResults} next queries` }}\n </span>\n </template>\n <template #promoted=\"{ item }\">\n <span class=\"promoted\">\n {{ `${item.title} promoted` }}\n </span>\n </template>\n <template #result=\"{ item }\">\n <BaseResultLink :result=\"item\">\n {{ item.name }}\n </BaseResultLink>\n </template>\n </BaseGrid>\n</template>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"base-grid.vue.js","sources":["../../../src/components/base-grid.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n :style=\"style\"\n class=\"x-grid x-base-grid\"\n :class=\"cssClasses\"\n tag=\"ul\"\n data-test=\"grid\"\n >\n <li\n v-for=\"{ slotName, item, cssClass } in gridItems\"\n :key=\"item.id\"\n :class=\"cssClass\"\n class=\"x-grid__item x-base-grid__item\"\n >\n <!--\n @slot Customized item rendering. Specifying a slot with the item's modelName will result in\n the item using that slot composition to render.\n @binding {item} item - Item to render\n -->\n <slot v-if=\"$scopedSlots[slotName]\" :name=\"slotName\" :item=\"item\" />\n <!--\n @slot (required) Default item rendering. This slot will be used by default for rendering\n the item without an specific slot implementation.\n @binding {item} item - Item to render\n -->\n <slot v-else :item=\"item\">{{ item.name || item.modelName || item.id || item }}</slot>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { toKebabCase } from '../utils/string';\n import { ListItem, VueCSSClasses } from '../utils/types';\n import { XInject } from './decorators/injection.decorators';\n import { LIST_ITEMS_KEY } from './decorators/injection.consts';\n\n /**\n * The type returned by the gridItems function. Basically it's a list of items with its CSS\n * classes and a slotName.\n *\n * @internal\n */\n interface GridItem {\n slotName: string;\n item: ListItem;\n cssClass: VueCSSClasses;\n }\n\n /**\n * Grid component that is able to render different items based on their modelName value. In order\n * to achieve this, it exposes a scopedSlot for each different modelName. In case the items used\n * do not have modelName property, the default slot is used instead. It has a required property:\n * the `items` to render; and an optional one: the number `columns` the grid is divided in. If the\n * number of columns is not specified, the grid automatically fills the rows with as many columns\n * as it can fit.\n *\n * @public\n */\n @Component({})\n export default class BaseGrid extends Vue {\n /**\n * Animation component that will be used to animate the base grid.\n *\n * @public\n */\n @Prop({ default: 'ul' })\n protected animation!: Vue | string;\n\n /**\n * Number of columns the grid is divided into. By default, its value is 0, setting the grid\n * columns mode to auto-fill.\n *\n * @public\n */\n @Prop({ default: 0 })\n protected columns!: number;\n\n /**\n * The list of items to be rendered.\n *\n * @remarks The items must have an id property.\n *\n * @public\n */\n @Prop()\n protected items!: ListItem[];\n\n /**\n * It injects {@link ListItem} provided by an ancestor.\n *\n * @internal\n */\n @XInject(LIST_ITEMS_KEY)\n public injectedListItems!: ListItem[];\n\n /**\n * It returns the items passed as props or the injected ones.\n *\n * @returns List of grid items.\n *\n * @public\n */\n protected get computedItems(): ListItem[] {\n return (\n this.items ??\n this.injectedListItems ??\n //TODO: add here logger\n //eslint-disable-next-line no-console\n console.warn('It is necessary to pass a prop or inject the list of filters')\n );\n }\n\n /**\n * CSS class based on the column property value so items inside the grid can fill different\n * amount of columns or rows based on how many columns the grid is divided into.\n *\n * @returns CSS class with the column property value.\n *\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return this.columns ? `x-grid--cols-${this.columns}` : 'x-grid--cols-auto';\n }\n\n /**\n * CSSStyleDeclaration object specifying the number of columns the grid is divided into based on\n * the column property value.\n *\n * @returns A CSSStyleDeclaration to use as the style attribute.\n *\n * @internal\n */\n protected get style(): Partial<CSSStyleDeclaration> {\n return {\n gridTemplateColumns: this.columns\n ? `repeat(${this.columns}, minmax(0, 1fr))`\n : 'repeat(auto-fill, minmax(var(--x-size-min-width-grid-item, 150px), 1fr))'\n };\n }\n\n /**\n * Maps the item to an object containing: the `item`, its `CSS class` and its slot name.\n *\n * @returns An array of objects containing the item and its CSS class.\n *\n * @internal\n */\n protected get gridItems(): GridItem[] {\n return this.computedItems.map(item => {\n const slotName = toKebabCase(item.modelName);\n return {\n slotName,\n item,\n cssClass: `x-base-grid__${slotName}`\n };\n });\n }\n }\n</script>\n\n<style lang=\"scss\" scoped>\n .x-base-grid {\n padding: var(--x-size-padding-grid, 0);\n margin: 0;\n display: grid;\n grid-auto-flow: dense;\n list-style: none;\n\n &__banner,\n &__next-queries-group {\n grid-column-start: 1;\n grid-column-end: -1;\n }\n }\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nThis component renders a list of elements in different slots depending on their modelName. In order\nto achieve this, it exposes a scopedSlot for each different modelName. In case the items used do not\nhave modelName property, the default slot is used instead. It has a required property, the `items`\nto render, and an optional one, the number of `columns` the grid is divided in. If the number of\ncolumns is not specified, the grid automatically fills the rows with as many columns as it can fit.\n\n### Basic example\n\nIt renders a list of items using the default slot:\n\n```vue\n<template>\n <BaseGrid :items=\"items\">\n <template #default=\"{ item }\">\n {{ `Default slot content: ${item.id}` }}\n </template>\n </BaseGrid>\n</template>\n```\n\n### Configuring the number of columns\n\nIt renders a grid with 12 columns instead of 6, which is the default value:\n\n```vue\n<template>\n <BaseGrid :items=\"items\" :columns=\"12\">\n <template #default=\"{ item }\">\n {{ `Default slot content: ${item.id}` }}\n </template>\n </BaseGrid>\n</template>\n```\n\n### Rendering usage\n\nConfiguring the number of columns.\n\nIt renders a list of items using the different scopedSlots created by the item's modelName. For\nexample, if you want to use this component as the search grid, you pass the search results (results,\nbanners, promoted, next queries...etc) as items. Each of these results have a different modelName\nand are rendered in different slots.\n\n```vue\n<template>\n <BaseGrid :animation=\"animation\" :items=\"items\">\n <template #banner=\"{ item }\">\n <span class=\"banner\">\n {{ `${item.title} banner` }}\n </span>\n </template>\n <template #next-queries=\"{ item }\">\n <span>\n {{ `${item.totalResults} next queries` }}\n </span>\n </template>\n <template #promoted=\"{ item }\">\n <span class=\"promoted\">\n {{ `${item.title} promoted` }}\n </span>\n </template>\n <template #result=\"{ item }\">\n <BaseResultLink :result=\"item\">\n {{ item.name }}\n </BaseResultLink>\n </template>\n </BaseGrid>\n</template>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
|
-
const LIST_ITEMS_KEY = 'listItems';
|
|
6
|
+
const LIST_ITEMS_KEY = 'listItems';
|
|
7
|
+
/**
|
|
8
|
+
* It's used to identify the provided and injected `query`.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
const QUERY_KEY = 'query';
|
|
7
13
|
|
|
8
|
-
export { LIST_ITEMS_KEY };
|
|
14
|
+
export { LIST_ITEMS_KEY, QUERY_KEY };
|
|
9
15
|
//# sourceMappingURL=injection.consts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injection.consts.js","sources":["../../../../src/components/decorators/injection.consts.ts"],"sourcesContent":["import { ListItem } from '../../utils/types';\nimport { XInjectKey } from './injection.decorators';\n\n/**\n * It's used to identify the provided and injected `items`.\n *\n * @internal\n */\nexport const LIST_ITEMS_KEY: XInjectKey<ListItem[] | undefined> = 'listItems';\n"],"names":[],"mappings":"AAGA;;;;;MAKa,cAAc,GAAuC;;;;"}
|
|
1
|
+
{"version":3,"file":"injection.consts.js","sources":["../../../../src/components/decorators/injection.consts.ts"],"sourcesContent":["import { ListItem } from '../../utils/types';\nimport { XInjectKey } from './injection.decorators';\n\n/**\n * It's used to identify the provided and injected `items`.\n *\n * @internal\n */\nexport const LIST_ITEMS_KEY: XInjectKey<ListItem[] | undefined> = 'listItems';\n\n/**\n * It's used to identify the provided and injected `query`.\n *\n * @internal\n */\nexport const QUERY_KEY: XInjectKey<string | undefined> = 'query';\n"],"names":[],"mappings":"AAGA;;;;;MAKa,cAAc,GAAuC,YAAY;AAE9E;;;;;MAKa,SAAS,GAAmC;;;;"}
|
package/js/index.js
CHANGED
|
@@ -118,7 +118,7 @@ export { default as SlidingPanel } from './components/sliding-panel.vue.js';
|
|
|
118
118
|
export { default as SnippetCallbacks } from './components/snippet-callbacks.vue.js';
|
|
119
119
|
export { XEmit, XOn } from './components/decorators/bus.decorators.js';
|
|
120
120
|
export { Debounce } from './components/decorators/debounce.decorators.js';
|
|
121
|
-
export { LIST_ITEMS_KEY } from './components/decorators/injection.consts.js';
|
|
121
|
+
export { LIST_ITEMS_KEY, QUERY_KEY } from './components/decorators/injection.consts.js';
|
|
122
122
|
export { XInject, XProvide } from './components/decorators/injection.decorators.js';
|
|
123
123
|
export { Getter, State } from './components/decorators/store.decorators.js';
|
|
124
124
|
export { ItemsListInjectionMixin } from './components/items-list-injection.mixin.js';
|
|
@@ -241,8 +241,9 @@ export { identifierResultsXStoreModule } from './x-modules/identifier-results/st
|
|
|
241
241
|
export { cancelFetchAndSaveIdentifierResultsWire, clearIdentifierResultsQuery, fetchAndSaveIdentifierResultsWire, identifierResultsWiring, saveIdentifierResultsOriginWire, setIdentifierResultsExtraParams, setIdentifierResultsQuery } from './x-modules/identifier-results/wiring.js';
|
|
242
242
|
export { identifierResultsXModule } from './x-modules/identifier-results/x-module.js';
|
|
243
243
|
export { default as NextQueries } from './x-modules/next-queries/components/next-queries.vue.js';
|
|
244
|
-
export { default as NextQuery } from './x-modules/next-queries/components/next-query.vue.js';
|
|
245
244
|
export { default as NextQueriesList } from './x-modules/next-queries/components/next-queries-list.vue.js';
|
|
245
|
+
export { default as NextQuery } from './x-modules/next-queries/components/next-query.vue.js';
|
|
246
|
+
export { default as NextQueryPreview } from './x-modules/next-queries/components/next-query-preview.vue.js';
|
|
246
247
|
export { cancelFetchAndSaveNextQueries, fetchAndSaveNextQueries } from './x-modules/next-queries/store/actions/fetch-and-save-next-queries.action.js';
|
|
247
248
|
export { fetchNextQueries } from './x-modules/next-queries/store/actions/fetch-next-queries.action.js';
|
|
248
249
|
export { setQueryFromLastHistoryQuery } from './x-modules/next-queries/store/actions/set-query-from-last-history-query.action.js';
|
package/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|