logisheets 1.14.0 → 1.14.1

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 { ActionEffect, BlockField, BlockInfo, BlockSortOrder, GetBlockSortOrderParams, MayModifyBlockParams, GetBlockModifyInfoParams, BlockModifyInfo, FormulaDisplayInfo, ShadowCellInfo, SheetCellId, SheetInfo, SaveFileResult, AppData, CellInfo, CellCoordinateWithSheet, Transaction, GetBlockValuesParams, GetCellIdParams, GetShadowCellIdParams, GetShadowCellIdsParams, GetAvailableBlockIdParams, TempStatusDiff, BlockDataRow, CommentMention } from '../bindings';
1
+ import { ActionEffect, BlockField, BlockInfo, BlockSortOrder, GetBlockSortOrderParams, MayModifyBlockParams, CheckFieldValidationParams, FieldValidationVerdict, GetBlockModifyInfoParams, BlockModifyInfo, FormulaDisplayInfo, ShadowCellInfo, SheetCellId, SheetInfo, SaveFileResult, AppData, CellInfo, CellCoordinateWithSheet, Transaction, GetBlockValuesParams, GetCellIdParams, GetShadowCellIdParams, GetShadowCellIdsParams, GetAvailableBlockIdParams, TempStatusDiff, BlockDataRow, CommentMention } from '../bindings';
2
2
  import { ColId, RowId } from '../types';
3
3
  import { Worksheet } from './worksheet';
4
4
  import { CustomFunc } from './calculator';
@@ -184,6 +184,20 @@ export declare class Workbook {
184
184
  * come back on `getBlockInfo` if you need to explain the refusal.
185
185
  */
186
186
  mayModifyBlock(params: MayModifyBlockParams): Result<boolean>;
187
+ /**
188
+ * Whether writing `proposed` into this cell would break its field's
189
+ * validation rule.
190
+ *
191
+ * The companion to {@link mayModifyBlock} for `overrideValidation`: that
192
+ * answers whether this actor may write a violating value, this answers
193
+ * whether the value in hand is a violating one. A host gating a write
194
+ * needs both, and needs them BEFORE the write — the marker on the cell
195
+ * only ever judges a value the cell already holds.
196
+ *
197
+ * Reads nothing into the workbook: the rule is evaluated against the
198
+ * proposed value and the cell is left exactly as it was.
199
+ */
200
+ checkFieldValidation(params: CheckFieldValidationParams): Result<FieldValidationVerdict>;
187
201
  /**
188
202
  * A block's governance metadata on its own — owner, default policy,
189
203
  * per-operation overrides, description. `getBlockInfo` carries the same
@@ -439,6 +439,22 @@ class Workbook {
439
439
  mayModifyBlock(params) {
440
440
  return rpc('mayModifyBlock', params, this._id);
441
441
  }
442
+ /**
443
+ * Whether writing `proposed` into this cell would break its field's
444
+ * validation rule.
445
+ *
446
+ * The companion to {@link mayModifyBlock} for `overrideValidation`: that
447
+ * answers whether this actor may write a violating value, this answers
448
+ * whether the value in hand is a violating one. A host gating a write
449
+ * needs both, and needs them BEFORE the write — the marker on the cell
450
+ * only ever judges a value the cell already holds.
451
+ *
452
+ * Reads nothing into the workbook: the rule is evaluated against the
453
+ * proposed value and the cell is left exactly as it was.
454
+ */
455
+ checkFieldValidation(params) {
456
+ return rpc('checkFieldValidation', params, this._id);
457
+ }
442
458
  /**
443
459
  * A block's governance metadata on its own — owner, default policy,
444
460
  * per-operation overrides, description. `getBlockInfo` carries the same
@@ -1 +1 @@
1
- export type BlockOp = 'insertDeleteLines' | 'removeBlock' | 'modifySchema' | 'cellInput' | 'sortByField' | 'modifyDescription';
1
+ export type BlockOp = 'insertDeleteLines' | 'removeBlock' | 'modifySchema' | 'cellInput' | 'sortByField' | 'modifyDescription' | 'overrideValidation';
@@ -6,6 +6,7 @@ export interface BlockPermissions {
6
6
  cellInput?: ModifyPolicy;
7
7
  sortByField?: ModifyPolicy;
8
8
  modifyDescription?: ModifyPolicy;
9
+ overrideValidation?: ModifyPolicy;
9
10
  }
10
11
  export declare class BlockPermissionsBuilder {
11
12
  private _insertDeleteLines?;
@@ -14,12 +15,14 @@ export declare class BlockPermissionsBuilder {
14
15
  private _cellInput?;
15
16
  private _sortByField?;
16
17
  private _modifyDescription?;
18
+ private _overrideValidation?;
17
19
  insertDeleteLines(value: ModifyPolicy): this;
18
20
  removeBlock(value: ModifyPolicy): this;
19
21
  modifySchema(value: ModifyPolicy): this;
20
22
  cellInput(value: ModifyPolicy): this;
21
23
  sortByField(value: ModifyPolicy): this;
22
24
  modifyDescription(value: ModifyPolicy): this;
25
+ overrideValidation(value: ModifyPolicy): this;
23
26
  build(): {
24
27
  insertDeleteLines: ModifyPolicy | undefined;
25
28
  removeBlock: ModifyPolicy | undefined;
@@ -27,5 +30,6 @@ export declare class BlockPermissionsBuilder {
27
30
  cellInput: ModifyPolicy | undefined;
28
31
  sortByField: ModifyPolicy | undefined;
29
32
  modifyDescription: ModifyPolicy | undefined;
33
+ overrideValidation: ModifyPolicy | undefined;
30
34
  };
31
35
  }
@@ -8,6 +8,7 @@ class BlockPermissionsBuilder {
8
8
  _cellInput;
9
9
  _sortByField;
10
10
  _modifyDescription;
11
+ _overrideValidation;
11
12
  insertDeleteLines(value) {
12
13
  this._insertDeleteLines = value;
13
14
  return this;
@@ -32,8 +33,12 @@ class BlockPermissionsBuilder {
32
33
  this._modifyDescription = value;
33
34
  return this;
34
35
  }
36
+ overrideValidation(value) {
37
+ this._overrideValidation = value;
38
+ return this;
39
+ }
35
40
  build() {
36
- return { insertDeleteLines: this._insertDeleteLines, removeBlock: this._removeBlock, modifySchema: this._modifySchema, cellInput: this._cellInput, sortByField: this._sortByField, modifyDescription: this._modifyDescription };
41
+ return { insertDeleteLines: this._insertDeleteLines, removeBlock: this._removeBlock, modifySchema: this._modifySchema, cellInput: this._cellInput, sortByField: this._sortByField, modifyDescription: this._modifyDescription, overrideValidation: this._overrideValidation };
37
42
  }
38
43
  }
39
44
  exports.BlockPermissionsBuilder = BlockPermissionsBuilder;
@@ -0,0 +1,6 @@
1
+ export interface CheckFieldValidationParams {
2
+ sheetIdx: number;
3
+ row: number;
4
+ col: number;
5
+ proposed: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface FieldValidationVerdict {
2
+ hasRule: boolean;
3
+ violates: boolean;
4
+ rule: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -57,6 +57,7 @@ export * from './chart_data_labels_info';
57
57
  export * from './chart_info';
58
58
  export * from './chart_of_pie_split_info';
59
59
  export * from './chart_series_info';
60
+ export * from './check_field_validation_params';
60
61
  export * from './checkpoint_meta';
61
62
  export * from './col_info';
62
63
  export * from './color';
@@ -105,6 +106,7 @@ export * from './ephemeral_cell_remove';
105
106
  export * from './ephemeral_cell_style_update';
106
107
  export * from './error_message';
107
108
  export * from './field_render_entry';
109
+ export * from './field_validation_verdict';
108
110
  export * from './fill';
109
111
  export * from './font';
110
112
  export * from './font_family';
@@ -74,6 +74,7 @@ __exportStar(require("./chart_data_labels_info"), exports);
74
74
  __exportStar(require("./chart_info"), exports);
75
75
  __exportStar(require("./chart_of_pie_split_info"), exports);
76
76
  __exportStar(require("./chart_series_info"), exports);
77
+ __exportStar(require("./check_field_validation_params"), exports);
77
78
  __exportStar(require("./checkpoint_meta"), exports);
78
79
  __exportStar(require("./col_info"), exports);
79
80
  __exportStar(require("./color"), exports);
@@ -122,6 +123,7 @@ __exportStar(require("./ephemeral_cell_remove"), exports);
122
123
  __exportStar(require("./ephemeral_cell_style_update"), exports);
123
124
  __exportStar(require("./error_message"), exports);
124
125
  __exportStar(require("./field_render_entry"), exports);
126
+ __exportStar(require("./field_validation_verdict"), exports);
125
127
  __exportStar(require("./fill"), exports);
126
128
  __exportStar(require("./font"), exports);
127
129
  __exportStar(require("./font_family"), exports);
@@ -17,6 +17,7 @@ import { CellPosition } from './cell_position';
17
17
  import { CellRefRange } from './cell_ref_range';
18
18
  import { CfRuleInfo } from './cf_rule_info';
19
19
  import { ChartInfo } from './chart_info';
20
+ import { CheckFieldValidationParams } from './check_field_validation_params';
20
21
  import { CheckFormulaParams } from './rpc_check_formula_params';
21
22
  import { CheckpointMetaDto } from './checkpoint_meta';
22
23
  import { Comment } from './comment';
@@ -26,6 +27,7 @@ import { DisplayWindow } from './display_window';
26
27
  import { DisplayWindowWithStartPoint } from './display_window_with_start_point';
27
28
  import { ErrorMessage } from './error_message';
28
29
  import { ExportBlockDataParams } from './rpc_export_block_data_params';
30
+ import { FieldValidationVerdict } from './field_validation_verdict';
29
31
  import { FormulaDisplayInfo } from './formula_display_info';
30
32
  import { GetAllBlocksParams } from './rpc_get_all_blocks_params';
31
33
  import { GetAvailableBlockIdParams } from './rpc_get_available_block_id_params';
@@ -126,6 +128,7 @@ export interface WorkbookMethods {
126
128
  getBlockValues(params: GetBlockValuesParams, bookId?: number): Promise<readonly string[] | ErrorMessage>;
127
129
  getBlockSortOrder(params: GetBlockSortOrderParams, bookId?: number): Promise<BlockSortOrder | ErrorMessage>;
128
130
  mayModifyBlock(params: MayModifyBlockParams, bookId?: number): Promise<boolean | ErrorMessage>;
131
+ checkFieldValidation(params: CheckFieldValidationParams, bookId?: number): Promise<FieldValidationVerdict | ErrorMessage>;
129
132
  getBlockModifyInfo(params: GetBlockModifyInfoParams, bookId?: number): Promise<BlockModifyInfo | ErrorMessage>;
130
133
  getAvailableBlockId(params: GetAvailableBlockIdParams, bookId?: number): Promise<number | ErrorMessage>;
131
134
  getAllBlockFields(bookId?: number): Promise<readonly BlockField[] | ErrorMessage>;
@@ -1,15 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function handle(msg: any, book_id?: number | null): any;
3
4
  /**
4
5
  * Render a text value with an Excel number-format code (for the `@` text
5
6
  * section). Falls back to the text itself on an unsupported format.
6
7
  */
7
8
  export function format_text(fmt: string, text: string): string;
8
- /**
9
- * Input: AsyncFuncResult
10
- * Output: ActionAffect
11
- */
12
- export function input_async_result(id: number, result: any): any;
13
9
  /**
14
10
  * Render a number with an Excel number-format code, natively via `ssf-rs`
15
11
  * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
@@ -17,4 +13,8 @@ export function input_async_result(id: number, result: any): any;
17
13
  * JavaScript `String(value)` representation, matching the previous behavior.
18
14
  */
19
15
  export function format_number(fmt: string, value: number): string;
20
- export function handle(msg: any, book_id?: number | null): any;
16
+ /**
17
+ * Input: AsyncFuncResult
18
+ * Output: ActionAffect
19
+ */
20
+ export function input_async_result(id: number, result: any): any;
@@ -170,6 +170,16 @@ function debugString(val) {
170
170
  // TODO we could test for more things here, like `Set`s and `Map`s.
171
171
  return className;
172
172
  }
173
+ /**
174
+ * @param {any} msg
175
+ * @param {number | null} [book_id]
176
+ * @returns {any}
177
+ */
178
+ module.exports.handle = function(msg, book_id) {
179
+ const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
180
+ return ret;
181
+ };
182
+
173
183
  /**
174
184
  * Render a text value with an Excel number-format code (for the `@` text
175
185
  * section). Falls back to the text itself on an unsupported format.
@@ -194,18 +204,6 @@ module.exports.format_text = function(fmt, text) {
194
204
  }
195
205
  };
196
206
 
197
- /**
198
- * Input: AsyncFuncResult
199
- * Output: ActionAffect
200
- * @param {number} id
201
- * @param {any} result
202
- * @returns {any}
203
- */
204
- module.exports.input_async_result = function(id, result) {
205
- const ret = wasm.input_async_result(id, result);
206
- return ret;
207
- };
208
-
209
207
  /**
210
208
  * Render a number with an Excel number-format code, natively via `ssf-rs`
211
209
  * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
@@ -231,12 +229,14 @@ module.exports.format_number = function(fmt, value) {
231
229
  };
232
230
 
233
231
  /**
234
- * @param {any} msg
235
- * @param {number | null} [book_id]
232
+ * Input: AsyncFuncResult
233
+ * Output: ActionAffect
234
+ * @param {number} id
235
+ * @param {any} result
236
236
  * @returns {any}
237
237
  */
238
- module.exports.handle = function(msg, book_id) {
239
- const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
238
+ module.exports.input_async_result = function(id, result) {
239
+ const ret = wasm.input_async_result(id, result);
240
240
  return ret;
241
241
  };
242
242
 
@@ -1,10 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const handle: (a: any, b: number) => any;
4
5
  export const format_number: (a: number, b: number, c: number) => [number, number];
5
6
  export const format_text: (a: number, b: number, c: number, d: number) => [number, number];
6
7
  export const input_async_result: (a: number, b: any) => any;
7
- export const handle: (a: any, b: number) => any;
8
8
  export const __wbindgen_malloc: (a: number, b: number) => number;
9
9
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
10
10
  export const __wbindgen_exn_store: (a: number) => void;
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.14.0",
6
+ "version": "1.14.1",
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.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "Node.js bindings for LogiSheets — a Rust + WebAssembly spreadsheet engine that reads, edits, and writes real .xlsx (Excel) files (formulas, styles, and structure preserved) with no browser required.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,15 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function handle(msg: any, book_id?: number | null): any;
3
4
  /**
4
5
  * Render a text value with an Excel number-format code (for the `@` text
5
6
  * section). Falls back to the text itself on an unsupported format.
6
7
  */
7
8
  export function format_text(fmt: string, text: string): string;
8
- /**
9
- * Input: AsyncFuncResult
10
- * Output: ActionAffect
11
- */
12
- export function input_async_result(id: number, result: any): any;
13
9
  /**
14
10
  * Render a number with an Excel number-format code, natively via `ssf-rs`
15
11
  * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
@@ -17,4 +13,8 @@ export function input_async_result(id: number, result: any): any;
17
13
  * JavaScript `String(value)` representation, matching the previous behavior.
18
14
  */
19
15
  export function format_number(fmt: string, value: number): string;
20
- export function handle(msg: any, book_id?: number | null): any;
16
+ /**
17
+ * Input: AsyncFuncResult
18
+ * Output: ActionAffect
19
+ */
20
+ export function input_async_result(id: number, result: any): any;
@@ -170,6 +170,16 @@ function debugString(val) {
170
170
  // TODO we could test for more things here, like `Set`s and `Map`s.
171
171
  return className;
172
172
  }
173
+ /**
174
+ * @param {any} msg
175
+ * @param {number | null} [book_id]
176
+ * @returns {any}
177
+ */
178
+ module.exports.handle = function(msg, book_id) {
179
+ const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
180
+ return ret;
181
+ };
182
+
173
183
  /**
174
184
  * Render a text value with an Excel number-format code (for the `@` text
175
185
  * section). Falls back to the text itself on an unsupported format.
@@ -194,18 +204,6 @@ module.exports.format_text = function(fmt, text) {
194
204
  }
195
205
  };
196
206
 
197
- /**
198
- * Input: AsyncFuncResult
199
- * Output: ActionAffect
200
- * @param {number} id
201
- * @param {any} result
202
- * @returns {any}
203
- */
204
- module.exports.input_async_result = function(id, result) {
205
- const ret = wasm.input_async_result(id, result);
206
- return ret;
207
- };
208
-
209
207
  /**
210
208
  * Render a number with an Excel number-format code, natively via `ssf-rs`
211
209
  * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
@@ -231,12 +229,14 @@ module.exports.format_number = function(fmt, value) {
231
229
  };
232
230
 
233
231
  /**
234
- * @param {any} msg
235
- * @param {number | null} [book_id]
232
+ * Input: AsyncFuncResult
233
+ * Output: ActionAffect
234
+ * @param {number} id
235
+ * @param {any} result
236
236
  * @returns {any}
237
237
  */
238
- module.exports.handle = function(msg, book_id) {
239
- const ret = wasm.handle(msg, isLikeNone(book_id) ? 0x100000001 : (book_id) >>> 0);
238
+ module.exports.input_async_result = function(id, result) {
239
+ const ret = wasm.input_async_result(id, result);
240
240
  return ret;
241
241
  };
242
242
 
Binary file
@@ -1,10 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const handle: (a: any, b: number) => any;
4
5
  export const format_number: (a: number, b: number, c: number) => [number, number];
5
6
  export const format_text: (a: number, b: number, c: number, d: number) => [number, number];
6
7
  export const input_async_result: (a: number, b: any) => any;
7
- export const handle: (a: any, b: number) => any;
8
8
  export const __wbindgen_malloc: (a: number, b: number) => number;
9
9
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
10
10
  export const __wbindgen_exn_store: (a: number) => void;
package/wasm/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.14.0",
6
+ "version": "1.14.1",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",