@empathyco/x-components 3.0.0-alpha.91 → 3.0.0-alpha.92
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/docs/API-reference/api/x-components.hierarchicalfilter.clickevents.md +13 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +1 -0
- package/docs/API-reference/api/x-components.numberrangefilter.clickevents.md +13 -0
- package/docs/API-reference/api/x-components.numberrangefilter.md +1 -0
- package/docs/API-reference/api/x-components.simplefilter.clickevents.md +13 -0
- package/docs/API-reference/api/x-components.simplefilter.md +1 -0
- package/docs/API-reference/components/facets/x-components.filters/hierarchical-filter.md +147 -28
- package/docs/API-reference/components/facets/x-components.filters/number-range-filter.md +116 -17
- package/docs/API-reference/components/facets/x-components.filters/simple-filter.md +52 -12
- package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js +2 -1
- package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/hierarchical-filter.vue_rollup-plugin-vue_script.vue.js +30 -6
- package/js/x-modules/facets/components/filters/hierarchical-filter.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/number-range-filter.vue.js +1 -1
- package/js/x-modules/facets/components/filters/number-range-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/number-range-filter.vue_rollup-plugin-vue_script.vue.js +8 -5
- package/js/x-modules/facets/components/filters/number-range-filter.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/simple-filter.vue.js +1 -1
- package/js/x-modules/facets/components/filters/simple-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/simple-filter.vue_rollup-plugin-vue_script.vue.js +8 -5
- package/js/x-modules/facets/components/filters/simple-filter.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +123 -0
- package/report/x-components.api.md +8 -3
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +18 -5
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/number-range-filter.vue.d.ts +9 -4
- package/types/x-modules/facets/components/filters/number-range-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +9 -4
- package/types/x-modules/facets/components/filters/simple-filter.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.92](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.91...@empathyco/x-components@3.0.0-alpha.92) (2022-05-05)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **facets:** expose `clickEvents` as a `prop` in filters components using a `RenderlessFilter`
|
|
11
|
+
([013d83d](https://github.com/empathyco/x/commit/013d83d93ac734a1365bbf98a19ae15dc2f1a64b)),
|
|
12
|
+
closes [EX-5986](https://searchbroker.atlassian.net/browse/EX-5986)
|
|
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.91](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.90...@empathyco/x-components@3.0.0-alpha.91) (2022-05-04)
|
|
7
20
|
|
|
8
21
|
### Features
|
|
@@ -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) > [HierarchicalFilter](./x-components.hierarchicalfilter.md) > [clickEvents](./x-components.hierarchicalfilter.clickevents.md)
|
|
4
|
+
|
|
5
|
+
## HierarchicalFilter.clickEvents property
|
|
6
|
+
|
|
7
|
+
Additional events, with their payload, to emit when the filter is clicked.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
clickEvents: Partial<XEventsTypes>;
|
|
13
|
+
```
|
|
@@ -18,6 +18,7 @@ export default class HierarchicalFilter extends Vue
|
|
|
18
18
|
| Property | Modifiers | Type | Description |
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
20
|
| [childrenAnimation?](./x-components.hierarchicalfilter.childrenanimation.md) | | Vue \| string | <i>(Optional)</i> The animation component to use for the children filters. |
|
|
21
|
+
| [clickEvents](./x-components.hierarchicalfilter.clickevents.md) | | Partial<[XEventsTypes](./x-components.xeventstypes.md)<!-- -->> | Additional events, with their payload, to emit when the filter is clicked. |
|
|
21
22
|
| [filter](./x-components.hierarchicalfilter.filter.md) | | HierarchicalFilterModel | The filter data to render. |
|
|
22
23
|
|
|
23
24
|
## Methods
|
|
@@ -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) > [NumberRangeFilter](./x-components.numberrangefilter.md) > [clickEvents](./x-components.numberrangefilter.clickevents.md)
|
|
4
|
+
|
|
5
|
+
## NumberRangeFilter.clickEvents property
|
|
6
|
+
|
|
7
|
+
Additional events, with their payload, to emit when the filter is clicked.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
clickEvents?: Partial<XEventsTypes>;
|
|
13
|
+
```
|
|
@@ -17,5 +17,6 @@ export default class NumberRangeFilter extends Vue
|
|
|
17
17
|
|
|
18
18
|
| Property | Modifiers | Type | Description |
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
|
+
| [clickEvents?](./x-components.numberrangefilter.clickevents.md) | | Partial<[XEventsTypes](./x-components.xeventstypes.md)<!-- -->> | <i>(Optional)</i> Additional events, with their payload, to emit when the filter is clicked. |
|
|
20
21
|
| [filter](./x-components.numberrangefilter.filter.md) | | NumberRangeFilterModel | The filter data to render. |
|
|
21
22
|
|
|
@@ -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) > [SimpleFilter](./x-components.simplefilter.md) > [clickEvents](./x-components.simplefilter.clickevents.md)
|
|
4
|
+
|
|
5
|
+
## SimpleFilter.clickEvents property
|
|
6
|
+
|
|
7
|
+
Additional events, with their payload, to emit when the filter is clicked.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
clickEvents?: Partial<XEventsTypes>;
|
|
13
|
+
```
|
|
@@ -17,5 +17,6 @@ export default class SimpleFilter extends Vue
|
|
|
17
17
|
|
|
18
18
|
| Property | Modifiers | Type | Description |
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
|
+
| [clickEvents?](./x-components.simplefilter.clickevents.md) | | Partial<[XEventsTypes](./x-components.xeventstypes.md)<!-- -->> | <i>(Optional)</i> Additional events, with their payload, to emit when the filter is clicked. |
|
|
20
21
|
| [filter](./x-components.simplefilter.filter.md) | | SimpleFilterModel | The filter data to render. |
|
|
21
22
|
|
|
@@ -10,10 +10,11 @@ Renders a hierarchical filter recursively, emitting the needed events when click
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Name | Description
|
|
14
|
-
| ------------------------------ |
|
|
15
|
-
| <code>filter</code> | The filter data to render.
|
|
16
|
-
| <code>childrenAnimation</code> | The animation component to use for the children filters.
|
|
13
|
+
| Name | Description | Type | Default |
|
|
14
|
+
| ------------------------------ | -------------------------------------------------------------------------- | ------------------------------------ | ------------- |
|
|
15
|
+
| <code>filter</code> | The filter data to render. | <code>HierarchicalFilterModel</code> | <code></code> |
|
|
16
|
+
| <code>childrenAnimation</code> | The animation component to use for the children filters. | <code>union</code> | <code></code> |
|
|
17
|
+
| <code>clickEvents</code> | Additional events, with their payload, to emit when the filter is clicked. | <code>Partial</code> | <code></code> |
|
|
17
18
|
|
|
18
19
|
## Slots
|
|
19
20
|
|
|
@@ -22,22 +23,93 @@ Renders a hierarchical filter recursively, emitting the needed events when click
|
|
|
22
23
|
| <code>default</code> | The content to render inside the button. | <br /><br /><br /> |
|
|
23
24
|
| <code>label</code> | The content to render inside the button. | |
|
|
24
25
|
|
|
25
|
-
##
|
|
26
|
+
## Events
|
|
27
|
+
|
|
28
|
+
A list of events that the component will emit:
|
|
29
|
+
|
|
30
|
+
- [`UserClickedAFilter`](x-components.xeventstypes.userclickedafilter.md): the event is emitted
|
|
31
|
+
after the user clicks the button, using the `filter` prop as its payload.
|
|
32
|
+
- [`UserClickedAHierarchicalFilter`](x-components.xeventstypes.userclickedahierarchicalfilter.md):
|
|
33
|
+
the event is emitted after the user clicks the button, using the `filter` prop as its payload.
|
|
34
|
+
filter.
|
|
35
|
+
|
|
36
|
+
## See it in action
|
|
26
37
|
|
|
27
38
|
This component renders a button, which on clicked emits the `UserClickedAFilter` and
|
|
28
39
|
`UserClickedAHierarchicalFilter` events. By default it renders the filter label as the button text.
|
|
29
40
|
If the provided filter has children filters, this component will render them recursively. Changing
|
|
30
41
|
the slot content will change it for all of the children.
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
The `filter` prop is required. The `clickEvents` prop is optional and allows configuring the events
|
|
44
|
+
to emit on click.
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<template>
|
|
48
|
+
<HierarchicalFilter :filter="filter" />
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script>
|
|
52
|
+
import { HierarchicalFilter } from "@empathyco/x-components/facets";
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
name: "HierarchicalFilterTest",
|
|
56
|
+
components: {
|
|
57
|
+
HierarchicalFilter
|
|
58
|
+
},
|
|
59
|
+
date() {
|
|
60
|
+
return {
|
|
61
|
+
filter: {
|
|
62
|
+
id: `categories:men`,
|
|
63
|
+
modelName: "HierarchicalFilter",
|
|
64
|
+
label: `men`,
|
|
65
|
+
facetId: "categories",
|
|
66
|
+
parentId: null,
|
|
67
|
+
totalResults: 10,
|
|
68
|
+
children: [],
|
|
69
|
+
selected: false
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
</script>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Playing with props
|
|
78
|
+
|
|
79
|
+
Configuring the events to emit when the filter is clicked.
|
|
33
80
|
|
|
34
81
|
```vue
|
|
35
82
|
<template>
|
|
36
83
|
<HierarchicalFilter
|
|
84
|
+
:clickEvents="{ UserClickedAHierarchicalFilter: filter }"
|
|
37
85
|
:filter="filter"
|
|
38
|
-
v-slot="{ filter: slotFilter, clickFilter, cssClasses, isDisabled }"
|
|
39
86
|
/>
|
|
40
87
|
</template>
|
|
88
|
+
|
|
89
|
+
<script>
|
|
90
|
+
import { HierarchicalFilter } from "@empathyco/x-components/facets";
|
|
91
|
+
|
|
92
|
+
export default {
|
|
93
|
+
name: "HierarchicalFilterTest",
|
|
94
|
+
components: {
|
|
95
|
+
HierarchicalFilter
|
|
96
|
+
},
|
|
97
|
+
date() {
|
|
98
|
+
return {
|
|
99
|
+
filter: {
|
|
100
|
+
id: `categories:men`,
|
|
101
|
+
modelName: "HierarchicalFilter",
|
|
102
|
+
label: `men`,
|
|
103
|
+
facetId: "categories",
|
|
104
|
+
parentId: null,
|
|
105
|
+
totalResults: 10,
|
|
106
|
+
children: [],
|
|
107
|
+
selected: false
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
</script>
|
|
41
113
|
```
|
|
42
114
|
|
|
43
115
|
### Customizing the default slot content
|
|
@@ -45,30 +117,77 @@ the slot content will change it for all of the children.
|
|
|
45
117
|
In this example, the child filters will also include the label and checkbox.
|
|
46
118
|
|
|
47
119
|
```vue
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</
|
|
120
|
+
<template>
|
|
121
|
+
<HierarchicalFilter
|
|
122
|
+
:filter="filter"
|
|
123
|
+
v-slot="{ filter, clickFilter, slotCSSClasses, isDisabled }"
|
|
124
|
+
>
|
|
125
|
+
<label :class="slotCSSClasses">
|
|
126
|
+
<input @change="clickFilter" :disabled="isDisabled" />
|
|
127
|
+
{{ filter.label }}
|
|
128
|
+
</label>
|
|
129
|
+
</HierarchicalFilter>
|
|
130
|
+
</template>
|
|
131
|
+
|
|
132
|
+
<script>
|
|
133
|
+
import { HierarchicalFilter } from "@empathyco/x-components/facets";
|
|
134
|
+
|
|
135
|
+
export default {
|
|
136
|
+
name: "HierarchicalFilterTest",
|
|
137
|
+
components: {
|
|
138
|
+
HierarchicalFilter
|
|
139
|
+
},
|
|
140
|
+
date() {
|
|
141
|
+
return {
|
|
142
|
+
filter: {
|
|
143
|
+
id: `categories:men`,
|
|
144
|
+
modelName: "HierarchicalFilter",
|
|
145
|
+
label: `men`,
|
|
146
|
+
facetId: "categories",
|
|
147
|
+
parentId: null,
|
|
148
|
+
totalResults: 10,
|
|
149
|
+
children: [],
|
|
150
|
+
selected: false
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
</script>
|
|
57
156
|
```
|
|
58
157
|
|
|
59
158
|
### Customizing the label slot content
|
|
60
159
|
|
|
61
160
|
```vue
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
</
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Events
|
|
70
|
-
|
|
71
|
-
A list of events that the component will emit:
|
|
161
|
+
<template>
|
|
162
|
+
<HierarchicalFilter :filter="filter">
|
|
163
|
+
<template #label :filter="filter">
|
|
164
|
+
<span class="custom-class">{{ filter.label }}</span>
|
|
165
|
+
</template>
|
|
166
|
+
</HierarchicalFilter>
|
|
167
|
+
</template>
|
|
72
168
|
|
|
73
|
-
|
|
74
|
-
|
|
169
|
+
<script>
|
|
170
|
+
import { HierarchicalFilter } from "@empathyco/x-components/facets";
|
|
171
|
+
|
|
172
|
+
export default {
|
|
173
|
+
name: "HierarchicalFilterTest",
|
|
174
|
+
components: {
|
|
175
|
+
HierarchicalFilter
|
|
176
|
+
},
|
|
177
|
+
date() {
|
|
178
|
+
return {
|
|
179
|
+
filter: {
|
|
180
|
+
id: `categories:men`,
|
|
181
|
+
modelName: "HierarchicalFilter",
|
|
182
|
+
label: `men`,
|
|
183
|
+
facetId: "categories",
|
|
184
|
+
parentId: null,
|
|
185
|
+
totalResults: 10,
|
|
186
|
+
children: [],
|
|
187
|
+
selected: false
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
</script>
|
|
193
|
+
```
|
|
@@ -10,9 +10,10 @@ Renders a number range filter, emitting the needed events when clicked.
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Name
|
|
14
|
-
|
|
|
15
|
-
| <code>filter</code>
|
|
13
|
+
| Name | Description | Type | Default |
|
|
14
|
+
| ------------------------ | -------------------------------------------------------------------------- | ----------------------------------- | ------------- |
|
|
15
|
+
| <code>filter</code> | The filter data to render. | <code>NumberRangeFilterModel</code> | <code></code> |
|
|
16
|
+
| <code>clickEvents</code> | Additional events, with their payload, to emit when the filter is clicked. | <code>Partial</code> | <code></code> |
|
|
16
17
|
|
|
17
18
|
## Slots
|
|
18
19
|
|
|
@@ -21,29 +22,127 @@ Renders a number range filter, emitting the needed events when clicked.
|
|
|
21
22
|
| <code>default</code> | The control element to render | **filter** <code>Filter</code> - The filter data<br />**clickFilter** <code>() => void</code> - Method that will invoke the needed actions after the user<br /> clicks the filter.<br />**cssClasses** <code>Object</code> - Object containing CSS classes to add to the button<br />**isDisabled** <code>Boolean</code> - True if the filter shouldn't be able to be selected by the<br /> user |
|
|
22
23
|
| <code>label</code> | The content to render inside the button | **filter** <code>Filter</code> - The filter data |
|
|
23
24
|
|
|
24
|
-
##
|
|
25
|
+
## Events
|
|
26
|
+
|
|
27
|
+
This component emits the following events:
|
|
28
|
+
|
|
29
|
+
- [`UserClickedAFilter`](x-components.xeventstypes.userclickedafilter.md): the event is emitted
|
|
30
|
+
after the user clicks the button, using the `filter` prop as its payload.
|
|
31
|
+
- [`UserClickedANumberRangeFilter`](x-components.xeventstypes.userclickedanumberrangefilter.md): the
|
|
32
|
+
event is emitted after the user clicks the button, using the `filter` prop as its payload.
|
|
25
33
|
|
|
26
|
-
|
|
34
|
+
## See it in action
|
|
35
|
+
|
|
36
|
+
This component renders a button which, on clicked, emits the `UserClickedAFilter` and the
|
|
27
37
|
`UserClickedANumberRangeFilter` events. By default, it renders the filter label as the button text.
|
|
28
38
|
|
|
29
|
-
|
|
39
|
+
The `filter` prop is required. The `clickEvents` prop is optional and allows configuring the events
|
|
40
|
+
to emit on click.
|
|
30
41
|
|
|
31
42
|
```vue
|
|
32
|
-
<
|
|
43
|
+
<template>
|
|
44
|
+
<NumberRangeFilter :filter="filter" />
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { NumberRangeFilter } from "@empathyco/x-components/facets";
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
name: "NumberRangeFilterTest",
|
|
52
|
+
components: {
|
|
53
|
+
NumberRangeFilter
|
|
54
|
+
},
|
|
55
|
+
date() {
|
|
56
|
+
return {
|
|
57
|
+
filter: {
|
|
58
|
+
id: `price:1-10`,
|
|
59
|
+
modelName: "NumberRangeFilter",
|
|
60
|
+
label: `From 1 to 10`,
|
|
61
|
+
facetId: "price",
|
|
62
|
+
range: {
|
|
63
|
+
min: 1,
|
|
64
|
+
max: 10
|
|
65
|
+
},
|
|
66
|
+
selected: false
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
</script>
|
|
33
72
|
```
|
|
34
73
|
|
|
35
|
-
###
|
|
74
|
+
### Playing with props
|
|
75
|
+
|
|
76
|
+
Configuring the events to emit when the filter is clicked.
|
|
36
77
|
|
|
37
78
|
```vue
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
79
|
+
<template>
|
|
80
|
+
<NumberRangeFilter
|
|
81
|
+
:clickEvents="{ UserClickedANumberRangeFilter: filter }"
|
|
82
|
+
:filter="filter"
|
|
83
|
+
/>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script>
|
|
87
|
+
import { NumberRangeFilter } from "@empathyco/x-components/facets";
|
|
88
|
+
|
|
89
|
+
export default {
|
|
90
|
+
name: "NumberRangeFilterTest",
|
|
91
|
+
components: {
|
|
92
|
+
NumberRangeFilter
|
|
93
|
+
},
|
|
94
|
+
date() {
|
|
95
|
+
return {
|
|
96
|
+
filter: {
|
|
97
|
+
id: `price:1-10`,
|
|
98
|
+
modelName: "NumberRangeFilter",
|
|
99
|
+
label: `From 1 to 10`,
|
|
100
|
+
facetId: "price",
|
|
101
|
+
range: {
|
|
102
|
+
min: 1,
|
|
103
|
+
max: 10
|
|
104
|
+
},
|
|
105
|
+
selected: false
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
</script>
|
|
42
111
|
```
|
|
43
112
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
A list of events that the component will emit:
|
|
113
|
+
### Customizing its contents
|
|
47
114
|
|
|
48
|
-
|
|
49
|
-
|
|
115
|
+
```vue
|
|
116
|
+
<template>
|
|
117
|
+
<NumberRangeFilter :filter="filter" v-slot="{ filter }">
|
|
118
|
+
<img src="checkbox.png" />
|
|
119
|
+
<span>{{ filter.label }}</span>
|
|
120
|
+
</NumberRangeFilter>
|
|
121
|
+
</template>
|
|
122
|
+
|
|
123
|
+
<script>
|
|
124
|
+
import { NumberRangeFilter } from "@empathyco/x-components/facets";
|
|
125
|
+
|
|
126
|
+
export default {
|
|
127
|
+
name: "NumberRangeFilterTest",
|
|
128
|
+
components: {
|
|
129
|
+
NumberRangeFilter
|
|
130
|
+
},
|
|
131
|
+
date() {
|
|
132
|
+
return {
|
|
133
|
+
filter: {
|
|
134
|
+
id: `price:1-10`,
|
|
135
|
+
modelName: "NumberRangeFilter",
|
|
136
|
+
label: `From 1 to 10`,
|
|
137
|
+
facetId: "price",
|
|
138
|
+
range: {
|
|
139
|
+
min: 1,
|
|
140
|
+
max: 10
|
|
141
|
+
},
|
|
142
|
+
selected: false
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
</script>
|
|
148
|
+
```
|
|
@@ -10,9 +10,10 @@ Renders a simple filter, emitting the needed events when clicked.
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Name
|
|
14
|
-
|
|
|
15
|
-
| <code>filter</code>
|
|
13
|
+
| Name | Description | Type | Default |
|
|
14
|
+
| ------------------------ | -------------------------------------------------------------------------- | ------------------------------ | ------------- |
|
|
15
|
+
| <code>filter</code> | The filter data to render. | <code>SimpleFilterModel</code> | <code></code> |
|
|
16
|
+
| <code>clickEvents</code> | Additional events, with their payload, to emit when the filter is clicked. | <code>Partial</code> | <code></code> |
|
|
16
17
|
|
|
17
18
|
## Slots
|
|
18
19
|
|
|
@@ -21,13 +22,23 @@ Renders a simple filter, emitting the needed events when clicked.
|
|
|
21
22
|
| <code>default</code> | The control element to render | **filter** <code>Filter</code> - The filter data<br />**clickFilter** <code>() => void</code> - Method that will invoke the needed actions after the user<br /> clicks the filter.<br />**cssClasses** <code>Object</code> - Object containing CSS classes to add to the button<br />**isDisabled** <code>Boolean</code> - True if the filter shouldn't be able to be selected by the<br /> user |
|
|
22
23
|
| <code>label</code> | The content to render inside the button | **filter** <code>Filter</code> - The filter data |
|
|
23
24
|
|
|
24
|
-
##
|
|
25
|
+
## Events
|
|
26
|
+
|
|
27
|
+
A list of events that the component will emit:
|
|
28
|
+
|
|
29
|
+
- [`UserClickedAFilter`](x-components.xeventstypes.userclickedafilter.md): the event is emitted
|
|
30
|
+
after the user clicks the button, using the `filter` prop as its payload.
|
|
31
|
+
- [`UserClickedASimpleFilter`[(x-components.xeventstypes.userclickedasimplefilter.md): the event is
|
|
32
|
+
emitted after the user clicks the button, using the `filter` prop as its payload.
|
|
33
|
+
|
|
34
|
+
## See it in action
|
|
25
35
|
|
|
26
36
|
This component renders a button, which on clicked emits the `UserClickedAFilter` and the
|
|
27
37
|
`UserClickedASimpleFilter` events. By default, it renders a `button` with the `filter.label`
|
|
28
38
|
property as text.
|
|
29
39
|
|
|
30
|
-
|
|
40
|
+
The `filter` prop is required. The `clickEvents` prop is optional and allows configuring the events
|
|
41
|
+
to emit on click.
|
|
31
42
|
|
|
32
43
|
```vue
|
|
33
44
|
<template>
|
|
@@ -58,6 +69,42 @@ export default {
|
|
|
58
69
|
</script>
|
|
59
70
|
```
|
|
60
71
|
|
|
72
|
+
### Playing with props
|
|
73
|
+
|
|
74
|
+
Configuring the events to emit when the filter is clicked.
|
|
75
|
+
|
|
76
|
+
```vue
|
|
77
|
+
<template>
|
|
78
|
+
<SimpleFilter
|
|
79
|
+
:clickEvents="{ UserClickedASimpleFilter: filter }"
|
|
80
|
+
:filter="filter"
|
|
81
|
+
/>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script>
|
|
85
|
+
import { SimpleFilter } from "@empathyco/x-components/facets";
|
|
86
|
+
|
|
87
|
+
export default {
|
|
88
|
+
name: "SimpleFilterTest",
|
|
89
|
+
components: {
|
|
90
|
+
SimpleFilter
|
|
91
|
+
},
|
|
92
|
+
data() {
|
|
93
|
+
return {
|
|
94
|
+
filter: {
|
|
95
|
+
modelName: "SimpleFilter",
|
|
96
|
+
selected: false,
|
|
97
|
+
id: "category:shirts",
|
|
98
|
+
value: "category:shirts",
|
|
99
|
+
facetId: "category",
|
|
100
|
+
totalResults: 10
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
```
|
|
107
|
+
|
|
61
108
|
### Rendering an input
|
|
62
109
|
|
|
63
110
|
You can change the rendered control using the default slot. Note that because of the current Vue
|
|
@@ -141,10 +188,3 @@ export default {
|
|
|
141
188
|
};
|
|
142
189
|
</script>
|
|
143
190
|
```
|
|
144
|
-
|
|
145
|
-
## Events
|
|
146
|
-
|
|
147
|
-
A list of events that the component will emit:
|
|
148
|
-
|
|
149
|
-
- `UserClickedASimpleFilter`: the event is emitted after the user clicks the button. The event
|
|
150
|
-
payload is the simple filter.
|
|
@@ -19,7 +19,7 @@ var __vue_render__ = function () {
|
|
|
19
19
|
_c("RenderlessFilter", {
|
|
20
20
|
staticClass: "x-hierarchical-filter",
|
|
21
21
|
class: _vm.cssClasses,
|
|
22
|
-
attrs: { clickEvents: _vm.
|
|
22
|
+
attrs: { clickEvents: _vm._clickEvents, filter: _vm.filter },
|
|
23
23
|
scopedSlots: _vm._u(
|
|
24
24
|
[
|
|
25
25
|
{
|
|
@@ -94,6 +94,7 @@ var __vue_render__ = function () {
|
|
|
94
94
|
attrs: {
|
|
95
95
|
childrenAnimation: _vm.childrenAnimation,
|
|
96
96
|
filter: childFilter,
|
|
97
|
+
clickEvents: _vm.getChildFilterClickEvents(childFilter),
|
|
97
98
|
},
|
|
98
99
|
scopedSlots: _vm._u(
|
|
99
100
|
[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hierarchical-filter.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/hierarchical-filter.vue"],"sourcesContent":["<template>\n <div class=\"x-hierarchical-filter-container\" data-test=\"hierarchical-filter-container\">\n <RenderlessFilter\n v-slot=\"{ filter, clickFilter, cssClasses, isDisabled }\"\n :class=\"cssClasses\"\n :clickEvents=\"clickEvents\"\n :filter=\"filter\"\n class=\"x-hierarchical-filter\"\n >\n <!--\n @slot The content to render inside the button.\n @binding {Filter} filter - The filter data.\n @binding {Function} clickFilter - The handler to invoke when clicking the filter.\n @binding {VueCssClasses} cssClasses - The CSS classes.\n @binding {boolean} isDisabled - Flag determining the disabled state.\n -->\n <slot v-bind=\"{ filter, clickFilter, cssClasses, isDisabled }\">\n <button\n @click=\"clickFilter\"\n :aria-checked=\"filter.selected.toString()\"\n :class=\"cssClasses\"\n :disabled=\"isDisabled\"\n data-test=\"filter\"\n role=\"checkbox\"\n >\n <!--\n @slot The content to render inside the button.\n @binding {Filter} filter - The filter data.\n -->\n <slot name=\"label\" :filter=\"filter\">{{ filter.label }}</slot>\n </button>\n </slot>\n </RenderlessFilter>\n <FiltersList\n #default=\"{ filter: childFilter }\"\n :animation=\"childrenAnimation\"\n :filters=\"renderedChildrenFilters\"\n :parent-id=\"filter.id\"\n class=\"x-hierarchical-filter__children\"\n data-test=\"children-filters\"\n >\n <HierarchicalFilter :childrenAnimation=\"childrenAnimation\" :filter=\"childFilter\">\n <template #default=\"{ filter, clickFilter, cssClasses, isDisabled }\">\n <slot v-bind=\"{ filter, clickFilter, cssClasses, isDisabled }\" />\n </template>\n <template #label=\"{ filter }\">\n <slot name=\"label\" :filter=\"filter\" />\n </template>\n </HierarchicalFilter>\n </FiltersList>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Filter, HierarchicalFilter as HierarchicalFilterModel } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { State, xComponentMixin } from '../../../../components';\n import { VueCSSClasses } from '../../../../utils/types';\n import { XEventsTypes } from '../../../../wiring/events.types';\n import { facetsXModule } from '../../x-module';\n import FiltersList from '../lists/filters-list.vue';\n import RenderlessFilter from './renderless-filter.vue';\n\n /**\n * Renders a hierarchical filter recursively, emitting the needed events when clicked.\n *\n * @public\n */\n @Component({\n name: 'HierarchicalFilter',\n components: { FiltersList, RenderlessFilter },\n mixins: [xComponentMixin(facetsXModule)]\n })\n export default class HierarchicalFilter extends Vue {\n /** The filter data to render. */\n @Prop({ required: true })\n public filter!: HierarchicalFilterModel;\n\n /** The animation component to use for the children filters. */\n @Prop()\n public childrenAnimation?: Vue | string;\n /**\n * The state filters.\n *\n * @internal\n */\n @State('facets', 'filters')\n public filters!: Record<Filter['id'], Filter>;\n\n /**\n * Additional events to emit when the filter is clicked.\n *\n * @returns A dictionary with the events to be emitted when the filter is clicked, and its\n * payload.\n * @internal\n */\n protected get clickEvents(): Partial<XEventsTypes> {\n return {\n UserClickedAHierarchicalFilter: this.filter\n };\n }\n\n /**\n * Dynamic CSS classes to apply to the component.\n *\n * @returns The dynamic CSS classes to apply to the component.\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return {\n 'x-hierarchical-filter--is-partially-selected': this.isPartiallySelected,\n 'x-hierarchical-filter--is-selected': this.filter.selected,\n 'x-filter--is-partially-selected': this.isPartiallySelected\n };\n }\n\n /**\n * Returns if the filter is partially selected, which means having more than one child filter\n * selected, but not every of them, or having at least one child filter partially selected.\n *\n * @returns True if the filter is partially selected. False otherwise.\n * @internal\n */\n protected get isPartiallySelected(): boolean {\n return this.isFilterPartiallySelected(this.filter);\n }\n\n /**\n * List of filters to render, in case that the children's array\n * is empty it will return an empty array instead of inject the ones from the parent.\n *\n * @returns A list of filters.\n *\n * @internal\n */\n protected get renderedChildrenFilters(): Filter[] {\n return this.filter.children?.map(filterId => this.filters[filterId]) ?? [];\n }\n\n protected isFilterPartiallySelected(filter: HierarchicalFilterModel): boolean {\n const selectedChildren = filter.children\n ?.map(filterId => this.filters[filterId])\n ?.filter(filter => filter?.selected) as HierarchicalFilterModel[] | undefined;\n const filterChildrenLength = filter.children?.length ?? 0;\n return (\n !!selectedChildren &&\n ((selectedChildren.length > 0 && selectedChildren.length < filterChildrenLength) ||\n // eslint-disable-next-line @typescript-eslint/unbound-method\n selectedChildren.some(this.isFilterPartiallySelected))\n );\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThis component renders a button, which on clicked emits the `UserClickedAFilter` and\n`UserClickedAHierarchicalFilter` events. By default it renders the filter label as the button text.\nIf the provided filter has children filters, this component will render them recursively. Changing\nthe slot content will change it for all of the children.\n\n### Basic usage\n\n```vue\n<template>\n <HierarchicalFilter\n :filter=\"filter\"\n v-slot=\"{ filter: slotFilter, clickFilter, cssClasses, isDisabled }\"\n />\n</template>\n```\n\n### Customizing the default slot content\n\nIn this example, the child filters will also include the label and checkbox.\n\n```vue\n<HierarchicalFilter :filter=\"filter\" v-slot=\"{ filter, clickFilter, slotCSSClasses, isDisabled }\">\n <label :class=\"slotCSSClasses\">\n <input @change=\"clickFilter\" :disabled=\"isDisabled\">\n {{ filter.label }}\n </label>\n</HierarchicalFilter>\n```\n\n### Customizing the label slot content\n\n```vue\n<HierarchicalFilter :filter=\"filter\">\n <template #label :filter=\"filter\">\n <span class=\"custom-class\">{{ filter.label }}</span>\n </template>\n</HierarchicalFilter>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserClickedAHierarchicalFilter`: the event is emitted after the user clicks the button. The event\n payload is the hierarchical filter.\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"hierarchical-filter.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/hierarchical-filter.vue"],"sourcesContent":["<template>\n <div class=\"x-hierarchical-filter-container\" data-test=\"hierarchical-filter-container\">\n <RenderlessFilter\n v-slot=\"{ filter, clickFilter, cssClasses, isDisabled }\"\n :class=\"cssClasses\"\n :clickEvents=\"_clickEvents\"\n :filter=\"filter\"\n class=\"x-hierarchical-filter\"\n >\n <!--\n @slot The content to render inside the button.\n @binding {Filter} filter - The filter data.\n @binding {Function} clickFilter - The handler to invoke when clicking the filter.\n @binding {VueCssClasses} cssClasses - The CSS classes.\n @binding {boolean} isDisabled - Flag determining the disabled state.\n -->\n <slot v-bind=\"{ filter, clickFilter, cssClasses, isDisabled }\">\n <button\n @click=\"clickFilter\"\n :aria-checked=\"filter.selected.toString()\"\n :class=\"cssClasses\"\n :disabled=\"isDisabled\"\n data-test=\"filter\"\n role=\"checkbox\"\n >\n <!--\n @slot The content to render inside the button.\n @binding {Filter} filter - The filter data.\n -->\n <slot name=\"label\" :filter=\"filter\">{{ filter.label }}</slot>\n </button>\n </slot>\n </RenderlessFilter>\n <FiltersList\n v-slot=\"{ filter: childFilter }\"\n :animation=\"childrenAnimation\"\n :filters=\"renderedChildrenFilters\"\n :parent-id=\"filter.id\"\n class=\"x-hierarchical-filter__children\"\n data-test=\"children-filters\"\n >\n <HierarchicalFilter\n :childrenAnimation=\"childrenAnimation\"\n :filter=\"childFilter\"\n :clickEvents=\"getChildFilterClickEvents(childFilter)\"\n >\n <template #default=\"{ filter, clickFilter, cssClasses, isDisabled }\">\n <slot v-bind=\"{ filter, clickFilter, cssClasses, isDisabled }\" />\n </template>\n <template #label=\"{ filter }\">\n <slot name=\"label\" :filter=\"filter\" />\n </template>\n </HierarchicalFilter>\n </FiltersList>\n </div>\n</template>\n\n<script lang=\"ts\">\n import {\n Filter,\n HierarchicalFilter as HierarchicalFilterModel,\n isHierarchicalFilter\n } from '@empathyco/x-types';\n import { isObject } from '@empathyco/x-utils';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { State, xComponentMixin } from '../../../../components';\n import { VueCSSClasses } from '../../../../utils/types';\n import { XEventsTypes } from '../../../../wiring/events.types';\n import { facetsXModule } from '../../x-module';\n import FiltersList from '../lists/filters-list.vue';\n import RenderlessFilter from './renderless-filter.vue';\n\n /**\n * Renders a hierarchical filter recursively, emitting the needed events when clicked.\n *\n * @public\n */\n @Component({\n name: 'HierarchicalFilter',\n components: { FiltersList, RenderlessFilter },\n mixins: [xComponentMixin(facetsXModule)]\n })\n export default class HierarchicalFilter extends Vue {\n /** The filter data to render. */\n @Prop({ required: true })\n public filter!: HierarchicalFilterModel;\n\n /** The animation component to use for the children filters. */\n @Prop()\n public childrenAnimation?: Vue | string;\n /**\n * The state filters.\n *\n * @internal\n */\n @State('facets', 'filters')\n public filters!: Record<Filter['id'], Filter>;\n\n /**\n * Additional events, with their payload, to emit when the filter is clicked.\n *\n * @public\n */\n @Prop()\n public clickEvents!: Partial<XEventsTypes>;\n\n /**\n * The {@link XEventsTypes | events} to emit.\n *\n * @returns The events to emit when clicked.\n * @internal\n */\n protected get _clickEvents(): Partial<XEventsTypes> {\n return {\n UserClickedAHierarchicalFilter: this.filter,\n ...this.clickEvents\n };\n }\n\n /**\n * Dynamic CSS classes to apply to the component.\n *\n * @returns The dynamic CSS classes to apply to the component.\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return {\n 'x-hierarchical-filter--is-partially-selected': this.isPartiallySelected,\n 'x-hierarchical-filter--is-selected': this.filter.selected,\n 'x-filter--is-partially-selected': this.isPartiallySelected\n };\n }\n\n /**\n * Gets the child filter click events, converting the payload of the events that have a\n * {@link @empathyco/x-types#HierarchicalFilter} as payload to the corresponding child filter.\n *\n * @param childFilter - The child filter.\n * @returns The events to emit when clicking a child.\n * @internal\n */\n protected getChildFilterClickEvents(\n childFilter: HierarchicalFilterModel\n ): Partial<XEventsTypes> {\n return Object.entries(this._clickEvents).reduce((clickEvents, [event, payload]) => {\n return {\n ...clickEvents,\n [event]:\n isObject(payload) &&\n isHierarchicalFilter(payload as unknown as Filter) &&\n childFilter !== (payload as unknown as HierarchicalFilterModel)\n ? childFilter\n : payload\n };\n }, {} as Partial<XEventsTypes>);\n }\n\n /**\n * Returns if the filter is partially selected, which means having more than one child filter\n * selected, but not every of them, or having at least one child filter partially selected.\n *\n * @returns True if the filter is partially selected. False otherwise.\n * @internal\n */\n protected get isPartiallySelected(): boolean {\n return this.isFilterPartiallySelected(this.filter);\n }\n\n /**\n * List of filters to render, in case that the children's array\n * is empty it will return an empty array instead of inject the ones from the parent.\n *\n * @returns A list of filters.\n * @internal\n */\n protected get renderedChildrenFilters(): Filter[] {\n return this.filter.children?.map(filterId => this.filters[filterId]) ?? [];\n }\n\n protected isFilterPartiallySelected(filter: HierarchicalFilterModel): boolean {\n const selectedChildren = filter.children\n ?.map(filterId => this.filters[filterId])\n ?.filter(filter => filter?.selected) as HierarchicalFilterModel[] | undefined;\n const filterChildrenLength = filter.children?.length ?? 0;\n return (\n !!selectedChildren &&\n ((selectedChildren.length > 0 && selectedChildren.length < filterChildrenLength) ||\n // eslint-disable-next-line @typescript-eslint/unbound-method\n selectedChildren.some(this.isFilterPartiallySelected))\n );\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedAFilter`](x-components.xeventstypes.userclickedafilter.md): the event is emitted\n after the user clicks the button, using the `filter` prop as its payload.\n- [`UserClickedAHierarchicalFilter`](x-components.xeventstypes.userclickedahierarchicalfilter.md):\n the event is emitted after the user clicks the button, using the `filter` prop as its payload.\n filter.\n\n## See it in action\n\nThis component renders a button, which on clicked emits the `UserClickedAFilter` and\n`UserClickedAHierarchicalFilter` events. By default it renders the filter label as the button text.\nIf the provided filter has children filters, this component will render them recursively. Changing\nthe slot content will change it for all of the children.\n\nThe `filter` prop is required. The `clickEvents` prop is optional and allows configuring the events\nto emit on click.\n\n```vue\n<template>\n <HierarchicalFilter :filter=\"filter\" />\n</template>\n\n<script>\n import { HierarchicalFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'HierarchicalFilterTest',\n components: {\n HierarchicalFilter\n },\n date() {\n return {\n filter: {\n id: `categories:men`,\n modelName: 'HierarchicalFilter',\n label: `men`,\n facetId: 'categories',\n parentId: null,\n totalResults: 10,\n children: [],\n selected: false\n }\n };\n }\n };\n</script>\n```\n\n### Playing with props\n\nConfiguring the events to emit when the filter is clicked.\n\n```vue\n<template>\n <HierarchicalFilter :clickEvents=\"{ UserClickedAHierarchicalFilter: filter }\" :filter=\"filter\" />\n</template>\n\n<script>\n import { HierarchicalFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'HierarchicalFilterTest',\n components: {\n HierarchicalFilter\n },\n date() {\n return {\n filter: {\n id: `categories:men`,\n modelName: 'HierarchicalFilter',\n label: `men`,\n facetId: 'categories',\n parentId: null,\n totalResults: 10,\n children: [],\n selected: false\n }\n };\n }\n };\n</script>\n```\n\n### Customizing the default slot content\n\nIn this example, the child filters will also include the label and checkbox.\n\n```vue\n<template>\n <HierarchicalFilter :filter=\"filter\" v-slot=\"{ filter, clickFilter, slotCSSClasses, isDisabled }\">\n <label :class=\"slotCSSClasses\">\n <input @change=\"clickFilter\" :disabled=\"isDisabled\" />\n {{ filter.label }}\n </label>\n </HierarchicalFilter>\n</template>\n\n<script>\n import { HierarchicalFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'HierarchicalFilterTest',\n components: {\n HierarchicalFilter\n },\n date() {\n return {\n filter: {\n id: `categories:men`,\n modelName: 'HierarchicalFilter',\n label: `men`,\n facetId: 'categories',\n parentId: null,\n totalResults: 10,\n children: [],\n selected: false\n }\n };\n }\n };\n</script>\n```\n\n### Customizing the label slot content\n\n```vue\n<template>\n <HierarchicalFilter :filter=\"filter\">\n <template #label :filter=\"filter\">\n <span class=\"custom-class\">{{ filter.label }}</span>\n </template>\n </HierarchicalFilter>\n</template>\n\n<script>\n import { HierarchicalFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'HierarchicalFilterTest',\n components: {\n HierarchicalFilter\n },\n date() {\n return {\n filter: {\n id: `categories:men`,\n modelName: 'HierarchicalFilter',\n label: `men`,\n facetId: 'categories',\n parentId: null,\n totalResults: 10,\n children: [],\n selected: false\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
+
import { isHierarchicalFilter } from '@empathyco/x-types';
|
|
3
|
+
import { isObject } from '@empathyco/x-utils';
|
|
2
4
|
import Vue from 'vue';
|
|
3
5
|
import { Prop, Component } from 'vue-property-decorator';
|
|
4
6
|
import '../../../../components/animations/animate-width.vue.js';
|
|
@@ -127,15 +129,15 @@ import __vue_component__$1 from './renderless-filter.vue.js';
|
|
|
127
129
|
*/
|
|
128
130
|
let HierarchicalFilter = class HierarchicalFilter extends Vue {
|
|
129
131
|
/**
|
|
130
|
-
*
|
|
132
|
+
* The {@link XEventsTypes | events} to emit.
|
|
131
133
|
*
|
|
132
|
-
* @returns
|
|
133
|
-
* payload.
|
|
134
|
+
* @returns The events to emit when clicked.
|
|
134
135
|
* @internal
|
|
135
136
|
*/
|
|
136
|
-
get
|
|
137
|
+
get _clickEvents() {
|
|
137
138
|
return {
|
|
138
|
-
UserClickedAHierarchicalFilter: this.filter
|
|
139
|
+
UserClickedAHierarchicalFilter: this.filter,
|
|
140
|
+
...this.clickEvents
|
|
139
141
|
};
|
|
140
142
|
}
|
|
141
143
|
/**
|
|
@@ -151,6 +153,26 @@ let HierarchicalFilter = class HierarchicalFilter extends Vue {
|
|
|
151
153
|
'x-filter--is-partially-selected': this.isPartiallySelected
|
|
152
154
|
};
|
|
153
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Gets the child filter click events, converting the payload of the events that have a
|
|
158
|
+
* {@link @empathyco/x-types#HierarchicalFilter} as payload to the corresponding child filter.
|
|
159
|
+
*
|
|
160
|
+
* @param childFilter - The child filter.
|
|
161
|
+
* @returns The events to emit when clicking a child.
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
getChildFilterClickEvents(childFilter) {
|
|
165
|
+
return Object.entries(this._clickEvents).reduce((clickEvents, [event, payload]) => {
|
|
166
|
+
return {
|
|
167
|
+
...clickEvents,
|
|
168
|
+
[event]: isObject(payload) &&
|
|
169
|
+
isHierarchicalFilter(payload) &&
|
|
170
|
+
childFilter !== payload
|
|
171
|
+
? childFilter
|
|
172
|
+
: payload
|
|
173
|
+
};
|
|
174
|
+
}, {});
|
|
175
|
+
}
|
|
154
176
|
/**
|
|
155
177
|
* Returns if the filter is partially selected, which means having more than one child filter
|
|
156
178
|
* selected, but not every of them, or having at least one child filter partially selected.
|
|
@@ -166,7 +188,6 @@ let HierarchicalFilter = class HierarchicalFilter extends Vue {
|
|
|
166
188
|
* is empty it will return an empty array instead of inject the ones from the parent.
|
|
167
189
|
*
|
|
168
190
|
* @returns A list of filters.
|
|
169
|
-
*
|
|
170
191
|
* @internal
|
|
171
192
|
*/
|
|
172
193
|
get renderedChildrenFilters() {
|
|
@@ -192,6 +213,9 @@ __decorate([
|
|
|
192
213
|
__decorate([
|
|
193
214
|
State('facets', 'filters')
|
|
194
215
|
], HierarchicalFilter.prototype, "filters", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
Prop()
|
|
218
|
+
], HierarchicalFilter.prototype, "clickEvents", void 0);
|
|
195
219
|
HierarchicalFilter = __decorate([
|
|
196
220
|
Component({
|
|
197
221
|
name: 'HierarchicalFilter',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hierarchical-filter.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/hierarchical-filter.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\n\n\n\n\n\n\n\n\n\n\nimport {
|
|
1
|
+
{"version":3,"file":"hierarchical-filter.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/hierarchical-filter.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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport {\n Filter,\n HierarchicalFilter as HierarchicalFilterModel,\n isHierarchicalFilter\n} from '@empathyco/x-types';\nimport { isObject } from '@empathyco/x-utils';\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { State, xComponentMixin } from '../../../../components';\nimport { VueCSSClasses } from '../../../../utils/types';\nimport { XEventsTypes } from '../../../../wiring/events.types';\nimport { facetsXModule } from '../../x-module';\nimport FiltersList from '../lists/filters-list.vue';\nimport RenderlessFilter from './renderless-filter.vue';\n\n/**\n * Renders a hierarchical filter recursively, emitting the needed events when clicked.\n *\n * @public\n */\n@Component({\n name: 'HierarchicalFilter',\n components: { FiltersList, RenderlessFilter },\n mixins: [xComponentMixin(facetsXModule)]\n})\nexport default class HierarchicalFilter extends Vue {\n /** The filter data to render. */\n @Prop({ required: true })\n public filter!: HierarchicalFilterModel;\n\n /** The animation component to use for the children filters. */\n @Prop()\n public childrenAnimation?: Vue | string;\n /**\n * The state filters.\n *\n * @internal\n */\n @State('facets', 'filters')\n public filters!: Record<Filter['id'], Filter>;\n\n /**\n * Additional events, with their payload, to emit when the filter is clicked.\n *\n * @public\n */\n @Prop()\n public clickEvents!: Partial<XEventsTypes>;\n\n /**\n * The {@link XEventsTypes | events} to emit.\n *\n * @returns The events to emit when clicked.\n * @internal\n */\n protected get _clickEvents(): Partial<XEventsTypes> {\n return {\n UserClickedAHierarchicalFilter: this.filter,\n ...this.clickEvents\n };\n }\n\n /**\n * Dynamic CSS classes to apply to the component.\n *\n * @returns The dynamic CSS classes to apply to the component.\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return {\n 'x-hierarchical-filter--is-partially-selected': this.isPartiallySelected,\n 'x-hierarchical-filter--is-selected': this.filter.selected,\n 'x-filter--is-partially-selected': this.isPartiallySelected\n };\n }\n\n /**\n * Gets the child filter click events, converting the payload of the events that have a\n * {@link @empathyco/x-types#HierarchicalFilter} as payload to the corresponding child filter.\n *\n * @param childFilter - The child filter.\n * @returns The events to emit when clicking a child.\n * @internal\n */\n protected getChildFilterClickEvents(\n childFilter: HierarchicalFilterModel\n ): Partial<XEventsTypes> {\n return Object.entries(this._clickEvents).reduce((clickEvents, [event, payload]) => {\n return {\n ...clickEvents,\n [event]:\n isObject(payload) &&\n isHierarchicalFilter(payload as unknown as Filter) &&\n childFilter !== (payload as unknown as HierarchicalFilterModel)\n ? childFilter\n : payload\n };\n }, {} as Partial<XEventsTypes>);\n }\n\n /**\n * Returns if the filter is partially selected, which means having more than one child filter\n * selected, but not every of them, or having at least one child filter partially selected.\n *\n * @returns True if the filter is partially selected. False otherwise.\n * @internal\n */\n protected get isPartiallySelected(): boolean {\n return this.isFilterPartiallySelected(this.filter);\n }\n\n /**\n * List of filters to render, in case that the children's array\n * is empty it will return an empty array instead of inject the ones from the parent.\n *\n * @returns A list of filters.\n * @internal\n */\n protected get renderedChildrenFilters(): Filter[] {\n return this.filter.children?.map(filterId => this.filters[filterId]) ?? [];\n }\n\n protected isFilterPartiallySelected(filter: HierarchicalFilterModel): boolean {\n const selectedChildren = filter.children\n ?.map(filterId => this.filters[filterId])\n ?.filter(filter => filter?.selected) as HierarchicalFilterModel[] | undefined;\n const filterChildrenLength = filter.children?.length ?? 0;\n return (\n !!selectedChildren &&\n ((selectedChildren.length > 0 && selectedChildren.length < filterChildrenLength) ||\n // eslint-disable-next-line @typescript-eslint/unbound-method\n selectedChildren.some(this.isFilterPartiallySelected))\n );\n }\n}\n"],"names":["FiltersList","RenderlessFilter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA;;;;;AAUA,IAAqB,kBAAkB,GAAvC,MAAqB,kBAAmB,SAAQ,GAAG;;;;;;;IA8BjD,IAAc,YAAY;QACxB,OAAO;YACL,8BAA8B,EAAE,IAAI,CAAC,MAAM;YAC3C,GAAG,IAAI,CAAC,WAAW;SACpB,CAAC;KACH;;;;;;;IAQD,IAAc,UAAU;QACtB,OAAO;YACL,8CAA8C,EAAE,IAAI,CAAC,mBAAmB;YACxE,oCAAoC,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC1D,iCAAiC,EAAE,IAAI,CAAC,mBAAmB;SAC5D,CAAC;KACH;;;;;;;;;IAUS,yBAAyB,CACjC,WAAoC;QAEpC,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;YAC5E,OAAO;gBACL,GAAG,WAAW;gBACd,CAAC,KAAK,GACJ,QAAQ,CAAC,OAAO,CAAC;oBACjB,oBAAoB,CAAC,OAA4B,CAAC;oBAClD,WAAW,KAAM,OAA8C;sBAC3D,WAAW;sBACX,OAAO;aACd,CAAC;SACH,EAAE,EAA2B,CAAC,CAAC;KACjC;;;;;;;;IASD,IAAc,mBAAmB;QAC/B,OAAO,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACpD;;;;;;;;IASD,IAAc,uBAAuB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;KAC5E;IAES,yBAAyB,CAAC,MAA+B;QACjE,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ;cACpC,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;cACvC,MAAM,CAAC,MAAM,IAAI,MAAM,EAAE,QAAQ,CAA0C,CAAC;QAChF,MAAM,oBAAoB,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAC;QAC1D,QACE,CAAC,CAAC,gBAAgB;aACjB,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,IAAI,gBAAgB,CAAC,MAAM,GAAG,oBAAoB;;gBAE7E,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,EACxD;KACH;CACF,CAAA;AA1GC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACe;AAIxC;IADC,IAAI,EAAE;6DACiC;AAOxC;IADC,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC;mDACmB;AAQ9C;IADC,IAAI,EAAE;uDACoC;AAtBxB,kBAAkB;IALtC,SAAS,CAAC;QACT,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE,eAAEA,iBAAW,oBAAEC,mBAAgB,EAAE;QAC7C,MAAM,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;KACzC,CAAC;GACmB,kBAAkB,CA6GtC;aA7GoB,kBAAkB;;;;"}
|
|
@@ -12,7 +12,7 @@ var __vue_render__ = function () {
|
|
|
12
12
|
return _c("RenderlessFilter", {
|
|
13
13
|
staticClass: "x-number-range-filter",
|
|
14
14
|
class: _vm.cssClasses,
|
|
15
|
-
attrs: { clickEvents: _vm.
|
|
15
|
+
attrs: { clickEvents: _vm._clickEvents, filter: _vm.filter },
|
|
16
16
|
scopedSlots: _vm._u(
|
|
17
17
|
[
|
|
18
18
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-range-filter.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/number-range-filter.vue"],"sourcesContent":["<template>\n <RenderlessFilter\n v-slot=\"{ filter, clickFilter, cssClasses, isDisabled }\"\n :class=\"cssClasses\"\n :clickEvents=\"
|
|
1
|
+
{"version":3,"file":"number-range-filter.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/number-range-filter.vue"],"sourcesContent":["<template>\n <RenderlessFilter\n v-slot=\"{ filter, clickFilter, cssClasses, isDisabled }\"\n :class=\"cssClasses\"\n :clickEvents=\"_clickEvents\"\n :filter=\"filter\"\n class=\"x-number-range-filter\"\n >\n <!--\n @slot The control element to render\n @binding {Filter} filter - The filter data\n @binding {() => void} clickFilter - Method that will invoke the needed actions after the user\n clicks the filter.\n @binding {Object} cssClasses - Object containing CSS classes to add to the button\n @binding {Boolean} isDisabled - True if the filter shouldn't be able to be selected by the\n user\n -->\n <slot\n v-bind=\"{\n filter,\n clickFilter,\n cssClasses,\n isDisabled\n }\"\n >\n <button\n @click=\"clickFilter\"\n :aria-checked=\"filter.selected.toString()\"\n :class=\"cssClasses\"\n :disabled=\"isDisabled\"\n data-test=\"filter\"\n role=\"checkbox\"\n >\n <!--\n @slot The content to render inside the button\n @binding {Filter} filter - The filter data\n -->\n <slot :filter=\"filter\" name=\"label\">{{ filter.label }}</slot>\n </button>\n </slot>\n </RenderlessFilter>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { NumberRangeFilter as NumberRangeFilterModel } from '@empathyco/x-types';\n import { xComponentMixin } from '../../../../components';\n import { VueCSSClasses } from '../../../../utils/types';\n import { XEventsTypes } from '../../../../wiring/events.types';\n import { facetsXModule } from '../../x-module';\n import RenderlessFilter from './renderless-filter.vue';\n\n /**\n * Renders a number range filter, emitting the needed events when clicked.\n *\n * @public\n */\n @Component({\n components: { RenderlessFilter },\n mixins: [xComponentMixin(facetsXModule)]\n })\n export default class NumberRangeFilter extends Vue {\n /** The filter data to render. */\n @Prop({ required: true })\n public filter!: NumberRangeFilterModel;\n\n /**\n * Additional events, with their payload, to emit when the filter is clicked.\n *\n * @public\n */\n @Prop()\n public clickEvents?: Partial<XEventsTypes>;\n\n /**\n * The {@link XEventsTypes | events} to emit.\n *\n * @returns The events to emit when clicked.\n * @internal\n */\n protected get _clickEvents(): Partial<XEventsTypes> {\n return {\n UserClickedANumberRangeFilter: this.filter,\n ...this.clickEvents\n };\n }\n\n /**\n * Dynamic CSS classes to apply to the component.\n *\n * @returns The dynamic CSS classes to apply to the component.\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return {\n 'x-number-range-filter--is-selected': this.filter.selected\n };\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserClickedAFilter`](x-components.xeventstypes.userclickedafilter.md): the event is emitted\n after the user clicks the button, using the `filter` prop as its payload.\n- [`UserClickedANumberRangeFilter`](x-components.xeventstypes.userclickedanumberrangefilter.md): the\n event is emitted after the user clicks the button, using the `filter` prop as its payload.\n\n## See it in action\n\nThis component renders a button which, on clicked, emits the `UserClickedAFilter` and the\n`UserClickedANumberRangeFilter` events. By default, it renders the filter label as the button text.\n\nThe `filter` prop is required. The `clickEvents` prop is optional and allows configuring the events\nto emit on click.\n\n```vue\n<template>\n <NumberRangeFilter :filter=\"filter\" />\n</template>\n\n<script>\n import { NumberRangeFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'NumberRangeFilterTest',\n components: {\n NumberRangeFilter\n },\n date() {\n return {\n filter: {\n id: `price:1-10`,\n modelName: 'NumberRangeFilter',\n label: `From 1 to 10`,\n facetId: 'price',\n range: {\n min: 1,\n max: 10\n },\n selected: false\n }\n };\n }\n };\n</script>\n```\n\n### Playing with props\n\nConfiguring the events to emit when the filter is clicked.\n\n```vue\n<template>\n <NumberRangeFilter :clickEvents=\"{ UserClickedANumberRangeFilter: filter }\" :filter=\"filter\" />\n</template>\n\n<script>\n import { NumberRangeFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'NumberRangeFilterTest',\n components: {\n NumberRangeFilter\n },\n date() {\n return {\n filter: {\n id: `price:1-10`,\n modelName: 'NumberRangeFilter',\n label: `From 1 to 10`,\n facetId: 'price',\n range: {\n min: 1,\n max: 10\n },\n selected: false\n }\n };\n }\n };\n</script>\n```\n\n### Customizing its contents\n\n```vue\n<template>\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <img src=\"checkbox.png\" />\n <span>{{ filter.label }}</span>\n </NumberRangeFilter>\n</template>\n\n<script>\n import { NumberRangeFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'NumberRangeFilterTest',\n components: {\n NumberRangeFilter\n },\n date() {\n return {\n filter: {\n id: `price:1-10`,\n modelName: 'NumberRangeFilter',\n label: `From 1 to 10`,\n facetId: 'price',\n range: {\n min: 1,\n max: 10\n },\n selected: false\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -125,15 +125,15 @@ import __vue_component__ from './renderless-filter.vue.js';
|
|
|
125
125
|
*/
|
|
126
126
|
let NumberRangeFilter = class NumberRangeFilter extends Vue {
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
128
|
+
* The {@link XEventsTypes | events} to emit.
|
|
129
129
|
*
|
|
130
|
-
* @returns
|
|
131
|
-
* payload.
|
|
130
|
+
* @returns The events to emit when clicked.
|
|
132
131
|
* @internal
|
|
133
132
|
*/
|
|
134
|
-
get
|
|
133
|
+
get _clickEvents() {
|
|
135
134
|
return {
|
|
136
|
-
UserClickedANumberRangeFilter: this.filter
|
|
135
|
+
UserClickedANumberRangeFilter: this.filter,
|
|
136
|
+
...this.clickEvents
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
@@ -151,6 +151,9 @@ let NumberRangeFilter = class NumberRangeFilter extends Vue {
|
|
|
151
151
|
__decorate([
|
|
152
152
|
Prop({ required: true })
|
|
153
153
|
], NumberRangeFilter.prototype, "filter", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
Prop()
|
|
156
|
+
], NumberRangeFilter.prototype, "clickEvents", void 0);
|
|
154
157
|
NumberRangeFilter = __decorate([
|
|
155
158
|
Component({
|
|
156
159
|
components: { RenderlessFilter: __vue_component__ },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-range-filter.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/number-range-filter.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 Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { NumberRangeFilter as NumberRangeFilterModel } from '@empathyco/x-types';\nimport { xComponentMixin } from '../../../../components';\nimport { VueCSSClasses } from '../../../../utils/types';\nimport { XEventsTypes } from '../../../../wiring/events.types';\nimport { facetsXModule } from '../../x-module';\nimport RenderlessFilter from './renderless-filter.vue';\n\n/**\n * Renders a number range filter, emitting the needed events when clicked.\n *\n * @public\n */\n@Component({\n components: { RenderlessFilter },\n mixins: [xComponentMixin(facetsXModule)]\n})\nexport default class NumberRangeFilter extends Vue {\n /** The filter data to render. */\n @Prop({ required: true })\n public filter!: NumberRangeFilterModel;\n\n /**\n * Additional events to emit when the filter is clicked.\n *\n * @
|
|
1
|
+
{"version":3,"file":"number-range-filter.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/number-range-filter.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 Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { NumberRangeFilter as NumberRangeFilterModel } from '@empathyco/x-types';\nimport { xComponentMixin } from '../../../../components';\nimport { VueCSSClasses } from '../../../../utils/types';\nimport { XEventsTypes } from '../../../../wiring/events.types';\nimport { facetsXModule } from '../../x-module';\nimport RenderlessFilter from './renderless-filter.vue';\n\n/**\n * Renders a number range filter, emitting the needed events when clicked.\n *\n * @public\n */\n@Component({\n components: { RenderlessFilter },\n mixins: [xComponentMixin(facetsXModule)]\n})\nexport default class NumberRangeFilter extends Vue {\n /** The filter data to render. */\n @Prop({ required: true })\n public filter!: NumberRangeFilterModel;\n\n /**\n * Additional events, with their payload, to emit when the filter is clicked.\n *\n * @public\n */\n @Prop()\n public clickEvents?: Partial<XEventsTypes>;\n\n /**\n * The {@link XEventsTypes | events} to emit.\n *\n * @returns The events to emit when clicked.\n * @internal\n */\n protected get _clickEvents(): Partial<XEventsTypes> {\n return {\n UserClickedANumberRangeFilter: this.filter,\n ...this.clickEvents\n };\n }\n\n /**\n * Dynamic CSS classes to apply to the component.\n *\n * @returns The dynamic CSS classes to apply to the component.\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return {\n 'x-number-range-filter--is-selected': this.filter.selected\n };\n }\n}\n"],"names":["RenderlessFilter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA;;;;;AASA,IAAqB,iBAAiB,GAAtC,MAAqB,iBAAkB,SAAQ,GAAG;;;;;;;IAmBhD,IAAc,YAAY;QACxB,OAAO;YACL,6BAA6B,EAAE,IAAI,CAAC,MAAM;YAC1C,GAAG,IAAI,CAAC,WAAW;SACpB,CAAC;KACH;;;;;;;IAQD,IAAc,UAAU;QACtB,OAAO;YACL,oCAAoC,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;SAC3D,CAAC;KACH;CACF,CAAA;AAlCC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;iDACc;AAQvC;IADC,IAAI,EAAE;sDACoC;AAXxB,iBAAiB;IAJrC,SAAS,CAAC;QACT,UAAU,EAAE,oBAAEA,iBAAgB,EAAE;QAChC,MAAM,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;KACzC,CAAC;GACmB,iBAAiB,CAqCrC;aArCoB,iBAAiB;;;;"}
|
|
@@ -12,7 +12,7 @@ var __vue_render__ = function () {
|
|
|
12
12
|
return _c("RenderlessFilter", {
|
|
13
13
|
staticClass: "x-simple-filter",
|
|
14
14
|
class: _vm.cssClasses,
|
|
15
|
-
attrs: { clickEvents: _vm.
|
|
15
|
+
attrs: { clickEvents: _vm._clickEvents, filter: _vm.filter },
|
|
16
16
|
scopedSlots: _vm._u(
|
|
17
17
|
[
|
|
18
18
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-filter.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/simple-filter.vue"],"sourcesContent":["<template>\n <RenderlessFilter\n v-slot=\"{ filter, clickFilter, cssClasses, isDisabled }\"\n :class=\"cssClasses\"\n :clickEvents=\"
|
|
1
|
+
{"version":3,"file":"simple-filter.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/simple-filter.vue"],"sourcesContent":["<template>\n <RenderlessFilter\n v-slot=\"{ filter, clickFilter, cssClasses, isDisabled }\"\n :class=\"cssClasses\"\n :clickEvents=\"_clickEvents\"\n :filter=\"filter\"\n class=\"x-simple-filter\"\n >\n <!--\n @slot The control element to render\n @binding {Filter} filter - The filter data\n @binding {() => void} clickFilter - Method that will invoke the needed actions after the user\n clicks the filter.\n @binding {Object} cssClasses - Object containing CSS classes to add to the button\n @binding {Boolean} isDisabled - True if the filter shouldn't be able to be selected by the\n user\n -->\n <slot\n v-bind=\"{\n filter,\n clickFilter,\n cssClasses,\n isDisabled\n }\"\n >\n <button\n @click=\"clickFilter\"\n :aria-checked=\"filter.selected.toString()\"\n :class=\"cssClasses\"\n :disabled=\"isDisabled\"\n data-test=\"filter\"\n role=\"checkbox\"\n >\n <!--\n @slot The content to render inside the button\n @binding {Filter} filter - The filter data\n -->\n <slot :filter=\"filter\" name=\"label\">{{ filter.label }}</slot>\n </button>\n </slot>\n </RenderlessFilter>\n</template>\n\n<script lang=\"ts\">\n import { SimpleFilter as SimpleFilterModel } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { xComponentMixin } from '../../../../components';\n import { VueCSSClasses } from '../../../../utils/types';\n import { XEventsTypes } from '../../../../wiring/events.types';\n import { facetsXModule } from '../../x-module';\n import RenderlessFilter from './renderless-filter.vue';\n\n /**\n * Renders a simple filter, emitting the needed events when clicked.\n *\n * @public\n */\n @Component({\n components: { RenderlessFilter },\n mixins: [xComponentMixin(facetsXModule)]\n })\n export default class SimpleFilter extends Vue {\n /** The filter data to render. */\n @Prop({ required: true })\n public filter!: SimpleFilterModel;\n\n /**\n * Additional events, with their payload, to emit when the filter is clicked.\n *\n * @public\n */\n @Prop()\n public clickEvents?: Partial<XEventsTypes>;\n\n /**\n * The {@link XEventsTypes | events} to emit.\n *\n * @returns The events to emit when clicked.\n * @internal\n */\n protected get _clickEvents(): Partial<XEventsTypes> {\n return {\n UserClickedASimpleFilter: this.filter,\n ...this.clickEvents\n };\n }\n\n /**\n * Dynamic CSS classes to apply to the component.\n *\n * @returns The dynamic CSS classes to apply to the component.\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return {\n 'x-simple-filter--is-selected': this.filter.selected\n };\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedAFilter`](x-components.xeventstypes.userclickedafilter.md): the event is emitted\n after the user clicks the button, using the `filter` prop as its payload.\n- [`UserClickedASimpleFilter`[(x-components.xeventstypes.userclickedasimplefilter.md): the event is\n emitted after the user clicks the button, using the `filter` prop as its payload.\n\n## See it in action\n\nThis component renders a button, which on clicked emits the `UserClickedAFilter` and the\n`UserClickedASimpleFilter` events. By default, it renders a `button` with the `filter.label`\nproperty as text.\n\nThe `filter` prop is required. The `clickEvents` prop is optional and allows configuring the events\nto emit on click.\n\n```vue\n<template>\n <SimpleFilter :filter=\"filter\" />\n</template>\n\n<script>\n import { SimpleFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'SimpleFilterTest',\n components: {\n SimpleFilter\n },\n data() {\n return {\n filter: {\n modelName: 'SimpleFilter',\n selected: false,\n id: 'category:shirts',\n value: 'category:shirts',\n facetId: 'category',\n totalResults: 10\n }\n };\n }\n };\n</script>\n```\n\n### Playing with props\n\nConfiguring the events to emit when the filter is clicked.\n\n```vue\n<template>\n <SimpleFilter :clickEvents=\"{ UserClickedASimpleFilter: filter }\" :filter=\"filter\" />\n</template>\n\n<script>\n import { SimpleFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'SimpleFilterTest',\n components: {\n SimpleFilter\n },\n data() {\n return {\n filter: {\n modelName: 'SimpleFilter',\n selected: false,\n id: 'category:shirts',\n value: 'category:shirts',\n facetId: 'category',\n totalResults: 10\n }\n };\n }\n };\n</script>\n```\n\n### Rendering an input\n\nYou can change the rendered control using the default slot. Note that because of the current Vue\nlimitations, you must only render one single root node in this slot. There you will receive all the\ndata and methods needed:\n\n```vue\n<template>\n <SimpleFilter v-slot=\"{ filter, clickFilter, isDisabled, cssClasses }\" :filter=\"filter\">\n <label :class=\"cssClasses\">\n <input :checked=\"filter.selected\" type=\"checkbox\" @change=\"clickFilter\" />\n {{ filter.label }}\n </label>\n </SimpleFilter>\n</template>\n\n<script>\n import { SimpleFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'SimpleFilterTest',\n components: {\n SimpleFilter\n },\n data() {\n return {\n filter: {\n modelName: 'SimpleFilter',\n selected: false,\n id: 'category:shirts',\n value: 'category:shirts',\n facetId: 'category',\n label: 'Shirts',\n totalResults: 10\n }\n };\n }\n };\n</script>\n```\n\n### Changing default button content\n\nYou can change the content rendered by the default button using the `label` slot. There you will\nreceive the filter data.\n\n```vue\n<template>\n <SimpleFilter :filter=\"filter\">\n <template #label=\"{ filter }\">\n <img :src=\"`imgs/filters/${filter.id}.png`\" />\n <span>{{ filter.label }}</span>\n </template>\n </SimpleFilter>\n</template>\n\n<script>\n import { SimpleFilter } from '@empathyco/x-components/facets';\n\n export default {\n name: 'SimpleFilterTest',\n components: {\n SimpleFilter\n },\n data() {\n return {\n filter: {\n modelName: 'SimpleFilter',\n selected: false,\n id: 'category:shirts',\n value: 'category:shirts',\n facetId: 'category',\n label: 'Shirts',\n totalResults: 10\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/js/x-modules/facets/components/filters/simple-filter.vue_rollup-plugin-vue_script.vue.js
CHANGED
|
@@ -125,15 +125,15 @@ import __vue_component__ from './renderless-filter.vue.js';
|
|
|
125
125
|
*/
|
|
126
126
|
let SimpleFilter = class SimpleFilter extends Vue {
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
128
|
+
* The {@link XEventsTypes | events} to emit.
|
|
129
129
|
*
|
|
130
|
-
* @returns
|
|
131
|
-
* payload.
|
|
130
|
+
* @returns The events to emit when clicked.
|
|
132
131
|
* @internal
|
|
133
132
|
*/
|
|
134
|
-
get
|
|
133
|
+
get _clickEvents() {
|
|
135
134
|
return {
|
|
136
|
-
UserClickedASimpleFilter: this.filter
|
|
135
|
+
UserClickedASimpleFilter: this.filter,
|
|
136
|
+
...this.clickEvents
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
@@ -151,6 +151,9 @@ let SimpleFilter = class SimpleFilter extends Vue {
|
|
|
151
151
|
__decorate([
|
|
152
152
|
Prop({ required: true })
|
|
153
153
|
], SimpleFilter.prototype, "filter", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
Prop()
|
|
156
|
+
], SimpleFilter.prototype, "clickEvents", void 0);
|
|
154
157
|
SimpleFilter = __decorate([
|
|
155
158
|
Component({
|
|
156
159
|
components: { RenderlessFilter: __vue_component__ },
|
package/js/x-modules/facets/components/filters/simple-filter.vue_rollup-plugin-vue_script.vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-filter.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/simple-filter.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 { SimpleFilter as SimpleFilterModel } from '@empathyco/x-types';\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { xComponentMixin } from '../../../../components';\nimport { VueCSSClasses } from '../../../../utils/types';\nimport { XEventsTypes } from '../../../../wiring/events.types';\nimport { facetsXModule } from '../../x-module';\nimport RenderlessFilter from './renderless-filter.vue';\n\n/**\n * Renders a simple filter, emitting the needed events when clicked.\n *\n * @public\n */\n@Component({\n components: { RenderlessFilter },\n mixins: [xComponentMixin(facetsXModule)]\n})\nexport default class SimpleFilter extends Vue {\n /** The filter data to render. */\n @Prop({ required: true })\n public filter!: SimpleFilterModel;\n\n /**\n * Additional events to emit when the filter is clicked.\n *\n * @
|
|
1
|
+
{"version":3,"file":"simple-filter.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../../../src/x-modules/facets/components/filters/simple-filter.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 { SimpleFilter as SimpleFilterModel } from '@empathyco/x-types';\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { xComponentMixin } from '../../../../components';\nimport { VueCSSClasses } from '../../../../utils/types';\nimport { XEventsTypes } from '../../../../wiring/events.types';\nimport { facetsXModule } from '../../x-module';\nimport RenderlessFilter from './renderless-filter.vue';\n\n/**\n * Renders a simple filter, emitting the needed events when clicked.\n *\n * @public\n */\n@Component({\n components: { RenderlessFilter },\n mixins: [xComponentMixin(facetsXModule)]\n})\nexport default class SimpleFilter extends Vue {\n /** The filter data to render. */\n @Prop({ required: true })\n public filter!: SimpleFilterModel;\n\n /**\n * Additional events, with their payload, to emit when the filter is clicked.\n *\n * @public\n */\n @Prop()\n public clickEvents?: Partial<XEventsTypes>;\n\n /**\n * The {@link XEventsTypes | events} to emit.\n *\n * @returns The events to emit when clicked.\n * @internal\n */\n protected get _clickEvents(): Partial<XEventsTypes> {\n return {\n UserClickedASimpleFilter: this.filter,\n ...this.clickEvents\n };\n }\n\n /**\n * Dynamic CSS classes to apply to the component.\n *\n * @returns The dynamic CSS classes to apply to the component.\n * @internal\n */\n protected get cssClasses(): VueCSSClasses {\n return {\n 'x-simple-filter--is-selected': this.filter.selected\n };\n }\n}\n"],"names":["RenderlessFilter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA;;;;;AASA,IAAqB,YAAY,GAAjC,MAAqB,YAAa,SAAQ,GAAG;;;;;;;IAmB3C,IAAc,YAAY;QACxB,OAAO;YACL,wBAAwB,EAAE,IAAI,CAAC,MAAM;YACrC,GAAG,IAAI,CAAC,WAAW;SACpB,CAAC;KACH;;;;;;;IAQD,IAAc,UAAU;QACtB,OAAO;YACL,8BAA8B,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;SACrD,CAAC;KACH;CACF,CAAA;AAlCC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;4CACS;AAQlC;IADC,IAAI,EAAE;iDACoC;AAXxB,YAAY;IAJhC,SAAS,CAAC;QACT,UAAU,EAAE,oBAAEA,iBAAgB,EAAE;QAChC,MAAM,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;KACzC,CAAC;GACmB,YAAY,CAqChC;aArCoB,YAAY;;;;"}
|
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.92",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"access": "public",
|
|
126
126
|
"directory": "dist"
|
|
127
127
|
},
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "e2f14ec7353d62834232ee677f7a1a1871583b16"
|
|
129
129
|
}
|
|
@@ -18159,6 +18159,47 @@
|
|
|
18159
18159
|
},
|
|
18160
18160
|
"isStatic": false
|
|
18161
18161
|
},
|
|
18162
|
+
{
|
|
18163
|
+
"kind": "Property",
|
|
18164
|
+
"canonicalReference": "@empathyco/x-components!HierarchicalFilter#clickEvents:member",
|
|
18165
|
+
"docComment": "/**\n * Additional events, with their payload, to emit when the filter is clicked.\n *\n * @public\n */\n",
|
|
18166
|
+
"excerptTokens": [
|
|
18167
|
+
{
|
|
18168
|
+
"kind": "Content",
|
|
18169
|
+
"text": "clickEvents: "
|
|
18170
|
+
},
|
|
18171
|
+
{
|
|
18172
|
+
"kind": "Reference",
|
|
18173
|
+
"text": "Partial",
|
|
18174
|
+
"canonicalReference": "!Partial:type"
|
|
18175
|
+
},
|
|
18176
|
+
{
|
|
18177
|
+
"kind": "Content",
|
|
18178
|
+
"text": "<"
|
|
18179
|
+
},
|
|
18180
|
+
{
|
|
18181
|
+
"kind": "Reference",
|
|
18182
|
+
"text": "XEventsTypes",
|
|
18183
|
+
"canonicalReference": "@empathyco/x-components!XEventsTypes:interface"
|
|
18184
|
+
},
|
|
18185
|
+
{
|
|
18186
|
+
"kind": "Content",
|
|
18187
|
+
"text": ">"
|
|
18188
|
+
},
|
|
18189
|
+
{
|
|
18190
|
+
"kind": "Content",
|
|
18191
|
+
"text": ";"
|
|
18192
|
+
}
|
|
18193
|
+
],
|
|
18194
|
+
"isOptional": false,
|
|
18195
|
+
"releaseTag": "Public",
|
|
18196
|
+
"name": "clickEvents",
|
|
18197
|
+
"propertyTypeTokenRange": {
|
|
18198
|
+
"startIndex": 1,
|
|
18199
|
+
"endIndex": 5
|
|
18200
|
+
},
|
|
18201
|
+
"isStatic": false
|
|
18202
|
+
},
|
|
18162
18203
|
{
|
|
18163
18204
|
"kind": "Property",
|
|
18164
18205
|
"canonicalReference": "@empathyco/x-components!HierarchicalFilter#filter:member",
|
|
@@ -26942,6 +26983,47 @@
|
|
|
26942
26983
|
"releaseTag": "Public",
|
|
26943
26984
|
"name": "NumberRangeFilter",
|
|
26944
26985
|
"members": [
|
|
26986
|
+
{
|
|
26987
|
+
"kind": "Property",
|
|
26988
|
+
"canonicalReference": "@empathyco/x-components!NumberRangeFilter#clickEvents:member",
|
|
26989
|
+
"docComment": "/**\n * Additional events, with their payload, to emit when the filter is clicked.\n *\n * @public\n */\n",
|
|
26990
|
+
"excerptTokens": [
|
|
26991
|
+
{
|
|
26992
|
+
"kind": "Content",
|
|
26993
|
+
"text": "clickEvents?: "
|
|
26994
|
+
},
|
|
26995
|
+
{
|
|
26996
|
+
"kind": "Reference",
|
|
26997
|
+
"text": "Partial",
|
|
26998
|
+
"canonicalReference": "!Partial:type"
|
|
26999
|
+
},
|
|
27000
|
+
{
|
|
27001
|
+
"kind": "Content",
|
|
27002
|
+
"text": "<"
|
|
27003
|
+
},
|
|
27004
|
+
{
|
|
27005
|
+
"kind": "Reference",
|
|
27006
|
+
"text": "XEventsTypes",
|
|
27007
|
+
"canonicalReference": "@empathyco/x-components!XEventsTypes:interface"
|
|
27008
|
+
},
|
|
27009
|
+
{
|
|
27010
|
+
"kind": "Content",
|
|
27011
|
+
"text": ">"
|
|
27012
|
+
},
|
|
27013
|
+
{
|
|
27014
|
+
"kind": "Content",
|
|
27015
|
+
"text": ";"
|
|
27016
|
+
}
|
|
27017
|
+
],
|
|
27018
|
+
"isOptional": true,
|
|
27019
|
+
"releaseTag": "Public",
|
|
27020
|
+
"name": "clickEvents",
|
|
27021
|
+
"propertyTypeTokenRange": {
|
|
27022
|
+
"startIndex": 1,
|
|
27023
|
+
"endIndex": 5
|
|
27024
|
+
},
|
|
27025
|
+
"isStatic": false
|
|
27026
|
+
},
|
|
26945
27027
|
{
|
|
26946
27028
|
"kind": "Property",
|
|
26947
27029
|
"canonicalReference": "@empathyco/x-components!NumberRangeFilter#filter:member",
|
|
@@ -41187,6 +41269,47 @@
|
|
|
41187
41269
|
"releaseTag": "Public",
|
|
41188
41270
|
"name": "SimpleFilter",
|
|
41189
41271
|
"members": [
|
|
41272
|
+
{
|
|
41273
|
+
"kind": "Property",
|
|
41274
|
+
"canonicalReference": "@empathyco/x-components!SimpleFilter#clickEvents:member",
|
|
41275
|
+
"docComment": "/**\n * Additional events, with their payload, to emit when the filter is clicked.\n *\n * @public\n */\n",
|
|
41276
|
+
"excerptTokens": [
|
|
41277
|
+
{
|
|
41278
|
+
"kind": "Content",
|
|
41279
|
+
"text": "clickEvents?: "
|
|
41280
|
+
},
|
|
41281
|
+
{
|
|
41282
|
+
"kind": "Reference",
|
|
41283
|
+
"text": "Partial",
|
|
41284
|
+
"canonicalReference": "!Partial:type"
|
|
41285
|
+
},
|
|
41286
|
+
{
|
|
41287
|
+
"kind": "Content",
|
|
41288
|
+
"text": "<"
|
|
41289
|
+
},
|
|
41290
|
+
{
|
|
41291
|
+
"kind": "Reference",
|
|
41292
|
+
"text": "XEventsTypes",
|
|
41293
|
+
"canonicalReference": "@empathyco/x-components!XEventsTypes:interface"
|
|
41294
|
+
},
|
|
41295
|
+
{
|
|
41296
|
+
"kind": "Content",
|
|
41297
|
+
"text": ">"
|
|
41298
|
+
},
|
|
41299
|
+
{
|
|
41300
|
+
"kind": "Content",
|
|
41301
|
+
"text": ";"
|
|
41302
|
+
}
|
|
41303
|
+
],
|
|
41304
|
+
"isOptional": true,
|
|
41305
|
+
"releaseTag": "Public",
|
|
41306
|
+
"name": "clickEvents",
|
|
41307
|
+
"propertyTypeTokenRange": {
|
|
41308
|
+
"startIndex": 1,
|
|
41309
|
+
"endIndex": 5
|
|
41310
|
+
},
|
|
41311
|
+
"isStatic": false
|
|
41312
|
+
},
|
|
41190
41313
|
{
|
|
41191
41314
|
"kind": "Property",
|
|
41192
41315
|
"canonicalReference": "@empathyco/x-components!SimpleFilter#filter:member",
|
|
@@ -1745,13 +1745,16 @@ export const HideIcon: {};
|
|
|
1745
1745
|
// @public
|
|
1746
1746
|
export class HierarchicalFilter extends Vue_2 {
|
|
1747
1747
|
childrenAnimation?: Vue_2 | string;
|
|
1748
|
+
clickEvents: Partial<XEventsTypes>;
|
|
1748
1749
|
// @internal
|
|
1749
|
-
protected get
|
|
1750
|
+
protected get _clickEvents(): Partial<XEventsTypes>;
|
|
1750
1751
|
// @internal
|
|
1751
1752
|
protected get cssClasses(): VueCSSClasses;
|
|
1752
1753
|
filter: HierarchicalFilter_2;
|
|
1753
1754
|
// @internal
|
|
1754
1755
|
filters: Record<Filter['id'], Filter>;
|
|
1756
|
+
// @internal
|
|
1757
|
+
protected getChildFilterClickEvents(childFilter: HierarchicalFilter_2): Partial<XEventsTypes>;
|
|
1755
1758
|
// (undocumented)
|
|
1756
1759
|
protected isFilterPartiallySelected(filter: HierarchicalFilter_2): boolean;
|
|
1757
1760
|
// @internal
|
|
@@ -2501,8 +2504,9 @@ export const Nq4Icon: {};
|
|
|
2501
2504
|
|
|
2502
2505
|
// @public
|
|
2503
2506
|
export class NumberRangeFilter extends Vue_2 {
|
|
2507
|
+
clickEvents?: Partial<XEventsTypes>;
|
|
2504
2508
|
// @internal
|
|
2505
|
-
protected get
|
|
2509
|
+
protected get _clickEvents(): Partial<XEventsTypes>;
|
|
2506
2510
|
// @internal
|
|
2507
2511
|
protected get cssClasses(): VueCSSClasses;
|
|
2508
2512
|
filter: NumberRangeFilter_2;
|
|
@@ -3875,8 +3879,9 @@ export const ShowIcon: {};
|
|
|
3875
3879
|
|
|
3876
3880
|
// @public
|
|
3877
3881
|
export class SimpleFilter extends Vue_2 {
|
|
3882
|
+
clickEvents?: Partial<XEventsTypes>;
|
|
3878
3883
|
// @internal
|
|
3879
|
-
protected get
|
|
3884
|
+
protected get _clickEvents(): Partial<XEventsTypes>;
|
|
3880
3885
|
// @internal
|
|
3881
3886
|
protected get cssClasses(): VueCSSClasses;
|
|
3882
3887
|
filter: SimpleFilter_2;
|
|
@@ -19,13 +19,18 @@ export default class HierarchicalFilter extends Vue {
|
|
|
19
19
|
*/
|
|
20
20
|
filters: Record<Filter['id'], Filter>;
|
|
21
21
|
/**
|
|
22
|
-
* Additional events to emit when the filter is clicked.
|
|
22
|
+
* Additional events, with their payload, to emit when the filter is clicked.
|
|
23
23
|
*
|
|
24
|
-
* @
|
|
25
|
-
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
clickEvents: Partial<XEventsTypes>;
|
|
27
|
+
/**
|
|
28
|
+
* The {@link XEventsTypes | events} to emit.
|
|
29
|
+
*
|
|
30
|
+
* @returns The events to emit when clicked.
|
|
26
31
|
* @internal
|
|
27
32
|
*/
|
|
28
|
-
protected get
|
|
33
|
+
protected get _clickEvents(): Partial<XEventsTypes>;
|
|
29
34
|
/**
|
|
30
35
|
* Dynamic CSS classes to apply to the component.
|
|
31
36
|
*
|
|
@@ -33,6 +38,15 @@ export default class HierarchicalFilter extends Vue {
|
|
|
33
38
|
* @internal
|
|
34
39
|
*/
|
|
35
40
|
protected get cssClasses(): VueCSSClasses;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the child filter click events, converting the payload of the events that have a
|
|
43
|
+
* {@link @empathyco/x-types#HierarchicalFilter} as payload to the corresponding child filter.
|
|
44
|
+
*
|
|
45
|
+
* @param childFilter - The child filter.
|
|
46
|
+
* @returns The events to emit when clicking a child.
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
protected getChildFilterClickEvents(childFilter: HierarchicalFilterModel): Partial<XEventsTypes>;
|
|
36
50
|
/**
|
|
37
51
|
* Returns if the filter is partially selected, which means having more than one child filter
|
|
38
52
|
* selected, but not every of them, or having at least one child filter partially selected.
|
|
@@ -46,7 +60,6 @@ export default class HierarchicalFilter extends Vue {
|
|
|
46
60
|
* is empty it will return an empty array instead of inject the ones from the parent.
|
|
47
61
|
*
|
|
48
62
|
* @returns A list of filters.
|
|
49
|
-
*
|
|
50
63
|
* @internal
|
|
51
64
|
*/
|
|
52
65
|
protected get renderedChildrenFilters(): Filter[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hierarchical-filter.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/components/filters/hierarchical-filter.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hierarchical-filter.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/components/filters/hierarchical-filter.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AA0DA,OAAO,EACL,MAAM,EACN,kBAAkB,IAAI,uBAAuB,EAE9C,MAAM,oBAAoB,CAAC;AAE5B,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAK/D;;;;GAIG;AAMH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,GAAG;IACjD,iCAAiC;IAE1B,MAAM,EAAG,uBAAuB,CAAC;IAExC,+DAA+D;IAExD,iBAAiB,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC;IACxC;;;;OAIG;IAEI,OAAO,EAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAE9C;;;;OAIG;IAEI,WAAW,EAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAE3C;;;;;OAKG;IACH,SAAS,KAAK,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,CAKlD;IAED;;;;;OAKG;IACH,SAAS,KAAK,UAAU,IAAI,aAAa,CAMxC;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,yBAAyB,CACjC,WAAW,EAAE,uBAAuB,GACnC,OAAO,CAAC,YAAY,CAAC;IAcxB;;;;;;OAMG;IACH,SAAS,KAAK,mBAAmB,IAAI,OAAO,CAE3C;IAED;;;;;;OAMG;IACH,SAAS,KAAK,uBAAuB,IAAI,MAAM,EAAE,CAEhD;IAED,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO;CAY9E"}
|
|
@@ -11,13 +11,18 @@ export default class NumberRangeFilter extends Vue {
|
|
|
11
11
|
/** The filter data to render. */
|
|
12
12
|
filter: NumberRangeFilterModel;
|
|
13
13
|
/**
|
|
14
|
-
* Additional events to emit when the filter is clicked.
|
|
14
|
+
* Additional events, with their payload, to emit when the filter is clicked.
|
|
15
15
|
*
|
|
16
|
-
* @
|
|
17
|
-
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
clickEvents?: Partial<XEventsTypes>;
|
|
19
|
+
/**
|
|
20
|
+
* The {@link XEventsTypes | events} to emit.
|
|
21
|
+
*
|
|
22
|
+
* @returns The events to emit when clicked.
|
|
18
23
|
* @internal
|
|
19
24
|
*/
|
|
20
|
-
protected get
|
|
25
|
+
protected get _clickEvents(): Partial<XEventsTypes>;
|
|
21
26
|
/**
|
|
22
27
|
* Dynamic CSS classes to apply to the component.
|
|
23
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-range-filter.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/components/filters/number-range-filter.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AA4CA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,iBAAiB,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAI/D;;;;GAIG;AAKH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,GAAG;IAChD,iCAAiC;IAE1B,MAAM,EAAG,sBAAsB,CAAC;IAEvC
|
|
1
|
+
{"version":3,"file":"number-range-filter.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/components/filters/number-range-filter.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AA4CA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,iBAAiB,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAI/D;;;;GAIG;AAKH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,GAAG;IAChD,iCAAiC;IAE1B,MAAM,EAAG,sBAAsB,CAAC;IAEvC;;;;OAIG;IAEI,WAAW,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE3C;;;;;OAKG;IACH,SAAS,KAAK,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,CAKlD;IAED;;;;;OAKG;IACH,SAAS,KAAK,UAAU,IAAI,aAAa,CAIxC;CACF"}
|
|
@@ -11,13 +11,18 @@ export default class SimpleFilter extends Vue {
|
|
|
11
11
|
/** The filter data to render. */
|
|
12
12
|
filter: SimpleFilterModel;
|
|
13
13
|
/**
|
|
14
|
-
* Additional events to emit when the filter is clicked.
|
|
14
|
+
* Additional events, with their payload, to emit when the filter is clicked.
|
|
15
15
|
*
|
|
16
|
-
* @
|
|
17
|
-
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
clickEvents?: Partial<XEventsTypes>;
|
|
19
|
+
/**
|
|
20
|
+
* The {@link XEventsTypes | events} to emit.
|
|
21
|
+
*
|
|
22
|
+
* @returns The events to emit when clicked.
|
|
18
23
|
* @internal
|
|
19
24
|
*/
|
|
20
|
-
protected get
|
|
25
|
+
protected get _clickEvents(): Partial<XEventsTypes>;
|
|
21
26
|
/**
|
|
22
27
|
* Dynamic CSS classes to apply to the component.
|
|
23
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-filter.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/components/filters/simple-filter.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AA4CA,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAI/D;;;;GAIG;AAKH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,GAAG;IAC3C,iCAAiC;IAE1B,MAAM,EAAG,iBAAiB,CAAC;IAElC
|
|
1
|
+
{"version":3,"file":"simple-filter.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/components/filters/simple-filter.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AA4CA,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAI/D;;;;GAIG;AAKH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,GAAG;IAC3C,iCAAiC;IAE1B,MAAM,EAAG,iBAAiB,CAAC;IAElC;;;;OAIG;IAEI,WAAW,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE3C;;;;;OAKG;IACH,SAAS,KAAK,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,CAKlD;IAED;;;;;OAKG;IACH,SAAS,KAAK,UAAU,IAAI,aAAa,CAIxC;CACF"}
|