logisheets 1.4.0 → 1.6.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.
@@ -80,6 +80,12 @@ export declare class Workbook {
80
80
  registerHeaderUpdatedCallback(callback: (sheetIdxes: readonly number[]) => void): void;
81
81
  getSheetNameByIdx(idx: number): Result<string>;
82
82
  getAllSheetInfo(): Array<SheetInfo>;
83
+ /**
84
+ * Every distinct formula function name used across the workbook (cell
85
+ * formulas + defined names), read from the parsed ASTs. Uppercased as
86
+ * stored at parse time, sorted + deduped.
87
+ */
88
+ getFormulaFunctionNames(): Result<string[]>;
83
89
  checkFormula(f: string): boolean;
84
90
  calcCondition(sheetIdx: number, f: string): Result<boolean>;
85
91
  /**
@@ -204,6 +204,14 @@ class Workbook {
204
204
  getAllSheetInfo() {
205
205
  return rpc('getAllSheetInfo', undefined, this._id);
206
206
  }
207
+ /**
208
+ * Every distinct formula function name used across the workbook (cell
209
+ * formulas + defined names), read from the parsed ASTs. Uppercased as
210
+ * stored at parse time, sorted + deduped.
211
+ */
212
+ getFormulaFunctionNames() {
213
+ return rpc('getFormulaFunctionNames', undefined, this._id);
214
+ }
207
215
  checkFormula(f) {
208
216
  return rpc('checkFormula', { formula: f }, this._id);
209
217
  }
@@ -1,9 +1,17 @@
1
- import { BlockInfo, CellPosition, ColInfo, DisplayWindow, DisplayWindowWithStartPoint, RowInfo, Style, Value, CellInfo, SheetDimension, MergeCell, AppendixWithCell, ReproducibleCell, SheetCoordinate, CellInput, Comment, CellImageInfo } from '../bindings';
1
+ import { BlockInfo, CellPosition, ColInfo, DisplayWindow, DisplayWindowWithStartPoint, RowInfo, Style, Value, CellInfo, SheetDimension, MergeCell, AppendixWithCell, ReproducibleCell, SheetCoordinate, CellInput, Comment, CellImageInfo, DependentCell, CellRefRange } from '../bindings';
2
2
  import { Cell } from './cell';
3
3
  import { Result } from './utils';
4
4
  export declare class Worksheet {
5
5
  constructor(id: number, sheetIdxOrId: number, isSheetIdx?: boolean);
6
6
  getSheetDimension(): Result<SheetDimension>;
7
+ /**
8
+ * Cells whose formula references the given range (Excel "trace dependents").
9
+ * Each result carries the reference (`via`) it used, resolved to a rectangle,
10
+ * so callers can tell an aggregate/range reference from a single-cell one.
11
+ */
12
+ getDependents(startRow: number, startCol: number, endRow: number, endCol: number): Result<DependentCell[]>;
13
+ /** The ranges/cells a cell's formula references (Excel "trace precedents"). */
14
+ getPrecedents(row: number, col: number): Result<CellRefRange[]>;
7
15
  getDisplayWindow(startRow: number, endRow: number, startCol: number, endCol: number): Result<DisplayWindow>;
8
16
  getDisplayWindowWithStartPoint(startX: number, startY: number, height: number, width: number): DisplayWindowWithStartPoint;
9
17
  getCellPosition(row: number, col: number): CellPosition;
@@ -22,6 +30,7 @@ export declare class Worksheet {
22
30
  getRowInfo(rowIdx: number): Result<RowInfo>;
23
31
  getColInfo(colIdx: number): Result<ColInfo>;
24
32
  getCellInfo(rowIdx: number, colIdx: number): Result<CellInfo>;
33
+ getCellListValidation(rowIdx: number, colIdx: number): Result<readonly string[] | undefined>;
25
34
  getReproducibleCell(rowIdx: number, colIdx: number): Result<ReproducibleCell>;
26
35
  getReproducibleCells(coordinates: readonly SheetCoordinate[]): Result<readonly ReproducibleCell[]>;
27
36
  getCellInfos(startRow: number, startCol: number, endRow: number, endCol: number): Result<readonly CellInfo[]>;
@@ -25,6 +25,18 @@ class Worksheet {
25
25
  getSheetDimension() {
26
26
  return rpc('getSheetDimension', { sheetId: this._sheetId }, this._id);
27
27
  }
28
+ /**
29
+ * Cells whose formula references the given range (Excel "trace dependents").
30
+ * Each result carries the reference (`via`) it used, resolved to a rectangle,
31
+ * so callers can tell an aggregate/range reference from a single-cell one.
32
+ */
33
+ getDependents(startRow, startCol, endRow, endCol) {
34
+ return rpc('getDependents', { sheetIdx: this._sheetIdx, startRow, startCol, endRow, endCol }, this._id);
35
+ }
36
+ /** The ranges/cells a cell's formula references (Excel "trace precedents"). */
37
+ getPrecedents(row, col) {
38
+ return rpc('getPrecedents', { sheetIdx: this._sheetIdx, row, col }, this._id);
39
+ }
28
40
  getDisplayWindow(startRow, endRow, startCol, endCol) {
29
41
  return rpc('getDisplayWindow', { sheetIdx: this._sheetIdx, startRow, endRow, startCol, endCol }, this._id);
30
42
  }
@@ -69,7 +81,12 @@ class Worksheet {
69
81
  // Ctrl+Arrow: jump to the next data/block boundary. Returns an
70
82
  // ErrorMessage when there is no boundary ahead (caller shows a hint).
71
83
  getUpwardDataBoundary(row, col) {
72
- return rpc('getDataBoundary', { sheetIdx: this._sheetIdx, rowIdx: row, colIdx: col, direction: 'up' }, this._id);
84
+ return rpc('getDataBoundary', {
85
+ sheetIdx: this._sheetIdx,
86
+ rowIdx: row,
87
+ colIdx: col,
88
+ direction: 'up',
89
+ }, this._id);
73
90
  }
74
91
  getDownwardDataBoundary(row, col) {
75
92
  return rpc('getDataBoundary', {
@@ -116,6 +133,12 @@ class Worksheet {
116
133
  getCellInfo(rowIdx, colIdx) {
117
134
  return rpc('getCell', { sheetIdx: this._sheetIdx, row: rowIdx, col: colIdx }, this._id);
118
135
  }
136
+ // The enum option set of a cell's list data-validation (inline lists),
137
+ // or undefined when the cell has no such dropdown. Used by douyoushu to
138
+ // prefill enum inputs from a workbook's existing dropdowns.
139
+ getCellListValidation(rowIdx, colIdx) {
140
+ return rpc('getCellListValidation', { sheetIdx: this._sheetIdx, row: rowIdx, col: colIdx }, this._id);
141
+ }
119
142
  getReproducibleCell(rowIdx, colIdx) {
120
143
  return rpc('getReproducibleCell', { sheetIdx: this._sheetIdx, row: rowIdx, col: colIdx }, this._id);
121
144
  }
@@ -0,0 +1,9 @@
1
+ export interface CellRefRange {
2
+ sheetIdx: number;
3
+ startRow: number;
4
+ startCol: number;
5
+ endRow: number;
6
+ endCol: number;
7
+ allRows: boolean;
8
+ allCols: boolean;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { CellRefRange } from './cell_ref_range';
2
+ export interface DependentCell {
3
+ sheetIdx: number;
4
+ row: number;
5
+ col: number;
6
+ via: CellRefRange;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -37,6 +37,7 @@ export * from './cell_input';
37
37
  export * from './cell_position';
38
38
  export * from './cell_protection';
39
39
  export * from './cell_ref';
40
+ export * from './cell_ref_range';
40
41
  export * from './cell_style_update';
41
42
  export * from './checkpoint_meta';
42
43
  export * from './col_info';
@@ -67,6 +68,7 @@ export * from './delete_comment';
67
68
  export * from './delete_rows';
68
69
  export * from './delete_rows_in_block';
69
70
  export * from './delete_sheet';
71
+ export * from './dependent_cell';
70
72
  export * from './display_window';
71
73
  export * from './display_window_request';
72
74
  export * from './display_window_with_start_point';
@@ -149,12 +151,14 @@ export * from './rpc_get_cells_params';
149
151
  export * from './rpc_get_col_width_params';
150
152
  export * from './rpc_get_comments_params';
151
153
  export * from './rpc_get_data_boundary_params';
154
+ export * from './rpc_get_dependents_params';
152
155
  export * from './rpc_get_display_units_of_formula_params';
153
156
  export * from './rpc_get_display_window_params';
154
157
  export * from './rpc_get_display_window_within_cell_params';
155
158
  export * from './rpc_get_diy_cell_id_with_block_id_params';
156
159
  export * from './rpc_get_merged_cells_params';
157
160
  export * from './rpc_get_next_visible_cell_params';
161
+ export * from './rpc_get_precedents_params';
158
162
  export * from './rpc_get_reproducible_cell_params';
159
163
  export * from './rpc_get_reproducible_cells_params';
160
164
  export * from './rpc_get_row_height_params';
@@ -54,6 +54,7 @@ __exportStar(require("./cell_input"), exports);
54
54
  __exportStar(require("./cell_position"), exports);
55
55
  __exportStar(require("./cell_protection"), exports);
56
56
  __exportStar(require("./cell_ref"), exports);
57
+ __exportStar(require("./cell_ref_range"), exports);
57
58
  __exportStar(require("./cell_style_update"), exports);
58
59
  __exportStar(require("./checkpoint_meta"), exports);
59
60
  __exportStar(require("./col_info"), exports);
@@ -84,6 +85,7 @@ __exportStar(require("./delete_comment"), exports);
84
85
  __exportStar(require("./delete_rows"), exports);
85
86
  __exportStar(require("./delete_rows_in_block"), exports);
86
87
  __exportStar(require("./delete_sheet"), exports);
88
+ __exportStar(require("./dependent_cell"), exports);
87
89
  __exportStar(require("./display_window"), exports);
88
90
  __exportStar(require("./display_window_request"), exports);
89
91
  __exportStar(require("./display_window_with_start_point"), exports);
@@ -166,12 +168,14 @@ __exportStar(require("./rpc_get_cells_params"), exports);
166
168
  __exportStar(require("./rpc_get_col_width_params"), exports);
167
169
  __exportStar(require("./rpc_get_comments_params"), exports);
168
170
  __exportStar(require("./rpc_get_data_boundary_params"), exports);
171
+ __exportStar(require("./rpc_get_dependents_params"), exports);
169
172
  __exportStar(require("./rpc_get_display_units_of_formula_params"), exports);
170
173
  __exportStar(require("./rpc_get_display_window_params"), exports);
171
174
  __exportStar(require("./rpc_get_display_window_within_cell_params"), exports);
172
175
  __exportStar(require("./rpc_get_diy_cell_id_with_block_id_params"), exports);
173
176
  __exportStar(require("./rpc_get_merged_cells_params"), exports);
174
177
  __exportStar(require("./rpc_get_next_visible_cell_params"), exports);
178
+ __exportStar(require("./rpc_get_precedents_params"), exports);
175
179
  __exportStar(require("./rpc_get_reproducible_cell_params"), exports);
176
180
  __exportStar(require("./rpc_get_reproducible_cells_params"), exports);
177
181
  __exportStar(require("./rpc_get_row_height_params"), exports);
@@ -0,0 +1,7 @@
1
+ export interface GetDependentsParams {
2
+ sheetIdx: number;
3
+ startRow: number;
4
+ startCol: number;
5
+ endRow: number;
6
+ endCol: number;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface GetPrecedentsParams {
2
+ sheetIdx: number;
3
+ row: number;
4
+ col: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -12,10 +12,12 @@ import { CellImageInfo } from './cell_image_info';
12
12
  import { CellInfo } from './cell_info';
13
13
  import { CellInput } from './cell_input';
14
14
  import { CellPosition } from './cell_position';
15
+ import { CellRefRange } from './cell_ref_range';
15
16
  import { CheckFormulaParams } from './rpc_check_formula_params';
16
17
  import { CheckpointMetaDto } from './checkpoint_meta';
17
18
  import { Comment } from './comment';
18
19
  import { DeleteCheckpointParams } from './rpc_delete_checkpoint_params';
20
+ import { DependentCell } from './dependent_cell';
19
21
  import { DisplayWindow } from './display_window';
20
22
  import { DisplayWindowWithStartPoint } from './display_window_with_start_point';
21
23
  import { ErrorMessage } from './error_message';
@@ -39,12 +41,14 @@ import { GetCellsParams } from './rpc_get_cells_params';
39
41
  import { GetColWidthParams } from './rpc_get_col_width_params';
40
42
  import { GetCommentsParams } from './rpc_get_comments_params';
41
43
  import { GetDataBoundaryParams } from './rpc_get_data_boundary_params';
44
+ import { GetDependentsParams } from './rpc_get_dependents_params';
42
45
  import { GetDisplayUnitsOfFormulaParams } from './rpc_get_display_units_of_formula_params';
43
46
  import { GetDisplayWindowParams } from './rpc_get_display_window_params';
44
47
  import { GetDisplayWindowWithinCellParams } from './rpc_get_display_window_within_cell_params';
45
48
  import { GetDiyCellIdWithBlockIdParams } from './rpc_get_diy_cell_id_with_block_id_params';
46
49
  import { GetMergedCellsParams } from './rpc_get_merged_cells_params';
47
50
  import { GetNextVisibleCellParams } from './rpc_get_next_visible_cell_params';
51
+ import { GetPrecedentsParams } from './rpc_get_precedents_params';
48
52
  import { GetReproducibleCellParams } from './rpc_get_reproducible_cell_params';
49
53
  import { GetReproducibleCellsParams } from './rpc_get_reproducible_cells_params';
50
54
  import { GetRowHeightParams } from './rpc_get_row_height_params';
@@ -76,7 +80,10 @@ import { ToggleStatusParams } from './rpc_toggle_status_params';
76
80
  import { Value } from './value';
77
81
  export interface WorkbookMethods {
78
82
  getSheetDimension(params: GetSheetDimensionParams, bookId?: number): Promise<SheetDimension | ErrorMessage>;
83
+ getDependents(params: GetDependentsParams, bookId?: number): Promise<readonly DependentCell[] | ErrorMessage>;
84
+ getPrecedents(params: GetPrecedentsParams, bookId?: number): Promise<readonly CellRefRange[] | ErrorMessage>;
79
85
  getAllSheetInfo(bookId?: number): Promise<readonly SheetInfo[] | ErrorMessage>;
86
+ getFormulaFunctionNames(bookId?: number): Promise<readonly string[] | ErrorMessage>;
80
87
  getSheetIdx(params: GetSheetIdxParams, bookId?: number): Promise<number | ErrorMessage>;
81
88
  getSheetId(params: GetSheetIdParams, bookId?: number): Promise<number | ErrorMessage>;
82
89
  getSheetNameByIdx(params: GetSheetNameByIdxParams, bookId?: number): Promise<string | ErrorMessage>;
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.4.0",
6
+ "version": "1.6.0",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logisheets",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Read and write the xlsx files",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
Binary file
package/wasm/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.4.0",
6
+ "version": "1.6.0",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",