@fluid-topics/ft-viewer 2.2.21 → 2.2.25

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.
@@ -37,7 +37,7 @@ export declare class FtUdViewerFeedback extends FtUdViewerFeedback_base implemen
37
37
  get canRateThisContent(): boolean | undefined;
38
38
  get configuredRatingType(): "DICHOTOMOUS" | "LIKE" | "NO_RATING" | "STARS" | FtRatingType.NO_RATING;
39
39
  constructor(guestStorage?: GuestLocalStorage<FtPublicationRatingSummary>);
40
- protected render(): import("lit-html").TemplateResult<1>;
40
+ protected render(): import("lit").TemplateResult<1>;
41
41
  protected willUpdate(props: PropertyValues): void;
42
42
  connectedCallback(): void;
43
43
  disconnectedCallback(): void;
@@ -28,7 +28,7 @@ export declare class FtUdViewerMetadata extends FtUdViewerMetadata_base implemen
28
28
  constructor();
29
29
  protected willUpdate(props: PropertyValues): void;
30
30
  private updateRelatives;
31
- protected render(): import("lit-html").TemplateResult<1>;
31
+ protected render(): import("lit").TemplateResult<1>;
32
32
  private hideIfEmpty;
33
33
  private renderSwitchToRelatives;
34
34
  private renderRelativeItem;
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { ftAppInfoStore, withDateFormat } from "@fluid-topics/ft-app-context";
8
8
  import { i18n, withI18n } from "@fluid-topics/ft-i18n";
9
9
  import { FtUdViewerComponent } from "./FtUdViewerComponent";
10
- import { ClusteringHelper, numberProperty, redux, reduxEventListener, reduxReactive, } from "@fluid-topics/ft-wc-utils";
10
+ import { ClusteringHelper, MetadataValueLocalizer, numberProperty, redux, reduxEventListener, reduxReactive, } from "@fluid-topics/ft-wc-utils";
11
11
  import { property, state } from "lit/decorators.js";
12
12
  import { udViewerContext } from "../ft-ud-viewer.messages";
13
13
  import { styles } from "./ft-ud-viewer-metadata.styles";
@@ -19,7 +19,6 @@ import { html, nothing } from "lit";
19
19
  import { repeat } from "lit/directives/repeat.js";
20
20
  import { getResultUrl } from "@fluid-topics/ft-search-result-context/build/utils";
21
21
  import { FtUdViewerStoreEvents } from "../model/ft-ud-viewer.models";
22
- import { MetadataValueLocalizer } from "../../common/utils/MetadataValueLocalizer";
23
22
  export class FtUdViewerMetadata extends withDateFormat(withI18n(FtUdViewerComponent)) {
24
23
  get metadataValue() {
25
24
  if (this.flatMetadata) {
@@ -5,7 +5,7 @@ import { FtUdViewerStateManager } from "./model/FtUdViewerStateManager";
5
5
  export declare class FtUdViewerContext extends FtLitElementRedux implements FtUdViewerContextProperties {
6
6
  documentId?: string;
7
7
  viewerStateManager: FtUdViewerStateManager;
8
- protected render(): import("lit-html").TemplateResult<1>;
8
+ protected render(): import("lit").TemplateResult<1>;
9
9
  protected willUpdate(props: PropertyValues<FtUdViewerContext>): void;
10
10
  load(): Promise<void>;
11
11
  connectedCallback(): void;
@@ -1,9 +1,10 @@
1
1
  import { FtServiceWithCache } from "@fluid-topics/ft-app-context";
2
- import { FtPublicationRatingSummary, FtRatingType, FtRatingTypeKeys, FtViewerConfiguration, FtSearchResults } from "@fluid-topics/public-api";
2
+ import { FtPublicationRatingSummary, FtRatingType, FtRatingTypeKeys, FtSearchResults, FtViewerConfiguration } from "@fluid-topics/public-api";
3
3
  import { FtViewerFeatureAccessData, FtViewerFeatures } from "./ft-ud-viewer.models";
4
4
  export declare class FtUdViewerService extends FtServiceWithCache {
5
5
  getDocument(documentId: string): Promise<import("@fluid-topics/public-api").FtUnstructuredDocument>;
6
6
  getAttachments(documentId: string): Promise<import("@fluid-topics/public-api").FtDocumentAttachment[]>;
7
+ clearAttachments(documentId: string): void;
7
8
  getAttachmentDownloadLink(documentId: string, id: string): string;
8
9
  makeAbsolute(endpoint: string): string;
9
10
  awaitMakeAbsolute(endpoint: string): Promise<string>;
@@ -8,6 +8,9 @@ export class FtUdViewerService extends FtServiceWithCache {
8
8
  getAttachments(documentId) {
9
9
  return this.cache.get(`${documentId}-attachments`, () => this.api.getUdAttachments(documentId));
10
10
  }
11
+ clearAttachments(documentId) {
12
+ this.cache.clear(`${documentId}-attachments`);
13
+ }
11
14
  getAttachmentDownloadLink(documentId, id) {
12
15
  return this.makeAbsolute(`${this.api.endpoints.khub.documents.documentId(documentId).attachments.attachmentId(id).content}?download=true&locationValue=viewer`);
13
16
  }
@@ -25,4 +25,5 @@ export declare class FtUdViewerStateManager extends FtViewerStateManager {
25
25
  registerMetadataForSwitchToRelatives(id: string): void;
26
26
  unregisterMetadataForSwitchToRelatives(id: string): void;
27
27
  getRelativeDocumentUrlForLocale(uiLocale: string): Promise<string | undefined>;
28
+ onUdAttachmentsUpdate(): void;
28
29
  }
@@ -130,4 +130,12 @@ export class FtUdViewerStateManager extends FtViewerStateManager {
130
130
  const maybeRelativeResult = ClusteringHelper.findResultWithMetadataValue((_a = this.store.getState().relatives) !== null && _a !== void 0 ? _a : [], "ft:locale", uiLocale);
131
131
  return accessResultUrl(maybeRelativeResult);
132
132
  }
133
+ onUdAttachmentsUpdate() {
134
+ var _a;
135
+ const { documentId } = this.store.getState();
136
+ if (documentId) {
137
+ (_a = this.service) === null || _a === void 0 ? void 0 : _a.clearAttachments(documentId);
138
+ this.store.dispatchEvent(new Event(FtUdViewerStoreEvents.udAttachmentsUpdate));
139
+ }
140
+ }
133
141
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-viewer",
3
- "version": "2.2.21",
3
+ "version": "2.2.25",
4
4
  "description": "File viewer components",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,18 +19,26 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-content-watermark": "2.2.21",
23
- "@fluid-topics/ft-i18n": "2.2.21",
24
- "@fluid-topics/ft-reader-attachments": "2.2.21",
25
- "@fluid-topics/ft-reader-feedback": "2.2.21",
26
- "@fluid-topics/ft-search-result-context": "2.2.21",
27
- "@fluid-topics/ft-wc-utils": "2.2.21",
28
- "@fluid-topics/public-api": "1.0.143",
22
+ "@fluid-topics/ft-app-context": "2.2.25",
23
+ "@fluid-topics/ft-chip": "2.2.25",
24
+ "@fluid-topics/ft-content-watermark": "2.2.25",
25
+ "@fluid-topics/ft-floating-menu": "2.2.25",
26
+ "@fluid-topics/ft-i18n": "2.2.25",
27
+ "@fluid-topics/ft-icon": "2.2.25",
28
+ "@fluid-topics/ft-reader-attachments": "2.2.25",
29
+ "@fluid-topics/ft-reader-feedback": "2.2.25",
30
+ "@fluid-topics/ft-ripple": "2.2.25",
31
+ "@fluid-topics/ft-search-result-context": "2.2.25",
32
+ "@fluid-topics/ft-tooltip": "2.2.25",
33
+ "@fluid-topics/ft-typography": "2.2.25",
34
+ "@fluid-topics/ft-wc-utils": "2.2.25",
35
+ "@fluid-topics/public-api": "1.0.144",
29
36
  "@lit/context": "1.1.6",
37
+ "@reduxjs/toolkit": "2.12.0",
30
38
  "lit": "3.3.3"
31
39
  },
32
40
  "devDependencies": {
33
- "@fluid-topics/ft-wc-test-utils": "2.2.21"
41
+ "@fluid-topics/ft-wc-test-utils": "2.2.25"
34
42
  },
35
- "gitHead": "633b6db0fae9f56c46c4211bf5bce2c73ef31ecb"
43
+ "gitHead": "c224b774c4f762eaf7836b0b0a401edd2a989a60"
36
44
  }
@@ -1,8 +0,0 @@
1
- import { FlatMetadata, Optional } from "@fluid-topics/ft-wc-utils";
2
- import { FtSearchLocale } from "@fluid-topics/public-api";
3
- export declare class MetadataValueLocalizer {
4
- private contentLocales;
5
- constructor(contentLocales: Array<FtSearchLocale>);
6
- localize(flatMetadata: Optional<FlatMetadata>): Optional<FlatMetadata>;
7
- private findLocaleValue;
8
- }
@@ -1,20 +0,0 @@
1
- export class MetadataValueLocalizer {
2
- constructor(contentLocales) {
3
- this.contentLocales = contentLocales;
4
- }
5
- localize(flatMetadata) {
6
- var _a, _b;
7
- if ((flatMetadata === null || flatMetadata === void 0 ? void 0 : flatMetadata.key) !== "ft:locale") {
8
- return flatMetadata;
9
- }
10
- return {
11
- ...flatMetadata,
12
- displayValue: (_a = this.findLocaleValue(flatMetadata)) !== null && _a !== void 0 ? _a : flatMetadata.displayValue,
13
- displayTooltipValue: (_b = this.findLocaleValue(flatMetadata)) !== null && _b !== void 0 ? _b : flatMetadata.displayTooltipValue,
14
- };
15
- }
16
- findLocaleValue(flatMetadata) {
17
- var _a;
18
- return (_a = this.contentLocales.find((locale) => locale.lang === flatMetadata.value)) === null || _a === void 0 ? void 0 : _a.label;
19
- }
20
- }