@mcurros2/microm 1.1.1-0 → 1.1.3-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 +100 -62
- 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,
|
|
@@ -35924,7 +35970,7 @@ var $40c00e2ecacb5ae0$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
35924
35970
|
});
|
|
35925
35971
|
};
|
|
35926
35972
|
function $40c00e2ecacb5ae0$export$2d2c672e82add59e(props, stateProps) {
|
|
35927
|
-
const { entity: entity, parentKeys: parentKeys, viewName: viewName, limit: limit, onSelectionChanged: onSelectionChanged, modalFormSize: modalFormSize, labels: labels, saveFormBeforeAdd: saveFormBeforeAdd, parentFormAPI: parentFormAPI, allwaysRefreshOnEntityClose: allwaysRefreshOnEntityClose, notExportableColumns: notExportableColumns, itemsPerPage: itemsPerPage, onActionExecuted: onActionExecuted, convertResultToLocaleString: convertResultToLocaleString, onDataRefresh: onDataRefresh } = props;
|
|
35973
|
+
const { entity: entity, parentKeys: parentKeys, viewName: viewName, limit: limit, onSelectionChanged: onSelectionChanged, modalFormSize: modalFormSize, onModalSaved: onModalSaved, labels: labels, saveFormBeforeAdd: saveFormBeforeAdd, parentFormAPI: parentFormAPI, allwaysRefreshOnEntityClose: allwaysRefreshOnEntityClose, notExportableColumns: notExportableColumns, itemsPerPage: itemsPerPage, onActionExecuted: onActionExecuted, convertResultToLocaleString: convertResultToLocaleString, onDataRefresh: onDataRefresh } = props;
|
|
35928
35974
|
const localeFormat = (0, $a2vzY.useLocaleFormat)({});
|
|
35929
35975
|
const { setRefresh: setRefresh, setSearchText: setSearchText, executeViewState: executeViewState } = stateProps;
|
|
35930
35976
|
const selectedRecords = (0, $b4te3$react.useRef)([]);
|
|
@@ -35936,19 +35982,31 @@ function $40c00e2ecacb5ae0$export$2d2c672e82add59e(props, stateProps) {
|
|
|
35936
35982
|
const [displayedItemsCount, setDisplayedItemsCount] = (0, $b4te3$react.useState)(itemsPerPage);
|
|
35937
35983
|
const [viewResult, setViewResult] = (0, $b4te3$react.useState)(null);
|
|
35938
35984
|
// MMC: we can't use callbacks here because we need to use the latest values of the state variables
|
|
35939
|
-
|
|
35985
|
+
const internalRefresh = (0, $b4te3$react.useCallback)(()=>{
|
|
35940
35986
|
setRefresh((prev)=>!prev);
|
|
35941
|
-
}
|
|
35942
|
-
|
|
35987
|
+
}, [
|
|
35988
|
+
setRefresh
|
|
35989
|
+
]);
|
|
35990
|
+
const handleRefresh = (0, $b4te3$react.useCallback)((search_text)=>{
|
|
35943
35991
|
setSearchText(search_text);
|
|
35944
35992
|
setRefresh((prev)=>!prev);
|
|
35945
|
-
}
|
|
35946
|
-
|
|
35947
|
-
|
|
35948
|
-
|
|
35949
|
-
|
|
35993
|
+
}, [
|
|
35994
|
+
setRefresh,
|
|
35995
|
+
setSearchText
|
|
35996
|
+
]);
|
|
35997
|
+
const handleModalSaved = (0, $b4te3$react.useCallback)((new_status)=>$40c00e2ecacb5ae0$var$__awaiter(this, void 0, void 0, function*() {
|
|
35998
|
+
if (!new_status.error && !new_status.loading && new_status.data) internalRefresh();
|
|
35999
|
+
if (onModalSaved) yield onModalSaved(new_status);
|
|
36000
|
+
}), [
|
|
36001
|
+
internalRefresh,
|
|
36002
|
+
onModalSaved
|
|
36003
|
+
]);
|
|
36004
|
+
const handleAllwaysRefreshOnClose = (0, $b4te3$react.useCallback)(()=>{
|
|
35950
36005
|
if (allwaysRefreshOnEntityClose) internalRefresh();
|
|
35951
|
-
}
|
|
36006
|
+
}, [
|
|
36007
|
+
allwaysRefreshOnEntityClose,
|
|
36008
|
+
internalRefresh
|
|
36009
|
+
]);
|
|
35952
36010
|
const UIAPI = (0, $1uAlg.useEntityUI)({
|
|
35953
36011
|
entity: entity,
|
|
35954
36012
|
parentKeys: parentKeys,
|
|
@@ -36075,7 +36133,9 @@ function $40c00e2ecacb5ae0$export$2d2c672e82add59e(props, stateProps) {
|
|
|
36075
36133
|
]);
|
|
36076
36134
|
const handleExport = (0, $b4te3$react.useCallback)(()=>{
|
|
36077
36135
|
if (!viewResult) return;
|
|
36078
|
-
(0, $7T941.
|
|
36136
|
+
(0, $7T941.exportToExcel)([
|
|
36137
|
+
viewResult
|
|
36138
|
+
], notExportableColumns);
|
|
36079
36139
|
}, [
|
|
36080
36140
|
notExportableColumns,
|
|
36081
36141
|
viewResult
|
|
@@ -45557,6 +45617,7 @@ parcelRegister("ixSh0", function(module, exports) {
|
|
|
45557
45617
|
|
|
45558
45618
|
$parcel$export(module.exports, "useExportToExcel", function () { return $d805689a29a5dad3$export$c319aff9ea4ad6e; });
|
|
45559
45619
|
|
|
45620
|
+
var $7T941 = parcelRequire("7T941");
|
|
45560
45621
|
var $d805689a29a5dad3$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
45561
45622
|
function adopt(value) {
|
|
45562
45623
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -45585,35 +45646,12 @@ var $d805689a29a5dad3$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
45585
45646
|
});
|
|
45586
45647
|
};
|
|
45587
45648
|
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);
|
|
45649
|
+
const { data: data, dataResultNames: dataResultNames, notExportableColumns: notExportableColumns } = props;
|
|
45650
|
+
const exportToExcelWrapper = ()=>$d805689a29a5dad3$var$__awaiter(this, void 0, void 0, function*() {
|
|
45651
|
+
yield (0, $7T941.exportToExcel)(data, notExportableColumns, dataResultNames);
|
|
45614
45652
|
});
|
|
45615
45653
|
return {
|
|
45616
|
-
exportToExcel:
|
|
45654
|
+
exportToExcel: exportToExcelWrapper
|
|
45617
45655
|
};
|
|
45618
45656
|
}
|
|
45619
45657
|
|