logisheets 1.5.0 → 1.7.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.
@@ -1,9 +1,23 @@
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, LinkInfo } 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[]>;
15
+ /** Blocks a `colCnt`-wide range can be linked to: same column count and not
16
+ * already linked. Used by the "link range → block" picker. */
17
+ getLinkableBlocks(colCnt: number): Result<BlockInfo[]>;
18
+ /** Ranges on this sheet that are linked to a block, in sheet coordinates.
19
+ * Used to draw an outer border around each linked source range. */
20
+ getLinks(): Result<LinkInfo[]>;
7
21
  getDisplayWindow(startRow: number, endRow: number, startCol: number, endCol: number): Result<DisplayWindow>;
8
22
  getDisplayWindowWithStartPoint(startX: number, startY: number, height: number, width: number): DisplayWindowWithStartPoint;
9
23
  getCellPosition(row: number, col: number): CellPosition;
@@ -25,6 +25,28 @@ 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
+ }
40
+ /** Blocks a `colCnt`-wide range can be linked to: same column count and not
41
+ * already linked. Used by the "link range → block" picker. */
42
+ getLinkableBlocks(colCnt) {
43
+ return rpc('getLinkableBlocks', { sheetIdx: this._sheetIdx, colCnt }, this._id);
44
+ }
45
+ /** Ranges on this sheet that are linked to a block, in sheet coordinates.
46
+ * Used to draw an outer border around each linked source range. */
47
+ getLinks() {
48
+ return rpc('getLinks', { sheetIdx: this._sheetIdx }, this._id);
49
+ }
28
50
  getDisplayWindow(startRow, endRow, startCol, endCol) {
29
51
  return rpc('getDisplayWindow', { sheetIdx: this._sheetIdx, startRow, endRow, startCol, endCol }, this._id);
30
52
  }
@@ -69,7 +91,12 @@ class Worksheet {
69
91
  // Ctrl+Arrow: jump to the next data/block boundary. Returns an
70
92
  // ErrorMessage when there is no boundary ahead (caller shows a hint).
71
93
  getUpwardDataBoundary(row, col) {
72
- return rpc('getDataBoundary', { sheetIdx: this._sheetIdx, rowIdx: row, colIdx: col, direction: 'up' }, this._id);
94
+ return rpc('getDataBoundary', {
95
+ sheetIdx: this._sheetIdx,
96
+ rowIdx: row,
97
+ colIdx: col,
98
+ direction: 'up',
99
+ }, this._id);
73
100
  }
74
101
  getDownwardDataBoundary(row, col) {
75
102
  return rpc('getDataBoundary', {
@@ -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,30 @@
1
+ export interface CreateLink {
2
+ sheetIdx: number;
3
+ masterRow: number;
4
+ masterCol: number;
5
+ rowCnt: number;
6
+ colCnt: number;
7
+ blockId: number;
8
+ }
9
+ export declare class CreateLinkBuilder {
10
+ private _sheetIdx;
11
+ private _masterRow;
12
+ private _masterCol;
13
+ private _rowCnt;
14
+ private _colCnt;
15
+ private _blockId;
16
+ sheetIdx(value: number): this;
17
+ masterRow(value: number): this;
18
+ masterCol(value: number): this;
19
+ rowCnt(value: number): this;
20
+ colCnt(value: number): this;
21
+ blockId(value: number): this;
22
+ build(): {
23
+ sheetIdx: number;
24
+ masterRow: number;
25
+ masterCol: number;
26
+ rowCnt: number;
27
+ colCnt: number;
28
+ blockId: number;
29
+ };
30
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateLinkBuilder = void 0;
4
+ class CreateLinkBuilder {
5
+ _sheetIdx;
6
+ _masterRow;
7
+ _masterCol;
8
+ _rowCnt;
9
+ _colCnt;
10
+ _blockId;
11
+ sheetIdx(value) {
12
+ this._sheetIdx = value;
13
+ return this;
14
+ }
15
+ masterRow(value) {
16
+ this._masterRow = value;
17
+ return this;
18
+ }
19
+ masterCol(value) {
20
+ this._masterCol = value;
21
+ return this;
22
+ }
23
+ rowCnt(value) {
24
+ this._rowCnt = value;
25
+ return this;
26
+ }
27
+ colCnt(value) {
28
+ this._colCnt = value;
29
+ return this;
30
+ }
31
+ blockId(value) {
32
+ this._blockId = value;
33
+ return this;
34
+ }
35
+ build() {
36
+ if (this._sheetIdx === undefined)
37
+ throw new Error('missing sheetIdx');
38
+ if (this._masterRow === undefined)
39
+ throw new Error('missing masterRow');
40
+ if (this._masterCol === undefined)
41
+ throw new Error('missing masterCol');
42
+ if (this._rowCnt === undefined)
43
+ throw new Error('missing rowCnt');
44
+ if (this._colCnt === undefined)
45
+ throw new Error('missing colCnt');
46
+ if (this._blockId === undefined)
47
+ throw new Error('missing blockId');
48
+ return { sheetIdx: this._sheetIdx, masterRow: this._masterRow, masterCol: this._masterCol, rowCnt: this._rowCnt, colCnt: this._colCnt, blockId: this._blockId };
49
+ }
50
+ }
51
+ exports.CreateLinkBuilder = CreateLinkBuilder;
@@ -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 });
@@ -14,6 +14,7 @@ import { CreateAppendix } from './create_appendix';
14
14
  import { CreateBlock } from './create_block';
15
15
  import { CreateDiyCell } from './create_diy_cell';
16
16
  import { CreateDiyCellById } from './create_diy_cell_by_id';
17
+ import { CreateLink } from './create_link';
17
18
  import { CreateSheet } from './create_sheet';
18
19
  import { DeleteCellImage } from './delete_cell_image';
19
20
  import { DeleteCols } from './delete_cols';
@@ -73,6 +74,9 @@ export type EditPayload = {
73
74
  } | {
74
75
  type: 'convertBlock';
75
76
  value: ConvertBlock;
77
+ } | {
78
+ type: 'createLink';
79
+ value: CreateLink;
76
80
  } | {
77
81
  type: 'bindFormSchema';
78
82
  value: BindFormSchema;
@@ -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';
@@ -51,6 +52,7 @@ export * from './create_appendix';
51
52
  export * from './create_block';
52
53
  export * from './create_diy_cell';
53
54
  export * from './create_diy_cell_by_id';
55
+ export * from './create_link';
54
56
  export * from './create_sheet';
55
57
  export * from './ct_border';
56
58
  export * from './ct_border_pr';
@@ -67,6 +69,7 @@ export * from './delete_comment';
67
69
  export * from './delete_rows';
68
70
  export * from './delete_rows_in_block';
69
71
  export * from './delete_sheet';
72
+ export * from './dependent_cell';
70
73
  export * from './display_window';
71
74
  export * from './display_window_request';
72
75
  export * from './display_window_with_start_point';
@@ -95,6 +98,7 @@ export * from './insert_rows_in_block';
95
98
  export * from './int_property';
96
99
  export * from './line_format_brush';
97
100
  export * from './line_style_update';
101
+ export * from './link_info';
98
102
  export * from './merge_cell';
99
103
  export * from './merge_cells';
100
104
  export * from './modify_policy';
@@ -149,12 +153,16 @@ export * from './rpc_get_cells_params';
149
153
  export * from './rpc_get_col_width_params';
150
154
  export * from './rpc_get_comments_params';
151
155
  export * from './rpc_get_data_boundary_params';
156
+ export * from './rpc_get_dependents_params';
152
157
  export * from './rpc_get_display_units_of_formula_params';
153
158
  export * from './rpc_get_display_window_params';
154
159
  export * from './rpc_get_display_window_within_cell_params';
155
160
  export * from './rpc_get_diy_cell_id_with_block_id_params';
161
+ export * from './rpc_get_linkable_blocks_params';
162
+ export * from './rpc_get_links_params';
156
163
  export * from './rpc_get_merged_cells_params';
157
164
  export * from './rpc_get_next_visible_cell_params';
165
+ export * from './rpc_get_precedents_params';
158
166
  export * from './rpc_get_reproducible_cell_params';
159
167
  export * from './rpc_get_reproducible_cells_params';
160
168
  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);
@@ -68,6 +69,7 @@ __exportStar(require("./create_appendix"), exports);
68
69
  __exportStar(require("./create_block"), exports);
69
70
  __exportStar(require("./create_diy_cell"), exports);
70
71
  __exportStar(require("./create_diy_cell_by_id"), exports);
72
+ __exportStar(require("./create_link"), exports);
71
73
  __exportStar(require("./create_sheet"), exports);
72
74
  __exportStar(require("./ct_border"), exports);
73
75
  __exportStar(require("./ct_border_pr"), exports);
@@ -84,6 +86,7 @@ __exportStar(require("./delete_comment"), exports);
84
86
  __exportStar(require("./delete_rows"), exports);
85
87
  __exportStar(require("./delete_rows_in_block"), exports);
86
88
  __exportStar(require("./delete_sheet"), exports);
89
+ __exportStar(require("./dependent_cell"), exports);
87
90
  __exportStar(require("./display_window"), exports);
88
91
  __exportStar(require("./display_window_request"), exports);
89
92
  __exportStar(require("./display_window_with_start_point"), exports);
@@ -112,6 +115,7 @@ __exportStar(require("./insert_rows_in_block"), exports);
112
115
  __exportStar(require("./int_property"), exports);
113
116
  __exportStar(require("./line_format_brush"), exports);
114
117
  __exportStar(require("./line_style_update"), exports);
118
+ __exportStar(require("./link_info"), exports);
115
119
  __exportStar(require("./merge_cell"), exports);
116
120
  __exportStar(require("./merge_cells"), exports);
117
121
  __exportStar(require("./modify_policy"), exports);
@@ -166,12 +170,16 @@ __exportStar(require("./rpc_get_cells_params"), exports);
166
170
  __exportStar(require("./rpc_get_col_width_params"), exports);
167
171
  __exportStar(require("./rpc_get_comments_params"), exports);
168
172
  __exportStar(require("./rpc_get_data_boundary_params"), exports);
173
+ __exportStar(require("./rpc_get_dependents_params"), exports);
169
174
  __exportStar(require("./rpc_get_display_units_of_formula_params"), exports);
170
175
  __exportStar(require("./rpc_get_display_window_params"), exports);
171
176
  __exportStar(require("./rpc_get_display_window_within_cell_params"), exports);
172
177
  __exportStar(require("./rpc_get_diy_cell_id_with_block_id_params"), exports);
178
+ __exportStar(require("./rpc_get_linkable_blocks_params"), exports);
179
+ __exportStar(require("./rpc_get_links_params"), exports);
173
180
  __exportStar(require("./rpc_get_merged_cells_params"), exports);
174
181
  __exportStar(require("./rpc_get_next_visible_cell_params"), exports);
182
+ __exportStar(require("./rpc_get_precedents_params"), exports);
175
183
  __exportStar(require("./rpc_get_reproducible_cell_params"), exports);
176
184
  __exportStar(require("./rpc_get_reproducible_cells_params"), exports);
177
185
  __exportStar(require("./rpc_get_row_height_params"), exports);
@@ -0,0 +1,8 @@
1
+ export interface LinkInfo {
2
+ sheetIdx: number;
3
+ blockId: number;
4
+ startRow: number;
5
+ startCol: number;
6
+ endRow: number;
7
+ endCol: number;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,4 @@
1
+ export interface GetLinkableBlocksParams {
2
+ sheetIdx: number;
3
+ colCnt: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface GetLinksParams {
2
+ sheetIdx: number;
3
+ }
@@ -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,16 @@ 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';
49
+ import { GetLinkableBlocksParams } from './rpc_get_linkable_blocks_params';
50
+ import { GetLinksParams } from './rpc_get_links_params';
46
51
  import { GetMergedCellsParams } from './rpc_get_merged_cells_params';
47
52
  import { GetNextVisibleCellParams } from './rpc_get_next_visible_cell_params';
53
+ import { GetPrecedentsParams } from './rpc_get_precedents_params';
48
54
  import { GetReproducibleCellParams } from './rpc_get_reproducible_cell_params';
49
55
  import { GetReproducibleCellsParams } from './rpc_get_reproducible_cells_params';
50
56
  import { GetRowHeightParams } from './rpc_get_row_height_params';
@@ -57,6 +63,7 @@ import { GetSheetIdParams } from './rpc_get_sheet_id_params';
57
63
  import { GetSheetIdxParams } from './rpc_get_sheet_idx_params';
58
64
  import { GetSheetNameByIdxParams } from './rpc_get_sheet_name_by_idx_params';
59
65
  import { HandleTransactionParams } from './rpc_handle_transaction_params';
66
+ import { LinkInfo } from './link_info';
60
67
  import { LoadWorkbookParams } from './rpc_load_workbook_params';
61
68
  import { LookupAppendixUpwardParams } from './rpc_lookup_appendix_upward_params';
62
69
  import { MergeCell } from './merge_cell';
@@ -76,6 +83,8 @@ import { ToggleStatusParams } from './rpc_toggle_status_params';
76
83
  import { Value } from './value';
77
84
  export interface WorkbookMethods {
78
85
  getSheetDimension(params: GetSheetDimensionParams, bookId?: number): Promise<SheetDimension | ErrorMessage>;
86
+ getDependents(params: GetDependentsParams, bookId?: number): Promise<readonly DependentCell[] | ErrorMessage>;
87
+ getPrecedents(params: GetPrecedentsParams, bookId?: number): Promise<readonly CellRefRange[] | ErrorMessage>;
79
88
  getAllSheetInfo(bookId?: number): Promise<readonly SheetInfo[] | ErrorMessage>;
80
89
  getFormulaFunctionNames(bookId?: number): Promise<readonly string[] | ErrorMessage>;
81
90
  getSheetIdx(params: GetSheetIdxParams, bookId?: number): Promise<number | ErrorMessage>;
@@ -109,6 +118,8 @@ export interface WorkbookMethods {
109
118
  getAvailableBlockId(params: GetAvailableBlockIdParams, bookId?: number): Promise<number | ErrorMessage>;
110
119
  getAllBlockFields(bookId?: number): Promise<readonly BlockField[] | ErrorMessage>;
111
120
  getAllBlocks(params: GetAllBlocksParams, bookId?: number): Promise<readonly BlockInfo[] | ErrorMessage>;
121
+ getLinkableBlocks(params: GetLinkableBlocksParams, bookId?: number): Promise<readonly BlockInfo[] | ErrorMessage>;
122
+ getLinks(params: GetLinksParams, bookId?: number): Promise<readonly LinkInfo[] | ErrorMessage>;
112
123
  saveCheckpoint(params: SaveCheckpointParams, bookId?: number): Promise<number | ErrorMessage>;
113
124
  deleteCheckpoint(params: DeleteCheckpointParams, bookId?: number): Promise<boolean | ErrorMessage>;
114
125
  listCheckpoints(bookId?: number): Promise<readonly CheckpointMetaDto[] | ErrorMessage>;
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.5.0",
6
+ "version": "1.7.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.5.0",
3
+ "version": "1.7.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.5.0",
6
+ "version": "1.7.0",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",