UNPKG

@microsoft/connected-workbooks

Version:

Microsoft backed, Excel advanced xlsx workbook generation JavaScript library

158 lines (157 loc) 8.12 kB
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", { value: true }); exports.maxQueryLength = exports.divider = exports.section1PathPrefix = exports.emptyValue = exports.falseValue = exports.trueValue = exports.pivotCachesPathPrefix = exports.xmlTextResultType = exports.textResultType = exports.application = exports.uint8ArrayType = exports.blobFileType = exports.columnIndexOutOfRangeErr = exports.relsNotFoundErr = exports.arrayIsntMxNErr = exports.unexpectedErr = exports.promotedHeadersCannotBeUsedWithoutAdjustingColumnNamesErr = exports.InvalidColumnNameErr = exports.stylesNotFoundErr = exports.EmptyQueryNameErr = exports.QueryNameInvalidCharsErr = exports.QueryNameMaxLengthErr = exports.invalidDataTypeErr = exports.headerNotFoundErr = exports.invalidValueInColumnErr = exports.tableNotFoundErr = exports.queryTableNotFoundErr = exports.templateWithInitialDataErr = exports.formulaSectionNotFoundErr = exports.queryConnectionNotFoundErr = exports.queryAndPivotTableNotFoundErr = exports.queryNameNotFoundErr = exports.emptyQueryMashupErr = exports.base64NotFoundErr = exports.sheetsNotFoundErr = exports.connectionsNotFoundErr = exports.sharedStringsNotFoundErr = exports.docPropsRootElement = exports.docMetadataXmlPath = exports.relsXmlPath = exports.docPropsCoreXmlPath = exports.section1mPath = exports.pivotCachesPath = exports.queryTablesPath = exports.workbookXmlPath = exports.queryTableXmlPath = exports.tableXmlPath = exports.sheetsXmlPath = exports.sharedStringsXmlPath = exports.connectionsXmlPath = void 0; exports.OFU = exports.headers = exports.URLS = exports.defaults = exports.elementAttributesValues = exports.dataTypeKind = exports.elementAttributes = exports.element = exports.BOM = exports.falseStr = exports.trueStr = void 0; exports.connectionsXmlPath = "xl/connections.xml"; exports.sharedStringsXmlPath = "xl/sharedStrings.xml"; exports.sheetsXmlPath = "xl/worksheets/sheet1.xml"; exports.tableXmlPath = "xl/tables/table1.xml"; exports.queryTableXmlPath = "xl/queryTables/queryTable1.xml"; exports.workbookXmlPath = "xl/workbook.xml"; exports.queryTablesPath = "xl/queryTables/"; exports.pivotCachesPath = "xl/pivotCache/"; exports.section1mPath = "Formulas/Section1.m"; exports.docPropsCoreXmlPath = "docProps/core.xml"; exports.relsXmlPath = "_rels/.rels"; exports.docMetadataXmlPath = "docMetadata"; exports.docPropsRootElement = "cp:coreProperties"; exports.sharedStringsNotFoundErr = "SharedStrings were not found in template"; exports.connectionsNotFoundErr = "Connections were not found in template"; exports.sheetsNotFoundErr = "Sheets were not found in template"; exports.base64NotFoundErr = "Base64 was not found in template"; exports.emptyQueryMashupErr = "Query mashup is empty"; exports.queryNameNotFoundErr = "Query name was not found"; exports.queryAndPivotTableNotFoundErr = "No such query found in Query Table or Pivot Table found in given template"; exports.queryConnectionNotFoundErr = "No connection found for query"; exports.formulaSectionNotFoundErr = "Formula section wasn't found in template"; exports.templateWithInitialDataErr = "Cannot use a template file with initial data"; exports.queryTableNotFoundErr = "Query table wasn't found in template"; exports.tableNotFoundErr = "Table wasn't found in template"; exports.invalidValueInColumnErr = "Invalid cell value in column"; exports.headerNotFoundErr = "Invalid JSON file, header is missing"; exports.invalidDataTypeErr = "Invalid JSON file, invalid data type"; exports.QueryNameMaxLengthErr = "Query names are limited to 80 characters"; exports.QueryNameInvalidCharsErr = 'Query names cannot contain periods or quotation marks. (. ")'; exports.EmptyQueryNameErr = "Query name cannot be empty"; exports.stylesNotFoundErr = "Styles were not found in template"; exports.InvalidColumnNameErr = "Invalid column name"; exports.promotedHeadersCannotBeUsedWithoutAdjustingColumnNamesErr = "Headers cannot be promoted without adjusting column names"; exports.unexpectedErr = "Unexpected error"; exports.arrayIsntMxNErr = "Array isn't MxN"; exports.relsNotFoundErr = ".rels were not found in template"; exports.columnIndexOutOfRangeErr = "Column index out of range"; exports.blobFileType = "blob"; exports.uint8ArrayType = "uint8array"; exports.application = "application/xlsx"; exports.textResultType = "text"; exports.xmlTextResultType = "text/xml"; exports.pivotCachesPathPrefix = "pivotCacheDefinition"; exports.trueValue = "1"; exports.falseValue = "0"; exports.emptyValue = ""; exports.section1PathPrefix = "Section1/"; exports.divider = "/"; exports.maxQueryLength = 80; exports.trueStr = "true"; exports.falseStr = "false"; exports.BOM = "\ufeff"; exports.element = { sharedStringTable: "sst", text: "t", sharedStringItem: "si", cellValue: "v", databaseProperties: "dbPr", queryTable: "queryTable", cacheSource: "cacheSource", item: "Item", items: "Items", itemPath: "ItemPath", itemType: "ItemType", itemLocation: "ItemLocation", entry: "Entry", stableEntries: "StableEntries", tableColumns: "tableColumns", tableColumn: "tableColumn", table: "table", autoFilter: "autoFilter", definedName: "definedName", queryTableFields: "queryTableFields", queryTableField: "queryTableField", queryTableRefresh: "queryTableRefresh", sheetData: "sheetData", row: "row", dimension: "dimension", selection: "selection", kindCell: "c", }; exports.elementAttributes = { connection: "connection", command: "command", refreshOnLoad: "refreshOnLoad", count: "count", uniqueCount: "uniqueCount", queryTable: "queryTable", connectionId: "connectionId", cacheSource: "cacheSource", name: "name", description: "description", id: "id", type: "Type", value: "Value", relationshipInfo: "RelationshipInfoContainer", resultType: "ResultType", fillColumnNames: "FillColumnNames", fillTarget: "FillTarget", fillLastUpdated: "FillLastUpdated", day: "d", uniqueName: "uniqueName", queryTableFieldId: "queryTableFieldId", reference: "ref", sqref: "sqref", tableColumnId: "tableColumnId", nextId: "nextId", row: "r", spans: "spans", x14acDyDescent: "x14ac:dyDescent", xr3uid: "xr3:uid", space: "xml:space", }; exports.dataTypeKind = { string: "str", number: "1", boolean: "b", }; exports.elementAttributesValues = { connectionName: function (queryName) { return "Query - ".concat(queryName); }, connectionDescription: function (queryName) { return "Connection to the '".concat(queryName, "' query in the workbook."); }, connection: function (queryName) { return "Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=\"".concat(queryName, "\";"); }, connectionCommand: function (queryName) { return "SELECT * FROM [".concat(queryName, "]"); }, tableResultType: function () { return "sTable"; }, }; exports.defaults = { queryName: "Query1", sheetName: "Sheet1", columnName: "Column", }; exports.URLS = { PQ: [ "http://schemas.microsoft.com/DataMashup", "http://schemas.microsoft.com/DataExplorer", "http://schemas.microsoft.com/DataMashup/Temp", "http://schemas.microsoft.com/DataExplorer/Temp", ], CONNECTED_WORKBOOK: "http://schemas.microsoft.com/ConnectedWorkbook", }; // Content-Type header to indicate that the content is an Excel document exports.headers = { "Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", }; exports.OFU = { ViewUrl: "https://view.officeapps.live.com/op/view.aspx?src=http://connectedWorkbooks.excel/", PostUrl: "https://view.officeapps.live.com/op/viewpost.aspx?src=http://connectedWorkbooks.excel/", AllowTyping: "AllowTyping", WdOrigin: "wdOrigin", OpenInExcelOririgin: "OpenInExcel", };