@jspreadsheet/react 10.0.26 → 10.0.30

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 (3) hide show
  1. package/dist/index.d.ts +21 -21
  2. package/dist/index.js +78 -78
  3. package/package.json +28 -28
package/dist/index.d.ts CHANGED
@@ -1,22 +1,22 @@
1
- /**
2
- * Official Type definitions for Jspreadsheet React
3
- * https://jspreadsheet.com/v10/docs/react
4
- * Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
- */
6
-
7
- interface Spreadsheet {
8
- (): any
9
- [key: string]: any
10
- }
11
-
12
- interface Worksheet {
13
- (): any
14
- [key: string]: any
15
- }
16
-
17
- declare function Spreadsheet<Spreadsheet>(props: Spreadsheet): any;
18
- declare function Worksheet<Worksheet>(props: Worksheet): any;
19
-
20
- import jspreadsheet from "jspreadsheet";
21
-
1
+ /**
2
+ * Official Type definitions for Jspreadsheet React
3
+ * https://jspreadsheet.com/v10/docs/react
4
+ * Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+ */
6
+
7
+ interface Spreadsheet {
8
+ (): any
9
+ [key: string]: any
10
+ }
11
+
12
+ interface Worksheet {
13
+ (): any
14
+ [key: string]: any
15
+ }
16
+
17
+ declare function Spreadsheet<Spreadsheet>(props: Spreadsheet): any;
18
+ declare function Worksheet<Worksheet>(props: Worksheet): any;
19
+
20
+ import jspreadsheet from "jspreadsheet";
21
+
22
22
  export { Spreadsheet, Worksheet, jspreadsheet };
package/dist/index.js CHANGED
@@ -1,79 +1,79 @@
1
- // @ts-nocheck
2
- import React, { useRef, useEffect } from "react";
3
- import jspreadsheet from 'jspreadsheet';
4
-
5
- import "jspreadsheet/dist/jspreadsheet.css";
6
- import "jsuites/dist/jsuites.css";
7
-
8
- const extractWorksheetProperties = function(props) {
9
- this.worksheets.push({
10
- minDimensions: [10, 10],
11
- ...props
12
- });
13
- }
14
-
15
- window.jspreadsheet = jspreadsheet;
16
-
17
- // @ts-ignore
18
- const Spreadsheet = React.forwardRef((props, mainReference) => {
19
- // Set the license
20
- if (props.license) {
21
- jspreadsheet.setLicense(props.license);
22
- }
23
- // Set the extensions
24
- if (props.extensions) {
25
- jspreadsheet.setExtensions(props.extensions);
26
- }
27
- // Dom element
28
- const jssDom = useRef(null);
29
-
30
- // Get the properties for the spreadsheet
31
- let options = { ...props };
32
-
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 {
44
- // Extract worksheet options
45
- extractWorksheetProperties.call(options, props.children.props);
46
- }
47
- }
48
-
49
- /*useEffect(function() {
50
- // Track changes in the data
51
- if (jssDom.current.innerText) {
52
- mainReference.current[0].setData(JSON.parse(JSON.stringify(options.worksheets[0].data)))
53
- }
54
- }, [options.worksheets[0].data]);*/
55
-
56
-
57
- useEffect(() => {
58
- // @ts-ignore
59
- if (! jssDom.current.innerText) {
60
- mainReference.current = jspreadsheet(jssDom.current, options);
61
- }
62
- }, []);
63
-
64
- let prop = {
65
- ref: jssDom
66
- };
67
-
68
- if (typeof(options.id) !== 'undefined') {
69
- prop.id = options.id;
70
- }
71
-
72
- return React.createElement("div", prop);
73
- })
74
-
75
- function Worksheet () {
76
- return (null);
77
- }
78
-
1
+ // @ts-nocheck
2
+ import React, { useRef, useEffect } from "react";
3
+ import jspreadsheet from 'jspreadsheet';
4
+
5
+ import "jspreadsheet/dist/jspreadsheet.css";
6
+ import "jsuites/dist/jsuites.css";
7
+
8
+ const extractWorksheetProperties = function(props) {
9
+ this.worksheets.push({
10
+ minDimensions: [10, 10],
11
+ ...props
12
+ });
13
+ }
14
+
15
+ window.jspreadsheet = jspreadsheet;
16
+
17
+ // @ts-ignore
18
+ const Spreadsheet = React.forwardRef((props, mainReference) => {
19
+ // Set the license
20
+ if (props.license) {
21
+ jspreadsheet.setLicense(props.license);
22
+ }
23
+ // Set the extensions
24
+ if (props.extensions) {
25
+ jspreadsheet.setExtensions(props.extensions);
26
+ }
27
+ // Dom element
28
+ const jssDom = useRef(null);
29
+
30
+ // Get the properties for the spreadsheet
31
+ let options = { ...props };
32
+
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 {
44
+ // Extract worksheet options
45
+ extractWorksheetProperties.call(options, props.children.props);
46
+ }
47
+ }
48
+
49
+ /*useEffect(function() {
50
+ // Track changes in the data
51
+ if (jssDom.current.innerText) {
52
+ mainReference.current[0].setData(JSON.parse(JSON.stringify(options.worksheets[0].data)))
53
+ }
54
+ }, [options.worksheets[0].data]);*/
55
+
56
+
57
+ useEffect(() => {
58
+ // @ts-ignore
59
+ if (! jssDom.current.innerText) {
60
+ mainReference.current = jspreadsheet(jssDom.current, options);
61
+ }
62
+ }, []);
63
+
64
+ let prop = {
65
+ ref: jssDom
66
+ };
67
+
68
+ if (typeof(options.id) !== 'undefined') {
69
+ prop.id = options.id;
70
+ }
71
+
72
+ return React.createElement("div", prop);
73
+ })
74
+
75
+ function Worksheet () {
76
+ return (null);
77
+ }
78
+
79
79
  export { Spreadsheet, Worksheet, jspreadsheet };
package/package.json CHANGED
@@ -1,28 +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/v10"
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": "^10.0.26"
24
- },
25
- "main": "dist/index.js",
26
- "types": "dist/index.d.ts",
27
- "version": "10.0.26"
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/v10"
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": "^10.0.30"
24
+ },
25
+ "main": "dist/index.js",
26
+ "types": "dist/index.d.ts",
27
+ "version": "10.0.30"
28
+ }