@getlupa/vue 0.9.0 → 0.9.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.
@@ -4636,6 +4636,7 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
4636
4636
  setup(__props, { emit }) {
4637
4637
  const props = __props;
4638
4638
  const searchBoxStore = useSearchBoxStore();
4639
+ const mounted = vue.ref(false);
4639
4640
  const { docResults } = storeToRefs(searchBoxStore);
4640
4641
  const searchResult = vue.ref(null);
4641
4642
  const options = vue.computed(() => props.options);
@@ -4650,15 +4651,15 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
4650
4651
  const uniqueFieldValues = Array.from(new Set(allFieldValues));
4651
4652
  return uniqueFieldValues;
4652
4653
  });
4653
- const inputValueProp = vue.computed(() => props.inputValue);
4654
+ const relatedSourceIdsString = vue.computed(() => relatedSourceIds.value.join(","));
4654
4655
  vue.onMounted(() => {
4655
4656
  getItemsDebounced();
4657
+ mounted.value = true;
4656
4658
  });
4657
- vue.watch(relatedSourceIds, () => {
4658
- getItemsDebounced();
4659
- });
4660
- vue.watch(inputValueProp, () => {
4661
- getItemsDebounced();
4659
+ vue.watch(relatedSourceIdsString, () => {
4660
+ if (mounted) {
4661
+ getItemsDebounced();
4662
+ }
4662
4663
  });
4663
4664
  const fetchRelatedItems = () => __async(this, null, function* () {
4664
4665
  var _a, _b;
@@ -4854,6 +4855,17 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
4854
4855
  const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
4855
4856
  return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
4856
4857
  };
4858
+ const showPanelTitle = (panel) => {
4859
+ if (panel.type === SearchBoxPanelType.RELATED_SOURCE) {
4860
+ const panelCounts2 = panelItemCounts.value.find((v) => {
4861
+ var _a;
4862
+ return v.queryKey === ((_a = panel.sourceIds) == null ? void 0 : _a.queryKey);
4863
+ });
4864
+ return (panelCounts2 == null ? void 0 : panelCounts2.count) > 0 && canShowPanel(panel);
4865
+ }
4866
+ const panelCounts = panelItemCounts.value.find((v) => v.queryKey === panel.queryKey);
4867
+ return (panelCounts == null ? void 0 : panelCounts.count) > 0;
4868
+ };
4857
4869
  const canShowPanel = (panel) => {
4858
4870
  var _a, _b, _c;
4859
4871
  if (!((_a = panel.visibility) == null ? void 0 : _a.showWhenKeyHasNoResults)) {
@@ -4888,7 +4900,7 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
4888
4900
  "data-cy": "lupa-panel-" + panel.type + "-index"
4889
4901
  }, [
4890
4902
  ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$v, vue.toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : vue.createCommentVNode("", true),
4891
- ((_c = panel.labels) == null ? void 0 : _c.title) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$o, vue.toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : vue.createCommentVNode("", true),
4903
+ ((_c = panel.labels) == null ? void 0 : _c.title) && showPanelTitle(panel) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$o, vue.toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : vue.createCommentVNode("", true),
4892
4904
  panel.queryKey && canShowPanel(panel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getComponent(panel.type)), {
4893
4905
  key: 2,
4894
4906
  panel,
@@ -4634,6 +4634,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
4634
4634
  setup(__props, { emit }) {
4635
4635
  const props = __props;
4636
4636
  const searchBoxStore = useSearchBoxStore();
4637
+ const mounted = ref(false);
4637
4638
  const { docResults } = storeToRefs(searchBoxStore);
4638
4639
  const searchResult = ref(null);
4639
4640
  const options = computed(() => props.options);
@@ -4648,15 +4649,15 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
4648
4649
  const uniqueFieldValues = Array.from(new Set(allFieldValues));
4649
4650
  return uniqueFieldValues;
4650
4651
  });
4651
- const inputValueProp = computed(() => props.inputValue);
4652
+ const relatedSourceIdsString = computed(() => relatedSourceIds.value.join(","));
4652
4653
  onMounted(() => {
4653
4654
  getItemsDebounced();
4655
+ mounted.value = true;
4654
4656
  });
4655
- watch(relatedSourceIds, () => {
4656
- getItemsDebounced();
4657
- });
4658
- watch(inputValueProp, () => {
4659
- getItemsDebounced();
4657
+ watch(relatedSourceIdsString, () => {
4658
+ if (mounted) {
4659
+ getItemsDebounced();
4660
+ }
4660
4661
  });
4661
4662
  const fetchRelatedItems = () => __async(this, null, function* () {
4662
4663
  var _a, _b;
@@ -4852,6 +4853,17 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
4852
4853
  const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
4853
4854
  return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
4854
4855
  };
4856
+ const showPanelTitle = (panel) => {
4857
+ if (panel.type === SearchBoxPanelType.RELATED_SOURCE) {
4858
+ const panelCounts2 = panelItemCounts.value.find((v) => {
4859
+ var _a;
4860
+ return v.queryKey === ((_a = panel.sourceIds) == null ? void 0 : _a.queryKey);
4861
+ });
4862
+ return (panelCounts2 == null ? void 0 : panelCounts2.count) > 0 && canShowPanel(panel);
4863
+ }
4864
+ const panelCounts = panelItemCounts.value.find((v) => v.queryKey === panel.queryKey);
4865
+ return (panelCounts == null ? void 0 : panelCounts.count) > 0;
4866
+ };
4855
4867
  const canShowPanel = (panel) => {
4856
4868
  var _a, _b, _c;
4857
4869
  if (!((_a = panel.visibility) == null ? void 0 : _a.showWhenKeyHasNoResults)) {
@@ -4886,7 +4898,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
4886
4898
  "data-cy": "lupa-panel-" + panel.type + "-index"
4887
4899
  }, [
4888
4900
  ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$v, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
4889
- ((_c = panel.labels) == null ? void 0 : _c.title) ? (openBlock(), createElementBlock("div", _hoisted_4$o, toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
4901
+ ((_c = panel.labels) == null ? void 0 : _c.title) && showPanelTitle(panel) ? (openBlock(), createElementBlock("div", _hoisted_4$o, toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
4890
4902
  panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
4891
4903
  key: 2,
4892
4904
  panel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",