UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

52 lines (50 loc) 1.63 kB
import { IntlService, Workbook, Worksheet } from "@progress/kendo-ooxml"; //#region ../src/kendo.ooxml.js const __meta__ = { id: "ooxml", name: "XLSX generation", category: "framework", advanced: true, mixin: true, depends: ["core"] }; (function($) { IntlService.register({ toString: kendo.toString }); let convertedWorkbook = kendo.ConvertClass(Workbook); var toDataURL = convertedWorkbook.prototype.toDataURL; Object.assign(convertedWorkbook.prototype, { toDataURL: function() { var result = toDataURL.call(this); if (typeof result !== "string") { throw new Error("The toDataURL method can be used only with jsZip 2. Either include jsZip 2 or use the toDataURLAsync method."); } return result; }, toDataURLAsync: function() { var deferred = $.Deferred(); var result = toDataURL.call(this); if (typeof result === "string") { result = deferred.resolve(result); } else if (result && result.then) { result.then(function(dataURI) { deferred.resolve(dataURI); }, function() { deferred.reject(); }); } return deferred.promise(); } }); window.kendo.ooxml = window.kendo.ooxml || {}; window.kendo.ooxml.IntlService = IntlService; window.kendo.ooxml.Workbook = convertedWorkbook; window.kendo.ooxml.Worksheet = kendo.ConvertClass(Worksheet); window.kendo.ooxml.createZip = function() { if (typeof JSZip === "undefined") { throw new Error("JSZip not found. Check http://docs.telerik.com/kendo-ui/framework/excel/introduction#requirements for more details."); } return new JSZip(); }; })(window.kendo.jQuery); //#endregion export { __meta__ as t };