@getlupa/vue 0.17.0 → 0.17.2
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/dist/lupaSearch.js +73 -19
- package/dist/lupaSearch.mjs +73 -19
- package/dist/src/types/search-box/SearchBoxHistory.d.ts +1 -0
- package/dist/src/types/search-box/SearchBoxOptions.d.ts +2 -1
- package/dist/src/types/search-box/SearchBoxPanel.d.ts +1 -0
- package/dist/src/types/search-results/SearchResultsOptions.d.ts +2 -1
- package/dist/src/utils/filter.utils.d.ts +1 -0
- package/dist/src/utils/price.utils.d.ts +2 -2
- package/package.json +1 -1
package/dist/lupaSearch.js
CHANGED
|
@@ -2542,7 +2542,7 @@ const getAmount = (price, separator = ".") => {
|
|
|
2542
2542
|
}
|
|
2543
2543
|
return (_b = value.toFixed(2)) == null ? void 0 : _b.replace(".", separator);
|
|
2544
2544
|
};
|
|
2545
|
-
const formatPrice = (price, currency = "€", separator = ",") => {
|
|
2545
|
+
const formatPrice = (price, currency = "€", separator = ",", currencyTemplate = "") => {
|
|
2546
2546
|
if (price !== 0 && !price) {
|
|
2547
2547
|
return "";
|
|
2548
2548
|
}
|
|
@@ -2550,16 +2550,24 @@ const formatPrice = (price, currency = "€", separator = ",") => {
|
|
|
2550
2550
|
if (!amount) {
|
|
2551
2551
|
return "";
|
|
2552
2552
|
}
|
|
2553
|
+
if (currencyTemplate) {
|
|
2554
|
+
return addParamsToLabel(currencyTemplate, amount);
|
|
2555
|
+
}
|
|
2553
2556
|
return `${amount} ${currency}`;
|
|
2554
2557
|
};
|
|
2555
|
-
const formatPriceSummary = ([min, max], currency, separator = ",") => {
|
|
2558
|
+
const formatPriceSummary = ([min, max], currency, separator = ",", currencyTemplate = "") => {
|
|
2556
2559
|
if (min !== void 0 && max !== void 0) {
|
|
2557
|
-
return `${formatPrice(min, currency, separator)} - ${formatPrice(
|
|
2560
|
+
return `${formatPrice(min, currency, separator, currencyTemplate)} - ${formatPrice(
|
|
2561
|
+
max,
|
|
2562
|
+
currency,
|
|
2563
|
+
separator,
|
|
2564
|
+
currencyTemplate
|
|
2565
|
+
)}`;
|
|
2558
2566
|
}
|
|
2559
2567
|
if (min !== void 0) {
|
|
2560
|
-
return `> ${formatPrice(min, currency, separator)}`;
|
|
2568
|
+
return `> ${formatPrice(min, currency, separator, currencyTemplate)}`;
|
|
2561
2569
|
}
|
|
2562
|
-
return `< ${formatPrice(max, currency, separator)}`;
|
|
2570
|
+
return `< ${formatPrice(max, currency, separator, currencyTemplate)}`;
|
|
2563
2571
|
};
|
|
2564
2572
|
const formatRange = (filter2) => {
|
|
2565
2573
|
var _a, _b;
|
|
@@ -2589,7 +2597,12 @@ const unfoldRangeFilter = (key, filter2, price = {}) => {
|
|
|
2589
2597
|
return [
|
|
2590
2598
|
{
|
|
2591
2599
|
key,
|
|
2592
|
-
value: formatPriceSummary(
|
|
2600
|
+
value: formatPriceSummary(
|
|
2601
|
+
[gt, lt],
|
|
2602
|
+
price.currency,
|
|
2603
|
+
price.separator,
|
|
2604
|
+
price.currencyTemplate
|
|
2605
|
+
),
|
|
2593
2606
|
type: "range"
|
|
2594
2607
|
}
|
|
2595
2608
|
];
|
|
@@ -9195,6 +9208,7 @@ const _sfc_main$1s = /* @__PURE__ */ vue.defineComponent({
|
|
|
9195
9208
|
},
|
|
9196
9209
|
emits: ["go-to-results"],
|
|
9197
9210
|
setup(__props, { emit }) {
|
|
9211
|
+
const props = __props;
|
|
9198
9212
|
const historyStore = useHistoryStore();
|
|
9199
9213
|
const searchBoxStore = useSearchBoxStore();
|
|
9200
9214
|
const { highlightedIndex } = storeToRefs(searchBoxStore);
|
|
@@ -9210,6 +9224,14 @@ const _sfc_main$1s = /* @__PURE__ */ vue.defineComponent({
|
|
|
9210
9224
|
vue.onBeforeMount(() => {
|
|
9211
9225
|
window.removeEventListener("keydown", handleKeyDown);
|
|
9212
9226
|
});
|
|
9227
|
+
const historyLimit = vue.computed(() => {
|
|
9228
|
+
var _a;
|
|
9229
|
+
return (_a = props.options.historyLimit) != null ? _a : 5;
|
|
9230
|
+
});
|
|
9231
|
+
const limitedHistory = vue.computed(() => {
|
|
9232
|
+
var _a;
|
|
9233
|
+
return ((_a = history.value) != null ? _a : []).slice(0, historyLimit.value);
|
|
9234
|
+
});
|
|
9213
9235
|
const remove = ({ item }) => {
|
|
9214
9236
|
historyStore.remove({ item });
|
|
9215
9237
|
};
|
|
@@ -9230,7 +9252,7 @@ const _sfc_main$1s = /* @__PURE__ */ vue.defineComponent({
|
|
|
9230
9252
|
};
|
|
9231
9253
|
return (_ctx, _cache) => {
|
|
9232
9254
|
return hasHistory.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1g, [
|
|
9233
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
9255
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(limitedHistory.value, (item, index) => {
|
|
9234
9256
|
return vue.openBlock(), vue.createBlock(_sfc_main$1t, {
|
|
9235
9257
|
key: item,
|
|
9236
9258
|
item,
|
|
@@ -18837,11 +18859,12 @@ const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
|
|
|
18837
18859
|
setup(__props) {
|
|
18838
18860
|
const props = __props;
|
|
18839
18861
|
const price = vue.computed(() => {
|
|
18840
|
-
var _a, _b;
|
|
18862
|
+
var _a, _b, _c;
|
|
18841
18863
|
return formatPrice(
|
|
18842
18864
|
props.item[props.options.key],
|
|
18843
18865
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
18844
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
18866
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
18867
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
18845
18868
|
);
|
|
18846
18869
|
});
|
|
18847
18870
|
return (_ctx, _cache) => {
|
|
@@ -18864,11 +18887,12 @@ const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
|
|
|
18864
18887
|
return props.options.className;
|
|
18865
18888
|
});
|
|
18866
18889
|
const price = vue.computed(() => {
|
|
18867
|
-
var _a, _b;
|
|
18890
|
+
var _a, _b, _c;
|
|
18868
18891
|
return formatPrice(
|
|
18869
18892
|
props.item[props.options.key],
|
|
18870
18893
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
18871
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
18894
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
18895
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
18872
18896
|
);
|
|
18873
18897
|
});
|
|
18874
18898
|
return (_ctx, _cache) => {
|
|
@@ -19032,12 +19056,17 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
19032
19056
|
var _a, _b, _c;
|
|
19033
19057
|
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.priceSeparator) != null ? _c : "";
|
|
19034
19058
|
});
|
|
19059
|
+
const currencyTemplate = vue.computed(() => {
|
|
19060
|
+
var _a, _b, _c;
|
|
19061
|
+
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currencyTemplate) != null ? _c : "";
|
|
19062
|
+
});
|
|
19035
19063
|
const labeledFilters = vue.computed(
|
|
19036
19064
|
() => getLabeledFilters(
|
|
19037
19065
|
unfoldFilters(filters.value, {
|
|
19038
19066
|
keys: priceKeys.value,
|
|
19039
19067
|
currency: currency.value,
|
|
19040
|
-
separator: priceSeparator.value
|
|
19068
|
+
separator: priceSeparator.value,
|
|
19069
|
+
currencyTemplate: currencyTemplate.value
|
|
19041
19070
|
}),
|
|
19042
19071
|
facets2.value
|
|
19043
19072
|
)
|
|
@@ -19585,11 +19614,12 @@ const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
|
|
|
19585
19614
|
return 0;
|
|
19586
19615
|
});
|
|
19587
19616
|
const discountStringValue = vue.computed(() => {
|
|
19588
|
-
var _a, _b, _c, _d;
|
|
19617
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19589
19618
|
return props.badge.discountType === "percentage" ? discountValue.value.toFixed(0) : formatPrice(
|
|
19590
19619
|
discountValue.value,
|
|
19591
19620
|
(_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currency,
|
|
19592
|
-
(_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator
|
|
19621
|
+
(_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator,
|
|
19622
|
+
(_f = (_e = searchResultOptions.value) == null ? void 0 : _e.labels) == null ? void 0 : _f.currencyTemplate
|
|
19593
19623
|
);
|
|
19594
19624
|
});
|
|
19595
19625
|
const hasDiscount = vue.computed(() => {
|
|
@@ -19977,6 +20007,9 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
|
|
|
19977
20007
|
}
|
|
19978
20008
|
emit("product-click");
|
|
19979
20009
|
handleRoutingEvent(link, event, boxRoutingBehavior.value === "event");
|
|
20010
|
+
if (props.panelOptions.programmaticNavigation) {
|
|
20011
|
+
window.location.assign(link);
|
|
20012
|
+
}
|
|
19980
20013
|
};
|
|
19981
20014
|
return (_ctx, _cache) => {
|
|
19982
20015
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$Z, [
|
|
@@ -20597,6 +20630,7 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20597
20630
|
const suggestedValue = vue.ref(defaultSuggestedValue);
|
|
20598
20631
|
const opened = vue.ref(props.isSearchContainer);
|
|
20599
20632
|
const focused = vue.ref(false);
|
|
20633
|
+
const openedAt = vue.ref(null);
|
|
20600
20634
|
const searchBoxInput = vue.ref(null);
|
|
20601
20635
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
20602
20636
|
const searchValue = vue.computed(() => {
|
|
@@ -20656,6 +20690,9 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20656
20690
|
const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
|
|
20657
20691
|
const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
|
|
20658
20692
|
const isOutsideElement = el && !el.contains(e2.target) && !hasLupaClass;
|
|
20693
|
+
if (openedAt.value && Date.now() - (openedAt == null ? void 0 : openedAt.value) < 500) {
|
|
20694
|
+
return;
|
|
20695
|
+
}
|
|
20659
20696
|
if (isOutsideElement && props.options.keepOpen) {
|
|
20660
20697
|
focused.value = false;
|
|
20661
20698
|
}
|
|
@@ -20687,6 +20724,10 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20687
20724
|
handleSearch();
|
|
20688
20725
|
resetValues();
|
|
20689
20726
|
break;
|
|
20727
|
+
case "Escape":
|
|
20728
|
+
opened.value = false;
|
|
20729
|
+
focused.value = false;
|
|
20730
|
+
break;
|
|
20690
20731
|
}
|
|
20691
20732
|
};
|
|
20692
20733
|
const handleInput = (value) => {
|
|
@@ -20828,6 +20869,13 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20828
20869
|
});
|
|
20829
20870
|
};
|
|
20830
20871
|
vue.watch(() => props.options.debounce, handleCurrentValueSearch);
|
|
20872
|
+
vue.watch(opened, () => {
|
|
20873
|
+
if (opened.value) {
|
|
20874
|
+
openedAt.value = Date.now();
|
|
20875
|
+
} else {
|
|
20876
|
+
openedAt.value = null;
|
|
20877
|
+
}
|
|
20878
|
+
});
|
|
20831
20879
|
const resetValues = () => {
|
|
20832
20880
|
inputValue.value = "";
|
|
20833
20881
|
suggestedValue.value = defaultSuggestedValue;
|
|
@@ -22626,6 +22674,10 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
|
|
|
22626
22674
|
var _a;
|
|
22627
22675
|
return (_a = searchResultOptions.value) == null ? void 0 : _a.labels.currency;
|
|
22628
22676
|
});
|
|
22677
|
+
const currencyTemplate = vue.computed(() => {
|
|
22678
|
+
var _a;
|
|
22679
|
+
return (_a = searchResultOptions.value) == null ? void 0 : _a.labels.currencyTemplate;
|
|
22680
|
+
});
|
|
22629
22681
|
const priceKeys = vue.computed(() => {
|
|
22630
22682
|
var _a, _b;
|
|
22631
22683
|
return (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.priceKeys) != null ? _b : [];
|
|
@@ -22708,7 +22760,7 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
|
|
|
22708
22760
|
});
|
|
22709
22761
|
const statsSummary = vue.computed(() => {
|
|
22710
22762
|
const [min, max] = sliderRange.value;
|
|
22711
|
-
return isPrice.value ? formatPriceSummary([min, max], currency.value, separator.value) : formatRange({ gte: min, lte: max });
|
|
22763
|
+
return isPrice.value ? formatPriceSummary([min, max], currency.value, separator.value, currencyTemplate.value) : formatRange({ gte: min, lte: max });
|
|
22712
22764
|
});
|
|
22713
22765
|
const separator = vue.computed(() => {
|
|
22714
22766
|
var _a, _b, _c;
|
|
@@ -24361,11 +24413,12 @@ const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
|
|
|
24361
24413
|
setup(__props) {
|
|
24362
24414
|
const props = __props;
|
|
24363
24415
|
const price = vue.computed(() => {
|
|
24364
|
-
var _a, _b;
|
|
24416
|
+
var _a, _b, _c;
|
|
24365
24417
|
return formatPrice(
|
|
24366
24418
|
props.item[props.options.key],
|
|
24367
24419
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
24368
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
24420
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
24421
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
24369
24422
|
);
|
|
24370
24423
|
});
|
|
24371
24424
|
return (_ctx, _cache) => {
|
|
@@ -24386,11 +24439,12 @@ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
|
24386
24439
|
return props.options.className;
|
|
24387
24440
|
});
|
|
24388
24441
|
const price = vue.computed(() => {
|
|
24389
|
-
var _a, _b;
|
|
24442
|
+
var _a, _b, _c;
|
|
24390
24443
|
return formatPrice(
|
|
24391
24444
|
props.item[props.options.key],
|
|
24392
24445
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
24393
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
24446
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
24447
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
24394
24448
|
);
|
|
24395
24449
|
});
|
|
24396
24450
|
return (_ctx, _cache) => {
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -2540,7 +2540,7 @@ const getAmount = (price, separator = ".") => {
|
|
|
2540
2540
|
}
|
|
2541
2541
|
return (_b = value.toFixed(2)) == null ? void 0 : _b.replace(".", separator);
|
|
2542
2542
|
};
|
|
2543
|
-
const formatPrice = (price, currency = "€", separator = ",") => {
|
|
2543
|
+
const formatPrice = (price, currency = "€", separator = ",", currencyTemplate = "") => {
|
|
2544
2544
|
if (price !== 0 && !price) {
|
|
2545
2545
|
return "";
|
|
2546
2546
|
}
|
|
@@ -2548,16 +2548,24 @@ const formatPrice = (price, currency = "€", separator = ",") => {
|
|
|
2548
2548
|
if (!amount) {
|
|
2549
2549
|
return "";
|
|
2550
2550
|
}
|
|
2551
|
+
if (currencyTemplate) {
|
|
2552
|
+
return addParamsToLabel(currencyTemplate, amount);
|
|
2553
|
+
}
|
|
2551
2554
|
return `${amount} ${currency}`;
|
|
2552
2555
|
};
|
|
2553
|
-
const formatPriceSummary = ([min, max], currency, separator = ",") => {
|
|
2556
|
+
const formatPriceSummary = ([min, max], currency, separator = ",", currencyTemplate = "") => {
|
|
2554
2557
|
if (min !== void 0 && max !== void 0) {
|
|
2555
|
-
return `${formatPrice(min, currency, separator)} - ${formatPrice(
|
|
2558
|
+
return `${formatPrice(min, currency, separator, currencyTemplate)} - ${formatPrice(
|
|
2559
|
+
max,
|
|
2560
|
+
currency,
|
|
2561
|
+
separator,
|
|
2562
|
+
currencyTemplate
|
|
2563
|
+
)}`;
|
|
2556
2564
|
}
|
|
2557
2565
|
if (min !== void 0) {
|
|
2558
|
-
return `> ${formatPrice(min, currency, separator)}`;
|
|
2566
|
+
return `> ${formatPrice(min, currency, separator, currencyTemplate)}`;
|
|
2559
2567
|
}
|
|
2560
|
-
return `< ${formatPrice(max, currency, separator)}`;
|
|
2568
|
+
return `< ${formatPrice(max, currency, separator, currencyTemplate)}`;
|
|
2561
2569
|
};
|
|
2562
2570
|
const formatRange = (filter2) => {
|
|
2563
2571
|
var _a, _b;
|
|
@@ -2587,7 +2595,12 @@ const unfoldRangeFilter = (key, filter2, price = {}) => {
|
|
|
2587
2595
|
return [
|
|
2588
2596
|
{
|
|
2589
2597
|
key,
|
|
2590
|
-
value: formatPriceSummary(
|
|
2598
|
+
value: formatPriceSummary(
|
|
2599
|
+
[gt, lt],
|
|
2600
|
+
price.currency,
|
|
2601
|
+
price.separator,
|
|
2602
|
+
price.currencyTemplate
|
|
2603
|
+
),
|
|
2591
2604
|
type: "range"
|
|
2592
2605
|
}
|
|
2593
2606
|
];
|
|
@@ -9193,6 +9206,7 @@ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
|
|
|
9193
9206
|
},
|
|
9194
9207
|
emits: ["go-to-results"],
|
|
9195
9208
|
setup(__props, { emit }) {
|
|
9209
|
+
const props = __props;
|
|
9196
9210
|
const historyStore = useHistoryStore();
|
|
9197
9211
|
const searchBoxStore = useSearchBoxStore();
|
|
9198
9212
|
const { highlightedIndex } = storeToRefs(searchBoxStore);
|
|
@@ -9208,6 +9222,14 @@ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
|
|
|
9208
9222
|
onBeforeMount(() => {
|
|
9209
9223
|
window.removeEventListener("keydown", handleKeyDown);
|
|
9210
9224
|
});
|
|
9225
|
+
const historyLimit = computed(() => {
|
|
9226
|
+
var _a;
|
|
9227
|
+
return (_a = props.options.historyLimit) != null ? _a : 5;
|
|
9228
|
+
});
|
|
9229
|
+
const limitedHistory = computed(() => {
|
|
9230
|
+
var _a;
|
|
9231
|
+
return ((_a = history.value) != null ? _a : []).slice(0, historyLimit.value);
|
|
9232
|
+
});
|
|
9211
9233
|
const remove = ({ item }) => {
|
|
9212
9234
|
historyStore.remove({ item });
|
|
9213
9235
|
};
|
|
@@ -9228,7 +9250,7 @@ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
|
|
|
9228
9250
|
};
|
|
9229
9251
|
return (_ctx, _cache) => {
|
|
9230
9252
|
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1g, [
|
|
9231
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
9253
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(limitedHistory.value, (item, index) => {
|
|
9232
9254
|
return openBlock(), createBlock(_sfc_main$1t, {
|
|
9233
9255
|
key: item,
|
|
9234
9256
|
item,
|
|
@@ -18835,11 +18857,12 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
|
18835
18857
|
setup(__props) {
|
|
18836
18858
|
const props = __props;
|
|
18837
18859
|
const price = computed(() => {
|
|
18838
|
-
var _a, _b;
|
|
18860
|
+
var _a, _b, _c;
|
|
18839
18861
|
return formatPrice(
|
|
18840
18862
|
props.item[props.options.key],
|
|
18841
18863
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
18842
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
18864
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
18865
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
18843
18866
|
);
|
|
18844
18867
|
});
|
|
18845
18868
|
return (_ctx, _cache) => {
|
|
@@ -18862,11 +18885,12 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
18862
18885
|
return props.options.className;
|
|
18863
18886
|
});
|
|
18864
18887
|
const price = computed(() => {
|
|
18865
|
-
var _a, _b;
|
|
18888
|
+
var _a, _b, _c;
|
|
18866
18889
|
return formatPrice(
|
|
18867
18890
|
props.item[props.options.key],
|
|
18868
18891
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
18869
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
18892
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
18893
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
18870
18894
|
);
|
|
18871
18895
|
});
|
|
18872
18896
|
return (_ctx, _cache) => {
|
|
@@ -19030,12 +19054,17 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
19030
19054
|
var _a, _b, _c;
|
|
19031
19055
|
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.priceSeparator) != null ? _c : "";
|
|
19032
19056
|
});
|
|
19057
|
+
const currencyTemplate = computed(() => {
|
|
19058
|
+
var _a, _b, _c;
|
|
19059
|
+
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currencyTemplate) != null ? _c : "";
|
|
19060
|
+
});
|
|
19033
19061
|
const labeledFilters = computed(
|
|
19034
19062
|
() => getLabeledFilters(
|
|
19035
19063
|
unfoldFilters(filters.value, {
|
|
19036
19064
|
keys: priceKeys.value,
|
|
19037
19065
|
currency: currency.value,
|
|
19038
|
-
separator: priceSeparator.value
|
|
19066
|
+
separator: priceSeparator.value,
|
|
19067
|
+
currencyTemplate: currencyTemplate.value
|
|
19039
19068
|
}),
|
|
19040
19069
|
facets2.value
|
|
19041
19070
|
)
|
|
@@ -19583,11 +19612,12 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
19583
19612
|
return 0;
|
|
19584
19613
|
});
|
|
19585
19614
|
const discountStringValue = computed(() => {
|
|
19586
|
-
var _a, _b, _c, _d;
|
|
19615
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19587
19616
|
return props.badge.discountType === "percentage" ? discountValue.value.toFixed(0) : formatPrice(
|
|
19588
19617
|
discountValue.value,
|
|
19589
19618
|
(_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currency,
|
|
19590
|
-
(_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator
|
|
19619
|
+
(_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator,
|
|
19620
|
+
(_f = (_e = searchResultOptions.value) == null ? void 0 : _e.labels) == null ? void 0 : _f.currencyTemplate
|
|
19591
19621
|
);
|
|
19592
19622
|
});
|
|
19593
19623
|
const hasDiscount = computed(() => {
|
|
@@ -19975,6 +20005,9 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
19975
20005
|
}
|
|
19976
20006
|
emit("product-click");
|
|
19977
20007
|
handleRoutingEvent(link, event, boxRoutingBehavior.value === "event");
|
|
20008
|
+
if (props.panelOptions.programmaticNavigation) {
|
|
20009
|
+
window.location.assign(link);
|
|
20010
|
+
}
|
|
19978
20011
|
};
|
|
19979
20012
|
return (_ctx, _cache) => {
|
|
19980
20013
|
return openBlock(), createElementBlock("div", _hoisted_1$Z, [
|
|
@@ -20595,6 +20628,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
20595
20628
|
const suggestedValue = ref(defaultSuggestedValue);
|
|
20596
20629
|
const opened = ref(props.isSearchContainer);
|
|
20597
20630
|
const focused = ref(false);
|
|
20631
|
+
const openedAt = ref(null);
|
|
20598
20632
|
const searchBoxInput = ref(null);
|
|
20599
20633
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
20600
20634
|
const searchValue = computed(() => {
|
|
@@ -20654,6 +20688,9 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
20654
20688
|
const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
|
|
20655
20689
|
const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
|
|
20656
20690
|
const isOutsideElement = el && !el.contains(e2.target) && !hasLupaClass;
|
|
20691
|
+
if (openedAt.value && Date.now() - (openedAt == null ? void 0 : openedAt.value) < 500) {
|
|
20692
|
+
return;
|
|
20693
|
+
}
|
|
20657
20694
|
if (isOutsideElement && props.options.keepOpen) {
|
|
20658
20695
|
focused.value = false;
|
|
20659
20696
|
}
|
|
@@ -20685,6 +20722,10 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
20685
20722
|
handleSearch();
|
|
20686
20723
|
resetValues();
|
|
20687
20724
|
break;
|
|
20725
|
+
case "Escape":
|
|
20726
|
+
opened.value = false;
|
|
20727
|
+
focused.value = false;
|
|
20728
|
+
break;
|
|
20688
20729
|
}
|
|
20689
20730
|
};
|
|
20690
20731
|
const handleInput = (value) => {
|
|
@@ -20826,6 +20867,13 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
20826
20867
|
});
|
|
20827
20868
|
};
|
|
20828
20869
|
watch(() => props.options.debounce, handleCurrentValueSearch);
|
|
20870
|
+
watch(opened, () => {
|
|
20871
|
+
if (opened.value) {
|
|
20872
|
+
openedAt.value = Date.now();
|
|
20873
|
+
} else {
|
|
20874
|
+
openedAt.value = null;
|
|
20875
|
+
}
|
|
20876
|
+
});
|
|
20829
20877
|
const resetValues = () => {
|
|
20830
20878
|
inputValue.value = "";
|
|
20831
20879
|
suggestedValue.value = defaultSuggestedValue;
|
|
@@ -22624,6 +22672,10 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
22624
22672
|
var _a;
|
|
22625
22673
|
return (_a = searchResultOptions.value) == null ? void 0 : _a.labels.currency;
|
|
22626
22674
|
});
|
|
22675
|
+
const currencyTemplate = computed(() => {
|
|
22676
|
+
var _a;
|
|
22677
|
+
return (_a = searchResultOptions.value) == null ? void 0 : _a.labels.currencyTemplate;
|
|
22678
|
+
});
|
|
22627
22679
|
const priceKeys = computed(() => {
|
|
22628
22680
|
var _a, _b;
|
|
22629
22681
|
return (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.priceKeys) != null ? _b : [];
|
|
@@ -22706,7 +22758,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
22706
22758
|
});
|
|
22707
22759
|
const statsSummary = computed(() => {
|
|
22708
22760
|
const [min, max] = sliderRange.value;
|
|
22709
|
-
return isPrice.value ? formatPriceSummary([min, max], currency.value, separator.value) : formatRange({ gte: min, lte: max });
|
|
22761
|
+
return isPrice.value ? formatPriceSummary([min, max], currency.value, separator.value, currencyTemplate.value) : formatRange({ gte: min, lte: max });
|
|
22710
22762
|
});
|
|
22711
22763
|
const separator = computed(() => {
|
|
22712
22764
|
var _a, _b, _c;
|
|
@@ -24359,11 +24411,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
24359
24411
|
setup(__props) {
|
|
24360
24412
|
const props = __props;
|
|
24361
24413
|
const price = computed(() => {
|
|
24362
|
-
var _a, _b;
|
|
24414
|
+
var _a, _b, _c;
|
|
24363
24415
|
return formatPrice(
|
|
24364
24416
|
props.item[props.options.key],
|
|
24365
24417
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
24366
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
24418
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
24419
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
24367
24420
|
);
|
|
24368
24421
|
});
|
|
24369
24422
|
return (_ctx, _cache) => {
|
|
@@ -24384,11 +24437,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
24384
24437
|
return props.options.className;
|
|
24385
24438
|
});
|
|
24386
24439
|
const price = computed(() => {
|
|
24387
|
-
var _a, _b;
|
|
24440
|
+
var _a, _b, _c;
|
|
24388
24441
|
return formatPrice(
|
|
24389
24442
|
props.item[props.options.key],
|
|
24390
24443
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
24391
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
24444
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
24445
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
24392
24446
|
);
|
|
24393
24447
|
});
|
|
24394
24448
|
return (_ctx, _cache) => {
|
|
@@ -22,7 +22,8 @@ export type SearchBoxOptionLabels = {
|
|
|
22
22
|
placeholder: string;
|
|
23
23
|
noResults: string;
|
|
24
24
|
moreResults: string;
|
|
25
|
-
currency
|
|
25
|
+
currency?: string;
|
|
26
|
+
currencyTemplate?: string;
|
|
26
27
|
priceSeparator?: string;
|
|
27
28
|
defaultFacetLabel?: string;
|
|
28
29
|
close?: string;
|
|
@@ -38,6 +38,7 @@ export type DocumentSearchBoxPanel = SearchBoxPanelBase & {
|
|
|
38
38
|
badges?: SearchBoxBadgeOptions;
|
|
39
39
|
showGoToResults?: boolean;
|
|
40
40
|
isInStock?: DisplayCondition | ((doc: Document) => boolean);
|
|
41
|
+
programmaticNavigation?: boolean;
|
|
41
42
|
customDocumentHtmlAttributes?: CustomDocumentHtmlAttributes;
|
|
42
43
|
};
|
|
43
44
|
export type RelatedSourcePanel = Omit<DocumentSearchBoxPanel, 'type'> & {
|
|
@@ -67,7 +67,8 @@ export type SearchResultEventCallbacks = {
|
|
|
67
67
|
};
|
|
68
68
|
export type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchResultsDidYouMeanLabels & SearchResultsSimilarQueriesLabels & SearchResultsSimilarResultsLabels & {
|
|
69
69
|
sortBy: string;
|
|
70
|
-
currency
|
|
70
|
+
currency?: string;
|
|
71
|
+
currencyTemplate?: string;
|
|
71
72
|
priceSeparator?: string;
|
|
72
73
|
searchResults?: string;
|
|
73
74
|
searchResultsCount?: string;
|
|
@@ -5,6 +5,7 @@ export declare const unfoldFilters: (filters?: FilterGroup, price?: {
|
|
|
5
5
|
keys?: string[];
|
|
6
6
|
currency?: string;
|
|
7
7
|
separator?: string;
|
|
8
|
+
currencyTemplate?: string;
|
|
8
9
|
}) => UnfoldedFilter[];
|
|
9
10
|
export declare const getLabeledFilters: (filters: UnfoldedFilter[], facets?: FacetResult[]) => LabeledFilter[];
|
|
10
11
|
export declare const isFacetKey: (key: string) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const formatPrice: (price?: string | number, currency?: string, separator?: string) => string;
|
|
2
|
-
export declare const formatPriceSummary: ([min, max]: [min?: string | number, max?: string | number], currency?: string, separator?: string) => string;
|
|
1
|
+
export declare const formatPrice: (price?: string | number, currency?: string, separator?: string, currencyTemplate?: string) => string;
|
|
2
|
+
export declare const formatPriceSummary: ([min, max]: [min?: string | number, max?: string | number], currency?: string, separator?: string, currencyTemplate?: string) => string;
|