@getlupa/vue 0.22.2 → 0.22.3
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
CHANGED
|
@@ -25534,6 +25534,7 @@ const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadV
|
|
|
25534
25534
|
const searchBoxStore = useSearchBoxStore();
|
|
25535
25535
|
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
25536
25536
|
const emit = __emit;
|
|
25537
|
+
const isSearchEmpty = vue.computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
25537
25538
|
const displayResults = vue.computed(() => {
|
|
25538
25539
|
var _a25;
|
|
25539
25540
|
return ((_a25 = props.inputValue) == null ? void 0 : _a25.length) >= props.options.minInputLength;
|
|
@@ -25544,6 +25545,12 @@ const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadV
|
|
|
25544
25545
|
return Boolean(props.options.history) && ((_a25 = props.inputValue) == null ? void 0 : _a25.length) < 1 && props.options.minInputLength > 0;
|
|
25545
25546
|
}
|
|
25546
25547
|
);
|
|
25548
|
+
const displayShowMoreResultsButton = vue.computed(() => {
|
|
25549
|
+
if (isSearchEmpty.value && props.options.hideMoreResultsButtonOnEmptyQuery) {
|
|
25550
|
+
return false;
|
|
25551
|
+
}
|
|
25552
|
+
return hasAnyResults.value || !props.options.hideMoreResultsButtonOnNoResults;
|
|
25553
|
+
});
|
|
25547
25554
|
const displayPanels = vue.computed(
|
|
25548
25555
|
() => props.isSearchContainer ? panels.value.filter((p2) => p2.type === SearchBoxPanelType.SUGGESTION) : panels.value
|
|
25549
25556
|
);
|
|
@@ -25713,7 +25720,7 @@ const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadV
|
|
|
25713
25720
|
key: 1,
|
|
25714
25721
|
labels: labels.value
|
|
25715
25722
|
}, null, 8, ["labels"])) : vue.createCommentVNode("", true),
|
|
25716
|
-
|
|
25723
|
+
displayShowMoreResultsButton.value ? (vue.openBlock(), vue.createBlock(_sfc_main$1x, {
|
|
25717
25724
|
key: 2,
|
|
25718
25725
|
labels: labels.value,
|
|
25719
25726
|
options: _ctx.options,
|
|
@@ -25797,6 +25804,7 @@ const _sfc_main$13 = /* @__PURE__ */ vue.defineComponent({
|
|
|
25797
25804
|
"debounce",
|
|
25798
25805
|
"showTotalCount",
|
|
25799
25806
|
"hideMoreResultsButtonOnNoResults",
|
|
25807
|
+
"hideMoreResultsButtonOnEmptyQuery",
|
|
25800
25808
|
"showNoResultsPanel",
|
|
25801
25809
|
"expandOnSinglePanel",
|
|
25802
25810
|
"showMoreResultsButton"
|
|
@@ -27760,6 +27768,18 @@ var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide"
|
|
|
27760
27768
|
m.render = function(e2, t, r, i, n, o) {
|
|
27761
27769
|
return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(e2.sliderProps, { ref: "slider" }), null, 16);
|
|
27762
27770
|
}, m.__file = "src/Slider.vue";
|
|
27771
|
+
const roundToMaxDecimals = (value, maxPrecision = 0.1) => {
|
|
27772
|
+
if (value === void 0 || value === null || Number.isNaN(value)) return "";
|
|
27773
|
+
const log = Math.log10(maxPrecision);
|
|
27774
|
+
const decimals = log < 0 ? Math.round(-log) : 0;
|
|
27775
|
+
const factor = Math.pow(10, decimals);
|
|
27776
|
+
const rounded = Math.round((value + Number.EPSILON) * factor) / factor;
|
|
27777
|
+
let out = rounded.toFixed(decimals);
|
|
27778
|
+
if (Number.isInteger(value)) {
|
|
27779
|
+
out = Math.trunc(value).toString();
|
|
27780
|
+
}
|
|
27781
|
+
return out;
|
|
27782
|
+
};
|
|
27763
27783
|
const _hoisted_1$P = { class: "lupa-search-result-facet-stats-values" };
|
|
27764
27784
|
const _hoisted_2$B = {
|
|
27765
27785
|
key: 0,
|
|
@@ -27908,7 +27928,7 @@ const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
|
|
|
27908
27928
|
const originalSliderRange = vue.computed(() => {
|
|
27909
27929
|
return innerSliderRange.value.length === 2 && (currentFilters.value.gte || currentFilters.value.lte) ? [
|
|
27910
27930
|
Math.max(+currentFilters.value.gte, facetValue.value.min),
|
|
27911
|
-
Math.min(+currentFilters.value.lte, facetValue.value.max)
|
|
27931
|
+
Math.min(+(currentFilters.value.lt || currentFilters.value.lte), facetValue.value.max)
|
|
27912
27932
|
] : [facetValue.value.min, facetValue.value.max];
|
|
27913
27933
|
});
|
|
27914
27934
|
const fromValue = vue.computed({
|
|
@@ -27964,6 +27984,7 @@ const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
|
|
|
27964
27984
|
}
|
|
27965
27985
|
);
|
|
27966
27986
|
const statsSummary = vue.computed(() => {
|
|
27987
|
+
var _a25, _b25;
|
|
27967
27988
|
const [min, max] = originalSliderRange.value;
|
|
27968
27989
|
if (isPrice.value) {
|
|
27969
27990
|
return formatPriceSummary(
|
|
@@ -27974,10 +27995,12 @@ const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
|
|
|
27974
27995
|
multiCurrency.value
|
|
27975
27996
|
);
|
|
27976
27997
|
}
|
|
27998
|
+
const minValue = roundToMaxDecimals(min, (_a25 = customInterval.value) != null ? _a25 : 0.1);
|
|
27999
|
+
const maxValue = roundToMaxDecimals(max, (_b25 = customInterval.value) != null ? _b25 : 0.1);
|
|
27977
28000
|
if (unit.value) {
|
|
27978
|
-
return `${
|
|
28001
|
+
return `${minValue} ${unit.value} – ${maxValue} ${unit.value}`;
|
|
27979
28002
|
}
|
|
27980
|
-
return formatRange({ gte:
|
|
28003
|
+
return formatRange({ gte: minValue, lte: maxValue });
|
|
27981
28004
|
});
|
|
27982
28005
|
function handleInputChange() {
|
|
27983
28006
|
if (innerSliderRange.value.length < 2) return;
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -25532,6 +25532,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValue
|
|
|
25532
25532
|
const searchBoxStore = useSearchBoxStore();
|
|
25533
25533
|
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
25534
25534
|
const emit = __emit;
|
|
25535
|
+
const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
25535
25536
|
const displayResults = computed(() => {
|
|
25536
25537
|
var _a25;
|
|
25537
25538
|
return ((_a25 = props.inputValue) == null ? void 0 : _a25.length) >= props.options.minInputLength;
|
|
@@ -25542,6 +25543,12 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValue
|
|
|
25542
25543
|
return Boolean(props.options.history) && ((_a25 = props.inputValue) == null ? void 0 : _a25.length) < 1 && props.options.minInputLength > 0;
|
|
25543
25544
|
}
|
|
25544
25545
|
);
|
|
25546
|
+
const displayShowMoreResultsButton = computed(() => {
|
|
25547
|
+
if (isSearchEmpty.value && props.options.hideMoreResultsButtonOnEmptyQuery) {
|
|
25548
|
+
return false;
|
|
25549
|
+
}
|
|
25550
|
+
return hasAnyResults.value || !props.options.hideMoreResultsButtonOnNoResults;
|
|
25551
|
+
});
|
|
25545
25552
|
const displayPanels = computed(
|
|
25546
25553
|
() => props.isSearchContainer ? panels.value.filter((p2) => p2.type === SearchBoxPanelType.SUGGESTION) : panels.value
|
|
25547
25554
|
);
|
|
@@ -25711,7 +25718,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValue
|
|
|
25711
25718
|
key: 1,
|
|
25712
25719
|
labels: labels.value
|
|
25713
25720
|
}, null, 8, ["labels"])) : createCommentVNode("", true),
|
|
25714
|
-
|
|
25721
|
+
displayShowMoreResultsButton.value ? (openBlock(), createBlock(_sfc_main$1x, {
|
|
25715
25722
|
key: 2,
|
|
25716
25723
|
labels: labels.value,
|
|
25717
25724
|
options: _ctx.options,
|
|
@@ -25795,6 +25802,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
|
25795
25802
|
"debounce",
|
|
25796
25803
|
"showTotalCount",
|
|
25797
25804
|
"hideMoreResultsButtonOnNoResults",
|
|
25805
|
+
"hideMoreResultsButtonOnEmptyQuery",
|
|
25798
25806
|
"showNoResultsPanel",
|
|
25799
25807
|
"expandOnSinglePanel",
|
|
25800
25808
|
"showMoreResultsButton"
|
|
@@ -27758,6 +27766,18 @@ var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide"
|
|
|
27758
27766
|
m.render = function(e2, t, r, i, n, o) {
|
|
27759
27767
|
return openBlock(), createElementBlock("div", mergeProps(e2.sliderProps, { ref: "slider" }), null, 16);
|
|
27760
27768
|
}, m.__file = "src/Slider.vue";
|
|
27769
|
+
const roundToMaxDecimals = (value, maxPrecision = 0.1) => {
|
|
27770
|
+
if (value === void 0 || value === null || Number.isNaN(value)) return "";
|
|
27771
|
+
const log = Math.log10(maxPrecision);
|
|
27772
|
+
const decimals = log < 0 ? Math.round(-log) : 0;
|
|
27773
|
+
const factor = Math.pow(10, decimals);
|
|
27774
|
+
const rounded = Math.round((value + Number.EPSILON) * factor) / factor;
|
|
27775
|
+
let out = rounded.toFixed(decimals);
|
|
27776
|
+
if (Number.isInteger(value)) {
|
|
27777
|
+
out = Math.trunc(value).toString();
|
|
27778
|
+
}
|
|
27779
|
+
return out;
|
|
27780
|
+
};
|
|
27761
27781
|
const _hoisted_1$P = { class: "lupa-search-result-facet-stats-values" };
|
|
27762
27782
|
const _hoisted_2$B = {
|
|
27763
27783
|
key: 0,
|
|
@@ -27906,7 +27926,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
|
|
|
27906
27926
|
const originalSliderRange = computed(() => {
|
|
27907
27927
|
return innerSliderRange.value.length === 2 && (currentFilters.value.gte || currentFilters.value.lte) ? [
|
|
27908
27928
|
Math.max(+currentFilters.value.gte, facetValue.value.min),
|
|
27909
|
-
Math.min(+currentFilters.value.lte, facetValue.value.max)
|
|
27929
|
+
Math.min(+(currentFilters.value.lt || currentFilters.value.lte), facetValue.value.max)
|
|
27910
27930
|
] : [facetValue.value.min, facetValue.value.max];
|
|
27911
27931
|
});
|
|
27912
27932
|
const fromValue = computed({
|
|
@@ -27962,6 +27982,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
|
|
|
27962
27982
|
}
|
|
27963
27983
|
);
|
|
27964
27984
|
const statsSummary = computed(() => {
|
|
27985
|
+
var _a25, _b25;
|
|
27965
27986
|
const [min, max] = originalSliderRange.value;
|
|
27966
27987
|
if (isPrice.value) {
|
|
27967
27988
|
return formatPriceSummary(
|
|
@@ -27972,10 +27993,12 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
|
|
|
27972
27993
|
multiCurrency.value
|
|
27973
27994
|
);
|
|
27974
27995
|
}
|
|
27996
|
+
const minValue = roundToMaxDecimals(min, (_a25 = customInterval.value) != null ? _a25 : 0.1);
|
|
27997
|
+
const maxValue = roundToMaxDecimals(max, (_b25 = customInterval.value) != null ? _b25 : 0.1);
|
|
27975
27998
|
if (unit.value) {
|
|
27976
|
-
return `${
|
|
27999
|
+
return `${minValue} ${unit.value} – ${maxValue} ${unit.value}`;
|
|
27977
28000
|
}
|
|
27978
|
-
return formatRange({ gte:
|
|
28001
|
+
return formatRange({ gte: minValue, lte: maxValue });
|
|
27979
28002
|
});
|
|
27980
28003
|
function handleInputChange() {
|
|
27981
28004
|
if (innerSliderRange.value.length < 2) return;
|
|
@@ -98,6 +98,7 @@ export type SearchBoxPanelOptions = SearchBoxInputOptions & {
|
|
|
98
98
|
showTotalCount?: boolean;
|
|
99
99
|
showNoResultsPanel?: boolean;
|
|
100
100
|
hideMoreResultsButtonOnNoResults?: boolean;
|
|
101
|
+
hideMoreResultsButtonOnEmptyQuery?: boolean;
|
|
101
102
|
showMoreResultsButton?: boolean;
|
|
102
103
|
expandOnSinglePanel?: boolean;
|
|
103
104
|
forceFullReloadOnParams?: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const roundToMaxDecimals: (value?: number, maxPrecision?: number) => string;
|