@topconsultnpm/sdkui-react-beta 6.8.1 → 6.8.3

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.
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ResultTypes } from '@topconsultnpm/sdk-ts-beta';
3
+ export type ResultInfo = {
4
+ rowIndex: number;
5
+ id1: number;
6
+ id2: number;
7
+ resultType: ResultTypes;
8
+ description?: any;
9
+ };
10
+ interface ITMResultDialogProps {
11
+ result: ResultInfo[];
12
+ id1Caption: string | undefined;
13
+ id2Caption: string | undefined;
14
+ title: string;
15
+ }
16
+ declare const TMResultDialog: React.FC<ITMResultDialogProps>;
17
+ export default TMResultDialog;
18
+ export declare class TMResultManager {
19
+ static show(result: ResultInfo[], title: string, id1Caption: string | undefined, id2Caption: string | undefined): void;
20
+ }
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ResultTypes } from '@topconsultnpm/sdk-ts-beta';
3
+ import { DataGrid } from 'devextreme-react';
4
+ import { Column, HeaderFilter, Pager, Paging, Scrolling } from 'devextreme-react/cjs/data-grid';
5
+ import ReactDOM from 'react-dom/client';
6
+ import { IconSuccessCirlce, IconWarning, IconCloseCircle, IconInfo, SDKUI_Globals, SDKUI_Localizator } from '../../helper';
7
+ import { TMColors } from '../../utils/theme';
8
+ import ShowAlert from '../base/TMAlert';
9
+ import { TMDeviceProvider } from '../base/TMDeviceProvider';
10
+ import TMLayoutContainer from '../base/TMLayout';
11
+ import TMModal from '../base/TMModal';
12
+ const cellRender = (cellData) => {
13
+ const resultType = cellData.data.resultType;
14
+ switch (resultType) {
15
+ case ResultTypes.SUCCESS: return _jsx(IconSuccessCirlce, { fontSize: 22, color: TMColors.success });
16
+ case ResultTypes.WARNING: return _jsx(IconWarning, { fontSize: 22, color: TMColors.warning });
17
+ case ResultTypes.ERROR: return _jsx(IconCloseCircle, { fontSize: 22, color: TMColors.error });
18
+ case ResultTypes.INFO: return _jsx(IconInfo, { fontSize: 22, color: TMColors.info });
19
+ default: return _jsx("div", { children: cellData.text });
20
+ }
21
+ };
22
+ const TMResultDialog = ({ title, result, id1Caption, id2Caption }) => {
23
+ return (_jsx(TMModal, { height: '60%', width: '60%', title: `Esito operazione - ${title}`, children: _jsxs(TMLayoutContainer, { children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', gap: '5px', padding: '3px', justifyContent: 'center', alignItems: 'center' }, children: [_jsx("p", { children: `Documenti elaborati: ${result.length}` }), _jsx(IconSuccessCirlce, { fontSize: 22, color: TMColors.success }), _jsx("p", { children: result.filter(o => o.resultType == ResultTypes.SUCCESS).length ?? 0 }), _jsx(IconWarning, { fontSize: 22, color: TMColors.warning }), _jsx("p", { children: result.filter(o => o.resultType == ResultTypes.WARNING).length ?? 0 }), _jsx(IconCloseCircle, { fontSize: 22, color: TMColors.error }), _jsx("p", { children: result.filter(o => o.resultType == ResultTypes.ERROR).length ?? 0 })] }), _jsxs(DataGrid, { dataSource: result, showColumnLines: SDKUI_Globals.dataGridShowColumnLines, showRowLines: SDKUI_Globals.dataGridShowRowLines, keyExpr: "rowIndex", width: "100%", height: "100%", columnResizingMode: "widget", allowColumnResizing: true, columnAutoWidth: true, children: [_jsx(Column, { dataField: 'resultType', caption: '', allowResizing: true, allowSorting: true, cellRender: cellRender }), _jsx(Column, { dataField: 'id1', caption: id1Caption }), _jsx(Column, { dataField: 'id2', caption: id2Caption }), _jsx(Column, { dataField: 'description', allowResizing: true, caption: SDKUI_Localizator.Description, allowSorting: true }), _jsx(Paging, { enabled: true, pageSize: 30 }), _jsx(Pager, { visible: true, showInfo: true, showNavigationButtons: true }), _jsx(Scrolling, { mode: 'standard', useNative: SDKUI_Globals.dataGridUseNativeScrollbar }), _jsx(HeaderFilter, { visible: true })] })] }) }));
24
+ };
25
+ export default TMResultDialog;
26
+ export class TMResultManager {
27
+ static show(result, title, id1Caption, id2Caption) {
28
+ const warningsCount = result.filter(o => o.resultType == ResultTypes.WARNING).length;
29
+ const errorsCount = result.filter(o => o.resultType == ResultTypes.ERROR).length;
30
+ if (warningsCount <= 0 && errorsCount <= 0) {
31
+ ShowAlert({ message: "Operazione completata con successo", mode: 'success', duration: 3000, title: title });
32
+ return;
33
+ }
34
+ let container = document.createElement('div');
35
+ document.body.appendChild(container);
36
+ const root = ReactDOM.createRoot(container);
37
+ root.render(_jsx(TMDeviceProvider, { children: _jsx(TMResultDialog, { title: title, result: result, id1Caption: id1Caption, id2Caption: id2Caption }) }));
38
+ }
39
+ }
@@ -44,6 +44,7 @@ export { default as TMLoginForm } from "./forms/TMLoginForm";
44
44
  export { default as TMSaveForm } from "./forms/TMSaveForm";
45
45
  export { default as TMApplyForm } from "./forms/TMApplyForm";
46
46
  export { default as TMChooserForm } from "./forms/TMChooserForm";
47
+ export * from './forms/TMResultDialog';
47
48
  export { default as TMPage } from "./pages/TMPage";
48
49
  export { default as SettingsAppearance } from "./settings/SettingsAppearance";
49
50
  export * from "./viewers/TMTidViewer";
@@ -52,6 +52,7 @@ export { default as TMLoginForm } from "./forms/TMLoginForm";
52
52
  export { default as TMSaveForm } from "./forms/TMSaveForm";
53
53
  export { default as TMApplyForm } from "./forms/TMApplyForm";
54
54
  export { default as TMChooserForm } from "./forms/TMChooserForm";
55
+ export * from './forms/TMResultDialog';
55
56
  //page
56
57
  export { default as TMPage } from "./pages/TMPage";
57
58
  //settings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.8.1",
3
+ "version": "6.8.3",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -28,7 +28,7 @@
28
28
  "lib"
29
29
  ],
30
30
  "dependencies": {
31
- "@topconsultnpm/sdk-ts-beta": "^6.8.0",
31
+ "@topconsultnpm/sdk-ts-beta": "^6.8.1",
32
32
  "buffer": "^6.0.3",
33
33
  "devextreme": "24.2.3",
34
34
  "devextreme-react": "24.2.3",