turbogui-angular 20.12.0 → 20.13.0
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.
|
@@ -1290,6 +1290,29 @@ class DialogService extends SingletoneStrictClass {
|
|
|
1290
1290
|
this._renderer.removeChild(document.body, hiddenInput);
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Show a native OS file download dialog to let the user download a file from a provided binary blob data.
|
|
1295
|
+
*
|
|
1296
|
+
* @param blob The binary data containing the file to download. It must be a Blob object
|
|
1297
|
+
* @param fileName The file name to be shown in the download dialog
|
|
1298
|
+
*
|
|
1299
|
+
* @returns void
|
|
1300
|
+
*/
|
|
1301
|
+
addFileDownloadBlobDialog(blob, fileName) {
|
|
1302
|
+
if (this._isEnabled) {
|
|
1303
|
+
const safeFileName = fileName
|
|
1304
|
+
.replace(/[\/\\:*?"<>|\s]/g, '-') // Replace invalid chars and spaces with -
|
|
1305
|
+
.replace(/\.+/g, '.') // Replace multiple dots with single dot
|
|
1306
|
+
.replace(/\.([^.]+)$/, '.$1'); // Ensure only one dot before extension
|
|
1307
|
+
const url = window.URL.createObjectURL(blob);
|
|
1308
|
+
const a = document.createElement('a');
|
|
1309
|
+
a.href = url;
|
|
1310
|
+
a.download = safeFileName;
|
|
1311
|
+
document.body.appendChild(a);
|
|
1312
|
+
a.click();
|
|
1313
|
+
a.remove();
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1293
1316
|
/**
|
|
1294
1317
|
* Show a dialog with an iframe inside it, to show external web pages or web applications.
|
|
1295
1318
|
*
|