@empathyco/x-components 10.11.0 → 10.12.0
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/js/x-modules/vendor/components/vendor-banners-list.vue.js +13 -2
- package/js/x-modules/vendor/components/vendor-banners-list.vue.js.map +1 -1
- package/js/x-modules/vendor/components/vendor-results-list.vue.js +13 -2
- package/js/x-modules/vendor/components/vendor-results-list.vue.js.map +1 -1
- package/package.json +7 -7
- package/types/src/x-modules/vendor/components/vendor-banners-list.vue.d.ts.map +1 -1
- package/types/src/x-modules/vendor/components/vendor-results-list.vue.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [10.12.0](https://github.com/empathyco/x/compare/@empathyco/x-components@10.3.0...@empathyco/x-components@10.12.0) (2026-11-23)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **base-modal:** add scrollLock prop to control page scroll behavior (#2200)
|
|
11
|
+
* **search:** add priceFacetId to SearchConfig and update request accordingly (#2194)
|
|
12
|
+
* **skills:** ship validated agent skills in every package (#2203)
|
|
13
|
+
* **x-components:** add responsive image props and loading events to BaseResultImage (#2195)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **ai:** set AI suggestions status to error when requests fail (ENG-2552) (#2204)
|
|
18
|
+
* change CSS selector for only child teleport (#2197)
|
|
19
|
+
* remove parent selector when BaseTeleport is unmounted (#2198)
|
|
20
|
+
* **vendor:** don't render the search results duplicated by vendor results (ENG-2618) (#2208)
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [10.11.0](https://github.com/empathyco/x/compare/@empathyco/x-components@10.3.0...@empathyco/x-components@10.11.0) (2026-11-23)
|
|
7
24
|
|
|
8
25
|
### Features
|
|
@@ -53,6 +53,17 @@ var _sfc_main = defineComponent({
|
|
|
53
53
|
: vendorBanners.value);
|
|
54
54
|
/** It injects {@link ListItem} provided by an ancestor as injectedListItems. */
|
|
55
55
|
const injectedListItems = inject(LIST_ITEMS_KEY);
|
|
56
|
+
/**
|
|
57
|
+
* The injected list items without the banners that are also provided as vendor banners
|
|
58
|
+
* (same id), so the same banner is not rendered twice.
|
|
59
|
+
*
|
|
60
|
+
* @remarks The vendor banner takes precedence over the indexed banner. The state is not
|
|
61
|
+
* modified, so the banner is rendered again if the vendor banner is removed.
|
|
62
|
+
*/
|
|
63
|
+
const injectedItemsWithoutDuplicates = computed(() => {
|
|
64
|
+
const vendorBannerIds = new Set(stateItems.value.map(({ id }) => id));
|
|
65
|
+
return (injectedListItems?.value ?? []).filter(({ id, modelName }) => modelName !== 'Banner' || !vendorBannerIds.has(id));
|
|
66
|
+
});
|
|
56
67
|
/**
|
|
57
68
|
* Indicates if all the results of the current context have been loaded, to know if the
|
|
58
69
|
* vendor banners can be inserted in positions of not yet loaded pages.
|
|
@@ -72,10 +83,10 @@ var _sfc_main = defineComponent({
|
|
|
72
83
|
* @returns List of {@link ListItem}.
|
|
73
84
|
*/
|
|
74
85
|
const items = computed(() => {
|
|
75
|
-
if (!
|
|
86
|
+
if (!injectedItemsWithoutDuplicates.value.length) {
|
|
76
87
|
return stateItems.value;
|
|
77
88
|
}
|
|
78
|
-
const items = [...
|
|
89
|
+
const items = [...injectedItemsWithoutDuplicates.value];
|
|
79
90
|
const positionedBanners = stateItems.value.filter(item => item.position != null);
|
|
80
91
|
const unpositionedBanners = stateItems.value.filter(item => item.position == null);
|
|
81
92
|
for (const item of positionedBanners) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendor-banners-list.vue.js","sources":["../../../../../src/x-modules/vendor/components/vendor-banners-list.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ListItem } from '../../../utils/types'\nimport { computed, defineComponent, h, inject, provide } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components/decorators/injection.consts'\nimport ItemsList from '../../../components/items-list.vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { AnimationProp } from '../../../types/animation-prop'\nimport { vendorXModule } from '../x-module'\n\n/**\n * It renders a {@link ItemsList} list of vendor banners from {@link VendorState.banners}.\n *\n * The component provides a default slot which wraps the whole component with the `vendorBanners`\n * plus the `injectedListItems` which also contains the injected list items from\n * the ancestor.\n *\n * If the `queryPreviewHash` prop is provided, the vendor banners are retrieved from\n * {@link VendorState.queryPreviews}, scoped to the query preview.\n *\n * It also provides the parent slots to customize the items.\n *\n * @public\n */\nexport default defineComponent({\n name: 'VendorBannersList',\n xModule: vendorXModule.name,\n props: {\n /** Animation component that will be used to animate the vendor banners. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /**\n * The hash of the query preview to render its vendor banners. If not provided,\n * the vendor banners from the root state are rendered.\n */\n queryPreviewHash: {\n type: String,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const $x = use$x()\n\n /** The vendor banners to render from the vendor state. */\n const vendorBanners = useState('vendor').banners\n\n /** The vendor banners of the query previews, indexed by their query preview hash. */\n const vendorQueryPreviews = useState('vendor').queryPreviews\n\n /**\n * The vendor banners to render. They are read from the query preview state when the\n * `queryPreviewHash` prop is provided, or from the root vendor state otherwise.\n */\n const stateItems = computed(() =>\n props.queryPreviewHash\n ? (vendorQueryPreviews.value?.[props.queryPreviewHash]?.banners ?? [])\n : vendorBanners.value,\n )\n\n /** It injects {@link ListItem} provided by an ancestor as injectedListItems. */\n const injectedListItems = inject<Ref<ListItem[]>>(LIST_ITEMS_KEY as string)\n\n /**\n * Indicates if all the results of the current context have been loaded, to know if the\n * vendor banners can be inserted in positions of not yet loaded pages.\n *\n * @remarks The query preview results are always considered as fully loaded, since they are\n * retrieved as a fixed batch.\n *\n * @returns Whether all the results are loaded.\n */\n const areAllPagesLoaded = computed(() =>\n props.queryPreviewHash ? true : $x.results.length === $x.totalResults,\n )\n\n /**\n * The `stateItems` concatenated with the `injectedListItems` if there are.\n *\n * @remarks This computed defines the merging strategy of the `stateItems` and the\n * `injectedListItems`.\n *\n * @returns List of {@link ListItem}.\n */\n const items = computed(() => {\n if (!
|
|
1
|
+
{"version":3,"file":"vendor-banners-list.vue.js","sources":["../../../../../src/x-modules/vendor/components/vendor-banners-list.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ListItem } from '../../../utils/types'\nimport { computed, defineComponent, h, inject, provide } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components/decorators/injection.consts'\nimport ItemsList from '../../../components/items-list.vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { AnimationProp } from '../../../types/animation-prop'\nimport { vendorXModule } from '../x-module'\n\n/**\n * It renders a {@link ItemsList} list of vendor banners from {@link VendorState.banners}.\n *\n * The component provides a default slot which wraps the whole component with the `vendorBanners`\n * plus the `injectedListItems` which also contains the injected list items from\n * the ancestor.\n *\n * If the `queryPreviewHash` prop is provided, the vendor banners are retrieved from\n * {@link VendorState.queryPreviews}, scoped to the query preview.\n *\n * It also provides the parent slots to customize the items.\n *\n * @public\n */\nexport default defineComponent({\n name: 'VendorBannersList',\n xModule: vendorXModule.name,\n props: {\n /** Animation component that will be used to animate the vendor banners. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /**\n * The hash of the query preview to render its vendor banners. If not provided,\n * the vendor banners from the root state are rendered.\n */\n queryPreviewHash: {\n type: String,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const $x = use$x()\n\n /** The vendor banners to render from the vendor state. */\n const vendorBanners = useState('vendor').banners\n\n /** The vendor banners of the query previews, indexed by their query preview hash. */\n const vendorQueryPreviews = useState('vendor').queryPreviews\n\n /**\n * The vendor banners to render. They are read from the query preview state when the\n * `queryPreviewHash` prop is provided, or from the root vendor state otherwise.\n */\n const stateItems = computed(() =>\n props.queryPreviewHash\n ? (vendorQueryPreviews.value?.[props.queryPreviewHash]?.banners ?? [])\n : vendorBanners.value,\n )\n\n /** It injects {@link ListItem} provided by an ancestor as injectedListItems. */\n const injectedListItems = inject<Ref<ListItem[]>>(LIST_ITEMS_KEY as string)\n\n /**\n * The injected list items without the banners that are also provided as vendor banners\n * (same id), so the same banner is not rendered twice.\n *\n * @remarks The vendor banner takes precedence over the indexed banner. The state is not\n * modified, so the banner is rendered again if the vendor banner is removed.\n */\n const injectedItemsWithoutDuplicates = computed(() => {\n const vendorBannerIds = new Set(stateItems.value.map(({ id }) => id))\n return (injectedListItems?.value ?? []).filter(\n ({ id, modelName }) => modelName !== 'Banner' || !vendorBannerIds.has(id),\n )\n })\n\n /**\n * Indicates if all the results of the current context have been loaded, to know if the\n * vendor banners can be inserted in positions of not yet loaded pages.\n *\n * @remarks The query preview results are always considered as fully loaded, since they are\n * retrieved as a fixed batch.\n *\n * @returns Whether all the results are loaded.\n */\n const areAllPagesLoaded = computed(() =>\n props.queryPreviewHash ? true : $x.results.length === $x.totalResults,\n )\n\n /**\n * The `stateItems` concatenated with the `injectedListItems` if there are.\n *\n * @remarks This computed defines the merging strategy of the `stateItems` and the\n * `injectedListItems`.\n *\n * @returns List of {@link ListItem}.\n */\n const items = computed(() => {\n if (!injectedItemsWithoutDuplicates.value.length) {\n return stateItems.value\n }\n const items = [...injectedItemsWithoutDuplicates.value]\n const positionedBanners = stateItems.value.filter(item => item.position != null)\n const unpositionedBanners = stateItems.value.filter(item => item.position == null)\n for (const item of positionedBanners) {\n let index = item.position! - 1\n while (items.at(index)?.modelName === 'VendorBanner') {\n index++\n }\n const isIndexInLoadedPages = index <= items.length\n if (!isIndexInLoadedPages && !areAllPagesLoaded.value) {\n break\n }\n items.splice(index, 0, item)\n }\n items.unshift(...unpositionedBanners)\n return items\n })\n\n /**\n * The computed list items of the entity that uses the mixin.\n *\n * @remarks It should be overridden in the component that uses the mixin and it's intended to be\n * filled with items from the state. Vue doesn't allow mixins as abstract classes.\n * @returns An empty array as fallback in case it is not overridden.\n */\n provide(LIST_ITEMS_KEY as string, items)\n\n return () => {\n const innerProps = { items: items.value, animation: props.animation }\n // https://vue-land.github.io/faq/forwarding-slots#passing-all-slots\n return slots.default?.(innerProps)[0] ?? h(ItemsList, innerProps, slots)\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;AAWA;;;;;;;;;;;;;AAaE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,KAAK,EAAE;;AAEL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;;AAGE;AACF,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;;QAGjB,MAAM,aAAY,GAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAM;;QAG/C,MAAM,mBAAkB,GAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,aAAY;AAE3D;;;AAGE;QACF,MAAM,aAAa,QAAQ,CAAC,MAC1B,KAAK,CAAC;AACJ,eAAG,mBAAmB,CAAC,KAAK,GAAG,KAAK,CAAC,gBAAgB,CAAC,EAAE,OAAM,IAAK,EAAE;AACrE,cAAE,aAAa,CAAC,KAAK,CACzB;;AAGA,QAAA,MAAM,iBAAgB,GAAI,MAAM,CAAkB,cAAwB,CAAA;AAE1E;;;;;;AAME;AACF,QAAA,MAAM,8BAA6B,GAAI,QAAQ,CAAC,MAAI;YAClD,MAAM,eAAc,GAAI,IAAI,GAAG,C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iB,CAAC,KAAK,EAAE;oBACrD;gBACF;gBACA,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAA;YAC7B;AACA,YAAA,KAAK,CAAC,OAAO,CAAC,GAAG,mBAAmB,CAAA;AACpC,YAAA,OAAO,KAAI;AACb,QAAA,CAAC,CAAA;AAED;;;;;;AAME;AACF,QAAA,OAAO,CAAC,cAAwB,EAAE,KAAK,CAAA;AAEvC,QAAA,OAAO,MAAI;AACT,YAAA,MAAM,UAAS,GAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAQ,EAAE;;AAEpE,YAAA,OAAO,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA,IAAK,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAA;AACzE,QAAA,CAAA;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -53,6 +53,17 @@ var _sfc_main = defineComponent({
|
|
|
53
53
|
: vendorResults.value);
|
|
54
54
|
/** It injects {@link ListItem} provided by an ancestor as injectedListItems. */
|
|
55
55
|
const injectedListItems = inject(LIST_ITEMS_KEY);
|
|
56
|
+
/**
|
|
57
|
+
* The injected list items without the search results that are also provided as vendor results
|
|
58
|
+
* (same id), so the same product is not rendered twice.
|
|
59
|
+
*
|
|
60
|
+
* @remarks The vendor result takes precedence over the indexed search result. The state is not
|
|
61
|
+
* modified, so the search result is rendered again if the vendor result is removed.
|
|
62
|
+
*/
|
|
63
|
+
const injectedItemsWithoutDuplicates = computed(() => {
|
|
64
|
+
const vendorResultIds = new Set(stateItems.value.map(({ id }) => id));
|
|
65
|
+
return (injectedListItems?.value ?? []).filter(({ id, modelName }) => modelName !== 'Result' || !vendorResultIds.has(id));
|
|
66
|
+
});
|
|
56
67
|
/**
|
|
57
68
|
* Indicates if all the results of the current context have been loaded, to know if the
|
|
58
69
|
* vendor results can be inserted in positions of not yet loaded pages.
|
|
@@ -72,10 +83,10 @@ var _sfc_main = defineComponent({
|
|
|
72
83
|
* @returns List of {@link ListItem}.
|
|
73
84
|
*/
|
|
74
85
|
const items = computed(() => {
|
|
75
|
-
if (!
|
|
86
|
+
if (!injectedItemsWithoutDuplicates.value.length) {
|
|
76
87
|
return stateItems.value;
|
|
77
88
|
}
|
|
78
|
-
const items = [...
|
|
89
|
+
const items = [...injectedItemsWithoutDuplicates.value];
|
|
79
90
|
for (const item of stateItems.value) {
|
|
80
91
|
const position = item.position ?? 1;
|
|
81
92
|
let index = position - 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendor-results-list.vue.js","sources":["../../../../../src/x-modules/vendor/components/vendor-results-list.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ListItem } from '../../../utils/types'\nimport { computed, defineComponent, h, inject, provide } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components/decorators/injection.consts'\nimport ItemsList from '../../../components/items-list.vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { AnimationProp } from '../../../types/animation-prop'\nimport { vendorXModule } from '../x-module'\n\n/**\n * It renders a {@link ItemsList} of vendor results from {@link VendorState.results}.\n *\n * The component provides a default slot which wraps the whole component with the `vendorResults`\n * plus the `injectedListItems` which also contains the injected list items from\n * the ancestor.\n *\n * If the `queryPreviewHash` prop is provided, the vendor results are retrieved from\n * {@link VendorState.queryPreviews}, scoped to the query preview.\n *\n * It also provides the parent slots to customize the items.\n *\n * @public\n */\nexport default defineComponent({\n name: 'VendorResultsList',\n xModule: vendorXModule.name,\n props: {\n /** Animation component that will be used to animate the vendor results. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /**\n * The hash of the query preview to render its vendor results. If not provided,\n * the vendor results from the root state are rendered.\n */\n queryPreviewHash: {\n type: String,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const $x = use$x()\n\n /** The vendor results to render from the vendor state. */\n const vendorResults = useState('vendor').results\n\n /** The vendor results of the query previews, indexed by their query preview hash. */\n const vendorQueryPreviews = useState('vendor').queryPreviews\n\n /**\n * The vendor results to render. They are read from the query preview state when the\n * `queryPreviewHash` prop is provided, or from the root vendor state otherwise.\n */\n const stateItems = computed(() =>\n props.queryPreviewHash\n ? (vendorQueryPreviews.value?.[props.queryPreviewHash]?.results ?? [])\n : vendorResults.value,\n )\n\n /** It injects {@link ListItem} provided by an ancestor as injectedListItems. */\n const injectedListItems = inject<Ref<ListItem[]>>(LIST_ITEMS_KEY as string)\n\n /**\n * Indicates if all the results of the current context have been loaded, to know if the\n * vendor results can be inserted in positions of not yet loaded pages.\n *\n * @remarks The query preview results are always considered as fully loaded, since they are\n * retrieved as a fixed batch.\n *\n * @returns Whether all the results are loaded.\n */\n const areAllPagesLoaded = computed(() =>\n props.queryPreviewHash ? true : $x.results.length === $x.totalResults,\n )\n\n /**\n * The `stateItems` concatenated with the `injectedListItems` if there are.\n *\n * @remarks This computed defines the merging strategy of the `stateItems` and the\n * `injectedListItems`.\n *\n * @returns List of {@link ListItem}.\n */\n const items = computed(() => {\n if (!
|
|
1
|
+
{"version":3,"file":"vendor-results-list.vue.js","sources":["../../../../../src/x-modules/vendor/components/vendor-results-list.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ListItem } from '../../../utils/types'\nimport { computed, defineComponent, h, inject, provide } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components/decorators/injection.consts'\nimport ItemsList from '../../../components/items-list.vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { AnimationProp } from '../../../types/animation-prop'\nimport { vendorXModule } from '../x-module'\n\n/**\n * It renders a {@link ItemsList} of vendor results from {@link VendorState.results}.\n *\n * The component provides a default slot which wraps the whole component with the `vendorResults`\n * plus the `injectedListItems` which also contains the injected list items from\n * the ancestor.\n *\n * If the `queryPreviewHash` prop is provided, the vendor results are retrieved from\n * {@link VendorState.queryPreviews}, scoped to the query preview.\n *\n * It also provides the parent slots to customize the items.\n *\n * @public\n */\nexport default defineComponent({\n name: 'VendorResultsList',\n xModule: vendorXModule.name,\n props: {\n /** Animation component that will be used to animate the vendor results. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /**\n * The hash of the query preview to render its vendor results. If not provided,\n * the vendor results from the root state are rendered.\n */\n queryPreviewHash: {\n type: String,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const $x = use$x()\n\n /** The vendor results to render from the vendor state. */\n const vendorResults = useState('vendor').results\n\n /** The vendor results of the query previews, indexed by their query preview hash. */\n const vendorQueryPreviews = useState('vendor').queryPreviews\n\n /**\n * The vendor results to render. They are read from the query preview state when the\n * `queryPreviewHash` prop is provided, or from the root vendor state otherwise.\n */\n const stateItems = computed(() =>\n props.queryPreviewHash\n ? (vendorQueryPreviews.value?.[props.queryPreviewHash]?.results ?? [])\n : vendorResults.value,\n )\n\n /** It injects {@link ListItem} provided by an ancestor as injectedListItems. */\n const injectedListItems = inject<Ref<ListItem[]>>(LIST_ITEMS_KEY as string)\n\n /**\n * The injected list items without the search results that are also provided as vendor results\n * (same id), so the same product is not rendered twice.\n *\n * @remarks The vendor result takes precedence over the indexed search result. The state is not\n * modified, so the search result is rendered again if the vendor result is removed.\n */\n const injectedItemsWithoutDuplicates = computed(() => {\n const vendorResultIds = new Set(stateItems.value.map(({ id }) => id))\n return (injectedListItems?.value ?? []).filter(\n ({ id, modelName }) => modelName !== 'Result' || !vendorResultIds.has(id),\n )\n })\n\n /**\n * Indicates if all the results of the current context have been loaded, to know if the\n * vendor results can be inserted in positions of not yet loaded pages.\n *\n * @remarks The query preview results are always considered as fully loaded, since they are\n * retrieved as a fixed batch.\n *\n * @returns Whether all the results are loaded.\n */\n const areAllPagesLoaded = computed(() =>\n props.queryPreviewHash ? true : $x.results.length === $x.totalResults,\n )\n\n /**\n * The `stateItems` concatenated with the `injectedListItems` if there are.\n *\n * @remarks This computed defines the merging strategy of the `stateItems` and the\n * `injectedListItems`.\n *\n * @returns List of {@link ListItem}.\n */\n const items = computed(() => {\n if (!injectedItemsWithoutDuplicates.value.length) {\n return stateItems.value\n }\n const items = [...injectedItemsWithoutDuplicates.value]\n for (const item of stateItems.value) {\n const position = item.position ?? 1\n let index = position - 1\n while (items.at(index)?.modelName === 'VendorResult') {\n index++\n }\n const isIndexInLoadedPages = index <= items.length\n if (!isIndexInLoadedPages && !areAllPagesLoaded.value) {\n break\n }\n items.splice(index, 0, item)\n }\n return items\n })\n\n /**\n * The computed list items of the entity that uses the mixin.\n *\n * @remarks It should be overridden in the component that uses the mixin and it's intended to be\n * filled with items from the state. Vue doesn't allow mixins as abstract classes.\n * @returns An empty array as fallback in case it is not overridden.\n */\n provide(LIST_ITEMS_KEY as string, items)\n\n return () => {\n const innerProps = { items: items.value, animation: props.animation }\n // https://vue-land.github.io/faq/forwarding-slots#passing-all-slots\n return slots.default?.(innerProps)[0] ?? h(ItemsList, innerProps, slots)\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;AAWA;;;;;;;;;;;;;AAaE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,aAAa,CAAC,IAAI;AAC3B,IAAA,KAAK,EAAE;;AAEL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;;AAGE;AACF,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;;QAGjB,MAAM,aAAY,GAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAM;;QAG/C,MAAM,mBAAkB,GAAI,QAAQ,CAAC,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AW,CAAA;gBACvB,OAAO,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,cAAc,cAAc,EAAE;AACpD,oBAAA,KAAK,EAAC;gBACR;AACA,gBAAA,MAAM,uBAAuB,SAAS,KAAK,CAAC,MAAK;gBACjD,IAAI,CAAC,oBAAmB,IAAK,CAAC,iBAAiB,CAAC,KAAK,EAAE;oBACrD;gBACF;gBACA,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAA;YAC7B;AACA,YAAA,OAAO,KAAI;AACb,QAAA,CAAC,CAAA;AAED;;;;;;AAME;AACF,QAAA,OAAO,CAAC,cAAwB,EAAE,KAAK,CAAA;AAEvC,QAAA,OAAO,MAAI;AACT,YAAA,MAAM,UAAS,GAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAQ,EAAE;;AAEpE,YAAA,OAAO,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA,IAAK,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAA;AACzE,QAAA,CAAA;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-components",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.12.0",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"vuex": "4.0.2"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@empathyco/x-adapter": "8.
|
|
71
|
-
"@empathyco/x-adapter-platform": "2.
|
|
72
|
-
"@empathyco/x-types": "11.
|
|
73
|
-
"@empathyco/x-utils": "1.
|
|
70
|
+
"@empathyco/x-adapter": "8.5.0",
|
|
71
|
+
"@empathyco/x-adapter-platform": "2.3.0",
|
|
72
|
+
"@empathyco/x-types": "11.3.0",
|
|
73
|
+
"@empathyco/x-utils": "1.4.0",
|
|
74
74
|
"@vue/devtools-api": "~6.6.4",
|
|
75
75
|
"@vueuse/core": "~12.8.2",
|
|
76
76
|
"js-md5": "~0.9.2",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@babel/preset-env": "8.0.7",
|
|
85
|
-
"@empathyco/x-design-system": "1.
|
|
85
|
+
"@empathyco/x-design-system": "1.5.0",
|
|
86
86
|
"@microsoft/api-documenter": "7.30.20",
|
|
87
87
|
"@microsoft/api-extractor": "7.60.1",
|
|
88
88
|
"@tailwindcss/vite": "4.3.5",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"access": "public",
|
|
118
118
|
"directory": "dist"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "4fec230caef3702924ebb2dbe80e4f8decb0b554"
|
|
121
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendor-banners-list.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/vendor/components/vendor-banners-list.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;;IAKC,2EAA2E;;;;;IAK3E;;;OAGG;;;;;;;;IARH,2EAA2E;;;;;IAK3E;;;OAGG;;;;;;;;;AAZP,
|
|
1
|
+
{"version":3,"file":"vendor-banners-list.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/vendor/components/vendor-banners-list.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;;IAKC,2EAA2E;;;;;IAK3E;;;OAGG;;;;;;;;IARH,2EAA2E;;;;;IAK3E;;;OAGG;;;;;;;;;AAZP,wBAgHE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendor-results-list.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/vendor/components/vendor-results-list.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;;IAKC,2EAA2E;;;;;IAK3E;;;OAGG;;;;;;;;IARH,2EAA2E;;;;;IAK3E;;;OAGG;;;;;;;;;AAZP,
|
|
1
|
+
{"version":3,"file":"vendor-results-list.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/vendor/components/vendor-results-list.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;;IAKC,2EAA2E;;;;;IAK3E;;;OAGG;;;;;;;;IARH,2EAA2E;;;;;IAK3E;;;OAGG;;;;;;;;;AAZP,wBA8GE"}
|