Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/pluggableWidgets/document-viewer-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Changed

- We changed the internal structure of the widget

## [1.2.0] - 2025-10-29

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@babel/plugin-transform-class-properties": "^7.27.1",
"@babel/plugin-transform-private-methods": "^7.27.1",
"@babel/plugin-transform-private-property-in-object": "^7.27.1",
"@mendix/eslint-config-web-widgets": "workspace:*",
"@mendix/pluggable-widgets-tools": "*",
"@mendix/rollup-web-widgets": "workspace:*",
"@rollup/plugin-replace": "^6.0.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ReactElement } from "react";
import { DocumentViewerPreviewProps } from "typings/DocumentViewerProps";
import "../ui/documentViewer.scss";
import "../ui/documentViewerIcons.scss";
import { DocumentViewerPreviewProps } from "../typings/DocumentViewerProps";
import "./ui/documentViewer.scss";
import "./ui/documentViewerIcons.scss";
import classNames from "classnames";
import { constructWrapperStyle } from "../utils/dimension";
import { BaseControlViewer } from "components/BaseViewer";
import { constructWrapperStyle } from "./utils/dimension";
import { BaseControlViewer } from "./components/BaseViewer";

export const preview = (props: DocumentViewerPreviewProps): ReactElement => {
const { file } = props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import classNames from "classnames";
import { ReactElement } from "react";
import { DocumentViewerContainerProps } from "../typings/DocumentViewerProps";
import "../ui/documentViewer.scss";
import "../ui/documentViewerIcons.scss";
import { constructWrapperStyle } from "../utils/dimension";
import { useRendererSelector } from "../utils/useRendererSelector";
import "./ui/documentViewer.scss";
import "./ui/documentViewerIcons.scss";
import { constructWrapperStyle } from "./utils/dimension";
import { useRendererSelector } from "./utils/useRendererSelector";

export default function DocumentViewer(props: DocumentViewerContainerProps): ReactElement {
const { CurrentRenderer, props: rendererProps } = useRendererSelector(props);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CSSProperties, Fragment, PropsWithChildren, ReactElement, ReactNode, useCallback } from "react";
import { useZoomScale } from "../utils/useZoomScale";
import { DocumentViewerContainerProps } from "typings/DocumentViewerProps";
import { DocumentViewerContainerProps } from "../../typings/DocumentViewerProps";
import { downloadFile } from "../utils/helpers";

type FileFormat = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fragment, useCallback, useEffect, useMemo, useState } from "react";
import { ChangeEvent, FormEvent, Fragment, KeyboardEvent, useCallback, useEffect, useMemo, useState } from "react";
import { Document, Page, pdfjs } from "react-pdf";
import "react-pdf/dist/Page/AnnotationLayer.css";
import "react-pdf/dist/Page/TextLayer.css";
Expand Down Expand Up @@ -42,7 +42,7 @@ const PDFViewer: DocRendererElement = (props: DocumentRendererProps) => {
downloadFile(file.value?.uri);
}, [file]);

const handlePageInputChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
const handlePageInputChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {
const value = event.target.value;
// Allow only numbers and empty string
if (value === "" || /^\d+$/.test(value)) {
Expand All @@ -61,7 +61,7 @@ const PDFViewer: DocRendererElement = (props: DocumentRendererProps) => {
}, [pageInputValue, numberOfPages, currentPage]);

const handlePageInputSubmit = useCallback(
(event: React.FormEvent) => {
(event: FormEvent) => {
event.preventDefault();
validateAndSetPage();
},
Expand All @@ -73,7 +73,7 @@ const PDFViewer: DocRendererElement = (props: DocumentRendererProps) => {
}, [validateAndSetPage]);

const handlePageInputKeyDown = useCallback(
(event: React.KeyboardEvent<HTMLInputElement>) => {
(event: KeyboardEvent<HTMLInputElement>) => {
if (event.key === "Enter") {
event.preventDefault();
validateAndSetPage();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC } from "react";
import { DocumentViewerContainerProps } from "../typings/DocumentViewerProps";
import { DocumentViewerContainerProps } from "../../typings/DocumentViewerProps";

export declare const enum DocumentStatus {
available = "available",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { CSSProperties } from "react";
import {
WidthUnitEnum,
HeightUnitEnum,
MinHeightUnitEnum,
MaxHeightUnitEnum,
OverflowYEnum
} from "../typings/DocumentViewerProps";
MinHeightUnitEnum,
OverflowYEnum,
WidthUnitEnum
} from "../../typings/DocumentViewerProps";

export interface DimensionContainerProps {
widthUnit: WidthUnitEnum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
DocumentStatusEvent
} from "../components/documentRenderer";
import ErrorViewer from "../components/ErrorViewer";
import { DocumentViewerContainerProps } from "../typings/DocumentViewerProps";
import { DocumentViewerContainerProps } from "../../typings/DocumentViewerProps";
interface DocumentRenderer {
CurrentRenderer: DocRendererElement;
props: DocumentRendererProps;
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading