rapid-spreadjs 1.0.0

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/README.md ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "rapid-spreadjs",
3
+ "version": "1.0.0",
4
+ "description": "SpreadJS常用公用处理函数。",
5
+ "main": "./src/index.js",
6
+ "license": "MIT",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "build": "babel src -d dist"
10
+ },
11
+ "keywords": [
12
+ "utils",
13
+ "helpers",
14
+ "spreadjs",
15
+ "spreadsheet",
16
+ "excel",
17
+ "workbook",
18
+ "worksheet"
19
+ ],
20
+ "author": {
21
+ "name": "qubernet",
22
+ "email": "qubernet@163.com",
23
+ "url": "https://www.cnblogs.com/qubernet"
24
+ },
25
+ "homepage": "https://www.cnblogs.com/qubernet"
26
+ }
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./utils/sheet";
2
+ export * from "./utils/wookbook";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 单元格实体
3
+ */
4
+ export type CellModel = {
5
+ /** 行索引 */
6
+ row?: number;
7
+
8
+ /** 列索引 */
9
+ col?: number;
10
+
11
+ /** 行数量 */
12
+ rowCount?: number;
13
+
14
+ /** 列数量 */
15
+ colCount?: number;
16
+ };
File without changes
@@ -0,0 +1,33 @@
1
+ import { CellModel } from "../types/sheet";
2
+
3
+ /**
4
+ * SpreadJS工作表工具函数
5
+ */
6
+ export const SheetUtils = {
7
+ /**
8
+ * 获取当前活动工作表选中的单元格集合
9
+ * @param spread 工作簿对象
10
+ * @returns 返回选中单元格的集合,格式如:[{row:,col:,rowCount:,colCount:}]
11
+ */
12
+ getActiveSheetSelectCells: (spread) => {
13
+ const sheet = spread.getActiveSheet();
14
+
15
+ return sheet.getSelections();
16
+ },
17
+
18
+ /**
19
+ * 设置当前活动工作表某个单元格范围为选中状态
20
+ * @param spread 工作簿对象
21
+ * @param cellObj 设置选中的单元格,格式如:{row:0,col:0,rowCount:1,colCount:1}
22
+ */
23
+ setActiveSheetSelectCells: (spread, cellObj: CellModel) => {
24
+ const sheet = spread.getActiveSheet();
25
+
26
+ sheet.setSelection(
27
+ cellObj.row,
28
+ cellObj.col,
29
+ cellObj.rowCount,
30
+ cellObj.colCount
31
+ );
32
+ },
33
+ };
File without changes