microsoft-graph 2.18.3 → 2.18.5
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.
- package/dist/cjs/operations/workbookRange/autoFitWorkbookRangeColumns.js +1 -1
- package/dist/cjs/operations/workbookRange/clearWorkbookRange.js +1 -1
- package/dist/cjs/operations/workbookRange/deleteWorkbookRange.js +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookRangeFill.js +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookRangeFont.js +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookRangeFormat.js +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookVisibleRange.js +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookWorksheetRange.js +1 -1
- package/dist/cjs/operations/workbookRange/setWorkbookRangeFill.js +1 -1
- package/dist/cjs/operations/workbookRange/setWorkbookRangeFont.js +1 -1
- package/dist/cjs/operations/workbookRange/setWorkbookRangeFormat.js +1 -1
- package/dist/cjs/operations/workbookRange/updateWorkbookRange.js +1 -1
- package/dist/cjs/services/rangeManipulation.d.ts +5 -1
- package/dist/cjs/services/rangeManipulation.d.ts.map +1 -1
- package/dist/cjs/services/rangeManipulation.js +8 -8
- package/dist/esm/operations/workbookRange/autoFitWorkbookRangeColumns.js +1 -1
- package/dist/esm/operations/workbookRange/clearWorkbookRange.js +1 -1
- package/dist/esm/operations/workbookRange/deleteWorkbookRange.js +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookRangeFill.js +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookRangeFont.js +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookRangeFormat.js +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookVisibleRange.js +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookWorksheetRange.js +1 -1
- package/dist/esm/operations/workbookRange/setWorkbookRangeFill.js +1 -1
- package/dist/esm/operations/workbookRange/setWorkbookRangeFont.js +1 -1
- package/dist/esm/operations/workbookRange/setWorkbookRangeFormat.js +1 -1
- package/dist/esm/operations/workbookRange/updateWorkbookRange.js +1 -1
- package/dist/esm/services/rangeManipulation.d.ts +5 -1
- package/dist/esm/services/rangeManipulation.d.ts.map +1 -1
- package/dist/esm/services/rangeManipulation.js +8 -8
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
12
12
|
* @see https://learn.microsoft.com/en-us/graph/api/rangeformat-autofitcolumns
|
|
13
13
|
*/
|
|
14
14
|
function autoFitWorkbookRangeColumns(rangeRef) {
|
|
15
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
15
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
16
16
|
return (0, graphApi_ts_1.operation)({
|
|
17
17
|
contextId: rangeRef.contextId,
|
|
18
18
|
method: "POST",
|
|
@@ -13,7 +13,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
13
13
|
* @see https://learn.microsoft.com/en-us/graph/api/range-delete
|
|
14
14
|
*/
|
|
15
15
|
function clearWorkbookRange(rangeRef, applyTo = "All") {
|
|
16
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
16
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
17
17
|
return (0, graphApi_ts_1.operation)({
|
|
18
18
|
contextId: rangeRef.contextId,
|
|
19
19
|
method: "POST",
|
|
@@ -13,7 +13,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
13
13
|
* @see https://learn.microsoft.com/en-us/graph/api/range-clear
|
|
14
14
|
*/
|
|
15
15
|
function deleteWorkbookRange(rangeRef, shift) {
|
|
16
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
16
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
17
17
|
return (0, graphApi_ts_1.operation)({
|
|
18
18
|
contextId: rangeRef.contextId,
|
|
19
19
|
method: "POST",
|
|
@@ -13,7 +13,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
13
13
|
* @see https://learn.microsoft.com/en-us/graph/api/rangefill-get
|
|
14
14
|
*/
|
|
15
15
|
function getWorkbookRangeFill(rangeRef) {
|
|
16
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
16
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
17
17
|
return (0, graphApi_ts_1.operation)({
|
|
18
18
|
contextId: rangeRef.contextId,
|
|
19
19
|
method: "GET",
|
|
@@ -13,7 +13,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
13
13
|
* @see https://learn.microsoft.com/en-us/graph/api/rangefont-get
|
|
14
14
|
*/
|
|
15
15
|
function getWorkbookRangeFont(rangeRef) {
|
|
16
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
16
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
17
17
|
return (0, graphApi_ts_1.operation)({
|
|
18
18
|
contextId: rangeRef.contextId,
|
|
19
19
|
method: "GET",
|
|
@@ -12,7 +12,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
12
12
|
* @see https://learn.microsoft.com/en-us/graph/api/rangeformat-get
|
|
13
13
|
*/
|
|
14
14
|
function getWorkbookRangeFormat(rangeRef) {
|
|
15
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
15
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
16
16
|
return (0, graphApi_ts_1.operation)({
|
|
17
17
|
contextId: rangeRef.contextId,
|
|
18
18
|
method: "GET",
|
|
@@ -12,7 +12,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
12
12
|
* @see https://learn.microsoft.com/en-us/graph/api/workbookrange-visibleview
|
|
13
13
|
*/
|
|
14
14
|
function getWorkbookVisibleRange(rangeRef) {
|
|
15
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
15
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
16
16
|
// TODO: Should be a visible ref type?
|
|
17
17
|
return (0, graphApi_ts_1.operation)({
|
|
18
18
|
contextId: rangeRef.contextId,
|
|
@@ -12,7 +12,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
12
12
|
* @see https://learn.microsoft.com/en-us/graph/api/range-get
|
|
13
13
|
*/
|
|
14
14
|
function getWorkbookWorksheetRange(rangeRef) {
|
|
15
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
15
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
16
16
|
return (0, graphApi_ts_1.operation)({
|
|
17
17
|
contextId: rangeRef.contextId,
|
|
18
18
|
method: "GET",
|
|
@@ -12,7 +12,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
12
12
|
* @see https://learn.microsoft.com/en-us/graph/api/rangefill-update
|
|
13
13
|
*/
|
|
14
14
|
function setWorkbookRangeFill(rangeRef, format) {
|
|
15
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
15
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
16
16
|
return (0, graphApi_ts_1.operation)({
|
|
17
17
|
contextId: rangeRef.contextId,
|
|
18
18
|
method: "PATCH",
|
|
@@ -12,7 +12,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
12
12
|
* @see https://learn.microsoft.com/en-us/graph/api/rangefont-update
|
|
13
13
|
*/
|
|
14
14
|
function setWorkbookRangeFont(rangeRef, format) {
|
|
15
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
15
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
16
16
|
return (0, graphApi_ts_1.operation)({
|
|
17
17
|
contextId: rangeRef.contextId,
|
|
18
18
|
method: "PATCH",
|
|
@@ -14,7 +14,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
14
14
|
* @see https://learn.microsoft.com/en-us/graph/api/rangeformat-update
|
|
15
15
|
*/
|
|
16
16
|
function setWorkbookRangeFormat(rangeRef, format) {
|
|
17
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
17
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
18
18
|
return (0, graphApi_ts_1.operation)({
|
|
19
19
|
contextId: rangeRef.contextId,
|
|
20
20
|
method: "PATCH",
|
|
@@ -13,7 +13,7 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
13
13
|
* @see https://learn.microsoft.com/en-us/graph/api/range-update
|
|
14
14
|
*/
|
|
15
15
|
function updateWorkbookRange(rangeRef, update) {
|
|
16
|
-
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address);
|
|
16
|
+
const address = (0, addressManipulation_ts_1.normalizeAddress)(rangeRef.address, true);
|
|
17
17
|
return (0, graphApi_ts_1.operation)({
|
|
18
18
|
contextId: rangeRef.contextId,
|
|
19
19
|
method: "PATCH",
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { Address } from "../models/Address.ts";
|
|
2
2
|
import type { CellRangeValues } from "../models/CellRangeValues.ts";
|
|
3
|
+
import type { ColumnOffset } from "../models/ColumnOffset.ts";
|
|
4
|
+
import type { RowOffset } from "../models/RowOffset.ts";
|
|
3
5
|
/**
|
|
4
6
|
* Converts a 2D array of cell values into range address in the upper left.
|
|
5
7
|
*
|
|
6
8
|
* @param {CellRangeValues} values - A 2D array representing cell values.
|
|
9
|
+
* @param {RowOffset} [rowOffset=0] - The row offset to apply to the range address.
|
|
10
|
+
* @param {ColumnOffset} [columnOffset=0] - The column offset to apply to the range address.
|
|
7
11
|
* @returns {Address} The default cell range address (e.g., "A1:C3").
|
|
8
12
|
* @throws {InvalidArgumentError} If rows have inconsistent column counts.
|
|
9
13
|
*/
|
|
10
|
-
export declare function inferRangeAddress(values: CellRangeValues): Address;
|
|
14
|
+
export declare function inferRangeAddress(values: CellRangeValues, rowOffset?: RowOffset, columnOffset?: ColumnOffset): Address;
|
|
11
15
|
/**
|
|
12
16
|
* Converts a 2D array of cell values into an array of objects.
|
|
13
17
|
* Assumes the first row is a header and uses it as keys for the objects.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,GAAE,SAA0B,EAAE,YAAY,GAAE,YAAgC,GAAG,OAAO,CAyBzJ;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAoBnE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,GAAE,MAAM,EAAE,GAAG,IAAW,GAAG,eAAe,CASjG"}
|
|
@@ -12,12 +12,14 @@ const cartesianAddress_ts_1 = require("./cartesianAddress.js");
|
|
|
12
12
|
* Converts a 2D array of cell values into range address in the upper left.
|
|
13
13
|
*
|
|
14
14
|
* @param {CellRangeValues} values - A 2D array representing cell values.
|
|
15
|
+
* @param {RowOffset} [rowOffset=0] - The row offset to apply to the range address.
|
|
16
|
+
* @param {ColumnOffset} [columnOffset=0] - The column offset to apply to the range address.
|
|
15
17
|
* @returns {Address} The default cell range address (e.g., "A1:C3").
|
|
16
18
|
* @throws {InvalidArgumentError} If rows have inconsistent column counts.
|
|
17
19
|
*/
|
|
18
|
-
function inferRangeAddress(values) {
|
|
20
|
+
function inferRangeAddress(values, rowOffset = 0, columnOffset = 0) {
|
|
19
21
|
const first = values[0];
|
|
20
|
-
if (!first) {
|
|
22
|
+
if (!first || first.length === 0) {
|
|
21
23
|
return "A1";
|
|
22
24
|
}
|
|
23
25
|
for (const row of values) {
|
|
@@ -27,14 +29,12 @@ function inferRangeAddress(values) {
|
|
|
27
29
|
}
|
|
28
30
|
const rowCount = values.length;
|
|
29
31
|
const columnCount = first.length;
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const endRow = (rowCount - 1);
|
|
33
|
-
const endColumn = (columnCount - 1);
|
|
32
|
+
const endRow = (rowOffset + rowCount - 1);
|
|
33
|
+
const endColumn = (columnOffset + columnCount - 1);
|
|
34
34
|
return (0, cartesianAddress_ts_1.cartesianToAddress)({
|
|
35
|
-
ax:
|
|
36
|
-
ay: startRow,
|
|
35
|
+
ax: columnOffset,
|
|
37
36
|
bx: endColumn,
|
|
37
|
+
ay: rowOffset,
|
|
38
38
|
by: endRow,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
9
9
|
* @see https://learn.microsoft.com/en-us/graph/api/rangeformat-autofitcolumns
|
|
10
10
|
*/
|
|
11
11
|
export default function autoFitWorkbookRangeColumns(rangeRef) {
|
|
12
|
-
const address = normalizeAddress(rangeRef.address);
|
|
12
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
13
13
|
return operation({
|
|
14
14
|
contextId: rangeRef.contextId,
|
|
15
15
|
method: "POST",
|
|
@@ -10,7 +10,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
10
10
|
* @see https://learn.microsoft.com/en-us/graph/api/range-delete
|
|
11
11
|
*/
|
|
12
12
|
export default function clearWorkbookRange(rangeRef, applyTo = "All") {
|
|
13
|
-
const address = normalizeAddress(rangeRef.address);
|
|
13
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
14
14
|
return operation({
|
|
15
15
|
contextId: rangeRef.contextId,
|
|
16
16
|
method: "POST",
|
|
@@ -10,7 +10,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
10
10
|
* @see https://learn.microsoft.com/en-us/graph/api/range-clear
|
|
11
11
|
*/
|
|
12
12
|
export default function deleteWorkbookRange(rangeRef, shift) {
|
|
13
|
-
const address = normalizeAddress(rangeRef.address);
|
|
13
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
14
14
|
return operation({
|
|
15
15
|
contextId: rangeRef.contextId,
|
|
16
16
|
method: "POST",
|
|
@@ -10,7 +10,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
10
10
|
* @see https://learn.microsoft.com/en-us/graph/api/rangefill-get
|
|
11
11
|
*/
|
|
12
12
|
export default function getWorkbookRangeFill(rangeRef) {
|
|
13
|
-
const address = normalizeAddress(rangeRef.address);
|
|
13
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
14
14
|
return operation({
|
|
15
15
|
contextId: rangeRef.contextId,
|
|
16
16
|
method: "GET",
|
|
@@ -10,7 +10,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
10
10
|
* @see https://learn.microsoft.com/en-us/graph/api/rangefont-get
|
|
11
11
|
*/
|
|
12
12
|
export default function getWorkbookRangeFont(rangeRef) {
|
|
13
|
-
const address = normalizeAddress(rangeRef.address);
|
|
13
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
14
14
|
return operation({
|
|
15
15
|
contextId: rangeRef.contextId,
|
|
16
16
|
method: "GET",
|
|
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
9
9
|
* @see https://learn.microsoft.com/en-us/graph/api/rangeformat-get
|
|
10
10
|
*/
|
|
11
11
|
export default function getWorkbookRangeFormat(rangeRef) {
|
|
12
|
-
const address = normalizeAddress(rangeRef.address);
|
|
12
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
13
13
|
return operation({
|
|
14
14
|
contextId: rangeRef.contextId,
|
|
15
15
|
method: "GET",
|
|
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
9
9
|
* @see https://learn.microsoft.com/en-us/graph/api/workbookrange-visibleview
|
|
10
10
|
*/
|
|
11
11
|
export default function getWorkbookVisibleRange(rangeRef) {
|
|
12
|
-
const address = normalizeAddress(rangeRef.address);
|
|
12
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
13
13
|
// TODO: Should be a visible ref type?
|
|
14
14
|
return operation({
|
|
15
15
|
contextId: rangeRef.contextId,
|
|
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
9
9
|
* @see https://learn.microsoft.com/en-us/graph/api/range-get
|
|
10
10
|
*/
|
|
11
11
|
export default function getWorkbookWorksheetRange(rangeRef) {
|
|
12
|
-
const address = normalizeAddress(rangeRef.address);
|
|
12
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
13
13
|
return operation({
|
|
14
14
|
contextId: rangeRef.contextId,
|
|
15
15
|
method: "GET",
|
|
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
9
9
|
* @see https://learn.microsoft.com/en-us/graph/api/rangefill-update
|
|
10
10
|
*/
|
|
11
11
|
export default function setWorkbookRangeFill(rangeRef, format) {
|
|
12
|
-
const address = normalizeAddress(rangeRef.address);
|
|
12
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
13
13
|
return operation({
|
|
14
14
|
contextId: rangeRef.contextId,
|
|
15
15
|
method: "PATCH",
|
|
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
9
9
|
* @see https://learn.microsoft.com/en-us/graph/api/rangefont-update
|
|
10
10
|
*/
|
|
11
11
|
export default function setWorkbookRangeFont(rangeRef, format) {
|
|
12
|
-
const address = normalizeAddress(rangeRef.address);
|
|
12
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
13
13
|
return operation({
|
|
14
14
|
contextId: rangeRef.contextId,
|
|
15
15
|
method: "PATCH",
|
|
@@ -11,7 +11,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
11
11
|
* @see https://learn.microsoft.com/en-us/graph/api/rangeformat-update
|
|
12
12
|
*/
|
|
13
13
|
export default function setWorkbookRangeFormat(rangeRef, format) {
|
|
14
|
-
const address = normalizeAddress(rangeRef.address);
|
|
14
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
15
15
|
return operation({
|
|
16
16
|
contextId: rangeRef.contextId,
|
|
17
17
|
method: "PATCH",
|
|
@@ -10,7 +10,7 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
10
10
|
* @see https://learn.microsoft.com/en-us/graph/api/range-update
|
|
11
11
|
*/
|
|
12
12
|
export default function updateWorkbookRange(rangeRef, update) {
|
|
13
|
-
const address = normalizeAddress(rangeRef.address);
|
|
13
|
+
const address = normalizeAddress(rangeRef.address, true);
|
|
14
14
|
return operation({
|
|
15
15
|
contextId: rangeRef.contextId,
|
|
16
16
|
method: "PATCH",
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { Address } from "../models/Address.ts";
|
|
2
2
|
import type { CellRangeValues } from "../models/CellRangeValues.ts";
|
|
3
|
+
import type { ColumnOffset } from "../models/ColumnOffset.ts";
|
|
4
|
+
import type { RowOffset } from "../models/RowOffset.ts";
|
|
3
5
|
/**
|
|
4
6
|
* Converts a 2D array of cell values into range address in the upper left.
|
|
5
7
|
*
|
|
6
8
|
* @param {CellRangeValues} values - A 2D array representing cell values.
|
|
9
|
+
* @param {RowOffset} [rowOffset=0] - The row offset to apply to the range address.
|
|
10
|
+
* @param {ColumnOffset} [columnOffset=0] - The column offset to apply to the range address.
|
|
7
11
|
* @returns {Address} The default cell range address (e.g., "A1:C3").
|
|
8
12
|
* @throws {InvalidArgumentError} If rows have inconsistent column counts.
|
|
9
13
|
*/
|
|
10
|
-
export declare function inferRangeAddress(values: CellRangeValues): Address;
|
|
14
|
+
export declare function inferRangeAddress(values: CellRangeValues, rowOffset?: RowOffset, columnOffset?: ColumnOffset): Address;
|
|
11
15
|
/**
|
|
12
16
|
* Converts a 2D array of cell values into an array of objects.
|
|
13
17
|
* Assumes the first row is a header and uses it as keys for the objects.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,GAAE,SAA0B,EAAE,YAAY,GAAE,YAAgC,GAAG,OAAO,CAyBzJ;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAoBnE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,GAAE,MAAM,EAAE,GAAG,IAAW,GAAG,eAAe,CASjG"}
|
|
@@ -4,12 +4,14 @@ import { cartesianToAddress } from "./cartesianAddress.js";
|
|
|
4
4
|
* Converts a 2D array of cell values into range address in the upper left.
|
|
5
5
|
*
|
|
6
6
|
* @param {CellRangeValues} values - A 2D array representing cell values.
|
|
7
|
+
* @param {RowOffset} [rowOffset=0] - The row offset to apply to the range address.
|
|
8
|
+
* @param {ColumnOffset} [columnOffset=0] - The column offset to apply to the range address.
|
|
7
9
|
* @returns {Address} The default cell range address (e.g., "A1:C3").
|
|
8
10
|
* @throws {InvalidArgumentError} If rows have inconsistent column counts.
|
|
9
11
|
*/
|
|
10
|
-
export function inferRangeAddress(values) {
|
|
12
|
+
export function inferRangeAddress(values, rowOffset = 0, columnOffset = 0) {
|
|
11
13
|
const first = values[0];
|
|
12
|
-
if (!first) {
|
|
14
|
+
if (!first || first.length === 0) {
|
|
13
15
|
return "A1";
|
|
14
16
|
}
|
|
15
17
|
for (const row of values) {
|
|
@@ -19,14 +21,12 @@ export function inferRangeAddress(values) {
|
|
|
19
21
|
}
|
|
20
22
|
const rowCount = values.length;
|
|
21
23
|
const columnCount = first.length;
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const endRow = (rowCount - 1);
|
|
25
|
-
const endColumn = (columnCount - 1);
|
|
24
|
+
const endRow = (rowOffset + rowCount - 1);
|
|
25
|
+
const endColumn = (columnOffset + columnCount - 1);
|
|
26
26
|
return cartesianToAddress({
|
|
27
|
-
ax:
|
|
28
|
-
ay: startRow,
|
|
27
|
+
ax: columnOffset,
|
|
29
28
|
bx: endColumn,
|
|
29
|
+
ay: rowOffset,
|
|
30
30
|
by: endRow,
|
|
31
31
|
});
|
|
32
32
|
}
|