@microsoft/connected-workbooks 3.0.0 → 3.1.1-beta.2

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/README.md CHANGED
@@ -1,5 +1,4 @@
1
1
  # Connected Workbooks
2
- [![Build Status](https://obilshield.visualstudio.com/ConnectedWorkbooks/_apis/build/status/microsoft.connected-workbooks?branchName=main)](https://obilshield.visualstudio.com/ConnectedWorkbooks/_build/latest?definitionId=14&branchName=main)
3
2
  [![License](https://img.shields.io/github/license/microsoft/connected-workbooks)](https://github.com/microsoft/connected-workbooks/blob/master/LICENSE)
4
3
 
5
4
  A pure JS library, Microsoft backed, that provides xlsx workbook generation capabilities, allowing for:
@@ -26,7 +25,7 @@ Connected Workbooks allows you to avoid "data dumps" in CSV form, providing a ri
26
25
  import workbookManager from '@microsoft/connected-workbooks';
27
26
 
28
27
  const blob = await workbookManager.generateTableWorkbookFromHtml(document.querySelector('table') as HTMLTableElement);
29
- workbookManager.downloadWorkbook(blob, "MyTable.xlsx");
28
+ workbookManager.openInExcelWeb(blob, "MyTable.xlsx", true /*allowTyping*/);
30
29
  ```
31
30
 
32
31
  ### 2. Export a table from raw data:
@@ -34,7 +33,7 @@ workbookManager.downloadWorkbook(blob, "MyTable.xlsx");
34
33
  import workbookManager from '@microsoft/connected-workbooks';
35
34
 
36
35
  const grid = {
37
- config: { promoteHeaders:true, adjustColumnNames:true }
36
+ config: { promoteHeaders:true, adjustColumnNames:true },
38
37
  data: [
39
38
  ["Product", "Price", "InStock", "Category", "Date"],
40
39
  ["Widget A", 19.99, true, "Electronics", "10/26/2024"],
@@ -45,7 +44,7 @@ const grid = {
45
44
  ]
46
45
  };
47
46
  const blob = await workbookManager.generateTableWorkbookFromGrid(grid);
48
- workbookManager.downloadWorkbook(blob, "MyTable.xlsx");
47
+ workbookManager.openInExcelWeb(blob, "MyTable.xlsx", true /*allowTyping*/);
49
48
  ```
50
49
  <img width="281" alt="image" src="https://github.com/microsoft/connected-workbooks/assets/7674478/b91e5d69-8444-4a19-a4b0-3fd721e5576f">
51
50
 
@@ -145,6 +144,19 @@ async function `generateTableWorkbookFromGrid`: `Promise<Blob>`
145
144
  |--- |--- |--- |--- |
146
145
  | grid | [Grid](#grid) | __required__ | Initial data loaded to workbook |
147
146
  | fileConfigs | [FileConfigs](#fileconfigs) | optional | Custom file configurations |
147
+
148
+ #### 3. Open the created workbook in excel for the web
149
+ ```typescript
150
+ async function `openInExcelWeb`: `Promise<void>`
151
+ ```
152
+
153
+ ⭐ This API is supported only for an HTTPS domain.
154
+
155
+ |Parameter | Type | Required | Description |
156
+ |--- |--- |--- |--- |
157
+ | blob | [Blob](https://developer.mozilla.org/docs/Web/API/Blob) | __required__ | Initial data loaded to workbook |
158
+ | filename | string | optional | Custom the opened file name |
159
+ | allowTyping | boolean | optional | allow user editing (typing) |
148
160
  </br>
149
161
 
150
162
  ### Types
@@ -173,6 +185,7 @@ async function `generateTableWorkbookFromGrid`: `Promise<Blob>`
173
185
  |---|---|---|---|
174
186
  | templateFile | File | optional | Custom Excel workbook |
175
187
  | docProps | [DocProps](#docprops) | optional | Custom workbook properties |
188
+ | hostName | string | optional | specify the host creator name |
176
189
 
177
190
  #### DocProps
178
191
  |Parameter | Type | Required
@@ -1,14 +1,9 @@
1
- "use strict";
2
1
  // Copyright (c) Microsoft Corporation.
3
2
  // Licensed under the MIT license.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.generateCustomXmlFilePath = exports.generateSingleQueryMashup = exports.generateMashupXMLTemplate = void 0;
6
- const generateMashupXMLTemplate = (base64) => `<?xml version="1.0" encoding="utf-16"?><DataMashup xmlns="http://schemas.microsoft.com/DataMashup">${base64}</DataMashup>`;
7
- exports.generateMashupXMLTemplate = generateMashupXMLTemplate;
8
- const generateSingleQueryMashup = (queryName, query) => `section Section1;
9
-
10
- shared #"${queryName}" =
11
- ${query};`;
12
- exports.generateSingleQueryMashup = generateSingleQueryMashup;
13
- const generateCustomXmlFilePath = (i) => `customXml/item${i}.xml`;
14
- exports.generateCustomXmlFilePath = generateCustomXmlFilePath;
3
+ export var generateMashupXMLTemplate = function (base64) {
4
+ return "<?xml version=\"1.0\" encoding=\"utf-16\"?><DataMashup xmlns=\"http://schemas.microsoft.com/DataMashup\">".concat(base64, "</DataMashup>");
5
+ };
6
+ export var generateSingleQueryMashup = function (queryName, query) {
7
+ return "section Section1;\n \n shared #\"".concat(queryName, "\" = \n ").concat(query, ";");
8
+ };
9
+ export var generateCustomXmlFilePath = function (i) { return "customXml/item".concat(i, ".xml"); };
package/dist/index.js CHANGED
@@ -1,32 +1,6 @@
1
- "use strict";
2
1
  // Copyright (c) Microsoft Corporation.
3
2
  // Licensed under the MIT license.
4
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
- if (k2 === undefined) k2 = k;
6
- var desc = Object.getOwnPropertyDescriptor(m, k);
7
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
- desc = { enumerable: true, get: function() { return m[k]; } };
9
- }
10
- Object.defineProperty(o, k2, desc);
11
- }) : (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- o[k2] = m[k];
14
- }));
15
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
- Object.defineProperty(o, "default", { enumerable: true, value: v });
17
- }) : function(o, v) {
18
- o["default"] = v;
19
- });
20
- var __importStar = (this && this.__importStar) || function (mod) {
21
- if (mod && mod.__esModule) return mod;
22
- var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
- __setModuleDefault(result, mod);
25
- return result;
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.DataTypes = void 0;
29
- const workbookManager = __importStar(require("./workbookManager"));
30
- const types_1 = require("./types");
31
- Object.defineProperty(exports, "DataTypes", { enumerable: true, get: function () { return types_1.DataTypes; } });
32
- exports.default = workbookManager;
3
+ import * as workbookManager from "./workbookManager";
4
+ import { DataTypes } from "./types";
5
+ export { DataTypes };
6
+ export default workbookManager;