@fluid-topics/ft-search-result-metadata 1.2.21 → 1.2.23

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.
@@ -19,7 +19,6 @@ export declare class FtSearchResultMetadata extends FtSearchResultMetadata_base
19
19
  private editorMode;
20
20
  private metadataDescriptors;
21
21
  private request?;
22
- private metadata?;
23
22
  private metadataLabel?;
24
23
  private clustersByValue;
25
24
  private clusterItems?;
@@ -78,7 +78,7 @@ class FtSearchResultMetadata extends withDateFormat(withI18n(FtSearchResultCompo
78
78
  var _a, _b;
79
79
  const clustersByValue = {};
80
80
  const clusteringHelper = new ClusteringHelper((_a = this.cluster) === null || _a === void 0 ? void 0 : _a.entries, this.result, this.resultStateManager.registeredMetadata, this.metadataDescriptors);
81
- this.clusterItems = clusteringHelper.computeClustersItemsForMetadata(this.key, ((_b = this.request) === null || _b === void 0 ? void 0 : _b.contentLocale) || "en", context.messages.itemWithNoValueForClusterSwitch());
81
+ this.clusterItems = clusteringHelper.computeClustersItemsForMetadata(this.key, ((_b = this.request) === null || _b === void 0 ? void 0 : _b.contentLocale) || "en", context.messages.itemWithNoValueForClusterSwitch(), this.getDateFormatter(this.key));
82
82
  this.clusterItems.forEach(item => {
83
83
  var _a;
84
84
  clustersByValue[(_a = item.metadata.value) !== null && _a !== void 0 ? _a : "ft:no_value"] = item;
@@ -98,9 +98,7 @@ class FtSearchResultMetadata extends withDateFormat(withI18n(FtSearchResultCompo
98
98
  renderClusterItemValue(value, displayValue) {
99
99
  return html `
100
100
  <ft-floating-menu-item value="${value !== null && value !== void 0 ? value : "ft:no_value"}">
101
- ${value == null || value === displayValue ? displayValue : html `
102
- <ft-tooltip text="${value}">${displayValue}</ft-tooltip>
103
- `}
101
+ ${displayValue}
104
102
  </ft-floating-menu-item>
105
103
  `;
106
104
  }
@@ -164,33 +162,33 @@ class FtSearchResultMetadata extends withDateFormat(withI18n(FtSearchResultCompo
164
162
  return cutText + (cutText.length < text.length ? "…" : "");
165
163
  }
166
164
  update(props) {
167
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
165
+ var _a, _b, _c, _d, _e, _f, _g, _h;
168
166
  super.update(props);
169
- if ((props.has("result") || (props.has("key")) && this.result) || this.dateFormatOptionsChanged(props)) {
170
- this.metadata = this.formatDateValues((_a = this.resultData()) === null || _a === void 0 ? void 0 : _a.metadata.find(m => m.key == this.key && m.values.length > 0));
171
- this.metadataLabel = (_c = (_b = this.metadata) === null || _b === void 0 ? void 0 : _b.label) !== null && _c !== void 0 ? _c : this.findClusterMetadataLabel();
172
- this.flatMetadata = ClusteringHelper.flattenMetadata(this.metadata);
167
+ if ((props.has("result") || props.has("key") || this.dateFormatOptionsChanged(props)) && this.key && this.result) {
168
+ const metadata = (_a = this.resultData()) === null || _a === void 0 ? void 0 : _a.metadata.find(m => m.key == this.key && m.values.length > 0);
169
+ this.metadataLabel = (_b = metadata === null || metadata === void 0 ? void 0 : metadata.label) !== null && _b !== void 0 ? _b : this.findClusterMetadataLabel();
170
+ this.flatMetadata = ClusteringHelper.flattenMetadata(metadata, this.getDateFormatter(this.key));
173
171
  }
174
172
  if (props.has("key") && this.useAsClusterSwitch) {
175
173
  if (props.get("key")) {
176
- (_d = this.resultStateManager) === null || _d === void 0 ? void 0 : _d.unregisterMetadata(props.get("key"));
174
+ (_c = this.resultStateManager) === null || _c === void 0 ? void 0 : _c.unregisterMetadata(props.get("key"));
177
175
  }
178
176
  if (this.key) {
179
- (_e = this.resultStateManager) === null || _e === void 0 ? void 0 : _e.registerMetadata(this.key);
177
+ (_d = this.resultStateManager) === null || _d === void 0 ? void 0 : _d.registerMetadata(this.key);
180
178
  }
181
179
  }
182
180
  if (props.has("useAsClusterSwitch") && this.key) {
183
181
  if (this.useAsClusterSwitch) {
184
- (_f = this.resultStateManager) === null || _f === void 0 ? void 0 : _f.registerMetadata(this.key);
182
+ (_e = this.resultStateManager) === null || _e === void 0 ? void 0 : _e.registerMetadata(this.key);
185
183
  }
186
184
  else {
187
- (_g = this.resultStateManager) === null || _g === void 0 ? void 0 : _g.unregisterMetadata(this.key);
185
+ (_f = this.resultStateManager) === null || _f === void 0 ? void 0 : _f.unregisterMetadata(this.key);
188
186
  }
189
187
  }
190
188
  if ((props.has("cluster") || props.has("result") || props.has("key") || props.has("useAsClusterSwitch"))) {
191
189
  if (this.cluster && this.result && this.key && this.useAsClusterSwitch) {
192
190
  this.computeClusters();
193
- this.displayCluster = this.useAsClusterSwitch && ((_j = (_h = this.cluster) === null || _h === void 0 ? void 0 : _h.entries.length) !== null && _j !== void 0 ? _j : 0) > 1 && this.clusterHasMultipleValues;
191
+ this.displayCluster = this.useAsClusterSwitch && ((_h = (_g = this.cluster) === null || _g === void 0 ? void 0 : _g.entries.length) !== null && _h !== void 0 ? _h : 0) > 1 && this.clusterHasMultipleValues;
194
192
  }
195
193
  else {
196
194
  this.displayCluster = false;
@@ -204,7 +202,7 @@ class FtSearchResultMetadata extends withDateFormat(withI18n(FtSearchResultCompo
204
202
  }
205
203
  get tooltipText() {
206
204
  if (this.flatMetadata) {
207
- return `${this.metadataLabel}: ${this.flatMetadata.value}`;
205
+ return `${this.metadataLabel}: ${this.flatMetadata.displayValue}`;
208
206
  }
209
207
  if (this.useAsClusterSwitch) {
210
208
  return `${this.metadataLabel}: ${adminContext.messages.noValueInCluster()}`;
@@ -252,9 +250,6 @@ __decorate([
252
250
  __decorate([
253
251
  redux({ store: "search" })
254
252
  ], FtSearchResultMetadata.prototype, "request", void 0);
255
- __decorate([
256
- state()
257
- ], FtSearchResultMetadata.prototype, "metadata", void 0);
258
253
  __decorate([
259
254
  state()
260
255
  ], FtSearchResultMetadata.prototype, "metadataLabel", void 0);