microsoft-graph 2.32.0 → 2.34.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.
- package/dist/cjs/models/Cell.d.ts +24 -33
- package/dist/cjs/models/Cell.d.ts.map +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookRangeFormat.d.ts.map +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookRangeFormat.js +1 -0
- package/dist/cjs/operations/workbookRange/getWorkbookWorksheetRange.d.ts.map +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookWorksheetRange.js +1 -5
- package/dist/cjs/services/dataSource.js +5 -7
- package/dist/cjs/services/stringCaseConversion.d.ts +6 -0
- package/dist/cjs/services/stringCaseConversion.d.ts.map +1 -1
- package/dist/cjs/services/stringCaseConversion.js +12 -0
- package/dist/cjs/tasks/insertWorkbookRangeRow.d.ts +18 -0
- package/dist/cjs/tasks/insertWorkbookRangeRow.d.ts.map +1 -0
- package/dist/cjs/tasks/insertWorkbookRangeRow.js +24 -0
- package/dist/cjs/tasks/insertWorkbookRangeRows.d.ts +31 -0
- package/dist/cjs/tasks/insertWorkbookRangeRows.d.ts.map +1 -0
- package/dist/cjs/tasks/insertWorkbookRangeRows.js +80 -0
- package/dist/cjs/tasks/iterateWorkbookRange.d.ts.map +1 -1
- package/dist/cjs/tasks/iterateWorkbookRange.js +5 -7
- package/dist/cjs/tasks/{iterateRows.d.ts → iterateWorkbookRangeRows.d.ts} +3 -4
- package/dist/cjs/tasks/iterateWorkbookRangeRows.d.ts.map +1 -0
- package/dist/cjs/tasks/{iterateRows.js → iterateWorkbookRangeRows.js} +59 -39
- package/dist/{esm/tasks/readFirstRow.d.ts → cjs/tasks/readWorkbookRangeFirstRow.d.ts} +2 -2
- package/dist/cjs/tasks/readWorkbookRangeFirstRow.d.ts.map +1 -0
- package/dist/cjs/tasks/{readFirstRow.js → readWorkbookRangeFirstRow.js} +4 -4
- package/dist/{esm/tasks/readRows.d.ts → cjs/tasks/readWorkbookRangeRows.d.ts} +3 -3
- package/dist/cjs/tasks/readWorkbookRangeRows.d.ts.map +1 -0
- package/dist/cjs/tasks/{readRows.js → readWorkbookRangeRows.js} +5 -5
- package/dist/cjs/tasks/readWorkbookRows.d.ts.map +1 -1
- package/dist/cjs/tasks/readWorkbookRows.js +5 -8
- package/dist/cjs/tasks/updateWorkbookRangeFirstRow.d.ts +26 -0
- package/dist/cjs/tasks/updateWorkbookRangeFirstRow.d.ts.map +1 -0
- package/dist/cjs/tasks/updateWorkbookRangeFirstRow.js +33 -0
- package/dist/cjs/tasks/updateWorkbookRangeRows.d.ts +26 -0
- package/dist/cjs/tasks/updateWorkbookRangeRows.d.ts.map +1 -0
- package/dist/cjs/tasks/updateWorkbookRangeRows.js +255 -0
- package/dist/cjs/tasks/writeWorkbookRows.js +4 -4
- package/dist/esm/models/Cell.d.ts +24 -33
- package/dist/esm/models/Cell.d.ts.map +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookRangeFormat.d.ts.map +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookRangeFormat.js +1 -0
- package/dist/esm/operations/workbookRange/getWorkbookWorksheetRange.d.ts.map +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookWorksheetRange.js +1 -5
- package/dist/esm/services/dataSource.js +5 -7
- package/dist/esm/services/stringCaseConversion.d.ts +6 -0
- package/dist/esm/services/stringCaseConversion.d.ts.map +1 -1
- package/dist/esm/services/stringCaseConversion.js +11 -0
- package/dist/esm/tasks/insertWorkbookRangeRow.d.ts +18 -0
- package/dist/esm/tasks/insertWorkbookRangeRow.d.ts.map +1 -0
- package/dist/esm/tasks/insertWorkbookRangeRow.js +18 -0
- package/dist/esm/tasks/insertWorkbookRangeRows.d.ts +31 -0
- package/dist/esm/tasks/insertWorkbookRangeRows.d.ts.map +1 -0
- package/dist/esm/tasks/insertWorkbookRangeRows.js +74 -0
- package/dist/esm/tasks/iterateWorkbookRange.d.ts.map +1 -1
- package/dist/esm/tasks/iterateWorkbookRange.js +5 -7
- package/dist/esm/tasks/{iterateRows.d.ts → iterateWorkbookRangeRows.d.ts} +3 -4
- package/dist/esm/tasks/iterateWorkbookRangeRows.d.ts.map +1 -0
- package/dist/esm/tasks/{iterateRows.js → iterateWorkbookRangeRows.js} +58 -38
- package/dist/{cjs/tasks/readFirstRow.d.ts → esm/tasks/readWorkbookRangeFirstRow.d.ts} +2 -2
- package/dist/esm/tasks/readWorkbookRangeFirstRow.d.ts.map +1 -0
- package/dist/esm/tasks/{readFirstRow.js → readWorkbookRangeFirstRow.js} +3 -3
- package/dist/{cjs/tasks/readRows.d.ts → esm/tasks/readWorkbookRangeRows.d.ts} +3 -3
- package/dist/esm/tasks/readWorkbookRangeRows.d.ts.map +1 -0
- package/dist/esm/tasks/{readRows.js → readWorkbookRangeRows.js} +4 -4
- package/dist/esm/tasks/readWorkbookRows.d.ts.map +1 -1
- package/dist/esm/tasks/readWorkbookRows.js +5 -8
- package/dist/esm/tasks/updateWorkbookRangeFirstRow.d.ts +26 -0
- package/dist/esm/tasks/updateWorkbookRangeFirstRow.d.ts.map +1 -0
- package/dist/esm/tasks/updateWorkbookRangeFirstRow.js +27 -0
- package/dist/esm/tasks/updateWorkbookRangeRows.d.ts +26 -0
- package/dist/esm/tasks/updateWorkbookRangeRows.d.ts.map +1 -0
- package/dist/esm/tasks/updateWorkbookRangeRows.js +249 -0
- package/dist/esm/tasks/writeWorkbookRows.js +4 -4
- package/docs/api/Cell.md +39 -55
- package/docs/api/CellFormat.md +5 -5
- package/docs/api/README.md +4 -0
- package/docs/api/getWorkbookRangeFormat.md +1 -1
- package/docs/api/getWorkbookWorksheetRange.md +1 -1
- package/docs/api/insertRow.md +34 -0
- package/docs/api/insertRows.md +47 -0
- package/docs/api/iterateRows.md +9 -13
- package/docs/api/readFirstRow.md +3 -3
- package/docs/api/readRows.md +4 -4
- package/docs/api/readWorkbookRows.md +1 -1
- package/docs/api/stringCaseConversion.md +22 -0
- package/docs/api/updateFirstRow.md +45 -0
- package/docs/api/updateRows.md +51 -0
- package/package.json +174 -74
- package/dist/cjs/tasks/iterateRows.d.ts.map +0 -1
- package/dist/cjs/tasks/readFirstRow.d.ts.map +0 -1
- package/dist/cjs/tasks/readRows.d.ts.map +0 -1
- package/dist/esm/tasks/iterateRows.d.ts.map +0 -1
- package/dist/esm/tasks/readFirstRow.d.ts.map +0 -1
- package/dist/esm/tasks/readRows.d.ts.map +0 -1
|
@@ -24,32 +24,6 @@ export type Cell = {
|
|
|
24
24
|
* Formatting that is applied to the value to derive the text representation.
|
|
25
25
|
*/
|
|
26
26
|
format: CellFormat;
|
|
27
|
-
/**
|
|
28
|
-
* Style applied to the cell to affect its appearance, like color, borders, alignment, etc.
|
|
29
|
-
*/
|
|
30
|
-
style: CellStyle;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* CellValue represents the value of a cell in a spreadsheet.
|
|
34
|
-
* @see {@link Cell} for a more comprehensive representation of a cell, which includes text and formatting.
|
|
35
|
-
*/
|
|
36
|
-
export type CellValue = string | number | boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Text content of a cell in a worksheet.
|
|
39
|
-
* @remarks This is a string that represents the text displayed in the cell, which may differ from the actual value of the cell (e.g., due to formatting).
|
|
40
|
-
*/
|
|
41
|
-
export type CellText = string;
|
|
42
|
-
/**
|
|
43
|
-
* Format to be applied to a cell value to convert it to text to display to the user.
|
|
44
|
-
* @see {@link Cell} for a more comprehensive representation of a cell, which includes text and formatting.
|
|
45
|
-
*/
|
|
46
|
-
export type CellFormat = string & {
|
|
47
|
-
__brand: "CellFormat";
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Style applied to the cell to affect its appearance, like color, borders, alignment, etc.
|
|
51
|
-
*/
|
|
52
|
-
export type CellStyle = {
|
|
53
27
|
/**
|
|
54
28
|
* Number of cell merges (WRITE ONLY).
|
|
55
29
|
* @remarks Due to API limitations, this value is never populated when reading a cell, but it can be set when writing a cell.
|
|
@@ -73,10 +47,10 @@ export type CellStyle = {
|
|
|
73
47
|
* @experimental
|
|
74
48
|
*/
|
|
75
49
|
borders: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
50
|
+
edgeTop?: Border | undefined;
|
|
51
|
+
edgeBottom?: Border | undefined;
|
|
52
|
+
edgeLeft?: Border | undefined;
|
|
53
|
+
edgeRight?: Border | undefined;
|
|
80
54
|
insideVertical?: Border | undefined;
|
|
81
55
|
insideHorizontal?: Border | undefined;
|
|
82
56
|
diagonalDown?: Border | undefined;
|
|
@@ -102,15 +76,32 @@ export type CellStyle = {
|
|
|
102
76
|
underline?: CellUnderline;
|
|
103
77
|
};
|
|
104
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* CellValue represents the value of a cell in a spreadsheet.
|
|
81
|
+
* @see {@link Cell} for a more comprehensive representation of a cell, which includes text and formatting.
|
|
82
|
+
*/
|
|
83
|
+
export type CellValue = string | number | boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Text content of a cell in a worksheet.
|
|
86
|
+
* @remarks This is a string that represents the text displayed in the cell, which may differ from the actual value of the cell (e.g., due to formatting).
|
|
87
|
+
*/
|
|
88
|
+
export type CellText = string;
|
|
89
|
+
/**
|
|
90
|
+
* Format to be applied to a cell value to convert it to text to display to the user.
|
|
91
|
+
* @see {@link Cell} for a more comprehensive representation of a cell, which includes text and formatting.
|
|
92
|
+
*/
|
|
93
|
+
export type CellFormat = string & {
|
|
94
|
+
__brand: "CellFormat";
|
|
95
|
+
};
|
|
105
96
|
/**
|
|
106
97
|
* The amount of detail that we're reading from a cell.
|
|
107
98
|
*/
|
|
108
99
|
export type CellScope = {
|
|
109
|
-
/** Raw cell value. CHEAP (
|
|
100
|
+
/** Raw cell value. CHEAP (+1 op per 10K cells, no additional op with `text` or `format`) */
|
|
110
101
|
values: boolean;
|
|
111
|
-
/** Formatted value, as presented to the user. CHEAP (
|
|
102
|
+
/** Formatted value, as presented to the user. CHEAP (+1 op per 10K cells, no additional call op `values` or `format`) */
|
|
112
103
|
text: boolean;
|
|
113
|
-
/** Logic used to format values to text. CHEAP (
|
|
104
|
+
/** Logic used to format values to text. CHEAP (+1 op per 10K cells, no additional call op `values` or `text`) */
|
|
114
105
|
format: boolean;
|
|
115
106
|
/** Content position with the cell. VERY EXPENSIVE (+1 op per cell) */
|
|
116
107
|
alignment: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG;IAClB;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;IAEnB
|
|
1
|
+
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG;IAClB;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;IAEnB;;;;OAIG;IACH,KAAK,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IAEF;;;OAGG;IACH,SAAS,EAAE;QACV,UAAU,CAAC,EAAE,uBAAuB,CAAC;QACrC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;QACjC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC/B,CAAC;IAEF;;;OAGG;IACH,OAAO,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAChC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACpC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACtC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC,CAAC;IAEF;;;OAGG;IACH,IAAI,EAAE;QACL,KAAK,CAAC,EAAE,KAAK,CAAC;KACd,CAAC;IACF;;;OAGG;IACH,IAAI,EAAE;QACL,IAAI,CAAC,EAAE,QAAQ,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,SAAS,CAAC,EAAE,aAAa,CAAC;KAC1B,CAAC;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IACjC,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,4FAA4F;IAC5F,MAAM,EAAE,OAAO,CAAC;IAEhB,yHAAyH;IACzH,IAAI,EAAE,OAAO,CAAC;IAEd,iHAAiH;IACjH,MAAM,EAAE,OAAO,CAAC;IAEhB,sEAAsE;IACtE,SAAS,EAAE,OAAO,CAAC;IAEnB,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IAEjB,8DAA8D;IAC9D,IAAI,EAAE,OAAO,CAAC;IAEd,kDAAkD;IAClD,IAAI,EAAE,OAAO,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,uBAAuB,GAAG,aAAa,CAAC;AAE7I,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAC;AAE5F,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,kBAAkB,GAAG,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkbookRangeFormat.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookRange/getWorkbookRangeFormat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getWorkbookRangeFormat.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookRange/getWorkbookRangeFormat.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKtE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,cAAc,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAmBjI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkbookWorksheetRange.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookRange/getWorkbookWorksheetRange.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getWorkbookWorksheetRange.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookRange/getWorkbookWorksheetRange.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKtE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,cAAc,CAAC,aAAa,GAAG,gBAAgB,CAAC,CA2BrM"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* Fetch a range.
|
|
4
|
-
* @module getWorkbookWorksheetRange
|
|
5
|
-
* @category Operations
|
|
6
|
-
*/
|
|
2
|
+
// TODO: Rename to getWorkbookRangeValueTextFormat
|
|
7
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
4
|
exports.default = getWorkbookWorksheetRange;
|
|
9
5
|
const addressManipulation_ts_1 = require("../../services/addressManipulation.js");
|
|
@@ -174,13 +174,11 @@ function recordToRow(record, source) {
|
|
|
174
174
|
value: cell.value ?? "",
|
|
175
175
|
text: cell.text ?? (cell.value ?? "").toString(),
|
|
176
176
|
format: cell.format ?? cell_ts_1.generalCellFormat,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
font: {},
|
|
183
|
-
},
|
|
177
|
+
merge: {},
|
|
178
|
+
alignment: {},
|
|
179
|
+
borders: {},
|
|
180
|
+
fill: {},
|
|
181
|
+
font: {},
|
|
184
182
|
};
|
|
185
183
|
});
|
|
186
184
|
return row;
|
|
@@ -9,4 +9,10 @@
|
|
|
9
9
|
* @returns The camelCase string.
|
|
10
10
|
*/
|
|
11
11
|
export declare function kebabToCamelCase(str: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Converts a camelCase string to PascalCase.
|
|
14
|
+
* @param str - The camelCase string.
|
|
15
|
+
* @returns The PascalCase string.
|
|
16
|
+
*/
|
|
17
|
+
export declare function camelCaseToPascalCase(str: string): string;
|
|
12
18
|
//# sourceMappingURL=stringCaseConversion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringCaseConversion.d.ts","sourceRoot":"","sources":["../../../src/services/stringCaseConversion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIpD"}
|
|
1
|
+
{"version":3,"file":"stringCaseConversion.d.ts","sourceRoot":"","sources":["../../../src/services/stringCaseConversion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.kebabToCamelCase = kebabToCamelCase;
|
|
9
|
+
exports.camelCaseToPascalCase = camelCaseToPascalCase;
|
|
9
10
|
/**
|
|
10
11
|
* Converts a kebab-case string to camelCase.
|
|
11
12
|
* @param str - The kebab-case string.
|
|
@@ -16,3 +17,14 @@ function kebabToCamelCase(str) {
|
|
|
16
17
|
.replace(/^-+|-+$/g, "") // Remove leading and trailing dashes
|
|
17
18
|
.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Converts a camelCase string to PascalCase.
|
|
22
|
+
* @param str - The camelCase string.
|
|
23
|
+
* @returns The PascalCase string.
|
|
24
|
+
*/
|
|
25
|
+
function camelCaseToPascalCase(str) {
|
|
26
|
+
if (!str) {
|
|
27
|
+
return str;
|
|
28
|
+
}
|
|
29
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inserts a single row into a workbook range.
|
|
3
|
+
* @module insertRow
|
|
4
|
+
* @category Tasks
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
7
|
+
import type { Cell } from "../models/Cell.ts";
|
|
8
|
+
import type { WorkbookRangeRef } from "../models/WorkbookRange.ts";
|
|
9
|
+
/**
|
|
10
|
+
* Inserts a single row into a workbook range.
|
|
11
|
+
* @param originRef Reference to the workbook range to update. Only the upper-left cell is used as an origin point.
|
|
12
|
+
* @param row Array of cells to insert as a single row.
|
|
13
|
+
* @experimental
|
|
14
|
+
* @example
|
|
15
|
+
* await insertRow(originRef, [{ value: "A1" }, { value: "B1" }, { value: "C1" }]);
|
|
16
|
+
*/
|
|
17
|
+
export default function insertWorkbookRangeRow(originRef: WorkbookRangeRef, row: Partial<Cell>[]): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=insertWorkbookRangeRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insertWorkbookRangeRow.d.ts","sourceRoot":"","sources":["../../../src/tasks/insertWorkbookRangeRow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE;;;;;;;GAOG;AACH,wBAA8B,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAErH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Inserts a single row into a workbook range.
|
|
4
|
+
* @module insertRow
|
|
5
|
+
* @category Tasks
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.default = insertWorkbookRangeRow;
|
|
13
|
+
const insertWorkbookRangeRows_ts_1 = __importDefault(require("./insertWorkbookRangeRows.js"));
|
|
14
|
+
/**
|
|
15
|
+
* Inserts a single row into a workbook range.
|
|
16
|
+
* @param originRef Reference to the workbook range to update. Only the upper-left cell is used as an origin point.
|
|
17
|
+
* @param row Array of cells to insert as a single row.
|
|
18
|
+
* @experimental
|
|
19
|
+
* @example
|
|
20
|
+
* await insertRow(originRef, [{ value: "A1" }, { value: "B1" }, { value: "C1" }]);
|
|
21
|
+
*/
|
|
22
|
+
async function insertWorkbookRangeRow(originRef, row) {
|
|
23
|
+
await (0, insertWorkbookRangeRows_ts_1.default)(originRef, [row]);
|
|
24
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inserts rows into a workbook range.
|
|
3
|
+
* @module insertRows
|
|
4
|
+
* @category Tasks
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
7
|
+
import type { Cell } from "../models/Cell.ts";
|
|
8
|
+
import type { WorkbookRangeRef } from "../models/WorkbookRange.ts";
|
|
9
|
+
/**
|
|
10
|
+
* Inserts rows into a workbook range.
|
|
11
|
+
* @param originRef Reference to the workbook range to update. Only the upper-left cell is used as an origin point.
|
|
12
|
+
* @param cells Array of arrays of cells to update in the specified range.
|
|
13
|
+
* @param maxCellsPerOperation Prescribe max cells to retrieve per operation. `null` automatically determines value. DO NOT SET EXCEPT FOR ADVANCED TUNING.
|
|
14
|
+
* @experimental
|
|
15
|
+
* @example
|
|
16
|
+
* // Basic example:
|
|
17
|
+
* await insertRows(originRef, [
|
|
18
|
+
* [{ value: "A1" }, { value: "B1" }, { value: "C1" }],
|
|
19
|
+
* [{ value: "A2" }, { value: "B2" }, { value: "C2" }],
|
|
20
|
+
* [{ value: "A3" }, { value: "B3" }, { value: "C3" }],
|
|
21
|
+
* ])
|
|
22
|
+
*
|
|
23
|
+
* // Advanced example with cell formatting:
|
|
24
|
+
* await insertRows(originRef, [
|
|
25
|
+
* [{ value: "A1", format: { fontColor: "red" } }, { value: "B1" }, { value: "C1" }],
|
|
26
|
+
* [{ value: "A2" }, { value: "B2", format: { fontColor: "blue" } }, { value: "C2" }],
|
|
27
|
+
* [{ value: "A3" }, { value: "B3" }, { value: "C3", format: { fontColor: "green" } }],
|
|
28
|
+
* ]);
|
|
29
|
+
*/
|
|
30
|
+
export default function insertWorkbookRangeRows(originRef: WorkbookRangeRef, cells: Iterable<Partial<Cell>[]> | AsyncIterable<Partial<Cell>[]>, maxCellsPerOperation?: number | null): Promise<void>;
|
|
31
|
+
//# sourceMappingURL=insertWorkbookRangeRows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insertWorkbookRangeRows.d.ts","sourceRoot":"","sources":["../../../src/tasks/insertWorkbookRangeRows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAMnE;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAA8B,uBAAuB,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,oBAAoB,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB/M"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Inserts rows into a workbook range.
|
|
4
|
+
* @module insertRows
|
|
5
|
+
* @category Tasks
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.default = insertWorkbookRangeRows;
|
|
13
|
+
const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
|
|
14
|
+
const insertWorkbookCells_ts_1 = __importDefault(require("../operations/workbookRange/insertWorkbookCells.js"));
|
|
15
|
+
const addressManipulation_ts_1 = require("../services/addressManipulation.js");
|
|
16
|
+
const batch_ts_1 = require("../services/batch.js");
|
|
17
|
+
const updateWorkbookRangeRows_ts_1 = __importDefault(require("./updateWorkbookRangeRows.js"));
|
|
18
|
+
/**
|
|
19
|
+
* Inserts rows into a workbook range.
|
|
20
|
+
* @param originRef Reference to the workbook range to update. Only the upper-left cell is used as an origin point.
|
|
21
|
+
* @param cells Array of arrays of cells to update in the specified range.
|
|
22
|
+
* @param maxCellsPerOperation Prescribe max cells to retrieve per operation. `null` automatically determines value. DO NOT SET EXCEPT FOR ADVANCED TUNING.
|
|
23
|
+
* @experimental
|
|
24
|
+
* @example
|
|
25
|
+
* // Basic example:
|
|
26
|
+
* await insertRows(originRef, [
|
|
27
|
+
* [{ value: "A1" }, { value: "B1" }, { value: "C1" }],
|
|
28
|
+
* [{ value: "A2" }, { value: "B2" }, { value: "C2" }],
|
|
29
|
+
* [{ value: "A3" }, { value: "B3" }, { value: "C3" }],
|
|
30
|
+
* ])
|
|
31
|
+
*
|
|
32
|
+
* // Advanced example with cell formatting:
|
|
33
|
+
* await insertRows(originRef, [
|
|
34
|
+
* [{ value: "A1", format: { fontColor: "red" } }, { value: "B1" }, { value: "C1" }],
|
|
35
|
+
* [{ value: "A2" }, { value: "B2", format: { fontColor: "blue" } }, { value: "C2" }],
|
|
36
|
+
* [{ value: "A3" }, { value: "B3" }, { value: "C3", format: { fontColor: "green" } }],
|
|
37
|
+
* ]);
|
|
38
|
+
*/
|
|
39
|
+
async function insertWorkbookRangeRows(originRef, cells, maxCellsPerOperation = null) {
|
|
40
|
+
let maxRowsPerOperation = maxCellsPerOperation;
|
|
41
|
+
let colCount = null;
|
|
42
|
+
let rowCount = 0;
|
|
43
|
+
const batch = [];
|
|
44
|
+
for await (const row of cells) {
|
|
45
|
+
if (colCount === null) {
|
|
46
|
+
colCount = row.length;
|
|
47
|
+
}
|
|
48
|
+
else if (colCount !== row.length) {
|
|
49
|
+
throw new InvalidArgumentError_ts_1.default("Not all rows have the same number of cells. Ensure all rows are consistent in length.");
|
|
50
|
+
}
|
|
51
|
+
if (maxRowsPerOperation === null) {
|
|
52
|
+
maxRowsPerOperation = calculateMaxRowsPerOperation(colCount, maxCellsPerOperation);
|
|
53
|
+
}
|
|
54
|
+
if (batch.push(row) >= maxRowsPerOperation) {
|
|
55
|
+
rowCount += await writeBatch(batch, originRef, rowCount, colCount);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (colCount !== null) {
|
|
59
|
+
rowCount += await writeBatch(batch, originRef, rowCount, colCount);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function writeBatch(batch, originRef, rowsCompleted, colCount) {
|
|
63
|
+
const rowCount = batch.length;
|
|
64
|
+
if (rowCount === 0) {
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
const rangeRef = (0, addressManipulation_ts_1.superRange)(originRef, rowsCompleted, rowCount, 0, colCount);
|
|
68
|
+
await (0, insertWorkbookCells_ts_1.default)(rangeRef, "Down");
|
|
69
|
+
await (0, updateWorkbookRangeRows_ts_1.default)(rangeRef, batch);
|
|
70
|
+
batch.length = 0;
|
|
71
|
+
return rowCount;
|
|
72
|
+
}
|
|
73
|
+
function calculateMaxRowsPerOperation(columnCount, overwriteMaxCellsPerOperation) {
|
|
74
|
+
const maxCellsPerOperation = overwriteMaxCellsPerOperation ?? batch_ts_1.maxCellsPerRequest;
|
|
75
|
+
const maxRowsPerOperation = Math.floor(maxCellsPerOperation / columnCount);
|
|
76
|
+
if (maxRowsPerOperation < 1) {
|
|
77
|
+
throw new InvalidArgumentError_ts_1.default("maxCellsPerOperation must be greater than or equal to the number of columns in the range."); // Excel supports up to 16k columns, which exceeds the assumed 10k cell limit per write. This might not be a problem, but not worth spending time checking this currently either.
|
|
78
|
+
}
|
|
79
|
+
return maxRowsPerOperation;
|
|
80
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterateWorkbookRange.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateWorkbookRange.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAOnE;;;;;;;;GAQG;AACH,wBAA+B,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,uBAAuB,GAAE,MAAM,GAAG,IAAW,GAAG,aAAa,CAAC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"iterateWorkbookRange.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateWorkbookRange.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAOnE;;;;;;;;GAQG;AACH,wBAA+B,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,uBAAuB,GAAE,MAAM,GAAG,IAAW,GAAG,aAAa,CAAC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAC,CA+DhL"}
|
|
@@ -58,13 +58,11 @@ async function* iterateWorkbookRange(rangeRef, overwriteRowsPerRequest = null) {
|
|
|
58
58
|
text: text[r]?.[c] ?? "",
|
|
59
59
|
value: values[r]?.[c] ?? "",
|
|
60
60
|
format: format?.[r]?.[c] ?? "",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
font: {},
|
|
67
|
-
},
|
|
61
|
+
merge: {},
|
|
62
|
+
alignment: {},
|
|
63
|
+
borders: {},
|
|
64
|
+
fill: {},
|
|
65
|
+
font: {},
|
|
68
66
|
}));
|
|
69
67
|
yield {
|
|
70
68
|
rowOffset: offset,
|
|
@@ -8,7 +8,7 @@ import type { Cell, CellScope } from "../models/Cell.ts";
|
|
|
8
8
|
import type { RowOffset } from "../models/Row.ts";
|
|
9
9
|
import type { WorkbookRangeRef } from "../models/WorkbookRange.ts";
|
|
10
10
|
/**
|
|
11
|
-
* Represents a row yielded by the {@link
|
|
11
|
+
* Represents a row yielded by the {@link iterateWorkbookRangeRows} generator.
|
|
12
12
|
* @property {Cell[]} cells Array of cells in the row, each containing value, text, format, and optionally style information depending on the scope.
|
|
13
13
|
* @property {RowOffset} offset Zero-based offset of the row within the original range.
|
|
14
14
|
* @property {boolean} isFirst If this is the first row in the iteration.
|
|
@@ -25,12 +25,11 @@ export type IteratedRow = {
|
|
|
25
25
|
* @param rangeRef Reference to the workbook range to iterate over.
|
|
26
26
|
* @param scope Amount of detail to include for each cell.
|
|
27
27
|
* @param maxCellsPerOperation Prescribe max cells to retrieve per operation. `null` automatically determines value. DO NOT SET EXCEPT FOR ADVANCED TUNING.
|
|
28
|
-
* @remarks Including `style` in the scope requires over three operations for each and every cell. Use this sparingly!
|
|
29
28
|
* @experimental
|
|
30
29
|
* @example
|
|
31
30
|
* for await (const { row } of iterateRows(rangeRef)) {
|
|
32
31
|
* console.log(row);
|
|
33
32
|
* }
|
|
34
33
|
*/
|
|
35
|
-
export declare function
|
|
36
|
-
//# sourceMappingURL=
|
|
34
|
+
export declare function iterateWorkbookRangeRows(rangeRef: WorkbookRangeRef, scope?: Partial<CellScope>, maxCellsPerOperation?: number | null): AsyncIterable<IteratedRow>;
|
|
35
|
+
//# sourceMappingURL=iterateWorkbookRangeRows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterateWorkbookRangeRows.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateWorkbookRangeRows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAuC,SAAS,EAA6D,MAAM,mBAAmB,CAAC;AAIzJ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAUnE;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAuB,wBAAwB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,GAAE,OAAO,CAAC,SAAS,CAAoB,EAAE,oBAAoB,GAAE,MAAM,GAAG,IAAW,GAAG,aAAa,CAAC,WAAW,CAAC,CAgDhM"}
|
|
@@ -9,7 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.iterateWorkbookRangeRows = iterateWorkbookRangeRows;
|
|
13
13
|
const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
|
|
14
14
|
const getWorkbookRangeFill_ts_1 = __importDefault(require("../operations/workbookRange/getWorkbookRangeFill.js"));
|
|
15
15
|
const getWorkbookRangeFont_ts_1 = __importDefault(require("../operations/workbookRange/getWorkbookRangeFont.js"));
|
|
@@ -24,14 +24,13 @@ const cell_ts_1 = require("../services/cell.js");
|
|
|
24
24
|
* @param rangeRef Reference to the workbook range to iterate over.
|
|
25
25
|
* @param scope Amount of detail to include for each cell.
|
|
26
26
|
* @param maxCellsPerOperation Prescribe max cells to retrieve per operation. `null` automatically determines value. DO NOT SET EXCEPT FOR ADVANCED TUNING.
|
|
27
|
-
* @remarks Including `style` in the scope requires over three operations for each and every cell. Use this sparingly!
|
|
28
27
|
* @experimental
|
|
29
28
|
* @example
|
|
30
29
|
* for await (const { row } of iterateRows(rangeRef)) {
|
|
31
30
|
* console.log(row);
|
|
32
31
|
* }
|
|
33
32
|
*/
|
|
34
|
-
async function*
|
|
33
|
+
async function* iterateWorkbookRangeRows(rangeRef, scope = cell_ts_1.defaultCellScope, maxCellsPerOperation = null) {
|
|
35
34
|
const totalColumnCount = (0, addressManipulation_ts_1.countAddressColumns)(rangeRef.address);
|
|
36
35
|
const totalRowCount = (0, addressManipulation_ts_1.countAddressRows)(rangeRef.address);
|
|
37
36
|
const maxRowsPerOperation = calculateMaxRowsPerOperation(totalColumnCount, maxCellsPerOperation);
|
|
@@ -46,12 +45,20 @@ async function* iterateRows(rangeRef, scope = cell_ts_1.defaultCellScope, maxCel
|
|
|
46
45
|
const value = (range?.values?.[operationRowOffset]?.[columnOffset] ?? ""); // The root of these is undefined if that detail isn't in scope
|
|
47
46
|
const text = (range?.text?.[operationRowOffset]?.[columnOffset] ?? "");
|
|
48
47
|
const format = (range?.numberFormat?.[operationRowOffset]?.[columnOffset] ?? "");
|
|
49
|
-
const
|
|
48
|
+
const merge = {}; // No API available to retrieve merge information
|
|
49
|
+
const alignment = await getAlignment(rangeRef, scope);
|
|
50
|
+
const borders = await getBorders(rangeRef, scope);
|
|
51
|
+
const fill = await getFill(rangeRef, scope);
|
|
52
|
+
const font = await getFont(rangeRef, scope);
|
|
50
53
|
cells.push({
|
|
51
54
|
value,
|
|
52
55
|
text,
|
|
53
56
|
format,
|
|
54
|
-
|
|
57
|
+
merge,
|
|
58
|
+
alignment,
|
|
59
|
+
borders,
|
|
60
|
+
fill,
|
|
61
|
+
font,
|
|
55
62
|
});
|
|
56
63
|
}
|
|
57
64
|
const offset = (operationRowStart + operationRowOffset);
|
|
@@ -66,41 +73,43 @@ async function* iterateRows(rangeRef, scope = cell_ts_1.defaultCellScope, maxCel
|
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
}
|
|
69
|
-
async function
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
76
|
+
async function getFont(rangeRef, scope) {
|
|
77
|
+
if (!scope.font) {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
const response = await (0, getWorkbookRangeFont_ts_1.default)(rangeRef);
|
|
74
81
|
return {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
82
|
+
name: response?.name,
|
|
83
|
+
size: response?.size,
|
|
84
|
+
color: response?.color,
|
|
85
|
+
bold: response?.bold,
|
|
86
|
+
italic: response?.italic,
|
|
87
|
+
underline: response?.underline,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
async function getFill(rangeRef, scope) {
|
|
91
|
+
if (!scope.fill) {
|
|
92
|
+
return {};
|
|
93
|
+
}
|
|
94
|
+
const response = await (0, getWorkbookRangeFill_ts_1.default)(rangeRef);
|
|
95
|
+
return {
|
|
96
|
+
color: response?.color,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async function getBorders(rangeRef, scope) {
|
|
100
|
+
if (!scope.borders) {
|
|
101
|
+
return {};
|
|
102
|
+
}
|
|
103
|
+
const response = await (0, listWorkbookRangeBorders_ts_1.default)(rangeRef);
|
|
104
|
+
return {
|
|
105
|
+
edgeTop: extractBorderStyle(response, "EdgeTop"),
|
|
106
|
+
edgeBottom: extractBorderStyle(response, "EdgeBottom"),
|
|
107
|
+
edgeLeft: extractBorderStyle(response, "EdgeLeft"),
|
|
108
|
+
edgeRight: extractBorderStyle(response, "EdgeRight"),
|
|
109
|
+
insideVertical: extractBorderStyle(response, "InsideVertical"),
|
|
110
|
+
insideHorizontal: extractBorderStyle(response, "InsideHorizontal"),
|
|
111
|
+
diagonalDown: extractBorderStyle(response, "DiagonalDown"),
|
|
112
|
+
diagonalUp: extractBorderStyle(response, "DiagonalUp"),
|
|
104
113
|
};
|
|
105
114
|
function extractBorderStyle(borders, side) {
|
|
106
115
|
if (!borders) {
|
|
@@ -117,6 +126,17 @@ async function getStyle(rangeRef, scope) {
|
|
|
117
126
|
};
|
|
118
127
|
}
|
|
119
128
|
}
|
|
129
|
+
async function getAlignment(rangeRef, scope) {
|
|
130
|
+
if (!scope.alignment) {
|
|
131
|
+
return {};
|
|
132
|
+
}
|
|
133
|
+
const response = await (0, getWorkbookRangeFormat_ts_1.default)(rangeRef);
|
|
134
|
+
return {
|
|
135
|
+
vertical: response?.verticalAlignment,
|
|
136
|
+
horizontal: response?.horizontalAlignment,
|
|
137
|
+
wrapText: response?.wrapText ?? undefined,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
120
140
|
function calculateMaxRowsPerOperation(columnCount, overwriteMaxCellsPerOperation) {
|
|
121
141
|
const maxCellsPerOperation = overwriteMaxCellsPerOperation ?? batch_ts_1.maxCellsPerRequest;
|
|
122
142
|
const maxRowsPerOperation = Math.floor(maxCellsPerOperation / columnCount);
|
|
@@ -14,5 +14,5 @@ import type { WorkbookRangeRef } from "../models/WorkbookRange.ts";
|
|
|
14
14
|
* @example
|
|
15
15
|
* const firstRow = await readFirstRow(rangeRef);
|
|
16
16
|
*/
|
|
17
|
-
export default function
|
|
18
|
-
//# sourceMappingURL=
|
|
17
|
+
export default function readWorkbookRangeFirstRow(rangeRef: WorkbookRangeRef, scope?: import("../models/Cell.ts").CellScope): Promise<Cell[]>;
|
|
18
|
+
//# sourceMappingURL=readWorkbookRangeFirstRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readWorkbookRangeFirstRow.d.ts","sourceRoot":"","sources":["../../../src/tasks/readWorkbookRangeFirstRow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAKnE;;;;;;;GAOG;AACH,wBAA8B,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,wCAAmB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAQ7H"}
|
|
@@ -9,11 +9,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.default =
|
|
12
|
+
exports.default = readWorkbookRangeFirstRow;
|
|
13
13
|
const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
|
|
14
14
|
const addressManipulation_ts_1 = require("../services/addressManipulation.js");
|
|
15
15
|
const cell_ts_1 = require("../services/cell.js");
|
|
16
|
-
const
|
|
16
|
+
const iterateWorkbookRangeRows_ts_1 = require("./iterateWorkbookRangeRows.js");
|
|
17
17
|
/** * Read the first row from a given workbook range.
|
|
18
18
|
* @param rangeRef Reference to the workbook range to read.
|
|
19
19
|
* @param scope Amount of detail to include for each cell.
|
|
@@ -22,9 +22,9 @@ const iterateRows_ts_1 = require("./iterateRows.js");
|
|
|
22
22
|
* @example
|
|
23
23
|
* const firstRow = await readFirstRow(rangeRef);
|
|
24
24
|
*/
|
|
25
|
-
async function
|
|
25
|
+
async function readWorkbookRangeFirstRow(rangeRef, scope = cell_ts_1.defaultCellScope) {
|
|
26
26
|
const firstRowRef = (0, addressManipulation_ts_1.subRange)(rangeRef, 0, 1);
|
|
27
|
-
for await (const { cells } of (0,
|
|
27
|
+
for await (const { cells } of (0, iterateWorkbookRangeRows_ts_1.iterateWorkbookRangeRows)(firstRowRef, scope)) {
|
|
28
28
|
return cells;
|
|
29
29
|
}
|
|
30
30
|
throw new InvalidArgumentError_ts_1.default("No rows in the specified range.");
|
|
@@ -11,10 +11,10 @@ import type { WorkbookRangeRef } from "../models/WorkbookRange.ts";
|
|
|
11
11
|
* @param rangeRef Reference to the workbook range to read.
|
|
12
12
|
* @param scope Amount of detail to include for each cell.
|
|
13
13
|
* @returns A promise that resolves to an array of rows, each containing an array of cells.
|
|
14
|
-
* @remarks Where practical, prefer using {@link
|
|
14
|
+
* @remarks Where practical, prefer using {@link iterateWorkbookRangeRows} for more efficient memory usage.
|
|
15
15
|
* @experimental
|
|
16
16
|
* @example
|
|
17
17
|
* const rows = await readRows(rangeRef);
|
|
18
18
|
*/
|
|
19
|
-
export default function
|
|
20
|
-
//# sourceMappingURL=
|
|
19
|
+
export default function readWorkbookRangeRows(rangeRef: WorkbookRangeRef, scope?: import("../models/Cell.ts").CellScope): Promise<Cell[][]>;
|
|
20
|
+
//# sourceMappingURL=readWorkbookRangeRows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readWorkbookRangeRows.d.ts","sourceRoot":"","sources":["../../../src/tasks/readWorkbookRangeRows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;;;;;;;GASG;AACH,wBAA8B,qBAAqB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,wCAAmB,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAO3H"}
|