devexpress-reporting-react 24.1.3 → 24.1.5
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/dx-report-designer/DxReportDesigner.d.ts +6 -2
- package/dx-report-designer/DxReportDesigner.js +17 -5
- package/dx-report-designer/index.d.ts +2 -1
- package/dx-report-viewer/DxReportViewer.js +3 -2
- package/dx-report-viewer/components/analytics/Widgets/Treelist/Treelist.js +9 -3
- package/dx-report-viewer/components/core/TemplateEngineProvider/TemplateEngineProvider.js +1 -2
- package/package.json +4 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { JSReportDesigner } from 'devexpress-reporting/dx-reportdesigner';
|
|
3
|
+
export type DxReportDesignerProps = {
|
|
3
4
|
reportUrl?: string;
|
|
4
5
|
height?: string;
|
|
5
6
|
width?: string;
|
|
@@ -7,5 +8,8 @@ type DxReportDesignerPropsType = {
|
|
|
7
8
|
developmentMode?: boolean;
|
|
8
9
|
children?: React.ReactNode | React.ReactNode[];
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
export type DxReportDesignerRef = {
|
|
12
|
+
instance: () => JSReportDesigner;
|
|
13
|
+
};
|
|
14
|
+
declare const DxReportDesigner: React.ForwardRefExoticComponent<DxReportDesignerProps & React.RefAttributes<DxReportDesignerRef>>;
|
|
11
15
|
export default DxReportDesigner;
|
|
@@ -12,21 +12,33 @@ const validChildComponents = {
|
|
|
12
12
|
'requestOptions': { component: RequestOptions },
|
|
13
13
|
'designerModelSettings': { component: DesignerModelSettings, children: designerModelSettingsValidChildren },
|
|
14
14
|
};
|
|
15
|
-
const DxReportDesigner = (props) => {
|
|
15
|
+
const DxReportDesigner = React.forwardRef(({ reportUrl, ...props }, ref) => {
|
|
16
16
|
const designerRef = React.useRef(null);
|
|
17
|
+
const [designerBinding, setDesignerBinding] = React.useState(null);
|
|
18
|
+
React.useImperativeHandle(ref, () => ({
|
|
19
|
+
instance() {
|
|
20
|
+
return designerBinding?.sender;
|
|
21
|
+
}
|
|
22
|
+
}), [designerBinding]);
|
|
17
23
|
React.useEffect(() => {
|
|
18
|
-
|
|
24
|
+
if (designerBinding) {
|
|
25
|
+
designerBinding.sender.OpenReport(reportUrl);
|
|
26
|
+
}
|
|
27
|
+
}, [reportUrl]);
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
const options = OptionsManager.getControlOptions({ ...props, reportUrl }, DxReportDesigner.propTypes, DxReportDesignerDefaultProps, validChildComponents);
|
|
19
30
|
const callbacks = options.callbacks;
|
|
20
31
|
options.callbacks = { designer: {}, preview: {} };
|
|
21
|
-
const binding = new JSReportDesignerBinding(options, OptionsManager.getEventRaiser(callbacks, () => binding
|
|
32
|
+
const binding = new JSReportDesignerBinding(options, OptionsManager.getEventRaiser(callbacks, () => binding?.sender));
|
|
22
33
|
binding.applyBindings(designerRef.current);
|
|
34
|
+
setDesignerBinding(binding);
|
|
23
35
|
return () => {
|
|
24
36
|
designerRef.current && ko.cleanNode(designerRef.current);
|
|
25
37
|
};
|
|
26
|
-
}, [
|
|
38
|
+
}, []);
|
|
27
39
|
return (React.createElement("div", { ref: designerRef, className: props.cssClass, style: { width: props.width || DxReportDesignerDefaultProps.width, height: props.height || DxReportDesignerDefaultProps.height } },
|
|
28
40
|
React.createElement("div", { "data-bind": "dxReportDesigner: $data" })));
|
|
29
|
-
};
|
|
41
|
+
});
|
|
30
42
|
DxReportDesigner.displayName = 'DxReportDesigner';
|
|
31
43
|
DxReportDesigner.propTypes = {
|
|
32
44
|
height: PropTypes.string,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import DxReportDesigner from './DxReportDesigner';
|
|
1
|
+
import DxReportDesigner, { DxReportDesignerRef, DxReportDesignerProps } from './DxReportDesigner';
|
|
2
2
|
import Callbacks from './options/Callbacks';
|
|
3
3
|
import DataSourceSettings from './options/DataSourceSettings';
|
|
4
4
|
import DesignerModelSettings from './options/DesignerModelSettings';
|
|
@@ -7,4 +7,5 @@ import RequestOptions from './options/RequestOptions';
|
|
|
7
7
|
import WizardSettings from './options/WizardSettings';
|
|
8
8
|
import ParameterEditingSettings from './options/ParameterEditingSettings';
|
|
9
9
|
export { Callbacks, DataSourceSettings, DesignerModelSettings, PreviewSettings, RequestOptions, WizardSettings, ParameterEditingSettings, DxReportDesigner };
|
|
10
|
+
export type { DxReportDesignerRef, DxReportDesignerProps };
|
|
10
11
|
export default DxReportDesigner;
|
|
@@ -52,7 +52,8 @@ const DxReportViewer = React.forwardRef(({ reportUrl, ...props }, ref) => {
|
|
|
52
52
|
disposeViewModelSubscription = viewModel?._viewModelEvents?.on(ViewModelChangedEvent, () => setViewModel({ ...viewModel }));
|
|
53
53
|
};
|
|
54
54
|
const controlOptions = OptionsManager.getControlOptions({ ...props, reportUrl }, DxReportViewer.propTypes, DxReportViewerDefaultProps, validChildComponents);
|
|
55
|
-
|
|
55
|
+
let binding;
|
|
56
|
+
binding = new JSReportViewerBinding({ ...controlOptions, callbacks: {} }, OptionsManager.getEventRaiser(controlOptions.callbacks, () => binding?.sender), false);
|
|
56
57
|
binding.applyBindings(viewerRef.current);
|
|
57
58
|
setViewerBinding(binding);
|
|
58
59
|
const model = binding.sender;
|
|
@@ -72,7 +73,7 @@ const DxReportViewer = React.forwardRef(({ reportUrl, ...props }, ref) => {
|
|
|
72
73
|
});
|
|
73
74
|
};
|
|
74
75
|
}, []);
|
|
75
|
-
return (React.createElement(TemplateEngineProvider, { templateEngine: props.templateEngine },
|
|
76
|
+
return (React.createElement(TemplateEngineProvider, { templateEngine: props.templateEngine ?? new TemplateEngine() },
|
|
76
77
|
React.createElement(AccessibilitySettingsProvider, { value: { accessibilityCompliant: !!viewModel?.accessibilityCompliant } },
|
|
77
78
|
React.createElement("div", { ref: viewerRef, className: props.cssClass, style: { width: props.width || DxReportViewerDefaultProps.width, height: props.height || DxReportViewerDefaultProps.height } },
|
|
78
79
|
React.createElement("div", { className: "dx-designer" }, !!viewModel && React.createElement(Template, { template: "dx-designer", data: viewModel }))))));
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import TreelistGroup from './TreelistGroup';
|
|
3
3
|
import { initTreeListBinding } from '@devexpress/analytics-core/widgets/treelist/_binding';
|
|
4
|
+
import { ViewModelChangedEvent } from '@devexpress/analytics-core/serializer/native/viewModels/viewModelGenerator';
|
|
4
5
|
const Treelist = ({ options, ...delegatedProps }) => {
|
|
5
6
|
const htmlRef = React.useRef();
|
|
6
7
|
const [viewModel, setViewModel] = React.useState();
|
|
7
8
|
React.useEffect(() => {
|
|
8
9
|
if (!htmlRef.current)
|
|
9
10
|
return () => { };
|
|
10
|
-
|
|
11
|
+
const disposables = [];
|
|
12
|
+
disposables.push(initTreeListBinding({
|
|
11
13
|
values: options,
|
|
12
14
|
element: htmlRef.current,
|
|
13
|
-
createChildContext: (vm) =>
|
|
14
|
-
|
|
15
|
+
createChildContext: (vm) => {
|
|
16
|
+
disposables.push(vm?._viewModelEvents?.on(ViewModelChangedEvent, () => setViewModel({ ...vm })));
|
|
17
|
+
setViewModel({ ...vm });
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
return () => disposables.forEach(disposable => disposable && disposable());
|
|
15
21
|
}, [options, htmlRef.current]);
|
|
16
22
|
return React.createElement("div", { ref: htmlRef, ...delegatedProps }, viewModel ? React.createElement(TreelistGroup, { data: viewModel }) : null);
|
|
17
23
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TemplateEngine } from '../../../core/template-engine';
|
|
3
2
|
export const TemplateEngineContext = React.createContext(null);
|
|
4
|
-
const TemplateEngineProvider = ({ templateEngine, children }) => (React.createElement(TemplateEngineContext.Provider, { value: templateEngine
|
|
3
|
+
const TemplateEngineProvider = ({ templateEngine, children }) => (React.createElement(TemplateEngineContext.Provider, { value: templateEngine }, children));
|
|
5
4
|
export default TemplateEngineProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devexpress-reporting-react",
|
|
3
|
-
"version": "24.1.
|
|
3
|
+
"version": "24.1.5",
|
|
4
4
|
"homepage": "https://www.devexpress.com/",
|
|
5
5
|
"bugs": "https://www.devexpress.com/support/",
|
|
6
6
|
"author": "Developer Express Inc.",
|
|
@@ -16,19 +16,19 @@
|
|
|
16
16
|
"main": "./index.js",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"prop-types": "^15.8.1",
|
|
19
|
-
"devexpress-reporting": "24.1.
|
|
19
|
+
"devexpress-reporting": "24.1.5"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@types/react": "^18.0.28",
|
|
23
23
|
"@types/react-dom": "^18.0.28",
|
|
24
|
-
"devextreme-react": "24.1.
|
|
24
|
+
"devextreme-react": "24.1.5",
|
|
25
25
|
"react": "^18.0.28",
|
|
26
26
|
"react-dom": "^18.0.28"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"shx": "^0.3.4",
|
|
30
30
|
"typescript": "~5.0.4",
|
|
31
|
-
"@devexpress/analytics-core": "24.1.
|
|
31
|
+
"@devexpress/analytics-core": "24.1.5"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"prebuild": "npx shx rm -rf dist && npx shx mkdir dist && npx shx cp README.md dist/ && npx shx cp package.json dist/",
|