@fluid-topics/ft-wc-utils 1.1.74 → 1.1.76
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.
|
@@ -18,7 +18,8 @@ export declare class ClusteringHelper {
|
|
|
18
18
|
constructor(allResults: Array<FtSearchResultClusterEntry>, selectedResult: FtSearchResultClusterEntry, clusteringMetadata: Set<string>, metadataDescriptors: Array<FtMetadataDescriptor>);
|
|
19
19
|
static extractResultMetadata(result: FtSearchResultClusterEntry): FlatMetadata[];
|
|
20
20
|
static extractResultMetadata(result: FtSearchResultClusterEntry, key: string): Optional<FlatMetadata>;
|
|
21
|
-
static flattenMetadata(metadata: FtMetadata): FlatMetadata;
|
|
21
|
+
static flattenMetadata(metadata: Optional<FtMetadata>[]): FlatMetadata[];
|
|
22
|
+
static flattenMetadata(metadata: Optional<FtMetadata>): Optional<FlatMetadata>;
|
|
22
23
|
computeClustersItemsForMetadata(key: string, locale: string, undefinedDisplayValue?: string): ClusterItem[];
|
|
23
24
|
private compareMetadata;
|
|
24
25
|
getMetadataDescriptor(key: string): FtMetadataDescriptor | undefined;
|
|
@@ -7,11 +7,21 @@ export class ClusteringHelper {
|
|
|
7
7
|
}
|
|
8
8
|
static extractResultMetadata(result, key) {
|
|
9
9
|
var _a, _b;
|
|
10
|
-
let
|
|
11
|
-
|
|
10
|
+
let metadata = ((_b = (_a = result === null || result === void 0 ? void 0 : result.map) !== null && _a !== void 0 ? _a : result === null || result === void 0 ? void 0 : result.document) !== null && _b !== void 0 ? _b : result === null || result === void 0 ? void 0 : result.topic).metadata;
|
|
11
|
+
if (key == null) {
|
|
12
|
+
return ClusteringHelper.flattenMetadata(metadata);
|
|
13
|
+
}
|
|
14
|
+
return ClusteringHelper.flattenMetadata(metadata.find(m => m.key === key));
|
|
12
15
|
}
|
|
13
16
|
static flattenMetadata(metadata) {
|
|
14
|
-
if (metadata
|
|
17
|
+
if (Array.isArray(metadata)) {
|
|
18
|
+
return metadata.map(m => ClusteringHelper.flattenMetadata(m)).filter(m => m != null);
|
|
19
|
+
}
|
|
20
|
+
const isHierarchical = (metadata === null || metadata === void 0 ? void 0 : metadata.hierarchicalValues) != null && metadata.hierarchicalValues.length > 0;
|
|
21
|
+
if (metadata == null || (metadata.values.length == 0 && !isHierarchical)) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
if (isHierarchical) {
|
|
15
25
|
const values = [];
|
|
16
26
|
const displayValues = [];
|
|
17
27
|
metadata.hierarchicalValues.forEach(tree => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-wc-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.76",
|
|
4
4
|
"description": "Internal web components tools",
|
|
5
5
|
"author": "Fluid Topics <devtopics@antidot.net>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@floating-ui/dom": "1.5.3",
|
|
17
|
-
"@fluid-topics/design-system-variables": "0.0.
|
|
17
|
+
"@fluid-topics/design-system-variables": "0.0.23",
|
|
18
18
|
"@fluid-topics/public-api": "1.0.69",
|
|
19
19
|
"@reduxjs/toolkit": "1.9.5",
|
|
20
20
|
"@types/mark.js": "8.11.12",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"lit": "3.1.0",
|
|
24
24
|
"mark.js": "8.11.1"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "1ebafa37bb5d86acff8e29a5f094ef58468f83e9"
|
|
27
27
|
}
|