@getlupa/vue 0.24.2 → 0.24.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.
@@ -23692,11 +23692,14 @@ const getDynamicAttributes = (dynamicAttributes = [], document2 = {}) => {
23692
23692
  }
23693
23693
  return parsedAttributes;
23694
23694
  };
23695
- const getFieldValue = (doc, field = "") => {
23695
+ const getFieldValue = (doc, field = "", matchLiteral) => {
23696
23696
  var _a25;
23697
23697
  if (typeof field === "number") {
23698
23698
  return +field;
23699
23699
  }
23700
+ if (matchLiteral) {
23701
+ return field;
23702
+ }
23700
23703
  const value = (_a25 = field == null ? void 0 : field.split(".")) == null ? void 0 : _a25.reduce((obj, key) => obj ? obj[key] : void 0, doc);
23701
23704
  if (+value) {
23702
23705
  return +value;
@@ -23720,32 +23723,32 @@ const processDisplayCondition = (displayCondition, doc = {}) => {
23720
23723
  case "equals": {
23721
23724
  if (fields.length < 2) return false;
23722
23725
  const [field1, field2] = fields;
23723
- return getFieldValue(doc, field1) === getFieldValue(doc, field2);
23726
+ return getFieldValue(doc, field1) === getFieldValue(doc, field2, displayCondition.matchLiteral);
23724
23727
  }
23725
23728
  case "notEquals": {
23726
23729
  if (fields.length < 2) return false;
23727
23730
  const [field1, field2] = fields;
23728
- return getFieldValue(doc, field1) !== getFieldValue(doc, field2);
23731
+ return getFieldValue(doc, field1) !== getFieldValue(doc, field2, displayCondition.matchLiteral);
23729
23732
  }
23730
23733
  case "greaterThan": {
23731
23734
  if (fields.length < 2) return false;
23732
23735
  const [field1, field2] = fields;
23733
- return getFieldValue(doc, field1) > getFieldValue(doc, field2);
23736
+ return getFieldValue(doc, field1) > getFieldValue(doc, field2, displayCondition.matchLiteral);
23734
23737
  }
23735
23738
  case "lessThan": {
23736
23739
  if (fields.length < 2) return false;
23737
23740
  const [field1, field2] = fields;
23738
- return getFieldValue(doc, field1) < getFieldValue(doc, field2);
23741
+ return getFieldValue(doc, field1) < getFieldValue(doc, field2, displayCondition.matchLiteral);
23739
23742
  }
23740
23743
  case "greaterThanOrEquals": {
23741
23744
  if (fields.length < 2) return false;
23742
23745
  const [field1, field2] = fields;
23743
- return getFieldValue(doc, field1) >= getFieldValue(doc, field2);
23746
+ return getFieldValue(doc, field1) >= getFieldValue(doc, field2, displayCondition.matchLiteral);
23744
23747
  }
23745
23748
  case "lessThanOrEquals": {
23746
23749
  if (fields.length < 2) return false;
23747
23750
  const [field1, field2] = fields;
23748
- return getFieldValue(doc, field1) <= getFieldValue(doc, field2);
23751
+ return getFieldValue(doc, field1) <= getFieldValue(doc, field2, displayCondition.matchLiteral);
23749
23752
  }
23750
23753
  default:
23751
23754
  return false;
@@ -31833,9 +31836,6 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
31833
31836
  var _a25, _b25, _c;
31834
31837
  return ((_c = (_b25 = (_a25 = props.options.filters) == null ? void 0 : _a25.facets) == null ? void 0 : _b25.style) == null ? void 0 : _c.type) !== "sidebar";
31835
31838
  });
31836
- const showMobileFilters = vue.computed(() => {
31837
- return props.options.searchTitlePosition !== "search-results-top";
31838
- });
31839
31839
  const currentFilterToolbarVisible = vue.computed(() => {
31840
31840
  var _a25, _b25, _c, _d, _e, _f;
31841
31841
  return Boolean(
@@ -31934,15 +31934,14 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
31934
31934
  key: 0,
31935
31935
  options: (_a25 = _ctx.options.filters) != null ? _a25 : {}
31936
31936
  }, null, 8, ["options"])) : vue.createCommentVNode("", true),
31937
- showMobileFilters.value ? (vue.openBlock(), vue.createBlock(_sfc_main$H, {
31938
- key: 1,
31937
+ vue.createVNode(_sfc_main$H, {
31939
31938
  class: "lupa-toolbar-mobile",
31940
31939
  options: _ctx.options,
31941
31940
  "pagination-location": "top",
31942
31941
  onFilter: filter
31943
- }, null, 8, ["options"])) : vue.createCommentVNode("", true),
31942
+ }, null, 8, ["options"]),
31944
31943
  currentFilterOptions.value && currentFilterPositionDesktop.value === "pageTop" ? (vue.openBlock(), vue.createBlock(_sfc_main$14, {
31945
- key: 2,
31944
+ key: 1,
31946
31945
  class: vue.normalizeClass(currentFiltersClass.value),
31947
31946
  "data-cy": "lupa-search-result-filters-mobile-toolbar",
31948
31947
  options: currentFilterOptions.value,
@@ -32102,12 +32101,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
32102
32101
  options: categoryOptions.value
32103
32102
  }, null, 8, ["item", "options"]);
32104
32103
  }), 128))
32105
- ])) : vue.createCommentVNode("", true),
32106
- vue.createVNode(_sfc_main$H, {
32107
- class: "lupa-toolbar-mobile",
32108
- "pagination-location": "top",
32109
- options: _ctx.options
32110
- }, null, 8, ["options"])
32104
+ ])) : vue.createCommentVNode("", true)
32111
32105
  ])
32112
32106
  ], 2);
32113
32107
  };
@@ -23690,11 +23690,14 @@ const getDynamicAttributes = (dynamicAttributes = [], document2 = {}) => {
23690
23690
  }
23691
23691
  return parsedAttributes;
23692
23692
  };
23693
- const getFieldValue = (doc, field = "") => {
23693
+ const getFieldValue = (doc, field = "", matchLiteral) => {
23694
23694
  var _a25;
23695
23695
  if (typeof field === "number") {
23696
23696
  return +field;
23697
23697
  }
23698
+ if (matchLiteral) {
23699
+ return field;
23700
+ }
23698
23701
  const value = (_a25 = field == null ? void 0 : field.split(".")) == null ? void 0 : _a25.reduce((obj, key) => obj ? obj[key] : void 0, doc);
23699
23702
  if (+value) {
23700
23703
  return +value;
@@ -23718,32 +23721,32 @@ const processDisplayCondition = (displayCondition, doc = {}) => {
23718
23721
  case "equals": {
23719
23722
  if (fields.length < 2) return false;
23720
23723
  const [field1, field2] = fields;
23721
- return getFieldValue(doc, field1) === getFieldValue(doc, field2);
23724
+ return getFieldValue(doc, field1) === getFieldValue(doc, field2, displayCondition.matchLiteral);
23722
23725
  }
23723
23726
  case "notEquals": {
23724
23727
  if (fields.length < 2) return false;
23725
23728
  const [field1, field2] = fields;
23726
- return getFieldValue(doc, field1) !== getFieldValue(doc, field2);
23729
+ return getFieldValue(doc, field1) !== getFieldValue(doc, field2, displayCondition.matchLiteral);
23727
23730
  }
23728
23731
  case "greaterThan": {
23729
23732
  if (fields.length < 2) return false;
23730
23733
  const [field1, field2] = fields;
23731
- return getFieldValue(doc, field1) > getFieldValue(doc, field2);
23734
+ return getFieldValue(doc, field1) > getFieldValue(doc, field2, displayCondition.matchLiteral);
23732
23735
  }
23733
23736
  case "lessThan": {
23734
23737
  if (fields.length < 2) return false;
23735
23738
  const [field1, field2] = fields;
23736
- return getFieldValue(doc, field1) < getFieldValue(doc, field2);
23739
+ return getFieldValue(doc, field1) < getFieldValue(doc, field2, displayCondition.matchLiteral);
23737
23740
  }
23738
23741
  case "greaterThanOrEquals": {
23739
23742
  if (fields.length < 2) return false;
23740
23743
  const [field1, field2] = fields;
23741
- return getFieldValue(doc, field1) >= getFieldValue(doc, field2);
23744
+ return getFieldValue(doc, field1) >= getFieldValue(doc, field2, displayCondition.matchLiteral);
23742
23745
  }
23743
23746
  case "lessThanOrEquals": {
23744
23747
  if (fields.length < 2) return false;
23745
23748
  const [field1, field2] = fields;
23746
- return getFieldValue(doc, field1) <= getFieldValue(doc, field2);
23749
+ return getFieldValue(doc, field1) <= getFieldValue(doc, field2, displayCondition.matchLiteral);
23747
23750
  }
23748
23751
  default:
23749
23752
  return false;
@@ -31831,9 +31834,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
31831
31834
  var _a25, _b25, _c;
31832
31835
  return ((_c = (_b25 = (_a25 = props.options.filters) == null ? void 0 : _a25.facets) == null ? void 0 : _b25.style) == null ? void 0 : _c.type) !== "sidebar";
31833
31836
  });
31834
- const showMobileFilters = computed(() => {
31835
- return props.options.searchTitlePosition !== "search-results-top";
31836
- });
31837
31837
  const currentFilterToolbarVisible = computed(() => {
31838
31838
  var _a25, _b25, _c, _d, _e, _f;
31839
31839
  return Boolean(
@@ -31932,15 +31932,14 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
31932
31932
  key: 0,
31933
31933
  options: (_a25 = _ctx.options.filters) != null ? _a25 : {}
31934
31934
  }, null, 8, ["options"])) : createCommentVNode("", true),
31935
- showMobileFilters.value ? (openBlock(), createBlock(_sfc_main$H, {
31936
- key: 1,
31935
+ createVNode(_sfc_main$H, {
31937
31936
  class: "lupa-toolbar-mobile",
31938
31937
  options: _ctx.options,
31939
31938
  "pagination-location": "top",
31940
31939
  onFilter: filter
31941
- }, null, 8, ["options"])) : createCommentVNode("", true),
31940
+ }, null, 8, ["options"]),
31942
31941
  currentFilterOptions.value && currentFilterPositionDesktop.value === "pageTop" ? (openBlock(), createBlock(_sfc_main$14, {
31943
- key: 2,
31942
+ key: 1,
31944
31943
  class: normalizeClass(currentFiltersClass.value),
31945
31944
  "data-cy": "lupa-search-result-filters-mobile-toolbar",
31946
31945
  options: currentFilterOptions.value,
@@ -32100,12 +32099,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
32100
32099
  options: categoryOptions.value
32101
32100
  }, null, 8, ["item", "options"]);
32102
32101
  }), 128))
32103
- ])) : createCommentVNode("", true),
32104
- createVNode(_sfc_main$H, {
32105
- class: "lupa-toolbar-mobile",
32106
- "pagination-location": "top",
32107
- options: _ctx.options
32108
- }, null, 8, ["options"])
32102
+ ])) : createCommentVNode("", true)
32109
32103
  ])
32110
32104
  ], 2);
32111
32105
  };
@@ -14,6 +14,7 @@ export type DisplayOption<T = any> = DisplayCondition | DisplayCondition[] | ((d
14
14
  export type DisplayCondition = {
15
15
  condition: 'exists' | 'notExists' | 'equals' | 'notEquals' | 'greaterThan' | 'lessThan' | 'greaterThanOrEquals' | 'lessThanOrEquals';
16
16
  fields: (string | number)[];
17
+ matchLiteral?: boolean;
17
18
  };
18
19
  export type DynamicAttribute = {
19
20
  key: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.24.2",
3
+ "version": "0.24.3",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",