@mcurros2/microm 1.1.1-0 → 1.1.2-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.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,13 +4,13 @@ var $b4te3$mantinecore = require("@mantine/core");
|
|
|
4
4
|
var $b4te3$mantineform = require("@mantine/form");
|
|
5
5
|
var $b4te3$react = require("react");
|
|
6
6
|
var $b4te3$dayjs = require("dayjs");
|
|
7
|
+
var $b4te3$exceljs = require("exceljs");
|
|
7
8
|
var $b4te3$tablericonsreact = require("@tabler/icons-react");
|
|
8
9
|
var $b4te3$mantinehooks = require("@mantine/hooks");
|
|
9
10
|
var $b4te3$mantineprism = require("@mantine/prism");
|
|
10
11
|
var $b4te3$dayjsplugincustomParseFormat = require("dayjs/plugin/customParseFormat");
|
|
11
12
|
var $b4te3$mantinedates = require("@mantine/dates");
|
|
12
13
|
var $b4te3$reactdom = require("react-dom");
|
|
13
|
-
var $b4te3$exceljs = require("exceljs");
|
|
14
14
|
var $b4te3$mantinespotlight = require("@mantine/spotlight");
|
|
15
15
|
var $b4te3$googlemapsjsapiloader = require("@googlemaps/js-api-loader");
|
|
16
16
|
var $b4te3$googlemapsmarkerclusterer = require("@googlemaps/markerclusterer");
|
|
@@ -2771,9 +2771,38 @@ $parcel$export(module.exports, "convertRecordsToArrayOfValuesObject", function (
|
|
|
2771
2771
|
$parcel$export(module.exports, "mapRecordToType", function () { return $5be4b35862a9dc4d$export$c7f39facb44b7cd1; });
|
|
2772
2772
|
$parcel$export(module.exports, "mapDataResultToType", function () { return $5be4b35862a9dc4d$export$713b0df7740fcd37; });
|
|
2773
2773
|
$parcel$export(module.exports, "exportToCSV", function () { return $5be4b35862a9dc4d$export$60d51d3f7c4f92d8; });
|
|
2774
|
+
$parcel$export(module.exports, "exportToExcel", function () { return $5be4b35862a9dc4d$export$a04f965200623e61; });
|
|
2774
2775
|
$parcel$export(module.exports, "extractArrayFromSelectedRecords", function () { return $5be4b35862a9dc4d$export$80885f6f0cd6803f; });
|
|
2775
2776
|
|
|
2777
|
+
|
|
2776
2778
|
var $iKzSR = parcelRequire("iKzSR");
|
|
2779
|
+
var $5be4b35862a9dc4d$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2780
|
+
function adopt(value) {
|
|
2781
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
2782
|
+
resolve(value);
|
|
2783
|
+
});
|
|
2784
|
+
}
|
|
2785
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
2786
|
+
function fulfilled(value) {
|
|
2787
|
+
try {
|
|
2788
|
+
step(generator.next(value));
|
|
2789
|
+
} catch (e) {
|
|
2790
|
+
reject(e);
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
function rejected(value) {
|
|
2794
|
+
try {
|
|
2795
|
+
step(generator["throw"](value));
|
|
2796
|
+
} catch (e) {
|
|
2797
|
+
reject(e);
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
function step(result) {
|
|
2801
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2802
|
+
}
|
|
2803
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2804
|
+
});
|
|
2805
|
+
};
|
|
2777
2806
|
function $5be4b35862a9dc4d$export$86f54f62aa7a7514(str) {
|
|
2778
2807
|
return str// Replace spaces, accents, or '.' followed by any character with the uppercase version of the character
|
|
2779
2808
|
.replace(/[\s.\u00C0-\u00FF]+(.)/g, (m, chr)=>chr.toUpperCase())// Ensure the first character is lowercase
|
|
@@ -2863,32 +2892,49 @@ function $5be4b35862a9dc4d$export$60d51d3f7c4f92d8(viewResult, notExportableColu
|
|
|
2863
2892
|
// MMC: cleanup
|
|
2864
2893
|
document.body.removeChild(linkElement);
|
|
2865
2894
|
URL.revokeObjectURL(csv_url);
|
|
2866
|
-
}
|
|
2895
|
+
} else console.error("Your browser does not support exporting data.");
|
|
2867
2896
|
} catch (ex) {
|
|
2897
|
+
console.error("exportToCSV", ex);
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
function $5be4b35862a9dc4d$export$a04f965200623e61(data, notExportableColumns, sheetNames) {
|
|
2901
|
+
return $5be4b35862a9dc4d$var$__awaiter(this, void 0, void 0, function*() {
|
|
2902
|
+
// MMC: some security checks can cause an exception
|
|
2868
2903
|
try {
|
|
2869
|
-
|
|
2870
|
-
|
|
2904
|
+
if (window.Blob && window.URL) {
|
|
2905
|
+
const currentDate = new Date();
|
|
2906
|
+
const filename = `export-${currentDate.getFullYear()}${(currentDate.getDate() + "").padStart(2, "0")}${(currentDate.getMonth() + 1 + "").padStart(2, "0")}_${(currentDate.getHours() + "").padStart(2, "0")}${(currentDate.getMinutes() + "").padStart(2, "0")}${(currentDate.getSeconds() + "").padStart(2, "0")}.xlsx`;
|
|
2907
|
+
const workbook = new (0, ($parcel$interopDefault($b4te3$exceljs))).Workbook();
|
|
2908
|
+
data.forEach((result, index)=>{
|
|
2909
|
+
const worksheet = workbook.addWorksheet(sheetNames ? sheetNames[index] : `Data ${index + 1}`);
|
|
2910
|
+
const columns = result.Header.map((header, index)=>(notExportableColumns === null || notExportableColumns === void 0 ? void 0 : notExportableColumns.includes(index)) ? null : {
|
|
2911
|
+
header: header,
|
|
2912
|
+
key: header
|
|
2913
|
+
}).filter((column)=>column !== null);
|
|
2914
|
+
worksheet.columns = columns;
|
|
2915
|
+
result.records.forEach((row)=>{
|
|
2916
|
+
const filteredRow = row.filter((_, index)=>!(notExportableColumns === null || notExportableColumns === void 0 ? void 0 : notExportableColumns.includes(index)));
|
|
2917
|
+
worksheet.addRow(filteredRow);
|
|
2918
|
+
});
|
|
2919
|
+
});
|
|
2920
|
+
const buffer = yield workbook.xlsx.writeBuffer();
|
|
2871
2921
|
const blob = new Blob([
|
|
2872
|
-
|
|
2922
|
+
buffer
|
|
2873
2923
|
], {
|
|
2874
|
-
type: "
|
|
2924
|
+
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
2875
2925
|
});
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
document.body.removeChild(linkElement);
|
|
2887
|
-
}
|
|
2888
|
-
} catch (ex2) {
|
|
2889
|
-
console.log("Your browser does not support exporting data.");
|
|
2926
|
+
const url = URL.createObjectURL(blob);
|
|
2927
|
+
const a = document.createElement("a");
|
|
2928
|
+
a.href = url;
|
|
2929
|
+
a.download = filename;
|
|
2930
|
+
a.click();
|
|
2931
|
+
document.body.removeChild(a);
|
|
2932
|
+
URL.revokeObjectURL(url);
|
|
2933
|
+
} else console.error("Your browser does not support exporting data.");
|
|
2934
|
+
} catch (ex) {
|
|
2935
|
+
console.error("exportToExcel", ex);
|
|
2890
2936
|
}
|
|
2891
|
-
}
|
|
2937
|
+
});
|
|
2892
2938
|
}
|
|
2893
2939
|
function $5be4b35862a9dc4d$export$80885f6f0cd6803f(selectedKeys, property) {
|
|
2894
2940
|
return selectedKeys.map((item)=>item[property]);
|
|
@@ -33389,8 +33435,8 @@ function $42d3a2ac8447d6e0$export$f77741f33c48605(props, stateProps) {
|
|
|
33389
33435
|
// MMC: this is special here for the Grid component as it uses columns and records
|
|
33390
33436
|
const handleExport = (0, $b4te3$react.useCallback)(()=>$42d3a2ac8447d6e0$var$__awaiter(this, void 0, void 0, function*() {
|
|
33391
33437
|
if (!(rows === null || rows === void 0 ? void 0 : rows.length) || !(columns === null || columns === void 0 ? void 0 : columns.length)) return;
|
|
33392
|
-
const
|
|
33393
|
-
const filename = `export-${
|
|
33438
|
+
const currentDate = new Date();
|
|
33439
|
+
const filename = `export-${currentDate.getFullYear()}${(currentDate.getDate() + "").padStart(2, "0")}${(currentDate.getMonth() + 1 + "").padStart(2, "0")}_${(currentDate.getHours() + "").padStart(2, "0")}${(currentDate.getMinutes() + "").padStart(2, "0")}${(currentDate.getSeconds() + "").padStart(2, "0")}.xlsx`;
|
|
33394
33440
|
const workbook = new (0, ($parcel$interopDefault($b4te3$exceljs))).Workbook();
|
|
33395
33441
|
const worksheet = workbook.addWorksheet("Data");
|
|
33396
33442
|
// headers
|
|
@@ -33420,7 +33466,7 @@ function $42d3a2ac8447d6e0$export$f77741f33c48605(props, stateProps) {
|
|
|
33420
33466
|
URL.revokeObjectURL(link.href);
|
|
33421
33467
|
}
|
|
33422
33468
|
} catch (ex) {
|
|
33423
|
-
|
|
33469
|
+
console.error("Your browser does not support exporting data.");
|
|
33424
33470
|
}
|
|
33425
33471
|
}), [
|
|
33426
33472
|
columns,
|
|
@@ -36075,7 +36121,9 @@ function $40c00e2ecacb5ae0$export$2d2c672e82add59e(props, stateProps) {
|
|
|
36075
36121
|
]);
|
|
36076
36122
|
const handleExport = (0, $b4te3$react.useCallback)(()=>{
|
|
36077
36123
|
if (!viewResult) return;
|
|
36078
|
-
(0, $7T941.
|
|
36124
|
+
(0, $7T941.exportToExcel)([
|
|
36125
|
+
viewResult
|
|
36126
|
+
], notExportableColumns);
|
|
36079
36127
|
}, [
|
|
36080
36128
|
notExportableColumns,
|
|
36081
36129
|
viewResult
|
|
@@ -45557,6 +45605,7 @@ parcelRegister("ixSh0", function(module, exports) {
|
|
|
45557
45605
|
|
|
45558
45606
|
$parcel$export(module.exports, "useExportToExcel", function () { return $d805689a29a5dad3$export$c319aff9ea4ad6e; });
|
|
45559
45607
|
|
|
45608
|
+
var $7T941 = parcelRequire("7T941");
|
|
45560
45609
|
var $d805689a29a5dad3$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
45561
45610
|
function adopt(value) {
|
|
45562
45611
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -45585,35 +45634,12 @@ var $d805689a29a5dad3$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
45585
45634
|
});
|
|
45586
45635
|
};
|
|
45587
45636
|
function $d805689a29a5dad3$export$c319aff9ea4ad6e(props) {
|
|
45588
|
-
const { data: data, dataResultNames: dataResultNames } = props;
|
|
45589
|
-
const
|
|
45590
|
-
|
|
45591
|
-
const filename = `export-${fechaActual.getFullYear()}${(fechaActual.getDate() + "").padStart(2, "0")}${(fechaActual.getMonth() + 1 + "").padStart(2, "0")}_${(fechaActual.getHours() + "").padStart(2, "0")}${(fechaActual.getMinutes() + "").padStart(2, "0")}${(fechaActual.getSeconds() + "").padStart(2, "0")}.xlsx`;
|
|
45592
|
-
const workbook = new (0, ($parcel$interopDefault($b4te3$exceljs))).Workbook();
|
|
45593
|
-
data.forEach((result, index)=>{
|
|
45594
|
-
const worksheet = workbook.addWorksheet(dataResultNames ? dataResultNames[index] : `Data ${index + 1}`);
|
|
45595
|
-
const columns = result.Header.map((header)=>({
|
|
45596
|
-
header: header,
|
|
45597
|
-
key: header
|
|
45598
|
-
}));
|
|
45599
|
-
worksheet.columns = columns;
|
|
45600
|
-
result.records.forEach((row)=>worksheet.addRow(row));
|
|
45601
|
-
});
|
|
45602
|
-
const buffer = yield workbook.xlsx.writeBuffer();
|
|
45603
|
-
const blob = new Blob([
|
|
45604
|
-
buffer
|
|
45605
|
-
], {
|
|
45606
|
-
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
45607
|
-
});
|
|
45608
|
-
const url = URL.createObjectURL(blob);
|
|
45609
|
-
const a = document.createElement("a");
|
|
45610
|
-
a.href = url;
|
|
45611
|
-
a.download = filename;
|
|
45612
|
-
a.click();
|
|
45613
|
-
URL.revokeObjectURL(url);
|
|
45637
|
+
const { data: data, dataResultNames: dataResultNames, notExportableColumns: notExportableColumns } = props;
|
|
45638
|
+
const exportToExcelWrapper = ()=>$d805689a29a5dad3$var$__awaiter(this, void 0, void 0, function*() {
|
|
45639
|
+
yield (0, $7T941.exportToExcel)(data, notExportableColumns, dataResultNames);
|
|
45614
45640
|
});
|
|
45615
45641
|
return {
|
|
45616
|
-
exportToExcel:
|
|
45642
|
+
exportToExcel: exportToExcelWrapper
|
|
45617
45643
|
};
|
|
45618
45644
|
}
|
|
45619
45645
|
|