@abi-software/map-side-bar 2.4.0-isan-0 → 2.4.0-isan-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.
@@ -10265,18 +10265,28 @@ const rO = function(e = {}) {
10265
10265
  },
10266
10266
  methods: {
10267
10267
  onFlatmapClick: function(e) {
10268
- this.$emit("flatmap-clicked", e);
10268
+ this.emitPMRActionClick({
10269
+ type: "Flatmap",
10270
+ resource: e
10271
+ });
10269
10272
  },
10270
10273
  onSimulationClick: function(e) {
10274
+ this.emitPMRActionClick({
10275
+ type: "Simulation",
10276
+ resource: e
10277
+ });
10278
+ },
10279
+ emitPMRActionClick: function(e) {
10271
10280
  const t = {
10272
- title: this.entry.title,
10281
+ ...e,
10282
+ name: this.entry.title,
10273
10283
  description: this.entry.description,
10274
- resource: e
10284
+ apiLocation: this.envVars.API_LOCATION
10275
10285
  };
10276
- this.$emit("simulation-clicked", t);
10286
+ this.$emit("pmr-action-click", t);
10277
10287
  }
10278
10288
  }
10279
- }, uO = (e) => (Jr("data-v-ac7950b4"), e = e(), Zr(), e), cO = {
10289
+ }, uO = (e) => (Jr("data-v-9e96e46c"), e = e(), Zr(), e), cO = {
10280
10290
  class: "dataset-card-container",
10281
10291
  ref: "container"
10282
10292
  }, dO = {
@@ -10365,7 +10375,7 @@ function xO(e, t, n, r, o, a) {
10365
10375
  ], 512)
10366
10376
  ], 512);
10367
10377
  }
10368
- const D0 = /* @__PURE__ */ Rn(lO, [["render", xO], ["__scopeId", "data-v-ac7950b4"]]), kO = {
10378
+ const D0 = /* @__PURE__ */ Rn(lO, [["render", xO], ["__scopeId", "data-v-9e96e46c"]]), kO = {
10369
10379
  name: "BadgesGroup",
10370
10380
  components: { Button: rn },
10371
10381
  props: {
@@ -21009,7 +21019,7 @@ let s9 = function() {
21009
21019
  const r = this.createTermSQL(e);
21010
21020
  return n += r, t && t !== "" && (n += `and (t.pmr_text match '${t}')`), (!t || t === "") && (n += "and m.exposure is not null and score > 0.69"), n += " group by m.exposure", this.sqlPreOffset = n, n += " " + this.offsetText() + ";", console.log(n), n;
21011
21021
  }, this.convertTermsToIds = function(e) {
21012
- return e.map((t) => this.lookUpId(t));
21022
+ return e.filter((t) => this.lookUpId(t));
21013
21023
  }, this.labelSQL = function() {
21014
21024
  return "select entity, label from labels";
21015
21025
  }, this.countSQL = function(e) {
@@ -21028,7 +21038,7 @@ let s9 = function() {
21028
21038
  }, this.processFilters = function(e) {
21029
21039
  let t = [];
21030
21040
  return e.forEach((n) => {
21031
- n.label !== "Show all" && n.label !== "PMR" && t.push(n.facet);
21041
+ n.facet !== "Show all" && n.facet !== "PMR" && t.push(n.facet);
21032
21042
  }), t;
21033
21043
  }, this.pmrSearch = function(e = [], t = "") {
21034
21044
  let n = this.processFilters(e), r = this.convertTermsToIds(n);
@@ -21127,6 +21137,7 @@ var l9 = async function(e) {
21127
21137
  numberPerPage: 10,
21128
21138
  page: 1,
21129
21139
  pmrResultsOnlyFlag: !1,
21140
+ noPMRResultsFlag: !1,
21130
21141
  hasSearched: !1,
21131
21142
  contextCardEnabled: !1,
21132
21143
  pmrResults: [],
@@ -21160,6 +21171,13 @@ const c9 = {
21160
21171
  type: Object,
21161
21172
  default: () => u9
21162
21173
  },
21174
+ initFilters: {
21175
+ type: Object,
21176
+ default: {
21177
+ filter: [],
21178
+ searchInput: ""
21179
+ }
21180
+ },
21163
21181
  envVars: {
21164
21182
  type: Object,
21165
21183
  default: () => {
@@ -21169,6 +21187,7 @@ const c9 = {
21169
21187
  data: function() {
21170
21188
  return {
21171
21189
  ...this.entry,
21190
+ ...this.initFilters,
21172
21191
  bodyStyle: {
21173
21192
  flex: "1 1 auto",
21174
21193
  "flex-flow": "column",
@@ -21201,11 +21220,8 @@ const c9 = {
21201
21220
  hoverChanged: function(e) {
21202
21221
  this.$emit("hover-changed", e);
21203
21222
  },
21204
- onFlatmapClicked: function(e) {
21205
- this.$emit("flatmap-clicked", e);
21206
- },
21207
- onSimulationClicked: function(e) {
21208
- this.$emit("simulation-clicked", e);
21223
+ onPmrActionClick: function(e) {
21224
+ this.$emit("pmr-action-click", e);
21209
21225
  },
21210
21226
  // resetSearch: Resets the results, and page, and variable results ratio
21211
21227
  // Does not: reset filters, search input, or search history
@@ -21214,19 +21230,20 @@ const c9 = {
21214
21230
  },
21215
21231
  // openSearch: Resets the results, populates dataset cards and filters. Will use Algolia and SciCrunch data uness pmr mode is set
21216
21232
  openSearch: function(e, t = "", n = !0) {
21217
- n ? (this.resetSearch(), this.openAlgoliaSearch(e, t)) : this.searchAlgolia(e, t), this.openPMRSearch(e, t);
21233
+ this.updatePMROnlyFlag(e), n ? (this.resetSearch(), this.openFilterSearch(e, t)) : (this.searchAlgolia(e, t), this.openPMRSearch(e, t));
21218
21234
  },
21219
21235
  // openPMRSearch: Resets the results, populates dataset cards and filters with PMR data.
21220
21236
  openPMRSearch: function(e, t = "") {
21221
- this.flatmapQueries.updateOffset(this.calculatePMROffest()), this.flatmapQueries.updateLimit(this.PMRLimit(this.pmrResultsOnlyFlag)), this.flatmapQueries.pmrSearch(e, t).then((n) => {
21237
+ this.loadingCards = !0, this.flatmapQueries.updateOffset(this.calculatePMROffest()), this.flatmapQueries.updateLimit(this.PMRLimit(this.pmrResultsOnlyFlag)), this.flatmapQueries.pmrSearch(e, t).then((n) => {
21222
21238
  n.forEach((r) => {
21223
21239
  this.results.push(r);
21224
- }), this.pmrNumberOfHits = this.flatmapQueries.numberOfHits;
21240
+ }), this.pmrNumberOfHits = this.flatmapQueries.numberOfHits, this.loadingCards = !1;
21225
21241
  });
21226
21242
  },
21227
- // openAlgoliaSearch: Resets the results, populates dataset cards and filters with Algloia and SciCrunch data.
21228
- openAlgoliaSearch: function(e, t = "") {
21229
- this.searchInput = t, this.cascaderIsReady ? (this.filter = this.$refs.filtersRef.getHierarchicalValidatedFilters(e), e && e.length > 0 && this.filter && this.filter.length === 0 ? (this.$refs.filtersRef.checkShowAllBoxes(), this.resetSearch()) : this.filter && (this.searchAlgolia(this.filter, t), this.$refs.filtersRef.setCascader(this.filter))) : (this.filter = e, (!e || e.length == 0) && this.searchAlgolia(this.filter, t));
21243
+ // previously openAlgoliaSearch:
21244
+ // Resets the results, populates dataset cards and filters with Algloia and SciCrunch data.
21245
+ openFilterSearch: function(e, t = "") {
21246
+ this.searchInput = t, this.cascaderIsReady ? (this.filter = this.$refs.filtersRef.getHierarchicalValidatedFilters(e), e && e.length > 0 && this.filter && this.filter.length === 0 ? (this.$refs.filtersRef.checkShowAllBoxes(), this.resetSearch()) : this.filter && (this.pmrResultsOnlyFlag ? this.openPMRSearch(this.filter, t) : this.noPMRResultsFlag ? this.searchAlgolia(this.filter, t) : (this.searchAlgolia(this.filter, t), this.openPMRSearch(this.filter, t)), this.$refs.filtersRef.setCascader(this.filter))) : (this.filter = e, (!e || e.length == 0) && (this.pmrResultsOnlyFlag ? this.openPMRSearch(this.filter, t) : this.noPMRResultsFlag ? this.searchAlgolia(this.filter, t) : (this.searchAlgolia(this.filter, t), this.openPMRSearch(this.filter, t))));
21230
21247
  },
21231
21248
  addFilter: function(e) {
21232
21249
  this.cascaderIsReady ? (this.resetSearch(), e && this.$refs.filtersRef.addFilter(e) && this.$refs.filtersRef.initiateSearch()) : Array.isArray(this.filter) ? this.filter.push(e) : this.filter = [e];
@@ -21244,10 +21261,11 @@ const c9 = {
21244
21261
  ));
21245
21262
  },
21246
21263
  updatePMROnlyFlag: function(e) {
21247
- e.find((n) => n.facet === "PMR") ? this.pmrResultsOnlyFlag = !0 : this.pmrResultsOnlyFlag = !1;
21264
+ const t = e.filter((o) => o.facetPropPath === "item.types.name"), n = t.filter((o) => o.facet === "PMR"), r = t.filter((o) => o.facet === "Show all");
21265
+ this.pmrResultsOnlyFlag = !1, this.noPMRResultsFlag = !1, t.length === 1 && n.length === 1 && (this.pmrResultsOnlyFlag = !0), t.length > 0 && n.length === 0 && r.length === 0 && (this.noPMRResultsFlag = !0);
21248
21266
  },
21249
21267
  filterUpdate: function(e) {
21250
- this.filter = [...e], this.updatePMROnlyFlag(e), this.resetSearch(), this.searchAlgolia(e, this.searchInput), this.openPMRSearch(e, this.searchInput), this.$emit("search-changed", {
21268
+ this.filter = [...e], this.updatePMROnlyFlag(e), this.resetSearch(), this.pmrResultsOnlyFlag ? this.openPMRSearch(e, this.searchInput) : this.noPMRResultsFlag ? this.searchAlgolia(e, this.searchInput) : (this.searchAlgolia(e, this.searchInput), this.openPMRSearch(e, this.searchInput)), this.$emit("search-changed", {
21251
21269
  value: e,
21252
21270
  type: "filter-update"
21253
21271
  });
@@ -21439,11 +21457,10 @@ function h9(e, t, n, r, o, a) {
21439
21457
  class: "dataset-card",
21440
21458
  entry: h,
21441
21459
  envVars: n.envVars,
21442
- onFlatmapClicked: a.onFlatmapClicked,
21443
- onSimulationClicked: a.onSimulationClicked,
21460
+ onPmrActionClick: a.onPmrActionClick,
21444
21461
  onMouseenter: (y) => a.hoverChanged(h),
21445
21462
  onMouseleave: t[2] || (t[2] = (y) => a.hoverChanged(void 0))
21446
- }, null, 8, ["entry", "envVars", "onFlatmapClicked", "onSimulationClicked", "onMouseenter"])) : U("", !0)
21463
+ }, null, 8, ["entry", "envVars", "onPmrActionClick", "onMouseenter"])) : U("", !0)
21447
21464
  ]))), 128)),
21448
21465
  re(m, {
21449
21466
  class: "pagination",
@@ -21463,7 +21480,7 @@ function h9(e, t, n, r, o, a) {
21463
21480
  _: 1
21464
21481
  }, 8, ["body-style"]);
21465
21482
  }
21466
- const ug = /* @__PURE__ */ Rn(c9, [["render", h9], ["__scopeId", "data-v-e4828ef0"]]), v9 = {
21483
+ const ug = /* @__PURE__ */ Rn(c9, [["render", h9], ["__scopeId", "data-v-8d7169f1"]]), v9 = {
21467
21484
  name: "ExternalResourceCard",
21468
21485
  components: {
21469
21486
  Button: rn
@@ -21983,6 +22000,7 @@ const fg = /* @__PURE__ */ Rn(Y9, [["render", r$], ["__scopeId", "data-v-a569bcf
21983
22000
  data: function() {
21984
22001
  return {
21985
22002
  drawerOpen: !1,
22003
+ initFilters: { filter: [], searchInput: "" },
21986
22004
  availableAnatomyFacets: []
21987
22005
  };
21988
22006
  },
@@ -22023,7 +22041,7 @@ const fg = /* @__PURE__ */ Rn(Y9, [["render", r$], ["__scopeId", "data-v-a569bcf
22023
22041
  this.drawerOpen = !this.drawerOpen;
22024
22042
  },
22025
22043
  openSearch: function(e, t) {
22026
- this.drawerOpen = !0, this.$nextTick(() => {
22044
+ this.initFilters.filter = e, this.initFilters.searchInput = t, this.drawerOpen = !0, this.$nextTick(() => {
22027
22045
  this.getSearchTabRefById(1).openSearch(e, t);
22028
22046
  });
22029
22047
  },
@@ -22074,23 +22092,8 @@ const fg = /* @__PURE__ */ Rn(Y9, [["render", r$], ["__scopeId", "data-v-a569bcf
22074
22092
  setDrawerOpen: function(e = !0) {
22075
22093
  this.drawerOpen = e;
22076
22094
  },
22077
- onFlatmapClicked: function(e) {
22078
- const t = {
22079
- type: "Flatmap",
22080
- data: e
22081
- };
22082
- this.$emit("actionClick", t);
22083
- },
22084
- onSimulationClicked: function(e) {
22085
- const t = {
22086
- type: "Simulation",
22087
- title: "View simulation",
22088
- apiLocation: this.envVars.API_LOCATION,
22089
- name: e.title,
22090
- description: e.description,
22091
- resource: e.resource
22092
- };
22093
- this.$emit("actionClick", t);
22095
+ onPmrActionClick: function(e) {
22096
+ this.$emit("actionClick", e);
22094
22097
  },
22095
22098
  /**
22096
22099
  * @vuese
@@ -22192,13 +22195,13 @@ function l$(e, t, n, r, o, a) {
22192
22195
  class: "sidebar-content-container",
22193
22196
  contextCardEntry: v.contextCard,
22194
22197
  envVars: n.envVars,
22198
+ initFilters: e.initFilters,
22195
22199
  ref_for: !0,
22196
22200
  ref: "searchTab_" + v.id,
22197
- onFlatmapClicked: a.onFlatmapClicked,
22198
- onSimulationClicked: a.onSimulationClicked,
22201
+ onPmrActionClick: a.onPmrActionClick,
22199
22202
  onSearchChanged: (p) => a.searchChanged(v.id, p),
22200
22203
  onHoverChanged: t[2] || (t[2] = (p) => a.hoverChanged(p))
22201
- }, null, 8, ["contextCardEntry", "envVars", "onFlatmapClicked", "onSimulationClicked", "onSearchChanged"])), [
22204
+ }, null, 8, ["contextCardEntry", "envVars", "initFilters", "onPmrActionClick", "onSearchChanged"])), [
22202
22205
  [yt, v.id === n.activeTabId]
22203
22206
  ])
22204
22207
  ], 64))), 128))
@@ -22209,7 +22212,7 @@ function l$(e, t, n, r, o, a) {
22209
22212
  }, 8, ["modelValue"])
22210
22213
  ], 512);
22211
22214
  }
22212
- const f$ = /* @__PURE__ */ Rn(o$, [["render", l$], ["__scopeId", "data-v-40e10cd3"]]);
22215
+ const f$ = /* @__PURE__ */ Rn(o$, [["render", l$], ["__scopeId", "data-v-46d87ece"]]);
22213
22216
  export {
22214
22217
  f$ as SideBar
22215
22218
  };