@fluxo-dev/shell-reporting 0.0.38 → 0.0.39

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.
package/index.esm.js CHANGED
@@ -6,7 +6,5 @@ import '@mantine/core';
6
6
  import '@mantine/dates';
7
7
  import '@mantine/notifications';
8
8
  import '@fluxo-dev/ui-components';
9
- import 'devexpress-reporting/dx-reportdesigner';
10
9
  import 'react-router-dom';
11
- import 'devexpress-reporting/dx-webdocumentviewer';
12
10
  import 'devextreme/localization';
package/index.esm2.js CHANGED
@@ -1,13 +1,11 @@
1
1
  import { EmbeddedModule, FluxoClientSys } from '@fluxo-dev/api-client-base';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import { lazy, Suspense, forwardRef, createElement as createElement$2, useState, useEffect, useCallback, useRef } from 'react';
4
- import { Stack, TextInput, NumberInput, Switch, Loader, Select, Box, Group, Text, Divider, Button, Center, Modal } from '@mantine/core';
4
+ import { Stack, TextInput, NumberInput, Switch, Loader, Select, Box, Group, Text, Divider, Button, Center, LoadingOverlay, Modal } from '@mantine/core';
5
5
  import { DatePickerInput } from '@mantine/dates';
6
6
  import { showNotification } from '@mantine/notifications';
7
7
  import { NoData, ShellPage } from '@fluxo-dev/ui-components';
8
- import { DxReportDesigner } from 'devexpress-reporting/dx-reportdesigner';
9
8
  import { useParams } from 'react-router-dom';
10
- import { DxReportViewer } from 'devexpress-reporting/dx-webdocumentviewer';
11
9
  import { locale } from 'devextreme/localization';
12
10
 
13
11
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -4944,20 +4942,51 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
4944
4942
  ];
4945
4943
  }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
4946
4944
 
4945
+ /******************************************************************************
4946
+ Copyright (c) Microsoft Corporation.
4947
+
4948
+ Permission to use, copy, modify, and/or distribute this software for any
4949
+ purpose with or without fee is hereby granted.
4950
+
4951
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
4952
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
4953
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
4954
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4955
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
4956
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4957
+ PERFORMANCE OF THIS SOFTWARE.
4958
+ ***************************************************************************** */
4959
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
4960
+
4961
+
4962
+ function __awaiter(thisArg, _arguments, P, generator) {
4963
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4964
+ return new (P || (P = Promise))(function (resolve, reject) {
4965
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4966
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
4967
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
4968
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
4969
+ });
4970
+ }
4971
+
4972
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
4973
+ var e = new Error(message);
4974
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
4975
+ };
4976
+
4947
4977
  const ReportDesigner = props => {
4948
- var _a, _b;
4949
4978
  const {
4950
4979
  id
4951
4980
  } = useParams();
4952
4981
  const [report, setReport] = useState();
4953
4982
  const designerRef = useRef(null);
4954
4983
  const [designerLoaded, setDesignerLoaded] = useState(false);
4984
+ const [designerInstance, setDesignerInstance] = useState(null);
4955
4985
  const requestOptions = {
4956
4986
  host: FluxoClientSys.Instance.clientConfig.fluxoInstanceUrl.replace('/api', ''),
4957
4987
  getDesignerModelAction: "/DXXRD/GetDesignerModel"
4958
4988
  };
4959
4989
  useEffect(() => {
4960
- //loadMessages(itMessages);
4961
4990
  locale('it');
4962
4991
  }, []);
4963
4992
  useEffect(() => {
@@ -4967,55 +4996,89 @@ const ReportDesigner = props => {
4967
4996
  });
4968
4997
  }, [id]);
4969
4998
  useEffect(() => {
4970
- if (!report) return;
4971
- if ((designerRef === null || designerRef === void 0 ? void 0 : designerRef.current) === undefined) return;
4972
- let designer = null;
4973
- if (props.mode === 'designer') designer = new DxReportDesigner(designerRef.current, {
4974
- reportUrl: report.id.toString(),
4975
- requestOptions
4976
- });else designer = new DxReportViewer(designerRef.current, {
4977
- reportUrl: report.id.toString() + '?' + props.reportParameters,
4978
- requestOptions: {
4979
- host: FluxoClientSys.Instance.clientConfig.fluxoInstanceUrl.replace('/api', '/'),
4980
- invokeAction: "DXXRDV"
4999
+ if (!report || !(designerRef === null || designerRef === void 0 ? void 0 : designerRef.current)) return;
5000
+ const loadDesigner = () => __awaiter(void 0, void 0, void 0, function* () {
5001
+ setDesignerLoaded(false);
5002
+ try {
5003
+ let designer;
5004
+ if (props.mode === 'designer') {
5005
+ const {
5006
+ DxReportDesigner
5007
+ } = yield import('devexpress-reporting/dx-reportdesigner');
5008
+ designer = new DxReportDesigner(designerRef.current, {
5009
+ reportUrl: report.id.toString(),
5010
+ requestOptions
5011
+ });
5012
+ } else {
5013
+ const {
5014
+ DxReportViewer
5015
+ } = yield import('devexpress-reporting/dx-webdocumentviewer');
5016
+ designer = new DxReportViewer(designerRef.current, {
5017
+ reportUrl: report.id.toString() + '?' + props.reportParameters,
5018
+ requestOptions: {
5019
+ host: FluxoClientSys.Instance.clientConfig.fluxoInstanceUrl.replace('/api', '/'),
5020
+ invokeAction: "DXXRDV"
5021
+ }
5022
+ });
5023
+ }
5024
+ if (designer) {
5025
+ designer.render();
5026
+ setDesignerInstance(designer);
5027
+ setTimeout(() => setDesignerLoaded(true), 2000);
5028
+ }
5029
+ } catch (error) {
5030
+ console.error('Error loading designer:', error);
4981
5031
  }
4982
5032
  });
4983
- if (designer) {
4984
- designer.render();
4985
- setDesignerLoaded(true);
4986
- }
4987
- return () => designer ? designer.dispose() : undefined;
5033
+ loadDesigner();
5034
+ return () => {
5035
+ if (designerInstance) {
5036
+ designerInstance.dispose();
5037
+ }
5038
+ };
4988
5039
  }, [designerRef, report]);
4989
- return jsx(Fragment, {
4990
- children: props.mode === 'viewer' ? jsxs(Fragment, {
4991
- children: [!designerLoaded && jsx(Loader, {}), jsx("div", {
4992
- style: {
4993
- width: "100%",
4994
- height: "calc(100vh - 38px)",
4995
- marginTop: -16
4996
- },
4997
- children: jsx("div", {
4998
- ref: designerRef
4999
- })
5000
- })]
5001
- }) : jsxs(ShellPage, {
5002
- withoutPadding: true,
5040
+ const renderContent = () => {
5041
+ if (props.mode === 'viewer') {
5042
+ return jsxs(Box, {
5043
+ pos: 'relative',
5044
+ children: [jsx(LoadingOverlay, {
5045
+ visible: !designerLoaded
5046
+ }), jsx("div", {
5047
+ style: {
5048
+ width: "100%",
5049
+ height: "calc(100vh - 38px)",
5050
+ marginTop: -16
5051
+ },
5052
+ children: jsx("div", {
5053
+ ref: designerRef
5054
+ })
5055
+ })]
5056
+ });
5057
+ }
5058
+ return jsx(ShellPage, {
5003
5059
  headerProps: {
5004
- title: (_a = report === null || report === void 0 ? void 0 : report.name) !== null && _a !== void 0 ? _a : "Caricamento...",
5005
- subtitle: (_b = report === null || report === void 0 ? void 0 : report.annotations) !== null && _b !== void 0 ? _b : "...",
5006
- backButtonTo: "/fluxo/reporting/reports"
5060
+ title: 'Report Designer',
5061
+ subtitle: report === null || report === void 0 ? void 0 : report.name,
5062
+ backButtonTo: '/fluxo/reporting/reports'
5007
5063
  },
5008
- children: [!designerLoaded && jsx(Loader, {}), jsx("div", {
5009
- style: {
5010
- width: "100%",
5011
- height: "calc(100vh - 153px)"
5012
- },
5013
- children: jsx("div", {
5014
- ref: designerRef
5015
- })
5016
- }), " :"]
5017
- })
5018
- });
5064
+ withoutPadding: true,
5065
+ children: jsxs(Box, {
5066
+ pos: 'relative',
5067
+ children: [jsx(LoadingOverlay, {
5068
+ visible: !designerLoaded
5069
+ }), jsx("div", {
5070
+ style: {
5071
+ width: "100%",
5072
+ height: "calc(100vh - 151px)"
5073
+ },
5074
+ children: jsx("div", {
5075
+ ref: designerRef
5076
+ })
5077
+ })]
5078
+ })
5079
+ });
5080
+ };
5081
+ return renderContent();
5019
5082
  };
5020
5083
 
5021
5084
  var reportDesigner = /*#__PURE__*/Object.freeze({
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@fluxo-dev/shell-reporting",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "peerDependencies": {
5
- "@fluxo-dev/api-client-base": "0.0.38"
5
+ "@fluxo-dev/api-client-base": "0.0.39"
6
6
  },
7
7
  "module": "./index.esm.js",
8
8
  "type": "module",
@@ -7,8 +7,6 @@ import { FluxoClientSys } from '@fluxo-dev/api-client-base';
7
7
  import { useNavigate } from 'react-router-dom';
8
8
  import { showNotification } from '@mantine/notifications';
9
9
  import '@mantine/dates';
10
- import 'devexpress-reporting/dx-reportdesigner';
11
- import 'devexpress-reporting/dx-webdocumentviewer';
12
10
  import 'devextreme/localization';
13
11
 
14
12
  /**