@fluxo-dev/shell-reporting 26.2.2 → 26.2.4
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 +93 -75
- package/package.json +4 -4
package/index.esm.js
CHANGED
|
@@ -4213,12 +4213,35 @@ const ReportDesigner = props => {
|
|
|
4213
4213
|
const [designerLoaded, setDesignerLoaded] = useState(false);
|
|
4214
4214
|
const designerInstanceRef = useRef(null);
|
|
4215
4215
|
const shellSessionContext = useContext(ShellSessionContext);
|
|
4216
|
+
const [showCloseConfirmModal, setShowCloseConfirmModal] = useState(false);
|
|
4216
4217
|
// Use reportId from props if available, otherwise use id from params
|
|
4217
4218
|
const effectiveReportId = (_a = props.reportId) !== null && _a !== void 0 ? _a : id ? +id : undefined;
|
|
4218
4219
|
const requestOptions = {
|
|
4219
4220
|
host: FluxoClientSys.Instance.clientConfig.fluxoInstanceUrl.replace('/api', ''),
|
|
4220
4221
|
getDesignerModelAction: "/DXXRD/GetDesignerModel"
|
|
4221
4222
|
};
|
|
4223
|
+
// Verifica se ci sono modifiche non salvate controllando lo stato del pulsante "Salva"
|
|
4224
|
+
const hasUnsavedChanges = useCallback(() => {
|
|
4225
|
+
const saveButton = document.querySelector('.dxrd-image-save');
|
|
4226
|
+
if (!saveButton) return false;
|
|
4227
|
+
const menuItem = saveButton.closest('.dxrd-menu-item');
|
|
4228
|
+
return menuItem ? !menuItem.classList.contains('dxrd-disabled-button') : false;
|
|
4229
|
+
}, []);
|
|
4230
|
+
// Gestisce la richiesta di chiusura del designer
|
|
4231
|
+
const requestClose = useCallback(() => {
|
|
4232
|
+
var _a;
|
|
4233
|
+
if (props.mode === 'designer' && hasUnsavedChanges()) {
|
|
4234
|
+
setShowCloseConfirmModal(true);
|
|
4235
|
+
return;
|
|
4236
|
+
}
|
|
4237
|
+
(_a = props.onBack) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
4238
|
+
}, [props, hasUnsavedChanges]);
|
|
4239
|
+
// Conferma la chiusura senza salvare
|
|
4240
|
+
const confirmClose = useCallback(() => {
|
|
4241
|
+
var _a;
|
|
4242
|
+
setShowCloseConfirmModal(false);
|
|
4243
|
+
(_a = props.onBack) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
4244
|
+
}, [props]);
|
|
4222
4245
|
useEffect(() => {
|
|
4223
4246
|
if (props.mode === 'designer') {
|
|
4224
4247
|
shellSessionContext.enterFocusMode();
|
|
@@ -4314,43 +4337,67 @@ const ReportDesigner = props => {
|
|
|
4314
4337
|
})]
|
|
4315
4338
|
});
|
|
4316
4339
|
}
|
|
4317
|
-
return jsxs(
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4340
|
+
return jsxs(Fragment, {
|
|
4341
|
+
children: [jsxs(Box, {
|
|
4342
|
+
pos: 'relative',
|
|
4343
|
+
children: [jsx(LoadingOverlay, {
|
|
4344
|
+
visible: !designerLoaded
|
|
4345
|
+
}), props.showBackButton && jsx(Group, {
|
|
4346
|
+
px: "sm",
|
|
4347
|
+
h: 48,
|
|
4348
|
+
justify: "space-between",
|
|
4349
|
+
style: {
|
|
4350
|
+
borderBottom: '1px solid var(--mantine-color-gray-3)'
|
|
4351
|
+
},
|
|
4352
|
+
children: jsxs(Group, {
|
|
4353
|
+
gap: 8,
|
|
4354
|
+
children: [jsx(ActionIcon, {
|
|
4355
|
+
variant: "subtle",
|
|
4356
|
+
color: "gray",
|
|
4357
|
+
onClick: requestClose,
|
|
4358
|
+
children: jsx(IconArrowLeft, {
|
|
4359
|
+
size: 18
|
|
4360
|
+
})
|
|
4361
|
+
}), jsx(Text, {
|
|
4362
|
+
size: "sm",
|
|
4363
|
+
fw: 500,
|
|
4364
|
+
children: "Torna ai report"
|
|
4365
|
+
})]
|
|
4366
|
+
})
|
|
4367
|
+
}), jsx("div", {
|
|
4368
|
+
style: {
|
|
4369
|
+
width: "100%",
|
|
4370
|
+
height: props.showBackButton ? "calc(100vh - 234px)" : "calc(100vh - 48px)"
|
|
4371
|
+
},
|
|
4372
|
+
children: jsx("div", {
|
|
4373
|
+
ref: designerRef
|
|
4374
|
+
})
|
|
4375
|
+
})]
|
|
4376
|
+
}), jsx(Modal, {
|
|
4377
|
+
opened: showCloseConfirmModal,
|
|
4378
|
+
onClose: () => setShowCloseConfirmModal(false),
|
|
4379
|
+
title: "Modifiche non salvate",
|
|
4380
|
+
size: "md",
|
|
4381
|
+
centered: true,
|
|
4382
|
+
children: jsxs(Stack, {
|
|
4383
|
+
gap: "lg",
|
|
4384
|
+
children: [jsx(Text, {
|
|
4341
4385
|
size: "sm",
|
|
4342
|
-
|
|
4343
|
-
children: "
|
|
4386
|
+
c: "dimmed",
|
|
4387
|
+
children: "Sono presenti modifiche non salvate. Se esci ora, le modifiche correnti andranno perse."
|
|
4388
|
+
}), jsxs(Group, {
|
|
4389
|
+
justify: "flex-end",
|
|
4390
|
+
children: [jsx(Button, {
|
|
4391
|
+
variant: "default",
|
|
4392
|
+
onClick: () => setShowCloseConfirmModal(false),
|
|
4393
|
+
children: "Annulla"
|
|
4394
|
+
}), jsx(Button, {
|
|
4395
|
+
color: "red",
|
|
4396
|
+
onClick: confirmClose,
|
|
4397
|
+
children: "Esci senza salvare"
|
|
4398
|
+
})]
|
|
4344
4399
|
})]
|
|
4345
4400
|
})
|
|
4346
|
-
}), jsx("div", {
|
|
4347
|
-
style: {
|
|
4348
|
-
width: "100%",
|
|
4349
|
-
height: props.showBackButton ? "calc(100vh - 234px)" : "calc(100vh - 48px)"
|
|
4350
|
-
},
|
|
4351
|
-
children: jsx("div", {
|
|
4352
|
-
ref: designerRef
|
|
4353
|
-
})
|
|
4354
4401
|
})]
|
|
4355
4402
|
});
|
|
4356
4403
|
};
|
|
@@ -4756,32 +4803,6 @@ function ReportsManager(props) {
|
|
|
4756
4803
|
setSelectedCategoryKey(`${firstCategory.scope}-${firstCategory.packageName}-${firstCategory.namespace}-${firstCategory.reportTypeId}`);
|
|
4757
4804
|
}
|
|
4758
4805
|
}, [reportsList, selectedCategoryKey]);
|
|
4759
|
-
// Intercetta la navigazione nel router (back button del browser)
|
|
4760
|
-
useEffect(() => {
|
|
4761
|
-
if (!reportEditorState.show) return;
|
|
4762
|
-
const handlePopState = () => {
|
|
4763
|
-
var _a, _b;
|
|
4764
|
-
if (!isClosingRef.current) {
|
|
4765
|
-
const confirmExit = window.confirm('Sei sicuro di voler uscire dall\'editor? Le modifiche non salvate andranno perse.');
|
|
4766
|
-
if (!confirmExit) {
|
|
4767
|
-
window.history.pushState(null, '', window.location.href);
|
|
4768
|
-
} else {
|
|
4769
|
-
setReportEditorState({
|
|
4770
|
-
show: false,
|
|
4771
|
-
reportId: undefined
|
|
4772
|
-
});
|
|
4773
|
-
(_b = (_a = props.shellPageRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.openSidebar();
|
|
4774
|
-
refresh();
|
|
4775
|
-
}
|
|
4776
|
-
}
|
|
4777
|
-
};
|
|
4778
|
-
// Aggiungi uno stato alla history per intercettare il back button
|
|
4779
|
-
window.history.pushState(null, '', window.location.href);
|
|
4780
|
-
window.addEventListener('popstate', handlePopState);
|
|
4781
|
-
return () => {
|
|
4782
|
-
window.removeEventListener('popstate', handlePopState);
|
|
4783
|
-
};
|
|
4784
|
-
}, [reportEditorState.show, props.shellPageRef]);
|
|
4785
4806
|
const refresh = () => {
|
|
4786
4807
|
FluxoClientSys.Instance.reporting.getReportsList().then(res => {
|
|
4787
4808
|
setReportsList(res);
|
|
@@ -4844,20 +4865,17 @@ function ReportsManager(props) {
|
|
|
4844
4865
|
};
|
|
4845
4866
|
const handleCloseReportEditor = useCallback(() => {
|
|
4846
4867
|
var _a, _b;
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
isClosingRef.current = false;
|
|
4859
|
-
}, 100);
|
|
4860
|
-
}
|
|
4868
|
+
isClosingRef.current = true;
|
|
4869
|
+
setReportEditorState({
|
|
4870
|
+
show: false,
|
|
4871
|
+
reportId: undefined
|
|
4872
|
+
});
|
|
4873
|
+
(_b = (_a = props.shellPageRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.openSidebar();
|
|
4874
|
+
refresh();
|
|
4875
|
+
// Reset del flag dopo un breve delay
|
|
4876
|
+
setTimeout(() => {
|
|
4877
|
+
isClosingRef.current = false;
|
|
4878
|
+
}, 100);
|
|
4861
4879
|
}, [props.shellPageRef]);
|
|
4862
4880
|
const deleteReport = () => {
|
|
4863
4881
|
if (!(selectedReport === null || selectedReport === void 0 ? void 0 : selectedReport.id)) return;
|
|
@@ -6408,7 +6426,7 @@ $$3({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('u
|
|
|
6408
6426
|
});
|
|
6409
6427
|
|
|
6410
6428
|
/** Valore speciale usato per indicare "stampa dal browser (anteprima)" */
|
|
6411
|
-
const CLIENT_PRINTER_VALUE =
|
|
6429
|
+
const CLIENT_PRINTER_VALUE = 'client-printer';
|
|
6412
6430
|
// ─────────────────────────────────────────────
|
|
6413
6431
|
// Preview placeholder del documento selezionato
|
|
6414
6432
|
// ─────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluxo-dev/shell-reporting",
|
|
3
|
-
"version": "26.2.
|
|
3
|
+
"version": "26.2.4",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": "^18.3.1",
|
|
6
6
|
"@mantine/core": "^7.12.2",
|
|
7
7
|
"react-router-dom": "^6.11.2",
|
|
8
8
|
"react-redux": "^8.0.5",
|
|
9
9
|
"@reduxjs/toolkit": "^1.9.1",
|
|
10
|
-
"@fluxo-dev/api-client-base": "^26.2.
|
|
11
|
-
"@fluxo-dev/state": "^26.2.
|
|
12
|
-
"@fluxo-dev/ui-components": "^26.2.
|
|
10
|
+
"@fluxo-dev/api-client-base": "^26.2.4",
|
|
11
|
+
"@fluxo-dev/state": "^26.2.4",
|
|
12
|
+
"@fluxo-dev/ui-components": "^26.2.4",
|
|
13
13
|
"@devexpress/analytics-core": "23.1.3",
|
|
14
14
|
"devexpress-reporting": "23.1.3",
|
|
15
15
|
"devextreme": "23.1.3",
|