@jspreadsheet/react 9.4.1 → 9.4.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.
- package/dist/index.js +23 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import jspreadsheet from 'jspreadsheet';
|
|
|
5
5
|
import "/node_modules/jspreadsheet/dist/jspreadsheet.css";
|
|
6
6
|
import "/node_modules/jsuites/dist/jsuites.css";
|
|
7
7
|
|
|
8
|
-
window.
|
|
8
|
+
window.jss = jspreadsheet;
|
|
9
9
|
|
|
10
10
|
const extractWorksheetProperties = function(props) {
|
|
11
11
|
this.worksheets.push({
|
|
@@ -14,6 +14,7 @@ const extractWorksheetProperties = function(props) {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// @ts-ignore
|
|
17
18
|
export const Spreadsheet = React.forwardRef((props, mainReference) => {
|
|
18
19
|
// Set the license
|
|
19
20
|
if (props.license) {
|
|
@@ -27,36 +28,42 @@ export const Spreadsheet = React.forwardRef((props, mainReference) => {
|
|
|
27
28
|
const jssDom = useRef(null);
|
|
28
29
|
|
|
29
30
|
// Get the properties for the spreadsheet
|
|
30
|
-
let options = { ...props
|
|
31
|
+
let options = { ...props };
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
if (! options.worksheets) {
|
|
34
|
+
// Create the worksheets
|
|
35
|
+
options.worksheets = [];
|
|
36
|
+
// Get all the properties from the worksheets
|
|
37
|
+
if (Array.isArray(props.children)) {
|
|
38
|
+
// Multiple worksheets
|
|
39
|
+
props.children.map(function (v) {
|
|
40
|
+
// Extract worksheet options
|
|
41
|
+
extractWorksheetProperties.call(options, v.props);
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
36
44
|
// Extract worksheet options
|
|
37
|
-
extractWorksheetProperties.call(options,
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
// Extract worksheet options
|
|
41
|
-
extractWorksheetProperties.call(options, props.children.props);
|
|
45
|
+
extractWorksheetProperties.call(options, props.children.props);
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
/*useEffect(()
|
|
49
|
+
/*useEffect(function() {
|
|
50
|
+
// Track changes in the data
|
|
45
51
|
if (jssDom.current.innerText) {
|
|
46
|
-
mainReference.current[
|
|
52
|
+
mainReference.current[1].setData(JSON.parse(JSON.stringify(options.worksheets[1].data)))
|
|
47
53
|
}
|
|
48
54
|
}, [options.worksheets[0].data]);*/
|
|
49
55
|
|
|
56
|
+
|
|
50
57
|
useEffect(() => {
|
|
58
|
+
// @ts-ignore
|
|
51
59
|
if (! jssDom.current.innerText) {
|
|
52
60
|
mainReference.current = jspreadsheet(jssDom.current, options);
|
|
53
61
|
}
|
|
54
62
|
}, []);
|
|
55
63
|
|
|
56
|
-
return (
|
|
57
|
-
|
|
64
|
+
return React.createElement("div", { ref: jssDom });
|
|
58
65
|
})
|
|
59
66
|
|
|
60
67
|
export function Worksheet () {
|
|
61
68
|
return (null);
|
|
62
|
-
}
|
|
69
|
+
}
|
package/package.json
CHANGED