@jspreadsheet/react 9.4.1

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.
Files changed (2) hide show
  1. package/dist/index.js +62 -0
  2. package/package.json +28 -0
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ // @ts-nocheck
2
+ import React, { useRef, useEffect } from "react";
3
+ import jspreadsheet from 'jspreadsheet';
4
+
5
+ import "/node_modules/jspreadsheet/dist/jspreadsheet.css";
6
+ import "/node_modules/jsuites/dist/jsuites.css";
7
+
8
+ window.jspreadsheet = jspreadsheet;
9
+
10
+ const extractWorksheetProperties = function(props) {
11
+ this.worksheets.push({
12
+ minDimensions: [10, 10],
13
+ ...props
14
+ });
15
+ }
16
+
17
+ export const Spreadsheet = React.forwardRef((props, mainReference) => {
18
+ // Set the license
19
+ if (props.license) {
20
+ jspreadsheet.setLicense(props.license);
21
+ }
22
+ // Set the extensions
23
+ if (props.extensions) {
24
+ jspreadsheet.setExtensions(props.extensions);
25
+ }
26
+ // Dom element
27
+ const jssDom = useRef(null);
28
+
29
+ // Get the properties for the spreadsheet
30
+ let options = { ...props, worksheets: [] };
31
+
32
+ // Get all the properties from the worksheets
33
+ if (Array.isArray(props.children)) {
34
+ // Multiple worksheets
35
+ props.children.map(function (v) {
36
+ // Extract worksheet options
37
+ extractWorksheetProperties.call(options, v.props);
38
+ });
39
+ } else {
40
+ // Extract worksheet options
41
+ extractWorksheetProperties.call(options, props.children.props);
42
+ }
43
+
44
+ /*useEffect(() => {
45
+ if (jssDom.current.innerText) {
46
+ mainReference.current[0].setData(JSON.parse(JSON.stringify(options.worksheets[1].data)))
47
+ }
48
+ }, [options.worksheets[0].data]);*/
49
+
50
+ useEffect(() => {
51
+ if (! jssDom.current.innerText) {
52
+ mainReference.current = jspreadsheet(jssDom.current, options);
53
+ }
54
+ }, []);
55
+
56
+ return (<div ref={jssDom}></div>);
57
+
58
+ })
59
+
60
+ export function Worksheet () {
61
+ return (null);
62
+ }
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@jspreadsheet/react",
3
+ "title": "Jspreadsheet Pro React Wrapper",
4
+ "description": "Jspreadsheet is a lightweight, vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.",
5
+ "author": {
6
+ "name": "Contact <contact@jspreadsheet.com>",
7
+ "url": "https://jspreadsheet.com/v9"
8
+ },
9
+ "keywords": [
10
+ "spreadsheet",
11
+ "spreadsheets",
12
+ "tables",
13
+ "table",
14
+ "excel",
15
+ "grid",
16
+ "grid-editor",
17
+ "data-table",
18
+ "data-grid",
19
+ "data-spreadsheet",
20
+ "react"
21
+ ],
22
+ "dependencies": {
23
+ "jspreadsheet": "^9.4.1"
24
+ },
25
+ "main": "dist/index.js",
26
+ "types": "dist/index.d.ts",
27
+ "version": "9.4.1"
28
+ }