diff --git a/package-lock.json b/package-lock.json
index 3900039e..473c5c1a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,16 +1,16 @@
{
"name": "@gisce/react-ooui",
- "version": "2.41.0",
+ "version": "2.44.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@gisce/react-ooui",
- "version": "2.41.0",
+ "version": "2.44.0",
"dependencies": {
"@ant-design/plots": "^1.0.9",
"@gisce/fiber-diagram": "2.1.1",
- "@gisce/ooui": "2.19.0",
+ "@gisce/ooui": "2.20.0",
"@gisce/react-formiga-components": "1.8.0",
"@gisce/react-formiga-table": "1.9.0-alpha.8",
"@monaco-editor/react": "^4.4.5",
@@ -3370,9 +3370,9 @@
}
},
"node_modules/@gisce/ooui": {
- "version": "2.19.0",
- "resolved": "https://registry.npmjs.org/@gisce/ooui/-/ooui-2.19.0.tgz",
- "integrity": "sha512-zG5Ta8I/sBCiKpjfs05rPo8z/9mhuHvG4qiaZiqIxvtcTAdi7HY9a6hEJLKx4wfexisR+bl8/uxiSiDmc/YiQw==",
+ "version": "2.20.0",
+ "resolved": "https://registry.npmjs.org/@gisce/ooui/-/ooui-2.20.0.tgz",
+ "integrity": "sha512-IeoZ55dM7vwVebUtLm2oxSCbGbKwxEYCjl7PO6ZAlpjvtWyXy7dVHLo+fT/90gnAO1XlT6sCRCORJhtbGy5d9A==",
"dependencies": {
"@gisce/conscheck": "1.0.9",
"html-entities": "^2.3.3",
diff --git a/package.json b/package.json
index 48ef1610..b5d2e39d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@gisce/react-ooui",
- "version": "2.41.0",
+ "version": "2.44.0",
"engines": {
"node": "20.5.0"
},
@@ -35,7 +35,7 @@
"dependencies": {
"@ant-design/plots": "^1.0.9",
"@gisce/fiber-diagram": "2.1.1",
- "@gisce/ooui": "2.19.0",
+ "@gisce/ooui": "2.20.0",
"@gisce/react-formiga-components": "1.8.0",
"@gisce/react-formiga-table": "1.9.0-alpha.8",
"@monaco-editor/react": "^4.4.5",
diff --git a/src/index.ts b/src/index.ts
index 4b064b4d..73a04642 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -51,6 +51,7 @@ import { HTMLPreview } from "@/widgets/custom/HTMLPreview";
import { Alert } from "@/widgets/custom/Alert";
import { DashboardGrid } from "@/widgets/views/DashboardGrid";
import { GraphIndicator } from "@/widgets/views/Graph/GraphIndicator";
+import { Spinner } from "@/widgets/custom/Spinner";
import type {
TreeView,
@@ -177,4 +178,5 @@ export {
HTMLPreview,
Alert,
dayjs,
+ Spinner,
};
diff --git a/src/widgets/WidgetFactory.tsx b/src/widgets/WidgetFactory.tsx
index c404296c..ccb9564b 100644
--- a/src/widgets/WidgetFactory.tsx
+++ b/src/widgets/WidgetFactory.tsx
@@ -35,6 +35,7 @@ import {
CommentsTimelineField,
HTMLPreview,
Alert,
+ Spinner,
} from "@/index";
import { Image } from "./base/Image";
import { FiberGrid } from "./custom/FiberGrid";
@@ -130,6 +131,8 @@ const getWidgetType = (type: string) => {
return HTMLPreview;
case "alert":
return Alert;
+ case "spinner":
+ return Spinner;
default:
return undefined;
}
diff --git a/src/widgets/base/Image.tsx b/src/widgets/base/Image.tsx
index cc16602a..79909a29 100644
--- a/src/widgets/base/Image.tsx
+++ b/src/widgets/base/Image.tsx
@@ -1,4 +1,4 @@
-import React, { useContext, useRef } from "react";
+import React, { useRef, useMemo } from "react";
import { Row, Space } from "antd";
import Field from "@/common/Field";
import { Image as ImageOoui } from "@gisce/ooui";
@@ -12,20 +12,39 @@ import {
import { toBase64, getMimeType } from "@/helpers/filesHelper";
import iconMapper from "@/helpers/iconMapper";
import { useLocale } from "@gisce/react-formiga-components";
-import isBase64 from "validator/lib/isBase64";
-type Props = {
+type ImageProps = {
ooui: ImageOoui;
};
-export const Image = (props: Props) => {
+type ImageRenderProps = {
+ value?: string;
+ style?: any;
+};
+
+export const ImageRender = (props: ImageRenderProps) => {
+ const { value, style = {} } = props;
+ if (value) {
+ const Icon: React.ElementType = iconMapper(value) as any;
+ if (Icon) {
+ return ;
+ } else {
+ return (
+
+ );
+ }
+ }
+};
+
+export const Image = (props: ImageProps) => {
const { ooui } = props;
const { required, id } = ooui;
- const Icon: React.ElementType = iconMapper(id) as any;
-
- if (Icon) {
- return ;
+ if (iconMapper(id)) {
+ return ;
}
return (
@@ -47,13 +66,6 @@ export const ImageInput = (props: ImageInputProps) => {
const inputFile = useRef(null);
const { t } = useLocale();
- if (value) {
- const Icon: React.ElementType = iconMapper(value) as any;
- if (Icon) {
- return ;
- }
- }
-
const triggerChange = (changedValue?: string) => {
onChange?.(changedValue);
};
@@ -83,11 +95,11 @@ export const ImageInput = (props: ImageInputProps) => {
return (
<>
- {value && isBase64(value) && (
-
+ {useMemo(
+ () => (
+
+ ),
+ [value, ooui],
)}
{
+ const { ooui } = props;
+
+ return (
+
+
+
+ );
+};
diff --git a/src/widgets/views/Tree/treeComponents.tsx b/src/widgets/views/Tree/treeComponents.tsx
index b1c86300..13bc27ac 100644
--- a/src/widgets/views/Tree/treeComponents.tsx
+++ b/src/widgets/views/Tree/treeComponents.tsx
@@ -13,6 +13,7 @@ import { DatePickerConfig } from "@/common/DatePicker";
import ConnectionProvider from "@/ConnectionProvider";
import { colorFromString } from "@/helpers/formHelper";
import { EmailTagsRender } from "@/widgets/custom/EmailTags";
+import { ImageRender } from "@/widgets/base/Image";
export const BooleanComponent = ({
value,
@@ -114,12 +115,7 @@ export const NumberComponent = ({ value }: { value: number }): ReactElement => {
export const ImageComponent = ({ value }: { value: string }): ReactElement => {
return useMemo(
- () => (
-
- ),
+ () => ,
[value],
);
};