logisheets-core 1.6.0 → 1.7.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.
@@ -120,6 +120,23 @@ export declare class WorkbookOps {
120
120
  keyIdx: number;
121
121
  fields: readonly FormBlockField[];
122
122
  }): Promise<void>;
123
+ /**
124
+ * Turn an EXISTING cell region into a form-backed block in place: like
125
+ * `createFormBlock`, but `convertBlock` (keeps the region's cells + values
126
+ * and its row/col extent, and remaps formulas that reference the range so
127
+ * they track the block). `fields.length` must equal the region's columns.
128
+ */
129
+ convertToFormBlock(opts: {
130
+ sheetIdx: number;
131
+ blockId: number;
132
+ masterRow: number;
133
+ masterCol: number;
134
+ rowCnt: number;
135
+ colCnt: number;
136
+ refName: string;
137
+ keyIdx: number;
138
+ fields: readonly FormBlockField[];
139
+ }): Promise<void>;
123
140
  /**
124
141
  * Apply a caller-built payload list as one transaction (at the host's
125
142
  * temp-mode). Escape hatch for operations whose payload construction still
package/dist/ops/index.js CHANGED
@@ -227,6 +227,53 @@ export class WorkbookOps {
227
227
  ];
228
228
  await this.apply(payloads, true);
229
229
  }
230
+ /**
231
+ * Turn an EXISTING cell region into a form-backed block in place: like
232
+ * `createFormBlock`, but `convertBlock` (keeps the region's cells + values
233
+ * and its row/col extent, and remaps formulas that reference the range so
234
+ * they track the block). `fields.length` must equal the region's columns.
235
+ */
236
+ async convertToFormBlock(opts) {
237
+ const { sheetIdx, blockId, masterRow, masterCol, rowCnt, colCnt, refName, keyIdx, fields, } = opts;
238
+ const payloads = [
239
+ {
240
+ type: 'convertBlock',
241
+ value: {
242
+ sheetIdx,
243
+ id: blockId,
244
+ masterRow,
245
+ masterCol,
246
+ rowCnt,
247
+ colCnt,
248
+ },
249
+ },
250
+ {
251
+ type: 'bindFormSchema',
252
+ value: {
253
+ refName,
254
+ sheetIdx,
255
+ blockId,
256
+ fieldFrom: 0,
257
+ row: true,
258
+ keyIdx: keyIdx < 0 ? 0 : keyIdx,
259
+ fields: fields.map((f) => f.name),
260
+ renderIds: fields.map((f) => f.renderId),
261
+ fieldFormulas: fields.map((f) => f.valueFormula ?? ''),
262
+ validationFormulas: [],
263
+ editabilityFormulas: [],
264
+ },
265
+ },
266
+ ...fields.map((f) => ({
267
+ type: 'upsertFieldRenderInfo',
268
+ value: {
269
+ renderId: f.renderId,
270
+ diyRender: f.diyRender,
271
+ styleUpdate: { setNumFmt: f.numFmt ?? '' },
272
+ },
273
+ })),
274
+ ];
275
+ await this.apply(payloads, true);
276
+ }
230
277
  // ---- generic / temp-branch -----------------------------------------
231
278
  /**
232
279
  * Apply a caller-built payload list as one transaction (at the host's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logisheets-core",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "UI-free LogiSheets logic — runs in the browser or on Node. Depends on logisheets-web only for types; the engine Client is injected by the host.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "author": "Jeremy He",
45
45
  "license": "MIT",
46
46
  "peerDependencies": {
47
- "logisheets-web": "^1.6.0"
47
+ "logisheets-web": "^1.7.1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "logisheets-web": "workspace:*",