@searchcraft/react-sdk 0.12.1 → 0.12.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/client/index.js +43 -23
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +259 -239
- package/dist/server/index.js.map +1 -1
- package/package.json +3 -3
package/dist/client/index.js
CHANGED
|
@@ -1468,31 +1468,46 @@ const Vs = (t, r) => {
|
|
|
1468
1468
|
return n;
|
|
1469
1469
|
};
|
|
1470
1470
|
return s(e, []);
|
|
1471
|
-
}, Gr = (t) => {
|
|
1472
|
-
const
|
|
1471
|
+
}, Gr = (t, r) => {
|
|
1472
|
+
const e = {
|
|
1473
1473
|
path: "/",
|
|
1474
1474
|
count: 0,
|
|
1475
1475
|
children: {}
|
|
1476
|
-
},
|
|
1477
|
-
if (
|
|
1478
|
-
for (const
|
|
1479
|
-
|
|
1476
|
+
}, s = [], a = (o) => {
|
|
1477
|
+
if (o.path !== "/" && s.push({ path: o.path, count: o.count }), o.children)
|
|
1478
|
+
for (const n of o.children)
|
|
1479
|
+
a(n);
|
|
1480
1480
|
};
|
|
1481
|
-
|
|
1482
|
-
for (const { path:
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1481
|
+
a(t);
|
|
1482
|
+
for (const { path: o, count: n } of s) {
|
|
1483
|
+
const h = o.split("/").filter(Boolean);
|
|
1484
|
+
if (r && r.length > 0) {
|
|
1485
|
+
let l = !1;
|
|
1486
|
+
for (const p of r)
|
|
1487
|
+
if (p.startsWith("/")) {
|
|
1488
|
+
if (o === p || o.startsWith(`${p}/`)) {
|
|
1489
|
+
l = !0;
|
|
1490
|
+
break;
|
|
1491
|
+
}
|
|
1492
|
+
} else if (h.includes(p)) {
|
|
1493
|
+
l = !0;
|
|
1494
|
+
break;
|
|
1495
|
+
}
|
|
1496
|
+
if (l)
|
|
1497
|
+
continue;
|
|
1498
|
+
}
|
|
1499
|
+
let u = e;
|
|
1500
|
+
for (const l of h) {
|
|
1501
|
+
const p = u.path === "/" ? `/${l}` : `${u.path}/${l}`;
|
|
1502
|
+
u.children[l] || (u.children[l] = {
|
|
1503
|
+
path: p,
|
|
1504
|
+
count: n,
|
|
1490
1505
|
children: {}
|
|
1491
|
-
}),
|
|
1506
|
+
}), u = u.children[l];
|
|
1492
1507
|
}
|
|
1493
|
-
|
|
1508
|
+
u.count = n;
|
|
1494
1509
|
}
|
|
1495
|
-
return
|
|
1510
|
+
return e;
|
|
1496
1511
|
}, So = /* @__PURE__ */ ee(class extends J {
|
|
1497
1512
|
constructor() {
|
|
1498
1513
|
super();
|
|
@@ -1504,6 +1519,10 @@ const Vs = (t, r) => {
|
|
|
1504
1519
|
* The name of the field where facets are applied.
|
|
1505
1520
|
*/
|
|
1506
1521
|
c(this, "fieldName", "");
|
|
1522
|
+
/**
|
|
1523
|
+
* Array of facet values to exclude from rendering.
|
|
1524
|
+
*/
|
|
1525
|
+
c(this, "exclude");
|
|
1507
1526
|
/**
|
|
1508
1527
|
* Emitted when the facets are updated.
|
|
1509
1528
|
*/
|
|
@@ -1559,7 +1578,7 @@ const Vs = (t, r) => {
|
|
|
1559
1578
|
path: "/",
|
|
1560
1579
|
count: 0,
|
|
1561
1580
|
children: o || []
|
|
1562
|
-
});
|
|
1581
|
+
}, this.exclude);
|
|
1563
1582
|
switch (s) {
|
|
1564
1583
|
case "SEARCH_TERM_EMPTY":
|
|
1565
1584
|
this.facetTreeCollectedFromSearchResponse = {
|
|
@@ -1579,7 +1598,7 @@ const Vs = (t, r) => {
|
|
|
1579
1598
|
path: "/",
|
|
1580
1599
|
count: 0,
|
|
1581
1600
|
children: w || []
|
|
1582
|
-
});
|
|
1601
|
+
}, this.exclude);
|
|
1583
1602
|
this.facetTreeCollectedFromSearchResponse = Vs(P, n);
|
|
1584
1603
|
} else
|
|
1585
1604
|
this.facetTreeCollectedFromSearchResponse = n;
|
|
@@ -1610,7 +1629,7 @@ const Vs = (t, r) => {
|
|
|
1610
1629
|
path: C
|
|
1611
1630
|
}));
|
|
1612
1631
|
}
|
|
1613
|
-
this.facetTreeFromFacetPathsNotInSearchResponse = Gr(h), this.renderedFacetTree = us(this.facetTreeFromFacetPathsNotInSearchResponse, this.facetTreeCollectedFromSearchResponse);
|
|
1632
|
+
this.facetTreeFromFacetPathsNotInSearchResponse = Gr(h, this.exclude), this.renderedFacetTree = us(this.facetTreeFromFacetPathsNotInSearchResponse, this.facetTreeCollectedFromSearchResponse);
|
|
1614
1633
|
}
|
|
1615
1634
|
handleStateUpdate(e) {
|
|
1616
1635
|
const s = { ...e }, a = typeof s.searchClientRequestProperties == "string" && s.searchTerm.trim() === "";
|
|
@@ -1676,6 +1695,7 @@ const Vs = (t, r) => {
|
|
|
1676
1695
|
}, [0, "searchcraft-facet-list", {
|
|
1677
1696
|
searchcraftId: [1, "searchcraft-id"],
|
|
1678
1697
|
fieldName: [1, "field-name"],
|
|
1698
|
+
exclude: [16],
|
|
1679
1699
|
selectedPaths: [32],
|
|
1680
1700
|
facetTreeCollectedFromSearchResponse: [32],
|
|
1681
1701
|
renderedFacetTree: [32]
|
|
@@ -2078,7 +2098,7 @@ const $a = /* @__PURE__ */ ee(class extends J {
|
|
|
2078
2098
|
}
|
|
2079
2099
|
case "facets": {
|
|
2080
2100
|
const s = e;
|
|
2081
|
-
return m("div", { class: "searchcraft-filter-panel-section" }, m("p", { class: "searchcraft-filter-panel-label" }, e.label), m("searchcraft-facet-list", { fieldName: s.fieldName, onFacetSelectionUpdated: (a) => {
|
|
2101
|
+
return m("div", { class: "searchcraft-filter-panel-section" }, m("p", { class: "searchcraft-filter-panel-label" }, e.label), m("searchcraft-facet-list", { fieldName: s.fieldName, exclude: s.options.exclude, onFacetSelectionUpdated: (a) => {
|
|
2082
2102
|
this.handleFacetSelectionUpdated(s.fieldName, a.detail.paths);
|
|
2083
2103
|
} }));
|
|
2084
2104
|
}
|
|
@@ -6942,7 +6962,7 @@ class cc {
|
|
|
6942
6962
|
}), (r = this.adClient) == null || r.onInputCleared();
|
|
6943
6963
|
}
|
|
6944
6964
|
}
|
|
6945
|
-
const lc = "@searchcraft/react-sdk", uc = "0.12.
|
|
6965
|
+
const lc = "@searchcraft/react-sdk", uc = "0.12.2", aa = {
|
|
6946
6966
|
name: lc,
|
|
6947
6967
|
version: uc
|
|
6948
6968
|
};
|