gridjs-spreadsheet 23.4.0 → 23.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.
Files changed (4) hide show
  1. package/index.d.ts +199 -0
  2. package/index.js +1 -0
  3. package/package.json +14 -5
  4. package/readme.md +34 -5
package/index.d.ts ADDED
@@ -0,0 +1,199 @@
1
+ declare module 'gridjs-spreadsheet' {
2
+ export interface Options {
3
+ mode?: 'edit' | 'read';
4
+ showToolbar?: boolean;
5
+ showGrid?: boolean;
6
+ showContextmenu?: boolean;
7
+ showFileName?: boolean;
8
+ local?:string;
9
+ view?: {
10
+ height: () => number;
11
+ width: () => number;
12
+ };
13
+ row?: {
14
+ len: number;
15
+ height: number;
16
+ };
17
+ col?: {
18
+ len: number;
19
+ width: number;
20
+ indexWidth: number;
21
+ minWidth: number;
22
+ };
23
+ style?: {
24
+ bgcolor: string;
25
+ align: 'left' | 'center' | 'right';
26
+ valign: 'top' | 'middle' | 'bottom';
27
+ textwrap: boolean;
28
+ strike: boolean;
29
+ underline: boolean;
30
+ color: string;
31
+ font: {
32
+ name: 'Helvetica';
33
+ size: number;
34
+ bold: boolean;
35
+ italic: false;
36
+ };
37
+ };
38
+ }
39
+
40
+ export type CELL_SELECTED = 'cell-selected';
41
+ export type CELLS_SELECTED = 'cells-selected';
42
+ export type CELL_EDITED = 'cell-edited';
43
+
44
+ export type CellMerge = [number, number];
45
+
46
+ export interface SpreadsheetEventHandler {
47
+ (
48
+ envt: CELL_SELECTED,
49
+ callback: (cell: Cell, rowIndex: number, colIndex: number) => void
50
+ ): void;
51
+ (
52
+ envt: CELLS_SELECTED,
53
+ callback: (
54
+ cell: Cell,
55
+ parameters: { sri: number; sci: number; eri: number; eci: number }
56
+ ) => void
57
+ ): void;
58
+ (
59
+ evnt: CELL_EDITED,
60
+ callback: (text: string, rowIndex: number, colIndex: number) => void
61
+ ): void;
62
+ }
63
+
64
+ export interface ColProperties {
65
+ width?: number;
66
+ }
67
+
68
+ /**
69
+ * Data for representing a cell
70
+ */
71
+ export interface CellData {
72
+ text: string;
73
+ style?: number;
74
+ merge?: CellMerge;
75
+ }
76
+ /**
77
+ * Data for representing a row
78
+ */
79
+ export interface RowData {
80
+ cells: {
81
+ [key: number]: CellData;
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Data for representing a sheet
87
+ */
88
+ export interface SheetData {
89
+ name?: string;
90
+ freeze?: string;
91
+ styles?: CellStyle[];
92
+ merges?: string[];
93
+ cols?: {
94
+ len?: number;
95
+ [key: number]: ColProperties;
96
+ };
97
+ rows?: {
98
+ [key: number]: RowData
99
+ };
100
+ }
101
+
102
+ /**
103
+ * Data for representing a spreadsheet
104
+ */
105
+ export interface SpreadsheetData {
106
+ [index: number]: SheetData;
107
+ }
108
+
109
+ export interface CellStyle {
110
+ align?: 'left' | 'center' | 'right';
111
+ valign?: 'top' | 'middle' | 'bottom';
112
+ font?: {
113
+ bold?: boolean;
114
+ }
115
+ bgcolor?: string;
116
+ textwrap?: boolean;
117
+ color?: string;
118
+ border?: {
119
+ top?: string[];
120
+ right?: string[];
121
+ bottom?: string[];
122
+ left?: string[];
123
+ };
124
+ }
125
+ export interface Editor {}
126
+ export interface Element {}
127
+
128
+ export interface Row {}
129
+ export interface Table {}
130
+ export interface Cell {}
131
+ export interface Sheet {}
132
+
133
+ export default class Spreadsheet {
134
+ constructor(container: string | HTMLElement, opts?: Options);
135
+ on: SpreadsheetEventHandler;
136
+ /**
137
+ * retrieve cell
138
+ * @param rowIndex {number} row index
139
+ * @param colIndex {number} column index
140
+ * @param sheetIndex {number} sheet iindex
141
+ */
142
+ cell(rowIndex: number, colIndex: number, sheetIndex: number): Cell;
143
+ /**
144
+ * retrieve cell style
145
+ * @param rowIndex
146
+ * @param colIndex
147
+ * @param sheetIndex
148
+ */
149
+ cellStyle(
150
+ rowIndex: number,
151
+ colIndex: number,
152
+ sheetIndex: number
153
+ ): CellStyle;
154
+ /**
155
+ * get/set cell text
156
+ * @param rowIndex
157
+ * @param colIndex
158
+ * @param text
159
+ * @param sheetIndex
160
+ */
161
+ cellText(
162
+ rowIndex: number,
163
+ colIndex: number,
164
+ text: string,
165
+ sheetIndex?: number
166
+ ): string;
167
+ /**
168
+ * remove current sheet
169
+ */
170
+ deleteSheet(): void;
171
+
172
+ /**
173
+ * load data
174
+ * @param json
175
+ */
176
+ loadData(json: Record<string, any>): void;
177
+ /**
178
+ * get data
179
+ */
180
+ getData(): Record<string, any>;
181
+ /**
182
+ * bind handler to change event, including data change and user actions
183
+ * @param callback
184
+ */
185
+ change(callback: (json: Record<string, any>) => void): void;
186
+ /**
187
+ * set locale
188
+ * @param lang
189
+ * @param message
190
+ */
191
+ locale(lang: string, message: string): void;
192
+ }
193
+ global {
194
+ interface Window {
195
+ x_spreadsheet(container: string | HTMLElement, opts?: Options): Spreadsheet;
196
+ }
197
+ }
198
+ }
199
+
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./xspreadsheet.js');
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "gridjs-spreadsheet",
3
- "version": "23.4.0",
4
- "description": "A simple library allows you to view and edit spreadsheet documents with ease.",
3
+ "version": "23.4.2",
4
+ "description": "A smart and simple to use Excel-like JavaScript Spreadsheet library allows you to view and edit spreadsheet file with ease and quick.",
5
+ "types": "index.d.ts",
5
6
  "main": "xspreadsheet.js",
6
7
  "scripts": {
7
8
  "test": "echo \"Error: no test specified\" && exit 1"
8
9
  },
9
10
  "keywords": [
10
- "Excel",
11
11
  "XLS",
12
12
  "XLSX",
13
13
  "XLSB",
@@ -30,8 +30,17 @@
30
30
  "SVG",
31
31
  "JSON",
32
32
  "SQL",
33
- "XML"
33
+ "XML",
34
+ "Online excel",
35
+ "spread-sheets",
36
+ "javascript spreadsheet",
37
+ "javascript excel",
38
+ "excel io",
39
+ "sheets",
40
+ "sheet",
41
+ "javascript",
42
+ "excel"
34
43
  ],
35
- "author": "Aspose",
44
+ "author": "Aspose Cells Team",
36
45
  "license": "MIT"
37
46
  }
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # gridjs-spreadsheet
2
2
 
3
- > A web-based JavaScript spreadsheet for GridJs client side
3
+ > A smart and simple to use Excel-like JavaScript Canvas based Spreadsheet library allows you to view and edit spreadsheet file with ease and quick
4
4
 
5
5
 
6
6
 
@@ -44,6 +44,31 @@
44
44
  </body>
45
45
  ```
46
46
 
47
+ ## NPM
48
+
49
+ ```shell
50
+ npm install gridjs-spreadsheet
51
+ ```
52
+
53
+ ```html
54
+ <div id="gridjs-demo"></div>
55
+ ```
56
+
57
+ ```javascript
58
+ import Spreadsheet from "gridjs-spreadsheet";
59
+ // If you need to override the default options, you can set the override
60
+ // const options = {};
61
+ // new Spreadsheet('#gridjs-demo', options);
62
+ const s = new Spreadsheet("#gridjs-demo")
63
+ .loadData({}) // load data
64
+ .change(data => {
65
+ // save data to db
66
+ });
67
+
68
+ // data validation
69
+ s.validate()
70
+ ```
71
+
47
72
 
48
73
  ## simple usage
49
74
 
@@ -152,6 +177,7 @@ xs.cellStyle(ri, ci);
152
177
  - Autofill
153
178
  - Insert/Delete row, column
154
179
  - Filter row, column
180
+ - Zoom in/out
155
181
  - Sort
156
182
  - Search
157
183
  - Formula
@@ -167,11 +193,14 @@ xs.cellStyle(ri, ci);
167
193
  - Display Form Controls /ActiveX Controls(incoming)
168
194
 
169
195
  ## Demo
170
- for more detail ,please check
171
-
196
+ Visit the GridJs demo to find more detail info
172
197
  https://github.com/aspose-cells/Aspose.Cells-for-.NET/tree/master/Examples_GridJs
173
-
174
-
198
+ You can ask any question using the [Forum](https://forum.aspose.com/c/cells).
199
+
200
+ ## Documentation
201
+ Online documentation is available here:
202
+ - [Developer's Guide](https://docs.aspose.com/cells/net/aspose-cells-gridjs/)
203
+ - [API Reference](https://docs.aspose.com/cells/net/aspose-cells-gridjs/client/)
175
204
 
176
205
  ## Browser Support
177
206