UNPKG

ag-grid-enterprise

Version:

AG Grid Enterprise Features

993 lines (979 loc) 3.57 MB
/** * ag-grid-enterprise - AG Grid Enterprise Features * @version v30.2.1 * @link https://www.ag-grid.com/ ' * @license Commercial */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var agGridCommunity = require('ag-grid-community'); var MD5 = /** @class */ (function () { function MD5() { this.ieCompatibility = false; } MD5.prototype.init = function () { this.ieCompatibility = (this.md5('hello') != '5d41402abc4b2a76b9719d911017c592'); }; MD5.prototype.md5cycle = function (x, k) { var 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]); }; MD5.prototype.cmn = function (q, a, b, x, s, t) { a = this.add32(this.add32(a, q), this.add32(x, t)); return this.add32((a << s) | (a >>> (32 - s)), b); }; MD5.prototype.ff = function (a, b, c, d, x, s, t) { return this.cmn((b & c) | ((~b) & d), a, b, x, s, t); }; MD5.prototype.gg = function (a, b, c, d, x, s, t) { return this.cmn((b & d) | (c & (~d)), a, b, x, s, t); }; MD5.prototype.hh = function (a, b, c, d, x, s, t) { return this.cmn(b ^ c ^ d, a, b, x, s, t); }; MD5.prototype.ii = function (a, b, c, d, x, s, t) { return this.cmn(c ^ (b | (~d)), a, b, x, s, t); }; MD5.prototype.md51 = function (s) { var n = s.length; var state = [1732584193, -271733879, -1732584194, 271733878]; var i; for (i = 64; i <= s.length; i += 64) { this.md5cycle(state, this.md5blk(s.substring(i - 64, i))); } s = s.substring(i - 64); var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; for (i = 0; i < s.length; i++) { tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3); } tail[i >> 2] |= 0x80 << ((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. */ MD5.prototype.md5blk = function (s) { var md5blks = []; /* Andy King said do it this way. */ for (var i = 0; i < 64; i += 4) { md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); } return md5blks; }; MD5.prototype.rhex = function (n) { var hex_chr = '0123456789abcdef'.split(''); var s = '', j = 0; for (; j < 4; j++) { s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; } return s; }; MD5.prototype.hex = function (x) { for (var i = 0; i < x.length; i++) { x[i] = this.rhex(x[i]); } return x.join(''); }; MD5.prototype.md5 = function (s) { return this.hex(this.md51(s)); }; MD5.prototype.add32 = function (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. */ MD5.prototype.add32Std = function (a, b) { return (a + b) & 0xFFFFFFFF; }; MD5.prototype.add32Compat = function (x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF), msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); }; return MD5; }()); var __read = (undefined && undefined.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; // move to general utils function missingOrEmpty(value) { return value == null || value.length === 0; } function exists(value, allowEmptyString) { if (allowEmptyString === void 0) { allowEmptyString = false; } return value != null && (value !== '' || allowEmptyString); } var LicenseManager = /** @class */ (function () { function LicenseManager(document) { this.watermarkMessage = undefined; this.document = document; this.md5 = new MD5(); this.md5.init(); } LicenseManager.prototype.validateLicense = function () { if (missingOrEmpty(LicenseManager.licenseKey)) { if (!this.isWebsiteUrl() || this.isForceWatermark()) { this.outputMissingLicenseKey(); } } else if (LicenseManager.licenseKey.length > 32) { if (LicenseManager.licenseKey.indexOf("For_Trialing_ag-Grid_Only") !== -1) { this.outputInvalidLicenseKey(); } else { var _a = LicenseManager.extractLicenseComponents(LicenseManager.licenseKey), md5 = _a.md5, license = _a.license, version = _a.version, isTrial = _a.isTrial; if (md5 === this.md5.md5(license)) { if (exists(version) && version) { this.validateLicenseKeyForVersion(version, !!isTrial, license); } else { this.validateLegacyKey(license); } } else { this.outputInvalidLicenseKey(); } } } else { this.outputInvalidLicenseKey(); } }; LicenseManager.extractExpiry = function (license) { var restrictionHashed = license.substring(license.lastIndexOf('_') + 1, license.length); return new Date(parseInt(LicenseManager.decode(restrictionHashed), 10)); }; LicenseManager.extractLicenseComponents = function (licenseKey) { // when users copy the license key from a PDF extra zero width characters are sometimes copied too // carriage returns and line feeds are problematic too // all of which causes license key validation to fail - strip these out var cleanedLicenseKey = licenseKey.replace(/[\u200B-\u200D\uFEFF]/g, ''); cleanedLicenseKey = cleanedLicenseKey.replace(/\r?\n|\r/g, ''); var hashStart = cleanedLicenseKey.length - 32; var md5 = cleanedLicenseKey.substring(hashStart); var license = cleanedLicenseKey.substring(0, hashStart); var _a = __read(LicenseManager.extractBracketedInformation(cleanedLicenseKey), 2), version = _a[0], isTrial = _a[1]; return { md5: md5, license: license, version: version, isTrial: isTrial }; }; LicenseManager.prototype.getLicenseDetails = function (licenseKey) { var _a = LicenseManager.extractLicenseComponents(licenseKey), md5 = _a.md5, license = _a.license, version = _a.version, isTrial = _a.isTrial; var valid = (md5 === this.md5.md5(license)) && licenseKey.indexOf("For_Trialing_ag-Grid_Only") === -1; var trialExpired = null; var expiry = null; if (valid) { expiry = LicenseManager.extractExpiry(license); valid = !isNaN(expiry.getTime()); if (isTrial) { var now = new Date(); trialExpired = (expiry < now); } } return { licenseKey: licenseKey, valid: valid, expiry: valid ? LicenseManager.formatDate(expiry) : null, version: version ? version : 'legacy', isTrial: isTrial, trialExpired: trialExpired }; }; LicenseManager.prototype.isDisplayWatermark = function () { return this.isForceWatermark() || (!this.isLocalhost() && !this.isWebsiteUrl() && !missingOrEmpty(this.watermarkMessage)); }; LicenseManager.prototype.getWatermarkMessage = function () { return this.watermarkMessage || ''; }; LicenseManager.prototype.getHostname = function () { var win = (this.document.defaultView || window); var loc = win.location; var _a = loc.hostname, hostname = _a === void 0 ? '' : _a; return hostname; }; LicenseManager.prototype.isForceWatermark = function () { var win = (this.document.defaultView || window); var loc = win.location; var pathname = loc.pathname; return pathname ? pathname.indexOf('forceWatermark') !== -1 : false; }; LicenseManager.prototype.isWebsiteUrl = function () { var hostname = this.getHostname(); return hostname.match(/^((?:\w+\.)?ag-grid\.com)$/) !== null; }; LicenseManager.prototype.isLocalhost = function () { var hostname = this.getHostname(); return hostname.match(/^(?:127\.0\.0\.1|localhost)$/) !== null; }; LicenseManager.formatDate = function (date) { var monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; var day = date.getDate(); var monthIndex = date.getMonth(); var year = date.getFullYear(); return day + ' ' + monthNames[monthIndex] + ' ' + year; }; LicenseManager.getGridReleaseDate = function () { return new Date(parseInt(LicenseManager.decode(LicenseManager.RELEASE_INFORMATION), 10)); }; LicenseManager.decode = function (input) { var keystr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var t = ''; var n, r, i; var s, o, u, a; var f = 0; var e = input.replace(/[^A-Za-z0-9+/=]/g, ''); while (f < e.length) { s = keystr.indexOf(e.charAt(f++)); o = keystr.indexOf(e.charAt(f++)); u = keystr.indexOf(e.charAt(f++)); a = keystr.indexOf(e.charAt(f++)); n = s << 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; }; LicenseManager.utf8_decode = function (input) { input = input.replace(/rn/g, 'n'); var t = ''; for (var n = 0; n < input.length; n++) { var 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; }; LicenseManager.setLicenseKey = function (licenseKey) { this.licenseKey = licenseKey; }; LicenseManager.extractBracketedInformation = function (licenseKey) { var matches = licenseKey.split('[') .filter(function (v) { return v.indexOf(']') > -1; }) .map(function (value) { return value.split(']')[0]; }); if (!matches || matches.length === 0) { return [null, null]; } var isTrial = matches.filter(function (match) { return match === 'TRIAL'; }).length === 1; var version = matches.filter(function (match) { return match.indexOf("v") === 0; }).map(function (match) { return match.replace(/^v/, ""); })[0]; return [version, isTrial]; }; LicenseManager.prototype.validateLicenseKeyForVersion = function (version, isTrial, license) { if (version !== '2') { return; } if (isTrial) { this.validateForTrial(license); } else { this.validateLegacyKey(license); } }; LicenseManager.prototype.validateLegacyKey = function (license) { var gridReleaseDate = LicenseManager.getGridReleaseDate(); var expiry = LicenseManager.extractExpiry(license); var valid = false; var current = false; if (!isNaN(expiry.getTime())) { valid = true; current = (gridReleaseDate < expiry); } if (!valid) { this.outputInvalidLicenseKey(); } else if (!current) { var formattedExpiryDate = LicenseManager.formatDate(expiry); var formattedReleaseDate = LicenseManager.formatDate(gridReleaseDate); this.outputIncompatibleVersion(formattedExpiryDate, formattedReleaseDate); } }; LicenseManager.prototype.validateForTrial = function (license) { var expiry = LicenseManager.extractExpiry(license); var now = new Date(); var valid = false; var current = false; if (!isNaN(expiry.getTime())) { valid = true; current = (expiry > now); } if (!valid) { this.outputInvalidLicenseKey(); } else if (!current) { var formattedExpiryDate = LicenseManager.formatDate(expiry); this.outputExpiredTrialKey(formattedExpiryDate); } }; LicenseManager.prototype.outputInvalidLicenseKey = function () { console.error('*****************************************************************************************************************'); console.error('***************************************** AG Grid Enterprise License ********************************************'); console.error('********************************************* Invalid License ***************************************************'); console.error('* Your license for AG Grid Enterprise is not valid - please contact info@ag-grid.com to obtain a valid license. *'); console.error('*****************************************************************************************************************'); console.error('*****************************************************************************************************************'); this.watermarkMessage = "Invalid License"; }; LicenseManager.prototype.outputExpiredTrialKey = function (formattedExpiryDate) { console.error('****************************************************************************************************************'); console.error('***************************************** AG Grid Enterprise License *******************************************'); console.error('***************************************** Trial Period Expired. *******************************************'); console.error("* Your license for AG Grid Enterprise expired on " + formattedExpiryDate + ". *"); console.error('* Please email info@ag-grid.com to purchase a license. *'); console.error('****************************************************************************************************************'); console.error('****************************************************************************************************************'); this.watermarkMessage = "Trial Period Expired"; }; LicenseManager.prototype.outputMissingLicenseKey = function () { console.error('****************************************************************************************************************'); console.error('***************************************** AG Grid Enterprise License *******************************************'); console.error('****************************************** License Key Not Found ***********************************************'); console.error('* All AG Grid Enterprise features are unlocked. *'); console.error('* This is an evaluation only version, it is not licensed for development projects intended for production. *'); console.error('* If you want to hide the watermark, please email info@ag-grid.com for a trial license. *'); console.error('****************************************************************************************************************'); console.error('****************************************************************************************************************'); this.watermarkMessage = "For Trial Use Only"; }; LicenseManager.prototype.outputIncompatibleVersion = function (formattedExpiryDate, formattedReleaseDate) { console.error('****************************************************************************************************************************'); console.error('****************************************************************************************************************************'); console.error('* AG Grid Enterprise License *'); console.error('* License not compatible with installed version of AG Grid Enterprise. *'); console.error('* *'); console.error("* Your AG Grid License entitles you to all versions of AG Grid that we release within the time covered by your license *"); console.error("* - typically we provide one year licenses which entitles you to all releases / updates of AG Grid within that year. *"); console.error("* Your license has an end (expiry) date which stops the license key working with versions of AG Grid released after the *"); console.error("* license end date. The license key that you have expires on " + formattedExpiryDate + ", however the version of AG Grid you *"); console.error("* are trying to use was released on " + formattedReleaseDate + ". *"); console.error('* *'); console.error('* Please contact info@ag-grid.com to renew your subscription to new versions and get a new license key to work with this *'); console.error('* version of AG Grid. *'); console.error('****************************************************************************************************************************'); console.error('****************************************************************************************************************************'); this.watermarkMessage = "License Expired"; }; LicenseManager.RELEASE_INFORMATION = 'MTY5ODkxNzc1MzgxNA=='; return LicenseManager; }()); var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var GridLicenseManager = /** @class */ (function (_super) { __extends(GridLicenseManager, _super); function GridLicenseManager() { return _super !== null && _super.apply(this, arguments) || this; } GridLicenseManager.prototype.validateLicense = function () { this.licenseManager = new LicenseManager(this.gridOptionsService.getDocument()); this.licenseManager.validateLicense(); }; GridLicenseManager.getLicenseDetails = function (licenseKey) { return new LicenseManager(null).getLicenseDetails(licenseKey); }; GridLicenseManager.prototype.isDisplayWatermark = function () { return this.licenseManager.isDisplayWatermark(); }; GridLicenseManager.prototype.getWatermarkMessage = function () { return this.licenseManager.getWatermarkMessage(); }; GridLicenseManager.setLicenseKey = function (licenseKey) { LicenseManager.setLicenseKey(licenseKey); }; __decorate([ agGridCommunity.PreConstruct ], GridLicenseManager.prototype, "validateLicense", null); GridLicenseManager = __decorate([ agGridCommunity.Bean('licenseManager') ], GridLicenseManager); return GridLicenseManager; }(agGridCommunity.BeanStub)); var __extends$1 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var WatermarkComp = /** @class */ (function (_super) { __extends$1(WatermarkComp, _super); function WatermarkComp() { return _super.call(this, /* html*/ "<div class=\"ag-watermark\">\n <div ref=\"eLicenseTextRef\" class=\"ag-watermark-text\"></div>\n </div>") || this; } WatermarkComp.prototype.postConstruct = function () { var _this = this; var show = this.shouldDisplayWatermark(); this.setDisplayed(show); if (show) { this.eLicenseTextRef.innerText = this.licenseManager.getWatermarkMessage(); window.setTimeout(function () { return _this.addCssClass('ag-opacity-zero'); }, 0); window.setTimeout(function () { return _this.setDisplayed(false); }, 5000); } }; WatermarkComp.prototype.shouldDisplayWatermark = function () { return this.licenseManager.isDisplayWatermark(); }; __decorate$1([ agGridCommunity.Autowired('licenseManager') ], WatermarkComp.prototype, "licenseManager", void 0); __decorate$1([ agGridCommunity.RefSelector('eLicenseTextRef') ], WatermarkComp.prototype, "eLicenseTextRef", void 0); __decorate$1([ agGridCommunity.PostConstruct ], WatermarkComp.prototype, "postConstruct", null); return WatermarkComp; }(agGridCommunity.Component)); // DO NOT UPDATE MANUALLY: Generated from script during build time var VERSION = '30.2.1'; var EnterpriseCoreModule = { version: VERSION, moduleName: agGridCommunity.ModuleNames.EnterpriseCoreModule, beans: [GridLicenseManager], agStackComponents: [ { componentName: 'AgWatermark', componentClass: WatermarkComp } ] }; var __extends$2 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var AdvancedFilterHeaderComp = /** @class */ (function (_super) { __extends$2(AdvancedFilterHeaderComp, _super); function AdvancedFilterHeaderComp(enabled) { var _this = _super.call(this, /* html */ "\n <div class=\"ag-advanced-filter-header\" role=\"row\">\n </div>") || this; _this.enabled = enabled; return _this; } AdvancedFilterHeaderComp.prototype.postConstruct = function () { var _this = this; this.setupAdvancedFilter(this.enabled); this.addDestroyFunc(function () { return _this.destroyBean(_this.eAdvancedFilter); }); this.addManagedListener(this.eventService, agGridCommunity.Events.EVENT_GRID_COLUMNS_CHANGED, function () { return _this.onGridColumnsChanged(); }); this.addGuiEventListener('keydown', function (event) { return _this.onKeyDown(event); }); this.addGuiEventListener('focusout', function (event) { if (!_this.getFocusableElement().contains(event.relatedTarget)) { _this.focusService.clearAdvancedFilterColumn(); } }); }; AdvancedFilterHeaderComp.prototype.getFocusableElement = function () { var _a, _b; return (_b = (_a = this.eAdvancedFilter) === null || _a === void 0 ? void 0 : _a.getGui()) !== null && _b !== void 0 ? _b : this.getGui(); }; AdvancedFilterHeaderComp.prototype.setEnabled = function (enabled) { if (enabled === this.enabled) { return; } this.setupAdvancedFilter(enabled); }; AdvancedFilterHeaderComp.prototype.refresh = function () { var _a; (_a = this.eAdvancedFilter) === null || _a === void 0 ? void 0 : _a.refresh(); }; AdvancedFilterHeaderComp.prototype.getHeight = function () { return this.height; }; AdvancedFilterHeaderComp.prototype.setInputDisabled = function (disabled) { var _a; (_a = this.eAdvancedFilter) === null || _a === void 0 ? void 0 : _a.setInputDisabled(disabled); }; AdvancedFilterHeaderComp.prototype.setupAdvancedFilter = function (enabled) { var eGui = this.getGui(); if (enabled) { // unmanaged as can be recreated this.eAdvancedFilter = this.createBean(new AdvancedFilterComp()); var eAdvancedFilterGui = this.eAdvancedFilter.getGui(); this.eAdvancedFilter.addCssClass('ag-advanced-filter-header-cell'); this.height = this.columnModel.getFloatingFiltersHeight(); var height = this.height + "px"; eGui.style.height = height; eGui.style.minHeight = height; this.setAriaRowIndex(); agGridCommunity._.setAriaRole(eAdvancedFilterGui, 'gridcell'); agGridCommunity._.setAriaColIndex(eAdvancedFilterGui, 1); this.setAriaColumnCount(eAdvancedFilterGui); eGui.appendChild(eAdvancedFilterGui); } else { agGridCommunity._.clearElement(eGui); this.destroyBean(this.eAdvancedFilter); this.height = 0; } agGridCommunity._.setDisplayed(eGui, enabled); this.enabled = enabled; }; AdvancedFilterHeaderComp.prototype.setAriaColumnCount = function (eAdvancedFilterGui) { var _a, _b; agGridCommunity._.setAriaColSpan(eAdvancedFilterGui, (_b = (_a = this.columnModel.getAllGridColumns()) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); }; AdvancedFilterHeaderComp.prototype.setAriaRowIndex = function () { agGridCommunity._.setAriaRowIndex(this.getGui(), this.headerNavigationService.getHeaderRowCount()); }; AdvancedFilterHeaderComp.prototype.onGridColumnsChanged = function () { if (!this.eAdvancedFilter) { return; } this.setAriaColumnCount(this.eAdvancedFilter.getGui()); this.setAriaRowIndex(); }; AdvancedFilterHeaderComp.prototype.onKeyDown = function (event) { switch (event.key) { case agGridCommunity.KeyCode.ENTER: { if (this.hasFocus()) { if (this.focusService.focusInto(this.getFocusableElement())) { event.preventDefault(); } } break; } case agGridCommunity.KeyCode.ESCAPE: if (!this.hasFocus()) { this.getFocusableElement().focus(); } break; case agGridCommunity.KeyCode.UP: this.navigateUpDown(true, event); break; case agGridCommunity.KeyCode.DOWN: this.navigateUpDown(false, event); break; case agGridCommunity.KeyCode.TAB: if (this.hasFocus()) { this.navigateLeftRight(event); } else { var nextFocusableEl = this.focusService.findNextFocusableElement(this.getFocusableElement(), null, event.shiftKey); if (nextFocusableEl) { event.preventDefault(); nextFocusableEl.focus(); } else { this.navigateLeftRight(event); } } break; } }; AdvancedFilterHeaderComp.prototype.navigateUpDown = function (backwards, event) { if (this.hasFocus()) { if (this.focusService.focusNextFromAdvancedFilter(backwards)) { event.preventDefault(); } } }; AdvancedFilterHeaderComp.prototype.navigateLeftRight = function (event) { if (event.shiftKey ? this.focusService.focusLastHeader() : this.focusService.focusNextFromAdvancedFilter(false, true)) { event.preventDefault(); } }; AdvancedFilterHeaderComp.prototype.hasFocus = function () { var eDocument = this.gridOptionsService.getDocument(); return eDocument.activeElement === this.getFocusableElement(); }; __decorate$2([ agGridCommunity.Autowired('columnModel') ], AdvancedFilterHeaderComp.prototype, "columnModel", void 0); __decorate$2([ agGridCommunity.Autowired('focusService') ], AdvancedFilterHeaderComp.prototype, "focusService", void 0); __decorate$2([ agGridCommunity.Autowired('headerNavigationService') ], AdvancedFilterHeaderComp.prototype, "headerNavigationService", void 0); __decorate$2([ agGridCommunity.PostConstruct ], AdvancedFilterHeaderComp.prototype, "postConstruct", null); return AdvancedFilterHeaderComp; }(agGridCommunity.Component)); var __extends$3 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var AddDropdownComp = /** @class */ (function (_super) { __extends$3(AddDropdownComp, _super); function AddDropdownComp(params) { var _this = _super.call(this, __assign(__assign({}, params), { template: /* html */ "\n <div class=\"ag-picker-field\" role=\"presentation\">\n <div ref=\"eLabel\"></div>\n <div ref=\"eWrapper\" class=\"ag-wrapper ag-picker-collapsed\">\n <div ref=\"eDisplayField\" class=\"ag-picker-field-display\"></div>\n <ag-input-text-field ref=\"eInput\" class=\"ag-rich-select-field-input\"></ag-input-text-field>\n <div ref=\"eIcon\" class=\"ag-picker-field-icon\" aria-hidden=\"true\"></div>\n </div>\n </div>" })) || this; _this.params = params; return _this; } AddDropdownComp.prototype.showPicker = function () { var _this = this; // avoid focus handling issues with multiple rich selects setTimeout(function () { return _super.prototype.showPicker.call(_this); }); }; AddDropdownComp.prototype.hidePicker = function () { var _this = this; // avoid focus handling issues with multiple rich selects setTimeout(function () { return _super.prototype.hidePicker.call(_this); }); }; AddDropdownComp.prototype.postConstruct = function () { _super.prototype.postConstruct.call(this); var _a = this.params, wrapperClassName = _a.wrapperClassName, ariaLabel = _a.ariaLabel; agGridCommunity._.setDisplayed(this.eDisplayField, false); if (wrapperClassName) { this.eWrapper.classList.add(wrapperClassName); } agGridCommunity._.setAriaLabelledBy(this.eWrapper, ''); agGridCommunity._.setAriaLabel(this.eWrapper, ariaLabel); }; AddDropdownComp.prototype.onEnterKeyDown = function (event) { agGridCommunity._.stopPropagationForAgGrid(event); if (this.isPickerDisplayed) { _super.prototype.onEnterKeyDown.call(this, event); } else { event.preventDefault(); this.showPicker(); } }; return AddDropdownComp; }(agGridCommunity.AgRichSelect)); var __extends$4 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var AdvancedFilterBuilderDragFeature = /** @class */ (function (_super) { __extends$4(AdvancedFilterBuilderDragFeature, _super); function AdvancedFilterBuilderDragFeature(comp, virtualList) { var _this = _super.call(this) || this; _this.comp = comp; _this.virtualList = virtualList; return _this; } AdvancedFilterBuilderDragFeature.prototype.postConstruct = function () { var _this = this; this.createManagedBean(new agGridCommunity.VirtualListDragFeature(this.comp, this.virtualList, { dragSourceType: agGridCommunity.DragSourceType.AdvancedFilterBuilder, listItemDragStartEvent: AdvancedFilterBuilderDragFeature.EVENT_DRAG_STARTED, listItemDragEndEvent: AdvancedFilterBuilderDragFeature.EVENT_DRAG_ENDED, eventSource: this, getCurrentDragValue: function (listItemDragStartEvent) { return _this.getCurrentDragValue(listItemDragStartEvent); }, isMoveBlocked: function () { return false; }, getNumRows: function (comp) { return comp.getNumItems(); }, moveItem: function (currentDragValue, lastHoveredListItem) { return _this.moveItem(currentDragValue, lastHoveredListItem); } })); }; AdvancedFilterBuilderDragFeature.prototype.getCurrentDragValue = function (listItemDragStartEvent) { return listItemDragStartEvent.item; }; AdvancedFilterBuilderDragFeature.prototype.moveItem = function (currentDragValue, lastHoveredListItem) { this.comp.moveItem(currentDragValue, lastHoveredListItem); }; AdvancedFilterBuilderDragFeature.EVENT_DRAG_STARTED = 'advancedFilterBuilderDragStarted'; AdvancedFilterBuilderDragFeature.EVENT_DRAG_ENDED = 'advancedFilterBuilderDragEnded'; __decorate$3([ agGridCommunity.PostConstruct ], AdvancedFilterBuilderDragFeature.prototype, "postConstruct", null); return AdvancedFilterBuilderDragFeature; }(agGridCommunity.BeanStub)); var __extends$5 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var AdvancedFilterBuilderItemNavigationFeature = /** @class */ (function (_super) { __extends$5(AdvancedFilterBuilderItemNavigationFeature, _super); function AdvancedFilterBuilderItemNavigationFeature(eGui, focusWrapper, eFocusableComp) { var _this = _super.call(this) || this; _this.eGui = eGui; _this.focusWrapper = focusWrapper; _this.eFocusableComp = eFocusableComp; return _this; } AdvancedFilterBuilderItemNavigationFeature.prototype.postConstruct = function () { var _this = this; this.addManagedListener(this.eGui, 'keydown', function (event) { switch (event.key) { case agGridCommunity.KeyCode.TAB: if (!event.defaultPrevented) { // tab guard handled the navigation. stop from reaching virtual list agGridCommunity._.stopPropagationForAgGrid(event); } break; case agGridCommunity.KeyCode.UP: case agGridCommunity.KeyCode.DOWN: // if this hasn't been handled by an editor, prevent virtual list navigation agGridCommunity._.stopPropagationForAgGrid(event); break; case agGridCommunity.KeyCode.ESCAPE: if (agGridCommunity._.isStopPropagationForAgGrid(event)) { return; } var eDocument = _this.gridOptionsService.getDocument(); if (_this.eGui.contains(eDocument.activeElement)) { event.preventDefault(); agGridCommunity._.stopPropagationForAgGrid(event); _this.focusWrapper.focus(); } break; } }); this.addManagedListener(this.focusWrapper, 'keydown', function (event) { switch (event.key) { case agGridCommunity.KeyCode.ENTER: if (agGridCommunity._.isStopPropagationForAgGrid(event)) { return; } var eDocument = _this.gridOptionsService.getDocument(); if (eDocument.activeElement === _this.focusWrapper) { event.preventDefault(); agGridCommunity._.stopPropagationForAgGrid(event); _this.eFocusableComp.getFocusableElement().focus(); } break; } }); this.addManagedListener(this.focusWrapper, 'focusin', function () { _this.focusWrapper.classList.add('ag-advanced-filter-builder-virtual-list-item-highlight'); }); this.addManagedListener(this.focusWrapper, 'focusout', function (event) { if (!_this.focusWrapper.contains(event.relatedTarget)) { _this.focusWrapper.classList.remove('ag-advanced-filter-builder-virtual-list-item-highlight'); } }); }; __decorate$4([ agGridCommunity.PostConstruct ], AdvancedFilterBuilderItemNavigationFeature.prototype, "postConstruct", null); return AdvancedFilterBuilderItemNavigationFeature; }(agGridCommunity.BeanStub)); function getAdvancedFilterBuilderAddButtonParams(translate, maxPickerWidth) { return { pickerAriaLabelKey: 'ariaLabelAdvancedFilterBuilderAddField', pickerAriaLabelValue: 'Advanced Filter Builder Add Field', pickerType: 'ag-list', valueList: [{ key: 'condition', displayValue: translate('advancedFilterBuilderAddCondition') }, { key: 'join', displayValue: translate('advancedFilterBuilderAddJoin') }], valueFormatter: function (value) { var _a; return value == null ? null : (_a = value.displayValue) !== null && _a !== void 0 ? _a : value.key; }, pickerIcon: 'advancedFilterBuilderAdd', maxPickerWidth: (maxPickerWidth !== null && maxPickerWidth !== void 0 ? maxPickerWidth : 120) + "px", wrapperC