logisheets 1.2.0 → 1.3.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,4 +1,4 @@
1
- import { BlockInfo, CellPosition, ColInfo, DisplayWindow, DisplayWindowWithStartPoint, RowInfo, Style, Value, CellInfo, SheetDimension, MergeCell, AppendixWithCell, ReproducibleCell, SheetCoordinate, CellInput, Comment } from '../bindings';
1
+ import { BlockInfo, CellPosition, ColInfo, DisplayWindow, DisplayWindowWithStartPoint, RowInfo, Style, Value, CellInfo, SheetDimension, MergeCell, AppendixWithCell, ReproducibleCell, SheetCoordinate, CellInput, Comment, CellImageInfo } from '../bindings';
2
2
  import { Cell } from './cell';
3
3
  import { Result } from './utils';
4
4
  export declare class Worksheet {
@@ -62,6 +62,13 @@ export declare class Worksheet {
62
62
  * (`addComment` / `editComment` / `deleteComment` / `resolveComment`).
63
63
  */
64
64
  getComments(): Result<Comment[]>;
65
+ /**
66
+ * All images placed in this sheet's cells. Each `CellImageInfo` carries the
67
+ * cell `(row, col)`, the image `format` (bare extension, e.g. `png`) and
68
+ * the base64-encoded image `data`. Mutations go through the workbook
69
+ * transaction API (`SetCellImage` / `DeleteCellImage`).
70
+ */
71
+ getCellImages(): Result<CellImageInfo[]>;
65
72
  getFullyCoveredBlocks(rowIdx: number, colIdx: number, rowCnt: number, colCnt: number): Result<BlockInfo[]>;
66
73
  private _id;
67
74
  private _sheetId;
@@ -206,6 +206,15 @@ export class Worksheet {
206
206
  getComments() {
207
207
  return rpc('getComments', { sheetIdx: this._sheetIdx }, this._id);
208
208
  }
209
+ /**
210
+ * All images placed in this sheet's cells. Each `CellImageInfo` carries the
211
+ * cell `(row, col)`, the image `format` (bare extension, e.g. `png`) and
212
+ * the base64-encoded image `data`. Mutations go through the workbook
213
+ * transaction API (`SetCellImage` / `DeleteCellImage`).
214
+ */
215
+ getCellImages() {
216
+ return rpc('getCellImages', { sheetIdx: this._sheetIdx }, this._id);
217
+ }
209
218
  getFullyCoveredBlocks(rowIdx, colIdx, rowCnt, colCnt) {
210
219
  return rpc('getFullyCoveredBlocks', {
211
220
  sheetId: this._sheetId,
@@ -0,0 +1,7 @@
1
+ export interface CellImageInfo {
2
+ row: number;
3
+ col: number;
4
+ id: string;
5
+ format: string;
6
+ data: string;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ export interface DeleteCellImage {
2
+ sheetIdx: number;
3
+ row: number;
4
+ col: number;
5
+ }
6
+ export declare class DeleteCellImageBuilder {
7
+ private _sheetIdx;
8
+ private _row;
9
+ private _col;
10
+ sheetIdx(value: number): this;
11
+ row(value: number): this;
12
+ col(value: number): this;
13
+ build(): {
14
+ sheetIdx: number;
15
+ row: number;
16
+ col: number;
17
+ };
18
+ }
@@ -0,0 +1,26 @@
1
+ export class DeleteCellImageBuilder {
2
+ _sheetIdx;
3
+ _row;
4
+ _col;
5
+ sheetIdx(value) {
6
+ this._sheetIdx = value;
7
+ return this;
8
+ }
9
+ row(value) {
10
+ this._row = value;
11
+ return this;
12
+ }
13
+ col(value) {
14
+ this._col = value;
15
+ return this;
16
+ }
17
+ build() {
18
+ if (this._sheetIdx === undefined)
19
+ throw new Error('missing sheetIdx');
20
+ if (this._row === undefined)
21
+ throw new Error('missing row');
22
+ if (this._col === undefined)
23
+ throw new Error('missing col');
24
+ return { sheetIdx: this._sheetIdx, row: this._row, col: this._col };
25
+ }
26
+ }
@@ -15,6 +15,7 @@ import { CreateBlock } from './create_block';
15
15
  import { CreateDiyCell } from './create_diy_cell';
16
16
  import { CreateDiyCellById } from './create_diy_cell_by_id';
17
17
  import { CreateSheet } from './create_sheet';
18
+ import { DeleteCellImage } from './delete_cell_image';
18
19
  import { DeleteCols } from './delete_cols';
19
20
  import { DeleteColsInBlock } from './delete_cols_in_block';
20
21
  import { DeleteComment } from './delete_comment';
@@ -43,6 +44,7 @@ import { ReproduceCells } from './reproduce_cells';
43
44
  import { ResizeBlock } from './resize_block';
44
45
  import { ResolveComment } from './resolve_comment';
45
46
  import { RestoreCheckpoint } from './restore_checkpoint';
47
+ import { SetCellImage } from './set_cell_image';
46
48
  import { SetColWidth } from './set_col_width';
47
49
  import { SetRowHeight } from './set_row_height';
48
50
  import { SetSheetColor } from './set_sheet_color';
@@ -143,6 +145,12 @@ export type EditPayload = {
143
145
  } | {
144
146
  type: 'cellClear';
145
147
  value: CellClear;
148
+ } | {
149
+ type: 'setCellImage';
150
+ value: SetCellImage;
151
+ } | {
152
+ type: 'deleteCellImage';
153
+ value: DeleteCellImage;
146
154
  } | {
147
155
  type: 'setColWidth';
148
156
  value: SetColWidth;
@@ -31,6 +31,7 @@ export * from './cell_coordinate';
31
31
  export * from './cell_coordinate_with_sheet';
32
32
  export * from './cell_format_brush';
33
33
  export * from './cell_id';
34
+ export * from './cell_image_info';
34
35
  export * from './cell_info';
35
36
  export * from './cell_input';
36
37
  export * from './cell_position';
@@ -59,6 +60,7 @@ export * from './ct_font';
59
60
  export * from './ct_gradient_fill';
60
61
  export * from './ct_gradient_stop';
61
62
  export * from './ct_pattern_fill';
63
+ export * from './delete_cell_image';
62
64
  export * from './delete_cols';
63
65
  export * from './delete_cols_in_block';
64
66
  export * from './delete_comment';
@@ -138,6 +140,7 @@ export * from './rpc_get_block_row_id_params';
138
140
  export * from './rpc_get_block_values_params';
139
141
  export * from './rpc_get_cell_id_by_block_ref_params';
140
142
  export * from './rpc_get_cell_id_params';
143
+ export * from './rpc_get_cell_images_params';
141
144
  export * from './rpc_get_cell_infos_params';
142
145
  export * from './rpc_get_cell_params';
143
146
  export * from './rpc_get_cell_position_params';
@@ -173,6 +176,7 @@ export * from './rpc_toggle_status_params';
173
176
  export * from './rpc_transaction';
174
177
  export * from './rpc_workbook_methods';
175
178
  export * from './save_file_result';
179
+ export * from './set_cell_image';
176
180
  export * from './set_col_width';
177
181
  export * from './set_row_height';
178
182
  export * from './set_sheet_color';
@@ -32,6 +32,7 @@ export * from './cell_coordinate';
32
32
  export * from './cell_coordinate_with_sheet';
33
33
  export * from './cell_format_brush';
34
34
  export * from './cell_id';
35
+ export * from './cell_image_info';
35
36
  export * from './cell_info';
36
37
  export * from './cell_input';
37
38
  export * from './cell_position';
@@ -60,6 +61,7 @@ export * from './ct_font';
60
61
  export * from './ct_gradient_fill';
61
62
  export * from './ct_gradient_stop';
62
63
  export * from './ct_pattern_fill';
64
+ export * from './delete_cell_image';
63
65
  export * from './delete_cols';
64
66
  export * from './delete_cols_in_block';
65
67
  export * from './delete_comment';
@@ -139,6 +141,7 @@ export * from './rpc_get_block_row_id_params';
139
141
  export * from './rpc_get_block_values_params';
140
142
  export * from './rpc_get_cell_id_by_block_ref_params';
141
143
  export * from './rpc_get_cell_id_params';
144
+ export * from './rpc_get_cell_images_params';
142
145
  export * from './rpc_get_cell_infos_params';
143
146
  export * from './rpc_get_cell_params';
144
147
  export * from './rpc_get_cell_position_params';
@@ -174,6 +177,7 @@ export * from './rpc_toggle_status_params';
174
177
  export * from './rpc_transaction';
175
178
  export * from './rpc_workbook_methods';
176
179
  export * from './save_file_result';
180
+ export * from './set_cell_image';
177
181
  export * from './set_col_width';
178
182
  export * from './set_row_height';
179
183
  export * from './set_sheet_color';
@@ -0,0 +1,3 @@
1
+ export interface GetCellImagesParams {
2
+ sheetIdx: number;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,7 @@ import { BlockField } from './block_field';
8
8
  import { BlockInfo } from './block_info';
9
9
  import { CalcConditionParams } from './rpc_calc_condition_params';
10
10
  import { CellCoordinateWithSheet } from './cell_coordinate_with_sheet';
11
+ import { CellImageInfo } from './cell_image_info';
11
12
  import { CellInfo } from './cell_info';
12
13
  import { CellInput } from './cell_input';
13
14
  import { CellPosition } from './cell_position';
@@ -29,6 +30,7 @@ import { GetBlockRowIdParams } from './rpc_get_block_row_id_params';
29
30
  import { GetBlockValuesParams } from './rpc_get_block_values_params';
30
31
  import { GetCellIdByBlockRefParams } from './rpc_get_cell_id_by_block_ref_params';
31
32
  import { GetCellIdParams } from './rpc_get_cell_id_params';
33
+ import { GetCellImagesParams } from './rpc_get_cell_images_params';
32
34
  import { GetCellInfosParams } from './rpc_get_cell_infos_params';
33
35
  import { GetCellParams } from './rpc_get_cell_params';
34
36
  import { GetCellPositionParams } from './rpc_get_cell_position_params';
@@ -113,6 +115,7 @@ export interface WorkbookMethods {
113
115
  lookupAppendixUpward(params: LookupAppendixUpwardParams, bookId?: number): Promise<AppendixWithCell | ErrorMessage>;
114
116
  getMergedCells(params: GetMergedCellsParams, bookId?: number): Promise<readonly MergeCell[] | ErrorMessage>;
115
117
  getComments(params: GetCommentsParams, bookId?: number): Promise<readonly Comment[] | ErrorMessage>;
118
+ getCellImages(params: GetCellImagesParams, bookId?: number): Promise<readonly CellImageInfo[] | ErrorMessage>;
116
119
  getShadowCellId(params: GetShadowCellIdParams, bookId?: number): Promise<SheetCellId | ErrorMessage>;
117
120
  getShadowCellIds(params: GetShadowCellIdsParams, bookId?: number): Promise<readonly SheetCellId[] | ErrorMessage>;
118
121
  getShadowInfoById(params: GetShadowInfoByIdParams, bookId?: number): Promise<ShadowCellInfo | ErrorMessage>;
@@ -0,0 +1,30 @@
1
+ export interface SetCellImage {
2
+ sheetIdx: number;
3
+ row: number;
4
+ col: number;
5
+ imageId: string;
6
+ format: string;
7
+ data: string;
8
+ }
9
+ export declare class SetCellImageBuilder {
10
+ private _sheetIdx;
11
+ private _row;
12
+ private _col;
13
+ private _imageId;
14
+ private _format;
15
+ private _data;
16
+ sheetIdx(value: number): this;
17
+ row(value: number): this;
18
+ col(value: number): this;
19
+ imageId(value: string): this;
20
+ format(value: string): this;
21
+ data(value: string): this;
22
+ build(): {
23
+ sheetIdx: number;
24
+ row: number;
25
+ col: number;
26
+ imageId: string;
27
+ format: string;
28
+ data: string;
29
+ };
30
+ }
@@ -0,0 +1,47 @@
1
+ export class SetCellImageBuilder {
2
+ _sheetIdx;
3
+ _row;
4
+ _col;
5
+ _imageId;
6
+ _format;
7
+ _data;
8
+ sheetIdx(value) {
9
+ this._sheetIdx = value;
10
+ return this;
11
+ }
12
+ row(value) {
13
+ this._row = value;
14
+ return this;
15
+ }
16
+ col(value) {
17
+ this._col = value;
18
+ return this;
19
+ }
20
+ imageId(value) {
21
+ this._imageId = value;
22
+ return this;
23
+ }
24
+ format(value) {
25
+ this._format = value;
26
+ return this;
27
+ }
28
+ data(value) {
29
+ this._data = value;
30
+ return this;
31
+ }
32
+ build() {
33
+ if (this._sheetIdx === undefined)
34
+ throw new Error('missing sheetIdx');
35
+ if (this._row === undefined)
36
+ throw new Error('missing row');
37
+ if (this._col === undefined)
38
+ throw new Error('missing col');
39
+ if (this._imageId === undefined)
40
+ throw new Error('missing imageId');
41
+ if (this._format === undefined)
42
+ throw new Error('missing format');
43
+ if (this._data === undefined)
44
+ throw new Error('missing data');
45
+ return { sheetIdx: this._sheetIdx, row: this._row, col: this._col, imageId: this._imageId, format: this._format, data: this._data };
46
+ }
47
+ }
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.2.0",
6
+ "version": "1.3.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.2.0",
3
+ "version": "1.3.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.2.0",
6
+ "version": "1.3.0",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",