@empathyco/x-components 3.0.0-alpha.68 → 3.0.0-alpha.70
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 +22 -0
- package/core/index.js.map +1 -1
- package/design-system/full-theme.css +14 -15
- package/docs/API-reference/api/x-components.md +1 -0
- package/docs/API-reference/api/x-components.myhistory.animation.md +13 -0
- package/docs/API-reference/api/x-components.myhistory.md +25 -0
- package/docs/API-reference/components/history-queries/x-components.history-queries.md +131 -32
- package/docs/API-reference/components/history-queries/x-components.my-history.md +157 -0
- package/history-queries/index.js +1 -0
- package/js/components/suggestions/base-suggestion.vue.js.map +1 -1
- package/js/components/suggestions/base-suggestion.vue_rollup-plugin-vue_script.vue.js +1 -1
- package/js/components/suggestions/base-suggestion.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/index.js +1 -0
- package/js/index.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/my-history.vue.js +117 -0
- package/js/x-modules/history-queries/components/my-history.vue.js.map +1 -0
- package/js/x-modules/history-queries/components/my-history.vue_rollup-plugin-vue_script.vue.js +38 -0
- package/js/x-modules/history-queries/components/my-history.vue_rollup-plugin-vue_script.vue.js.map +1 -0
- package/package.json +2 -2
- package/report/x-components.api.json +57 -0
- package/report/x-components.api.md +7 -0
- package/types/x-modules/history-queries/components/index.d.ts +1 -0
- package/types/x-modules/history-queries/components/index.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/my-history.vue.d.ts +28 -0
- package/types/x-modules/history-queries/components/my-history.vue.d.ts.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.70](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.69...@empathyco/x-components@3.0.0-alpha.70) (2022-03-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @empathyco/x-components
|
|
9
|
+
|
|
10
|
+
# Change Log
|
|
11
|
+
|
|
12
|
+
All notable changes to this project will be documented in this file. See
|
|
13
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
14
|
+
|
|
15
|
+
## [3.0.0-alpha.69](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.68...@empathyco/x-components@3.0.0-alpha.69) (2022-03-18)
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
- **history-queries:** add `my-history` component
|
|
20
|
+
([a7de7f2](https://github.com/empathyco/x/commit/a7de7f297251bf4290787e362f46b2ab3ec6a428)),
|
|
21
|
+
closes [EX-3582](https://searchbroker.atlassian.net/browse/EX-3582)
|
|
22
|
+
|
|
23
|
+
# Change Log
|
|
24
|
+
|
|
25
|
+
All notable changes to this project will be documented in this file. See
|
|
26
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
27
|
+
|
|
6
28
|
## [3.0.0-alpha.68](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.67...@empathyco/x-components@3.0.0-alpha.68) (2022-03-16)
|
|
7
29
|
|
|
8
30
|
### Bug Fixes
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -100,6 +100,20 @@
|
|
|
100
100
|
--x-number-font-weight-badge-default: var(--x-number-font-weight-base-regular);
|
|
101
101
|
--x-size-font-badge-default: var(--x-size-font-base-xs);
|
|
102
102
|
}
|
|
103
|
+
.x-button--card.x-button,
|
|
104
|
+
.x-button--card .x-button {
|
|
105
|
+
--x-size-border-radius-button-default: var(--x-size-border-radius-button-card);
|
|
106
|
+
--x-size-border-radius-top-left-button-default: var(--x-size-border-radius-top-left-button-card);
|
|
107
|
+
--x-size-border-radius-top-right-button-default: var(
|
|
108
|
+
--x-size-border-radius-top-right-button-card
|
|
109
|
+
);
|
|
110
|
+
--x-size-border-radius-bottom-right-button-default: var(
|
|
111
|
+
--x-size-border-radius-bottom-right-button-card
|
|
112
|
+
);
|
|
113
|
+
--x-size-border-radius-bottom-left-button-default: var(
|
|
114
|
+
--x-size-border-radius-bottom-left-button-card
|
|
115
|
+
);
|
|
116
|
+
}
|
|
103
117
|
:root {
|
|
104
118
|
--x-size-border-radius-button-card: var(--x-size-border-radius-base-s);
|
|
105
119
|
--x-size-border-radius-top-left-button-card: var(--x-size-border-radius-button-card);
|
|
@@ -7552,18 +7566,3 @@
|
|
|
7552
7566
|
.x-normal-case {
|
|
7553
7567
|
text-transform: none;
|
|
7554
7568
|
}
|
|
7555
|
-
|
|
7556
|
-
.x-button--card.x-button,
|
|
7557
|
-
.x-button--card .x-button {
|
|
7558
|
-
--x-size-border-radius-button-default: var(--x-size-border-radius-button-card);
|
|
7559
|
-
--x-size-border-radius-top-left-button-default: var(--x-size-border-radius-top-left-button-card);
|
|
7560
|
-
--x-size-border-radius-top-right-button-default: var(
|
|
7561
|
-
--x-size-border-radius-top-right-button-card
|
|
7562
|
-
);
|
|
7563
|
-
--x-size-border-radius-bottom-right-button-default: var(
|
|
7564
|
-
--x-size-border-radius-bottom-right-button-card
|
|
7565
|
-
);
|
|
7566
|
-
--x-size-border-radius-bottom-left-button-default: var(
|
|
7567
|
-
--x-size-border-radius-bottom-left-button-card
|
|
7568
|
-
);
|
|
7569
|
-
}
|
|
@@ -86,6 +86,7 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
86
86
|
| [MainScroll](./x-components.mainscroll.md) | Extends the scroll making it able to sync the first visible element, and allowing the children position to be restored.<!-- -->Each child element that wants to have this support must be wrapped in a [MainScrollItem](./x-components.mainscrollitem.md) component. |
|
|
87
87
|
| [MainScrollItem](./x-components.mainscrollitem.md) | Wrapper for elements contained in the [MainScroll](./x-components.mainscroll.md) that should store/restore its position. |
|
|
88
88
|
| [MultiColumnMaxWidthLayout](./x-components.multicolumnmaxwidthlayout.md) | Component for use as Layout to be filled with the rest of the Components. |
|
|
89
|
+
| [MyHistory](./x-components.myhistory.md) | This component renders the complete list of suggestions coming from the user queries history. |
|
|
89
90
|
| [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>. |
|
|
90
91
|
| [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. |
|
|
91
92
|
| [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. |
|
|
@@ -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) > [MyHistory](./x-components.myhistory.md) > [animation](./x-components.myhistory.animation.md)
|
|
4
|
+
|
|
5
|
+
## MyHistory.animation property
|
|
6
|
+
|
|
7
|
+
Animation component that will be used to animate the suggestions.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
protected animation: Vue;
|
|
13
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [MyHistory](./x-components.myhistory.md)
|
|
4
|
+
|
|
5
|
+
## MyHistory class
|
|
6
|
+
|
|
7
|
+
This component renders the complete list of suggestions coming from the user queries history.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export default class MyHistory extends Vue
|
|
13
|
+
```
|
|
14
|
+
<b>Extends:</b> Vue
|
|
15
|
+
|
|
16
|
+
## Remarks
|
|
17
|
+
|
|
18
|
+
Allows the user to select one of them, emitting the needed events. A history query is just another type of suggestion that contains a query that the user has made in the past.
|
|
19
|
+
|
|
20
|
+
## Properties
|
|
21
|
+
|
|
22
|
+
| Property | Modifiers | Type | Description |
|
|
23
|
+
| --- | --- | --- | --- |
|
|
24
|
+
| [animation](./x-components.myhistory.animation.md) | | Vue | Animation component that will be used to animate the suggestions. |
|
|
25
|
+
|
|
@@ -27,55 +27,154 @@ made in the past.
|
|
|
27
27
|
| <code>suggestion-content</code> | History Query content | **suggestion** <code>Suggestion</code> - History Query suggestion data<br />**index** <code>number</code> - History Query suggestion index<br />**queryHTML** <code>string</code> - Suggestion's query with the matching part inside a span tag |
|
|
28
28
|
| <code>suggestion-remove-content</code> | History Query remove button content | **suggestion** <code>Suggestion</code> - History Query suggestion data<br />**index** <code>number</code> - History Query suggestion index |
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Events
|
|
31
31
|
|
|
32
|
-
This component
|
|
32
|
+
This component doesn't emit events.
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
## See it in action
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Here you have a basic example of how the HistoryQueries is rendered.
|
|
37
37
|
|
|
38
38
|
```vue
|
|
39
|
-
<
|
|
39
|
+
<template>
|
|
40
|
+
<HistoryQueries />
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
import { HistoryQueries } from "@empathyco/x-components/history-queries";
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
name: "HistoryQueriesDemo",
|
|
48
|
+
components: {
|
|
49
|
+
HistoryQueries
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
40
53
|
```
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
### Play with props
|
|
56
|
+
|
|
57
|
+
In this example, the history queries have been limited to render a maximum of 10 queries (by default
|
|
58
|
+
it is 5).
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<template>
|
|
62
|
+
<HistoryQueries :maxItemsToRender="10" />
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
import { HistoryQueries } from "@empathyco/x-components/history-queries";
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
name: "HistoryQueriesDemo",
|
|
70
|
+
components: {
|
|
71
|
+
HistoryQueries
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
</script>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Play with the animation
|
|
78
|
+
|
|
79
|
+
```vue
|
|
80
|
+
<template>
|
|
81
|
+
<HistoryQueries :animation="fadeAndSlide" />
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script>
|
|
85
|
+
import { HistoryQueries } from "@empathyco/x-components/history-queries";
|
|
86
|
+
import { FadeAndSlide } from "@empathyco/x-components";
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
name: "HistoryQueriesDemo",
|
|
90
|
+
components: {
|
|
91
|
+
HistoryQueries
|
|
92
|
+
},
|
|
93
|
+
data() {
|
|
94
|
+
return {
|
|
95
|
+
fadeAndSlide: FadeAndSlide
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
</script>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Play with suggestion slot
|
|
103
|
+
|
|
104
|
+
In this example, the [`HistoryQuery`](./x-components.history-query.md) component is passed in the
|
|
105
|
+
`suggestion` slot (although any other component could potentially be passed).
|
|
44
106
|
|
|
45
107
|
```vue
|
|
46
|
-
<
|
|
108
|
+
<template>
|
|
109
|
+
<HistoryQueries #suggestion="{ suggestion }">
|
|
110
|
+
<HistoryQuery :suggestion="suggestion"></HistoryQuery>
|
|
111
|
+
</HistoryQueries>
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<script>
|
|
115
|
+
import {
|
|
116
|
+
HistoryQueries,
|
|
117
|
+
HistoryQuery
|
|
118
|
+
} from "@empathyco/x-components/history-queries";
|
|
119
|
+
|
|
120
|
+
export default {
|
|
121
|
+
name: "HistoryQueriesDemo",
|
|
122
|
+
components: {
|
|
123
|
+
HistoryQueries,
|
|
124
|
+
HistoryQuery
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
</script>
|
|
47
128
|
```
|
|
48
129
|
|
|
49
|
-
###
|
|
130
|
+
### Play with suggestion-content slot
|
|
50
131
|
|
|
51
|
-
|
|
52
|
-
`suggestion` slot
|
|
53
|
-
|
|
54
|
-
to be implemented emitting the needed events.
|
|
132
|
+
To continue the previous example, the [`HistoryQuery`](./x-components.history-query.md) component is
|
|
133
|
+
passed in the `suggestion-content` slot, but in addition, an HTML span tag for the text are also
|
|
134
|
+
passed.
|
|
55
135
|
|
|
56
136
|
```vue
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
137
|
+
<template>
|
|
138
|
+
<HistoryQueries #suggestion-content="{ suggestion }">
|
|
139
|
+
<span>{{ suggestion.query }}</span>
|
|
140
|
+
</HistoryQueries>
|
|
141
|
+
</template>
|
|
142
|
+
|
|
143
|
+
<script>
|
|
144
|
+
import { HistoryQueries } from "@empathyco/x-components/history-queries";
|
|
145
|
+
|
|
146
|
+
export default {
|
|
147
|
+
name: "HistoryQueriesDemo",
|
|
148
|
+
components: {
|
|
149
|
+
HistoryQueries
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
</script>
|
|
63
153
|
```
|
|
64
154
|
|
|
65
|
-
###
|
|
155
|
+
### Play with suggestion-content-remove slot
|
|
66
156
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
157
|
+
To continue the previous example, the [`HistoryQuery`](./x-components.history-query.md) component is
|
|
158
|
+
passed in the `suggestion-content` slot, but in addition, a cross icon is also passed to change the
|
|
159
|
+
icon to remove the history query.
|
|
70
160
|
|
|
71
161
|
```vue
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
162
|
+
<template>
|
|
163
|
+
<HistoryQueries #suggestion-content-remove="{ suggestion }">
|
|
164
|
+
<CrossIcon />
|
|
165
|
+
</HistoryQueries>
|
|
166
|
+
</template>
|
|
167
|
+
|
|
168
|
+
<script>
|
|
169
|
+
import { HistoryQueries } from "@empathyco/x-components/history-queries";
|
|
170
|
+
import { CrossIcon } from "@empathyco/x-components";
|
|
171
|
+
|
|
172
|
+
export default {
|
|
173
|
+
name: "HistoryQueriesDemo",
|
|
174
|
+
components: {
|
|
175
|
+
HistoryQueries,
|
|
176
|
+
CrossIcon
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
</script>
|
|
81
180
|
```
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
title: MyHistory
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MyHistory
|
|
8
|
+
|
|
9
|
+
This component renders the complete list of suggestions coming from the user queries history.
|
|
10
|
+
|
|
11
|
+
Allows the user to select one of them, emitting the needed events.
|
|
12
|
+
A history query is just another type of suggestion that contains a query that the user has
|
|
13
|
+
made in the past.
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
| Name | Description | Type | Default |
|
|
18
|
+
| ---------------------- | ----------------------------------------------------------------- | ---------------- | ------------- |
|
|
19
|
+
| <code>animation</code> | Animation component that will be used to animate the suggestions. | <code>Vue</code> | <code></code> |
|
|
20
|
+
|
|
21
|
+
## Slots
|
|
22
|
+
|
|
23
|
+
| Name | Description | Bindings<br />(name - type - description) |
|
|
24
|
+
| -------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
25
|
+
| <code>suggestion</code> | History Query item | **suggestion** <code>Suggestion</code> - History Query suggestion data<br />**index** <code>number</code> - History Query suggestion index |
|
|
26
|
+
| <code>suggestion-content</code> | History Query content | **suggestion** <code>Suggestion</code> - History Query suggestion data<br />**index** <code>number</code> - History Query suggestion index |
|
|
27
|
+
| <code>suggestion-remove-content</code> | History Query remove button content | **suggestion** <code>Suggestion</code> - History Query suggestion data<br />**index** <code>number</code> - History Query suggestion index |
|
|
28
|
+
|
|
29
|
+
## Events
|
|
30
|
+
|
|
31
|
+
This component doesn't emit events.
|
|
32
|
+
|
|
33
|
+
## See it in action
|
|
34
|
+
|
|
35
|
+
Here you have a basic example of how the MyHistory is rendered.
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<MyHistory />
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import { MyHistory } from "@empathyco/x-components/history-queries";
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
name: "MyHistoryDemo",
|
|
47
|
+
components: {
|
|
48
|
+
MyHistory
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Play with the animation
|
|
55
|
+
|
|
56
|
+
```vue
|
|
57
|
+
<template>
|
|
58
|
+
<MyHistory :animation="fadeAndSlide" />
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script>
|
|
62
|
+
import { MyHistory } from "@empathyco/x-components/history-queries";
|
|
63
|
+
import { FadeAndSlide } from "@empathyco/x-components";
|
|
64
|
+
|
|
65
|
+
export default {
|
|
66
|
+
name: "MyHistoryDemo",
|
|
67
|
+
components: {
|
|
68
|
+
MyHistory
|
|
69
|
+
},
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
fadeAndSlide: FadeAndSlide
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
</script>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Play with suggestion slot
|
|
80
|
+
|
|
81
|
+
In this example, the [`HistoryQuery`](./x-components.history-query.md) component is passed in the
|
|
82
|
+
`suggestion` slot (although any other component could potentially be passed).
|
|
83
|
+
|
|
84
|
+
```vue
|
|
85
|
+
<template>
|
|
86
|
+
<MyHistory #suggestion="{ suggestion }">
|
|
87
|
+
<HistoryQuery :suggestion="suggestion"></HistoryQuery>
|
|
88
|
+
</MyHistory>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<script>
|
|
92
|
+
import {
|
|
93
|
+
MyHistory,
|
|
94
|
+
HistoryQuery
|
|
95
|
+
} from "@empathyco/x-components/history-queries";
|
|
96
|
+
|
|
97
|
+
export default {
|
|
98
|
+
name: "MyHistoryDemo",
|
|
99
|
+
components: {
|
|
100
|
+
MyHistory,
|
|
101
|
+
HistoryQuery
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
</script>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Play with suggestion-content slot
|
|
108
|
+
|
|
109
|
+
To continue the previous example, the [`HistoryQuery`](./x-components.history-query.md) component is
|
|
110
|
+
passed in the `suggestion-content` slot, but in addition, an HTML span tag for the text are also
|
|
111
|
+
passed.
|
|
112
|
+
|
|
113
|
+
```vue
|
|
114
|
+
<template>
|
|
115
|
+
<MyHistory #suggestion-content="{ suggestion }">
|
|
116
|
+
<span>{{ suggestion.query }}</span>
|
|
117
|
+
</MyHistory>
|
|
118
|
+
</template>
|
|
119
|
+
|
|
120
|
+
<script>
|
|
121
|
+
import { MyHistory } from "@empathyco/x-components/history-queries";
|
|
122
|
+
|
|
123
|
+
export default {
|
|
124
|
+
name: "MyHistoryDemo",
|
|
125
|
+
components: {
|
|
126
|
+
MyHistory
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
</script>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Play with suggestion-content-remove slot
|
|
133
|
+
|
|
134
|
+
To continue the previous example, the [`HistoryQuery`](./x-components.history-query.md) component is
|
|
135
|
+
passed in the `suggestion-content` slot, but in addition, a cross icon is also passed to change the
|
|
136
|
+
icon to remove the history query.
|
|
137
|
+
|
|
138
|
+
```vue
|
|
139
|
+
<template>
|
|
140
|
+
<MyHistory #suggestion-content-remove="{ suggestion }">
|
|
141
|
+
<CrossIcon />
|
|
142
|
+
</MyHistory>
|
|
143
|
+
</template>
|
|
144
|
+
|
|
145
|
+
<script>
|
|
146
|
+
import { MyHistory } from "@empathyco/x-components/history-queries";
|
|
147
|
+
import { CrossIcon } from "@empathyco/x-components";
|
|
148
|
+
|
|
149
|
+
export default {
|
|
150
|
+
name: "MyHistoryDemo",
|
|
151
|
+
components: {
|
|
152
|
+
MyHistory,
|
|
153
|
+
CrossIcon
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
</script>
|
|
157
|
+
```
|
package/history-queries/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as ClearHistoryQueries } from '../js/x-modules/history-queries/components/clear-history-queries.vue.js';
|
|
2
2
|
export { default as HistoryQueries } from '../js/x-modules/history-queries/components/history-queries.vue.js';
|
|
3
3
|
export { default as HistoryQuery } from '../js/x-modules/history-queries/components/history-query.vue.js';
|
|
4
|
+
export { default as MyHistory } from '../js/x-modules/history-queries/components/my-history.vue.js';
|
|
4
5
|
export { default as RemoveHistoryQuery } from '../js/x-modules/history-queries/components/remove-history-query.vue.js';
|
|
5
6
|
export { AddQueryToHistoryAction, addQueryToHistory } from '../js/x-modules/history-queries/store/actions/add-query-to-history.action.js';
|
|
6
7
|
export { loadHistoryQueriesFromBrowserStorage } from '../js/x-modules/history-queries/store/actions/load-history-queries-from-browser-storage.action.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-suggestion.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue"],"sourcesContent":["<template>\n <button @click=\"emitEvents\" :class=\"dynamicCSSClasses\" class=\"x-suggestion\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Button content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {string} queryHTML - Suggestion's query with the matching part inside a `<span>` tag\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ suggestion, queryHTML }\">\n <span v-html=\"queryHTML\" :aria-label=\"suggestion.query\" class=\"x-suggestion__query\" />\n </slot>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { Suggestion } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { QueryFeature } from '../../types/origin';\n import { forEach } from '../../utils/object';\n import { normalizeString } from '../../utils/normalize';\n import { sanitize } from '../../utils/sanitize';\n import { VueCSSClasses } from '../../utils/types';\n import { XEventsTypes } from '../../wiring/events.types';\n\n /**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent | XEvents} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\n @Component\n export default class BaseSuggestion extends Vue {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n @Prop({ default: '' })\n protected query!: string;\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestion!: Suggestion;\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n @Prop() //TODO: set to true when the suggestions components pass it.\n protected feature?: QueryFeature;\n\n /**\n * The {@link XEvent | XEvents} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestionSelectedEvents!: Partial<XEventsTypes>;\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n @Prop({ default: false, type: Boolean })\n protected highlightCurated!: boolean;\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * * UserAcceptedAQuery: suggestion.query\n * * UserSelectedASuggestion: suggestion\n * * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent | XEvents} to emit.\n * @public\n */\n protected get events(): Partial<XEventsTypes> {\n return {\n UserAcceptedAQuery: this.suggestion.query,\n UserSelectedASuggestion: this.suggestion,\n ...this.suggestionSelectedEvents\n };\n }\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n protected emitEvents(): void {\n forEach(this.events, (event, payload) => {\n this.$x.emit(event, payload, {\n target: this.$el as HTMLElement,\n feature: this.feature\n });\n });\n }\n\n /**\n * Checks if the normalized suggestion query matches with the module's query so it has a\n * matching part.\n *\n * @returns If the query has a matching part or not.\n * @internal\n */\n protected get hasMatchingQuery(): boolean {\n return !!this.query && normalizeString(this.suggestion.query).includes(this.query);\n }\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n protected get shouldHighlightCurated(): boolean {\n return this.highlightCurated && !!this.suggestion.isCurated;\n }\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n protected get dynamicCSSClasses(): VueCSSClasses {\n return {\n 'x-suggestion--matching': this.hasMatchingQuery,\n 'x-suggestion--is-curated': this.shouldHighlightCurated
|
|
1
|
+
{"version":3,"file":"base-suggestion.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue"],"sourcesContent":["<template>\n <button @click=\"emitEvents\" :class=\"dynamicCSSClasses\" class=\"x-suggestion\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Button content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {string} queryHTML - Suggestion's query with the matching part inside a `<span>` tag\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ suggestion, queryHTML }\">\n <span v-html=\"queryHTML\" :aria-label=\"suggestion.query\" class=\"x-suggestion__query\" />\n </slot>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { Suggestion } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { QueryFeature } from '../../types/origin';\n import { forEach } from '../../utils/object';\n import { normalizeString } from '../../utils/normalize';\n import { sanitize } from '../../utils/sanitize';\n import { VueCSSClasses } from '../../utils/types';\n import { XEventsTypes } from '../../wiring/events.types';\n\n /**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent | XEvents} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\n @Component\n export default class BaseSuggestion extends Vue {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n @Prop({ default: '' })\n protected query!: string;\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestion!: Suggestion;\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n @Prop() //TODO: set to true when the suggestions components pass it.\n protected feature?: QueryFeature;\n\n /**\n * The {@link XEvent | XEvents} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestionSelectedEvents!: Partial<XEventsTypes>;\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n @Prop({ default: false, type: Boolean })\n protected highlightCurated!: boolean;\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * * UserAcceptedAQuery: suggestion.query\n * * UserSelectedASuggestion: suggestion\n * * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent | XEvents} to emit.\n * @public\n */\n protected get events(): Partial<XEventsTypes> {\n return {\n UserAcceptedAQuery: this.suggestion.query,\n UserSelectedASuggestion: this.suggestion,\n ...this.suggestionSelectedEvents\n };\n }\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n protected emitEvents(): void {\n forEach(this.events, (event, payload) => {\n this.$x.emit(event, payload, {\n target: this.$el as HTMLElement,\n feature: this.feature\n });\n });\n }\n\n /**\n * Checks if the normalized suggestion query matches with the module's query so it has a\n * matching part.\n *\n * @returns If the query has a matching part or not.\n * @internal\n */\n protected get hasMatchingQuery(): boolean {\n return !!this.query && normalizeString(this.suggestion.query).includes(this.query);\n }\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n protected get shouldHighlightCurated(): boolean {\n return this.highlightCurated && !!this.suggestion.isCurated;\n }\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n protected get dynamicCSSClasses(): VueCSSClasses {\n return {\n 'x-suggestion--matching': this.hasMatchingQuery,\n 'x-suggestion--is-curated': this.shouldHighlightCurated\n };\n }\n\n /**\n * Highlights the matching part of the suggestion query with the query passed as prop of the\n * component putting it inside a `<span>` tag.\n *\n * @remarks\n * The query prop should be normalized.\n *\n * @returns The suggestion's query with the matching part inside a `<span>` tag.\n * @public\n */\n protected get queryHTML(): string {\n if (this.hasMatchingQuery) {\n const matcherIndex = normalizeString(this.suggestion.query).indexOf(this.query);\n\n const [beginning, matching, end] = this.splitAt(\n this.suggestion.query,\n matcherIndex,\n this.query.length\n );\n\n const attrsMatching = 'data-test=\"matching-part\" class=\"x-suggestion__matching-part\"';\n return `${beginning}<span ${attrsMatching}>${matching}</span>${end}`;\n }\n\n return sanitize(this.suggestion.query);\n }\n\n /**\n * Splits the label in three parts based on two indexes.\n *\n * @param label - The string that will be divided in three parts.\n * @param start - The first index that the label will be divided by.\n * @param skip - The second index that the label will be divided by.\n *\n * @returns The three parts of the divided label.\n * @internal\n */\n protected splitAt(label: string, start: number, skip: number): [string, string, string] {\n const startPart = label.substr(0, start);\n const matchingPart = label.substr(start, skip);\n const endPart = label.substr(start + skip);\n\n return [sanitize(startPart), sanitize(matchingPart), sanitize(endPart)];\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThis default suggestion component expects a suggestion to render and pass to its default slot, a\nnormalized query to compare with the suggestion's query and highlight its matching parts and events\nto emit when the suggestion is selected.\n\n### Default usage\n\n```vue\n<BaseSuggestion v-bind=\"{ query, suggestion, suggestionSelectedEvents }\" />\n```\n\n### Customized usage\n\n```vue\n<BaseSuggestion v-bind=\"{ query, suggestion, suggestionSelectedEvents }\">\n <template #default=\"{ suggestion, queryHTML }\">\n <span\n class=\"my-suggestion\"\n v-html=\"queryHTML\"\n :aria-label=\"suggestion.query\"\n />\n </template>\n</BaseSuggestion>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserAcceptedAQuery`: the event is emitted after the user clicks the button. The event payload is\n the suggestion query data.\n- `UserSelectedASuggestion`: the event is emitted after the user clicks the button. The event\n payload is the suggestion data.\n- The component can emit more events on click using the `suggestionSelectedEvents` prop.\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -78,7 +78,7 @@ let BaseSuggestion = class BaseSuggestion extends Vue {
|
|
|
78
78
|
get dynamicCSSClasses() {
|
|
79
79
|
return {
|
|
80
80
|
'x-suggestion--matching': this.hasMatchingQuery,
|
|
81
|
-
'x-suggestion--is-curated': this.shouldHighlightCurated
|
|
81
|
+
'x-suggestion--is-curated': this.shouldHighlightCurated
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-suggestion.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { Suggestion } from '@empathyco/x-types';\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { QueryFeature } from '../../types/origin';\nimport { forEach } from '../../utils/object';\nimport { normalizeString } from '../../utils/normalize';\nimport { sanitize } from '../../utils/sanitize';\nimport { VueCSSClasses } from '../../utils/types';\nimport { XEventsTypes } from '../../wiring/events.types';\n\n/**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent | XEvents} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\n@Component\nexport default class BaseSuggestion extends Vue {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n @Prop({ default: '' })\n protected query!: string;\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestion!: Suggestion;\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n @Prop() //TODO: set to true when the suggestions components pass it.\n protected feature?: QueryFeature;\n\n /**\n * The {@link XEvent | XEvents} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestionSelectedEvents!: Partial<XEventsTypes>;\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n @Prop({ default: false, type: Boolean })\n protected highlightCurated!: boolean;\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * * UserAcceptedAQuery: suggestion.query\n * * UserSelectedASuggestion: suggestion\n * * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent | XEvents} to emit.\n * @public\n */\n protected get events(): Partial<XEventsTypes> {\n return {\n UserAcceptedAQuery: this.suggestion.query,\n UserSelectedASuggestion: this.suggestion,\n ...this.suggestionSelectedEvents\n };\n }\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n protected emitEvents(): void {\n forEach(this.events, (event, payload) => {\n this.$x.emit(event, payload, {\n target: this.$el as HTMLElement,\n feature: this.feature\n });\n });\n }\n\n /**\n * Checks if the normalized suggestion query matches with the module's query so it has a\n * matching part.\n *\n * @returns If the query has a matching part or not.\n * @internal\n */\n protected get hasMatchingQuery(): boolean {\n return !!this.query && normalizeString(this.suggestion.query).includes(this.query);\n }\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n protected get shouldHighlightCurated(): boolean {\n return this.highlightCurated && !!this.suggestion.isCurated;\n }\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n protected get dynamicCSSClasses(): VueCSSClasses {\n return {\n 'x-suggestion--matching': this.hasMatchingQuery,\n 'x-suggestion--is-curated': this.shouldHighlightCurated
|
|
1
|
+
{"version":3,"file":"base-suggestion.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { Suggestion } from '@empathyco/x-types';\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { QueryFeature } from '../../types/origin';\nimport { forEach } from '../../utils/object';\nimport { normalizeString } from '../../utils/normalize';\nimport { sanitize } from '../../utils/sanitize';\nimport { VueCSSClasses } from '../../utils/types';\nimport { XEventsTypes } from '../../wiring/events.types';\n\n/**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent | XEvents} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\n@Component\nexport default class BaseSuggestion extends Vue {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n @Prop({ default: '' })\n protected query!: string;\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestion!: Suggestion;\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n @Prop() //TODO: set to true when the suggestions components pass it.\n protected feature?: QueryFeature;\n\n /**\n * The {@link XEvent | XEvents} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestionSelectedEvents!: Partial<XEventsTypes>;\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n @Prop({ default: false, type: Boolean })\n protected highlightCurated!: boolean;\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * * UserAcceptedAQuery: suggestion.query\n * * UserSelectedASuggestion: suggestion\n * * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent | XEvents} to emit.\n * @public\n */\n protected get events(): Partial<XEventsTypes> {\n return {\n UserAcceptedAQuery: this.suggestion.query,\n UserSelectedASuggestion: this.suggestion,\n ...this.suggestionSelectedEvents\n };\n }\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n protected emitEvents(): void {\n forEach(this.events, (event, payload) => {\n this.$x.emit(event, payload, {\n target: this.$el as HTMLElement,\n feature: this.feature\n });\n });\n }\n\n /**\n * Checks if the normalized suggestion query matches with the module's query so it has a\n * matching part.\n *\n * @returns If the query has a matching part or not.\n * @internal\n */\n protected get hasMatchingQuery(): boolean {\n return !!this.query && normalizeString(this.suggestion.query).includes(this.query);\n }\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n protected get shouldHighlightCurated(): boolean {\n return this.highlightCurated && !!this.suggestion.isCurated;\n }\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n protected get dynamicCSSClasses(): VueCSSClasses {\n return {\n 'x-suggestion--matching': this.hasMatchingQuery,\n 'x-suggestion--is-curated': this.shouldHighlightCurated\n };\n }\n\n /**\n * Highlights the matching part of the suggestion query with the query passed as prop of the\n * component putting it inside a `<span>` tag.\n *\n * @remarks\n * The query prop should be normalized.\n *\n * @returns The suggestion's query with the matching part inside a `<span>` tag.\n * @public\n */\n protected get queryHTML(): string {\n if (this.hasMatchingQuery) {\n const matcherIndex = normalizeString(this.suggestion.query).indexOf(this.query);\n\n const [beginning, matching, end] = this.splitAt(\n this.suggestion.query,\n matcherIndex,\n this.query.length\n );\n\n const attrsMatching = 'data-test=\"matching-part\" class=\"x-suggestion__matching-part\"';\n return `${beginning}<span ${attrsMatching}>${matching}</span>${end}`;\n }\n\n return sanitize(this.suggestion.query);\n }\n\n /**\n * Splits the label in three parts based on two indexes.\n *\n * @param label - The string that will be divided in three parts.\n * @param start - The first index that the label will be divided by.\n * @param skip - The second index that the label will be divided by.\n *\n * @returns The three parts of the divided label.\n * @internal\n */\n protected splitAt(label: string, start: number, skip: number): [string, string, string] {\n const startPart = label.substr(0, start);\n const matchingPart = label.substr(start, skip);\n const endPart = label.substr(start + skip);\n\n return [sanitize(startPart), sanitize(matchingPart), sanitize(endPart)];\n }\n}\n"],"names":[],"mappings":";;;;;;;AA0BA;;;;;;;;;AAUA,IAAqB,cAAc,GAAnC,MAAqB,cAAe,SAAQ,GAAG;;;;;;;;;;;;IAoD7C,IAAc,MAAM;QAClB,OAAO;YACL,kBAAkB,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YACzC,uBAAuB,EAAE,IAAI,CAAC,UAAU;YACxC,GAAG,IAAI,CAAC,wBAAwB;SACjC,CAAC;KACH;;;;;;IAOS,UAAU;QAClB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO;YAClC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;gBAC3B,MAAM,EAAE,IAAI,CAAC,GAAkB;gBAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC,CAAC;SACJ,CAAC,CAAC;KACJ;;;;;;;;IASD,IAAc,gBAAgB;QAC5B,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACpF;;;;;;;;IASD,IAAc,sBAAsB;QAClC,OAAO,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;KAC7D;;;;;;;;;;IAWD,IAAc,iBAAiB;QAC7B,OAAO;YACL,wBAAwB,EAAE,IAAI,CAAC,gBAAgB;YAC/C,0BAA0B,EAAE,IAAI,CAAC,sBAAsB;SACxD,CAAC;KACH;;;;;;;;;;;IAYD,IAAc,SAAS;QACrB,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEhF,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,EACrB,YAAY,EACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAClB,CAAC;YAEF,MAAM,aAAa,GAAG,+DAA+D,CAAC;YACtF,OAAO,GAAG,SAAS,SAAS,aAAa,IAAI,QAAQ,UAAU,GAAG,EAAE,CAAC;SACtE;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;KACxC;;;;;;;;;;;IAYS,OAAO,CAAC,KAAa,EAAE,KAAa,EAAE,IAAY;QAC1D,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACzC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAE3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KACzE;CACF,CAAA;AArJC;IADC,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;6CACG;AAQzB;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACS;AAQlC;IADC,IAAI,EAAE;+CAC0B;AAQjC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;gEACkC;AAQ3D;IADC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDACH;AAvClB,cAAc;IADlC,SAAS;GACW,cAAc,CA4JlC;aA5JoB,cAAc;;;;"}
|
package/js/index.js
CHANGED
|
@@ -204,6 +204,7 @@ export { default as FacetsMixin } from './x-modules/facets/components/facets.mix
|
|
|
204
204
|
export { default as ClearHistoryQueries } from './x-modules/history-queries/components/clear-history-queries.vue.js';
|
|
205
205
|
export { default as HistoryQueries } from './x-modules/history-queries/components/history-queries.vue.js';
|
|
206
206
|
export { default as HistoryQuery } from './x-modules/history-queries/components/history-query.vue.js';
|
|
207
|
+
export { default as MyHistory } from './x-modules/history-queries/components/my-history.vue.js';
|
|
207
208
|
export { default as RemoveHistoryQuery } from './x-modules/history-queries/components/remove-history-query.vue.js';
|
|
208
209
|
export { AddQueryToHistoryAction, addQueryToHistory } from './x-modules/history-queries/store/actions/add-query-to-history.action.js';
|
|
209
210
|
export { loadHistoryQueriesFromBrowserStorage } from './x-modules/history-queries/store/actions/load-history-queries-from-browser-storage.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history-queries.vue.js","sources":["../../../../../src/x-modules/history-queries/components/history-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"historyQueries\"\n class=\"x-history-queries\"\n data-test=\"history-queries\"\n :animation=\"animation\"\n :maxItemsToRender=\"maxItemsToRender\"\n >\n <template #default=\"{ suggestion, index }\">\n <!--\n @slot History Query item\n @binding {Suggestion} suggestion - History Query suggestion data\n @binding {number} index - History Query suggestion index\n -->\n <slot name=\"suggestion\" v-bind=\"{ suggestion, index }\">\n <HistoryQuery\n :suggestion=\"suggestion\"\n data-test=\"history-query-item\"\n class=\"x-history-queries__item\"\n >\n <template #default=\"{ queryHTML }\">\n <!-- eslint-disable max-len -->\n <!--\n @slot History Query content\n @binding {Suggestion} suggestion - History Query suggestion data\n @binding {string} queryHTML - Suggestion's query with the matching part inside a span tag\n @binding {number} index - History Query suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ suggestion, index, queryHTML }\" />\n </template>\n <template #remove-button-content>\n <!--\n @slot History Query remove button content\n @binding {Suggestion} suggestion - History Query suggestion data\n @binding {number} index - History Query suggestion index\n -->\n <slot name=\"suggestion-remove-content\" v-bind=\"{ suggestion, index }\" />\n </template>\n </HistoryQuery>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\n import { HistoryQuery as HistoryQueryModel } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import BaseSuggestions from '../../../components/suggestions/base-suggestions.vue';\n import { Getter } from '../../../components/decorators/store.decorators';\n import { xComponentMixin } from '../../../components/x-component.mixin';\n import { historyQueriesXModule } from '../x-module';\n import HistoryQuery from './history-query.vue';\n\n /**\n * This component renders a list of suggestions coming from the user queries history.\n *\n * @remarks\n *\n * Allows the user to select one of them, emitting the needed events.\n * A history query is just another type of suggestion that contains a query that the user has\n * made in the past.\n *\n * @public\n */\n @Component({\n components: { BaseSuggestions, HistoryQuery },\n mixins: [xComponentMixin(historyQueriesXModule)]\n })\n export default class HistoryQueries extends Vue {\n /**\n * Animation component that will be used to animate the suggestions.\n *\n * @public\n */\n @Prop()\n protected animation!: Vue;\n\n /**\n * Maximum number of history queries to show. It should be a lower number than the\n * {@link HistoryQueriesConfig.maxItemsToStore}. If it is not provided, it will show\n * all the stored `HistoryQueries`.\n */\n @Prop()\n protected maxItemsToRender?: number;\n\n /**\n * The filtered list of history queries.\n *\n * @internal\n */\n @Getter('historyQueries', 'historyQueries')\n public historyQueries!: HistoryQueryModel[];\n }\n</script>\n\n<docs lang=\"mdx\">\n##
|
|
1
|
+
{"version":3,"file":"history-queries.vue.js","sources":["../../../../../src/x-modules/history-queries/components/history-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"historyQueries\"\n class=\"x-history-queries\"\n data-test=\"history-queries\"\n :animation=\"animation\"\n :maxItemsToRender=\"maxItemsToRender\"\n >\n <template #default=\"{ suggestion, index }\">\n <!--\n @slot History Query item\n @binding {Suggestion} suggestion - History Query suggestion data\n @binding {number} index - History Query suggestion index\n -->\n <slot name=\"suggestion\" v-bind=\"{ suggestion, index }\">\n <HistoryQuery\n :suggestion=\"suggestion\"\n data-test=\"history-query-item\"\n class=\"x-history-queries__item\"\n >\n <template #default=\"{ queryHTML }\">\n <!-- eslint-disable max-len -->\n <!--\n @slot History Query content\n @binding {Suggestion} suggestion - History Query suggestion data\n @binding {string} queryHTML - Suggestion's query with the matching part inside a span tag\n @binding {number} index - History Query suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ suggestion, index, queryHTML }\" />\n </template>\n <template #remove-button-content>\n <!--\n @slot History Query remove button content\n @binding {Suggestion} suggestion - History Query suggestion data\n @binding {number} index - History Query suggestion index\n -->\n <slot name=\"suggestion-remove-content\" v-bind=\"{ suggestion, index }\" />\n </template>\n </HistoryQuery>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\n import { HistoryQuery as HistoryQueryModel } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import BaseSuggestions from '../../../components/suggestions/base-suggestions.vue';\n import { Getter } from '../../../components/decorators/store.decorators';\n import { xComponentMixin } from '../../../components/x-component.mixin';\n import { historyQueriesXModule } from '../x-module';\n import HistoryQuery from './history-query.vue';\n\n /**\n * This component renders a list of suggestions coming from the user queries history.\n *\n * @remarks\n *\n * Allows the user to select one of them, emitting the needed events.\n * A history query is just another type of suggestion that contains a query that the user has\n * made in the past.\n *\n * @public\n */\n @Component({\n components: { BaseSuggestions, HistoryQuery },\n mixins: [xComponentMixin(historyQueriesXModule)]\n })\n export default class HistoryQueries extends Vue {\n /**\n * Animation component that will be used to animate the suggestions.\n *\n * @public\n */\n @Prop()\n protected animation!: Vue;\n\n /**\n * Maximum number of history queries to show. It should be a lower number than the\n * {@link HistoryQueriesConfig.maxItemsToStore}. If it is not provided, it will show\n * all the stored `HistoryQueries`.\n */\n @Prop()\n protected maxItemsToRender?: number;\n\n /**\n * The filtered list of history queries.\n *\n * @internal\n */\n @Getter('historyQueries', 'historyQueries')\n public historyQueries!: HistoryQueryModel[];\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component doesn't emit events.\n\n## See it in action\n\nHere you have a basic example of how the HistoryQueries is rendered.\n\n```vue\n<template>\n <HistoryQueries />\n</template>\n\n<script>\n import { HistoryQueries } from '@empathyco/x-components/history-queries';\n\n export default {\n name: 'HistoryQueriesDemo',\n components: {\n HistoryQueries\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the history queries have been limited to render a maximum of 10 queries (by default\nit is 5).\n\n```vue\n<template>\n <HistoryQueries :maxItemsToRender=\"10\" />\n</template>\n\n<script>\n import { HistoryQueries } from '@empathyco/x-components/history-queries';\n\n export default {\n name: 'HistoryQueriesDemo',\n components: {\n HistoryQueries\n }\n };\n</script>\n```\n\n### Play with the animation\n\n```vue\n<template>\n <HistoryQueries :animation=\"fadeAndSlide\" />\n</template>\n\n<script>\n import { HistoryQueries } from '@empathyco/x-components/history-queries';\n import { FadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'HistoryQueriesDemo',\n components: {\n HistoryQueries\n },\n data() {\n return {\n fadeAndSlide: FadeAndSlide\n };\n }\n };\n</script>\n```\n\n### Play with suggestion slot\n\nIn this example, the [`HistoryQuery`](./x-components.history-query.md) component is passed in the\n`suggestion` slot (although any other component could potentially be passed).\n\n```vue\n<template>\n <HistoryQueries #suggestion=\"{ suggestion }\">\n <HistoryQuery :suggestion=\"suggestion\"></HistoryQuery>\n </HistoryQueries>\n</template>\n\n<script>\n import { HistoryQueries, HistoryQuery } from '@empathyco/x-components/history-queries';\n\n export default {\n name: 'HistoryQueriesDemo',\n components: {\n HistoryQueries,\n HistoryQuery\n }\n };\n</script>\n```\n\n### Play with suggestion-content slot\n\nTo continue the previous example, the [`HistoryQuery`](./x-components.history-query.md) component is\npassed in the `suggestion-content` slot, but in addition, an HTML span tag for the text are also\npassed.\n\n```vue\n<template>\n <HistoryQueries #suggestion-content=\"{ suggestion }\">\n <span>{{ suggestion.query }}</span>\n </HistoryQueries>\n</template>\n\n<script>\n import { HistoryQueries } from '@empathyco/x-components/history-queries';\n\n export default {\n name: 'HistoryQueriesDemo',\n components: {\n HistoryQueries\n }\n };\n</script>\n```\n\n### Play with suggestion-content-remove slot\n\nTo continue the previous example, the [`HistoryQuery`](./x-components.history-query.md) component is\npassed in the `suggestion-content` slot, but in addition, a cross icon is also passed to change the\nicon to remove the history query.\n\n```vue\n<template>\n <HistoryQueries #suggestion-content-remove=\"{ suggestion }\">\n <CrossIcon />\n </HistoryQueries>\n</template>\n\n<script>\n import { HistoryQueries } from '@empathyco/x-components/history-queries';\n import { CrossIcon } from '@empathyco/x-components';\n\n export default {\n name: 'HistoryQueriesDemo',\n components: {\n HistoryQueries,\n CrossIcon\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import script from './my-history.vue_rollup-plugin-vue_script.vue.js';
|
|
2
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.mjs';
|
|
3
|
+
|
|
4
|
+
/* script */
|
|
5
|
+
const __vue_script__ = script;
|
|
6
|
+
|
|
7
|
+
/* template */
|
|
8
|
+
var __vue_render__ = function () {
|
|
9
|
+
var _vm = this;
|
|
10
|
+
var _h = _vm.$createElement;
|
|
11
|
+
var _c = _vm._self._c || _h;
|
|
12
|
+
return _c("BaseSuggestions", {
|
|
13
|
+
staticClass: "x-my-history-queries",
|
|
14
|
+
attrs: {
|
|
15
|
+
suggestions: _vm.historyQueries,
|
|
16
|
+
"data-test": "my-history-queries",
|
|
17
|
+
animation: _vm.animation,
|
|
18
|
+
},
|
|
19
|
+
scopedSlots: _vm._u(
|
|
20
|
+
[
|
|
21
|
+
{
|
|
22
|
+
key: "default",
|
|
23
|
+
fn: function (ref) {
|
|
24
|
+
var suggestion = ref.suggestion;
|
|
25
|
+
var index = ref.index;
|
|
26
|
+
return [
|
|
27
|
+
_vm._t(
|
|
28
|
+
"suggestion",
|
|
29
|
+
function () {
|
|
30
|
+
return [
|
|
31
|
+
_c("HistoryQuery", {
|
|
32
|
+
staticClass: "x-history-queries__item",
|
|
33
|
+
attrs: {
|
|
34
|
+
suggestion: suggestion,
|
|
35
|
+
"data-test": "history-query-item",
|
|
36
|
+
},
|
|
37
|
+
scopedSlots: _vm._u(
|
|
38
|
+
[
|
|
39
|
+
{
|
|
40
|
+
key: "default",
|
|
41
|
+
fn: function () {
|
|
42
|
+
return [
|
|
43
|
+
_vm._t("suggestion-content", null, null, {
|
|
44
|
+
suggestion: suggestion,
|
|
45
|
+
index: index,
|
|
46
|
+
}),
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
proxy: true,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "remove-button-content",
|
|
53
|
+
fn: function () {
|
|
54
|
+
return [
|
|
55
|
+
_vm._t(
|
|
56
|
+
"suggestion-remove-content",
|
|
57
|
+
null,
|
|
58
|
+
null,
|
|
59
|
+
{ suggestion: suggestion, index: index }
|
|
60
|
+
),
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
proxy: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
null,
|
|
67
|
+
true
|
|
68
|
+
),
|
|
69
|
+
}),
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
null,
|
|
73
|
+
{ suggestion: suggestion, index: index }
|
|
74
|
+
),
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
null,
|
|
80
|
+
true
|
|
81
|
+
),
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
var __vue_staticRenderFns__ = [];
|
|
85
|
+
__vue_render__._withStripped = true;
|
|
86
|
+
|
|
87
|
+
/* style */
|
|
88
|
+
const __vue_inject_styles__ = undefined;
|
|
89
|
+
/* scoped */
|
|
90
|
+
const __vue_scope_id__ = undefined;
|
|
91
|
+
/* module identifier */
|
|
92
|
+
const __vue_module_identifier__ = undefined;
|
|
93
|
+
/* functional template */
|
|
94
|
+
const __vue_is_functional_template__ = false;
|
|
95
|
+
/* style inject */
|
|
96
|
+
|
|
97
|
+
/* style inject SSR */
|
|
98
|
+
|
|
99
|
+
/* style inject shadow dom */
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
const __vue_component__ = /*#__PURE__*/__vue_normalize__(
|
|
104
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
105
|
+
__vue_inject_styles__,
|
|
106
|
+
__vue_script__,
|
|
107
|
+
__vue_scope_id__,
|
|
108
|
+
__vue_is_functional_template__,
|
|
109
|
+
__vue_module_identifier__,
|
|
110
|
+
false,
|
|
111
|
+
undefined,
|
|
112
|
+
undefined,
|
|
113
|
+
undefined
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
export { __vue_component__ as default };
|
|
117
|
+
//# sourceMappingURL=my-history.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"my-history.vue.js","sources":["../../../../../src/x-modules/history-queries/components/my-history.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"historyQueries\"\n class=\"x-my-history-queries\"\n data-test=\"my-history-queries\"\n :animation=\"animation\"\n >\n <template #default=\"{ suggestion, index }\">\n <!--\n @slot History Query item\n @binding {Suggestion} suggestion - History Query suggestion data\n @binding {number} index - History Query suggestion index\n -->\n <slot name=\"suggestion\" v-bind=\"{ suggestion, index }\">\n <HistoryQuery\n :suggestion=\"suggestion\"\n data-test=\"history-query-item\"\n class=\"x-history-queries__item\"\n >\n <template #default>\n <!-- eslint-disable max-len -->\n <!--\n @slot History Query content\n @binding {Suggestion} suggestion - History Query suggestion data\n @binding {number} index - History Query suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ suggestion, index }\" />\n </template>\n <template #remove-button-content>\n <!--\n @slot History Query remove button content\n @binding {Suggestion} suggestion - History Query suggestion data\n @binding {number} index - History Query suggestion index\n -->\n <slot name=\"suggestion-remove-content\" v-bind=\"{ suggestion, index }\" />\n </template>\n </HistoryQuery>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\n import { HistoryQuery } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { xComponentMixin } from '../../../components/x-component.mixin';\n import { State } from '../../../components/decorators/store.decorators';\n import BaseSuggestions from '../../../components/suggestions/base-suggestions.vue';\n import { historyQueriesXModule } from '../x-module';\n import HistoryQueryComponent from './history-query.vue';\n\n /**\n * This component renders the complete list of suggestions coming from the user queries history.\n *\n * @remarks\n *\n * Allows the user to select one of them, emitting the needed events.\n * A history query is just another type of suggestion that contains a query that the user has\n * made in the past.\n *\n * @public\n */\n @Component({\n components: { HistoryQuery: HistoryQueryComponent, BaseSuggestions },\n mixins: [xComponentMixin(historyQueriesXModule)]\n })\n export default class MyHistory extends Vue {\n /**\n * Animation component that will be used to animate the suggestions.\n *\n * @public\n */\n @Prop()\n protected animation!: Vue;\n\n /**\n * The list of history queries.\n *\n * @internal\n */\n @State('historyQueries', 'historyQueries')\n public historyQueries!: HistoryQuery[];\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component doesn't emit events.\n\n## See it in action\n\nHere you have a basic example of how the MyHistory is rendered.\n\n```vue\n<template>\n <MyHistory />\n</template>\n\n<script>\n import { MyHistory } from '@empathyco/x-components/history-queries';\n\n export default {\n name: 'MyHistoryDemo',\n components: {\n MyHistory\n }\n };\n</script>\n```\n\n### Play with the animation\n\n```vue\n<template>\n <MyHistory :animation=\"fadeAndSlide\" />\n</template>\n\n<script>\n import { MyHistory } from '@empathyco/x-components/history-queries';\n import { FadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'MyHistoryDemo',\n components: {\n MyHistory\n },\n data() {\n return {\n fadeAndSlide: FadeAndSlide\n };\n }\n };\n</script>\n```\n\n### Play with suggestion slot\n\nIn this example, the [`HistoryQuery`](./x-components.history-query.md) component is passed in the\n`suggestion` slot (although any other component could potentially be passed).\n\n```vue\n<template>\n <MyHistory #suggestion=\"{ suggestion }\">\n <HistoryQuery :suggestion=\"suggestion\"></HistoryQuery>\n </MyHistory>\n</template>\n\n<script>\n import { MyHistory, HistoryQuery } from '@empathyco/x-components/history-queries';\n\n export default {\n name: 'MyHistoryDemo',\n components: {\n MyHistory,\n HistoryQuery\n }\n };\n</script>\n```\n\n### Play with suggestion-content slot\n\nTo continue the previous example, the [`HistoryQuery`](./x-components.history-query.md) component is\npassed in the `suggestion-content` slot, but in addition, an HTML span tag for the text are also\npassed.\n\n```vue\n<template>\n <MyHistory #suggestion-content=\"{ suggestion }\">\n <span>{{ suggestion.query }}</span>\n </MyHistory>\n</template>\n\n<script>\n import { MyHistory } from '@empathyco/x-components/history-queries';\n\n export default {\n name: 'MyHistoryDemo',\n components: {\n MyHistory\n }\n };\n</script>\n```\n\n### Play with suggestion-content-remove slot\n\nTo continue the previous example, the [`HistoryQuery`](./x-components.history-query.md) component is\npassed in the `suggestion-content` slot, but in addition, a cross icon is also passed to change the\nicon to remove the history query.\n\n```vue\n<template>\n <MyHistory #suggestion-content-remove=\"{ suggestion }\">\n <CrossIcon />\n </MyHistory>\n</template>\n\n<script>\n import { MyHistory } from '@empathyco/x-components/history-queries';\n import { CrossIcon } from '@empathyco/x-components';\n\n export default {\n name: 'MyHistoryDemo',\n components: {\n MyHistory,\n CrossIcon\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/js/x-modules/history-queries/components/my-history.vue_rollup-plugin-vue_script.vue.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import Vue from 'vue';
|
|
3
|
+
import { Prop, Component } from 'vue-property-decorator';
|
|
4
|
+
import { xComponentMixin } from '../../../components/x-component.mixin.js';
|
|
5
|
+
import { State } from '../../../components/decorators/store.decorators.js';
|
|
6
|
+
import __vue_component__$1 from '../../../components/suggestions/base-suggestions.vue.js';
|
|
7
|
+
import { historyQueriesXModule } from '../x-module.js';
|
|
8
|
+
import __vue_component__ from './history-query.vue.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This component renders the complete list of suggestions coming from the user queries history.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
*
|
|
15
|
+
* Allows the user to select one of them, emitting the needed events.
|
|
16
|
+
* A history query is just another type of suggestion that contains a query that the user has
|
|
17
|
+
* made in the past.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
let MyHistory = class MyHistory extends Vue {
|
|
22
|
+
};
|
|
23
|
+
__decorate([
|
|
24
|
+
Prop()
|
|
25
|
+
], MyHistory.prototype, "animation", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
State('historyQueries', 'historyQueries')
|
|
28
|
+
], MyHistory.prototype, "historyQueries", void 0);
|
|
29
|
+
MyHistory = __decorate([
|
|
30
|
+
Component({
|
|
31
|
+
components: { HistoryQuery: __vue_component__, BaseSuggestions: __vue_component__$1 },
|
|
32
|
+
mixins: [xComponentMixin(historyQueriesXModule)]
|
|
33
|
+
})
|
|
34
|
+
], MyHistory);
|
|
35
|
+
var script = MyHistory;
|
|
36
|
+
|
|
37
|
+
export { script as default };
|
|
38
|
+
//# sourceMappingURL=my-history.vue_rollup-plugin-vue_script.vue.js.map
|
package/js/x-modules/history-queries/components/my-history.vue_rollup-plugin-vue_script.vue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"my-history.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../../src/x-modules/history-queries/components/my-history.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\n\n\n\n\n\n\n\n\n\n\n\n\nimport { HistoryQuery } from '@empathyco/x-types';\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { xComponentMixin } from '../../../components/x-component.mixin';\nimport { State } from '../../../components/decorators/store.decorators';\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue';\nimport { historyQueriesXModule } from '../x-module';\nimport HistoryQueryComponent from './history-query.vue';\n\n/**\n * This component renders the complete list of suggestions coming from the user queries history.\n *\n * @remarks\n *\n * Allows the user to select one of them, emitting the needed events.\n * A history query is just another type of suggestion that contains a query that the user has\n * made in the past.\n *\n * @public\n */\n@Component({\n components: { HistoryQuery: HistoryQueryComponent, BaseSuggestions },\n mixins: [xComponentMixin(historyQueriesXModule)]\n})\nexport default class MyHistory extends Vue {\n /**\n * Animation component that will be used to animate the suggestions.\n *\n * @public\n */\n @Prop()\n protected animation!: Vue;\n\n /**\n * The list of history queries.\n *\n * @internal\n */\n @State('historyQueries', 'historyQueries')\n public historyQueries!: HistoryQuery[];\n}\n"],"names":["HistoryQueryComponent","BaseSuggestions"],"mappings":";;;;;;;;;AAqDA;;;;;;;;;;;AAeA,IAAqB,SAAS,GAA9B,MAAqB,SAAU,SAAQ,GAAG;CAgBzC,CAAA;AATC;IADC,IAAI,EAAE;4CACmB;AAQ1B;IADC,KAAK,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;iDACH;AAfpB,SAAS;IAJ7B,SAAS,CAAC;QACT,UAAU,EAAE,EAAE,YAAY,EAAEA,iBAAqB,mBAAEC,mBAAe,EAAE;QACpE,MAAM,EAAE,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC;KACjD,CAAC;GACmB,SAAS,CAgB7B;aAhBoB,SAAS;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-components",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.70",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"access": "public",
|
|
128
128
|
"directory": "dist"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "c410c0ffd3032023573cc21760dede6432926a61"
|
|
131
131
|
}
|
|
@@ -24105,6 +24105,63 @@
|
|
|
24105
24105
|
"endIndex": 9
|
|
24106
24106
|
}
|
|
24107
24107
|
},
|
|
24108
|
+
{
|
|
24109
|
+
"kind": "Class",
|
|
24110
|
+
"canonicalReference": "@empathyco/x-components!MyHistory:class",
|
|
24111
|
+
"docComment": "/**\n * This component renders the complete list of suggestions coming from the user queries history.\n *\n * @remarks\n *\n * Allows the user to select one of them, emitting the needed events. A history query is just another type of suggestion that contains a query that the user has made in the past.\n *\n * @public\n */\n",
|
|
24112
|
+
"excerptTokens": [
|
|
24113
|
+
{
|
|
24114
|
+
"kind": "Content",
|
|
24115
|
+
"text": "export default class MyHistory extends "
|
|
24116
|
+
},
|
|
24117
|
+
{
|
|
24118
|
+
"kind": "Reference",
|
|
24119
|
+
"text": "Vue",
|
|
24120
|
+
"canonicalReference": "vue!Vue:interface"
|
|
24121
|
+
},
|
|
24122
|
+
{
|
|
24123
|
+
"kind": "Content",
|
|
24124
|
+
"text": " "
|
|
24125
|
+
}
|
|
24126
|
+
],
|
|
24127
|
+
"releaseTag": "Public",
|
|
24128
|
+
"name": "MyHistory",
|
|
24129
|
+
"members": [
|
|
24130
|
+
{
|
|
24131
|
+
"kind": "Property",
|
|
24132
|
+
"canonicalReference": "@empathyco/x-components!MyHistory#animation:member",
|
|
24133
|
+
"docComment": "/**\n * Animation component that will be used to animate the suggestions.\n *\n * @public\n */\n",
|
|
24134
|
+
"excerptTokens": [
|
|
24135
|
+
{
|
|
24136
|
+
"kind": "Content",
|
|
24137
|
+
"text": "protected animation: "
|
|
24138
|
+
},
|
|
24139
|
+
{
|
|
24140
|
+
"kind": "Reference",
|
|
24141
|
+
"text": "Vue",
|
|
24142
|
+
"canonicalReference": "vue!Vue:interface"
|
|
24143
|
+
},
|
|
24144
|
+
{
|
|
24145
|
+
"kind": "Content",
|
|
24146
|
+
"text": ";"
|
|
24147
|
+
}
|
|
24148
|
+
],
|
|
24149
|
+
"isOptional": false,
|
|
24150
|
+
"releaseTag": "Public",
|
|
24151
|
+
"name": "animation",
|
|
24152
|
+
"propertyTypeTokenRange": {
|
|
24153
|
+
"startIndex": 1,
|
|
24154
|
+
"endIndex": 2
|
|
24155
|
+
},
|
|
24156
|
+
"isStatic": false
|
|
24157
|
+
}
|
|
24158
|
+
],
|
|
24159
|
+
"extendsTokenRange": {
|
|
24160
|
+
"startIndex": 1,
|
|
24161
|
+
"endIndex": 3
|
|
24162
|
+
},
|
|
24163
|
+
"implementsTokenRanges": []
|
|
24164
|
+
},
|
|
24108
24165
|
{
|
|
24109
24166
|
"kind": "Function",
|
|
24110
24167
|
"canonicalReference": "@empathyco/x-components!namespacedDebounce:function(1)",
|
|
@@ -2286,6 +2286,13 @@ export type MutationsTree<State extends Dictionary, Mutations extends MutationsD
|
|
|
2286
2286
|
[Key in keyof Mutations]: (state: State, payload: ExtractPayload<Mutations[Key]>) => void;
|
|
2287
2287
|
};
|
|
2288
2288
|
|
|
2289
|
+
// @public
|
|
2290
|
+
export class MyHistory extends Vue_2 {
|
|
2291
|
+
protected animation: Vue_2;
|
|
2292
|
+
// @internal
|
|
2293
|
+
historyQueries: HistoryQuery_2[];
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2289
2296
|
// @public
|
|
2290
2297
|
export function namespacedDebounce<ModuleName extends XModuleName>(moduleName: ModuleName): NamespacedTimeWireOperator<ModuleName>;
|
|
2291
2298
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as ClearHistoryQueries } from './clear-history-queries.vue';
|
|
2
2
|
export { default as HistoryQueries } from './history-queries.vue';
|
|
3
3
|
export { default as HistoryQuery } from './history-query.vue';
|
|
4
|
+
export { default as MyHistory } from './my-history.vue';
|
|
4
5
|
export { default as RemoveHistoryQuery } from './remove-history-query.vue';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/history-queries/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/history-queries/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HistoryQuery } from '@empathyco/x-types';
|
|
2
|
+
import Vue from 'vue';
|
|
3
|
+
/**
|
|
4
|
+
* This component renders the complete list of suggestions coming from the user queries history.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
*
|
|
8
|
+
* Allows the user to select one of them, emitting the needed events.
|
|
9
|
+
* A history query is just another type of suggestion that contains a query that the user has
|
|
10
|
+
* made in the past.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export default class MyHistory extends Vue {
|
|
15
|
+
/**
|
|
16
|
+
* Animation component that will be used to animate the suggestions.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
protected animation: Vue;
|
|
21
|
+
/**
|
|
22
|
+
* The list of history queries.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
historyQueries: HistoryQuery[];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=my-history.vue?rollup-plugin-vue=script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"my-history.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/history-queries/components/my-history.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AA4CA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,GAAG,MAAM,KAAK,CAAC;AAQtB;;;;;;;;;;GAUG;AAKH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,GAAG;IACxC;;;;OAIG;IAEH,SAAS,CAAC,SAAS,EAAG,GAAG,CAAC;IAE1B;;;;OAIG;IAEI,cAAc,EAAG,YAAY,EAAE,CAAC;CACxC"}
|