@elliemae/ds-csv-converter 3.26.1-rc.1 → 3.27.0-next.10
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/cjs/index.js +4 -56
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/index.js +3 -56
- package/dist/esm/index.js.map +3 -3
- package/dist/types/index.d.ts +2 -3
- package/package.json +10 -7
package/dist/cjs/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -28,63 +29,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
30
|
var src_exports = {};
|
|
30
31
|
__export(src_exports, {
|
|
31
|
-
|
|
32
|
-
listToCsvBlob: () => listToCsvBlob,
|
|
33
|
-
listToCsvFile: () => listToCsvFile
|
|
32
|
+
default: () => import_ds_legacy_csv_converter.default
|
|
34
33
|
});
|
|
35
34
|
module.exports = __toCommonJS(src_exports);
|
|
36
35
|
var React = __toESM(require("react"));
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
let headerMap;
|
|
40
|
-
if (argIsRecord(map)) {
|
|
41
|
-
headerMap = new Map(Object.entries(map));
|
|
42
|
-
} else {
|
|
43
|
-
headerMap = map;
|
|
44
|
-
}
|
|
45
|
-
const columns = headerMap && Array.from(headerMap.keys()) || Object.keys(list[0] || {});
|
|
46
|
-
const header = columns.map((v) => `"${headerMap?.get(v) ?? v}"`).join(",");
|
|
47
|
-
const content = list.map(
|
|
48
|
-
(item) => columns.map((key) => {
|
|
49
|
-
let finalCell;
|
|
50
|
-
const cell = item[key];
|
|
51
|
-
finalCell = cell;
|
|
52
|
-
if (typeof cell === "string")
|
|
53
|
-
finalCell = cell.replace(/"/g, '""');
|
|
54
|
-
return `"${finalCell}"`;
|
|
55
|
-
}).join(",")
|
|
56
|
-
).join("\r\n");
|
|
57
|
-
return `${header}\r
|
|
58
|
-
${content}`;
|
|
59
|
-
}
|
|
60
|
-
function listToCsvBlob(list, map) {
|
|
61
|
-
const data = list2csv(list, map);
|
|
62
|
-
return new Blob([data], {
|
|
63
|
-
type: "text/csv;charset=utf-8;"
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function listToCsvFile(list, fileName = "list", map) {
|
|
67
|
-
if (!document.createElement && !navigator.msSaveBlob) {
|
|
68
|
-
throw new Error(`
|
|
69
|
-
Can not export to file without document/navigator msSaveBlob functionality.
|
|
70
|
-
Use listToCsvBlob and handle file creation on your side instead.
|
|
71
|
-
`);
|
|
72
|
-
}
|
|
73
|
-
const blob = listToCsvBlob(list, map);
|
|
74
|
-
const finalFileName = `${fileName}.csv`;
|
|
75
|
-
if (navigator.msSaveBlob) {
|
|
76
|
-
navigator.msSaveBlob(blob, finalFileName);
|
|
77
|
-
} else {
|
|
78
|
-
const link = document.createElement("a");
|
|
79
|
-
if (link.download !== void 0) {
|
|
80
|
-
const url = URL.createObjectURL(blob);
|
|
81
|
-
link.setAttribute("href", url);
|
|
82
|
-
link.setAttribute("download", finalFileName);
|
|
83
|
-
link.style.visibility = "hidden";
|
|
84
|
-
document.body.appendChild(link);
|
|
85
|
-
link.click();
|
|
86
|
-
document.body.removeChild(link);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
36
|
+
__reExport(src_exports, require("@elliemae/ds-legacy-csv-converter"), module.exports);
|
|
37
|
+
var import_ds_legacy_csv_converter = __toESM(require("@elliemae/ds-legacy-csv-converter"));
|
|
90
38
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export * from '@elliemae/ds-legacy-csv-converter';\nexport { default } from '@elliemae/ds-legacy-csv-converter';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,8CAAd;AACA,qCAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,60 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
let headerMap;
|
|
5
|
-
if (argIsRecord(map)) {
|
|
6
|
-
headerMap = new Map(Object.entries(map));
|
|
7
|
-
} else {
|
|
8
|
-
headerMap = map;
|
|
9
|
-
}
|
|
10
|
-
const columns = headerMap && Array.from(headerMap.keys()) || Object.keys(list[0] || {});
|
|
11
|
-
const header = columns.map((v) => `"${headerMap?.get(v) ?? v}"`).join(",");
|
|
12
|
-
const content = list.map(
|
|
13
|
-
(item) => columns.map((key) => {
|
|
14
|
-
let finalCell;
|
|
15
|
-
const cell = item[key];
|
|
16
|
-
finalCell = cell;
|
|
17
|
-
if (typeof cell === "string")
|
|
18
|
-
finalCell = cell.replace(/"/g, '""');
|
|
19
|
-
return `"${finalCell}"`;
|
|
20
|
-
}).join(",")
|
|
21
|
-
).join("\r\n");
|
|
22
|
-
return `${header}\r
|
|
23
|
-
${content}`;
|
|
24
|
-
}
|
|
25
|
-
function listToCsvBlob(list, map) {
|
|
26
|
-
const data = list2csv(list, map);
|
|
27
|
-
return new Blob([data], {
|
|
28
|
-
type: "text/csv;charset=utf-8;"
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
function listToCsvFile(list, fileName = "list", map) {
|
|
32
|
-
if (!document.createElement && !navigator.msSaveBlob) {
|
|
33
|
-
throw new Error(`
|
|
34
|
-
Can not export to file without document/navigator msSaveBlob functionality.
|
|
35
|
-
Use listToCsvBlob and handle file creation on your side instead.
|
|
36
|
-
`);
|
|
37
|
-
}
|
|
38
|
-
const blob = listToCsvBlob(list, map);
|
|
39
|
-
const finalFileName = `${fileName}.csv`;
|
|
40
|
-
if (navigator.msSaveBlob) {
|
|
41
|
-
navigator.msSaveBlob(blob, finalFileName);
|
|
42
|
-
} else {
|
|
43
|
-
const link = document.createElement("a");
|
|
44
|
-
if (link.download !== void 0) {
|
|
45
|
-
const url = URL.createObjectURL(blob);
|
|
46
|
-
link.setAttribute("href", url);
|
|
47
|
-
link.setAttribute("download", finalFileName);
|
|
48
|
-
link.style.visibility = "hidden";
|
|
49
|
-
document.body.appendChild(link);
|
|
50
|
-
link.click();
|
|
51
|
-
document.body.removeChild(link);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
2
|
+
export * from "@elliemae/ds-legacy-csv-converter";
|
|
3
|
+
import { default as default2 } from "@elliemae/ds-legacy-csv-converter";
|
|
55
4
|
export {
|
|
56
|
-
|
|
57
|
-
listToCsvBlob,
|
|
58
|
-
listToCsvFile
|
|
5
|
+
default2 as default
|
|
59
6
|
};
|
|
60
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from '@elliemae/ds-legacy-csv-converter';\nexport { default } from '@elliemae/ds-legacy-csv-converter';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,SAAS,WAAAA,gBAAe;",
|
|
6
|
+
"names": ["default"]
|
|
7
7
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export declare function listToCsvFile(list: Record<string, string>[], fileName?: string, map?: Record<string, string> | Map<string, string>): void;
|
|
1
|
+
export * from '@elliemae/ds-legacy-csv-converter';
|
|
2
|
+
export { default } from '@elliemae/ds-legacy-csv-converter';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-csv-converter",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.27.0-next.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - CSV converting utilities",
|
|
6
6
|
"files": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@elliemae/pui-cli": "~9.0.0-next.31",
|
|
36
36
|
"styled-components": "~5.3.9",
|
|
37
|
-
"@elliemae/ds-monorepo-devops": "3.
|
|
37
|
+
"@elliemae/ds-monorepo-devops": "3.27.0-next.10"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^17.0.2",
|
|
@@ -44,15 +44,18 @@
|
|
|
44
44
|
"access": "public",
|
|
45
45
|
"typeSafety": false
|
|
46
46
|
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@elliemae/ds-legacy-csv-converter": "1.0.1"
|
|
49
|
+
},
|
|
47
50
|
"scripts": {
|
|
48
|
-
"test": "
|
|
49
|
-
"lint": "
|
|
50
|
-
"eslint:fix": "
|
|
51
|
-
"dts": "
|
|
51
|
+
"test": "exit 0 | echo",
|
|
52
|
+
"lint": "exit 0 | echo",
|
|
53
|
+
"eslint:fix": "exit 0 | echo",
|
|
54
|
+
"dts": "exit 0 | echo",
|
|
52
55
|
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
|
53
56
|
"dev:build": "pnpm --filter {.}... build",
|
|
54
57
|
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
|
55
|
-
"checkDeps": "
|
|
58
|
+
"checkDeps": "exit 0 | echo",
|
|
56
59
|
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch"
|
|
57
60
|
}
|
|
58
61
|
}
|