@empathyco/x-components 4.1.0-alpha.21 → 4.1.0-alpha.23
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 +17 -0
- package/core/index.js +1 -0
- package/core/index.js.map +1 -1
- package/design-system/deprecated-full-theme.css +615 -615
- package/docs/API-reference/api/x-components.md +1 -0
- package/docs/API-reference/api/x-components.preselectedfilters.created.md +1 -1
- package/docs/API-reference/api/x-components.preselectedfilters.emitpreselectedfilters.md +17 -0
- package/docs/API-reference/api/x-components.preselectedfilters.md +3 -1
- package/docs/API-reference/api/x-components.preselectedfilters.preselectedfilters.md +13 -0
- package/docs/API-reference/api/x-components.usehybridinject.md +27 -0
- package/js/composables/use-hybrid-inject.js +24 -0
- package/js/composables/use-hybrid-inject.js.map +1 -0
- package/js/index.js +1 -0
- package/js/index.js.map +1 -1
- package/js/x-modules/facets/components/preselected-filters.vue.js.map +1 -1
- package/js/x-modules/facets/components/preselected-filters.vue2.js +25 -7
- package/js/x-modules/facets/components/preselected-filters.vue2.js.map +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +141 -1
- package/report/x-components.api.md +5 -0
- package/types/composables/index.d.ts +1 -0
- package/types/composables/index.d.ts.map +1 -1
- package/types/composables/use-hybrid-inject.d.ts +12 -0
- package/types/composables/use-hybrid-inject.d.ts.map +1 -0
- package/types/x-modules/facets/components/preselected-filters.vue.d.ts +13 -1
- package/types/x-modules/facets/components/preselected-filters.vue.d.ts.map +1 -1
|
@@ -191,6 +191,7 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
191
191
|
| [use$x()](./x-components.use_x.md) | Function which returns the <code>$x</code> object from the current component instance. |
|
|
192
192
|
| [useEmitDisplayEvent({ element, taggingRequest, eventMetadata })](./x-components.useemitdisplayevent.md) | Composable that emits a <code>TrackableElementDisplayed</code> event whenever the provided element appears in the viewport for the first time. |
|
|
193
193
|
| [useGetter(module, getters)](./x-components.usegetter.md) | Function which returns the requested getters as a dictionary of getters. |
|
|
194
|
+
| [useHybridInject(key, defaultValue)](./x-components.usehybridinject.md) | Function to use a hybrid inject, which allows to inject a value provided by the regular provide of vue or by the XProvide decorator. |
|
|
194
195
|
| [useNoElementRender(slots)](./x-components.usenoelementrender.md) | Returns a render function that returns the default slot or nothing if it's not defined. |
|
|
195
196
|
| [useOnDisplay({ element, callback, triggerOnce })](./x-components.useondisplay.md) | Composable that triggers a callback whenever the provided element appears in the viewport. It can trigger the first time only or every time the element appears in the viewport. |
|
|
196
197
|
| [useRegisterXModule(module)](./x-components.useregisterxmodule.md) | Initializes a component as an X-Component: \* Registers the module passed as parameter. \* Flags the component as X-Component, so then it can be detected with the [isXComponent()](./x-components.isxcomponent.md) function. |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## PreselectedFilters.created() method
|
|
6
6
|
|
|
7
|
-
Emits the
|
|
7
|
+
Emits the [FacetsXEvents.PreselectedFiltersProvided](./x-components.facetsxevents.preselectedfiltersprovided.md) when the component is created.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [PreselectedFilters](./x-components.preselectedfilters.md) > [emitPreselectedFilters](./x-components.preselectedfilters.emitpreselectedfilters.md)
|
|
4
|
+
|
|
5
|
+
## PreselectedFilters.emitPreselectedFilters() method
|
|
6
|
+
|
|
7
|
+
Emits the [FacetsXEvents.PreselectedFiltersProvided](./x-components.facetsxevents.preselectedfiltersprovided.md) to save the provided filters in the state.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
protected emitPreselectedFilters(): void;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
void
|
|
17
|
+
|
|
@@ -18,11 +18,13 @@ export default class PreselectedFilters extends Vue
|
|
|
18
18
|
| Property | Modifiers | Type | Description |
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
20
|
| [filters](./x-components.preselectedfilters.filters.md) | | string\[\] | A list of filters to preselect. |
|
|
21
|
+
| [preselectedFilters](./x-components.preselectedfilters.preselectedfilters.md) | <p><code>protected</code></p><p><code>readonly</code></p> | string\[\] | Gets the provided preselected filters prioritizing the [SnippetConfig](./x-components.snippetconfig.md) over the filters prop. |
|
|
21
22
|
|
|
22
23
|
## Methods
|
|
23
24
|
|
|
24
25
|
| Method | Modifiers | Description |
|
|
25
26
|
| --- | --- | --- |
|
|
26
|
-
| [created()](./x-components.preselectedfilters.created.md) | | Emits the
|
|
27
|
+
| [created()](./x-components.preselectedfilters.created.md) | | Emits the [FacetsXEvents.PreselectedFiltersProvided](./x-components.facetsxevents.preselectedfiltersprovided.md) when the component is created. |
|
|
28
|
+
| [emitPreselectedFilters()](./x-components.preselectedfilters.emitpreselectedfilters.md) | <code>protected</code> | Emits the [FacetsXEvents.PreselectedFiltersProvided](./x-components.facetsxevents.preselectedfiltersprovided.md) to save the provided filters in the state. |
|
|
27
29
|
| [render()](./x-components.preselectedfilters.render.md) | | |
|
|
28
30
|
|
|
@@ -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) > [PreselectedFilters](./x-components.preselectedfilters.md) > [preselectedFilters](./x-components.preselectedfilters.preselectedfilters.md)
|
|
4
|
+
|
|
5
|
+
## PreselectedFilters.preselectedFilters property
|
|
6
|
+
|
|
7
|
+
Gets the provided preselected filters prioritizing the [SnippetConfig](./x-components.snippetconfig.md) over the filters prop.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
protected get preselectedFilters(): string[];
|
|
13
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [useHybridInject](./x-components.usehybridinject.md)
|
|
4
|
+
|
|
5
|
+
## useHybridInject() function
|
|
6
|
+
|
|
7
|
+
Function to use a hybrid inject, which allows to inject a value provided by the regular provide of vue or by the XProvide decorator.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare function useHybridInject<SomeValue>(key: string, defaultValue?: SomeValue): ComputedRef<SomeValue | undefined>;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| key | string | The key of the value to inject. |
|
|
20
|
+
| defaultValue | SomeValue | _(Optional)_ The default value to use if the value is not provided. |
|
|
21
|
+
|
|
22
|
+
**Returns:**
|
|
23
|
+
|
|
24
|
+
ComputedRef<SomeValue \| undefined>
|
|
25
|
+
|
|
26
|
+
The computed value of the injected value.
|
|
27
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { computed, inject } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Function to use a hybrid inject, which allows to inject a value provided by the regular provide
|
|
5
|
+
* of vue or by the XProvide decorator.
|
|
6
|
+
*
|
|
7
|
+
* @param key - The key of the value to inject.
|
|
8
|
+
* @param defaultValue - The default value to use if the value is not provided.
|
|
9
|
+
* @returns The computed value of the injected value.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
function useHybridInject(key, defaultValue) {
|
|
13
|
+
return computed(() => {
|
|
14
|
+
const injectedValue = defaultValue
|
|
15
|
+
? inject(key, defaultValue)
|
|
16
|
+
: inject(key);
|
|
17
|
+
return injectedValue && typeof injectedValue === 'object' && 'value' in injectedValue
|
|
18
|
+
? injectedValue.value
|
|
19
|
+
: injectedValue;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { useHybridInject };
|
|
24
|
+
//# sourceMappingURL=use-hybrid-inject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-hybrid-inject.js","sources":["../../../src/composables/use-hybrid-inject.ts"],"sourcesContent":["import { computed, ComputedRef, inject } from 'vue';\n\n/**\n * Function to use a hybrid inject, which allows to inject a value provided by the regular provide\n * of vue or by the XProvide decorator.\n *\n * @param key - The key of the value to inject.\n * @param defaultValue - The default value to use if the value is not provided.\n * @returns The computed value of the injected value.\n * @public\n */\nexport function useHybridInject<SomeValue>(\n key: string,\n defaultValue?: SomeValue\n): ComputedRef<SomeValue | undefined> {\n type WrappedValue = { value: SomeValue };\n\n return computed<SomeValue | undefined>(() => {\n const injectedValue = defaultValue\n ? inject<SomeValue | WrappedValue>(key, defaultValue)\n : inject<SomeValue | WrappedValue>(key);\n\n return injectedValue && typeof injectedValue === 'object' && 'value' in injectedValue\n ? injectedValue.value\n : injectedValue;\n });\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;AAQG;AACa,SAAA,eAAe,CAC7B,GAAW,EACX,YAAwB,EAAA;IAIxB,OAAO,QAAQ,CAAwB,MAAK;QAC1C,MAAM,aAAa,GAAG,YAAY;AAChC,cAAE,MAAM,CAA2B,GAAG,EAAE,YAAY,CAAC;AACrD,cAAE,MAAM,CAA2B,GAAG,CAAC,CAAC;QAE1C,OAAO,aAAa,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,OAAO,IAAI,aAAa;cACjF,aAAa,CAAC,KAAK;cACnB,aAAa,CAAC;AACpB,KAAC,CAAC,CAAC;AACL;;;;"}
|
package/js/index.js
CHANGED
|
@@ -155,6 +155,7 @@ export { useEmitDisplayEvent, useOnDisplay } from './composables/use-on-display.
|
|
|
155
155
|
export { useStore } from './composables/use-store.js';
|
|
156
156
|
export { useState } from './composables/use-state.js';
|
|
157
157
|
export { useGetter } from './composables/use-getter.js';
|
|
158
|
+
export { useHybridInject } from './composables/use-hybrid-inject.js';
|
|
158
159
|
export { infiniteScroll } from './directives/infinite-scroll/infinite-scroll.js';
|
|
159
160
|
export { setupDevtools } from './plugins/devtools/devtools.plugin.js';
|
|
160
161
|
export { bus } from './plugins/x-bus.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":"preselected-filters.vue.js","sources":["../../../../../src/x-modules/facets/components/preselected-filters.vue"],"sourcesContent":["<script lang=\"ts\">\n import { Component, Inject, Prop } from 'vue-property-decorator';\n import Vue from 'vue';\n import { createRawFilters } from '../../../utils/filters';\n import { isArrayEmpty } from '../../../utils/array';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n\n /**\n * This component emits {@link FacetsXEvents.PreselectedFiltersProvided} when a preselected filter\n * is set in the snippet config or by using the prop of the component.\n *\n * @public\n */\n @Component\n export default class PreselectedFilters extends Vue {\n /**\n * Injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n *\n * @internal\n */\n @Inject()\n public snippetConfig?: SnippetConfig;\n\n /**\n * A list of filters to preselect.\n *\n * @remarks Emits the {@link FacetsXEvents.PreselectedFiltersProvided} when the\n * component is created.\n *\n * @public\n */\n @Prop({ default: () => [] })\n public filters!: string[];\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"preselected-filters.vue.js","sources":["../../../../../src/x-modules/facets/components/preselected-filters.vue"],"sourcesContent":["<script lang=\"ts\">\n import { Component, Inject, Prop, Watch } from 'vue-property-decorator';\n import Vue from 'vue';\n import { createRawFilters } from '../../../utils/filters';\n import { isArrayEmpty } from '../../../utils/array';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n\n /**\n * This component emits {@link FacetsXEvents.PreselectedFiltersProvided} when a preselected filter\n * is set in the snippet config or by using the prop of the component.\n *\n * @public\n */\n @Component\n export default class PreselectedFilters extends Vue {\n /**\n * Injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n *\n * @internal\n */\n @Inject('snippetConfig')\n public snippetConfig?: SnippetConfig;\n\n /**\n * A list of filters to preselect.\n *\n * @remarks Emits the {@link FacetsXEvents.PreselectedFiltersProvided} when the\n * component is created.\n *\n * @public\n */\n @Prop({ default: () => [] })\n public filters!: string[];\n\n /**\n * Gets the provided preselected filters prioritizing the {@link SnippetConfig} over the\n * filters prop.\n *\n * @returns An array of filter's ids.\n */\n protected get preselectedFilters(): string[] {\n return this.snippetConfig?.filters ?? this.filters;\n }\n\n /**\n * Emits the {@link FacetsXEvents.PreselectedFiltersProvided} to save\n * the provided filters in the state.\n */\n @Watch('preselectedFilters')\n protected emitPreselectedFilters(): void {\n if (!isArrayEmpty(this.preselectedFilters)) {\n this.$x.emit('PreselectedFiltersProvided', createRawFilters(this.preselectedFilters));\n }\n }\n\n /**\n * Emits the {@link FacetsXEvents.PreselectedFiltersProvided} when the\n * component is created.\n */\n created(): void {\n this.emitPreselectedFilters();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n render(): void {}\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n[`PreselectedFiltersProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts).\n\n## See it in action\n\n_See how the event is triggered when the component is rendered._\n\n```vue\n<template>\n <PreselectedFilters />\n</template>\n\n<script>\n import { PreselectedFilters } from '@empathyco/x-components';\n export default {\n name: 'PreselectedFiltersDemo',\n components: {\n PreselectedFilters\n },\n provide: {\n snippetConfig: {\n filters: ['{!tag=brand_facet}brand_facet:\"Lego\"', '{!tag=age_facet}age_facet:\"toddler\"']\n }\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the preselected filters have been configured to use a list of configured filters by\nprop:\n\n```vue\n<template>\n <PreselectedFilters :filters=\"filters\" />\n</template>\n\n<script>\n import { PreselectedFilters } from '@empathyco/x-components';\n export default {\n name: 'PreselectedFiltersDemo',\n components: {\n PreselectedFilters\n },\n computed: {\n filters() {\n return ['{!tag=brand_facet}brand_facet:\"Lego\"', '{!tag=age_facet}age_facet:\"toddler\"'];\n }\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
-
import { Inject, Prop, Component } from 'vue-property-decorator';
|
|
2
|
+
import { Inject, Prop, Watch, Component } from 'vue-property-decorator';
|
|
3
3
|
import Vue from 'vue';
|
|
4
4
|
import { createRawFilters } from '../../../utils/filters.js';
|
|
5
5
|
import { isArrayEmpty } from '../../../utils/array.js';
|
|
@@ -12,24 +12,42 @@ import { isArrayEmpty } from '../../../utils/array.js';
|
|
|
12
12
|
*/
|
|
13
13
|
let PreselectedFilters = class PreselectedFilters extends Vue {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Gets the provided preselected filters prioritizing the {@link SnippetConfig} over the
|
|
16
16
|
* filters prop.
|
|
17
|
+
*
|
|
18
|
+
* @returns An array of filter's ids.
|
|
17
19
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
get preselectedFilters() {
|
|
21
|
+
return this.snippetConfig?.filters ?? this.filters;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Emits the {@link FacetsXEvents.PreselectedFiltersProvided} to save
|
|
25
|
+
* the provided filters in the state.
|
|
26
|
+
*/
|
|
27
|
+
emitPreselectedFilters() {
|
|
28
|
+
if (!isArrayEmpty(this.preselectedFilters)) {
|
|
29
|
+
this.$x.emit('PreselectedFiltersProvided', createRawFilters(this.preselectedFilters));
|
|
22
30
|
}
|
|
23
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Emits the {@link FacetsXEvents.PreselectedFiltersProvided} when the
|
|
34
|
+
* component is created.
|
|
35
|
+
*/
|
|
36
|
+
created() {
|
|
37
|
+
this.emitPreselectedFilters();
|
|
38
|
+
}
|
|
24
39
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
25
40
|
render() { }
|
|
26
41
|
};
|
|
27
42
|
__decorate([
|
|
28
|
-
Inject()
|
|
43
|
+
Inject('snippetConfig')
|
|
29
44
|
], PreselectedFilters.prototype, "snippetConfig", void 0);
|
|
30
45
|
__decorate([
|
|
31
46
|
Prop({ default: () => [] })
|
|
32
47
|
], PreselectedFilters.prototype, "filters", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
Watch('preselectedFilters')
|
|
50
|
+
], PreselectedFilters.prototype, "emitPreselectedFilters", null);
|
|
33
51
|
PreselectedFilters = __decorate([
|
|
34
52
|
Component
|
|
35
53
|
], PreselectedFilters);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preselected-filters.vue2.js","sources":["../../../../../src/x-modules/facets/components/preselected-filters.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n import { Component, Inject, Prop } from 'vue-property-decorator';\n import Vue from 'vue';\n import { createRawFilters } from '../../../utils/filters';\n import { isArrayEmpty } from '../../../utils/array';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n\n /**\n * This component emits {@link FacetsXEvents.PreselectedFiltersProvided} when a preselected filter\n * is set in the snippet config or by using the prop of the component.\n *\n * @public\n */\n @Component\n export default class PreselectedFilters extends Vue {\n /**\n * Injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n *\n * @internal\n */\n @Inject()\n public snippetConfig?: SnippetConfig;\n\n /**\n * A list of filters to preselect.\n *\n * @remarks Emits the {@link FacetsXEvents.PreselectedFiltersProvided} when the\n * component is created.\n *\n * @public\n */\n @Prop({ default: () => [] })\n public filters!: string[];\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"preselected-filters.vue2.js","sources":["../../../../../src/x-modules/facets/components/preselected-filters.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n import { Component, Inject, Prop, Watch } from 'vue-property-decorator';\n import Vue from 'vue';\n import { createRawFilters } from '../../../utils/filters';\n import { isArrayEmpty } from '../../../utils/array';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n\n /**\n * This component emits {@link FacetsXEvents.PreselectedFiltersProvided} when a preselected filter\n * is set in the snippet config or by using the prop of the component.\n *\n * @public\n */\n @Component\n export default class PreselectedFilters extends Vue {\n /**\n * Injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n *\n * @internal\n */\n @Inject('snippetConfig')\n public snippetConfig?: SnippetConfig;\n\n /**\n * A list of filters to preselect.\n *\n * @remarks Emits the {@link FacetsXEvents.PreselectedFiltersProvided} when the\n * component is created.\n *\n * @public\n */\n @Prop({ default: () => [] })\n public filters!: string[];\n\n /**\n * Gets the provided preselected filters prioritizing the {@link SnippetConfig} over the\n * filters prop.\n *\n * @returns An array of filter's ids.\n */\n protected get preselectedFilters(): string[] {\n return this.snippetConfig?.filters ?? this.filters;\n }\n\n /**\n * Emits the {@link FacetsXEvents.PreselectedFiltersProvided} to save\n * the provided filters in the state.\n */\n @Watch('preselectedFilters')\n protected emitPreselectedFilters(): void {\n if (!isArrayEmpty(this.preselectedFilters)) {\n this.$x.emit('PreselectedFiltersProvided', createRawFilters(this.preselectedFilters));\n }\n }\n\n /**\n * Emits the {@link FacetsXEvents.PreselectedFiltersProvided} when the\n * component is created.\n */\n created(): void {\n this.emitPreselectedFilters();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n render(): void {}\n }\n"],"names":[],"mappings":";;;;;;AAOE;;;;;AAKG;AAEY,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,GAAG,CAAA;AAoBjD;;;;;AAKG;AACH,IAAA,IAAc,kBAAkB,GAAA;QAC9B,OAAO,IAAI,CAAC,aAAa,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;KACpD;AAED;;;AAGG;IAEO,sBAAsB,GAAA;AAC9B,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE;AAC1C,YAAA,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACvF,SAAA;KACF;AAED;;;AAGG;IACH,OAAO,GAAA;QACL,IAAI,CAAC,sBAAsB,EAAE,CAAC;KAC/B;;AAGD,IAAA,MAAM,MAAW;CAClB,CAAA;AA5CC,UAAA,CAAA;IADC,MAAM,CAAC,eAAe,CAAC;AACa,CAAA,EAAA,kBAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAWrC,UAAA,CAAA;IADC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;AACF,CAAA,EAAA,kBAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAiB1B,UAAA,CAAA;IADC,KAAK,CAAC,oBAAoB,CAAC;AAK3B,CAAA,EAAA,kBAAA,CAAA,SAAA,EAAA,wBAAA,EAAA,IAAA,CAAA,CAAA;AAvCkB,kBAAkB,GAAA,UAAA,CAAA;IADtC,SAAS;AACW,CAAA,EAAA,kBAAkB,CAmDtC,CAAA;aAnDoB,kBAAkB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-components",
|
|
3
|
-
"version": "4.1.0-alpha.
|
|
3
|
+
"version": "4.1.0-alpha.23",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
"access": "public",
|
|
144
144
|
"directory": "dist"
|
|
145
145
|
},
|
|
146
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "ae3bb29c745057c0b50dc3ee0d96b79c2297305e"
|
|
147
147
|
}
|
|
@@ -37605,7 +37605,7 @@
|
|
|
37605
37605
|
{
|
|
37606
37606
|
"kind": "Method",
|
|
37607
37607
|
"canonicalReference": "@empathyco/x-components!PreselectedFilters#created:member(1)",
|
|
37608
|
-
"docComment": "/**\n * Emits the
|
|
37608
|
+
"docComment": "/**\n * Emits the {@link FacetsXEvents.PreselectedFiltersProvided} when the component is created.\n */\n",
|
|
37609
37609
|
"excerptTokens": [
|
|
37610
37610
|
{
|
|
37611
37611
|
"kind": "Content",
|
|
@@ -37633,6 +37633,37 @@
|
|
|
37633
37633
|
"isAbstract": false,
|
|
37634
37634
|
"name": "created"
|
|
37635
37635
|
},
|
|
37636
|
+
{
|
|
37637
|
+
"kind": "Method",
|
|
37638
|
+
"canonicalReference": "@empathyco/x-components!PreselectedFilters#emitPreselectedFilters:member(1)",
|
|
37639
|
+
"docComment": "/**\n * Emits the {@link FacetsXEvents.PreselectedFiltersProvided} to save the provided filters in the state.\n */\n",
|
|
37640
|
+
"excerptTokens": [
|
|
37641
|
+
{
|
|
37642
|
+
"kind": "Content",
|
|
37643
|
+
"text": "protected emitPreselectedFilters(): "
|
|
37644
|
+
},
|
|
37645
|
+
{
|
|
37646
|
+
"kind": "Content",
|
|
37647
|
+
"text": "void"
|
|
37648
|
+
},
|
|
37649
|
+
{
|
|
37650
|
+
"kind": "Content",
|
|
37651
|
+
"text": ";"
|
|
37652
|
+
}
|
|
37653
|
+
],
|
|
37654
|
+
"isStatic": false,
|
|
37655
|
+
"returnTypeTokenRange": {
|
|
37656
|
+
"startIndex": 1,
|
|
37657
|
+
"endIndex": 2
|
|
37658
|
+
},
|
|
37659
|
+
"releaseTag": "Public",
|
|
37660
|
+
"isProtected": true,
|
|
37661
|
+
"overloadIndex": 1,
|
|
37662
|
+
"parameters": [],
|
|
37663
|
+
"isOptional": false,
|
|
37664
|
+
"isAbstract": false,
|
|
37665
|
+
"name": "emitPreselectedFilters"
|
|
37666
|
+
},
|
|
37636
37667
|
{
|
|
37637
37668
|
"kind": "Property",
|
|
37638
37669
|
"canonicalReference": "@empathyco/x-components!PreselectedFilters#filters:member",
|
|
@@ -37663,6 +37694,36 @@
|
|
|
37663
37694
|
"isProtected": false,
|
|
37664
37695
|
"isAbstract": false
|
|
37665
37696
|
},
|
|
37697
|
+
{
|
|
37698
|
+
"kind": "Property",
|
|
37699
|
+
"canonicalReference": "@empathyco/x-components!PreselectedFilters#preselectedFilters:member",
|
|
37700
|
+
"docComment": "/**\n * Gets the provided preselected filters prioritizing the {@link SnippetConfig} over the filters prop.\n *\n * @returns An array of filter's ids.\n */\n",
|
|
37701
|
+
"excerptTokens": [
|
|
37702
|
+
{
|
|
37703
|
+
"kind": "Content",
|
|
37704
|
+
"text": "protected get preselectedFilters(): "
|
|
37705
|
+
},
|
|
37706
|
+
{
|
|
37707
|
+
"kind": "Content",
|
|
37708
|
+
"text": "string[]"
|
|
37709
|
+
},
|
|
37710
|
+
{
|
|
37711
|
+
"kind": "Content",
|
|
37712
|
+
"text": ";"
|
|
37713
|
+
}
|
|
37714
|
+
],
|
|
37715
|
+
"isReadonly": true,
|
|
37716
|
+
"isOptional": false,
|
|
37717
|
+
"releaseTag": "Public",
|
|
37718
|
+
"name": "preselectedFilters",
|
|
37719
|
+
"propertyTypeTokenRange": {
|
|
37720
|
+
"startIndex": 1,
|
|
37721
|
+
"endIndex": 2
|
|
37722
|
+
},
|
|
37723
|
+
"isStatic": false,
|
|
37724
|
+
"isProtected": true,
|
|
37725
|
+
"isAbstract": false
|
|
37726
|
+
},
|
|
37666
37727
|
{
|
|
37667
37728
|
"kind": "Method",
|
|
37668
37729
|
"canonicalReference": "@empathyco/x-components!PreselectedFilters#render:member(1)",
|
|
@@ -63676,6 +63737,85 @@
|
|
|
63676
63737
|
],
|
|
63677
63738
|
"name": "useGetter"
|
|
63678
63739
|
},
|
|
63740
|
+
{
|
|
63741
|
+
"kind": "Function",
|
|
63742
|
+
"canonicalReference": "@empathyco/x-components!useHybridInject:function(1)",
|
|
63743
|
+
"docComment": "/**\n * Function to use a hybrid inject, which allows to inject a value provided by the regular provide of vue or by the XProvide decorator.\n *\n * @param key - The key of the value to inject.\n *\n * @param defaultValue - The default value to use if the value is not provided.\n *\n * @returns The computed value of the injected value.\n *\n * @public\n */\n",
|
|
63744
|
+
"excerptTokens": [
|
|
63745
|
+
{
|
|
63746
|
+
"kind": "Content",
|
|
63747
|
+
"text": "export declare function useHybridInject<SomeValue>(key: "
|
|
63748
|
+
},
|
|
63749
|
+
{
|
|
63750
|
+
"kind": "Content",
|
|
63751
|
+
"text": "string"
|
|
63752
|
+
},
|
|
63753
|
+
{
|
|
63754
|
+
"kind": "Content",
|
|
63755
|
+
"text": ", defaultValue?: "
|
|
63756
|
+
},
|
|
63757
|
+
{
|
|
63758
|
+
"kind": "Content",
|
|
63759
|
+
"text": "SomeValue"
|
|
63760
|
+
},
|
|
63761
|
+
{
|
|
63762
|
+
"kind": "Content",
|
|
63763
|
+
"text": "): "
|
|
63764
|
+
},
|
|
63765
|
+
{
|
|
63766
|
+
"kind": "Reference",
|
|
63767
|
+
"text": "ComputedRef",
|
|
63768
|
+
"canonicalReference": "vue!ComputedRef:interface"
|
|
63769
|
+
},
|
|
63770
|
+
{
|
|
63771
|
+
"kind": "Content",
|
|
63772
|
+
"text": "<SomeValue | undefined>"
|
|
63773
|
+
},
|
|
63774
|
+
{
|
|
63775
|
+
"kind": "Content",
|
|
63776
|
+
"text": ";"
|
|
63777
|
+
}
|
|
63778
|
+
],
|
|
63779
|
+
"fileUrlPath": "src/composables/use-hybrid-inject.ts",
|
|
63780
|
+
"returnTypeTokenRange": {
|
|
63781
|
+
"startIndex": 5,
|
|
63782
|
+
"endIndex": 7
|
|
63783
|
+
},
|
|
63784
|
+
"releaseTag": "Public",
|
|
63785
|
+
"overloadIndex": 1,
|
|
63786
|
+
"parameters": [
|
|
63787
|
+
{
|
|
63788
|
+
"parameterName": "key",
|
|
63789
|
+
"parameterTypeTokenRange": {
|
|
63790
|
+
"startIndex": 1,
|
|
63791
|
+
"endIndex": 2
|
|
63792
|
+
},
|
|
63793
|
+
"isOptional": false
|
|
63794
|
+
},
|
|
63795
|
+
{
|
|
63796
|
+
"parameterName": "defaultValue",
|
|
63797
|
+
"parameterTypeTokenRange": {
|
|
63798
|
+
"startIndex": 3,
|
|
63799
|
+
"endIndex": 4
|
|
63800
|
+
},
|
|
63801
|
+
"isOptional": true
|
|
63802
|
+
}
|
|
63803
|
+
],
|
|
63804
|
+
"typeParameters": [
|
|
63805
|
+
{
|
|
63806
|
+
"typeParameterName": "SomeValue",
|
|
63807
|
+
"constraintTokenRange": {
|
|
63808
|
+
"startIndex": 0,
|
|
63809
|
+
"endIndex": 0
|
|
63810
|
+
},
|
|
63811
|
+
"defaultTypeTokenRange": {
|
|
63812
|
+
"startIndex": 0,
|
|
63813
|
+
"endIndex": 0
|
|
63814
|
+
}
|
|
63815
|
+
}
|
|
63816
|
+
],
|
|
63817
|
+
"name": "useHybridInject"
|
|
63818
|
+
},
|
|
63679
63819
|
{
|
|
63680
63820
|
"kind": "Function",
|
|
63681
63821
|
"canonicalReference": "@empathyco/x-components!useNoElementRender:function(1)",
|
|
@@ -3554,7 +3554,9 @@ export const popularSearchesXStoreModule: PopularSearchesXStoreModule;
|
|
|
3554
3554
|
// @public
|
|
3555
3555
|
export class PreselectedFilters extends Vue_2 {
|
|
3556
3556
|
created(): void;
|
|
3557
|
+
protected emitPreselectedFilters(): void;
|
|
3557
3558
|
filters: string[];
|
|
3559
|
+
protected get preselectedFilters(): string[];
|
|
3558
3560
|
// (undocumented)
|
|
3559
3561
|
render(): void;
|
|
3560
3562
|
// @internal
|
|
@@ -6163,6 +6165,9 @@ export function useEmitDisplayEvent({ element, taggingRequest, eventMetadata }:
|
|
|
6163
6165
|
// @public
|
|
6164
6166
|
export function useGetter<Module extends XModuleName, GetterName extends keyof ExtractGetters<Module> & string>(module: Module, getters: GetterName[]): Dictionary<ComputedRef<GetterName[]>>;
|
|
6165
6167
|
|
|
6168
|
+
// @public
|
|
6169
|
+
export function useHybridInject<SomeValue>(key: string, defaultValue?: SomeValue): ComputedRef<SomeValue | undefined>;
|
|
6170
|
+
|
|
6166
6171
|
// @public
|
|
6167
6172
|
export function useNoElementRender(slots: {
|
|
6168
6173
|
[key: string]: VNode_2[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Function to use a hybrid inject, which allows to inject a value provided by the regular provide
|
|
4
|
+
* of vue or by the XProvide decorator.
|
|
5
|
+
*
|
|
6
|
+
* @param key - The key of the value to inject.
|
|
7
|
+
* @param defaultValue - The default value to use if the value is not provided.
|
|
8
|
+
* @returns The computed value of the injected value.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare function useHybridInject<SomeValue>(key: string, defaultValue?: SomeValue): ComputedRef<SomeValue | undefined>;
|
|
12
|
+
//# sourceMappingURL=use-hybrid-inject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-hybrid-inject.d.ts","sourceRoot":"","sources":["../../../src/composables/use-hybrid-inject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAU,MAAM,KAAK,CAAC;AAEpD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,SAAS,EACvC,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,SAAS,GACvB,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC,CAYpC"}
|
|
@@ -23,8 +23,20 @@ export default class PreselectedFilters extends Vue {
|
|
|
23
23
|
*/
|
|
24
24
|
filters: string[];
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Gets the provided preselected filters prioritizing the {@link SnippetConfig} over the
|
|
27
27
|
* filters prop.
|
|
28
|
+
*
|
|
29
|
+
* @returns An array of filter's ids.
|
|
30
|
+
*/
|
|
31
|
+
protected get preselectedFilters(): string[];
|
|
32
|
+
/**
|
|
33
|
+
* Emits the {@link FacetsXEvents.PreselectedFiltersProvided} to save
|
|
34
|
+
* the provided filters in the state.
|
|
35
|
+
*/
|
|
36
|
+
protected emitPreselectedFilters(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Emits the {@link FacetsXEvents.PreselectedFiltersProvided} when the
|
|
39
|
+
* component is created.
|
|
28
40
|
*/
|
|
29
41
|
created(): void;
|
|
30
42
|
render(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preselected-filters.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/facets/components/preselected-filters.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AAEE,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAEnE;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,GAAG;IACjD;;;;OAIG;IAEI,aAAa,CAAC,EAAE,aAAa,CAAC;IAErC;;;;;;;OAOG;IAEI,OAAO,EAAG,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,OAAO,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"preselected-filters.vue?rollup-plugin-vue=script.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/facets/components/preselected-filters.vue?rollup-plugin-vue=script.ts"],"names":[],"mappings":"AAEE,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAEnE;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,GAAG;IACjD;;;;OAIG;IAEI,aAAa,CAAC,EAAE,aAAa,CAAC;IAErC;;;;;;;OAOG;IAEI,OAAO,EAAG,MAAM,EAAE,CAAC;IAE1B;;;;;OAKG;IACH,SAAS,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAE3C;IAED;;;OAGG;IAEH,SAAS,CAAC,sBAAsB,IAAI,IAAI;IAMxC;;;OAGG;IACH,OAAO,IAAI,IAAI;IAKf,MAAM,IAAI,IAAI;CACf"}
|