@corbe30/fortune-excel 2.1.1 → 2.1.2
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.
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface ExportHelperProps {
|
|
3
|
+
sheetRef: React.RefObject<any>;
|
|
4
|
+
config: {
|
|
5
|
+
xlsx?: boolean;
|
|
6
|
+
csv?: boolean;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare const ExportHelper: React.FC<ExportHelperProps>;
|
|
10
|
+
export {};
|
|
@@ -5,11 +5,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ExportHelper = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
-
require("./style.css");
|
|
9
8
|
var Transform_1 = require("../common/Transform");
|
|
10
9
|
var ICommon_1 = require("../common/ICommon");
|
|
10
|
+
var exportHelperStyle = {
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: "column",
|
|
13
|
+
visibility: "hidden",
|
|
14
|
+
backgroundColor: "#fff",
|
|
15
|
+
color: "#000",
|
|
16
|
+
textAlign: "start",
|
|
17
|
+
borderRadius: "4px",
|
|
18
|
+
fontSize: "12px",
|
|
19
|
+
position: "absolute",
|
|
20
|
+
zIndex: 26,
|
|
21
|
+
top: "40px",
|
|
22
|
+
whiteSpace: "nowrap",
|
|
23
|
+
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.35)",
|
|
24
|
+
left: "50px",
|
|
25
|
+
};
|
|
26
|
+
var unstyledButtonStyle = {
|
|
27
|
+
width: "100%",
|
|
28
|
+
background: "none",
|
|
29
|
+
border: "none",
|
|
30
|
+
margin: 0,
|
|
31
|
+
font: "inherit",
|
|
32
|
+
color: "inherit",
|
|
33
|
+
cursor: "pointer",
|
|
34
|
+
padding: "6px 12px",
|
|
35
|
+
outline: "none",
|
|
36
|
+
fontFamily: "Arial, Helvetica, sans-serif",
|
|
37
|
+
textAlign: "left",
|
|
38
|
+
};
|
|
11
39
|
var getExportButton = function (fileType, onClick) {
|
|
12
|
-
return (react_1.default.createElement("button", {
|
|
40
|
+
return (react_1.default.createElement("button", { style: unstyledButtonStyle, onMouseEnter: function (e) { return (e.currentTarget.style.backgroundColor = "#ededed"); }, onMouseLeave: function (e) { return (e.currentTarget.style.backgroundColor = "#fff"); }, onClick: function () { return onClick(fileType); } },
|
|
13
41
|
"Export as .",
|
|
14
42
|
fileType.toLowerCase()));
|
|
15
43
|
};
|
|
@@ -17,13 +45,14 @@ var ExportHelper = function (props) {
|
|
|
17
45
|
var sheetRef = props.sheetRef, config = props.config;
|
|
18
46
|
var onMouseLeave = function () {
|
|
19
47
|
var exportHelper = document.querySelector(".export-helper");
|
|
20
|
-
exportHelper
|
|
48
|
+
if (exportHelper)
|
|
49
|
+
exportHelper.style.visibility = "hidden";
|
|
21
50
|
};
|
|
22
51
|
var onClick = function (fileType) {
|
|
23
52
|
(0, Transform_1.transformFortuneToExcel)(sheetRef.current, fileType);
|
|
24
53
|
onMouseLeave();
|
|
25
54
|
};
|
|
26
|
-
return (react_1.default.createElement("div", { className: "export-helper", onMouseLeave: onMouseLeave },
|
|
55
|
+
return (react_1.default.createElement("div", { className: "export-helper", style: exportHelperStyle, onMouseLeave: onMouseLeave },
|
|
27
56
|
config.xlsx ? getExportButton(ICommon_1.IFileType.XLSX, onClick) : null,
|
|
28
57
|
config.csv ? getExportButton(ICommon_1.IFileType.CSV, onClick) : null));
|
|
29
58
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"workspaces": [
|
|
4
4
|
"src/*"
|
|
5
5
|
],
|
|
6
|
-
"version": "2.1.
|
|
6
|
+
"version": "2.1.2",
|
|
7
7
|
"description": "An Excel import/export import library for FortuneSheet",
|
|
8
8
|
"main": "dist/main.js",
|
|
9
9
|
"types": "dist/main.d.ts",
|
|
@@ -32,10 +32,8 @@
|
|
|
32
32
|
"@storybook/react-webpack5": "^7.3.2",
|
|
33
33
|
"@storybook/test": "^7.6.12",
|
|
34
34
|
"@types/node": "^20.11.16",
|
|
35
|
-
"copyfiles": "^2.4.1",
|
|
36
35
|
"react": "^18.2.0",
|
|
37
36
|
"react-dom": "^18.2.0",
|
|
38
|
-
"rimraf": "^6.1.0",
|
|
39
37
|
"storybook": "^7.6.16",
|
|
40
38
|
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
41
39
|
"typescript": "^5.3.3"
|
|
@@ -49,9 +47,6 @@
|
|
|
49
47
|
},
|
|
50
48
|
"scripts": {
|
|
51
49
|
"prepare": "tsc",
|
|
52
|
-
"clean": "rimraf dist/",
|
|
53
|
-
"copy-files": "copyfiles -u 1 src/**/*.html src/**/*.css dist/",
|
|
54
|
-
"build": "npm run clean && tsc && npm run copy-files",
|
|
55
50
|
"storybook": "storybook dev -p 6006",
|
|
56
51
|
"build-storybook": "storybook build"
|
|
57
52
|
}
|
package/dist/ToExcel/style.css
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
.export-helper {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
visibility: hidden;
|
|
5
|
-
background-color: #fff;
|
|
6
|
-
color: #000;
|
|
7
|
-
text-align: start;
|
|
8
|
-
border-radius: 4px;
|
|
9
|
-
font-size: 12px;
|
|
10
|
-
position: absolute;
|
|
11
|
-
z-index: 26;
|
|
12
|
-
top: 40px;
|
|
13
|
-
white-space: nowrap;
|
|
14
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
|
|
15
|
-
left: 50px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.unstyled-button {
|
|
19
|
-
width: 100%;
|
|
20
|
-
background: none;
|
|
21
|
-
border: none;
|
|
22
|
-
margin: 0;
|
|
23
|
-
font: inherit;
|
|
24
|
-
color: inherit;
|
|
25
|
-
cursor: pointer;
|
|
26
|
-
padding: 6px 12px 6px 12px;
|
|
27
|
-
outline: none;
|
|
28
|
-
font-family: Arial, Helvetica, sans-serif;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.unstyled-button:hover {
|
|
32
|
-
background-color: #ededed;
|
|
33
|
-
}
|