diff --git a/packages/pluggableWidgets/image-web/src/Image.editorConfig.ts b/packages/pluggableWidgets/image-web/src/Image.editorConfig.ts index 4f2b23e8e1..b51493a013 100644 --- a/packages/pluggableWidgets/image-web/src/Image.editorConfig.ts +++ b/packages/pluggableWidgets/image-web/src/Image.editorConfig.ts @@ -7,10 +7,10 @@ import { StructurePreviewProps, transformGroupsIntoTabs } from "@mendix/piw-utils-internal"; -import { DatasourceEnum, ImageViewerPreviewProps } from "../typings/ImageViewerProps"; +import { DatasourceEnum, ImagePreviewProps } from "../typings/ImageProps"; import StructurePreviewImageViewerSvg from "./assets/placeholder.svg"; -type ImageViewPreviewPropsKey = keyof ImageViewerPreviewProps; +type ImageViewPreviewPropsKey = keyof ImagePreviewProps; const dataSourceProperties: ImageViewPreviewPropsKey[] = ["imageObject", "imageUrl", "imageIcon"]; @@ -40,7 +40,7 @@ function reorderTabsForStudio(tabs: Properties): void { } export function getProperties( - values: ImageViewerPreviewProps, + values: ImagePreviewProps, defaultProperties: Properties, platform: "web" | "desktop" ): Properties { @@ -88,7 +88,7 @@ export function getPreview(): StructurePreviewProps | null { }; } -export function check(values: ImageViewerPreviewProps): Problem[] { +export function check(values: ImagePreviewProps): Problem[] { const errors: Problem[] = []; if (values.datasource === "imageUrl" && !values.imageUrl) { diff --git a/packages/pluggableWidgets/image-web/src/Image.editorPreview.tsx b/packages/pluggableWidgets/image-web/src/Image.editorPreview.tsx index a7863813bb..056c8d912e 100644 --- a/packages/pluggableWidgets/image-web/src/Image.editorPreview.tsx +++ b/packages/pluggableWidgets/image-web/src/Image.editorPreview.tsx @@ -1,14 +1,14 @@ import { parseStyle } from "@mendix/piw-utils-internal"; import { WebIcon } from "mendix"; import { createElement, ReactElement } from "react"; -import { ImageViewerPreviewProps } from "../typings/ImageViewerProps"; +import { ImagePreviewProps } from "../typings/ImageProps"; import { ImageViewer as ImageViewerComponent } from "./components/Image/index"; import ImageViewerPlaceholder from "./assets/placeholder.svg"; declare function require(name: string): string; -export function preview(props: ImageViewerPreviewProps): ReactElement | null { +export function preview(props: ImagePreviewProps): ReactElement | null { let image = ImageViewerPlaceholder; switch (props.datasource) { case "image": diff --git a/packages/pluggableWidgets/image-web/src/Image.tsx b/packages/pluggableWidgets/image-web/src/Image.tsx index 50ba63abb9..39dd0ba45b 100644 --- a/packages/pluggableWidgets/image-web/src/Image.tsx +++ b/packages/pluggableWidgets/image-web/src/Image.tsx @@ -1,6 +1,6 @@ import { ValueStatus } from "mendix"; import { createElement, FunctionComponent, useCallback } from "react"; -import { ImageViewerContainerProps } from "../typings/ImageViewerProps"; +import { ImageContainerProps } from "../typings/ImageProps"; import { ImageViewer as ImageViewerComponent, ImageViewerImageProps } from "./components/Image/index"; function getImageProps({ @@ -9,7 +9,7 @@ function getImageProps({ imageObject, imageUrl, defaultImageDynamic -}: ImageViewerContainerProps): ImageViewerImageProps { +}: ImageContainerProps): ImageViewerImageProps { const fallback: ImageViewerImageProps = { type: "image", image: undefined @@ -62,7 +62,7 @@ function getImageProps({ } } -export const ImageViewer: FunctionComponent = props => { +export const ImageViewer: FunctionComponent = props => { const onClick = useCallback(() => props.onClick?.execute(), [props.onClick]); const { type, image } = getImageProps(props); diff --git a/packages/pluggableWidgets/image-web/src/components/Image/index.tsx b/packages/pluggableWidgets/image-web/src/components/Image/index.tsx index e09a18da48..a204aa8c2e 100644 --- a/packages/pluggableWidgets/image-web/src/components/Image/index.tsx +++ b/packages/pluggableWidgets/image-web/src/components/Image/index.tsx @@ -1,5 +1,5 @@ import { cloneElement, createElement, CSSProperties, FunctionComponent, useCallback } from "react"; -import { HeightUnitEnum, WidthUnitEnum, OnClickTypeEnum, DisplayAsEnum } from "../../../typings/ImageViewerProps"; +import { HeightUnitEnum, WidthUnitEnum, OnClickTypeEnum, DisplayAsEnum } from "../../../typings/ImageProps"; import { useLightboxState } from "../../utils/lightboxState"; import { ImageViewerUi, ImageViewerContentProps } from "./ui"; import { Lightbox, LightboxProps } from "../Lightbox"; diff --git a/packages/pluggableWidgets/image-web/src/components/Image/ui.tsx b/packages/pluggableWidgets/image-web/src/components/Image/ui.tsx index 764c308387..8e7e788283 100644 --- a/packages/pluggableWidgets/image-web/src/components/Image/ui.tsx +++ b/packages/pluggableWidgets/image-web/src/components/Image/ui.tsx @@ -1,6 +1,6 @@ import { createElement, CSSProperties, HTMLAttributes, ReactElement, ReactEventHandler } from "react"; import classNames from "classnames"; -import { HeightUnitEnum, WidthUnitEnum } from "../../../typings/ImageViewerProps"; +import { HeightUnitEnum, WidthUnitEnum } from "../../../typings/ImageProps"; import { LightboxProps } from "../Lightbox"; import "../../ui/Image.scss"; diff --git a/packages/pluggableWidgets/image-web/typings/ImageProps.d.ts b/packages/pluggableWidgets/image-web/typings/ImageProps.d.ts index d60803302e..c1b2ce6bdc 100644 --- a/packages/pluggableWidgets/image-web/typings/ImageProps.d.ts +++ b/packages/pluggableWidgets/image-web/typings/ImageProps.d.ts @@ -42,8 +42,8 @@ export interface ImagePreviewProps { class: string; style: string; datasource: DatasourceEnum; - imageObject: string; - defaultImageDynamic: string; + imageObject: { type: "static"; imageUrl: string; } | { type: "dynamic"; entity: string; } | null; + defaultImageDynamic: { type: "static"; imageUrl: string; } | { type: "dynamic"; entity: string; } | null; imageUrl: string; imageIcon: { type: "glyph"; iconClass: string; } | { type: "image"; imageUrl: string; } | null; onClickType: OnClickTypeEnum; diff --git a/packages/pluggableWidgets/image-web/typings/ImageViewerProps.d.ts b/packages/pluggableWidgets/image-web/typings/ImageViewerProps.d.ts deleted file mode 100644 index b20424cb3c..0000000000 --- a/packages/pluggableWidgets/image-web/typings/ImageViewerProps.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This file was generated from ImageViewer.xml - * WARNING: All changes made to this file will be overwritten - * @author Mendix UI Content Team - */ -import { CSSProperties } from "react"; -import { ActionValue, DynamicValue, WebIcon, WebImage } from "mendix"; - -export type DatasourceEnum = "image" | "imageUrl" | "icon"; - -export type OnClickTypeEnum = "action" | "enlarge"; - -export type WidthUnitEnum = "auto" | "pixels" | "percentage"; - -export type HeightUnitEnum = "auto" | "pixels"; - -export type DisplayAsEnum = "fullImage" | "thumbnail"; - -export interface ImageViewerContainerProps { - name: string; - class: string; - style?: CSSProperties; - tabIndex?: number; - datasource: DatasourceEnum; - imageObject?: DynamicValue; - defaultImageDynamic?: DynamicValue; - imageUrl?: DynamicValue; - imageIcon?: DynamicValue; - onClickType: OnClickTypeEnum; - onClick?: ActionValue; - alternativeText?: DynamicValue; - widthUnit: WidthUnitEnum; - width: number; - heightUnit: HeightUnitEnum; - height: number; - iconSize: number; - displayAs: DisplayAsEnum; - responsive: boolean; -} - -export interface ImageViewerPreviewProps { - class: string; - style: string; - datasource: DatasourceEnum; - imageObject: { type: "static"; imageUrl: string; } | { type: "dynamic"; entity: string; } | null; - defaultImageDynamic: { type: "static"; imageUrl: string; } | { type: "dynamic"; entity: string; } | null; - imageUrl: string; - imageIcon: { type: "glyph"; iconClass: string; } | { type: "image"; imageUrl: string; } | null; - onClickType: OnClickTypeEnum; - onClick: {} | null; - alternativeText: string; - widthUnit: WidthUnitEnum; - width: number | null; - heightUnit: HeightUnitEnum; - height: number | null; - iconSize: number | null; - displayAs: DisplayAsEnum; - responsive: boolean; -}