UNPKG

ag-grid-enterprise

Version:

Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue

1,306 lines (1,290 loc) 2.35 MB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // packages/ag-grid-enterprise/src/main.ts var main_exports = {}; __export(main_exports, { AdvancedFilterModule: () => AdvancedFilterModule, AggregationModule: () => AggregationModule, AiToolkitModule: () => AiToolkitModule, AllEnterpriseModule: () => AllEnterpriseModule, BatchEditModule: () => BatchEditModule, CellSelectionModule: () => CellSelectionModule, ClipboardModule: () => ClipboardModule, ColumnMenuModule: () => ColumnMenuModule, ColumnsToolPanelModule: () => ColumnsToolPanelModule, ContextMenuModule: () => ContextMenuModule, ExcelExportModule: () => ExcelExportModule, FiltersToolPanelModule: () => FiltersToolPanelModule, FindModule: () => FindModule, FormulaModule: () => FormulaModule, GridChartsModule: () => GridChartsModule, GroupFilterModule: () => GroupFilterModule, IntegratedChartsModule: () => IntegratedChartsModule, LicenseManager: () => GridLicenseManager, MasterDetailModule: () => MasterDetailModule, MenuModule: () => MenuModule, MultiFilterModule: () => MultiFilterModule, NewFiltersToolPanelModule: () => NewFiltersToolPanelModule, PivotModule: () => PivotModule, RangeSelectionModule: () => RangeSelectionModule, RichSelectModule: () => RichSelectModule, RowGroupingEditModule: () => RowGroupingEditModule, RowGroupingModule: () => RowGroupingModule, RowGroupingPanelModule: () => RowGroupingPanelModule, RowNumbersModule: () => RowNumbersModule, ServerSideRowModelApiModule: () => ServerSideRowModelApiModule, ServerSideRowModelModule: () => ServerSideRowModelModule, SetFilterModule: () => SetFilterModule, SideBarModule: () => SideBarModule, SparklinesModule: () => SparklinesModule, StatusBarModule: () => StatusBarModule, TreeDataModule: () => TreeDataModule, ViewportRowModelModule: () => ViewportRowModelModule, _AgColorPicker: () => AgColorPicker, _AgColorPickerSelector: () => AgColorPickerSelector, _AgContextMenuService: () => AgContextMenuService, _AgDialog: () => AgDialog, _AgGroupComponent: () => AgGroupComponent, _AgGroupComponentSelector: () => AgGroupComponentSelector, _AgInputRange: () => AgInputRange, _AgInputRangeSelector: () => AgInputRangeSelector, _AgMenuItemComponent: () => AgMenuItemComponent, _AgMenuItemRenderer: () => AgMenuItemRenderer, _AgMenuList: () => AgMenuList, _AgPanel: () => AgPanel, _AgSlider: () => AgSlider, _AgSliderSelector: () => AgSliderSelector, _AgTabbedLayout: () => AgTabbedLayout, _AgVirtualList: () => AgVirtualList, _AgVirtualListDragFeature: () => AgVirtualListDragFeature, distributeGroupValue: () => distributeGroupValue, exportMultipleSheetsAsExcel: () => exportMultipleSheetsAsExcel, getMultipleSheetsAsExcel: () => getMultipleSheetsAsExcel }); module.exports = __toCommonJS(main_exports); // packages/ag-grid-enterprise/src/license/gridLicenseManager.ts var import_ag_grid_community3 = require("ag-grid-community"); // packages/ag-grid-enterprise/src/license/shared/licenseManager.ts var import_ag_grid_community = require("ag-grid-community"); // packages/ag-grid-enterprise/src/license/shared/md5.ts var MD5 = class { constructor() { this.ieCompatibility = false; } init() { this.ieCompatibility = this.md5("hello") != "5d41402abc4b2a76b9719d911017c592"; } md5cycle(x, k) { let a = x[0], b = x[1], c = x[2], d = x[3]; a = this.ff(a, b, c, d, k[0], 7, -680876936); d = this.ff(d, a, b, c, k[1], 12, -389564586); c = this.ff(c, d, a, b, k[2], 17, 606105819); b = this.ff(b, c, d, a, k[3], 22, -1044525330); a = this.ff(a, b, c, d, k[4], 7, -176418897); d = this.ff(d, a, b, c, k[5], 12, 1200080426); c = this.ff(c, d, a, b, k[6], 17, -1473231341); b = this.ff(b, c, d, a, k[7], 22, -45705983); a = this.ff(a, b, c, d, k[8], 7, 1770035416); d = this.ff(d, a, b, c, k[9], 12, -1958414417); c = this.ff(c, d, a, b, k[10], 17, -42063); b = this.ff(b, c, d, a, k[11], 22, -1990404162); a = this.ff(a, b, c, d, k[12], 7, 1804603682); d = this.ff(d, a, b, c, k[13], 12, -40341101); c = this.ff(c, d, a, b, k[14], 17, -1502002290); b = this.ff(b, c, d, a, k[15], 22, 1236535329); a = this.gg(a, b, c, d, k[1], 5, -165796510); d = this.gg(d, a, b, c, k[6], 9, -1069501632); c = this.gg(c, d, a, b, k[11], 14, 643717713); b = this.gg(b, c, d, a, k[0], 20, -373897302); a = this.gg(a, b, c, d, k[5], 5, -701558691); d = this.gg(d, a, b, c, k[10], 9, 38016083); c = this.gg(c, d, a, b, k[15], 14, -660478335); b = this.gg(b, c, d, a, k[4], 20, -405537848); a = this.gg(a, b, c, d, k[9], 5, 568446438); d = this.gg(d, a, b, c, k[14], 9, -1019803690); c = this.gg(c, d, a, b, k[3], 14, -187363961); b = this.gg(b, c, d, a, k[8], 20, 1163531501); a = this.gg(a, b, c, d, k[13], 5, -1444681467); d = this.gg(d, a, b, c, k[2], 9, -51403784); c = this.gg(c, d, a, b, k[7], 14, 1735328473); b = this.gg(b, c, d, a, k[12], 20, -1926607734); a = this.hh(a, b, c, d, k[5], 4, -378558); d = this.hh(d, a, b, c, k[8], 11, -2022574463); c = this.hh(c, d, a, b, k[11], 16, 1839030562); b = this.hh(b, c, d, a, k[14], 23, -35309556); a = this.hh(a, b, c, d, k[1], 4, -1530992060); d = this.hh(d, a, b, c, k[4], 11, 1272893353); c = this.hh(c, d, a, b, k[7], 16, -155497632); b = this.hh(b, c, d, a, k[10], 23, -1094730640); a = this.hh(a, b, c, d, k[13], 4, 681279174); d = this.hh(d, a, b, c, k[0], 11, -358537222); c = this.hh(c, d, a, b, k[3], 16, -722521979); b = this.hh(b, c, d, a, k[6], 23, 76029189); a = this.hh(a, b, c, d, k[9], 4, -640364487); d = this.hh(d, a, b, c, k[12], 11, -421815835); c = this.hh(c, d, a, b, k[15], 16, 530742520); b = this.hh(b, c, d, a, k[2], 23, -995338651); a = this.ii(a, b, c, d, k[0], 6, -198630844); d = this.ii(d, a, b, c, k[7], 10, 1126891415); c = this.ii(c, d, a, b, k[14], 15, -1416354905); b = this.ii(b, c, d, a, k[5], 21, -57434055); a = this.ii(a, b, c, d, k[12], 6, 1700485571); d = this.ii(d, a, b, c, k[3], 10, -1894986606); c = this.ii(c, d, a, b, k[10], 15, -1051523); b = this.ii(b, c, d, a, k[1], 21, -2054922799); a = this.ii(a, b, c, d, k[8], 6, 1873313359); d = this.ii(d, a, b, c, k[15], 10, -30611744); c = this.ii(c, d, a, b, k[6], 15, -1560198380); b = this.ii(b, c, d, a, k[13], 21, 1309151649); a = this.ii(a, b, c, d, k[4], 6, -145523070); d = this.ii(d, a, b, c, k[11], 10, -1120210379); c = this.ii(c, d, a, b, k[2], 15, 718787259); b = this.ii(b, c, d, a, k[9], 21, -343485551); x[0] = this.add32(a, x[0]); x[1] = this.add32(b, x[1]); x[2] = this.add32(c, x[2]); x[3] = this.add32(d, x[3]); } cmn(q, a, b, x, s2, t) { a = this.add32(this.add32(a, q), this.add32(x, t)); return this.add32(a << s2 | a >>> 32 - s2, b); } ff(a, b, c, d, x, s2, t) { return this.cmn(b & c | ~b & d, a, b, x, s2, t); } gg(a, b, c, d, x, s2, t) { return this.cmn(b & d | c & ~d, a, b, x, s2, t); } hh(a, b, c, d, x, s2, t) { return this.cmn(b ^ c ^ d, a, b, x, s2, t); } ii(a, b, c, d, x, s2, t) { return this.cmn(c ^ (b | ~d), a, b, x, s2, t); } md51(s2) { const n = s2.length; const state = [1732584193, -271733879, -1732584194, 271733878]; let i; for (i = 64; i <= s2.length; i += 64) { this.md5cycle(state, this.md5blk(s2.substring(i - 64, i))); } s2 = s2.substring(i - 64); const tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; for (i = 0; i < s2.length; i++) { tail[i >> 2] |= s2.charCodeAt(i) << (i % 4 << 3); } tail[i >> 2] |= 128 << (i % 4 << 3); if (i > 55) { this.md5cycle(state, tail); for (i = 0; i < 16; i++) { tail[i] = 0; } } tail[14] = n * 8; this.md5cycle(state, tail); return state; } /* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5 * algorithm for multi-byte characters (perhaps by adding every four 16-bit characters and * shortening the sum to 32 bits). Otherwise I suthis.ggest performing MD-5 as if every character * was two bytes--e.g., 0040 0025 = @%--but then how will an ordinary MD-5 sum be matched? * There is no way to standardize text to something like UTF-8 before transformation; speed cost is * utterly prohibitive. The JavaScript standard itself needs to look at this: it should start * providing access to strings as preformed UTF-8 8-bit unsigned value arrays. */ md5blk(s2) { const md5blks = []; for (let i = 0; i < 64; i += 4) { md5blks[i >> 2] = s2.charCodeAt(i) + (s2.charCodeAt(i + 1) << 8) + (s2.charCodeAt(i + 2) << 16) + (s2.charCodeAt(i + 3) << 24); } return md5blks; } rhex(n) { const hex_chr = "0123456789abcdef".split(""); let s2 = "", j = 0; for (; j < 4; j++) { s2 += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15]; } return s2; } hex(x) { for (let i = 0; i < x.length; i++) { x[i] = this.rhex(x[i]); } return x.join(""); } md5(s2) { return this.hex(this.md51(s2)); } add32(a, b) { return this.ieCompatibility ? this.add32Compat(a, b) : this.add32Std(a, b); } /* this function is much faster, so if possible we use it. Some IEs are the only ones I know of that need the idiotic second function, generated by an if clause. */ add32Std(a, b) { return a + b & 4294967295; } add32Compat(x, y) { const lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16); return msw << 16 | lsw & 65535; } }; // packages/ag-grid-enterprise/src/license/shared/licenseManager.ts var LICENSE_TYPES = { "01": "GRID", "02": "CHARTS", "0102": "BOTH" }; var LICENSING_HELP_URL = "https://www.ag-grid.com/licensing/"; var _LicenseManager = class _LicenseManager { constructor(document2) { this.watermarkMessage = void 0; this.totalMessageLength = 124; this.document = document2; this.md5 = new MD5(); this.md5.init(); } validateLicense() { const licenseDetails = this.getLicenseDetails(_LicenseManager.licenseKey); const currentLicenseName = `AG Grid ${licenseDetails.currentLicenseType === "BOTH" ? "and AG Charts " : ""}Enterprise`; const suppliedLicenseName = licenseDetails.suppliedLicenseType === void 0 ? "" : `AG ${licenseDetails.suppliedLicenseType === "BOTH" ? "Grid and AG Charts" : licenseDetails.suppliedLicenseType === "GRID" ? "Grid" : "Charts"} Enterprise`; if (licenseDetails.missing) { if (!this.isWebsiteUrl() || this.isForceWatermark()) { this.outputMissingLicenseKey(currentLicenseName); } } else if (licenseDetails.expired) { const gridReleaseDate = _LicenseManager.getGridReleaseDate(); const formattedReleaseDate = _LicenseManager.formatDate(gridReleaseDate); this.outputExpiredKey(licenseDetails.expiry, formattedReleaseDate, currentLicenseName, suppliedLicenseName); } else if (!licenseDetails.valid) { this.outputInvalidLicenseKey( !!licenseDetails.incorrectLicenseType, currentLicenseName, suppliedLicenseName ); } else if (licenseDetails.isTrial && licenseDetails.trialExpired) { this.outputExpiredTrialKey(licenseDetails.expiry, currentLicenseName, suppliedLicenseName); } } static extractExpiry(license) { const restrictionHashed = license.substring(license.lastIndexOf("_") + 1, license.length); return new Date(parseInt(_LicenseManager.decode(restrictionHashed), 10)); } static extractLicenseComponents(licenseKey) { let cleanedLicenseKey = licenseKey.replace(/[\u200B-\u200D\uFEFF]/g, ""); cleanedLicenseKey = cleanedLicenseKey.replace(/\r?\n|\r/g, ""); if (licenseKey.length <= 32) { return { md5: null, license: licenseKey, version: null, isTrial: null }; } const hashStart = cleanedLicenseKey.length - 32; const md5 = cleanedLicenseKey.substring(hashStart); const license = cleanedLicenseKey.substring(0, hashStart); const [version, isTrial, type] = _LicenseManager.extractBracketedInformation(cleanedLicenseKey); return { md5, license, version, isTrial, type }; } getLicenseDetails(licenseKey) { const currentLicenseType = _LicenseManager.chartsLicenseManager ? "BOTH" : "GRID"; if (!licenseKey?.length) { return { licenseKey, valid: false, missing: true, currentLicenseType }; } const gridReleaseDate = _LicenseManager.getGridReleaseDate(); const { md5, license, version, isTrial, type } = _LicenseManager.extractLicenseComponents(licenseKey); let valid = md5 === this.md5.md5(license) && !licenseKey.includes("For_Trialing_ag-Grid_Only"); let trialExpired = void 0; let expired = void 0; let expiry = null; let incorrectLicenseType = false; let suppliedLicenseType = void 0; function handleTrial() { const now = /* @__PURE__ */ new Date(); trialExpired = expiry < now; expired = void 0; } if (valid) { expiry = _LicenseManager.extractExpiry(license); valid = !isNaN(expiry.getTime()); if (valid) { expired = gridReleaseDate > expiry; switch (version) { case "legacy": case "2": { if (isTrial) { handleTrial(); } break; } case "3": { if (!type?.length) { valid = false; } else { suppliedLicenseType = type; if (type !== LICENSE_TYPES["01"] && type !== LICENSE_TYPES["0102"] || currentLicenseType === "BOTH" && suppliedLicenseType !== "BOTH") { valid = false; incorrectLicenseType = true; } else if (isTrial) { handleTrial(); } } } } } } if (!valid) { return { licenseKey, valid, incorrectLicenseType, currentLicenseType, suppliedLicenseType }; } return { licenseKey, valid, expiry: _LicenseManager.formatDate(expiry), expired, version, isTrial, trialExpired, incorrectLicenseType, currentLicenseType, suppliedLicenseType }; } isDisplayWatermark() { return this.isForceWatermark() || !this.isLocalhost() && !this.isWebsiteUrl() && !!this.watermarkMessage?.length; } getWatermarkMessage() { return this.watermarkMessage || ""; } getHostname() { const win = this.document.defaultView || window; const loc = win.location; const { hostname = "" } = loc; return hostname; } isForceWatermark() { const win = this.document.defaultView || window; const loc = win.location; const { pathname } = loc; return pathname ? pathname.includes("forceWatermark") : false; } isWebsiteUrl() { const hostname = this.getHostname(); return hostname.match(/^(?:[\w-]+\.)?(ag-grid|bryntum)\.com$/) !== null; } isLocalhost() { const hostname = this.getHostname(); return hostname.match(/^(?:127\.0\.0\.1|localhost)$/) !== null; } static formatDate(date) { const monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; const day = date.getDate(); const monthIndex = date.getMonth(); const year = date.getFullYear(); return day + " " + monthNames[monthIndex] + " " + year; } static getGridReleaseDate() { return new Date(parseInt(_LicenseManager.decode(_LicenseManager.RELEASE_INFORMATION), 10)); } static decode(input) { const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; let t = ""; let n, r, i; let s2, o, u, a; let f = 0; const e = input.replace(/[^A-Za-z0-9+/=]/g, ""); while (f < e.length) { s2 = keystr.indexOf(e.charAt(f++)); o = keystr.indexOf(e.charAt(f++)); u = keystr.indexOf(e.charAt(f++)); a = keystr.indexOf(e.charAt(f++)); n = s2 << 2 | o >> 4; r = (o & 15) << 4 | u >> 2; i = (u & 3) << 6 | a; t = t + String.fromCharCode(n); if (u != 64) { t = t + String.fromCharCode(r); } if (a != 64) { t = t + String.fromCharCode(i); } } t = _LicenseManager.utf8_decode(t); return t; } static utf8_decode(input) { input = input.replace(/rn/g, "n"); let t = ""; for (let n = 0; n < input.length; n++) { const r = input.charCodeAt(n); if (r < 128) { t += String.fromCharCode(r); } else if (r > 127 && r < 2048) { t += String.fromCharCode(r >> 6 | 192); t += String.fromCharCode(r & 63 | 128); } else { t += String.fromCharCode(r >> 12 | 224); t += String.fromCharCode(r >> 6 & 63 | 128); t += String.fromCharCode(r & 63 | 128); } } return t; } static setChartsLicenseManager(dependantLicenseManager) { this.chartsLicenseManager = dependantLicenseManager; this.chartsLicenseManager?.setLicenseKey(this.licenseKey, true); } static setLicenseKey(licenseKey) { if ((0, import_ag_grid_community._exists)(this.licenseKey) && this.licenseKey !== licenseKey) { (0, import_ag_grid_community._logPreInitWarn)( 291, void 0, "AG Grid: License Key being set multiple times with different values. This can result in an incorrect license key being used." ); } this.licenseKey = licenseKey; this.chartsLicenseManager?.setLicenseKey(licenseKey, true); } static extractBracketedInformation(licenseKey) { if (!licenseKey.includes("[")) { return ["legacy", false, void 0]; } const matches = licenseKey.match(/\[(.*?)\]/g).map((match) => match.replace("[", "").replace("]", "")); if (!matches || matches.length === 0) { return ["legacy", false, void 0]; } const isTrial = matches.filter((match) => match === "TRIAL").length === 1; const rawVersion = matches.filter((match) => match.indexOf("v") === 0)[0]; const version = rawVersion ? rawVersion.replace("v", "") : "legacy"; const type = LICENSE_TYPES[matches.filter((match) => LICENSE_TYPES[match])[0]]; return [version, isTrial, type]; } centerPadAndOutput(input) { const paddingRequired = this.totalMessageLength - input.length; console.error(input.padStart(paddingRequired / 2 + input.length, "*").padEnd(this.totalMessageLength, "*")); } padAndOutput(input, padding = "*", terminateWithPadding = "") { console.error( input.padEnd(this.totalMessageLength - terminateWithPadding.length, padding) + terminateWithPadding ); } outputInvalidLicenseKey(incorrectLicenseType, currentLicenseName, suppliedLicenseName) { if (incorrectLicenseType) { this.centerPadAndOutput(""); this.centerPadAndOutput(` ${currentLicenseName} License `); this.centerPadAndOutput(" Incompatible License Key "); this.padAndOutput( `* Your license key is for ${suppliedLicenseName} only and does not cover you for ${currentLicenseName}.`, " ", "*" ); this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*"); this.centerPadAndOutput(""); this.centerPadAndOutput(""); } else { this.centerPadAndOutput(""); this.centerPadAndOutput(` ${currentLicenseName} License `); this.centerPadAndOutput(" Invalid License Key "); this.padAndOutput(`* Your license key is not valid.`, " ", "*"); this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*"); this.centerPadAndOutput(""); this.centerPadAndOutput(""); } this.watermarkMessage = "Invalid License"; } outputExpiredTrialKey(formattedExpiryDate, currentLicenseName, suppliedLicenseName) { this.centerPadAndOutput(""); this.centerPadAndOutput(` ${currentLicenseName} License `); this.centerPadAndOutput(" Trial Period Expired. "); this.padAndOutput( `* Your trial only license for ${suppliedLicenseName} expired on ${formattedExpiryDate}.`, " ", "*" ); this.padAndOutput("* Please email info@ag-grid.com to purchase a license.", " ", "*"); this.centerPadAndOutput(""); this.centerPadAndOutput(""); this.watermarkMessage = "Trial Period Expired"; } outputMissingLicenseKey(currentLicenseName) { this.centerPadAndOutput(""); this.centerPadAndOutput(` ${currentLicenseName} License `); this.centerPadAndOutput(" License Key Not Found "); this.padAndOutput(`* All ${currentLicenseName} features are unlocked for trial.`, " ", "*"); this.padAndOutput( "* If you want to hide the watermark please email info@ag-grid.com for a trial license key.", " ", "*" ); this.centerPadAndOutput(""); this.centerPadAndOutput(""); this.watermarkMessage = "For Trial Use Only"; } outputExpiredKey(formattedExpiryDate, formattedReleaseDate, currentLicenseName, suppliedLicenseName) { this.centerPadAndOutput(""); this.centerPadAndOutput(` ${currentLicenseName} License `); this.centerPadAndOutput(" Incompatible Software Version "); this.padAndOutput( `* Your license key works with versions${suppliedLicenseName == "" ? "" : ` of ${suppliedLicenseName}`} released before ${formattedExpiryDate}.`, " ", "*" ); this.padAndOutput(`* The version you are trying to use was released on ${formattedReleaseDate}.`, " ", "*"); this.padAndOutput("* Please contact info@ag-grid.com to renew your license key.", " ", "*"); this.centerPadAndOutput(""); this.centerPadAndOutput(""); this.watermarkMessage = "License Expired"; } }; // eslint-disable-next-line no-restricted-syntax _LicenseManager.RELEASE_INFORMATION = "MTc3NDQyNTc0Nzc3NQ=="; var LicenseManager = _LicenseManager; // packages/ag-grid-enterprise/src/license/watermark.ts var import_ag_grid_community2 = require("ag-grid-community"); // packages/ag-grid-enterprise/src/license/watermark.css var watermark_default = '.ag-watermark{bottom:20px;color:#9b9b9b;opacity:.7;position:absolute;transition:opacity 1s ease-out 3s}:where(.ag-ltr) .ag-watermark{right:25px}:where(.ag-rtl) .ag-watermark{left:25px}.ag-watermark:before{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZH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dhOS4xIDkuMSAwIDAgMSAzLjU2LS43cTQuMDA1IDAgNi4xMDMgMS45MDdsMy4zMDUtMy4zMDVjLTIuNDc5LTEuOTA3LTUuNjU4LTIuOTI1LTkuNDA4LTIuOTI1LTIuMDk4IDAtNC4wMDUuMzE4LTUuNzIyIDEuMDE4LTEuNzE2LjY5OS0zLjE3OCAxLjU4OS00LjM4NiAyLjc5N2ExMi4xIDEyLjEgMCAwIDAtMi43OTcgNC4zODZjLS42MzYgMS43MTctLjk1NCAzLjYyNC0uOTU0IDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1OCAxLjAxNyAyLjAzNCAwIDMuODc4LS4zMTggNS41My0xLjAxNyAxLjY1My0uNyAzLjA1Mi0xLjU5IDQuMTk2LTIuNzk3cTEuNzE4LTEuODEyIDIuNjctNC4zODdjLjYzNi0xLjcxNi45NTQtMy42MjMuOTU0LTUuNjU4di0uODI2Yy0uMTktLjEyNy0uMjU1LS40NDUtLjI1NS0uNyIvPjwvc3ZnPg==");background-repeat:no-repeat;background-size:170px 40px;content:"";display:block;height:40px;width:170px}.ag-watermark-text{font-family:Impact,sans-serif;font-size:19px;font-weight:700;opacity:.5}:where(.ag-ltr) .ag-watermark-text{padding-left:.7rem}:where(.ag-rtl) .ag-watermark-text{padding-right:.7rem}'; // packages/ag-grid-enterprise/src/license/watermark.ts var WatermarkElement = { tag: "div", cls: "ag-watermark", children: [{ tag: "div", ref: "eLicenseTextRef", cls: "ag-watermark-text" }] }; var AgWatermark = class extends import_ag_grid_community2.Component { constructor() { super(WatermarkElement); this.eLicenseTextRef = import_ag_grid_community2.RefPlaceholder; this.registerCSS(watermark_default); } wireBeans(beans) { this.licenseManager = beans.licenseManager; } postConstruct() { const show = this.shouldDisplayWatermark(); this.setDisplayed(show); if (show) { this.eLicenseTextRef.textContent = this.licenseManager.getWatermarkMessage(); window.setTimeout(() => this.addCss("ag-opacity-zero"), 0); window.setTimeout(() => this.setDisplayed(false), 5e3); } } shouldDisplayWatermark() { return this.licenseManager.isDisplayWatermark(); } }; var AgWatermarkSelector = { selector: "AG-WATERMARK", component: AgWatermark }; // packages/ag-grid-enterprise/src/license/gridLicenseManager.ts var GridLicenseManager = class extends import_ag_grid_community3.BeanStub { constructor() { super(...arguments); this.beanName = "licenseManager"; } postConstruct() { this.validateLicense(); } validateLicense() { const beans = this.beans; if (beans.withinStudio) { this.licenseManager = { isDisplayWatermark: () => false, getWatermarkMessage: () => "" }; } else { const licenseManager = new LicenseManager((0, import_ag_grid_community3._getDocument)(beans)); this.licenseManager = licenseManager; licenseManager.validateLicense(); } } static getLicenseDetails(licenseKey) { return new LicenseManager(null).getLicenseDetails(licenseKey); } getWatermarkSelector() { return AgWatermarkSelector; } isDisplayWatermark() { return this.licenseManager.isDisplayWatermark(); } getWatermarkMessage() { return this.licenseManager.getWatermarkMessage(); } static setLicenseKey(licenseKey) { LicenseManager.setLicenseKey(licenseKey); } static setChartsLicenseManager(chartsLicenseManager) { LicenseManager.setChartsLicenseManager(chartsLicenseManager); } }; // packages/ag-grid-enterprise/src/excelExport/excelCreator.ts var import_ag_grid_community13 = require("ag-grid-community"); // packages/ag-grid-enterprise/src/excelExport/excelSerializingSession.ts var import_ag_grid_community5 = require("ag-grid-community"); // packages/ag-grid-enterprise/src/excelExport/assets/excelUtils.ts var import_ag_grid_community4 = require("ag-grid-community"); // packages/ag-grid-enterprise/src/excelExport/assets/excelConstants.ts var INCH_TO_EMU = 9525; var numberFormatMap = { "0": 1, "0.00": 2, "#,##0": 3, "#,##0.00": 4, "0%": 9, "0.00%": 10, "0.00E+00": 11, "# ?/?": 12, "# ??/??": 13, "mm-dd-yy": 14, "d-mmm-yy": 15, "d-mmm": 16, "mmm-yy": 17, "h:mm AM/PM": 18, "h:mm:ss AM/PM": 19, "h:mm": 20, "h:mm:ss": 21, "m/d/yy h:mm": 22, "#,##0 ;(#,##0)": 37, "#,##0 ;[Red](#,##0)": 38, "#,##0.00;(#,##0.00)": 39, "#,##0.00;[Red](#,##0.00)": 40, "mm:ss": 45, "[h]:mm:ss": 46, "mmss.0": 47, "##0.0E+0": 48, "@": 49 }; // packages/ag-grid-enterprise/src/excelExport/assets/xmlFactory.ts var LINE_SEPARATOR = "\r\n"; function returnAttributeIfPopulated(key, value, booleanTransformer) { if (!value && value !== "" && value !== 0) { return ""; } let xmlValue = value; if (typeof value === "boolean") { if (booleanTransformer) { xmlValue = booleanTransformer(value); } } return ` ${key}="${xmlValue}"`; } function createXmlHeader(headerElement = {}) { const headerStart = "<?"; const headerEnd = "?>"; const keys = ["version"]; if (!headerElement.version) { headerElement.version = "1.0"; } if (headerElement.encoding) { keys.push("encoding"); } if (headerElement.standalone) { keys.push("standalone"); } const att = keys.map((key) => `${key}="${headerElement[key]}"`).join(" "); return `${headerStart}xml ${att} ${headerEnd}`; } function createXml(xmlElement, booleanTransformer) { let props = ""; if (xmlElement.properties) { if (xmlElement.properties.prefixedAttributes) { xmlElement.properties.prefixedAttributes.forEach((prefixedSet) => { for (const key of Object.keys(prefixedSet.map)) { props += returnAttributeIfPopulated( prefixedSet.prefix + key, prefixedSet.map[key], booleanTransformer ); } }); } if (xmlElement.properties.rawMap) { for (const key of Object.keys(xmlElement.properties.rawMap)) { props += returnAttributeIfPopulated(key, xmlElement.properties.rawMap[key], booleanTransformer); } } } let result = "<" + xmlElement.name + props; if (!xmlElement.children && xmlElement.textNode == null) { return result + "/>" + LINE_SEPARATOR; } if (xmlElement.textNode != null) { return result + ">" + xmlElement.textNode + "</" + xmlElement.name + ">" + LINE_SEPARATOR; } result += ">" + LINE_SEPARATOR; if (xmlElement.children) { for (const it of xmlElement.children) { result += createXml(it, booleanTransformer); } } return result + "</" + xmlElement.name + ">" + LINE_SEPARATOR; } // packages/ag-grid-enterprise/src/excelExport/assets/excelUtils.ts var pointsToPixel = (points) => { return Math.round(points * 96 / 72); }; var pixelsToEMU = (value) => { return Math.ceil(value * INCH_TO_EMU); }; var getFontFamilyId = (name) => { if (name === void 0) { return; } const families = ["Automatic", "Roman", "Swiss", "Modern", "Script", "Decorative"]; const pos = families.indexOf(name || "Automatic"); return Math.max(pos, 0); }; var getHeightFromProperty = (rowIndex, height) => { if (!height) { return; } let finalHeight; if (typeof height === "number") { finalHeight = height; } else { const heightFunc = height; finalHeight = heightFunc({ rowIndex }); } return finalHeight; }; var setExcelImageTotalWidth = (image, columnsToExport) => { const { colSpan, column } = image.position; if (!image.width) { return; } if (colSpan) { const columnsInSpan = columnsToExport.slice(column - 1, column + colSpan - 1); let totalWidth = 0; for (let i = 0; i < columnsInSpan.length; i++) { const colWidth = columnsInSpan[i].getActualWidth(); if (image.width < totalWidth + colWidth) { image.position.colSpan = i + 1; image.totalWidth = image.width; image.width = image.totalWidth - totalWidth; break; } totalWidth += colWidth; } } else { image.totalWidth = image.width; } }; var setExcelImageTotalHeight = (image, rowHeight) => { const { rowSpan, row } = image.position; if (!image.height) { return; } if (rowSpan) { let totalHeight = 0; let counter = 0; for (let i = row; i < row + rowSpan; i++) { const nextRowHeight = pointsToPixel(getHeightFromProperty(i, rowHeight) || 20); if (image.height < totalHeight + nextRowHeight) { image.position.rowSpan = counter + 1; image.totalHeight = image.height; image.height = image.totalHeight - totalHeight; break; } totalHeight += nextRowHeight; counter++; } } else { image.totalHeight = image.height; } }; var createXmlPart = (body, skipHeader) => { const header = createXmlHeader({ encoding: "UTF-8", standalone: "yes" }); const xmlBody = createXml(body); if (skipHeader) { return xmlBody; } return `${header}${xmlBody}`; }; var getExcelColumnName = (colIdx) => { const startCode = 65; const tableWidth = 26; const fromCharCode = String.fromCharCode; const pos = Math.floor(colIdx / tableWidth); const tableIdx = colIdx % tableWidth; if (!pos || colIdx === tableWidth) { return fromCharCode(startCode + colIdx - 1); } if (!tableIdx) { return getExcelColumnName(pos - 1) + "Z"; } if (pos < tableWidth) { return fromCharCode(startCode + pos - 1) + fromCharCode(startCode + tableIdx - 1); } return getExcelColumnName(pos) + fromCharCode(startCode + tableIdx - 1); }; var sanitizeTableName = (name) => { return name.replaceAll("\n", "_x000a_"); }; var replaceInvisibleCharacters = (str) => { if (str == null) { return null; } let newString = ""; for (let i = 0; i < str.length; i++) { const point = str.charCodeAt(i); if (point >= 0 && point <= 31 && point !== 10) { const convertedCode = point.toString(16).toUpperCase(); const paddedCode = convertedCode.padStart(4, "0"); const newValue = `_x${paddedCode}_`; newString += newValue; } else { newString += str[i]; } } return newString; }; var buildSharedString = (strMap) => { const ret = []; for (const key of strMap.keys()) { const textNode = key.toString(); const child = { name: "t", textNode: (0, import_ag_grid_community4._escapeString)(replaceInvisibleCharacters(textNode)) }; const preserveSpaces = textNode.trim().length !== textNode.length; if (preserveSpaces) { child.properties = { rawMap: { "xml:space": "preserve" } }; } ret.push({ name: "si", children: [child] }); } return ret; }; // packages/ag-grid-enterprise/src/excelExport/excelSerializingSession.ts var ExcelSerializingSession = class extends import_ag_grid_community5.BaseGridSerializingSession { constructor(config) { super(config); this.mixedStyles = {}; this.mixedStyleCounter = 0; this.rows = []; this.frozenRowCount = 0; this.skipFrozenRows = false; this.frozenColumnCount = 0; this.skipFrozenColumns = false; this.formulaSvc = config.formulaSvc; this.config = Object.assign({}, config); this.workbook = config.workbook; this.stylesByIds = {}; for (const style of this.config.baseExcelStyles) { this.stylesByIds[style.id] = style; } const quotePrefixStyle = { id: "_quotePrefix", quotePrefix: 1 }; this.stylesByIds[quotePrefixStyle.id] = quotePrefixStyle; this.excelStyles = [...this.config.baseExcelStyles, quotePrefixStyle]; } addCustomContent(customContent) { for (const row of customContent) { const rowLen = this.rows.length + 1; let outlineLevel; if (!this.config.suppressRowOutline && row.outlineLevel != null) { outlineLevel = row.outlineLevel; } const rowObj = { height: getHeightFromProperty(rowLen, row.height || this.config.rowHeight), cells: (row.cells || []).map((cell, idx) => { const image = this.addImage(rowLen, this.columnsToExport[idx], cell.data?.value); let excelStyles = null; if (cell.styleId) { excelStyles = typeof cell.styleId === "string" ? [cell.styleId] : cell.styleId; } const excelStyleId = this.getStyleId(excelStyles); if (image) { return this.createCell( excelStyleId, this.getDataTypeForValue(image.value), image.value == null ? "" : image.value ); } const value = cell.data?.value ?? ""; const type = this.getDataTypeForValue(value); if (cell.mergeAcross) { return this.createMergedCell(excelStyleId, type, value, cell.mergeAcross); } return this.createCell(excelStyleId, type, value); }), outlineLevel }; if (row.collapsed != null) { rowObj.collapsed = row.collapsed; } if (row.hidden != null) { rowObj.hidden = row.hidden; } this.rows.push(rowObj); } } onNewHeaderGroupingRow() { const currentCells = []; const { freezeRows, headerRowHeight } = this.config; this.rows.push({ cells: currentCells, height: getHeightFromProperty(this.rows.length + 1, headerRowHeight) }); if (freezeRows) { this.frozenRowCount++; } return { onColumn: (columnGroup, header, index, span, collapsibleGroupRanges) => { const styleIds = this.config.styleLinker({ rowType: "HEADER_GROUPING", rowIndex: 1, value: `grouping-${header}`, columnGroup }); currentCells.push({ ...this.createMergedCell( this.getStyleId(styleIds), this.getDataTypeForValue("string"), header, span ), collapsibleRanges: collapsibleGroupRanges }); } }; } onNewHeaderRow() { const { freezeRows, headerRowHeight } = this.config; if (freezeRows) { this.frozenRowCount++; } return this.onNewRow(this.onNewHeaderColumn, headerRowHeight); } onNewBodyRow(node) { const { freezeRows, rowHeight } = this.config; if (!this.skipFrozenRows) { if (freezeRows === "headersAndPinnedRows" && node?.rowPinned === "top") { this.frozenRowCount++; } else if (typeof freezeRows === "function") { if (freezeRows((0, import_ag_grid_community5._addGridCommonParams)(this.gos, { node }))) { this.frozenRowCount++; } else { this.skipFrozenRows = true; } } else { this.skipFrozenRows = true; } } const rowAccumulator = this.onNewRow(this.onNewBodyColumn, rowHeight); if (node) { this.addRowOutlineIfNecessary(node); } return rowAccumulator; } prepare(columnsToExport) { super.prepare(columnsToExport); this.columnsToExport = [...columnsToExport]; this.cols = columnsToExport.map((col, i) => this.convertColumnToExcel(col, i)); } parse() { const longestRow = this.rows.reduce((a, b) => Math.max(a, b.cells.length), 0); while (this.cols.length < longestRow) { this.cols.push(this.convertColumnToExcel(null, this.cols.length + 1)); } const worksheet = this.createWorksheet(); return this.addWorksheetToWorkbook(worksheet); } createWorksheet() { const { sheetName } = this.config; let name; if (sheetName != null) { const sheetNameValue = typeof sheetName === "function" ? sheetName((0, import_ag_grid_community5._addGridCommonParams)(this.gos, {})) : sheetName; name = String(sheetNameValue).substring(0, 31); } else { name = "ag-grid"; } return { name, table: { columns: this.cols, rows: this.rows } }; } addRowOutlineIfNecessary(node) { const { gos, suppressRowOutline, rowGroupExpandState = "expanded" } = this.config; const isGroupHideOpenParents = gos.get("groupHideOpenParents"); if (isGroupHideOpenParents || suppressRowOutline || node.level == null) { return; } const padding = node.footer ? 1 : 0; const currentRow = (0, import_ag_grid_community5._last)(this.rows); if (node.uiLevel == null || node.level === node.uiLevel) { const outlineLevel = Math.min(node.level + padding, 7); currentRow.outlineLevel = outlineLevel; } if (rowGroupExpandState === "expanded") { return; } const collapseAll = rowGroupExpandState === "collapsed"; if (node.isExpandable()) { const isExpanded = !collapseAll && node.expanded; currentRow.collapsed = !isExpanded; } currentRow.hidden = // always show the node if there is no parent to be expanded !!node.parent && // or if it is a child of the root node node.parent.level !== -1 && (collapseAll || this.isAnyParentCollapsed(node.parent)); } isAnyParentCollapsed(node) { while (node && node.level !== -1) { if (!node.expanded) { return true; } node = node.parent; } return false; } convertColumnToExcel(column, index) { const columnWidth = this.config.columnWidth; const headerValue = column ? this.extractHeaderValue(column) : void 0; const displayName = headerValue ?? ""; const filterAllowed = column ? column.isFilterAllowed() : false; if (columnWidth) { if (typeof columnWidth === "number") { return { width: columnWidth, displayName, filterAllowed }; } return { width: columnWidth({ column, index }), displayName, filterAllowed }; } if (column) { const smallestUsefulWidth = 75; return { width: Math.max(column.getActualWidth(), smallestUsefulWidth), displayName, filterAllowed }; } return { displayName, filterAllowed }; } onNewHeaderColumn(rowIndex, currentCells) { return (column) => { const nameForCol = this.extractHeaderValue(column); const styleIds = this.config.styleLinker({ rowType: "HEADER", rowIndex, value: nameForCol, column }); currentCells.push( this.createCell(this.getStyleId(styleIds), this.getDataTypeForValue("string"), nameForCol) ); }; } onNewBodyColumn(rowIndex, currentCells) { let skipCols = 0; const { freezeColumns, rightToLeft } = this.config; return (column, index, node) => { if (skipCols > 0) { skipCols -= 1; return; } if (!this.skipFrozenColumns) { const pinned = column.getPinned(); const isPinnedLeft = pinned === true || pinned === "left"; if (freezeColumns === "pinned" && pinned && isPinnedLeft !== rightToLeft) { this.frozenColumnCount++; } else if (typeof freezeColumns === "function" && freezeColumns((0, import_ag_grid_community5._addGridCommonParams)(this.gos, { column }))) { this.frozenColumnCount++; } else { this.skipFrozenColumns = true; } } const { value: valueForCell, valueFormatted } = this.extractRowCellValue({ column, node, currentColumnIndex: index, accumulatedRowIndex: rowIndex, type: "excel", useRawFormula: true }); const rawValueForCell = valueForCell; const valueForCellString = typeof rawValueForCell === "bigint" ? rawValueForCell.toString() : rawValueForCell; const styleIds = this.config.styleLinker({ rowType: "BODY", rowIndex, value: rawValueForCell, column, node }); const excelStyleId = this.getStyleId(styleIds); const colSpan = column.getColSpan(node); const addedImage = this.addImage(rowIndex, column, valueForCellString); if (addedImage) { currentCells.push( this.createCell( excelStyleId, this.getDataTypeForValue(addedImage.value), addedImage.value == null ? "" : addedImage.value ) ); } else if (colSpan > 1) { skipCols = colSpan - 1; currentCells.push( this.createMergedCell( excelStyleId, this.getDataTypeForValue(rawValueForCell), valueForCellString, colSpan - 1 ) ); } else { const isFormula = column.isAllowFormula() && this.formulaSvc?.isFormula(valueForCellString); const cell = this.createCell( excelStyleId, isFormula ? "f" : this.getDataTypeForValue(rawValueForCell), isFormula ? this.formulaSvc?.updateFormulaByOffset({ value: valueForCellString, rowDelta: rowIndex - (node.formulaRowIndex + 1), useRefFormat: false }) : valueForCellString, valueFormatted ); currentCells.push(cell); } }; } onNewRow(onNewColumnAccumulator, height) { const currentCells = []; this.rows.push({ cells: currentCells, height: getHeightFromProperty(this.rows.length + 1, height) }); return { onColumn: onNewColumnAccumulator.bind(this, this.rows.length, currentCells)() }; } addWorksheetToWorkbook(worksheet) { const { excelStyles, config } = this; this.mapSharedStrings(worksheet); if (this.frozenColumnCount) { config.frozenColumnCount = this.frozenColumnCount; } if (this.frozenRowCount) { config.frozenRowCount = this.frozenRowCount; } return this.workbook.addWorksheet(excelStyles, worksheet, config); } mapSharedStrings(worksheet) { let emptyStringPosition; for (const row of worksheet.table.rows) { for (const cell of row.cells) { const data = cell.data; if (!data || data.type !== "s") { continue; } const value = data.value; if (value == null) { continue; } if (value === "") { emptyStringPosition ?? (emptyStringPosition = this.workbook.getStringPosition("").toString()); data.value = emptyStringPosition; continue; } data.value = this.workbook.getStringPosition(String(value)).toString(); } } } getDataTypeForValue(valueForCell) { if (valueForCell === void 0) { return "empty"; } let dataType = "s"; try { if (this.isNumerical(valueForCell)) { dataType = "n"; } } catch (e) { } return dataType; } getTypeFromStyle(style, value) { if (this.isFormula(value)) { return "f"; } if (style?.dataType) { switch (style.dataType.toLocaleLowerCase()) { case "formula": return "f"; case "string": return "s"; case "number": return "n"; case "datetime": return "d"; case "error": return "e"; case "boolean": return "b"; default: (0, import_ag_grid_community5._warn)(162, { id: style.id, dataType: style.dataType }); } } return null; } addImage(rowIndex, column, value) { if (!this.config.addImageToCell) { return; } const addedImage = this.config.addImageToCell(rowIndex, column, value); if (!addedImage) { return; } this.workbook.addBodyImageToMap( addedImage.image, rowIndex, column, this.columnsToExport, this.config.rowHeight ); return addedImage; } createCell(styleId, type, value, valueFormatted) { const actualStyle = this.getStyleById(styleId); if (!actualStyle