to-spreadsheet 1.1.3 → 1.1.5
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/lib/docProps/core.xml.js +10 -5
- package/package.json +2 -3
- package/src/index.ts +0 -68
package/lib/docProps/core.xml.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateCoreXml = void 0;
|
|
4
|
-
const
|
|
4
|
+
const formatDate = (date) => {
|
|
5
|
+
const year = date.getUTCFullYear();
|
|
6
|
+
const month = String(date.getUTCMonth() + 1).padStart(2, '0');
|
|
7
|
+
const day = String(date.getUTCDate()).padStart(2, '0');
|
|
8
|
+
const hours = String(date.getUTCHours()).padStart(2, '0');
|
|
9
|
+
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
|
|
10
|
+
const seconds = String(date.getUTCSeconds()).padStart(2, '0');
|
|
11
|
+
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}Z`;
|
|
12
|
+
};
|
|
5
13
|
const generateCoreXml = ({ username = "to-spreadsheet", description = "", language = "en-US", version = "1", subject = "", title = "" }) => {
|
|
6
|
-
const date = (
|
|
7
|
-
"T" +
|
|
8
|
-
(0, date_fns_1.format)(Date.now(), "HH:mm:ss") +
|
|
9
|
-
"Z";
|
|
14
|
+
const date = formatDate(new Date());
|
|
10
15
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
11
16
|
<cp:coreProperties
|
|
12
17
|
xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "to-spreadsheet",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "npm package to create spreadsheet in node environment and in browser",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepare": "npm run build",
|
|
8
8
|
"build": "tsc",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"homepage": "https://github.com/maifeeulasad/to-spreadsheet#readme",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"archiver": "^6.0.1",
|
|
23
|
-
"date-fns": "^2.30.0",
|
|
24
23
|
"file-saver": "^2.0.5",
|
|
25
24
|
"jszip": "^3.10.1"
|
|
26
25
|
},
|
package/src/index.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { generateExcel, EnvironmentType } from "./generate-excel";
|
|
2
|
-
import { SkipCell, skipCell, Equation, writeEquation } from "./util";
|
|
3
|
-
|
|
4
|
-
enum ICellType {
|
|
5
|
-
string = "s",
|
|
6
|
-
number = "n",
|
|
7
|
-
skip = "skip",
|
|
8
|
-
equation = "equation",
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface ICellString {
|
|
12
|
-
type: ICellType.string;
|
|
13
|
-
value: number;
|
|
14
|
-
}
|
|
15
|
-
interface ICellNumber {
|
|
16
|
-
type: ICellType.number;
|
|
17
|
-
value: number;
|
|
18
|
-
}
|
|
19
|
-
interface ICellSkip {
|
|
20
|
-
type: ICellType.skip;
|
|
21
|
-
}
|
|
22
|
-
interface ICellEquation {
|
|
23
|
-
type: ICellType.equation;
|
|
24
|
-
value: Equation;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
type ICell = ICellString | ICellNumber | ICellSkip | ICellEquation;
|
|
28
|
-
|
|
29
|
-
interface IRows {
|
|
30
|
-
cells: ICell[];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface ISheet {
|
|
34
|
-
title: string;
|
|
35
|
-
rows: IRows[];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface IWorkbook {
|
|
39
|
-
filename: string;
|
|
40
|
-
sheets: ISheet[];
|
|
41
|
-
strings: string[];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface IPage {
|
|
45
|
-
title: string
|
|
46
|
-
content: (string | number | undefined | SkipCell | Equation)[][]
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { ICell, ISheet, IWorkbook, IRows, ICellType, IPage }
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const sampleData = [
|
|
53
|
-
{
|
|
54
|
-
title: 'Maifee1', content: [
|
|
55
|
-
['meaw', 'grrr'],
|
|
56
|
-
['woof', 'smack'],
|
|
57
|
-
[1],
|
|
58
|
-
[1, 2],
|
|
59
|
-
[1, 2, 3, writeEquation('SUM(A5,C5)')],
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
{ title: 'Maifee2', content: [[1], [1, skipCell(3), 2]] },
|
|
63
|
-
{ title: 'Maifee3', content: [['meaw', undefined, "meaw"], ["woof", 'woof']] }
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
// generateExcel(sampleData) // <- check before releasing with `yarn test:compile`
|
|
67
|
-
|
|
68
|
-
export { generateExcel, sampleData, EnvironmentType, skipCell, writeEquation };
|