UNPKG

2.38 MBJavaScriptView Raw
1/**
2 * ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v27.3.0
3 * @link https://www.ag-grid.com/
4' * @license MIT
5 */
6
7'use strict';
8
9Object.defineProperty(exports, '__esModule', { value: true });
10
11/**
12 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13 * @version v27.3.0
14 * @link https://www.ag-grid.com/
15 * @license MIT
16 */
17/**
18 * If value is undefined, null or blank, returns null, otherwise returns the value
19 * @param {T} value
20 * @returns {T | null}
21 */
22function makeNull(value) {
23 if (value == null || value === '') {
24 return null;
25 }
26 return value;
27}
28function exists(value, allowEmptyString) {
29 if (allowEmptyString === void 0) { allowEmptyString = false; }
30 return value != null && (value !== '' || allowEmptyString);
31}
32function missing(value) {
33 return !exists(value);
34}
35function missingOrEmpty(value) {
36 return value == null || value.length === 0;
37}
38function toStringOrNull(value) {
39 return value != null && typeof value.toString === 'function' ? value.toString() : null;
40}
41// for parsing html attributes, where we want empty strings and missing attributes to be undefined
42function attrToNumber(value) {
43 if (value === undefined) {
44 // undefined or empty means ignore the value
45 return;
46 }
47 if (value === null || value === '') {
48 // null or blank means clear
49 return null;
50 }
51 if (typeof value === 'number') {
52 return isNaN(value) ? undefined : value;
53 }
54 var valueParsed = parseInt(value, 10);
55 return isNaN(valueParsed) ? undefined : valueParsed;
56}
57// for parsing html attributes, where we want empty strings and missing attributes to be undefined
58function attrToBoolean(value) {
59 if (value === undefined) {
60 // undefined or empty means ignore the value
61 return;
62 }
63 if (value === null || value === '') {
64 // null means clear
65 return false;
66 }
67 if (typeof value === 'boolean') {
68 // if simple boolean, return the boolean
69 return value;
70 }
71 // if equal to the string 'true' (ignoring case) then return true
72 return (/true/i).test(value);
73}
74// for parsing html attributes, where we want empty strings and missing attributes to be undefined
75function attrToString(value) {
76 if (value == null || value === '') {
77 return;
78 }
79 return value;
80}
81/** @deprecated */
82function referenceCompare(left, right) {
83 if (left == null && right == null) {
84 return true;
85 }
86 if (left == null && right != null) {
87 return false;
88 }
89 if (left != null && right == null) {
90 return false;
91 }
92 return left === right;
93}
94function jsonEquals(val1, val2) {
95 var val1Json = val1 ? JSON.stringify(val1) : null;
96 var val2Json = val2 ? JSON.stringify(val2) : null;
97 return val1Json === val2Json;
98}
99function defaultComparator(valueA, valueB, accentedCompare) {
100 if (accentedCompare === void 0) { accentedCompare = false; }
101 var valueAMissing = valueA == null;
102 var valueBMissing = valueB == null;
103 // this is for aggregations sum and avg, where the result can be a number that is wrapped.
104 // if we didn't do this, then the toString() value would be used, which would result in
105 // the strings getting used instead of the numbers.
106 if (valueA && valueA.toNumber) {
107 valueA = valueA.toNumber();
108 }
109 if (valueB && valueB.toNumber) {
110 valueB = valueB.toNumber();
111 }
112 if (valueAMissing && valueBMissing) {
113 return 0;
114 }
115 if (valueAMissing) {
116 return -1;
117 }
118 if (valueBMissing) {
119 return 1;
120 }
121 function doQuickCompare(a, b) {
122 return (a > b ? 1 : (a < b ? -1 : 0));
123 }
124 if (typeof valueA !== 'string') {
125 return doQuickCompare(valueA, valueB);
126 }
127 if (!accentedCompare) {
128 return doQuickCompare(valueA, valueB);
129 }
130 try {
131 // using local compare also allows chinese comparisons
132 return valueA.localeCompare(valueB);
133 }
134 catch (e) {
135 // if something wrong with localeCompare, eg not supported
136 // by browser, then just continue with the quick one
137 return doQuickCompare(valueA, valueB);
138 }
139}
140function values(object) {
141 if (object instanceof Set || object instanceof Map) {
142 var arr_1 = [];
143 object.forEach(function (value) { return arr_1.push(value); });
144 return arr_1;
145 }
146 return Object.values(object);
147}
148
149var GenericUtils = /*#__PURE__*/Object.freeze({
150 makeNull: makeNull,
151 exists: exists,
152 missing: missing,
153 missingOrEmpty: missingOrEmpty,
154 toStringOrNull: toStringOrNull,
155 attrToNumber: attrToNumber,
156 attrToBoolean: attrToBoolean,
157 attrToString: attrToString,
158 referenceCompare: referenceCompare,
159 jsonEquals: jsonEquals,
160 defaultComparator: defaultComparator,
161 values: values
162});
163
164/**
165 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
166 * @version v27.3.0
167 * @link https://www.ag-grid.com/
168 * @license MIT
169 */
170var ColumnKeyCreator = /** @class */ (function () {
171 function ColumnKeyCreator() {
172 this.existingKeys = {};
173 }
174 ColumnKeyCreator.prototype.addExistingKeys = function (keys) {
175 for (var i = 0; i < keys.length; i++) {
176 this.existingKeys[keys[i]] = true;
177 }
178 };
179 ColumnKeyCreator.prototype.getUniqueKey = function (colId, colField) {
180 // in case user passed in number for colId, convert to string
181 colId = toStringOrNull(colId);
182 var count = 0;
183 while (true) {
184 var idToTry = void 0;
185 if (colId) {
186 idToTry = colId;
187 if (count !== 0) {
188 idToTry += '_' + count;
189 }
190 }
191 else if (colField) {
192 idToTry = colField;
193 if (count !== 0) {
194 idToTry += '_' + count;
195 }
196 }
197 else {
198 idToTry = '' + count;
199 }
200 if (!this.existingKeys[idToTry]) {
201 this.existingKeys[idToTry] = true;
202 return idToTry;
203 }
204 count++;
205 }
206 };
207 return ColumnKeyCreator;
208}());
209
210/**
211 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
212 * @version v27.3.0
213 * @link https://www.ag-grid.com/
214 * @license MIT
215 */
216function iterateObject(object, callback) {
217 if (object == null) {
218 return;
219 }
220 if (Array.isArray(object)) {
221 object.forEach(function (value, index) { return callback("" + index, value); });
222 }
223 else {
224 Object.keys(object).forEach(function (key) { return callback(key, object[key]); });
225 }
226}
227function cloneObject(object) {
228 var copy = {};
229 var keys = Object.keys(object);
230 for (var i = 0; i < keys.length; i++) {
231 var key = keys[i];
232 var value = object[key];
233 copy[key] = value;
234 }
235 return copy;
236}
237function deepCloneObject(object) {
238 return JSON.parse(JSON.stringify(object));
239}
240// returns copy of an object, doing a deep clone of any objects with that object.
241// this is used for eg creating copies of Column Definitions, where we want to
242// deep copy all objects, but do not want to deep copy functions (eg when user provides
243// a function or class for colDef.cellRenderer)
244function deepCloneDefinition(object, keysToSkip) {
245 if (!object) {
246 return;
247 }
248 var obj = object;
249 var res = {};
250 Object.keys(obj).forEach(function (key) {
251 if (keysToSkip && keysToSkip.indexOf(key) >= 0) {
252 return;
253 }
254 var value = obj[key];
255 // 'simple object' means a bunch of key/value pairs, eg {filter: 'myFilter'}. it does
256 // NOT include the following:
257 // 1) arrays
258 // 2) functions or classes (eg ColumnAPI instance)
259 var sourceIsSimpleObject = isNonNullObject(value) && value.constructor === Object;
260 if (sourceIsSimpleObject) {
261 res[key] = deepCloneDefinition(value);
262 }
263 else {
264 res[key] = value;
265 }
266 });
267 return res;
268}
269function getProperty(object, key) {
270 return object[key];
271}
272function setProperty(object, key, value) {
273 object[key] = value;
274}
275/**
276 * Will copy the specified properties from `source` into the equivalent properties on `target`, ignoring properties with
277 * a value of `undefined`.
278 */
279function copyPropertiesIfPresent(source, target) {
280 var properties = [];
281 for (var _i = 2; _i < arguments.length; _i++) {
282 properties[_i - 2] = arguments[_i];
283 }
284 properties.forEach(function (p) { return copyPropertyIfPresent(source, target, p); });
285}
286/**
287 * Will copy the specified property from `source` into the equivalent property on `target`, unless the property has a
288 * value of `undefined`. If a transformation is provided, it will be applied to the value before being set on `target`.
289 */
290function copyPropertyIfPresent(source, target, property, transform) {
291 var value = getProperty(source, property);
292 if (value !== undefined) {
293 setProperty(target, property, transform ? transform(value) : value);
294 }
295}
296function getAllKeysInObjects(objects) {
297 var allValues = {};
298 objects.filter(function (obj) { return obj != null; }).forEach(function (obj) {
299 Object.keys(obj).forEach(function (key) { return allValues[key] = null; });
300 });
301 return Object.keys(allValues);
302}
303function getAllValuesInObject(obj) {
304 if (!obj) {
305 return [];
306 }
307 var anyObject = Object;
308 if (typeof anyObject.values === 'function') {
309 return anyObject.values(obj);
310 }
311 var ret = [];
312 for (var key in obj) {
313 if (obj.hasOwnProperty(key) && obj.propertyIsEnumerable(key)) {
314 ret.push(obj[key]);
315 }
316 }
317 return ret;
318}
319function mergeDeep(dest, source, copyUndefined, makeCopyOfSimpleObjects) {
320 if (copyUndefined === void 0) { copyUndefined = true; }
321 if (makeCopyOfSimpleObjects === void 0) { makeCopyOfSimpleObjects = false; }
322 if (!exists(source)) {
323 return;
324 }
325 iterateObject(source, function (key, sourceValue) {
326 var destValue = dest[key];
327 if (destValue === sourceValue) {
328 return;
329 }
330 // when creating params, we don't want to just copy objects over. otherwise merging ColDefs (eg DefaultColDef
331 // and Column Types) would result in params getting shared between objects.
332 // by putting an empty value into destValue first, it means we end up copying over values from
333 // the source object, rather than just copying in the source object in it's entirety.
334 if (makeCopyOfSimpleObjects) {
335 var objectIsDueToBeCopied = destValue == null && sourceValue != null;
336 if (objectIsDueToBeCopied) {
337 // 'simple object' means a bunch of key/value pairs, eg {filter: 'myFilter'}, as opposed
338 // to a Class instance (such as ColumnAPI instance).
339 var sourceIsSimpleObject = typeof sourceValue === 'object' && sourceValue.constructor === Object;
340 var dontCopy = sourceIsSimpleObject;
341 if (dontCopy) {
342 destValue = {};
343 dest[key] = destValue;
344 }
345 }
346 }
347 if (isNonNullObject(sourceValue) && isNonNullObject(destValue) && !Array.isArray(destValue)) {
348 mergeDeep(destValue, sourceValue, copyUndefined, makeCopyOfSimpleObjects);
349 }
350 else if (copyUndefined || sourceValue !== undefined) {
351 dest[key] = sourceValue;
352 }
353 });
354}
355function missingOrEmptyObject(value) {
356 return missing(value) || Object.keys(value).length === 0;
357}
358function get(source, expression, defaultValue) {
359 if (source == null) {
360 return defaultValue;
361 }
362 var keys = expression.split('.');
363 var objectToRead = source;
364 while (keys.length > 1) {
365 objectToRead = objectToRead[keys.shift()];
366 if (objectToRead == null) {
367 return defaultValue;
368 }
369 }
370 var value = objectToRead[keys[0]];
371 return value != null ? value : defaultValue;
372}
373function set(target, expression, value) {
374 if (target == null) {
375 return;
376 }
377 var keys = expression.split('.');
378 var objectToUpdate = target;
379 while (keys.length > 1) {
380 objectToUpdate = objectToUpdate[keys.shift()];
381 if (objectToUpdate == null) {
382 return;
383 }
384 }
385 objectToUpdate[keys[0]] = value;
386}
387function deepFreeze(object) {
388 Object.freeze(object);
389 values(object).forEach(function (v) {
390 if (isNonNullObject(v) || typeof v === 'function') {
391 deepFreeze(v);
392 }
393 });
394 return object;
395}
396function getValueUsingField(data, field, fieldContainsDots) {
397 if (!field || !data) {
398 return;
399 }
400 // if no '.', then it's not a deep value
401 if (!fieldContainsDots) {
402 return data[field];
403 }
404 // otherwise it is a deep value, so need to dig for it
405 var fields = field.split('.');
406 var currentObject = data;
407 for (var i = 0; i < fields.length; i++) {
408 if (currentObject == null) {
409 return undefined;
410 }
411 currentObject = currentObject[fields[i]];
412 }
413 return currentObject;
414}
415// used by ColumnAPI and GridAPI to remove all references, so keeping grid in memory resulting in a
416// memory leak if user is not disposing of the GridAPI or ColumnApi references
417function removeAllReferences(obj, objectName) {
418 Object.keys(obj).forEach(function (key) {
419 var value = obj[key];
420 // we want to replace all the @autowired services, which are objects. any simple types (boolean, string etc)
421 // we don't care about
422 if (typeof value === 'object') {
423 obj[key] = undefined;
424 }
425 });
426 var proto = Object.getPrototypeOf(obj);
427 var properties = {};
428 Object.keys(proto).forEach(function (key) {
429 var value = proto[key];
430 // leave all basic types - this is needed for GridAPI to leave the "destroyed: boolean" attribute alone
431 if (typeof value === 'function') {
432 var func = function () {
433 console.warn("AG Grid: " + objectName + " function " + key + "() cannot be called as the grid has been destroyed.\n Please don't call grid API functions on destroyed grids - as a matter of fact you shouldn't\n be keeping the API reference, your application has a memory leak! Remove the API reference\n when the grid is destroyed.");
434 };
435 properties[key] = { value: func, writable: true };
436 }
437 });
438 Object.defineProperties(obj, properties);
439}
440function isNonNullObject(value) {
441 return typeof value === 'object' && value !== null;
442}
443
444var ObjectUtils = /*#__PURE__*/Object.freeze({
445 iterateObject: iterateObject,
446 cloneObject: cloneObject,
447 deepCloneObject: deepCloneObject,
448 deepCloneDefinition: deepCloneDefinition,
449 getProperty: getProperty,
450 setProperty: setProperty,
451 copyPropertiesIfPresent: copyPropertiesIfPresent,
452 copyPropertyIfPresent: copyPropertyIfPresent,
453 getAllKeysInObjects: getAllKeysInObjects,
454 getAllValuesInObject: getAllValuesInObject,
455 mergeDeep: mergeDeep,
456 missingOrEmptyObject: missingOrEmptyObject,
457 get: get,
458 set: set,
459 deepFreeze: deepFreeze,
460 getValueUsingField: getValueUsingField,
461 removeAllReferences: removeAllReferences,
462 isNonNullObject: isNonNullObject
463});
464
465/**
466 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
467 * @version v27.3.0
468 * @link https://www.ag-grid.com/
469 * @license MIT
470 */
471var FUNCTION_STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
472var FUNCTION_ARGUMENT_NAMES = /([^\s,]+)/g;
473var doOnceFlags = {};
474/**
475 * If the key was passed before, then doesn't execute the func
476 * @param {Function} func
477 * @param {string} key
478 */
479function doOnce(func, key) {
480 if (doOnceFlags[key]) {
481 return;
482 }
483 func();
484 doOnceFlags[key] = true;
485}
486function getFunctionName(funcConstructor) {
487 // for every other browser in the world
488 if (funcConstructor.name) {
489 return funcConstructor.name;
490 }
491 // for the pestilence that is ie11
492 var matches = /function\s+([^\(]+)/.exec(funcConstructor.toString());
493 return matches && matches.length === 2 ? matches[1].trim() : null;
494}
495/** @deprecated */
496function getFunctionParameters(func) {
497 var fnStr = func.toString().replace(FUNCTION_STRIP_COMMENTS, '');
498 return fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(FUNCTION_ARGUMENT_NAMES) || [];
499}
500function isFunction(val) {
501 return !!(val && val.constructor && val.call && val.apply);
502}
503function executeInAWhile(funcs) {
504 executeAfter(funcs, 400);
505}
506var executeNextVMTurnFuncs = [];
507var executeNextVMTurnPending = false;
508function executeNextVMTurn(func) {
509 executeNextVMTurnFuncs.push(func);
510 if (executeNextVMTurnPending) {
511 return;
512 }
513 executeNextVMTurnPending = true;
514 window.setTimeout(function () {
515 var funcsCopy = executeNextVMTurnFuncs.slice();
516 executeNextVMTurnFuncs.length = 0;
517 executeNextVMTurnPending = false;
518 funcsCopy.forEach(function (func) { return func(); });
519 }, 0);
520}
521function executeAfter(funcs, milliseconds) {
522 if (milliseconds === void 0) { milliseconds = 0; }
523 if (funcs.length > 0) {
524 window.setTimeout(function () { return funcs.forEach(function (func) { return func(); }); }, milliseconds);
525 }
526}
527/**
528 * from https://stackoverflow.com/questions/24004791/can-someone-explain-the-debounce-function-in-javascript
529 * @param {Function} func The function to be debounced
530 * @param {number} wait The time in ms to debounce
531 * @param {boolean} immediate If it should run immediately or wait for the initial debounce delay
532 * @return {Function} The debounced function
533 */
534function debounce(func, wait, immediate) {
535 if (immediate === void 0) { immediate = false; }
536 // 'private' variable for instance
537 // The returned function will be able to reference this due to closure.
538 // Each call to the returned function will share this common timer.
539 var timeout;
540 // Calling debounce returns a new anonymous function
541 return function () {
542 var args = [];
543 for (var _i = 0; _i < arguments.length; _i++) {
544 args[_i] = arguments[_i];
545 }
546 // reference the context and args for the setTimeout function
547 var context = this;
548 // Should the function be called now? If immediate is true
549 // and not already in a timeout then the answer is: Yes
550 var callNow = immediate && !timeout;
551 // This is the basic debounce behaviour where you can call this
552 // function several times, but it will only execute once
553 // [before or after imposing a delay].
554 // Each time the returned function is called, the timer starts over.
555 window.clearTimeout(timeout);
556 // Set the new timeout
557 timeout = window.setTimeout(function () {
558 // Inside the timeout function, clear the timeout variable
559 // which will let the next execution run when in 'immediate' mode
560 timeout = null;
561 // Check if the function already ran with the immediate flag
562 if (!immediate) {
563 // Call the original function with apply
564 // apply lets you define the 'this' object as well as the arguments
565 // (both captured before setTimeout)
566 func.apply(context, args);
567 }
568 }, wait);
569 // Immediate mode and no wait timer? Execute the function..
570 if (callNow) {
571 func.apply(context, args);
572 }
573 };
574}
575/**
576 * @param {Function} func The function to be throttled
577 * @param {number} wait The time in ms to throttle
578 * @return {Function} The throttled function
579 */
580function throttle(func, wait) {
581 var previousCall = 0;
582 return function () {
583 var args = [];
584 for (var _i = 0; _i < arguments.length; _i++) {
585 args[_i] = arguments[_i];
586 }
587 var context = this;
588 var currentCall = new Date().getTime();
589 if (currentCall - previousCall < wait) {
590 return;
591 }
592 previousCall = currentCall;
593 func.apply(context, args);
594 };
595}
596function waitUntil(condition, callback, timeout, timeoutMessage) {
597 if (timeout === void 0) { timeout = 100; }
598 var timeStamp = new Date().getTime();
599 var interval = null;
600 var executed = false;
601 var internalCallback = function () {
602 var reachedTimeout = ((new Date().getTime()) - timeStamp) > timeout;
603 if (condition() || reachedTimeout) {
604 callback();
605 executed = true;
606 if (interval != null) {
607 window.clearInterval(interval);
608 interval = null;
609 }
610 if (reachedTimeout && timeoutMessage) {
611 console.warn(timeoutMessage);
612 }
613 }
614 };
615 internalCallback();
616 if (!executed) {
617 interval = window.setInterval(internalCallback, 10);
618 }
619}
620function compose() {
621 var fns = [];
622 for (var _i = 0; _i < arguments.length; _i++) {
623 fns[_i] = arguments[_i];
624 }
625 return function (arg) { return fns.reduce(function (composed, f) { return f(composed); }, arg); };
626}
627function callIfPresent(func) {
628 if (func) {
629 func();
630 }
631}
632
633var FunctionUtils = /*#__PURE__*/Object.freeze({
634 doOnce: doOnce,
635 getFunctionName: getFunctionName,
636 getFunctionParameters: getFunctionParameters,
637 isFunction: isFunction,
638 executeInAWhile: executeInAWhile,
639 executeNextVMTurn: executeNextVMTurn,
640 executeAfter: executeAfter,
641 debounce: debounce,
642 throttle: throttle,
643 waitUntil: waitUntil,
644 compose: compose,
645 callIfPresent: callIfPresent
646});
647
648/**
649 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
650 * @version v27.3.0
651 * @link https://www.ag-grid.com/
652 * @license MIT
653 */
654var Context = /** @class */ (function () {
655 function Context(params, logger) {
656 this.beanWrappers = {};
657 this.destroyed = false;
658 if (!params || !params.beanClasses) {
659 return;
660 }
661 this.contextParams = params;
662 this.logger = logger;
663 this.logger.log(">> creating ag-Application Context");
664 this.createBeans();
665 var beanInstances = this.getBeanInstances();
666 this.wireBeans(beanInstances);
667 this.logger.log(">> ag-Application Context ready - component is alive");
668 }
669 Context.prototype.getBeanInstances = function () {
670 return values(this.beanWrappers).map(function (beanEntry) { return beanEntry.beanInstance; });
671 };
672 Context.prototype.createBean = function (bean, afterPreCreateCallback) {
673 if (!bean) {
674 throw Error("Can't wire to bean since it is null");
675 }
676 this.wireBeans([bean], afterPreCreateCallback);
677 return bean;
678 };
679 Context.prototype.wireBeans = function (beanInstances, afterPreCreateCallback) {
680 this.autoWireBeans(beanInstances);
681 this.methodWireBeans(beanInstances);
682 this.callLifeCycleMethods(beanInstances, 'preConstructMethods');
683 // the callback sets the attributes, so the component has access to attributes
684 // before postConstruct methods in the component are executed
685 if (exists(afterPreCreateCallback)) {
686 beanInstances.forEach(afterPreCreateCallback);
687 }
688 this.callLifeCycleMethods(beanInstances, 'postConstructMethods');
689 };
690 Context.prototype.createBeans = function () {
691 var _this = this;
692 // register all normal beans
693 this.contextParams.beanClasses.forEach(this.createBeanWrapper.bind(this));
694 // register override beans, these will overwrite beans above of same name
695 // instantiate all beans - overridden beans will be left out
696 iterateObject(this.beanWrappers, function (key, beanEntry) {
697 var constructorParamsMeta;
698 if (beanEntry.bean.__agBeanMetaData && beanEntry.bean.__agBeanMetaData.autowireMethods && beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor) {
699 constructorParamsMeta = beanEntry.bean.__agBeanMetaData.autowireMethods.agConstructor;
700 }
701 var constructorParams = _this.getBeansForParameters(constructorParamsMeta, beanEntry.bean.name);
702 var newInstance = applyToConstructor(beanEntry.bean, constructorParams);
703 beanEntry.beanInstance = newInstance;
704 });
705 var createdBeanNames = Object.keys(this.beanWrappers).join(', ');
706 this.logger.log("created beans: " + createdBeanNames);
707 };
708 // tslint:disable-next-line
709 Context.prototype.createBeanWrapper = function (BeanClass) {
710 var metaData = BeanClass.__agBeanMetaData;
711 if (!metaData) {
712 var beanName = void 0;
713 if (BeanClass.prototype.constructor) {
714 beanName = getFunctionName(BeanClass.prototype.constructor);
715 }
716 else {
717 beanName = "" + BeanClass;
718 }
719 console.error("Context item " + beanName + " is not a bean");
720 return;
721 }
722 var beanEntry = {
723 bean: BeanClass,
724 beanInstance: null,
725 beanName: metaData.beanName
726 };
727 this.beanWrappers[metaData.beanName] = beanEntry;
728 };
729 Context.prototype.autoWireBeans = function (beanInstances) {
730 var _this = this;
731 beanInstances.forEach(function (beanInstance) {
732 _this.forEachMetaDataInHierarchy(beanInstance, function (metaData, beanName) {
733 var attributes = metaData.agClassAttributes;
734 if (!attributes) {
735 return;
736 }
737 attributes.forEach(function (attribute) {
738 var otherBean = _this.lookupBeanInstance(beanName, attribute.beanName, attribute.optional);
739 beanInstance[attribute.attributeName] = otherBean;
740 });
741 });
742 });
743 };
744 Context.prototype.methodWireBeans = function (beanInstances) {
745 var _this = this;
746 beanInstances.forEach(function (beanInstance) {
747 _this.forEachMetaDataInHierarchy(beanInstance, function (metaData, beanName) {
748 iterateObject(metaData.autowireMethods, function (methodName, wireParams) {
749 // skip constructor, as this is dealt with elsewhere
750 if (methodName === "agConstructor") {
751 return;
752 }
753 var initParams = _this.getBeansForParameters(wireParams, beanName);
754 beanInstance[methodName].apply(beanInstance, initParams);
755 });
756 });
757 });
758 };
759 Context.prototype.forEachMetaDataInHierarchy = function (beanInstance, callback) {
760 var prototype = Object.getPrototypeOf(beanInstance);
761 while (prototype != null) {
762 var constructor = prototype.constructor;
763 if (constructor.hasOwnProperty('__agBeanMetaData')) {
764 var metaData = constructor.__agBeanMetaData;
765 var beanName = this.getBeanName(constructor);
766 callback(metaData, beanName);
767 }
768 prototype = Object.getPrototypeOf(prototype);
769 }
770 };
771 Context.prototype.getBeanName = function (constructor) {
772 if (constructor.__agBeanMetaData && constructor.__agBeanMetaData.beanName) {
773 return constructor.__agBeanMetaData.beanName;
774 }
775 var constructorString = constructor.toString();
776 var beanName = constructorString.substring(9, constructorString.indexOf("("));
777 return beanName;
778 };
779 Context.prototype.getBeansForParameters = function (parameters, beanName) {
780 var _this = this;
781 var beansList = [];
782 if (parameters) {
783 iterateObject(parameters, function (paramIndex, otherBeanName) {
784 var otherBean = _this.lookupBeanInstance(beanName, otherBeanName);
785 beansList[Number(paramIndex)] = otherBean;
786 });
787 }
788 return beansList;
789 };
790 Context.prototype.lookupBeanInstance = function (wiringBean, beanName, optional) {
791 if (optional === void 0) { optional = false; }
792 if (beanName === "context") {
793 return this;
794 }
795 if (this.contextParams.providedBeanInstances && this.contextParams.providedBeanInstances.hasOwnProperty(beanName)) {
796 return this.contextParams.providedBeanInstances[beanName];
797 }
798 var beanEntry = this.beanWrappers[beanName];
799 if (beanEntry) {
800 return beanEntry.beanInstance;
801 }
802 if (!optional) {
803 console.error("AG Grid: unable to find bean reference " + beanName + " while initialising " + wiringBean);
804 }
805 return null;
806 };
807 Context.prototype.callLifeCycleMethods = function (beanInstances, lifeCycleMethod) {
808 var _this = this;
809 beanInstances.forEach(function (beanInstance) { return _this.callLifeCycleMethodsOnBean(beanInstance, lifeCycleMethod); });
810 };
811 Context.prototype.callLifeCycleMethodsOnBean = function (beanInstance, lifeCycleMethod, methodToIgnore) {
812 // putting all methods into a map removes duplicates
813 var allMethods = {};
814 // dump methods from each level of the metadata hierarchy
815 this.forEachMetaDataInHierarchy(beanInstance, function (metaData) {
816 var methods = metaData[lifeCycleMethod];
817 if (methods) {
818 methods.forEach(function (methodName) {
819 if (methodName != methodToIgnore) {
820 allMethods[methodName] = true;
821 }
822 });
823 }
824 });
825 var allMethodsList = Object.keys(allMethods);
826 allMethodsList.forEach(function (methodName) { return beanInstance[methodName](); });
827 };
828 Context.prototype.getBean = function (name) {
829 return this.lookupBeanInstance("getBean", name, true);
830 };
831 Context.prototype.destroy = function () {
832 if (this.destroyed) {
833 return;
834 }
835 this.logger.log(">> Shutting down ag-Application Context");
836 var beanInstances = this.getBeanInstances();
837 this.destroyBeans(beanInstances);
838 this.contextParams.providedBeanInstances = null;
839 this.destroyed = true;
840 this.logger.log(">> ag-Application Context shut down - component is dead");
841 };
842 Context.prototype.destroyBean = function (bean) {
843 if (!bean) {
844 return;
845 }
846 this.destroyBeans([bean]);
847 };
848 Context.prototype.destroyBeans = function (beans) {
849 var _this = this;
850 if (!beans) {
851 return [];
852 }
853 beans.forEach(function (bean) {
854 _this.callLifeCycleMethodsOnBean(bean, 'preDestroyMethods', 'destroy');
855 // call destroy() explicitly if it exists
856 var beanAny = bean;
857 if (typeof beanAny.destroy === 'function') {
858 beanAny.destroy();
859 }
860 });
861 return [];
862 };
863 return Context;
864}());
865// taken from: http://stackoverflow.com/questions/3362471/how-can-i-call-a-javascript-constructor-using-call-or-apply
866// allows calling 'apply' on a constructor
867function applyToConstructor(constructor, argArray) {
868 var args = [null].concat(argArray);
869 var factoryFunction = constructor.bind.apply(constructor, args);
870 return new factoryFunction();
871}
872function PreConstruct(target, methodName, descriptor) {
873 var props = getOrCreateProps(target.constructor);
874 if (!props.preConstructMethods) {
875 props.preConstructMethods = [];
876 }
877 props.preConstructMethods.push(methodName);
878}
879function PostConstruct(target, methodName, descriptor) {
880 var props = getOrCreateProps(target.constructor);
881 if (!props.postConstructMethods) {
882 props.postConstructMethods = [];
883 }
884 props.postConstructMethods.push(methodName);
885}
886function PreDestroy(target, methodName, descriptor) {
887 var props = getOrCreateProps(target.constructor);
888 if (!props.preDestroyMethods) {
889 props.preDestroyMethods = [];
890 }
891 props.preDestroyMethods.push(methodName);
892}
893function Bean(beanName) {
894 return function (classConstructor) {
895 var props = getOrCreateProps(classConstructor);
896 props.beanName = beanName;
897 };
898}
899function Autowired(name) {
900 return function (target, propertyKey, descriptor) {
901 autowiredFunc(target, name, false, target, propertyKey, null);
902 };
903}
904function Optional(name) {
905 return function (target, propertyKey, descriptor) {
906 autowiredFunc(target, name, true, target, propertyKey, null);
907 };
908}
909function autowiredFunc(target, name, optional, classPrototype, methodOrAttributeName, index) {
910 if (name === null) {
911 console.error("AG Grid: Autowired name should not be null");
912 return;
913 }
914 if (typeof index === "number") {
915 console.error("AG Grid: Autowired should be on an attribute");
916 return;
917 }
918 // it's an attribute on the class
919 var props = getOrCreateProps(target.constructor);
920 if (!props.agClassAttributes) {
921 props.agClassAttributes = [];
922 }
923 props.agClassAttributes.push({
924 attributeName: methodOrAttributeName,
925 beanName: name,
926 optional: optional
927 });
928}
929function Qualifier(name) {
930 return function (classPrototype, methodOrAttributeName, index) {
931 var constructor = typeof classPrototype == "function" ? classPrototype : classPrototype.constructor;
932 var props;
933 if (typeof index === "number") {
934 // it's a parameter on a method
935 var methodName = void 0;
936 if (methodOrAttributeName) {
937 props = getOrCreateProps(constructor);
938 methodName = methodOrAttributeName;
939 }
940 else {
941 props = getOrCreateProps(constructor);
942 methodName = "agConstructor";
943 }
944 if (!props.autowireMethods) {
945 props.autowireMethods = {};
946 }
947 if (!props.autowireMethods[methodName]) {
948 props.autowireMethods[methodName] = {};
949 }
950 props.autowireMethods[methodName][index] = name;
951 }
952 };
953}
954function getOrCreateProps(target) {
955 if (!target.hasOwnProperty("__agBeanMetaData")) {
956 target.__agBeanMetaData = {};
957 }
958 return target.__agBeanMetaData;
959}
960
961/**
962 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
963 * @version v27.3.0
964 * @link https://www.ag-grid.com/
965 * @license MIT
966 */
967var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
968 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
969 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
970 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;
971 return c > 3 && r && Object.defineProperty(target, key, r), r;
972};
973var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
974 return function (target, key) { decorator(target, key, paramIndex); }
975};
976var EventService = /** @class */ (function () {
977 function EventService() {
978 this.allSyncListeners = new Map();
979 this.allAsyncListeners = new Map();
980 this.globalSyncListeners = new Set();
981 this.globalAsyncListeners = new Set();
982 this.asyncFunctionsQueue = [];
983 this.scheduled = false;
984 // using an object performs better than a Set for the number of different events we have
985 this.firedEvents = {};
986 }
987 // because this class is used both inside the context and outside the context, we do not
988 // use autowired attributes, as that would be confusing, as sometimes the attributes
989 // would be wired, and sometimes not.
990 //
991 // the global event servers used by AG Grid is autowired by the context once, and this
992 // setBeans method gets called once.
993 //
994 // the times when this class is used outside of the context (eg RowNode has an instance of this
995 // class) then it is not a bean, and this setBeans method is not called.
996 EventService.prototype.setBeans = function (loggerFactory, gridOptionsWrapper, frameworkOverrides, globalEventListener) {
997 if (globalEventListener === void 0) { globalEventListener = null; }
998 this.frameworkOverrides = frameworkOverrides;
999 if (globalEventListener) {
1000 var async = gridOptionsWrapper.useAsyncEvents();
1001 this.addGlobalListener(globalEventListener, async);
1002 }
1003 };
1004 EventService.prototype.getListeners = function (eventType, async, autoCreateListenerCollection) {
1005 var listenerMap = async ? this.allAsyncListeners : this.allSyncListeners;
1006 var listeners = listenerMap.get(eventType);
1007 // Note: 'autoCreateListenerCollection' should only be 'true' if a listener is about to be added. For instance
1008 // getListeners() is also called during event dispatch even though no listeners are added. This measure protects
1009 // against 'memory bloat' as empty collections will prevent the RowNode's event service from being removed after
1010 // the RowComp is destroyed, see noRegisteredListenersExist() below.
1011 if (!listeners && autoCreateListenerCollection) {
1012 listeners = new Set();
1013 listenerMap.set(eventType, listeners);
1014 }
1015 return listeners;
1016 };
1017 EventService.prototype.noRegisteredListenersExist = function () {
1018 return this.allSyncListeners.size === 0 && this.allAsyncListeners.size === 0 &&
1019 this.globalSyncListeners.size === 0 && this.globalAsyncListeners.size === 0;
1020 };
1021 EventService.prototype.addEventListener = function (eventType, listener, async) {
1022 if (async === void 0) { async = false; }
1023 this.getListeners(eventType, async, true).add(listener);
1024 };
1025 EventService.prototype.removeEventListener = function (eventType, listener, async) {
1026 if (async === void 0) { async = false; }
1027 var listeners = this.getListeners(eventType, async, false);
1028 if (!listeners) {
1029 return;
1030 }
1031 listeners.delete(listener);
1032 if (listeners.size === 0) {
1033 var listenerMap = async ? this.allAsyncListeners : this.allSyncListeners;
1034 listenerMap.delete(eventType);
1035 }
1036 };
1037 EventService.prototype.addGlobalListener = function (listener, async) {
1038 if (async === void 0) { async = false; }
1039 (async ? this.globalAsyncListeners : this.globalSyncListeners).add(listener);
1040 };
1041 EventService.prototype.removeGlobalListener = function (listener, async) {
1042 if (async === void 0) { async = false; }
1043 (async ? this.globalAsyncListeners : this.globalSyncListeners).delete(listener);
1044 };
1045 EventService.prototype.dispatchEvent = function (event) {
1046 this.dispatchToListeners(event, true);
1047 this.dispatchToListeners(event, false);
1048 this.firedEvents[event.type] = true;
1049 };
1050 EventService.prototype.dispatchEventOnce = function (event) {
1051 if (!this.firedEvents[event.type]) {
1052 this.dispatchEvent(event);
1053 }
1054 };
1055 EventService.prototype.dispatchToListeners = function (event, async) {
1056 var _this = this;
1057 var eventType = event.type;
1058 var processEventListeners = function (listeners) { return listeners.forEach(function (listener) {
1059 if (async) {
1060 _this.dispatchAsync(function () { return listener(event); });
1061 }
1062 else {
1063 listener(event);
1064 }
1065 }); };
1066 var listeners = this.getListeners(eventType, async, false);
1067 if (listeners) {
1068 processEventListeners(listeners);
1069 }
1070 var globalListeners = async ? this.globalAsyncListeners : this.globalSyncListeners;
1071 globalListeners.forEach(function (listener) {
1072 if (async) {
1073 _this.dispatchAsync(function () { return _this.frameworkOverrides.dispatchEvent(eventType, function () { return listener(eventType, event); }, true); });
1074 }
1075 else {
1076 _this.frameworkOverrides.dispatchEvent(eventType, function () { return listener(eventType, event); }, true);
1077 }
1078 });
1079 };
1080 // this gets called inside the grid's thread, for each event that it
1081 // wants to set async. the grid then batches the events into one setTimeout()
1082 // because setTimeout() is an expensive operation. ideally we would have
1083 // each event in it's own setTimeout(), but we batch for performance.
1084 EventService.prototype.dispatchAsync = function (func) {
1085 // add to the queue for executing later in the next VM turn
1086 this.asyncFunctionsQueue.push(func);
1087 // check if timeout is already scheduled. the first time the grid calls
1088 // this within it's thread turn, this should be false, so it will schedule
1089 // the 'flush queue' method the first time it comes here. then the flag is
1090 // set to 'true' so it will know it's already scheduled for subsequent calls.
1091 if (!this.scheduled) {
1092 // if not scheduled, schedule one
1093 window.setTimeout(this.flushAsyncQueue.bind(this), 0);
1094 // mark that it is scheduled
1095 this.scheduled = true;
1096 }
1097 };
1098 // this happens in the next VM turn only, and empties the queue of events
1099 EventService.prototype.flushAsyncQueue = function () {
1100 this.scheduled = false;
1101 // we take a copy, because the event listener could be using
1102 // the grid, which would cause more events, which would be potentially
1103 // added to the queue, so safe to take a copy, the new events will
1104 // get executed in a later VM turn rather than risk updating the
1105 // queue as we are flushing it.
1106 var queueCopy = this.asyncFunctionsQueue.slice();
1107 this.asyncFunctionsQueue = [];
1108 // execute the queue
1109 queueCopy.forEach(function (func) { return func(); });
1110 };
1111 __decorate([
1112 __param(0, Qualifier('loggerFactory')),
1113 __param(1, Qualifier('gridOptionsWrapper')),
1114 __param(2, Qualifier('frameworkOverrides')),
1115 __param(3, Qualifier('globalEventListener'))
1116 ], EventService.prototype, "setBeans", null);
1117 EventService = __decorate([
1118 Bean('eventService')
1119 ], EventService);
1120 return EventService;
1121}());
1122
1123/**
1124 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
1125 * @version v27.3.0
1126 * @link https://www.ag-grid.com/
1127 * @license MIT
1128 */
1129var Constants = /** @class */ (function () {
1130 function Constants() {
1131 }
1132 Constants.ROW_BUFFER_SIZE = 10;
1133 Constants.LAYOUT_INTERVAL = 500;
1134 Constants.BATCH_WAIT_MILLIS = 50;
1135 Constants.EXPORT_TYPE_DRAG_COPY = 'dragCopy';
1136 Constants.EXPORT_TYPE_CLIPBOARD = 'clipboard';
1137 Constants.EXPORT_TYPE_EXCEL = 'excel';
1138 Constants.EXPORT_TYPE_CSV = 'csv';
1139 Constants.ROW_MODEL_TYPE_INFINITE = 'infinite';
1140 Constants.ROW_MODEL_TYPE_VIEWPORT = 'viewport';
1141 Constants.ROW_MODEL_TYPE_CLIENT_SIDE = 'clientSide';
1142 Constants.ROW_MODEL_TYPE_SERVER_SIDE = 'serverSide';
1143 Constants.ALWAYS = 'always';
1144 Constants.ONLY_WHEN_GROUPING = 'onlyWhenGrouping';
1145 Constants.PINNED_TOP = 'top';
1146 Constants.PINNED_BOTTOM = 'bottom';
1147 Constants.DOM_LAYOUT_NORMAL = 'normal';
1148 Constants.DOM_LAYOUT_PRINT = 'print';
1149 Constants.DOM_LAYOUT_AUTO_HEIGHT = 'autoHeight';
1150 Constants.GROUP_AUTO_COLUMN_ID = 'ag-Grid-AutoColumn';
1151 Constants.SOURCE_PASTE = 'paste';
1152 Constants.PINNED_RIGHT = 'right';
1153 Constants.PINNED_LEFT = 'left';
1154 Constants.SORT_ASC = 'asc';
1155 Constants.SORT_DESC = 'desc';
1156 Constants.INPUT_SELECTOR = 'input, select, button, textarea';
1157 Constants.FOCUSABLE_SELECTOR = '[tabindex], input, select, button, textarea';
1158 Constants.FOCUSABLE_EXCLUDE = '.ag-hidden, .ag-hidden *, [disabled], .ag-disabled, .ag-disabled *';
1159 return Constants;
1160}());
1161
1162/**
1163 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
1164 * @version v27.3.0
1165 * @link https://www.ag-grid.com/
1166 * @license MIT
1167 */
1168(function (ModuleNames) {
1169 // when using modules, user references this
1170 ModuleNames["CommunityCoreModule"] = "@ag-grid-community/core";
1171 // when not using modules, user references this
1172 ModuleNames["CommunityAllModules"] = "@ag-grid-community/all";
1173 // community modules
1174 ModuleNames["InfiniteRowModelModule"] = "@ag-grid-community/infinite-row-model";
1175 ModuleNames["ClientSideRowModelModule"] = "@ag-grid-community/client-side-row-model";
1176 ModuleNames["CsvExportModule"] = "@ag-grid-community/csv-export";
1177 // enterprise core - users never import on this, but other enterprise modules do
1178 ModuleNames["EnterpriseCoreModule"] = "@ag-grid-enterprise/core";
1179 // when not using modules, user references this
1180 ModuleNames["EnterpriseAllModules"] = "@ag-grid-enterprise/all";
1181 // enterprise modules
1182 ModuleNames["RowGroupingModule"] = "@ag-grid-enterprise/row-grouping";
1183 ModuleNames["ColumnToolPanelModule"] = "@ag-grid-enterprise/column-tool-panel";
1184 ModuleNames["FiltersToolPanelModule"] = "@ag-grid-enterprise/filter-tool-panel";
1185 ModuleNames["MenuModule"] = "@ag-grid-enterprise/menu";
1186 ModuleNames["SetFilterModule"] = "@ag-grid-enterprise/set-filter";
1187 ModuleNames["MultiFilterModule"] = "@ag-grid-enterprise/multi-filter";
1188 ModuleNames["StatusBarModule"] = "@ag-grid-enterprise/status-bar";
1189 ModuleNames["SideBarModule"] = "@ag-grid-enterprise/side-bar";
1190 ModuleNames["RangeSelectionModule"] = "@ag-grid-enterprise/range-selection";
1191 ModuleNames["MasterDetailModule"] = "@ag-grid-enterprise/master-detail";
1192 ModuleNames["RichSelectModule"] = "@ag-grid-enterprise/rich-select";
1193 ModuleNames["GridChartsModule"] = "@ag-grid-enterprise/charts";
1194 ModuleNames["ViewportRowModelModule"] = "@ag-grid-enterprise/viewport-row-model";
1195 ModuleNames["ServerSideRowModelModule"] = "@ag-grid-enterprise/server-side-row-model";
1196 ModuleNames["ExcelExportModule"] = "@ag-grid-enterprise/excel-export";
1197 ModuleNames["ClipboardModule"] = "@ag-grid-enterprise/clipboard";
1198 ModuleNames["SparklinesModule"] = "@ag-grid-enterprise/sparklines";
1199 // framework wrappers currently don't provide beans, comps etc, so no need to be modules,
1200 // however i argue they should be as in theory they 'could' provide beans etc
1201 ModuleNames["AngularModule"] = "@ag-grid-community/angular";
1202 ModuleNames["ReactModule"] = "@ag-grid-community/react";
1203 ModuleNames["VueModule"] = "@ag-grid-community/vue";
1204 ModuleNames["PolymerModule"] = "@ag-grid-community/polymer";
1205 // and then this, which is definitely not a grid module, as it should not have any dependency
1206 // on the grid (ie shouldn't even reference the Module interface)
1207 // ChartsModule = "@ag-grid-community/charts-core",
1208})(exports.ModuleNames || (exports.ModuleNames = {}));
1209
1210/**
1211 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
1212 * @version v27.3.0
1213 * @link https://www.ag-grid.com/
1214 * @license MIT
1215 */
1216var ModuleRegistry = /** @class */ (function () {
1217 function ModuleRegistry() {
1218 }
1219 ModuleRegistry.register = function (module, moduleBased) {
1220 if (moduleBased === void 0) { moduleBased = true; }
1221 ModuleRegistry.modulesMap[module.moduleName] = module;
1222 if (ModuleRegistry.moduleBased === undefined) {
1223 ModuleRegistry.moduleBased = moduleBased;
1224 }
1225 else {
1226 if (ModuleRegistry.moduleBased !== moduleBased) {
1227 doOnce(function () {
1228 console.warn("AG Grid: You are mixing modules (i.e. @ag-grid-community/core) and packages (ag-grid-community) - you can only use one or the other of these mechanisms.");
1229 console.warn('Please see https://www.ag-grid.com/javascript-grid/packages-modules/ for more information.');
1230 }, 'ModulePackageCheck');
1231 }
1232 }
1233 };
1234 // noinspection JSUnusedGlobalSymbols
1235 ModuleRegistry.registerModules = function (modules, moduleBased) {
1236 if (moduleBased === void 0) { moduleBased = true; }
1237 if (!modules) {
1238 return;
1239 }
1240 modules.forEach(function (module) { return ModuleRegistry.register(module, moduleBased); });
1241 };
1242 ModuleRegistry.assertRegistered = function (moduleName, reason) {
1243 if (this.isRegistered(moduleName)) {
1244 return true;
1245 }
1246 var warningKey = reason + moduleName;
1247 var warningMessage;
1248 if (ModuleRegistry.moduleBased) {
1249 warningMessage = "AG Grid: unable to use " + reason + " as module " + moduleName + " is not present. Please see: https://www.ag-grid.com/javascript-grid/modules/";
1250 }
1251 else {
1252 warningMessage = "AG Grid: unable to use " + reason + " as package 'ag-grid-enterprise' is not present. Please see: https://www.ag-grid.com/javascript-grid/packages/";
1253 }
1254 doOnce(function () {
1255 console.warn(warningMessage);
1256 }, warningKey);
1257 return false;
1258 };
1259 ModuleRegistry.isRegistered = function (moduleName) {
1260 return !!ModuleRegistry.modulesMap[moduleName];
1261 };
1262 ModuleRegistry.getRegisteredModules = function () {
1263 return values(ModuleRegistry.modulesMap);
1264 };
1265 ModuleRegistry.isPackageBased = function () {
1266 return !ModuleRegistry.moduleBased;
1267 };
1268 // having in a map a) removes duplicates and b) allows fast lookup
1269 ModuleRegistry.modulesMap = {};
1270 return ModuleRegistry;
1271}());
1272
1273/**
1274 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
1275 * @version v27.3.0
1276 * @link https://www.ag-grid.com/
1277 * @license MIT
1278 */
1279var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1280 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1281 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1282 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;
1283 return c > 3 && r && Object.defineProperty(target, key, r), r;
1284};
1285var instanceIdSequence = 0;
1286// Wrapper around a user provide column definition. The grid treats the column definition as ready only.
1287// This class contains all the runtime information about a column, plus some logic (the definition has no logic).
1288// This class implements both interfaces ColumnGroupChild and ProvidedColumnGroupChild as the class can
1289// appear as a child of either the original tree or the displayed tree. However the relevant group classes
1290// for each type only implements one, as each group can only appear in it's associated tree (eg ProvidedColumnGroup
1291// can only appear in OriginalColumn tree).
1292var Column = /** @class */ (function () {
1293 function Column(colDef, userProvidedColDef, colId, primary) {
1294 // used by React (and possibly other frameworks) as key for rendering
1295 this.instanceId = instanceIdSequence++;
1296 this.moving = false;
1297 this.menuVisible = false;
1298 this.filterActive = false;
1299 this.eventService = new EventService();
1300 this.rowGroupActive = false;
1301 this.pivotActive = false;
1302 this.aggregationActive = false;
1303 this.colDef = colDef;
1304 this.userProvidedColDef = userProvidedColDef;
1305 this.colId = colId;
1306 this.primary = primary;
1307 this.setState(colDef);
1308 }
1309 Column.prototype.getInstanceId = function () {
1310 return this.instanceId;
1311 };
1312 Column.prototype.setState = function (colDef) {
1313 // sort
1314 if (colDef.sort !== undefined) {
1315 if (colDef.sort === Constants.SORT_ASC || colDef.sort === Constants.SORT_DESC) {
1316 this.sort = colDef.sort;
1317 }
1318 }
1319 else {
1320 if (colDef.initialSort === Constants.SORT_ASC || colDef.initialSort === Constants.SORT_DESC) {
1321 this.sort = colDef.initialSort;
1322 }
1323 }
1324 // sortIndex
1325 var sortIndex = attrToNumber(colDef.sortIndex);
1326 var initialSortIndex = attrToNumber(colDef.initialSortIndex);
1327 if (sortIndex !== undefined) {
1328 if (sortIndex !== null) {
1329 this.sortIndex = sortIndex;
1330 }
1331 }
1332 else {
1333 if (initialSortIndex !== null) {
1334 this.sortIndex = initialSortIndex;
1335 }
1336 }
1337 // hide
1338 var hide = attrToBoolean(colDef.hide);
1339 var initialHide = attrToBoolean(colDef.initialHide);
1340 if (hide !== undefined) {
1341 this.visible = !hide;
1342 }
1343 else {
1344 this.visible = !initialHide;
1345 }
1346 // pinned
1347 if (colDef.pinned !== undefined) {
1348 this.setPinned(colDef.pinned);
1349 }
1350 else {
1351 this.setPinned(colDef.initialPinned);
1352 }
1353 // flex
1354 var flex = attrToNumber(colDef.flex);
1355 var initialFlex = attrToNumber(colDef.initialFlex);
1356 if (flex !== undefined) {
1357 this.flex = flex;
1358 }
1359 else if (initialFlex !== undefined) {
1360 this.flex = initialFlex;
1361 }
1362 };
1363 // gets called when user provides an alternative colDef, eg
1364 Column.prototype.setColDef = function (colDef, userProvidedColDef) {
1365 this.colDef = colDef;
1366 this.userProvidedColDef = userProvidedColDef;
1367 this.initMinAndMaxWidths();
1368 this.initDotNotation();
1369 };
1370 /**
1371 * Returns the column definition provided by the application.
1372 * This may not be correct, as items can be superseded by default column options.
1373 * However it's useful for comparison, eg to know which application column definition matches that column.
1374 */
1375 Column.prototype.getUserProvidedColDef = function () {
1376 return this.userProvidedColDef;
1377 };
1378 Column.prototype.setParent = function (parent) {
1379 this.parent = parent;
1380 };
1381 /** Returns the parent column group, if column grouping is active. */
1382 Column.prototype.getParent = function () {
1383 return this.parent;
1384 };
1385 Column.prototype.setOriginalParent = function (originalParent) {
1386 this.originalParent = originalParent;
1387 };
1388 Column.prototype.getOriginalParent = function () {
1389 return this.originalParent;
1390 };
1391 // this is done after constructor as it uses gridOptionsWrapper
1392 Column.prototype.initialise = function () {
1393 this.initMinAndMaxWidths();
1394 this.resetActualWidth('gridInitializing');
1395 this.initDotNotation();
1396 this.validate();
1397 };
1398 Column.prototype.initDotNotation = function () {
1399 var suppressDotNotation = this.gridOptionsWrapper.isSuppressFieldDotNotation();
1400 this.fieldContainsDots = exists(this.colDef.field) && this.colDef.field.indexOf('.') >= 0 && !suppressDotNotation;
1401 this.tooltipFieldContainsDots = exists(this.colDef.tooltipField) && this.colDef.tooltipField.indexOf('.') >= 0 && !suppressDotNotation;
1402 };
1403 Column.prototype.initMinAndMaxWidths = function () {
1404 var colDef = this.colDef;
1405 this.minWidth = this.columnUtils.calculateColMinWidth(colDef);
1406 this.maxWidth = this.columnUtils.calculateColMaxWidth(colDef);
1407 };
1408 Column.prototype.resetActualWidth = function (source) {
1409 if (source === void 0) { source = 'api'; }
1410 var initialWidth = this.columnUtils.calculateColInitialWidth(this.colDef);
1411 this.setActualWidth(initialWidth, source, true);
1412 };
1413 Column.prototype.isEmptyGroup = function () {
1414 return false;
1415 };
1416 Column.prototype.isRowGroupDisplayed = function (colId) {
1417 if (missing(this.colDef) || missing(this.colDef.showRowGroup)) {
1418 return false;
1419 }
1420 var showingAllGroups = this.colDef.showRowGroup === true;
1421 var showingThisGroup = this.colDef.showRowGroup === colId;
1422 return showingAllGroups || showingThisGroup;
1423 };
1424 /** Returns `true` if column is a primary column, `false` if secondary. Secondary columns are used for pivoting. */
1425 Column.prototype.isPrimary = function () {
1426 return this.primary;
1427 };
1428 /** Returns `true` if column filtering is allowed. */
1429 Column.prototype.isFilterAllowed = function () {
1430 // filter defined means it's a string, class or true.
1431 // if its false, null or undefined then it's false.
1432 var filterDefined = !!this.colDef.filter || !!this.colDef.filterFramework;
1433 return filterDefined;
1434 };
1435 Column.prototype.isFieldContainsDots = function () {
1436 return this.fieldContainsDots;
1437 };
1438 Column.prototype.isTooltipFieldContainsDots = function () {
1439 return this.tooltipFieldContainsDots;
1440 };
1441 Column.prototype.validate = function () {
1442 var colDefAny = this.colDef;
1443 function warnOnce(msg, key, obj) {
1444 doOnce(function () {
1445 if (obj) {
1446 console.warn(msg, obj);
1447 }
1448 else {
1449 doOnce(function () { return console.warn(msg); }, key);
1450 }
1451 }, key);
1452 }
1453 var usingCSRM = this.gridOptionsWrapper.isRowModelDefault();
1454 if (usingCSRM && !ModuleRegistry.isRegistered(exports.ModuleNames.RowGroupingModule)) {
1455 var rowGroupingItems = ['enableRowGroup', 'rowGroup', 'rowGroupIndex', 'enablePivot', 'enableValue', 'pivot', 'pivotIndex', 'aggFunc'];
1456 rowGroupingItems.forEach(function (item) {
1457 if (exists(colDefAny[item])) {
1458 if (ModuleRegistry.isPackageBased()) {
1459 warnOnce("AG Grid: " + item + " is only valid in ag-grid-enterprise, your column definition should not have " + item, 'ColumnRowGroupingMissing' + item);
1460 }
1461 else {
1462 warnOnce("AG Grid: " + item + " is only valid with AG Grid Enterprise Module " + exports.ModuleNames.RowGroupingModule + " - your column definition should not have " + item, 'ColumnRowGroupingMissing' + item);
1463 }
1464 }
1465 });
1466 }
1467 if (!ModuleRegistry.isRegistered(exports.ModuleNames.RichSelectModule)) {
1468 if (this.colDef.cellEditor === 'agRichSelect') {
1469 if (ModuleRegistry.isPackageBased()) {
1470 warnOnce("AG Grid: " + this.colDef.cellEditor + " can only be used with ag-grid-enterprise", 'ColumnRichSelectMissing');
1471 }
1472 else {
1473 warnOnce("AG Grid: " + this.colDef.cellEditor + " can only be used with AG Grid Enterprise Module " + exports.ModuleNames.RichSelectModule, 'ColumnRichSelectMissing');
1474 }
1475 }
1476 }
1477 if (this.gridOptionsWrapper.isTreeData()) {
1478 var itemsNotAllowedWithTreeData = ['rowGroup', 'rowGroupIndex', 'pivot', 'pivotIndex'];
1479 itemsNotAllowedWithTreeData.forEach(function (item) {
1480 if (exists(colDefAny[item])) {
1481 warnOnce("AG Grid: " + item + " is not possible when doing tree data, your column definition should not have " + item, 'TreeDataCannotRowGroup');
1482 }
1483 });
1484 }
1485 if (exists(this.colDef.width) && typeof this.colDef.width !== 'number') {
1486 warnOnce('AG Grid: colDef.width should be a number, not ' + typeof this.colDef.width, 'ColumnCheck_asdfawef');
1487 }
1488 if (colDefAny.pinnedRowCellRenderer) {
1489 warnOnce('AG Grid: pinnedRowCellRenderer no longer exists, use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. This was an unfortunate (but necessary) change we had to do to allow future plans we have of re-skinng the data grid in frameworks such as React, Angular and Vue. See https://www.ag-grid.com/javascript-grid/cell-rendering/#many-renderers-one-column', 'colDef.pinnedRowCellRenderer-deprecated');
1490 }
1491 if (colDefAny.pinnedRowCellRendererParams) {
1492 warnOnce('AG Grid: pinnedRowCellRenderer no longer exists, use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. This was an unfortunate (but necessary) change we had to do to allow future plans we have of re-skinng the data grid in frameworks such as React, Angular and Vue. See https://www.ag-grid.com/javascript-grid/cell-rendering/#many-renderers-one-column', 'colDef.pinnedRowCellRenderer-deprecated');
1493 }
1494 if (colDefAny.pinnedRowCellRendererFramework) {
1495 warnOnce('AG Grid: pinnedRowCellRenderer no longer exists, use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. This was an unfortunate (but necessary) change we had to do to allow future plans we have of re-skinng the data grid in frameworks such as React, Angular and Vue. See https://www.ag-grid.com/javascript-grid/cell-rendering/#many-renderers-one-column', 'colDef.pinnedRowCellRenderer-deprecated');
1496 }
1497 if (colDefAny.pinnedRowValueGetter) {
1498 warnOnce('AG Grid: pinnedRowCellRenderer is deprecated, use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. This was an unfortunate (but necessary) change we had to do to allow future plans we have of re-skinng the data grid in frameworks such as React, Angular and Vue.', 'colDef.pinnedRowCellRenderer-deprecated');
1499 }
1500 };
1501 /** Add an event listener to the column. */
1502 Column.prototype.addEventListener = function (eventType, listener) {
1503 this.eventService.addEventListener(eventType, listener);
1504 };
1505 /** Remove event listener from the column. */
1506 Column.prototype.removeEventListener = function (eventType, listener) {
1507 this.eventService.removeEventListener(eventType, listener);
1508 };
1509 Column.prototype.createColumnFunctionCallbackParams = function (rowNode) {
1510 return {
1511 node: rowNode,
1512 data: rowNode.data,
1513 column: this,
1514 colDef: this.colDef,
1515 context: this.gridOptionsWrapper.getContext(),
1516 api: this.gridOptionsWrapper.getApi(),
1517 columnApi: this.gridOptionsWrapper.getColumnApi()
1518 };
1519 };
1520 Column.prototype.isSuppressNavigable = function (rowNode) {
1521 // if boolean set, then just use it
1522 if (typeof this.colDef.suppressNavigable === 'boolean') {
1523 return this.colDef.suppressNavigable;
1524 }
1525 // if function, then call the function to find out
1526 if (typeof this.colDef.suppressNavigable === 'function') {
1527 var params = this.createColumnFunctionCallbackParams(rowNode);
1528 var userFunc = this.colDef.suppressNavigable;
1529 return userFunc(params);
1530 }
1531 return false;
1532 };
1533 Column.prototype.isCellEditable = function (rowNode) {
1534 // only allow editing of groups if the user has this option enabled
1535 if (rowNode.group && !this.gridOptionsWrapper.isEnableGroupEdit()) {
1536 return false;
1537 }
1538 return this.isColumnFunc(rowNode, this.colDef.editable);
1539 };
1540 Column.prototype.isSuppressFillHandle = function () {
1541 return !!attrToBoolean(this.colDef.suppressFillHandle);
1542 };
1543 Column.prototype.isAutoHeight = function () {
1544 return !!attrToBoolean(this.colDef.autoHeight);
1545 };
1546 Column.prototype.isRowDrag = function (rowNode) {
1547 return this.isColumnFunc(rowNode, this.colDef.rowDrag);
1548 };
1549 Column.prototype.isDndSource = function (rowNode) {
1550 return this.isColumnFunc(rowNode, this.colDef.dndSource);
1551 };
1552 Column.prototype.isCellCheckboxSelection = function (rowNode) {
1553 return this.isColumnFunc(rowNode, this.colDef.checkboxSelection);
1554 };
1555 Column.prototype.isSuppressPaste = function (rowNode) {
1556 return this.isColumnFunc(rowNode, this.colDef ? this.colDef.suppressPaste : null);
1557 };
1558 Column.prototype.isResizable = function () {
1559 return !!attrToBoolean(this.colDef.resizable);
1560 };
1561 Column.prototype.isColumnFunc = function (rowNode, value) {
1562 // if boolean set, then just use it
1563 if (typeof value === 'boolean') {
1564 return value;
1565 }
1566 // if function, then call the function to find out
1567 if (typeof value === 'function') {
1568 var params = this.createColumnFunctionCallbackParams(rowNode);
1569 var editableFunc = value;
1570 return editableFunc(params);
1571 }
1572 return false;
1573 };
1574 Column.prototype.setMoving = function (moving, source) {
1575 if (source === void 0) { source = "api"; }
1576 this.moving = moving;
1577 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_MOVING_CHANGED, source));
1578 };
1579 Column.prototype.createColumnEvent = function (type, source) {
1580 return {
1581 api: this.gridApi,
1582 columnApi: this.columnApi,
1583 type: type,
1584 column: this,
1585 columns: [this],
1586 source: source
1587 };
1588 };
1589 Column.prototype.isMoving = function () {
1590 return this.moving;
1591 };
1592 /** If sorting is active, returns the sort direction e.g. `'asc'` or `'desc'`. */
1593 Column.prototype.getSort = function () {
1594 return this.sort;
1595 };
1596 Column.prototype.setSort = function (sort, source) {
1597 if (source === void 0) { source = "api"; }
1598 if (this.sort !== sort) {
1599 this.sort = sort;
1600 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_SORT_CHANGED, source));
1601 }
1602 };
1603 Column.prototype.setMenuVisible = function (visible, source) {
1604 if (source === void 0) { source = "api"; }
1605 if (this.menuVisible !== visible) {
1606 this.menuVisible = visible;
1607 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_MENU_VISIBLE_CHANGED, source));
1608 }
1609 };
1610 Column.prototype.isMenuVisible = function () {
1611 return this.menuVisible;
1612 };
1613 Column.prototype.isSortAscending = function () {
1614 return this.sort === Constants.SORT_ASC;
1615 };
1616 Column.prototype.isSortDescending = function () {
1617 return this.sort === Constants.SORT_DESC;
1618 };
1619 Column.prototype.isSortNone = function () {
1620 return missing(this.sort);
1621 };
1622 Column.prototype.isSorting = function () {
1623 return exists(this.sort);
1624 };
1625 Column.prototype.getSortIndex = function () {
1626 return this.sortIndex;
1627 };
1628 Column.prototype.setSortIndex = function (sortOrder) {
1629 this.sortIndex = sortOrder;
1630 };
1631 Column.prototype.setAggFunc = function (aggFunc) {
1632 this.aggFunc = aggFunc;
1633 };
1634 /** If aggregation is set for the column, returns the aggregation function. */
1635 Column.prototype.getAggFunc = function () {
1636 return this.aggFunc;
1637 };
1638 Column.prototype.getLeft = function () {
1639 return this.left;
1640 };
1641 Column.prototype.getOldLeft = function () {
1642 return this.oldLeft;
1643 };
1644 Column.prototype.getRight = function () {
1645 return this.left + this.actualWidth;
1646 };
1647 Column.prototype.setLeft = function (left, source) {
1648 if (source === void 0) { source = "api"; }
1649 this.oldLeft = this.left;
1650 if (this.left !== left) {
1651 this.left = left;
1652 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_LEFT_CHANGED, source));
1653 }
1654 };
1655 /** Returns `true` if filter is active on the column. */
1656 Column.prototype.isFilterActive = function () {
1657 return this.filterActive;
1658 };
1659 // additionalEventAttributes is used by provided simple floating filter, so it can add 'floatingFilter=true' to the event
1660 Column.prototype.setFilterActive = function (active, source, additionalEventAttributes) {
1661 if (source === void 0) { source = "api"; }
1662 if (this.filterActive !== active) {
1663 this.filterActive = active;
1664 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_FILTER_ACTIVE_CHANGED, source));
1665 }
1666 var filterChangedEvent = this.createColumnEvent(Column.EVENT_FILTER_CHANGED, source);
1667 if (additionalEventAttributes) {
1668 mergeDeep(filterChangedEvent, additionalEventAttributes);
1669 }
1670 this.eventService.dispatchEvent(filterChangedEvent);
1671 };
1672 Column.prototype.setPinned = function (pinned) {
1673 if (pinned === true || pinned === Constants.PINNED_LEFT) {
1674 this.pinned = Constants.PINNED_LEFT;
1675 }
1676 else if (pinned === Constants.PINNED_RIGHT) {
1677 this.pinned = Constants.PINNED_RIGHT;
1678 }
1679 else {
1680 this.pinned = null;
1681 }
1682 };
1683 Column.prototype.setFirstRightPinned = function (firstRightPinned, source) {
1684 if (source === void 0) { source = "api"; }
1685 if (this.firstRightPinned !== firstRightPinned) {
1686 this.firstRightPinned = firstRightPinned;
1687 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_FIRST_RIGHT_PINNED_CHANGED, source));
1688 }
1689 };
1690 Column.prototype.setLastLeftPinned = function (lastLeftPinned, source) {
1691 if (source === void 0) { source = "api"; }
1692 if (this.lastLeftPinned !== lastLeftPinned) {
1693 this.lastLeftPinned = lastLeftPinned;
1694 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_LAST_LEFT_PINNED_CHANGED, source));
1695 }
1696 };
1697 Column.prototype.isFirstRightPinned = function () {
1698 return this.firstRightPinned;
1699 };
1700 Column.prototype.isLastLeftPinned = function () {
1701 return this.lastLeftPinned;
1702 };
1703 Column.prototype.isPinned = function () {
1704 return this.pinned === Constants.PINNED_LEFT || this.pinned === Constants.PINNED_RIGHT;
1705 };
1706 Column.prototype.isPinnedLeft = function () {
1707 return this.pinned === Constants.PINNED_LEFT;
1708 };
1709 Column.prototype.isPinnedRight = function () {
1710 return this.pinned === Constants.PINNED_RIGHT;
1711 };
1712 Column.prototype.getPinned = function () {
1713 return this.pinned;
1714 };
1715 Column.prototype.setVisible = function (visible, source) {
1716 if (source === void 0) { source = "api"; }
1717 var newValue = visible === true;
1718 if (this.visible !== newValue) {
1719 this.visible = newValue;
1720 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_VISIBLE_CHANGED, source));
1721 }
1722 };
1723 Column.prototype.isVisible = function () {
1724 return this.visible;
1725 };
1726 /** Returns the column definition for this column.
1727 * The column definition will be the result of merging the application provided column definition with any provided defaults
1728 * (e.g. `defaultColDef` grid option, or column types.
1729 *
1730 * Equivalent: `getDefinition` */
1731 Column.prototype.getColDef = function () {
1732 return this.colDef;
1733 };
1734 Column.prototype.getColumnGroupShow = function () {
1735 return this.colDef.columnGroupShow;
1736 };
1737 /**
1738 * Returns the unique ID for the column.
1739 *
1740 * Equivalent: `getId`, `getUniqueId` */
1741 Column.prototype.getColId = function () {
1742 return this.colId;
1743 };
1744 /**
1745 * Returns the unique ID for the column.
1746 *
1747 * Equivalent: `getColId`, `getUniqueId` */
1748 Column.prototype.getId = function () {
1749 return this.getColId();
1750 };
1751 /**
1752 * Returns the unique ID for the column.
1753 *
1754 * Equivalent: `getColId`, `getId` */
1755 Column.prototype.getUniqueId = function () {
1756 return this.getId();
1757 };
1758 Column.prototype.getDefinition = function () {
1759 return this.colDef;
1760 };
1761 /** Returns the current width of the column. If the column is resized, the actual width is the new size. */
1762 Column.prototype.getActualWidth = function () {
1763 return this.actualWidth;
1764 };
1765 Column.prototype.createBaseColDefParams = function (rowNode) {
1766 var params = {
1767 node: rowNode,
1768 data: rowNode.data,
1769 colDef: this.colDef,
1770 column: this,
1771 api: this.gridOptionsWrapper.getApi(),
1772 columnApi: this.gridOptionsWrapper.getColumnApi(),
1773 context: this.gridOptionsWrapper.getContext()
1774 };
1775 return params;
1776 };
1777 Column.prototype.getColSpan = function (rowNode) {
1778 if (missing(this.colDef.colSpan)) {
1779 return 1;
1780 }
1781 var params = this.createBaseColDefParams(rowNode);
1782 var colSpan = this.colDef.colSpan(params);
1783 // colSpan must be number equal to or greater than 1
1784 return Math.max(colSpan, 1);
1785 };
1786 Column.prototype.getRowSpan = function (rowNode) {
1787 if (missing(this.colDef.rowSpan)) {
1788 return 1;
1789 }
1790 var params = this.createBaseColDefParams(rowNode);
1791 var rowSpan = this.colDef.rowSpan(params);
1792 // rowSpan must be number equal to or greater than 1
1793 return Math.max(rowSpan, 1);
1794 };
1795 Column.prototype.setActualWidth = function (actualWidth, source, silent) {
1796 if (source === void 0) { source = "api"; }
1797 if (silent === void 0) { silent = false; }
1798 if (this.minWidth != null) {
1799 actualWidth = Math.max(actualWidth, this.minWidth);
1800 }
1801 if (this.maxWidth != null) {
1802 actualWidth = Math.min(actualWidth, this.maxWidth);
1803 }
1804 if (this.actualWidth !== actualWidth) {
1805 // disable flex for this column if it was manually resized.
1806 this.actualWidth = actualWidth;
1807 if (this.flex && source !== 'flex' && source !== 'gridInitializing') {
1808 this.flex = null;
1809 }
1810 if (!silent) {
1811 this.fireColumnWidthChangedEvent(source);
1812 }
1813 }
1814 };
1815 Column.prototype.fireColumnWidthChangedEvent = function (source) {
1816 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_WIDTH_CHANGED, source));
1817 };
1818 Column.prototype.isGreaterThanMax = function (width) {
1819 if (this.maxWidth != null) {
1820 return width > this.maxWidth;
1821 }
1822 return false;
1823 };
1824 Column.prototype.getMinWidth = function () {
1825 return this.minWidth;
1826 };
1827 Column.prototype.getMaxWidth = function () {
1828 return this.maxWidth;
1829 };
1830 Column.prototype.getFlex = function () {
1831 return this.flex || 0;
1832 };
1833 // this method should only be used by the columnModel to
1834 // change flex when required by the setColumnState method.
1835 Column.prototype.setFlex = function (flex) {
1836 if (this.flex !== flex) {
1837 this.flex = flex;
1838 }
1839 };
1840 Column.prototype.setMinimum = function (source) {
1841 if (source === void 0) { source = "api"; }
1842 if (exists(this.minWidth)) {
1843 this.setActualWidth(this.minWidth, source);
1844 }
1845 };
1846 Column.prototype.setRowGroupActive = function (rowGroup, source) {
1847 if (source === void 0) { source = "api"; }
1848 if (this.rowGroupActive !== rowGroup) {
1849 this.rowGroupActive = rowGroup;
1850 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_ROW_GROUP_CHANGED, source));
1851 }
1852 };
1853 /** Returns `true` if row group is currently active for this column. */
1854 Column.prototype.isRowGroupActive = function () {
1855 return this.rowGroupActive;
1856 };
1857 Column.prototype.setPivotActive = function (pivot, source) {
1858 if (source === void 0) { source = "api"; }
1859 if (this.pivotActive !== pivot) {
1860 this.pivotActive = pivot;
1861 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_PIVOT_CHANGED, source));
1862 }
1863 };
1864 /** Returns `true` if pivot is currently active for this column. */
1865 Column.prototype.isPivotActive = function () {
1866 return this.pivotActive;
1867 };
1868 Column.prototype.isAnyFunctionActive = function () {
1869 return this.isPivotActive() || this.isRowGroupActive() || this.isValueActive();
1870 };
1871 Column.prototype.isAnyFunctionAllowed = function () {
1872 return this.isAllowPivot() || this.isAllowRowGroup() || this.isAllowValue();
1873 };
1874 Column.prototype.setValueActive = function (value, source) {
1875 if (source === void 0) { source = "api"; }
1876 if (this.aggregationActive !== value) {
1877 this.aggregationActive = value;
1878 this.eventService.dispatchEvent(this.createColumnEvent(Column.EVENT_VALUE_CHANGED, source));
1879 }
1880 };
1881 /** Returns `true` if value (aggregation) is currently active for this column. */
1882 Column.prototype.isValueActive = function () {
1883 return this.aggregationActive;
1884 };
1885 Column.prototype.isAllowPivot = function () {
1886 return this.colDef.enablePivot === true;
1887 };
1888 Column.prototype.isAllowValue = function () {
1889 return this.colDef.enableValue === true;
1890 };
1891 Column.prototype.isAllowRowGroup = function () {
1892 return this.colDef.enableRowGroup === true;
1893 };
1894 Column.prototype.getMenuTabs = function (defaultValues) {
1895 var menuTabs = this.getColDef().menuTabs;
1896 if (menuTabs == null) {
1897 menuTabs = defaultValues;
1898 }
1899 return menuTabs;
1900 };
1901 // this used to be needed, as previous version of ag-grid had lockPosition as column state,
1902 // so couldn't depend on colDef version.
1903 Column.prototype.isLockPosition = function () {
1904 console.warn('AG Grid: since v21, col.isLockPosition() should not be used, please use col.getColDef().lockPosition instead.');
1905 return this.colDef ? !!this.colDef.lockPosition : false;
1906 };
1907 // this used to be needed, as previous version of ag-grid had lockVisible as column state,
1908 // so couldn't depend on colDef version.
1909 Column.prototype.isLockVisible = function () {
1910 console.warn('AG Grid: since v21, col.isLockVisible() should not be used, please use col.getColDef().lockVisible instead.');
1911 return this.colDef ? !!this.colDef.lockVisible : false;
1912 };
1913 // this used to be needed, as previous version of ag-grid had lockPinned as column state,
1914 // so couldn't depend on colDef version.
1915 Column.prototype.isLockPinned = function () {
1916 console.warn('AG Grid: since v21, col.isLockPinned() should not be used, please use col.getColDef().lockPinned instead.');
1917 return this.colDef ? !!this.colDef.lockPinned : false;
1918 };
1919 // + renderedHeaderCell - for making header cell transparent when moving
1920 Column.EVENT_MOVING_CHANGED = 'movingChanged';
1921 // + renderedCell - changing left position
1922 Column.EVENT_LEFT_CHANGED = 'leftChanged';
1923 // + renderedCell - changing width
1924 Column.EVENT_WIDTH_CHANGED = 'widthChanged';
1925 // + renderedCell - for changing pinned classes
1926 Column.EVENT_LAST_LEFT_PINNED_CHANGED = 'lastLeftPinnedChanged';
1927 Column.EVENT_FIRST_RIGHT_PINNED_CHANGED = 'firstRightPinnedChanged';
1928 // + renderedColumn - for changing visibility icon
1929 Column.EVENT_VISIBLE_CHANGED = 'visibleChanged';
1930 // + every time the filter changes, used in the floating filters
1931 Column.EVENT_FILTER_CHANGED = 'filterChanged';
1932 // + renderedHeaderCell - marks the header with filter icon
1933 Column.EVENT_FILTER_ACTIVE_CHANGED = 'filterActiveChanged';
1934 // + renderedHeaderCell - marks the header with sort icon
1935 Column.EVENT_SORT_CHANGED = 'sortChanged';
1936 Column.EVENT_MENU_VISIBLE_CHANGED = 'menuVisibleChanged';
1937 // + toolpanel, for gui updates
1938 Column.EVENT_ROW_GROUP_CHANGED = 'columnRowGroupChanged';
1939 // + toolpanel, for gui updates
1940 Column.EVENT_PIVOT_CHANGED = 'columnPivotChanged';
1941 // + toolpanel, for gui updates
1942 Column.EVENT_VALUE_CHANGED = 'columnValueChanged';
1943 __decorate$1([
1944 Autowired('gridOptionsWrapper')
1945 ], Column.prototype, "gridOptionsWrapper", void 0);
1946 __decorate$1([
1947 Autowired('columnUtils')
1948 ], Column.prototype, "columnUtils", void 0);
1949 __decorate$1([
1950 Autowired('columnApi')
1951 ], Column.prototype, "columnApi", void 0);
1952 __decorate$1([
1953 Autowired('gridApi')
1954 ], Column.prototype, "gridApi", void 0);
1955 __decorate$1([
1956 Autowired('context')
1957 ], Column.prototype, "context", void 0);
1958 __decorate$1([
1959 PostConstruct
1960 ], Column.prototype, "initialise", null);
1961 return Column;
1962}());
1963
1964/**
1965 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
1966 * @version v27.3.0
1967 * @link https://www.ag-grid.com/
1968 * @license MIT
1969 */
1970function firstExistingValue() {
1971 var values = [];
1972 for (var _i = 0; _i < arguments.length; _i++) {
1973 values[_i] = arguments[_i];
1974 }
1975 for (var i = 0; i < values.length; i++) {
1976 var value = values[i];
1977 if (exists(value)) {
1978 return value;
1979 }
1980 }
1981 return null;
1982}
1983function existsAndNotEmpty(value) {
1984 return value != null && value.length > 0;
1985}
1986function last(arr) {
1987 if (!arr || !arr.length) {
1988 return;
1989 }
1990 return arr[arr.length - 1];
1991}
1992function areEqual(a, b, comparator) {
1993 if (a == null && b == null) {
1994 return true;
1995 }
1996 return a != null &&
1997 b != null &&
1998 a.length === b.length &&
1999 a.every(function (value, index) { return comparator ? comparator(value, b[index]) : b[index] === value; });
2000}
2001/** @deprecated */
2002function compareArrays(array1, array2) {
2003 return areEqual(array1, array2);
2004}
2005/** @deprecated */
2006function shallowCompare(arr1, arr2) {
2007 return areEqual(arr1, arr2);
2008}
2009function sortNumerically(array) {
2010 return array.sort(function (a, b) { return a - b; });
2011}
2012function removeRepeatsFromArray(array, object) {
2013 if (!array) {
2014 return;
2015 }
2016 for (var index = array.length - 2; index >= 0; index--) {
2017 var thisOneMatches = array[index] === object;
2018 var nextOneMatches = array[index + 1] === object;
2019 if (thisOneMatches && nextOneMatches) {
2020 array.splice(index + 1, 1);
2021 }
2022 }
2023}
2024function removeFromArray(array, object) {
2025 var index = array.indexOf(object);
2026 if (index >= 0) {
2027 array.splice(index, 1);
2028 }
2029}
2030function removeAllFromArray(array, toRemove) {
2031 toRemove.forEach(function (item) { return removeFromArray(array, item); });
2032}
2033function insertIntoArray(array, object, toIndex) {
2034 array.splice(toIndex, 0, object);
2035}
2036function insertArrayIntoArray(dest, src, toIndex) {
2037 if (dest == null || src == null) {
2038 return;
2039 }
2040 // put items in backwards, otherwise inserted items end up in reverse order
2041 for (var i = src.length - 1; i >= 0; i--) {
2042 var item = src[i];
2043 insertIntoArray(dest, item, toIndex);
2044 }
2045}
2046function moveInArray(array, objectsToMove, toIndex) {
2047 // first take out items from the array
2048 removeAllFromArray(array, objectsToMove);
2049 // now add the objects, in same order as provided to us, that means we start at the end
2050 // as the objects will be pushed to the right as they are inserted
2051 objectsToMove.slice().reverse().forEach(function (obj) { return insertIntoArray(array, obj, toIndex); });
2052}
2053function includes(array, value) {
2054 return array.indexOf(value) > -1;
2055}
2056function flatten(arrayOfArrays) {
2057 return [].concat.apply([], arrayOfArrays);
2058}
2059function pushAll(target, source) {
2060 if (source == null || target == null) {
2061 return;
2062 }
2063 source.forEach(function (value) { return target.push(value); });
2064}
2065function toStrings(array) {
2066 return array.map(toStringOrNull);
2067}
2068function forEachReverse(list, action) {
2069 if (list == null) {
2070 return;
2071 }
2072 for (var i = list.length - 1; i >= 0; i--) {
2073 action(list[i], i);
2074 }
2075}
2076
2077var ArrayUtils = /*#__PURE__*/Object.freeze({
2078 firstExistingValue: firstExistingValue,
2079 existsAndNotEmpty: existsAndNotEmpty,
2080 last: last,
2081 areEqual: areEqual,
2082 compareArrays: compareArrays,
2083 shallowCompare: shallowCompare,
2084 sortNumerically: sortNumerically,
2085 removeRepeatsFromArray: removeRepeatsFromArray,
2086 removeFromArray: removeFromArray,
2087 removeAllFromArray: removeAllFromArray,
2088 insertIntoArray: insertIntoArray,
2089 insertArrayIntoArray: insertArrayIntoArray,
2090 moveInArray: moveInArray,
2091 includes: includes,
2092 flatten: flatten,
2093 pushAll: pushAll,
2094 toStrings: toStrings,
2095 forEachReverse: forEachReverse
2096});
2097
2098/**
2099 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
2100 * @version v27.3.0
2101 * @link https://www.ag-grid.com/
2102 * @license MIT
2103 */
2104var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2105 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2106 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2107 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;
2108 return c > 3 && r && Object.defineProperty(target, key, r), r;
2109};
2110var ColumnGroup = /** @class */ (function () {
2111 function ColumnGroup(providedColumnGroup, groupId, instanceId, pinned) {
2112 // depends on the open/closed state of the group, only displaying columns are stored here
2113 this.displayedChildren = [];
2114 this.localEventService = new EventService();
2115 this.groupId = groupId;
2116 this.instanceId = instanceId;
2117 this.providedColumnGroup = providedColumnGroup;
2118 this.pinned = pinned;
2119 }
2120 // this is static, a it is used outside of this class
2121 ColumnGroup.createUniqueId = function (groupId, instanceId) {
2122 return groupId + '_' + instanceId;
2123 };
2124 // as the user is adding and removing columns, the groups are recalculated.
2125 // this reset clears out all children, ready for children to be added again
2126 ColumnGroup.prototype.reset = function () {
2127 this.parent = null;
2128 this.children = null;
2129 this.displayedChildren = null;
2130 };
2131 ColumnGroup.prototype.getParent = function () {
2132 return this.parent;
2133 };
2134 ColumnGroup.prototype.setParent = function (parent) {
2135 this.parent = parent;
2136 };
2137 ColumnGroup.prototype.getUniqueId = function () {
2138 return ColumnGroup.createUniqueId(this.groupId, this.instanceId);
2139 };
2140 ColumnGroup.prototype.isEmptyGroup = function () {
2141 return this.displayedChildren.length === 0;
2142 };
2143 ColumnGroup.prototype.isMoving = function () {
2144 var allLeafColumns = this.getProvidedColumnGroup().getLeafColumns();
2145 if (!allLeafColumns || allLeafColumns.length === 0) {
2146 return false;
2147 }
2148 return allLeafColumns.every(function (col) { return col.isMoving(); });
2149 };
2150 ColumnGroup.prototype.checkLeft = function () {
2151 // first get all children to setLeft, as it impacts our decision below
2152 this.displayedChildren.forEach(function (child) {
2153 if (child instanceof ColumnGroup) {
2154 child.checkLeft();
2155 }
2156 });
2157 // set our left based on first displayed column
2158 if (this.displayedChildren.length > 0) {
2159 if (this.gridOptionsWrapper.isEnableRtl()) {
2160 var lastChild = last(this.displayedChildren);
2161 var lastChildLeft = lastChild.getLeft();
2162 this.setLeft(lastChildLeft);
2163 }
2164 else {
2165 var firstChildLeft = this.displayedChildren[0].getLeft();
2166 this.setLeft(firstChildLeft);
2167 }
2168 }
2169 else {
2170 // this should never happen, as if we have no displayed columns, then
2171 // this groups should not even exist.
2172 this.setLeft(null);
2173 }
2174 };
2175 ColumnGroup.prototype.getLeft = function () {
2176 return this.left;
2177 };
2178 ColumnGroup.prototype.getOldLeft = function () {
2179 return this.oldLeft;
2180 };
2181 ColumnGroup.prototype.setLeft = function (left) {
2182 this.oldLeft = left;
2183 if (this.left !== left) {
2184 this.left = left;
2185 this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_LEFT_CHANGED));
2186 }
2187 };
2188 ColumnGroup.prototype.getPinned = function () {
2189 return this.pinned;
2190 };
2191 ColumnGroup.prototype.createAgEvent = function (type) {
2192 return { type: type };
2193 };
2194 ColumnGroup.prototype.addEventListener = function (eventType, listener) {
2195 this.localEventService.addEventListener(eventType, listener);
2196 };
2197 ColumnGroup.prototype.removeEventListener = function (eventType, listener) {
2198 this.localEventService.removeEventListener(eventType, listener);
2199 };
2200 ColumnGroup.prototype.getGroupId = function () {
2201 return this.groupId;
2202 };
2203 ColumnGroup.prototype.getInstanceId = function () {
2204 return this.instanceId;
2205 };
2206 ColumnGroup.prototype.isChildInThisGroupDeepSearch = function (wantedChild) {
2207 var result = false;
2208 this.children.forEach(function (foundChild) {
2209 if (wantedChild === foundChild) {
2210 result = true;
2211 }
2212 if (foundChild instanceof ColumnGroup) {
2213 if (foundChild.isChildInThisGroupDeepSearch(wantedChild)) {
2214 result = true;
2215 }
2216 }
2217 });
2218 return result;
2219 };
2220 ColumnGroup.prototype.getActualWidth = function () {
2221 var groupActualWidth = 0;
2222 if (this.displayedChildren) {
2223 this.displayedChildren.forEach(function (child) {
2224 groupActualWidth += child.getActualWidth();
2225 });
2226 }
2227 return groupActualWidth;
2228 };
2229 ColumnGroup.prototype.isResizable = function () {
2230 if (!this.displayedChildren) {
2231 return false;
2232 }
2233 // if at least one child is resizable, then the group is resizable
2234 var result = false;
2235 this.displayedChildren.forEach(function (child) {
2236 if (child.isResizable()) {
2237 result = true;
2238 }
2239 });
2240 return result;
2241 };
2242 ColumnGroup.prototype.getMinWidth = function () {
2243 var result = 0;
2244 this.displayedChildren.forEach(function (groupChild) {
2245 result += groupChild.getMinWidth() || 0;
2246 });
2247 return result;
2248 };
2249 ColumnGroup.prototype.addChild = function (child) {
2250 if (!this.children) {
2251 this.children = [];
2252 }
2253 this.children.push(child);
2254 };
2255 ColumnGroup.prototype.getDisplayedChildren = function () {
2256 return this.displayedChildren;
2257 };
2258 ColumnGroup.prototype.getLeafColumns = function () {
2259 var result = [];
2260 this.addLeafColumns(result);
2261 return result;
2262 };
2263 ColumnGroup.prototype.getDisplayedLeafColumns = function () {
2264 var result = [];
2265 this.addDisplayedLeafColumns(result);
2266 return result;
2267 };
2268 // why two methods here doing the same thing?
2269 ColumnGroup.prototype.getDefinition = function () {
2270 return this.providedColumnGroup.getColGroupDef();
2271 };
2272 ColumnGroup.prototype.getColGroupDef = function () {
2273 return this.providedColumnGroup.getColGroupDef();
2274 };
2275 ColumnGroup.prototype.isPadding = function () {
2276 return this.providedColumnGroup.isPadding();
2277 };
2278 ColumnGroup.prototype.isExpandable = function () {
2279 return this.providedColumnGroup.isExpandable();
2280 };
2281 ColumnGroup.prototype.isExpanded = function () {
2282 return this.providedColumnGroup.isExpanded();
2283 };
2284 ColumnGroup.prototype.setExpanded = function (expanded) {
2285 this.providedColumnGroup.setExpanded(expanded);
2286 };
2287 ColumnGroup.prototype.addDisplayedLeafColumns = function (leafColumns) {
2288 this.displayedChildren.forEach(function (child) {
2289 if (child instanceof Column) {
2290 leafColumns.push(child);
2291 }
2292 else if (child instanceof ColumnGroup) {
2293 child.addDisplayedLeafColumns(leafColumns);
2294 }
2295 });
2296 };
2297 ColumnGroup.prototype.addLeafColumns = function (leafColumns) {
2298 this.children.forEach(function (child) {
2299 if (child instanceof Column) {
2300 leafColumns.push(child);
2301 }
2302 else if (child instanceof ColumnGroup) {
2303 child.addLeafColumns(leafColumns);
2304 }
2305 });
2306 };
2307 ColumnGroup.prototype.getChildren = function () {
2308 return this.children;
2309 };
2310 ColumnGroup.prototype.getColumnGroupShow = function () {
2311 return this.providedColumnGroup.getColumnGroupShow();
2312 };
2313 ColumnGroup.prototype.getProvidedColumnGroup = function () {
2314 return this.providedColumnGroup;
2315 };
2316 /** @deprecated getOriginalColumnGroup is deprecated, use getOriginalColumnGroup. */
2317 ColumnGroup.prototype.getOriginalColumnGroup = function () {
2318 console.warn('AG Grid: columnGroup.getOriginalColumnGroup() is deprecated due to a method rename, use columnGroup.getProvidedColumnGroup() instead');
2319 return this.getProvidedColumnGroup();
2320 };
2321 ColumnGroup.prototype.getPaddingLevel = function () {
2322 var parent = this.getParent();
2323 if (!this.isPadding() || !parent || !parent.isPadding()) {
2324 return 0;
2325 }
2326 return 1 + parent.getPaddingLevel();
2327 };
2328 ColumnGroup.prototype.calculateDisplayedColumns = function () {
2329 var _this = this;
2330 // clear out last time we calculated
2331 this.displayedChildren = [];
2332 // find the column group that is controlling expandable. this is relevant when we have padding (empty)
2333 // groups, where the expandable is actually the first parent that is not a padding group.
2334 var parentWithExpansion = this;
2335 while (parentWithExpansion != null && parentWithExpansion.isPadding()) {
2336 parentWithExpansion = parentWithExpansion.getParent();
2337 }
2338 var isExpandable = parentWithExpansion ? parentWithExpansion.providedColumnGroup.isExpandable() : false;
2339 // it not expandable, everything is visible
2340 if (!isExpandable) {
2341 this.displayedChildren = this.children;
2342 this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED));
2343 return;
2344 }
2345 // Add cols based on columnGroupShow
2346 // Note - the below also adds padding groups, these are always added because they never have
2347 // colDef.columnGroupShow set.
2348 this.children.forEach(function (child) {
2349 // never add empty groups
2350 var emptyGroup = child instanceof ColumnGroup && (!child.displayedChildren || !child.displayedChildren.length);
2351 if (emptyGroup) {
2352 return;
2353 }
2354 var headerGroupShow = child.getColumnGroupShow();
2355 switch (headerGroupShow) {
2356 case ColumnGroup.HEADER_GROUP_SHOW_OPEN:
2357 // when set to open, only show col if group is open
2358 if (parentWithExpansion.providedColumnGroup.isExpanded()) {
2359 _this.displayedChildren.push(child);
2360 }
2361 break;
2362 case ColumnGroup.HEADER_GROUP_SHOW_CLOSED:
2363 // when set to open, only show col if group is open
2364 if (!parentWithExpansion.providedColumnGroup.isExpanded()) {
2365 _this.displayedChildren.push(child);
2366 }
2367 break;
2368 default:
2369 _this.displayedChildren.push(child);
2370 break;
2371 }
2372 });
2373 this.localEventService.dispatchEvent(this.createAgEvent(ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED));
2374 };
2375 ColumnGroup.HEADER_GROUP_SHOW_OPEN = 'open';
2376 ColumnGroup.HEADER_GROUP_SHOW_CLOSED = 'closed';
2377 ColumnGroup.EVENT_LEFT_CHANGED = 'leftChanged';
2378 ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED = 'displayedChildrenChanged';
2379 __decorate$2([
2380 Autowired('gridOptionsWrapper')
2381 ], ColumnGroup.prototype, "gridOptionsWrapper", void 0);
2382 return ColumnGroup;
2383}());
2384
2385/**
2386 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
2387 * @version v27.3.0
2388 * @link https://www.ag-grid.com/
2389 * @license MIT
2390 */
2391var ProvidedColumnGroup = /** @class */ (function () {
2392 function ProvidedColumnGroup(colGroupDef, groupId, padding, level) {
2393 this.localEventService = new EventService();
2394 this.expandable = false;
2395 this.colGroupDef = colGroupDef;
2396 this.groupId = groupId;
2397 this.expanded = !!colGroupDef && !!colGroupDef.openByDefault;
2398 this.padding = padding;
2399 this.level = level;
2400 }
2401 ProvidedColumnGroup.prototype.setOriginalParent = function (originalParent) {
2402 this.originalParent = originalParent;
2403 };
2404 ProvidedColumnGroup.prototype.getOriginalParent = function () {
2405 return this.originalParent;
2406 };
2407 ProvidedColumnGroup.prototype.getLevel = function () {
2408 return this.level;
2409 };
2410 ProvidedColumnGroup.prototype.isVisible = function () {
2411 // return true if at least one child is visible
2412 if (this.children) {
2413 return this.children.some(function (child) { return child.isVisible(); });
2414 }
2415 return false;
2416 };
2417 ProvidedColumnGroup.prototype.isPadding = function () {
2418 return this.padding;
2419 };
2420 ProvidedColumnGroup.prototype.setExpanded = function (expanded) {
2421 this.expanded = expanded === undefined ? false : expanded;
2422 var event = {
2423 type: ProvidedColumnGroup.EVENT_EXPANDED_CHANGED
2424 };
2425 this.localEventService.dispatchEvent(event);
2426 };
2427 ProvidedColumnGroup.prototype.isExpandable = function () {
2428 return this.expandable;
2429 };
2430 ProvidedColumnGroup.prototype.isExpanded = function () {
2431 return this.expanded;
2432 };
2433 ProvidedColumnGroup.prototype.getGroupId = function () {
2434 return this.groupId;
2435 };
2436 ProvidedColumnGroup.prototype.getId = function () {
2437 return this.getGroupId();
2438 };
2439 ProvidedColumnGroup.prototype.setChildren = function (children) {
2440 this.children = children;
2441 };
2442 ProvidedColumnGroup.prototype.getChildren = function () {
2443 return this.children;
2444 };
2445 ProvidedColumnGroup.prototype.getColGroupDef = function () {
2446 return this.colGroupDef;
2447 };
2448 ProvidedColumnGroup.prototype.getLeafColumns = function () {
2449 var result = [];
2450 this.addLeafColumns(result);
2451 return result;
2452 };
2453 ProvidedColumnGroup.prototype.addLeafColumns = function (leafColumns) {
2454 if (!this.children) {
2455 return;
2456 }
2457 this.children.forEach(function (child) {
2458 if (child instanceof Column) {
2459 leafColumns.push(child);
2460 }
2461 else if (child instanceof ProvidedColumnGroup) {
2462 child.addLeafColumns(leafColumns);
2463 }
2464 });
2465 };
2466 ProvidedColumnGroup.prototype.getColumnGroupShow = function () {
2467 var colGroupDef = this.colGroupDef;
2468 if (!colGroupDef) {
2469 return;
2470 }
2471 return colGroupDef.columnGroupShow;
2472 };
2473 // need to check that this group has at least one col showing when both expanded and contracted.
2474 // if not, then we don't allow expanding and contracting on this group
2475 ProvidedColumnGroup.prototype.setupExpandable = function () {
2476 var _this = this;
2477 this.setExpandable();
2478 // note - we should be removing this event listener
2479 this.getLeafColumns().forEach(function (col) { return col.addEventListener(Column.EVENT_VISIBLE_CHANGED, _this.onColumnVisibilityChanged.bind(_this)); });
2480 };
2481 ProvidedColumnGroup.prototype.setExpandable = function () {
2482 if (this.isPadding()) {
2483 return;
2484 }
2485 // want to make sure the group doesn't disappear when it's open
2486 var atLeastOneShowingWhenOpen = false;
2487 // want to make sure the group doesn't disappear when it's closed
2488 var atLeastOneShowingWhenClosed = false;
2489 // want to make sure the group has something to show / hide
2490 var atLeastOneChangeable = false;
2491 var children = this.findChildrenRemovingPadding();
2492 for (var i = 0, j = children.length; i < j; i++) {
2493 var abstractColumn = children[i];
2494 if (!abstractColumn.isVisible()) {
2495 continue;
2496 }
2497 // if the abstractColumn is a grid generated group, there will be no colDef
2498 var headerGroupShow = abstractColumn.getColumnGroupShow();
2499 if (headerGroupShow === ColumnGroup.HEADER_GROUP_SHOW_OPEN) {
2500 atLeastOneShowingWhenOpen = true;
2501 atLeastOneChangeable = true;
2502 }
2503 else if (headerGroupShow === ColumnGroup.HEADER_GROUP_SHOW_CLOSED) {
2504 atLeastOneShowingWhenClosed = true;
2505 atLeastOneChangeable = true;
2506 }
2507 else {
2508 atLeastOneShowingWhenOpen = true;
2509 atLeastOneShowingWhenClosed = true;
2510 }
2511 }
2512 var expandable = atLeastOneShowingWhenOpen && atLeastOneShowingWhenClosed && atLeastOneChangeable;
2513 if (this.expandable !== expandable) {
2514 this.expandable = expandable;
2515 var event_1 = {
2516 type: ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED
2517 };
2518 this.localEventService.dispatchEvent(event_1);
2519 }
2520 };
2521 ProvidedColumnGroup.prototype.findChildrenRemovingPadding = function () {
2522 var res = [];
2523 var process = function (items) {
2524 items.forEach(function (item) {
2525 // if padding, we add this children instead of the padding
2526 var skipBecausePadding = item instanceof ProvidedColumnGroup && item.isPadding();
2527 if (skipBecausePadding) {
2528 process(item.children);
2529 }
2530 else {
2531 res.push(item);
2532 }
2533 });
2534 };
2535 process(this.children);
2536 return res;
2537 };
2538 ProvidedColumnGroup.prototype.onColumnVisibilityChanged = function () {
2539 this.setExpandable();
2540 };
2541 ProvidedColumnGroup.prototype.addEventListener = function (eventType, listener) {
2542 this.localEventService.addEventListener(eventType, listener);
2543 };
2544 ProvidedColumnGroup.prototype.removeEventListener = function (eventType, listener) {
2545 this.localEventService.removeEventListener(eventType, listener);
2546 };
2547 ProvidedColumnGroup.EVENT_EXPANDED_CHANGED = 'expandedChanged';
2548 ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED = 'expandableChanged';
2549 return ProvidedColumnGroup;
2550}());
2551
2552/**
2553 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
2554 * @version v27.3.0
2555 * @link https://www.ag-grid.com/
2556 * @license MIT
2557 */
2558var DefaultColumnTypes = {
2559 numericColumn: {
2560 headerClass: 'ag-right-aligned-header',
2561 cellClass: 'ag-right-aligned-cell'
2562 },
2563 rightAligned: {
2564 headerClass: 'ag-right-aligned-header',
2565 cellClass: 'ag-right-aligned-cell'
2566 }
2567};
2568
2569/**
2570 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
2571 * @version v27.3.0
2572 * @link https://www.ag-grid.com/
2573 * @license MIT
2574 */
2575var AG_GRID_STOP_PROPAGATION = '__ag_Grid_Stop_Propagation';
2576var PASSIVE_EVENTS = ['touchstart', 'touchend', 'touchmove', 'touchcancel'];
2577var supports = {};
2578/**
2579 * a user once raised an issue - they said that when you opened a popup (eg context menu)
2580 * and then clicked on a selection checkbox, the popup wasn't closed. this is because the
2581 * popup listens for clicks on the body, however ag-grid WAS stopping propagation on the
2582 * checkbox clicks (so the rows didn't pick them up as row selection selection clicks).
2583 * to get around this, we have a pattern to stop propagation for the purposes of AG Grid,
2584 * but we still let the event pass back to the body.
2585 * @param {Event} event
2586 */
2587function stopPropagationForAgGrid(event) {
2588 event[AG_GRID_STOP_PROPAGATION] = true;
2589}
2590function isStopPropagationForAgGrid(event) {
2591 return event[AG_GRID_STOP_PROPAGATION] === true;
2592}
2593var isEventSupported = (function () {
2594 var tags = {
2595 select: 'input',
2596 change: 'input',
2597 submit: 'form',
2598 reset: 'form',
2599 error: 'img',
2600 load: 'img',
2601 abort: 'img'
2602 };
2603 var eventChecker = function (eventName) {
2604 if (typeof supports[eventName] === 'boolean') {
2605 return supports[eventName];
2606 }
2607 var el = document.createElement(tags[eventName] || 'div');
2608 eventName = 'on' + eventName;
2609 return supports[eventName] = (eventName in el);
2610 };
2611 return eventChecker;
2612})();
2613function getCtrlForEvent(gridOptionsWrapper, event, type) {
2614 var sourceElement = event.target;
2615 while (sourceElement) {
2616 var renderedComp = gridOptionsWrapper.getDomData(sourceElement, type);
2617 if (renderedComp) {
2618 return renderedComp;
2619 }
2620 sourceElement = sourceElement.parentElement;
2621 }
2622 return null;
2623}
2624/**
2625 * @deprecated
2626 * Adds all type of change listeners to an element, intended to be a text field
2627 * @param {HTMLElement} element
2628 * @param {EventListener} listener
2629 */
2630function addChangeListener(element, listener) {
2631 element.addEventListener('changed', listener);
2632 element.addEventListener('paste', listener);
2633 element.addEventListener('input', listener);
2634}
2635function isElementInEventPath(element, event) {
2636 if (!event || !element) {
2637 return false;
2638 }
2639 return getEventPath(event).indexOf(element) >= 0;
2640}
2641function createEventPath(event) {
2642 var res = [];
2643 var pointer = event.target;
2644 while (pointer) {
2645 res.push(pointer);
2646 pointer = pointer.parentElement;
2647 }
2648 return res;
2649}
2650/**
2651 * firefox doesn't have event.path set, or any alternative to it, so we hack
2652 * it in. this is needed as it's to late to work out the path when the item is
2653 * removed from the dom. used by MouseEventService, where it works out if a click
2654 * was from the current grid, or a detail grid (master / detail).
2655 * @param {Event} event
2656 */
2657function addAgGridEventPath(event) {
2658 event.__agGridEventPath = getEventPath(event);
2659}
2660/**
2661 * Gets the path for an Event.
2662 * https://stackoverflow.com/questions/39245488/event-path-undefined-with-firefox-and-vue-js
2663 * https://developer.mozilla.org/en-US/docs/Web/API/Event
2664 * @param {Event} event
2665 * @returns {EventTarget[]}
2666 */
2667function getEventPath(event) {
2668 var eventNoType = event;
2669 if (eventNoType.path) {
2670 // Chrome supports path
2671 return eventNoType.path;
2672 }
2673 if (eventNoType.composedPath) {
2674 // Firefox supports composePath
2675 return eventNoType.composedPath();
2676 }
2677 if (eventNoType.__agGridEventPath) {
2678 // Firefox supports composePath
2679 return eventNoType.__agGridEventPath;
2680 }
2681 // and finally, if none of the above worked,
2682 // we create the path ourselves
2683 return createEventPath(event);
2684}
2685function addSafePassiveEventListener(frameworkOverrides, eElement, event, listener) {
2686 var isPassive = includes(PASSIVE_EVENTS, event);
2687 var options = isPassive ? { passive: true } : undefined;
2688 // this check is here for certain scenarios where I believe the user must be destroying
2689 // the grid somehow but continuing for it to be used
2690 if (frameworkOverrides && frameworkOverrides.addEventListener) {
2691 frameworkOverrides.addEventListener(eElement, event, listener, options);
2692 }
2693}
2694
2695var EventUtils = /*#__PURE__*/Object.freeze({
2696 stopPropagationForAgGrid: stopPropagationForAgGrid,
2697 isStopPropagationForAgGrid: isStopPropagationForAgGrid,
2698 isEventSupported: isEventSupported,
2699 getCtrlForEvent: getCtrlForEvent,
2700 addChangeListener: addChangeListener,
2701 isElementInEventPath: isElementInEventPath,
2702 createEventPath: createEventPath,
2703 addAgGridEventPath: addAgGridEventPath,
2704 getEventPath: getEventPath,
2705 addSafePassiveEventListener: addSafePassiveEventListener
2706});
2707
2708/**
2709 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
2710 * @version v27.3.0
2711 * @link https://www.ag-grid.com/
2712 * @license MIT
2713 */
2714var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2715 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2716 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2717 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;
2718 return c > 3 && r && Object.defineProperty(target, key, r), r;
2719};
2720var BeanStub = /** @class */ (function () {
2721 function BeanStub() {
2722 var _this = this;
2723 this.destroyFunctions = [];
2724 this.destroyed = false;
2725 // for vue 3 - prevents Vue from trying to make this (and obviously any sub classes) from being reactive
2726 // prevents vue from creating proxies for created objects and prevents identity related issues
2727 this.__v_skip = true;
2728 this.isAlive = function () { return !_this.destroyed; };
2729 }
2730 // this was a test constructor niall built, when active, it prints after 5 seconds all beans/components that are
2731 // not destroyed. to use, create a new grid, then api.destroy() before 5 seconds. then anything that gets printed
2732 // points to a bean or component that was not properly disposed of.
2733 // constructor() {
2734 // setTimeout(()=> {
2735 // if (this.isAlive()) {
2736 // let prototype: any = Object.getPrototypeOf(this);
2737 // const constructor: any = prototype.constructor;
2738 // const constructorString = constructor.toString();
2739 // const beanName = constructorString.substring(9, constructorString.indexOf("("));
2740 // console.log('is alive ' + beanName);
2741 // }
2742 // }, 5000);
2743 // }
2744 // CellComp and GridComp and override this because they get the FrameworkOverrides from the Beans bean
2745 BeanStub.prototype.getFrameworkOverrides = function () {
2746 return this.frameworkOverrides;
2747 };
2748 BeanStub.prototype.getContext = function () {
2749 return this.context;
2750 };
2751 BeanStub.prototype.destroy = function () {
2752 // let prototype: any = Object.getPrototypeOf(this);
2753 // const constructor: any = prototype.constructor;
2754 // const constructorString = constructor.toString();
2755 // const beanName = constructorString.substring(9, constructorString.indexOf("("));
2756 this.destroyFunctions.forEach(function (func) { return func(); });
2757 this.destroyFunctions.length = 0;
2758 this.destroyed = true;
2759 this.dispatchEvent({ type: BeanStub.EVENT_DESTROYED });
2760 };
2761 BeanStub.prototype.addEventListener = function (eventType, listener) {
2762 if (!this.localEventService) {
2763 this.localEventService = new EventService();
2764 }
2765 this.localEventService.addEventListener(eventType, listener);
2766 };
2767 BeanStub.prototype.removeEventListener = function (eventType, listener) {
2768 if (this.localEventService) {
2769 this.localEventService.removeEventListener(eventType, listener);
2770 }
2771 };
2772 BeanStub.prototype.dispatchEventAsync = function (event) {
2773 var _this = this;
2774 window.setTimeout(function () { return _this.dispatchEvent(event); }, 0);
2775 };
2776 BeanStub.prototype.dispatchEvent = function (event) {
2777 if (this.localEventService) {
2778 this.localEventService.dispatchEvent(event);
2779 }
2780 };
2781 BeanStub.prototype.addManagedListener = function (object, event, listener) {
2782 var _this = this;
2783 if (this.destroyed) {
2784 return;
2785 }
2786 if (object instanceof HTMLElement) {
2787 addSafePassiveEventListener(this.getFrameworkOverrides(), object, event, listener);
2788 }
2789 else {
2790 object.addEventListener(event, listener);
2791 }
2792 var destroyFunc = function () {
2793 object.removeEventListener(event, listener);
2794 _this.destroyFunctions = _this.destroyFunctions.filter(function (fn) { return fn !== destroyFunc; });
2795 return null;
2796 };
2797 this.destroyFunctions.push(destroyFunc);
2798 return destroyFunc;
2799 };
2800 BeanStub.prototype.addDestroyFunc = function (func) {
2801 // if we are already destroyed, we execute the func now
2802 if (this.isAlive()) {
2803 this.destroyFunctions.push(func);
2804 }
2805 else {
2806 func();
2807 }
2808 };
2809 BeanStub.prototype.createManagedBean = function (bean, context) {
2810 var res = this.createBean(bean, context);
2811 this.addDestroyFunc(this.destroyBean.bind(this, bean, context));
2812 return res;
2813 };
2814 BeanStub.prototype.createBean = function (bean, context, afterPreCreateCallback) {
2815 return (context || this.getContext()).createBean(bean, afterPreCreateCallback);
2816 };
2817 BeanStub.prototype.destroyBean = function (bean, context) {
2818 return (context || this.getContext()).destroyBean(bean);
2819 };
2820 BeanStub.prototype.destroyBeans = function (beans, context) {
2821 var _this = this;
2822 if (beans) {
2823 beans.forEach(function (bean) { return _this.destroyBean(bean, context); });
2824 }
2825 return [];
2826 };
2827 BeanStub.EVENT_DESTROYED = 'destroyed';
2828 __decorate$3([
2829 Autowired('frameworkOverrides')
2830 ], BeanStub.prototype, "frameworkOverrides", void 0);
2831 __decorate$3([
2832 Autowired('context')
2833 ], BeanStub.prototype, "context", void 0);
2834 __decorate$3([
2835 Autowired('eventService')
2836 ], BeanStub.prototype, "eventService", void 0);
2837 __decorate$3([
2838 Autowired('gridOptionsWrapper')
2839 ], BeanStub.prototype, "gridOptionsWrapper", void 0);
2840 __decorate$3([
2841 PreDestroy
2842 ], BeanStub.prototype, "destroy", null);
2843 return BeanStub;
2844}());
2845
2846/**
2847 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
2848 * @version v27.3.0
2849 * @link https://www.ag-grid.com/
2850 * @license MIT
2851 */
2852var __extends = (undefined && undefined.__extends) || (function () {
2853 var extendStatics = function (d, b) {
2854 extendStatics = Object.setPrototypeOf ||
2855 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
2856 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2857 return extendStatics(d, b);
2858 };
2859 return function (d, b) {
2860 extendStatics(d, b);
2861 function __() { this.constructor = d; }
2862 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2863 };
2864})();
2865var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2866 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2867 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2868 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;
2869 return c > 3 && r && Object.defineProperty(target, key, r), r;
2870};
2871var __param$1 = (undefined && undefined.__param) || function (paramIndex, decorator) {
2872 return function (target, key) { decorator(target, key, paramIndex); }
2873};
2874// takes ColDefs and ColGroupDefs and turns them into Columns and OriginalGroups
2875var ColumnFactory = /** @class */ (function (_super) {
2876 __extends(ColumnFactory, _super);
2877 function ColumnFactory() {
2878 return _super !== null && _super.apply(this, arguments) || this;
2879 }
2880 ColumnFactory.prototype.setBeans = function (loggerFactory) {
2881 this.logger = loggerFactory.create('ColumnFactory');
2882 };
2883 ColumnFactory.prototype.createColumnTree = function (defs, primaryColumns, existingTree) {
2884 // column key creator dishes out unique column id's in a deterministic way,
2885 // so if we have two grids (that could be master/slave) with same column definitions,
2886 // then this ensures the two grids use identical id's.
2887 var columnKeyCreator = new ColumnKeyCreator();
2888 var _a = this.extractExistingTreeData(existingTree), existingCols = _a.existingCols, existingGroups = _a.existingGroups, existingColKeys = _a.existingColKeys;
2889 columnKeyCreator.addExistingKeys(existingColKeys);
2890 // create am unbalanced tree that maps the provided definitions
2891 var unbalancedTree = this.recursivelyCreateColumns(defs, 0, primaryColumns, existingCols, columnKeyCreator, existingGroups);
2892 var treeDept = this.findMaxDept(unbalancedTree, 0);
2893 this.logger.log('Number of levels for grouped columns is ' + treeDept);
2894 var columnTree = this.balanceColumnTree(unbalancedTree, 0, treeDept, columnKeyCreator);
2895 var deptFirstCallback = function (child, parent) {
2896 if (child instanceof ProvidedColumnGroup) {
2897 child.setupExpandable();
2898 }
2899 // we set the original parents at the end, rather than when we go along, as balancing the tree
2900 // adds extra levels into the tree. so we can only set parents when balancing is done.
2901 child.setOriginalParent(parent);
2902 };
2903 this.columnUtils.depthFirstOriginalTreeSearch(null, columnTree, deptFirstCallback);
2904 return {
2905 columnTree: columnTree,
2906 treeDept: treeDept
2907 };
2908 };
2909 ColumnFactory.prototype.extractExistingTreeData = function (existingTree) {
2910 var existingCols = [];
2911 var existingGroups = [];
2912 var existingColKeys = [];
2913 if (existingTree) {
2914 this.columnUtils.depthFirstOriginalTreeSearch(null, existingTree, function (item) {
2915 if (item instanceof ProvidedColumnGroup) {
2916 var group = item;
2917 existingGroups.push(group);
2918 }
2919 else {
2920 var col = item;
2921 existingColKeys.push(col.getId());
2922 existingCols.push(col);
2923 }
2924 });
2925 }
2926 return { existingCols: existingCols, existingGroups: existingGroups, existingColKeys: existingColKeys };
2927 };
2928 ColumnFactory.prototype.createForAutoGroups = function (autoGroupCols, gridBalancedTree) {
2929 var _this = this;
2930 return autoGroupCols.map(function (col) { return _this.createAutoGroupTreeItem(gridBalancedTree, col); });
2931 };
2932 ColumnFactory.prototype.createAutoGroupTreeItem = function (balancedColumnTree, column) {
2933 var dept = this.findDepth(balancedColumnTree);
2934 // at the end, this will be the top of the tree item.
2935 var nextChild = column;
2936 for (var i = dept - 1; i >= 0; i--) {
2937 var autoGroup = new ProvidedColumnGroup(null, "FAKE_PATH_" + column.getId() + "}_" + i, true, i);
2938 this.context.createBean(autoGroup);
2939 autoGroup.setChildren([nextChild]);
2940 nextChild.setOriginalParent(autoGroup);
2941 nextChild = autoGroup;
2942 }
2943 // at this point, the nextChild is the top most item in the tree
2944 return nextChild;
2945 };
2946 ColumnFactory.prototype.findDepth = function (balancedColumnTree) {
2947 var dept = 0;
2948 var pointer = balancedColumnTree;
2949 while (pointer && pointer[0] && pointer[0] instanceof ProvidedColumnGroup) {
2950 dept++;
2951 pointer = pointer[0].getChildren();
2952 }
2953 return dept;
2954 };
2955 ColumnFactory.prototype.balanceColumnTree = function (unbalancedTree, currentDept, columnDept, columnKeyCreator) {
2956 var result = [];
2957 // go through each child, for groups, recurse a level deeper,
2958 // for columns we need to pad
2959 for (var i = 0; i < unbalancedTree.length; i++) {
2960 var child = unbalancedTree[i];
2961 if (child instanceof ProvidedColumnGroup) {
2962 // child is a group, all we do is go to the next level of recursion
2963 var originalGroup = child;
2964 var newChildren = this.balanceColumnTree(originalGroup.getChildren(), currentDept + 1, columnDept, columnKeyCreator);
2965 originalGroup.setChildren(newChildren);
2966 result.push(originalGroup);
2967 }
2968 else {
2969 // child is a column - so here we add in the padded column groups if needed
2970 var firstPaddedGroup = void 0;
2971 var currentPaddedGroup = void 0;
2972 // this for loop will NOT run any loops if no padded column groups are needed
2973 for (var j = columnDept - 1; j >= currentDept; j--) {
2974 var newColId = columnKeyCreator.getUniqueKey(null, null);
2975 var colGroupDefMerged = this.createMergedColGroupDef(null);
2976 var paddedGroup = new ProvidedColumnGroup(colGroupDefMerged, newColId, true, currentDept);
2977 this.context.createBean(paddedGroup);
2978 if (currentPaddedGroup) {
2979 currentPaddedGroup.setChildren([paddedGroup]);
2980 }
2981 currentPaddedGroup = paddedGroup;
2982 if (!firstPaddedGroup) {
2983 firstPaddedGroup = currentPaddedGroup;
2984 }
2985 }
2986 // likewise this if statement will not run if no padded groups
2987 if (firstPaddedGroup && currentPaddedGroup) {
2988 result.push(firstPaddedGroup);
2989 var hasGroups = unbalancedTree.some(function (leaf) { return leaf instanceof ProvidedColumnGroup; });
2990 if (hasGroups) {
2991 currentPaddedGroup.setChildren([child]);
2992 continue;
2993 }
2994 else {
2995 currentPaddedGroup.setChildren(unbalancedTree);
2996 break;
2997 }
2998 }
2999 result.push(child);
3000 }
3001 }
3002 return result;
3003 };
3004 ColumnFactory.prototype.findMaxDept = function (treeChildren, dept) {
3005 var maxDeptThisLevel = dept;
3006 for (var i = 0; i < treeChildren.length; i++) {
3007 var abstractColumn = treeChildren[i];
3008 if (abstractColumn instanceof ProvidedColumnGroup) {
3009 var originalGroup = abstractColumn;
3010 var newDept = this.findMaxDept(originalGroup.getChildren(), dept + 1);
3011 if (maxDeptThisLevel < newDept) {
3012 maxDeptThisLevel = newDept;
3013 }
3014 }
3015 }
3016 return maxDeptThisLevel;
3017 };
3018 ColumnFactory.prototype.recursivelyCreateColumns = function (defs, level, primaryColumns, existingColsCopy, columnKeyCreator, existingGroups) {
3019 var _this = this;
3020 return (defs || []).map(function (def) {
3021 if (_this.isColumnGroup(def)) {
3022 return _this.createColumnGroup(primaryColumns, def, level, existingColsCopy, columnKeyCreator, existingGroups);
3023 }
3024 else {
3025 return _this.createColumn(primaryColumns, def, existingColsCopy, columnKeyCreator);
3026 }
3027 });
3028 };
3029 ColumnFactory.prototype.createColumnGroup = function (primaryColumns, colGroupDef, level, existingColumns, columnKeyCreator, existingGroups) {
3030 var colGroupDefMerged = this.createMergedColGroupDef(colGroupDef);
3031 var groupId = columnKeyCreator.getUniqueKey(colGroupDefMerged.groupId || null, null);
3032 var providedGroup = new ProvidedColumnGroup(colGroupDefMerged, groupId, false, level);
3033 this.context.createBean(providedGroup);
3034 var existingGroup = this.findExistingGroup(colGroupDef, existingGroups);
3035 // make sure we remove, so if user provided duplicate id, then we don't have more than
3036 // one column instance for colDef with common id
3037 if (existingGroup) {
3038 removeFromArray(existingGroups, existingGroup);
3039 }
3040 if (existingGroup && existingGroup.isExpanded()) {
3041 providedGroup.setExpanded(true);
3042 }
3043 var children = this.recursivelyCreateColumns(colGroupDefMerged.children, level + 1, primaryColumns, existingColumns, columnKeyCreator, existingGroups);
3044 providedGroup.setChildren(children);
3045 return providedGroup;
3046 };
3047 ColumnFactory.prototype.createMergedColGroupDef = function (colGroupDef) {
3048 var colGroupDefMerged = {};
3049 Object.assign(colGroupDefMerged, this.gridOptionsWrapper.getDefaultColGroupDef());
3050 Object.assign(colGroupDefMerged, colGroupDef);
3051 this.checkForDeprecatedItems(colGroupDefMerged);
3052 return colGroupDefMerged;
3053 };
3054 ColumnFactory.prototype.createColumn = function (primaryColumns, colDef, existingColsCopy, columnKeyCreator) {
3055 var colDefMerged = this.mergeColDefs(colDef);
3056 this.checkForDeprecatedItems(colDefMerged);
3057 // see if column already exists
3058 var column = this.findExistingColumn(colDef, existingColsCopy);
3059 // make sure we remove, so if user provided duplicate id, then we don't have more than
3060 // one column instance for colDef with common id
3061 if (existingColsCopy && column) {
3062 removeFromArray(existingColsCopy, column);
3063 }
3064 if (!column) {
3065 // no existing column, need to create one
3066 var colId = columnKeyCreator.getUniqueKey(colDefMerged.colId, colDefMerged.field);
3067 column = new Column(colDefMerged, colDef, colId, primaryColumns);
3068 this.context.createBean(column);
3069 }
3070 else {
3071 column.setColDef(colDefMerged, colDef);
3072 this.applyColumnState(column, colDefMerged);
3073 }
3074 return column;
3075 };
3076 ColumnFactory.prototype.applyColumnState = function (column, colDef) {
3077 // flex
3078 var flex = attrToNumber(colDef.flex);
3079 if (flex !== undefined) {
3080 column.setFlex(flex);
3081 }
3082 // width - we only set width if column is not flexing
3083 var noFlexThisCol = column.getFlex() <= 0;
3084 if (noFlexThisCol) {
3085 // both null and undefined means we skip, as it's not possible to 'clear' width (a column must have a width)
3086 var width = attrToNumber(colDef.width);
3087 if (width != null) {
3088 column.setActualWidth(width);
3089 }
3090 else {
3091 // otherwise set the width again, in case min or max width has changed,
3092 // and width needs to be adjusted.
3093 var widthBeforeUpdate = column.getActualWidth();
3094 column.setActualWidth(widthBeforeUpdate);
3095 }
3096 }
3097 // sort - anything but undefined will set sort, thus null or empty string will clear the sort
3098 if (colDef.sort !== undefined) {
3099 if (colDef.sort == Constants.SORT_ASC || colDef.sort == Constants.SORT_DESC) {
3100 column.setSort(colDef.sort);
3101 }
3102 else {
3103 column.setSort(undefined);
3104 }
3105 }
3106 // sorted at - anything but undefined, thus null will clear the sortIndex
3107 var sortIndex = attrToNumber(colDef.sortIndex);
3108 if (sortIndex !== undefined) {
3109 column.setSortIndex(sortIndex);
3110 }
3111 // hide - anything but undefined, thus null will clear the hide
3112 var hide = attrToBoolean(colDef.hide);
3113 if (hide !== undefined) {
3114 column.setVisible(!hide);
3115 }
3116 // pinned - anything but undefined, thus null or empty string will remove pinned
3117 if (colDef.pinned !== undefined) {
3118 column.setPinned(colDef.pinned);
3119 }
3120 };
3121 ColumnFactory.prototype.findExistingColumn = function (newColDef, existingColsCopy) {
3122 return (existingColsCopy || []).find(function (existingCol) {
3123 var existingColDef = existingCol.getUserProvidedColDef();
3124 if (!existingColDef) {
3125 return false;
3126 }
3127 var newHasId = newColDef.colId != null;
3128 var newHasField = newColDef.field != null;
3129 if (newHasId) {
3130 return existingCol.getId() === newColDef.colId;
3131 }
3132 if (newHasField) {
3133 return existingColDef.field === newColDef.field;
3134 }
3135 // if no id or field present, then try object equivalence.
3136 if (existingColDef === newColDef) {
3137 return true;
3138 }
3139 return false;
3140 });
3141 };
3142 ColumnFactory.prototype.findExistingGroup = function (newGroupDef, existingGroups) {
3143 return existingGroups.find(function (existingGroup) {
3144 var existingDef = existingGroup.getColGroupDef();
3145 if (!existingDef) {
3146 return false;
3147 }
3148 var newHasId = newGroupDef.groupId != null;
3149 if (newHasId) {
3150 return existingGroup.getId() === newGroupDef.groupId;
3151 }
3152 return false;
3153 });
3154 };
3155 ColumnFactory.prototype.mergeColDefs = function (colDef) {
3156 // start with empty merged definition
3157 var colDefMerged = {};
3158 // merge properties from default column definitions
3159 var defaultColDef = this.gridOptionsWrapper.getDefaultColDef();
3160 mergeDeep(colDefMerged, defaultColDef, false, true);
3161 // merge properties from column type properties
3162 var columnType = colDef.type;
3163 if (!columnType) {
3164 columnType = defaultColDef && defaultColDef.type;
3165 }
3166 // if type of both colDef and defaultColDef, then colDef gets preference
3167 if (columnType) {
3168 this.assignColumnTypes(columnType, colDefMerged);
3169 }
3170 // merge properties from column definitions
3171 mergeDeep(colDefMerged, colDef, false, true);
3172 return colDefMerged;
3173 };
3174 ColumnFactory.prototype.assignColumnTypes = function (type, colDefMerged) {
3175 var typeKeys = [];
3176 if (type instanceof Array) {
3177 var invalidArray = type.some(function (a) { return typeof a !== 'string'; });
3178 if (invalidArray) {
3179 console.warn("AG Grid: if colDef.type is supplied an array it should be of type 'string[]'");
3180 }
3181 else {
3182 typeKeys = type;
3183 }
3184 }
3185 else if (typeof type === 'string') {
3186 typeKeys = type.split(',');
3187 }
3188 else {
3189 console.warn("AG Grid: colDef.type should be of type 'string' | 'string[]'");
3190 return;
3191 }
3192 // merge user defined with default column types
3193 var allColumnTypes = Object.assign({}, DefaultColumnTypes);
3194 var userTypes = this.gridOptionsWrapper.getColumnTypes() || {};
3195 iterateObject(userTypes, function (key, value) {
3196 if (key in allColumnTypes) {
3197 console.warn("AG Grid: the column type '" + key + "' is a default column type and cannot be overridden.");
3198 }
3199 else {
3200 allColumnTypes[key] = value;
3201 }
3202 });
3203 typeKeys.forEach(function (t) {
3204 var typeColDef = allColumnTypes[t.trim()];
3205 if (typeColDef) {
3206 mergeDeep(colDefMerged, typeColDef, false, true);
3207 }
3208 else {
3209 console.warn("AG Grid: colDef.type '" + t + "' does not correspond to defined gridOptions.columnTypes");
3210 }
3211 });
3212 };
3213 ColumnFactory.prototype.checkForDeprecatedItems = function (colDef) {
3214 if (colDef) {
3215 var colDefNoType = colDef; // take out the type, so we can access attributes not defined in the type
3216 if (colDefNoType.group !== undefined) {
3217 console.warn('AG Grid: colDef.group is invalid, please check documentation on how to do grouping as it changed in version 3');
3218 }
3219 if (colDefNoType.headerGroup !== undefined) {
3220 console.warn('AG Grid: colDef.headerGroup is invalid, please check documentation on how to do grouping as it changed in version 3');
3221 }
3222 if (colDefNoType.headerGroupShow !== undefined) {
3223 console.warn('AG Grid: colDef.headerGroupShow is invalid, should be columnGroupShow, please check documentation on how to do grouping as it changed in version 3');
3224 }
3225 if (colDefNoType.suppressRowGroup !== undefined) {
3226 console.warn('AG Grid: colDef.suppressRowGroup is deprecated, please use colDef.type instead');
3227 }
3228 if (colDefNoType.suppressAggregation !== undefined) {
3229 console.warn('AG Grid: colDef.suppressAggregation is deprecated, please use colDef.type instead');
3230 }
3231 if (colDefNoType.suppressRowGroup || colDefNoType.suppressAggregation) {
3232 console.warn('AG Grid: colDef.suppressAggregation and colDef.suppressRowGroup are deprecated, use allowRowGroup, allowPivot and allowValue instead');
3233 }
3234 if (colDefNoType.displayName) {
3235 console.warn("AG Grid: Found displayName " + colDefNoType.displayName + ", please use headerName instead, displayName is deprecated.");
3236 colDefNoType.headerName = colDefNoType.displayName;
3237 }
3238 }
3239 };
3240 // if object has children, we assume it's a group
3241 ColumnFactory.prototype.isColumnGroup = function (abstractColDef) {
3242 return abstractColDef.children !== undefined;
3243 };
3244 __decorate$4([
3245 Autowired('columnUtils')
3246 ], ColumnFactory.prototype, "columnUtils", void 0);
3247 __decorate$4([
3248 __param$1(0, Qualifier('loggerFactory'))
3249 ], ColumnFactory.prototype, "setBeans", null);
3250 ColumnFactory = __decorate$4([
3251 Bean('columnFactory')
3252 ], ColumnFactory);
3253 return ColumnFactory;
3254}(BeanStub));
3255
3256/**
3257 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
3258 * @version v27.3.0
3259 * @link https://www.ag-grid.com/
3260 * @license MIT
3261 */
3262var Events = /** @class */ (function () {
3263 function Events() {
3264 }
3265 /** Everything has changed with the columns. Either complete new set of columns set, or user called setState() */
3266 /** @deprecated - grid no longer uses this, and setSate() also fires individual events */
3267 Events.EVENT_COLUMN_EVERYTHING_CHANGED = 'columnEverythingChanged';
3268 /** User has set in new columns. */
3269 Events.EVENT_NEW_COLUMNS_LOADED = 'newColumnsLoaded';
3270 /** The pivot mode flag was changed */
3271 Events.EVENT_COLUMN_PIVOT_MODE_CHANGED = 'columnPivotModeChanged';
3272 /** A row group column was added, removed or order changed. */
3273 Events.EVENT_COLUMN_ROW_GROUP_CHANGED = 'columnRowGroupChanged';
3274 /** expandAll / collapseAll was called from the api. */
3275 Events.EVENT_EXPAND_COLLAPSE_ALL = 'expandOrCollapseAll';
3276 /** A pivot column was added, removed or order changed. */
3277 Events.EVENT_COLUMN_PIVOT_CHANGED = 'columnPivotChanged';
3278 /** The list of grid columns has changed. */
3279 Events.EVENT_GRID_COLUMNS_CHANGED = 'gridColumnsChanged';
3280 /** A value column was added, removed or agg function was changed. */
3281 Events.EVENT_COLUMN_VALUE_CHANGED = 'columnValueChanged';
3282 /** A column was moved */
3283 Events.EVENT_COLUMN_MOVED = 'columnMoved';
3284 /** One or more columns was shown / hidden */
3285 Events.EVENT_COLUMN_VISIBLE = 'columnVisible';
3286 /** One or more columns was pinned / unpinned*/
3287 Events.EVENT_COLUMN_PINNED = 'columnPinned';
3288 /** A column group was opened / closed */
3289 Events.EVENT_COLUMN_GROUP_OPENED = 'columnGroupOpened';
3290 /** One or more columns was resized. If just one, the column in the event is set. */
3291 Events.EVENT_COLUMN_RESIZED = 'columnResized';
3292 /** The list of displayed columns has changed, can result from columns open / close, column move, pivot, group, etc */
3293 Events.EVENT_DISPLAYED_COLUMNS_CHANGED = 'displayedColumnsChanged';
3294 /** The list of virtual columns has changed, results from viewport changing */
3295 Events.EVENT_VIRTUAL_COLUMNS_CHANGED = 'virtualColumnsChanged';
3296 /** Async Transactions Executed */
3297 Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED = 'asyncTransactionsFlushed';
3298 /** A row group was opened / closed */
3299 Events.EVENT_ROW_GROUP_OPENED = 'rowGroupOpened';
3300 /** The client has set new data into the grid */
3301 Events.EVENT_ROW_DATA_CHANGED = 'rowDataChanged';
3302 /** The client has updated data for the grid */
3303 Events.EVENT_ROW_DATA_UPDATED = 'rowDataUpdated';
3304 /** The client has set new floating data into the grid */
3305 Events.EVENT_PINNED_ROW_DATA_CHANGED = 'pinnedRowDataChanged';
3306 /** Range selection has changed */
3307 Events.EVENT_RANGE_SELECTION_CHANGED = 'rangeSelectionChanged';
3308 /** Chart was created */
3309 Events.EVENT_CHART_CREATED = 'chartCreated';
3310 /** Chart Range selection has changed */
3311 Events.EVENT_CHART_RANGE_SELECTION_CHANGED = 'chartRangeSelectionChanged';
3312 /** Chart Options have changed */
3313 Events.EVENT_CHART_OPTIONS_CHANGED = 'chartOptionsChanged';
3314 /** Chart was destroyed */
3315 Events.EVENT_CHART_DESTROYED = 'chartDestroyed';
3316 /** For when the tool panel is shown / hidden */
3317 Events.EVENT_TOOL_PANEL_VISIBLE_CHANGED = 'toolPanelVisibleChanged';
3318 Events.EVENT_COLUMN_PANEL_ITEM_DRAG_START = 'columnPanelItemDragStart';
3319 Events.EVENT_COLUMN_PANEL_ITEM_DRAG_END = 'columnPanelItemDragEnd';
3320 /** Model was updated - grid updates the drawn rows when this happens */
3321 Events.EVENT_MODEL_UPDATED = 'modelUpdated';
3322 Events.EVENT_PASTE_START = 'pasteStart';
3323 Events.EVENT_PASTE_END = 'pasteEnd';
3324 Events.EVENT_FILL_START = 'fillStart';
3325 Events.EVENT_FILL_END = 'fillEnd';
3326 Events.EVENT_CELL_CLICKED = 'cellClicked';
3327 Events.EVENT_CELL_DOUBLE_CLICKED = 'cellDoubleClicked';
3328 Events.EVENT_CELL_MOUSE_DOWN = 'cellMouseDown';
3329 Events.EVENT_CELL_CONTEXT_MENU = 'cellContextMenu';
3330 Events.EVENT_CELL_VALUE_CHANGED = 'cellValueChanged';
3331 Events.EVENT_CELL_EDIT_REQUEST = 'cellEditRequest';
3332 Events.EVENT_ROW_VALUE_CHANGED = 'rowValueChanged';
3333 Events.EVENT_CELL_FOCUSED = 'cellFocused';
3334 Events.EVENT_FULL_WIDTH_ROW_FOCUSED = 'fullWidthRowFocused';
3335 Events.EVENT_ROW_SELECTED = 'rowSelected';
3336 Events.EVENT_SELECTION_CHANGED = 'selectionChanged';
3337 Events.EVENT_CELL_KEY_DOWN = 'cellKeyDown';
3338 Events.EVENT_CELL_KEY_PRESS = 'cellKeyPress';
3339 Events.EVENT_CELL_MOUSE_OVER = 'cellMouseOver';
3340 Events.EVENT_CELL_MOUSE_OUT = 'cellMouseOut';
3341 /** 2 events for filtering. The grid LISTENS for filterChanged and afterFilterChanged */
3342 Events.EVENT_FILTER_CHANGED = 'filterChanged';
3343 /** Filter was change but not applied. Only useful if apply buttons are used in filters. */
3344 Events.EVENT_FILTER_MODIFIED = 'filterModified';
3345 Events.EVENT_FILTER_OPENED = 'filterOpened';
3346 Events.EVENT_SORT_CHANGED = 'sortChanged';
3347 /** A row was removed from the dom, for any reason. Use to clean up resources (if any) used by the row. */
3348 Events.EVENT_VIRTUAL_ROW_REMOVED = 'virtualRowRemoved';
3349 Events.EVENT_ROW_CLICKED = 'rowClicked';
3350 Events.EVENT_ROW_DOUBLE_CLICKED = 'rowDoubleClicked';
3351 /** Gets called once after the grid has finished initialising. */
3352 Events.EVENT_GRID_READY = 'gridReady';
3353 /** Width of height of the main grid div has changed. Grid listens for this and does layout of grid if it's
3354 * changed, so always filling the space it was given. */
3355 Events.EVENT_GRID_SIZE_CHANGED = 'gridSizeChanged';
3356 /** The indexes of the rows rendered has changed, eg user has scrolled to a new vertical position. */
3357 Events.EVENT_VIEWPORT_CHANGED = 'viewportChanged';
3358 /* The width of the scrollbar has been calculated */
3359 Events.EVENT_SCROLLBAR_WIDTH_CHANGED = 'scrollbarWidthChanged';
3360 /** Rows were rendered for the first time (ie on async data load). */
3361 Events.EVENT_FIRST_DATA_RENDERED = 'firstDataRendered';
3362 /** A column drag has started, either resizing a column or moving a column. */
3363 Events.EVENT_DRAG_STARTED = 'dragStarted';
3364 /** A column drag has stopped */
3365 Events.EVENT_DRAG_STOPPED = 'dragStopped';
3366 Events.EVENT_CHECKBOX_CHANGED = 'checkboxChanged';
3367 Events.EVENT_ROW_EDITING_STARTED = 'rowEditingStarted';
3368 Events.EVENT_ROW_EDITING_STOPPED = 'rowEditingStopped';
3369 Events.EVENT_CELL_EDITING_STARTED = 'cellEditingStarted';
3370 Events.EVENT_CELL_EDITING_STOPPED = 'cellEditingStopped';
3371 /** Main body of grid has scrolled, either horizontally or vertically */
3372 Events.EVENT_BODY_SCROLL = 'bodyScroll';
3373 /** Main body of the grid has stopped scrolling, either horizontally or vertically */
3374 Events.EVENT_BODY_SCROLL_END = 'bodyScrollEnd';
3375 Events.EVENT_HEIGHT_SCALE_CHANGED = 'heightScaleChanged';
3376 /** The displayed page for pagination has changed. For example the data was filtered or sorted,
3377 * or the user has moved to a different page. */
3378 Events.EVENT_PAGINATION_CHANGED = 'paginationChanged';
3379 /** Only used by React, Angular, Web Components and VueJS AG Grid components
3380 * (not used if doing plain JavaScript). If the grid receives changes due
3381 * to bound properties, this event fires after the grid has finished processing the change. */
3382 Events.EVENT_COMPONENT_STATE_CHANGED = 'componentStateChanged';
3383 /***************************** INTERNAL EVENTS: START ******************************************* */
3384 /** Please remember to add to ComponentUtil.EXCLUDED_INTERNAL_EVENTS to not have these events exposed to framework components. */
3385 /** All items from here down are used internally by the grid, not intended for external use. */
3386 // not documented, either experimental, or we just don't want users using an depending on them
3387 Events.EVENT_BODY_HEIGHT_CHANGED = 'bodyHeightChanged';
3388 Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED = 'displayedColumnsWidthChanged';
3389 Events.EVENT_SCROLL_VISIBILITY_CHANGED = 'scrollVisibilityChanged';
3390 Events.EVENT_COLUMN_HOVER_CHANGED = 'columnHoverChanged';
3391 Events.EVENT_FLASH_CELLS = 'flashCells';
3392 Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED = 'paginationPixelOffsetChanged';
3393 Events.EVENT_DISPLAYED_ROWS_CHANGED = 'displayedRowsChanged';
3394 Events.EVENT_LEFT_PINNED_WIDTH_CHANGED = 'leftPinnedWidthChanged';
3395 Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED = 'rightPinnedWidthChanged';
3396 Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED = 'rowContainerHeightChanged';
3397 Events.EVENT_ROW_DRAG_ENTER = 'rowDragEnter';
3398 Events.EVENT_ROW_DRAG_MOVE = 'rowDragMove';
3399 Events.EVENT_ROW_DRAG_LEAVE = 'rowDragLeave';
3400 Events.EVENT_ROW_DRAG_END = 'rowDragEnd';
3401 // primarily for charts
3402 Events.EVENT_POPUP_TO_FRONT = 'popupToFront';
3403 // these are used for server side group and agg - only used by CS with Viewport Row Model - intention is
3404 // to design these better around server side functions and then release to general public when fully working with
3405 // all the row models.
3406 Events.EVENT_COLUMN_ROW_GROUP_CHANGE_REQUEST = 'columnRowGroupChangeRequest';
3407 Events.EVENT_COLUMN_PIVOT_CHANGE_REQUEST = 'columnPivotChangeRequest';
3408 Events.EVENT_COLUMN_VALUE_CHANGE_REQUEST = 'columnValueChangeRequest';
3409 Events.EVENT_COLUMN_AGG_FUNC_CHANGE_REQUEST = 'columnAggFuncChangeRequest';
3410 Events.EVENT_KEYBOARD_FOCUS = 'keyboardFocus';
3411 Events.EVENT_MOUSE_FOCUS = 'mouseFocus';
3412 Events.EVENT_STORE_UPDATED = 'storeUpdated';
3413 return Events;
3414}());
3415
3416/**
3417 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
3418 * @version v27.3.0
3419 * @link https://www.ag-grid.com/
3420 * @license MIT
3421 */
3422// class returns unique instance id's for columns.
3423// eg, the following calls (in this order) will result in:
3424//
3425// getInstanceIdForKey('country') => 0
3426// getInstanceIdForKey('country') => 1
3427// getInstanceIdForKey('country') => 2
3428// getInstanceIdForKey('country') => 3
3429// getInstanceIdForKey('age') => 0
3430// getInstanceIdForKey('age') => 1
3431// getInstanceIdForKey('country') => 4
3432var GroupInstanceIdCreator = /** @class */ (function () {
3433 function GroupInstanceIdCreator() {
3434 // this map contains keys to numbers, so we remember what the last call was
3435 this.existingIds = {};
3436 }
3437 GroupInstanceIdCreator.prototype.getInstanceIdForKey = function (key) {
3438 var lastResult = this.existingIds[key];
3439 var result;
3440 if (typeof lastResult !== 'number') {
3441 // first time this key
3442 result = 0;
3443 }
3444 else {
3445 result = lastResult + 1;
3446 }
3447 this.existingIds[key] = result;
3448 return result;
3449 };
3450 return GroupInstanceIdCreator;
3451}());
3452
3453/**
3454 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
3455 * @version v27.3.0
3456 * @link https://www.ag-grid.com/
3457 * @license MIT
3458 */
3459var reUnescapedHtml = /[&<>"']/g;
3460/**
3461 * HTML Escapes.
3462 */
3463var HTML_ESCAPES = {
3464 '&': '&amp;',
3465 '<': '&lt;',
3466 '>': '&gt;',
3467 '"': '&quot;',
3468 "'": '&#39;'
3469};
3470/**
3471 * It encodes any string in UTF-8 format
3472 * taken from https://github.com/mathiasbynens/utf8.js
3473 * @param {string} s
3474 * @returns {string}
3475 */
3476function utf8_encode(s) {
3477 var stringFromCharCode = String.fromCharCode;
3478 function ucs2decode(string) {
3479 var output = [];
3480 if (!string) {
3481 return [];
3482 }
3483 var len = string.length;
3484 var counter = 0;
3485 var value;
3486 var extra;
3487 while (counter < len) {
3488 value = string.charCodeAt(counter++);
3489 if (value >= 0xD800 && value <= 0xDBFF && counter < len) {
3490 // high surrogate, and there is a next character
3491 extra = string.charCodeAt(counter++);
3492 if ((extra & 0xFC00) == 0xDC00) { // low surrogate
3493 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
3494 }
3495 else {
3496 // unmatched surrogate; only append this code unit, in case the next
3497 // code unit is the high surrogate of a surrogate pair
3498 output.push(value);
3499 counter--;
3500 }
3501 }
3502 else {
3503 output.push(value);
3504 }
3505 }
3506 return output;
3507 }
3508 function checkScalarValue(point) {
3509 if (point >= 0xD800 && point <= 0xDFFF) {
3510 throw Error('Lone surrogate U+' + point.toString(16).toUpperCase() +
3511 ' is not a scalar value');
3512 }
3513 }
3514 function createByte(point, shift) {
3515 return stringFromCharCode(((point >> shift) & 0x3F) | 0x80);
3516 }
3517 function encodeCodePoint(point) {
3518 if ((point >= 0 && point <= 31 && point !== 10)) {
3519 var convertedCode = point.toString(16).toUpperCase();
3520 var paddedCode = convertedCode.padStart(4, '0');
3521 return "_x" + paddedCode + "_";
3522 }
3523 if ((point & 0xFFFFFF80) == 0) { // 1-byte sequence
3524 return stringFromCharCode(point);
3525 }
3526 var symbol = '';
3527 if ((point & 0xFFFFF800) == 0) { // 2-byte sequence
3528 symbol = stringFromCharCode(((point >> 6) & 0x1F) | 0xC0);
3529 }
3530 else if ((point & 0xFFFF0000) == 0) { // 3-byte sequence
3531 checkScalarValue(point);
3532 symbol = stringFromCharCode(((point >> 12) & 0x0F) | 0xE0);
3533 symbol += createByte(point, 6);
3534 }
3535 else if ((point & 0xFFE00000) == 0) { // 4-byte sequence
3536 symbol = stringFromCharCode(((point >> 18) & 0x07) | 0xF0);
3537 symbol += createByte(point, 12);
3538 symbol += createByte(point, 6);
3539 }
3540 symbol += stringFromCharCode((point & 0x3F) | 0x80);
3541 return symbol;
3542 }
3543 var codePoints = ucs2decode(s);
3544 var length = codePoints.length;
3545 var index = -1;
3546 var codePoint;
3547 var byteString = '';
3548 while (++index < length) {
3549 codePoint = codePoints[index];
3550 byteString += encodeCodePoint(codePoint);
3551 }
3552 return byteString;
3553}
3554/**
3555 * Converts a camelCase string into hyphenated string
3556 * from https://gist.github.com/youssman/745578062609e8acac9f
3557 * @param {string} str
3558 * @return {string}
3559 */
3560function camelCaseToHyphen(str) {
3561 if (str === null || str === undefined) {
3562 return null;
3563 }
3564 return str.replace(/([A-Z])/g, function (g) { return '-' + g[0].toLowerCase(); });
3565}
3566/**
3567 * Converts a hyphenated string into camelCase string
3568 * from https://stackoverflow.com/questions/6660977/convert-hyphens-to-camel-case-camelcase
3569 * @param {string} str
3570 * @return {string}
3571 */
3572function hyphenToCamelCase(str) {
3573 if (str === null || str === undefined) {
3574 return null;
3575 }
3576 return str.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
3577}
3578function capitalise(str) {
3579 return str[0].toUpperCase() + str.substr(1).toLowerCase();
3580}
3581function escapeString(toEscape) {
3582 // we call toString() twice, in case value is an object, where user provides
3583 // a toString() method, and first call to toString() returns back something other
3584 // than a string (eg a number to render)
3585 return toEscape == null ? null : toEscape.toString().toString().replace(reUnescapedHtml, function (chr) { return HTML_ESCAPES[chr]; });
3586}
3587/**
3588 * Converts a camelCase string into regular text
3589 * from: https://stackoverflow.com/questions/15369566/putting-space-in-camel-case-string-using-regular-expression
3590 * @param {string} camelCase
3591 * @return {string}
3592 */
3593function camelCaseToHumanText(camelCase) {
3594 if (!camelCase || camelCase == null) {
3595 return null;
3596 }
3597 var rex = /([A-Z])([A-Z])([a-z])|([a-z])([A-Z])/g;
3598 var words = camelCase.replace(rex, '$1$4 $2$3$5').replace('.', ' ').split(' ');
3599 return words.map(function (word) { return word.substring(0, 1).toUpperCase() + ((word.length > 1) ? word.substring(1, word.length) : ''); }).join(' ');
3600}
3601
3602var StringUtils = /*#__PURE__*/Object.freeze({
3603 utf8_encode: utf8_encode,
3604 camelCaseToHyphen: camelCaseToHyphen,
3605 hyphenToCamelCase: hyphenToCamelCase,
3606 capitalise: capitalise,
3607 escapeString: escapeString,
3608 camelCaseToHumanText: camelCaseToHumanText
3609});
3610
3611/**
3612 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
3613 * @version v27.3.0
3614 * @link https://www.ag-grid.com/
3615 * @license MIT
3616 */
3617function convertToMap(arr) {
3618 var map = new Map();
3619 arr.forEach(function (pair) { return map.set(pair[0], pair[1]); });
3620 return map;
3621}
3622// handy for organising a list into a map, where each item is mapped by an attribute, eg mapping Columns by ID
3623function mapById(arr, callback) {
3624 var map = new Map();
3625 arr.forEach(function (item) { return map.set(callback(item), item); });
3626 return map;
3627}
3628function keys(map) {
3629 var arr = [];
3630 map.forEach(function (_, key) { return arr.push(key); });
3631 return arr;
3632}
3633
3634var MapUtils = /*#__PURE__*/Object.freeze({
3635 convertToMap: convertToMap,
3636 mapById: mapById,
3637 keys: keys
3638});
3639
3640/**
3641 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
3642 * @version v27.3.0
3643 * @link https://www.ag-grid.com/
3644 * @license MIT
3645 */
3646var __extends$1 = (undefined && undefined.__extends) || (function () {
3647 var extendStatics = function (d, b) {
3648 extendStatics = Object.setPrototypeOf ||
3649 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3650 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3651 return extendStatics(d, b);
3652 };
3653 return function (d, b) {
3654 extendStatics(d, b);
3655 function __() { this.constructor = d; }
3656 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3657 };
3658})();
3659var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3660 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3661 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3662 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;
3663 return c > 3 && r && Object.defineProperty(target, key, r), r;
3664};
3665var __param$2 = (undefined && undefined.__param) || function (paramIndex, decorator) {
3666 return function (target, key) { decorator(target, key, paramIndex); }
3667};
3668var __values = (undefined && undefined.__values) || function(o) {
3669 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3670 if (m) return m.call(o);
3671 if (o && typeof o.length === "number") return {
3672 next: function () {
3673 if (o && i >= o.length) o = void 0;
3674 return { value: o && o[i++], done: !o };
3675 }
3676 };
3677 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3678};
3679var __read = (undefined && undefined.__read) || function (o, n) {
3680 var m = typeof Symbol === "function" && o[Symbol.iterator];
3681 if (!m) return o;
3682 var i = m.call(o), r, ar = [], e;
3683 try {
3684 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
3685 }
3686 catch (error) { e = { error: error }; }
3687 finally {
3688 try {
3689 if (r && !r.done && (m = i["return"])) m.call(i);
3690 }
3691 finally { if (e) throw e.error; }
3692 }
3693 return ar;
3694};
3695var __spread = (undefined && undefined.__spread) || function () {
3696 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
3697 return ar;
3698};
3699var ColumnModel = /** @class */ (function (_super) {
3700 __extends$1(ColumnModel, _super);
3701 function ColumnModel() {
3702 var _this = _super !== null && _super.apply(this, arguments) || this;
3703 // header row count, based on user provided columns
3704 _this.primaryHeaderRowCount = 0;
3705 _this.secondaryHeaderRowCount = 0;
3706 // header row count, either above, or based on pivoting if we are pivoting
3707 _this.gridHeaderRowCount = 0;
3708 // leave level columns of the displayed trees
3709 _this.displayedColumnsLeft = [];
3710 _this.displayedColumnsRight = [];
3711 _this.displayedColumnsCenter = [];
3712 // all three lists above combined
3713 _this.displayedColumns = [];
3714 // for fast lookup, to see if a column or group is still displayed
3715 _this.displayedColumnsAndGroupsMap = {};
3716 // all columns to be rendered
3717 _this.viewportColumns = [];
3718 // all columns to be rendered in the centre
3719 _this.viewportColumnsCenter = [];
3720 _this.autoHeightActiveAtLeastOnce = false;
3721 _this.rowGroupColumns = [];
3722 _this.valueColumns = [];
3723 _this.pivotColumns = [];
3724 _this.ready = false;
3725 _this.autoGroupsNeedBuilding = false;
3726 _this.forceRecreateAutoGroups = false;
3727 _this.pivotMode = false;
3728 _this.bodyWidth = 0;
3729 _this.leftWidth = 0;
3730 _this.rightWidth = 0;
3731 _this.bodyWidthDirty = true;
3732 _this.colDefVersion = 0;
3733 _this.flexColsCalculatedAtLestOnce = false;
3734 return _this;
3735 }
3736 ColumnModel.prototype.init = function () {
3737 var _this = this;
3738 this.suppressColumnVirtualisation = this.gridOptionsWrapper.isSuppressColumnVirtualisation();
3739 var pivotMode = this.gridOptionsWrapper.isPivotMode();
3740 if (this.isPivotSettingAllowed(pivotMode)) {
3741 this.pivotMode = pivotMode;
3742 }
3743 this.usingTreeData = this.gridOptionsWrapper.isTreeData();
3744 this.addManagedListener(this.gridOptionsWrapper, 'autoGroupColumnDef', function () { return _this.onAutoGroupColumnDefChanged(); });
3745 this.addManagedListener(this.gridOptionsWrapper, 'defaultColDef', function () { return _this.onDefaultColDefChanged(); });
3746 };
3747 ColumnModel.prototype.onAutoGroupColumnDefChanged = function () {
3748 this.autoGroupsNeedBuilding = true;
3749 this.forceRecreateAutoGroups = true;
3750 this.updateGridColumns();
3751 this.updateDisplayedColumns('gridOptionsChanged');
3752 };
3753 ColumnModel.prototype.onDefaultColDefChanged = function () {
3754 // col def's should get revisited, even if specific column hasn't changed,
3755 // as the defaultColDef impacts all columns, so each column should assume it's Col Def has changed.
3756 this.colDefVersion++;
3757 // likewise for autoGroupCol, the default col def impacts this
3758 this.forceRecreateAutoGroups = true;
3759 this.createColumnsFromColumnDefs(true);
3760 };
3761 ColumnModel.prototype.getColDefVersion = function () {
3762 return this.colDefVersion;
3763 };
3764 ColumnModel.prototype.setColumnDefs = function (columnDefs, source) {
3765 if (source === void 0) { source = 'api'; }
3766 var colsPreviouslyExisted = !!this.columnDefs;
3767 this.colDefVersion++;
3768 this.columnDefs = columnDefs;
3769 this.createColumnsFromColumnDefs(colsPreviouslyExisted, source);
3770 };
3771 ColumnModel.prototype.createColumnsFromColumnDefs = function (colsPreviouslyExisted, source) {
3772 var _this = this;
3773 if (source === void 0) { source = 'api'; }
3774 // only need to raise before/after events if updating columns, never if setting columns for first time
3775 var raiseEventsFunc = colsPreviouslyExisted ? this.compareColumnStatesAndRaiseEvents(source) : undefined;
3776 // always invalidate cache on changing columns, as the column id's for the new columns
3777 // could overlap with the old id's, so the cache would return old values for new columns.
3778 this.valueCache.expire();
3779 // NOTE ==================
3780 // we should be destroying the existing columns and groups if they exist, for example, the original column
3781 // group adds a listener to the columns, it should be also removing the listeners
3782 this.autoGroupsNeedBuilding = true;
3783 var oldPrimaryColumns = this.primaryColumns;
3784 var oldPrimaryTree = this.primaryColumnTree;
3785 var balancedTreeResult = this.columnFactory.createColumnTree(this.columnDefs, true, oldPrimaryTree);
3786 this.primaryColumnTree = balancedTreeResult.columnTree;
3787 this.primaryHeaderRowCount = balancedTreeResult.treeDept + 1;
3788 this.primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);
3789 this.primaryColumnsMap = {};
3790 this.primaryColumns.forEach(function (col) { return _this.primaryColumnsMap[col.getId()] = col; });
3791 this.extractRowGroupColumns(source, oldPrimaryColumns);
3792 this.extractPivotColumns(source, oldPrimaryColumns);
3793 this.extractValueColumns(source, oldPrimaryColumns);
3794 this.ready = true;
3795 // if we are showing secondary columns, then no need to update grid columns
3796 // at this point, as it's the pivot service responsibility to change these
3797 // if we are no longer pivoting (ie and need to revert back to primary, otherwise
3798 // we shouldn't be touching the primary).
3799 var gridColsNotProcessed = this.gridColsArePrimary === undefined;
3800 var processGridCols = this.gridColsArePrimary || gridColsNotProcessed;
3801 if (processGridCols) {
3802 this.updateGridColumns();
3803 if (colsPreviouslyExisted && !this.gridOptionsWrapper.isMaintainColumnOrder()) {
3804 this.orderGridColumnsLikePrimary();
3805 }
3806 this.updateDisplayedColumns(source);
3807 this.checkViewportColumns();
3808 }
3809 // this event is not used by AG Grid, but left here for backwards compatibility,
3810 // in case applications use it
3811 this.dispatchEverythingChanged(source);
3812 raiseEventsFunc && raiseEventsFunc();
3813 this.dispatchNewColumnsLoaded();
3814 };
3815 ColumnModel.prototype.dispatchNewColumnsLoaded = function () {
3816 var newColumnsLoadedEvent = {
3817 type: Events.EVENT_NEW_COLUMNS_LOADED,
3818 api: this.gridApi,
3819 columnApi: this.columnApi
3820 };
3821 this.eventService.dispatchEvent(newColumnsLoadedEvent);
3822 };
3823 // this event is legacy, no grid code listens to it. instead the grid listens to New Columns Loaded
3824 ColumnModel.prototype.dispatchEverythingChanged = function (source) {
3825 if (source === void 0) { source = 'api'; }
3826 var eventEverythingChanged = {
3827 type: Events.EVENT_COLUMN_EVERYTHING_CHANGED,
3828 api: this.gridApi,
3829 columnApi: this.columnApi,
3830 source: source
3831 };
3832 this.eventService.dispatchEvent(eventEverythingChanged);
3833 };
3834 ColumnModel.prototype.orderGridColumnsLikePrimary = function () {
3835 var _this = this;
3836 var primaryColumns = this.primaryColumns;
3837 if (!primaryColumns) {
3838 return;
3839 }
3840 this.gridColumns.sort(function (colA, colB) {
3841 var primaryIndexA = primaryColumns.indexOf(colA);
3842 var primaryIndexB = primaryColumns.indexOf(colB);
3843 // if both cols are present in primary, then we just return the position,
3844 // so position is maintained.
3845 var indexAPresent = primaryIndexA >= 0;
3846 var indexBPresent = primaryIndexB >= 0;
3847 if (indexAPresent && indexBPresent) {
3848 return primaryIndexA - primaryIndexB;
3849 }
3850 if (indexAPresent) {
3851 // B is auto group column, so put B first
3852 return 1;
3853 }
3854 if (indexBPresent) {
3855 // A is auto group column, so put A first
3856 return -1;
3857 }
3858 // otherwise both A and B are auto-group columns. so we just keep the order
3859 // as they were already in.
3860 var gridIndexA = _this.gridColumns.indexOf(colA);
3861 var gridIndexB = _this.gridColumns.indexOf(colB);
3862 return gridIndexA - gridIndexB;
3863 });
3864 };
3865 ColumnModel.prototype.getAllDisplayedAutoHeightCols = function () {
3866 return this.displayedAutoHeightCols;
3867 };
3868 ColumnModel.prototype.setViewport = function () {
3869 if (this.gridOptionsWrapper.isEnableRtl()) {
3870 this.viewportLeft = this.bodyWidth - this.scrollPosition - this.scrollWidth;
3871 this.viewportRight = this.bodyWidth - this.scrollPosition;
3872 }
3873 else {
3874 this.viewportLeft = this.scrollPosition;
3875 this.viewportRight = this.scrollWidth + this.scrollPosition;
3876 }
3877 };
3878 // used by clipboard service, to know what columns to paste into
3879 ColumnModel.prototype.getDisplayedColumnsStartingAt = function (column) {
3880 var currentColumn = column;
3881 var columns = [];
3882 while (currentColumn != null) {
3883 columns.push(currentColumn);
3884 currentColumn = this.getDisplayedColAfter(currentColumn);
3885 }
3886 return columns;
3887 };
3888 // checks what columns are currently displayed due to column virtualisation. fires an event
3889 // if the list of columns has changed.
3890 // + setColumnWidth(), setViewportPosition(), setColumnDefs(), sizeColumnsToFit()
3891 ColumnModel.prototype.checkViewportColumns = function () {
3892 // check displayCenterColumnTree exists first, as it won't exist when grid is initialising
3893 if (this.displayedColumnsCenter == null) {
3894 return;
3895 }
3896 var hashBefore = this.viewportColumns.map(function (column) { return column.getId(); }).join('#');
3897 this.extractViewport();
3898 var hashAfter = this.viewportColumns.map(function (column) { return column.getId(); }).join('#');
3899 if (hashBefore !== hashAfter) {
3900 var event_1 = {
3901 type: Events.EVENT_VIRTUAL_COLUMNS_CHANGED,
3902 api: this.gridApi,
3903 columnApi: this.columnApi
3904 };
3905 this.eventService.dispatchEvent(event_1);
3906 }
3907 };
3908 ColumnModel.prototype.setViewportPosition = function (scrollWidth, scrollPosition) {
3909 if (scrollWidth !== this.scrollWidth || scrollPosition !== this.scrollPosition || this.bodyWidthDirty) {
3910 this.scrollWidth = scrollWidth;
3911 this.scrollPosition = scrollPosition;
3912 // we need to call setVirtualViewportLeftAndRight() at least once after the body width changes,
3913 // as the viewport can stay the same, but in RTL, if body width changes, we need to work out the
3914 // virtual columns again
3915 this.bodyWidthDirty = true;
3916 this.setViewport();
3917 if (this.ready) {
3918 this.checkViewportColumns();
3919 }
3920 }
3921 };
3922 ColumnModel.prototype.isPivotMode = function () {
3923 return this.pivotMode;
3924 };
3925 ColumnModel.prototype.isPivotSettingAllowed = function (pivot) {
3926 if (pivot && this.gridOptionsWrapper.isTreeData()) {
3927 console.warn("AG Grid: Pivot mode not available in conjunction Tree Data i.e. 'gridOptions.treeData: true'");
3928 return false;
3929 }
3930 return true;
3931 };
3932 ColumnModel.prototype.setPivotMode = function (pivotMode, source) {
3933 if (source === void 0) { source = 'api'; }
3934 if (pivotMode === this.pivotMode || !this.isPivotSettingAllowed(this.pivotMode)) {
3935 return;
3936 }
3937 this.pivotMode = pivotMode;
3938 // we need to update grid columns to cover the scenario where user has groupSuppressAutoColumn=true, as
3939 // this means we don't use auto group column UNLESS we are in pivot mode (it's mandatory in pivot mode),
3940 // so need to updateGridColumn() to check it autoGroupCol needs to be added / removed
3941 this.autoGroupsNeedBuilding = true;
3942 this.updateGridColumns();
3943 this.updateDisplayedColumns(source);
3944 var event = {
3945 type: Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,
3946 api: this.gridApi,
3947 columnApi: this.columnApi
3948 };
3949 this.eventService.dispatchEvent(event);
3950 };
3951 ColumnModel.prototype.getSecondaryPivotColumn = function (pivotKeys, valueColKey) {
3952 if (missing(this.secondaryColumns)) {
3953 return null;
3954 }
3955 var valueColumnToFind = this.getPrimaryColumn(valueColKey);
3956 var foundColumn = null;
3957 this.secondaryColumns.forEach(function (column) {
3958 var thisPivotKeys = column.getColDef().pivotKeys;
3959 var pivotValueColumn = column.getColDef().pivotValueColumn;
3960 var pivotKeyMatches = areEqual(thisPivotKeys, pivotKeys);
3961 var pivotValueMatches = pivotValueColumn === valueColumnToFind;
3962 if (pivotKeyMatches && pivotValueMatches) {
3963 foundColumn = column;
3964 }
3965 });
3966 return foundColumn;
3967 };
3968 ColumnModel.prototype.setBeans = function (loggerFactory) {
3969 this.logger = loggerFactory.create('columnModel');
3970 };
3971 ColumnModel.prototype.setFirstRightAndLastLeftPinned = function (source) {
3972 var lastLeft;
3973 var firstRight;
3974 if (this.gridOptionsWrapper.isEnableRtl()) {
3975 lastLeft = this.displayedColumnsLeft ? this.displayedColumnsLeft[0] : null;
3976 firstRight = this.displayedColumnsRight ? last(this.displayedColumnsRight) : null;
3977 }
3978 else {
3979 lastLeft = this.displayedColumnsLeft ? last(this.displayedColumnsLeft) : null;
3980 firstRight = this.displayedColumnsRight ? this.displayedColumnsRight[0] : null;
3981 }
3982 this.gridColumns.forEach(function (column) {
3983 column.setLastLeftPinned(column === lastLeft, source);
3984 column.setFirstRightPinned(column === firstRight, source);
3985 });
3986 };
3987 ColumnModel.prototype.autoSizeColumns = function (params) {
3988 var _this = this;
3989 var columns = params.columns, skipHeader = params.skipHeader, skipHeaderGroups = params.skipHeaderGroups, stopAtGroup = params.stopAtGroup, _a = params.source, source = _a === void 0 ? 'api' : _a;
3990 // because of column virtualisation, we can only do this function on columns that are
3991 // actually rendered, as non-rendered columns (outside the viewport and not rendered
3992 // due to column virtualisation) are not present. this can result in all rendered columns
3993 // getting narrowed, which in turn introduces more rendered columns on the RHS which
3994 // did not get autosized in the original run, leaving the visible grid with columns on
3995 // the LHS sized, but RHS no. so we keep looping through the visible columns until
3996 // no more cols are available (rendered) to be resized
3997 // we autosize after animation frames finish in case any cell renderers need to complete first. this can
3998 // happen eg if client code is calling api.autoSizeAllColumns() straight after grid is initialised, but grid
3999 // hasn't fully drawn out all the cells yet (due to cell renderers in animation frames).
4000 this.animationFrameService.flushAllFrames();
4001 // keep track of which cols we have resized in here
4002 var columnsAutosized = [];
4003 // initialise with anything except 0 so that while loop executes at least once
4004 var changesThisTimeAround = -1;
4005 var shouldSkipHeader = skipHeader != null ? skipHeader : this.gridOptionsWrapper.isSkipHeaderOnAutoSize();
4006 var shouldSkipHeaderGroups = skipHeaderGroups != null ? skipHeaderGroups : shouldSkipHeader;
4007 while (changesThisTimeAround !== 0) {
4008 changesThisTimeAround = 0;
4009 this.actionOnGridColumns(columns, function (column) {
4010 // if already autosized, skip it
4011 if (columnsAutosized.indexOf(column) >= 0) {
4012 return false;
4013 }
4014 // get how wide this col should be
4015 var preferredWidth = _this.autoWidthCalculator.getPreferredWidthForColumn(column, shouldSkipHeader);
4016 // preferredWidth = -1 if this col is not on the screen
4017 if (preferredWidth > 0) {
4018 var newWidth = _this.normaliseColumnWidth(column, preferredWidth);
4019 column.setActualWidth(newWidth, source);
4020 columnsAutosized.push(column);
4021 changesThisTimeAround++;
4022 }
4023 return true;
4024 }, source);
4025 }
4026 if (!shouldSkipHeaderGroups) {
4027 this.autoSizeColumnGroupsByColumns(columns, stopAtGroup);
4028 }
4029 this.fireColumnResizedEvent(columnsAutosized, true, 'autosizeColumns');
4030 };
4031 ColumnModel.prototype.fireColumnResizedEvent = function (columns, finished, source, flexColumns) {
4032 if (flexColumns === void 0) { flexColumns = null; }
4033 if (columns && columns.length) {
4034 var event_2 = {
4035 type: Events.EVENT_COLUMN_RESIZED,
4036 columns: columns,
4037 column: columns.length === 1 ? columns[0] : null,
4038 flexColumns: flexColumns,
4039 finished: finished,
4040 api: this.gridApi,
4041 columnApi: this.columnApi,
4042 source: source
4043 };
4044 this.eventService.dispatchEvent(event_2);
4045 }
4046 };
4047 ColumnModel.prototype.autoSizeColumn = function (key, skipHeader, source) {
4048 if (source === void 0) { source = "api"; }
4049 if (key) {
4050 this.autoSizeColumns({ columns: [key], skipHeader: skipHeader, skipHeaderGroups: true, source: source });
4051 }
4052 };
4053 ColumnModel.prototype.autoSizeColumnGroupsByColumns = function (keys, stopAtGroup) {
4054 var e_1, _a, e_2, _b;
4055 var columnGroups = new Set();
4056 var columns = this.getGridColumns(keys);
4057 columns.forEach(function (col) {
4058 var parent = col.getParent();
4059 while (parent && parent != stopAtGroup) {
4060 if (!parent.isPadding()) {
4061 columnGroups.add(parent);
4062 }
4063 parent = parent.getParent();
4064 }
4065 });
4066 var headerGroupCtrl;
4067 var resizedColumns = [];
4068 try {
4069 for (var columnGroups_1 = __values(columnGroups), columnGroups_1_1 = columnGroups_1.next(); !columnGroups_1_1.done; columnGroups_1_1 = columnGroups_1.next()) {
4070 var columnGroup = columnGroups_1_1.value;
4071 try {
4072 for (var _c = (e_2 = void 0, __values(this.ctrlsService.getHeaderRowContainerCtrls())), _d = _c.next(); !_d.done; _d = _c.next()) {
4073 var headerContainerCtrl = _d.value;
4074 headerGroupCtrl = headerContainerCtrl.getHeaderCtrlForColumn(columnGroup);
4075 if (headerGroupCtrl) {
4076 break;
4077 }
4078 }
4079 }
4080 catch (e_2_1) { e_2 = { error: e_2_1 }; }
4081 finally {
4082 try {
4083 if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
4084 }
4085 finally { if (e_2) throw e_2.error; }
4086 }
4087 if (headerGroupCtrl) {
4088 headerGroupCtrl.resizeLeafColumnsToFit();
4089 }
4090 }
4091 }
4092 catch (e_1_1) { e_1 = { error: e_1_1 }; }
4093 finally {
4094 try {
4095 if (columnGroups_1_1 && !columnGroups_1_1.done && (_a = columnGroups_1.return)) _a.call(columnGroups_1);
4096 }
4097 finally { if (e_1) throw e_1.error; }
4098 }
4099 return resizedColumns;
4100 };
4101 ColumnModel.prototype.autoSizeAllColumns = function (skipHeader, source) {
4102 if (source === void 0) { source = "api"; }
4103 var allDisplayedColumns = this.getAllDisplayedColumns();
4104 this.autoSizeColumns({ columns: allDisplayedColumns, skipHeader: skipHeader, source: source });
4105 };
4106 // Possible candidate for reuse (alot of recursive traversal duplication)
4107 ColumnModel.prototype.getColumnsFromTree = function (rootColumns) {
4108 var result = [];
4109 var recursiveFindColumns = function (childColumns) {
4110 for (var i = 0; i < childColumns.length; i++) {
4111 var child = childColumns[i];
4112 if (child instanceof Column) {
4113 result.push(child);
4114 }
4115 else if (child instanceof ProvidedColumnGroup) {
4116 recursiveFindColumns(child.getChildren());
4117 }
4118 }
4119 };
4120 recursiveFindColumns(rootColumns);
4121 return result;
4122 };
4123 ColumnModel.prototype.getAllDisplayedTrees = function () {
4124 if (this.displayedTreeLeft && this.displayedTreeRight && this.displayedTreeCentre) {
4125 return this.displayedTreeLeft
4126 .concat(this.displayedTreeCentre)
4127 .concat(this.displayedTreeRight);
4128 }
4129 return null;
4130 };
4131 // + columnSelectPanel
4132 ColumnModel.prototype.getPrimaryColumnTree = function () {
4133 return this.primaryColumnTree;
4134 };
4135 // + gridPanel -> for resizing the body and setting top margin
4136 ColumnModel.prototype.getHeaderRowCount = function () {
4137 return this.gridHeaderRowCount;
4138 };
4139 // + headerRenderer -> setting pinned body width
4140 ColumnModel.prototype.getDisplayedTreeLeft = function () {
4141 return this.displayedTreeLeft;
4142 };
4143 // + headerRenderer -> setting pinned body width
4144 ColumnModel.prototype.getDisplayedTreeRight = function () {
4145 return this.displayedTreeRight;
4146 };
4147 // + headerRenderer -> setting pinned body width
4148 ColumnModel.prototype.getDisplayedTreeCentre = function () {
4149 return this.displayedTreeCentre;
4150 };
4151 // gridPanel -> ensureColumnVisible
4152 ColumnModel.prototype.isColumnDisplayed = function (column) {
4153 return this.getAllDisplayedColumns().indexOf(column) >= 0;
4154 };
4155 // + csvCreator
4156 ColumnModel.prototype.getAllDisplayedColumns = function () {
4157 return this.displayedColumns;
4158 };
4159 ColumnModel.prototype.getViewportColumns = function () {
4160 return this.viewportColumns;
4161 };
4162 ColumnModel.prototype.getDisplayedLeftColumnsForRow = function (rowNode) {
4163 if (!this.colSpanActive) {
4164 return this.displayedColumnsLeft;
4165 }
4166 return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsLeft);
4167 };
4168 ColumnModel.prototype.getDisplayedRightColumnsForRow = function (rowNode) {
4169 if (!this.colSpanActive) {
4170 return this.displayedColumnsRight;
4171 }
4172 return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsRight);
4173 };
4174 ColumnModel.prototype.getDisplayedColumnsForRow = function (rowNode, displayedColumns, filterCallback, emptySpaceBeforeColumn) {
4175 var result = [];
4176 var lastConsideredCol = null;
4177 var _loop_1 = function (i) {
4178 var col = displayedColumns[i];
4179 var maxAllowedColSpan = displayedColumns.length - i;
4180 var colSpan = Math.min(col.getColSpan(rowNode), maxAllowedColSpan);
4181 var columnsToCheckFilter = [col];
4182 if (colSpan > 1) {
4183 var colsToRemove = colSpan - 1;
4184 for (var j = 1; j <= colsToRemove; j++) {
4185 columnsToCheckFilter.push(displayedColumns[i + j]);
4186 }
4187 i += colsToRemove;
4188 }
4189 // see which cols we should take out for column virtualisation
4190 var filterPasses;
4191 if (filterCallback) {
4192 // if user provided a callback, means some columns may not be in the viewport.
4193 // the user will NOT provide a callback if we are talking about pinned areas,
4194 // as pinned areas have no horizontal scroll and do not virtualise the columns.
4195 // if lots of columns, that means column spanning, and we set filterPasses = true
4196 // if one or more of the columns spanned pass the filter.
4197 filterPasses = false;
4198 columnsToCheckFilter.forEach(function (colForFilter) {
4199 if (filterCallback(colForFilter)) {
4200 filterPasses = true;
4201 }
4202 });
4203 }
4204 else {
4205 filterPasses = true;
4206 }
4207 if (filterPasses) {
4208 if (result.length === 0 && lastConsideredCol) {
4209 var gapBeforeColumn = emptySpaceBeforeColumn ? emptySpaceBeforeColumn(col) : false;
4210 if (gapBeforeColumn) {
4211 result.push(lastConsideredCol);
4212 }
4213 }
4214 result.push(col);
4215 }
4216 lastConsideredCol = col;
4217 out_i_1 = i;
4218 };
4219 var out_i_1;
4220 for (var i = 0; i < displayedColumns.length; i++) {
4221 _loop_1(i);
4222 i = out_i_1;
4223 }
4224 return result;
4225 };
4226 // + rowRenderer
4227 // if we are not column spanning, this just returns back the virtual centre columns,
4228 // however if we are column spanning, then different rows can have different virtual
4229 // columns, so we have to work out the list for each individual row.
4230 ColumnModel.prototype.getViewportCenterColumnsForRow = function (rowNode) {
4231 var _this = this;
4232 if (!this.colSpanActive) {
4233 return this.viewportColumnsCenter;
4234 }
4235 var emptySpaceBeforeColumn = function (col) {
4236 var left = col.getLeft();
4237 return exists(left) && left > _this.viewportLeft;
4238 };
4239 // if doing column virtualisation, then we filter based on the viewport.
4240 var filterCallback = this.suppressColumnVirtualisation ? null : this.isColumnInViewport.bind(this);
4241 return this.getDisplayedColumnsForRow(rowNode, this.displayedColumnsCenter, filterCallback, emptySpaceBeforeColumn);
4242 };
4243 ColumnModel.prototype.getAriaColumnIndex = function (col) {
4244 return this.getAllGridColumns().indexOf(col) + 1;
4245 };
4246 ColumnModel.prototype.isColumnInViewport = function (col) {
4247 // we never filter out autoHeight columns, as we need them in the DOM for calculating Auto Height
4248 if (col.isAutoHeight()) {
4249 return true;
4250 }
4251 var columnLeft = col.getLeft() || 0;
4252 var columnRight = columnLeft + col.getActualWidth();
4253 // adding 200 for buffer size, so some cols off viewport are rendered.
4254 // this helps horizontal scrolling so user rarely sees white space (unless
4255 // they scroll horizontally fast). however we are conservative, as the more
4256 // buffer the slower the vertical redraw speed
4257 var leftBounds = this.viewportLeft - 200;
4258 var rightBounds = this.viewportRight + 200;
4259 var columnToMuchLeft = columnLeft < leftBounds && columnRight < leftBounds;
4260 var columnToMuchRight = columnLeft > rightBounds && columnRight > rightBounds;
4261 return !columnToMuchLeft && !columnToMuchRight;
4262 };
4263 // used by:
4264 // + angularGrid -> setting pinned body width
4265 // note: this should be cached
4266 ColumnModel.prototype.getDisplayedColumnsLeftWidth = function () {
4267 return this.getWidthOfColsInList(this.displayedColumnsLeft);
4268 };
4269 // note: this should be cached
4270 ColumnModel.prototype.getDisplayedColumnsRightWidth = function () {
4271 return this.getWidthOfColsInList(this.displayedColumnsRight);
4272 };
4273 ColumnModel.prototype.updatePrimaryColumnList = function (keys, masterList, actionIsAdd, columnCallback, eventType, source) {
4274 var _this = this;
4275 if (source === void 0) { source = "api"; }
4276 if (!keys || missingOrEmpty(keys)) {
4277 return;
4278 }
4279 var atLeastOne = false;
4280 keys.forEach(function (key) {
4281 var columnToAdd = _this.getPrimaryColumn(key);
4282 if (!columnToAdd) {
4283 return;
4284 }
4285 if (actionIsAdd) {
4286 if (masterList.indexOf(columnToAdd) >= 0) {
4287 return;
4288 }
4289 masterList.push(columnToAdd);
4290 }
4291 else {
4292 if (masterList.indexOf(columnToAdd) < 0) {
4293 return;
4294 }
4295 removeFromArray(masterList, columnToAdd);
4296 }
4297 columnCallback(columnToAdd);
4298 atLeastOne = true;
4299 });
4300 if (!atLeastOne) {
4301 return;
4302 }
4303 if (this.autoGroupsNeedBuilding) {
4304 this.updateGridColumns();
4305 }
4306 this.updateDisplayedColumns(source);
4307 var event = {
4308 type: eventType,
4309 columns: masterList,
4310 column: masterList.length === 1 ? masterList[0] : null,
4311 api: this.gridApi,
4312 columnApi: this.columnApi,
4313 source: source
4314 };
4315 this.eventService.dispatchEvent(event);
4316 };
4317 ColumnModel.prototype.setRowGroupColumns = function (colKeys, source) {
4318 if (source === void 0) { source = "api"; }
4319 this.autoGroupsNeedBuilding = true;
4320 this.setPrimaryColumnList(colKeys, this.rowGroupColumns, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.setRowGroupActive.bind(this), source);
4321 };
4322 ColumnModel.prototype.setRowGroupActive = function (active, column, source) {
4323 if (active === column.isRowGroupActive()) {
4324 return;
4325 }
4326 column.setRowGroupActive(active, source);
4327 if (!active && !this.gridOptionsWrapper.isSuppressMakeColumnVisibleAfterUnGroup()) {
4328 column.setVisible(true, source);
4329 }
4330 };
4331 ColumnModel.prototype.addRowGroupColumn = function (key, source) {
4332 if (source === void 0) { source = "api"; }
4333 if (key) {
4334 this.addRowGroupColumns([key], source);
4335 }
4336 };
4337 ColumnModel.prototype.addRowGroupColumns = function (keys, source) {
4338 if (source === void 0) { source = "api"; }
4339 this.autoGroupsNeedBuilding = true;
4340 this.updatePrimaryColumnList(keys, this.rowGroupColumns, true, this.setRowGroupActive.bind(this, true), Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);
4341 };
4342 ColumnModel.prototype.removeRowGroupColumns = function (keys, source) {
4343 if (source === void 0) { source = "api"; }
4344 this.autoGroupsNeedBuilding = true;
4345 this.updatePrimaryColumnList(keys, this.rowGroupColumns, false, this.setRowGroupActive.bind(this, false), Events.EVENT_COLUMN_ROW_GROUP_CHANGED, source);
4346 };
4347 ColumnModel.prototype.removeRowGroupColumn = function (key, source) {
4348 if (source === void 0) { source = "api"; }
4349 if (key) {
4350 this.removeRowGroupColumns([key], source);
4351 }
4352 };
4353 ColumnModel.prototype.addPivotColumns = function (keys, source) {
4354 if (source === void 0) { source = "api"; }
4355 this.updatePrimaryColumnList(keys, this.pivotColumns, true, function (column) { return column.setPivotActive(true, source); }, Events.EVENT_COLUMN_PIVOT_CHANGED, source);
4356 };
4357 ColumnModel.prototype.setPivotColumns = function (colKeys, source) {
4358 if (source === void 0) { source = "api"; }
4359 this.setPrimaryColumnList(colKeys, this.pivotColumns, Events.EVENT_COLUMN_PIVOT_CHANGED, function (added, column) {
4360 column.setPivotActive(added, source);
4361 }, source);
4362 };
4363 ColumnModel.prototype.addPivotColumn = function (key, source) {
4364 if (source === void 0) { source = "api"; }
4365 this.addPivotColumns([key], source);
4366 };
4367 ColumnModel.prototype.removePivotColumns = function (keys, source) {
4368 if (source === void 0) { source = "api"; }
4369 this.updatePrimaryColumnList(keys, this.pivotColumns, false, function (column) { return column.setPivotActive(false, source); }, Events.EVENT_COLUMN_PIVOT_CHANGED, source);
4370 };
4371 ColumnModel.prototype.removePivotColumn = function (key, source) {
4372 if (source === void 0) { source = "api"; }
4373 this.removePivotColumns([key], source);
4374 };
4375 ColumnModel.prototype.setPrimaryColumnList = function (colKeys, masterList, eventName, columnCallback, source) {
4376 var _this = this;
4377 masterList.length = 0;
4378 if (exists(colKeys)) {
4379 colKeys.forEach(function (key) {
4380 var column = _this.getPrimaryColumn(key);
4381 if (column) {
4382 masterList.push(column);
4383 }
4384 });
4385 }
4386 (this.primaryColumns || []).forEach(function (column) {
4387 var added = masterList.indexOf(column) >= 0;
4388 columnCallback(added, column);
4389 });
4390 if (this.autoGroupsNeedBuilding) {
4391 this.updateGridColumns();
4392 }
4393 this.updateDisplayedColumns(source);
4394 this.fireColumnEvent(eventName, masterList, source);
4395 };
4396 ColumnModel.prototype.setValueColumns = function (colKeys, source) {
4397 if (source === void 0) { source = "api"; }
4398 this.setPrimaryColumnList(colKeys, this.valueColumns, Events.EVENT_COLUMN_VALUE_CHANGED, this.setValueActive.bind(this), source);
4399 };
4400 ColumnModel.prototype.setValueActive = function (active, column, source) {
4401 if (active === column.isValueActive()) {
4402 return;
4403 }
4404 column.setValueActive(active, source);
4405 if (active && !column.getAggFunc()) {
4406 var initialAggFunc = this.aggFuncService.getDefaultAggFunc(column);
4407 column.setAggFunc(initialAggFunc);
4408 }
4409 };
4410 ColumnModel.prototype.addValueColumns = function (keys, source) {
4411 if (source === void 0) { source = "api"; }
4412 this.updatePrimaryColumnList(keys, this.valueColumns, true, this.setValueActive.bind(this, true), Events.EVENT_COLUMN_VALUE_CHANGED, source);
4413 };
4414 ColumnModel.prototype.addValueColumn = function (colKey, source) {
4415 if (source === void 0) { source = "api"; }
4416 if (colKey) {
4417 this.addValueColumns([colKey], source);
4418 }
4419 };
4420 ColumnModel.prototype.removeValueColumn = function (colKey, source) {
4421 if (source === void 0) { source = "api"; }
4422 this.removeValueColumns([colKey], source);
4423 };
4424 ColumnModel.prototype.removeValueColumns = function (keys, source) {
4425 if (source === void 0) { source = "api"; }
4426 this.updatePrimaryColumnList(keys, this.valueColumns, false, this.setValueActive.bind(this, false), Events.EVENT_COLUMN_VALUE_CHANGED, source);
4427 };
4428 // returns the width we can set to this col, taking into consideration min and max widths
4429 ColumnModel.prototype.normaliseColumnWidth = function (column, newWidth) {
4430 var minWidth = column.getMinWidth();
4431 if (exists(minWidth) && newWidth < minWidth) {
4432 newWidth = minWidth;
4433 }
4434 var maxWidth = column.getMaxWidth();
4435 if (exists(maxWidth) && column.isGreaterThanMax(newWidth)) {
4436 newWidth = maxWidth;
4437 }
4438 return newWidth;
4439 };
4440 ColumnModel.prototype.getPrimaryOrGridColumn = function (key) {
4441 var column = this.getPrimaryColumn(key);
4442 return column || this.getGridColumn(key);
4443 };
4444 ColumnModel.prototype.setColumnWidths = function (columnWidths, shiftKey, // @takeFromAdjacent - if user has 'shift' pressed, then pixels are taken from adjacent column
4445 finished, // @finished - ends up in the event, tells the user if more events are to come
4446 source) {
4447 var _this = this;
4448 if (source === void 0) { source = "api"; }
4449 var sets = [];
4450 columnWidths.forEach(function (columnWidth) {
4451 var col = _this.getPrimaryOrGridColumn(columnWidth.key);
4452 if (!col) {
4453 return;
4454 }
4455 sets.push({
4456 width: columnWidth.newWidth,
4457 ratios: [1],
4458 columns: [col]
4459 });
4460 // if user wants to do shift resize by default, then we invert the shift operation
4461 var defaultIsShift = _this.gridOptionsWrapper.getColResizeDefault() === 'shift';
4462 if (defaultIsShift) {
4463 shiftKey = !shiftKey;
4464 }
4465 if (shiftKey) {
4466 var otherCol = _this.getDisplayedColAfter(col);
4467 if (!otherCol) {
4468 return;
4469 }
4470 var widthDiff = col.getActualWidth() - columnWidth.newWidth;
4471 var otherColWidth = otherCol.getActualWidth() + widthDiff;
4472 sets.push({
4473 width: otherColWidth,
4474 ratios: [1],
4475 columns: [otherCol]
4476 });
4477 }
4478 });
4479 if (sets.length === 0) {
4480 return;
4481 }
4482 this.resizeColumnSets({
4483 resizeSets: sets,
4484 finished: finished,
4485 source: source
4486 });
4487 };
4488 ColumnModel.prototype.checkMinAndMaxWidthsForSet = function (columnResizeSet) {
4489 var columns = columnResizeSet.columns, width = columnResizeSet.width;
4490 // every col has a min width, so sum them all up and see if we have enough room
4491 // for all the min widths
4492 var minWidthAccumulated = 0;
4493 var maxWidthAccumulated = 0;
4494 var maxWidthActive = true;
4495 columns.forEach(function (col) {
4496 var minWidth = col.getMinWidth();
4497 minWidthAccumulated += minWidth || 0;
4498 var maxWidth = col.getMaxWidth();
4499 if (exists(maxWidth) && maxWidth > 0) {
4500 maxWidthAccumulated += maxWidth;
4501 }
4502 else {
4503 // if at least one columns has no max width, it means the group of columns
4504 // then has no max width, as at least one column can take as much width as possible
4505 maxWidthActive = false;
4506 }
4507 });
4508 var minWidthPasses = width >= minWidthAccumulated;
4509 var maxWidthPasses = !maxWidthActive || (width <= maxWidthAccumulated);
4510 return minWidthPasses && maxWidthPasses;
4511 };
4512 // method takes sets of columns and resizes them. either all sets will be resized, or nothing
4513 // be resized. this is used for example when user tries to resize a group and holds shift key,
4514 // then both the current group (grows), and the adjacent group (shrinks), will get resized,
4515 // so that's two sets for this method.
4516 ColumnModel.prototype.resizeColumnSets = function (params) {
4517 var _this = this;
4518 var resizeSets = params.resizeSets, finished = params.finished, source = params.source;
4519 var passMinMaxCheck = !resizeSets || resizeSets.every(function (columnResizeSet) { return _this.checkMinAndMaxWidthsForSet(columnResizeSet); });
4520 if (!passMinMaxCheck) {
4521 // even though we are not going to resize beyond min/max size, we still need to raise event when finished
4522 if (finished) {
4523 var columns = resizeSets && resizeSets.length > 0 ? resizeSets[0].columns : null;
4524 this.fireColumnResizedEvent(columns, finished, source);
4525 }
4526 return; // don't resize!
4527 }
4528 var changedCols = [];
4529 var allResizedCols = [];
4530 resizeSets.forEach(function (set) {
4531 var width = set.width, columns = set.columns, ratios = set.ratios;
4532 // keep track of pixels used, and last column gets the remaining,
4533 // to cater for rounding errors, and min width adjustments
4534 var newWidths = {};
4535 var finishedCols = {};
4536 columns.forEach(function (col) { return allResizedCols.push(col); });
4537 // the loop below goes through each col. if a col exceeds it's min/max width,
4538 // it then gets set to its min/max width and the column is removed marked as 'finished'
4539 // and the calculation is done again leaving this column out. take for example columns
4540 // {A, width: 50, maxWidth: 100}
4541 // {B, width: 50}
4542 // {C, width: 50}
4543 // and then the set is set to width 600 - on the first pass the grid tries to set each column
4544 // to 200. it checks A and sees 200 > 100 and so sets the width to 100. col A is then marked
4545 // as 'finished' and the calculation is done again with the remaining cols B and C, which end up
4546 // splitting the remaining 500 pixels.
4547 var finishedColsGrew = true;
4548 var loopCount = 0;
4549 var _loop_2 = function () {
4550 loopCount++;
4551 if (loopCount > 1000) {
4552 // this should never happen, but in the future, someone might introduce a bug here,
4553 // so we stop the browser from hanging and report bug properly
4554 console.error('AG Grid: infinite loop in resizeColumnSets');
4555 return "break";
4556 }
4557 finishedColsGrew = false;
4558 var subsetCols = [];
4559 var subsetRatioTotal = 0;
4560 var pixelsToDistribute = width;
4561 columns.forEach(function (col, index) {
4562 var thisColFinished = finishedCols[col.getId()];
4563 if (thisColFinished) {
4564 pixelsToDistribute -= newWidths[col.getId()];
4565 }
4566 else {
4567 subsetCols.push(col);
4568 var ratioThisCol = ratios[index];
4569 subsetRatioTotal += ratioThisCol;
4570 }
4571 });
4572 // because we are not using all of the ratios (cols can be missing),
4573 // we scale the ratio. if all columns are included, then subsetRatioTotal=1,
4574 // and so the ratioScale will be 1.
4575 var ratioScale = 1 / subsetRatioTotal;
4576 subsetCols.forEach(function (col, index) {
4577 var lastCol = index === (subsetCols.length - 1);
4578 var colNewWidth;
4579 if (lastCol) {
4580 colNewWidth = pixelsToDistribute;
4581 }
4582 else {
4583 colNewWidth = Math.round(ratios[index] * width * ratioScale);
4584 pixelsToDistribute -= colNewWidth;
4585 }
4586 var minWidth = col.getMinWidth();
4587 var maxWidth = col.getMaxWidth();
4588 if (exists(minWidth) && colNewWidth < minWidth) {
4589 colNewWidth = minWidth;
4590 finishedCols[col.getId()] = true;
4591 finishedColsGrew = true;
4592 }
4593 else if (exists(maxWidth) && maxWidth > 0 && colNewWidth > maxWidth) {
4594 colNewWidth = maxWidth;
4595 finishedCols[col.getId()] = true;
4596 finishedColsGrew = true;
4597 }
4598 newWidths[col.getId()] = colNewWidth;
4599 });
4600 };
4601 while (finishedColsGrew) {
4602 var state_1 = _loop_2();
4603 if (state_1 === "break")
4604 break;
4605 }
4606 columns.forEach(function (col) {
4607 var newWidth = newWidths[col.getId()];
4608 var actualWidth = col.getActualWidth();
4609 if (actualWidth !== newWidth) {
4610 col.setActualWidth(newWidth, source);
4611 changedCols.push(col);
4612 }
4613 });
4614 });
4615 // if no cols changed, then no need to update more or send event.
4616 var atLeastOneColChanged = changedCols.length > 0;
4617 var flexedCols = [];
4618 if (atLeastOneColChanged) {
4619 flexedCols = this.refreshFlexedColumns({ resizingCols: allResizedCols, skipSetLeft: true });
4620 this.setLeftValues(source);
4621 this.updateBodyWidths();
4622 this.checkViewportColumns();
4623 }
4624 // check for change first, to avoid unnecessary firing of events
4625 // however we always fire 'finished' events. this is important
4626 // when groups are resized, as if the group is changing slowly,
4627 // eg 1 pixel at a time, then each change will fire change events
4628 // in all the columns in the group, but only one with get the pixel.
4629 var colsForEvent = allResizedCols.concat(flexedCols);
4630 if (atLeastOneColChanged || finished) {
4631 this.fireColumnResizedEvent(colsForEvent, finished, source, flexedCols);
4632 }
4633 };
4634 ColumnModel.prototype.setColumnAggFunc = function (key, aggFunc, source) {
4635 if (source === void 0) { source = "api"; }
4636 if (!key) {
4637 return;
4638 }
4639 var column = this.getPrimaryColumn(key);
4640 if (!column) {
4641 return;
4642 }
4643 column.setAggFunc(aggFunc);
4644 this.fireColumnEvent(Events.EVENT_COLUMN_VALUE_CHANGED, [column], source);
4645 };
4646 ColumnModel.prototype.fireColumnEvent = function (type, columns, source) {
4647 var event = {
4648 type: type,
4649 columns: columns,
4650 column: (columns && columns.length == 1) ? columns[0] : null,
4651 api: this.gridApi,
4652 columnApi: this.columnApi,
4653 source: source
4654 };
4655 this.eventService.dispatchEvent(event);
4656 };
4657 ColumnModel.prototype.moveRowGroupColumn = function (fromIndex, toIndex, source) {
4658 if (source === void 0) { source = "api"; }
4659 var column = this.rowGroupColumns[fromIndex];
4660 this.rowGroupColumns.splice(fromIndex, 1);
4661 this.rowGroupColumns.splice(toIndex, 0, column);
4662 var event = {
4663 type: Events.EVENT_COLUMN_ROW_GROUP_CHANGED,
4664 columns: this.rowGroupColumns,
4665 column: this.rowGroupColumns.length === 1 ? this.rowGroupColumns[0] : null,
4666 api: this.gridApi,
4667 columnApi: this.columnApi,
4668 source: source
4669 };
4670 this.eventService.dispatchEvent(event);
4671 };
4672 ColumnModel.prototype.moveColumns = function (columnsToMoveKeys, toIndex, source) {
4673 if (source === void 0) { source = "api"; }
4674 this.columnAnimationService.start();
4675 if (toIndex > this.gridColumns.length - columnsToMoveKeys.length) {
4676 console.warn('AG Grid: tried to insert columns in invalid location, toIndex = ' + toIndex);
4677 console.warn('AG Grid: remember that you should not count the moving columns when calculating the new index');
4678 return;
4679 }
4680 // we want to pull all the columns out first and put them into an ordered list
4681 var columnsToMove = this.getGridColumns(columnsToMoveKeys);
4682 var failedRules = !this.doesMovePassRules(columnsToMove, toIndex);
4683 if (failedRules) {
4684 return;
4685 }
4686 moveInArray(this.gridColumns, columnsToMove, toIndex);
4687 this.updateDisplayedColumns(source);
4688 var event = {
4689 type: Events.EVENT_COLUMN_MOVED,
4690 columns: columnsToMove,
4691 column: columnsToMove.length === 1 ? columnsToMove[0] : null,
4692 toIndex: toIndex,
4693 api: this.gridApi,
4694 columnApi: this.columnApi,
4695 source: source
4696 };
4697 this.eventService.dispatchEvent(event);
4698 this.columnAnimationService.finish();
4699 };
4700 ColumnModel.prototype.doesMovePassRules = function (columnsToMove, toIndex) {
4701 // make a copy of what the grid columns would look like after the move
4702 var proposedColumnOrder = this.gridColumns.slice();
4703 moveInArray(proposedColumnOrder, columnsToMove, toIndex);
4704 // then check that the new proposed order of the columns passes all rules
4705 if (!this.doesMovePassMarryChildren(proposedColumnOrder)) {
4706 return false;
4707 }
4708 if (!this.doesMovePassLockedPositions(proposedColumnOrder)) {
4709 return false;
4710 }
4711 return true;
4712 };
4713 // returns the provided cols sorted in same order as they appear in grid columns. eg if grid columns
4714 // contains [a,b,c,d,e] and col passed is [e,a] then the passed cols are sorted into [a,e]
4715 ColumnModel.prototype.sortColumnsLikeGridColumns = function (cols) {
4716 var _this = this;
4717 if (!cols || cols.length <= 1) {
4718 return;
4719 }
4720 var notAllColsInGridColumns = cols.filter(function (c) { return _this.gridColumns.indexOf(c) < 0; }).length > 0;
4721 if (notAllColsInGridColumns) {
4722 return;
4723 }
4724 cols.sort(function (a, b) {
4725 var indexA = _this.gridColumns.indexOf(a);
4726 var indexB = _this.gridColumns.indexOf(b);
4727 return indexA - indexB;
4728 });
4729 };
4730 ColumnModel.prototype.doesMovePassLockedPositions = function (proposedColumnOrder) {
4731 // Placement is a number indicating 'left' 'center' or 'right' as 0 1 2
4732 var lastPlacement = 0;
4733 var rulePassed = true;
4734 var lockPositionToPlacement = function (position) {
4735 if (!position) { // false or undefined
4736 return 1;
4737 }
4738 if (position === true) {
4739 return 0;
4740 }
4741 return position === 'left' ? 0 : 2; // Otherwise 'right'
4742 };
4743 proposedColumnOrder.forEach(function (col) {
4744 var placement = lockPositionToPlacement(col.getColDef().lockPosition);
4745 if (placement < lastPlacement) { // If placement goes down, we're not in the correct order
4746 rulePassed = false;
4747 }
4748 lastPlacement = placement;
4749 });
4750 return rulePassed;
4751 };
4752 ColumnModel.prototype.doesMovePassMarryChildren = function (allColumnsCopy) {
4753 var rulePassed = true;
4754 this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (child) {
4755 if (!(child instanceof ProvidedColumnGroup)) {
4756 return;
4757 }
4758 var columnGroup = child;
4759 var colGroupDef = columnGroup.getColGroupDef();
4760 var marryChildren = colGroupDef && colGroupDef.marryChildren;
4761 if (!marryChildren) {
4762 return;
4763 }
4764 var newIndexes = [];
4765 columnGroup.getLeafColumns().forEach(function (col) {
4766 var newColIndex = allColumnsCopy.indexOf(col);
4767 newIndexes.push(newColIndex);
4768 });
4769 var maxIndex = Math.max.apply(Math, newIndexes);
4770 var minIndex = Math.min.apply(Math, newIndexes);
4771 // spread is how far the first column in this group is away from the last column
4772 var spread = maxIndex - minIndex;
4773 var maxSpread = columnGroup.getLeafColumns().length - 1;
4774 // if the columns
4775 if (spread > maxSpread) {
4776 rulePassed = false;
4777 }
4778 // console.log(`maxIndex = ${maxIndex}, minIndex = ${minIndex}, spread = ${spread}, maxSpread = ${maxSpread}, fail = ${spread > (count-1)}`)
4779 // console.log(allColumnsCopy.map( col => col.getColDef().field).join(','));
4780 });
4781 return rulePassed;
4782 };
4783 ColumnModel.prototype.moveColumn = function (key, toIndex, source) {
4784 if (source === void 0) { source = "api"; }
4785 this.moveColumns([key], toIndex, source);
4786 };
4787 ColumnModel.prototype.moveColumnByIndex = function (fromIndex, toIndex, source) {
4788 if (source === void 0) { source = "api"; }
4789 var column = this.gridColumns[fromIndex];
4790 this.moveColumn(column, toIndex, source);
4791 };
4792 ColumnModel.prototype.getColumnDefs = function () {
4793 var _this = this;
4794 if (!this.primaryColumns) {
4795 return;
4796 }
4797 var cols = this.primaryColumns.slice();
4798 if (this.gridColsArePrimary) {
4799 cols.sort(function (a, b) { return _this.gridColumns.indexOf(a) - _this.gridColumns.indexOf(b); });
4800 }
4801 else if (this.lastPrimaryOrder) {
4802 cols.sort(function (a, b) { return _this.lastPrimaryOrder.indexOf(a) - _this.lastPrimaryOrder.indexOf(b); });
4803 }
4804 return this.columnDefFactory.buildColumnDefs(cols, this.rowGroupColumns, this.pivotColumns);
4805 };
4806 // used by:
4807 // + angularGrid -> for setting body width
4808 // + rowController -> setting main row widths (when inserting and resizing)
4809 // need to cache this
4810 ColumnModel.prototype.getBodyContainerWidth = function () {
4811 return this.bodyWidth;
4812 };
4813 ColumnModel.prototype.getContainerWidth = function (pinned) {
4814 switch (pinned) {
4815 case Constants.PINNED_LEFT:
4816 return this.leftWidth;
4817 case Constants.PINNED_RIGHT:
4818 return this.rightWidth;
4819 default:
4820 return this.bodyWidth;
4821 }
4822 };
4823 // after setColumnWidth or updateGroupsAndDisplayedColumns
4824 ColumnModel.prototype.updateBodyWidths = function () {
4825 var newBodyWidth = this.getWidthOfColsInList(this.displayedColumnsCenter);
4826 var newLeftWidth = this.getWidthOfColsInList(this.displayedColumnsLeft);
4827 var newRightWidth = this.getWidthOfColsInList(this.displayedColumnsRight);
4828 // this is used by virtual col calculation, for RTL only, as a change to body width can impact displayed
4829 // columns, due to RTL inverting the y coordinates
4830 this.bodyWidthDirty = this.bodyWidth !== newBodyWidth;
4831 var atLeastOneChanged = this.bodyWidth !== newBodyWidth || this.leftWidth !== newLeftWidth || this.rightWidth !== newRightWidth;
4832 if (atLeastOneChanged) {
4833 this.bodyWidth = newBodyWidth;
4834 this.leftWidth = newLeftWidth;
4835 this.rightWidth = newRightWidth;
4836 // when this fires, it is picked up by the gridPanel, which ends up in
4837 // gridPanel calling setWidthAndScrollPosition(), which in turn calls setViewportPosition()
4838 var event_3 = {
4839 type: Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED,
4840 api: this.gridApi,
4841 columnApi: this.columnApi
4842 };
4843 this.eventService.dispatchEvent(event_3);
4844 }
4845 };
4846 // + rowController
4847 ColumnModel.prototype.getValueColumns = function () {
4848 return this.valueColumns ? this.valueColumns : [];
4849 };
4850 // + rowController
4851 ColumnModel.prototype.getPivotColumns = function () {
4852 return this.pivotColumns ? this.pivotColumns : [];
4853 };
4854 // + clientSideRowModel
4855 ColumnModel.prototype.isPivotActive = function () {
4856 return this.pivotColumns && this.pivotColumns.length > 0 && this.pivotMode;
4857 };
4858 // + toolPanel
4859 ColumnModel.prototype.getRowGroupColumns = function () {
4860 return this.rowGroupColumns ? this.rowGroupColumns : [];
4861 };
4862 // + rowController -> while inserting rows
4863 ColumnModel.prototype.getDisplayedCenterColumns = function () {
4864 return this.displayedColumnsCenter;
4865 };
4866 // + rowController -> while inserting rows
4867 ColumnModel.prototype.getDisplayedLeftColumns = function () {
4868 return this.displayedColumnsLeft;
4869 };
4870 ColumnModel.prototype.getDisplayedRightColumns = function () {
4871 return this.displayedColumnsRight;
4872 };
4873 ColumnModel.prototype.getDisplayedColumns = function (type) {
4874 switch (type) {
4875 case Constants.PINNED_LEFT:
4876 return this.getDisplayedLeftColumns();
4877 case Constants.PINNED_RIGHT:
4878 return this.getDisplayedRightColumns();
4879 default:
4880 return this.getDisplayedCenterColumns();
4881 }
4882 };
4883 // used by:
4884 // + clientSideRowController -> sorting, building quick filter text
4885 // + headerRenderer -> sorting (clearing icon)
4886 ColumnModel.prototype.getAllPrimaryColumns = function () {
4887 return this.primaryColumns ? this.primaryColumns.slice() : null;
4888 };
4889 ColumnModel.prototype.getSecondaryColumns = function () {
4890 return this.secondaryColumns ? this.secondaryColumns.slice() : null;
4891 };
4892 ColumnModel.prototype.getAllColumnsForQuickFilter = function () {
4893 return this.columnsForQuickFilter;
4894 };
4895 // + moveColumnController
4896 ColumnModel.prototype.getAllGridColumns = function () {
4897 return this.gridColumns;
4898 };
4899 ColumnModel.prototype.isEmpty = function () {
4900 return missingOrEmpty(this.gridColumns);
4901 };
4902 ColumnModel.prototype.isRowGroupEmpty = function () {
4903 return missingOrEmpty(this.rowGroupColumns);
4904 };
4905 ColumnModel.prototype.setColumnVisible = function (key, visible, source) {
4906 if (source === void 0) { source = "api"; }
4907 this.setColumnsVisible([key], visible, source);
4908 };
4909 ColumnModel.prototype.setColumnsVisible = function (keys, visible, source) {
4910 var _this = this;
4911 if (visible === void 0) { visible = false; }
4912 if (source === void 0) { source = "api"; }
4913 this.columnAnimationService.start();
4914 this.actionOnGridColumns(keys, function (column) {
4915 if (column.isVisible() !== visible) {
4916 column.setVisible(visible, source);
4917 return true;
4918 }
4919 return false;
4920 }, source, function () {
4921 var event = {
4922 type: Events.EVENT_COLUMN_VISIBLE,
4923 visible: visible,
4924 column: null,
4925 columns: null,
4926 api: _this.gridApi,
4927 columnApi: _this.columnApi,
4928 source: source
4929 };
4930 return event;
4931 });
4932 this.columnAnimationService.finish();
4933 };
4934 ColumnModel.prototype.setColumnPinned = function (key, pinned, source) {
4935 if (source === void 0) { source = "api"; }
4936 if (key) {
4937 this.setColumnsPinned([key], pinned, source);
4938 }
4939 };
4940 ColumnModel.prototype.setColumnsPinned = function (keys, pinned, source) {
4941 var _this = this;
4942 if (source === void 0) { source = "api"; }
4943 if (this.gridOptionsWrapper.getDomLayout() === 'print') {
4944 console.warn("Changing the column pinning status is not allowed with domLayout='print'");
4945 return;
4946 }
4947 this.columnAnimationService.start();
4948 var actualPinned;
4949 if (pinned === true || pinned === Constants.PINNED_LEFT) {
4950 actualPinned = Constants.PINNED_LEFT;
4951 }
4952 else if (pinned === Constants.PINNED_RIGHT) {
4953 actualPinned = Constants.PINNED_RIGHT;
4954 }
4955 else {
4956 actualPinned = null;
4957 }
4958 this.actionOnGridColumns(keys, function (col) {
4959 if (col.getPinned() !== actualPinned) {
4960 col.setPinned(actualPinned);
4961 return true;
4962 }
4963 return false;
4964 }, source, function () {
4965 var event = {
4966 type: Events.EVENT_COLUMN_PINNED,
4967 pinned: actualPinned,
4968 column: null,
4969 columns: null,
4970 api: _this.gridApi,
4971 columnApi: _this.columnApi,
4972 source: source
4973 };
4974 return event;
4975 });
4976 this.columnAnimationService.finish();
4977 };
4978 // does an action on a set of columns. provides common functionality for looking up the
4979 // columns based on key, getting a list of effected columns, and then updated the event
4980 // with either one column (if it was just one col) or a list of columns
4981 // used by: autoResize, setVisible, setPinned
4982 ColumnModel.prototype.actionOnGridColumns = function (// the column keys this action will be on
4983 keys,
4984 // the action to do - if this returns false, the column was skipped
4985 // and won't be included in the event
4986 action,
4987 // should return back a column event of the right type
4988 source, createEvent) {
4989 var _this = this;
4990 if (missingOrEmpty(keys)) {
4991 return;
4992 }
4993 var updatedColumns = [];
4994 keys.forEach(function (key) {
4995 var column = _this.getGridColumn(key);
4996 if (!column) {
4997 return;
4998 }
4999 // need to check for false with type (ie !== instead of !=)
5000 // as not returning anything (undefined) would also be false
5001 var resultOfAction = action(column);
5002 if (resultOfAction !== false) {
5003 updatedColumns.push(column);
5004 }
5005 });
5006 if (!updatedColumns.length) {
5007 return;
5008 }
5009 this.updateDisplayedColumns(source);
5010 if (exists(createEvent) && createEvent) {
5011 var event_4 = createEvent();
5012 event_4.columns = updatedColumns;
5013 event_4.column = updatedColumns.length === 1 ? updatedColumns[0] : null;
5014 this.eventService.dispatchEvent(event_4);
5015 }
5016 };
5017 ColumnModel.prototype.getDisplayedColBefore = function (col) {
5018 var allDisplayedColumns = this.getAllDisplayedColumns();
5019 var oldIndex = allDisplayedColumns.indexOf(col);
5020 if (oldIndex > 0) {
5021 return allDisplayedColumns[oldIndex - 1];
5022 }
5023 return null;
5024 };
5025 // used by:
5026 // + rowRenderer -> for navigation
5027 ColumnModel.prototype.getDisplayedColAfter = function (col) {
5028 var allDisplayedColumns = this.getAllDisplayedColumns();
5029 var oldIndex = allDisplayedColumns.indexOf(col);
5030 if (oldIndex < (allDisplayedColumns.length - 1)) {
5031 return allDisplayedColumns[oldIndex + 1];
5032 }
5033 return null;
5034 };
5035 ColumnModel.prototype.getDisplayedGroupAfter = function (columnGroup) {
5036 return this.getDisplayedGroupAtDirection(columnGroup, 'After');
5037 };
5038 ColumnModel.prototype.getDisplayedGroupBefore = function (columnGroup) {
5039 return this.getDisplayedGroupAtDirection(columnGroup, 'Before');
5040 };
5041 ColumnModel.prototype.getDisplayedGroupAtDirection = function (columnGroup, direction) {
5042 // pick the last displayed column in this group
5043 var requiredLevel = columnGroup.getProvidedColumnGroup().getLevel() + columnGroup.getPaddingLevel();
5044 var colGroupLeafColumns = columnGroup.getDisplayedLeafColumns();
5045 var col = direction === 'After' ? last(colGroupLeafColumns) : colGroupLeafColumns[0];
5046 var getDisplayColMethod = "getDisplayedCol" + direction;
5047 while (true) {
5048 // keep moving to the next col, until we get to another group
5049 var column = this[getDisplayColMethod](col);
5050 if (!column) {
5051 return null;
5052 }
5053 var groupPointer = this.getColumnGroupAtLevel(column, requiredLevel);
5054 if (groupPointer !== columnGroup) {
5055 return groupPointer;
5056 }
5057 }
5058 };
5059 ColumnModel.prototype.getColumnGroupAtLevel = function (column, level) {
5060 // get group at same level as the one we are looking for
5061 var groupPointer = column.getParent();
5062 var originalGroupLevel;
5063 var groupPointerLevel;
5064 while (true) {
5065 var groupPointerProvidedColumnGroup = groupPointer.getProvidedColumnGroup();
5066 originalGroupLevel = groupPointerProvidedColumnGroup.getLevel();
5067 groupPointerLevel = groupPointer.getPaddingLevel();
5068 if (originalGroupLevel + groupPointerLevel <= level) {
5069 break;
5070 }
5071 groupPointer = groupPointer.getParent();
5072 }
5073 return groupPointer;
5074 };
5075 ColumnModel.prototype.isPinningLeft = function () {
5076 return this.displayedColumnsLeft.length > 0;
5077 };
5078 ColumnModel.prototype.isPinningRight = function () {
5079 return this.displayedColumnsRight.length > 0;
5080 };
5081 ColumnModel.prototype.getPrimaryAndSecondaryAndAutoColumns = function () {
5082 var _a;
5083 return (_a = []).concat.apply(_a, __spread([
5084 this.primaryColumns || [],
5085 this.groupAutoColumns || [],
5086 this.secondaryColumns || [],
5087 ]));
5088 };
5089 ColumnModel.prototype.getPrimaryAndAutoGroupCols = function () {
5090 var _a;
5091 return (_a = []).concat.apply(_a, __spread([
5092 this.primaryColumns || [],
5093 this.groupAutoColumns || [],
5094 ]));
5095 };
5096 ColumnModel.prototype.getPrimaryAndSecondaryColumns = function () {
5097 var _a;
5098 return (_a = []).concat.apply(_a, __spread([
5099 this.primaryColumns || [],
5100 this.secondaryColumns || [],
5101 ]));
5102 };
5103 ColumnModel.prototype.createStateItemFromColumn = function (column) {
5104 var rowGroupIndex = column.isRowGroupActive() ? this.rowGroupColumns.indexOf(column) : null;
5105 var pivotIndex = column.isPivotActive() ? this.pivotColumns.indexOf(column) : null;
5106 var aggFunc = column.isValueActive() ? column.getAggFunc() : null;
5107 var sort = column.getSort() != null ? column.getSort() : null;
5108 var sortIndex = column.getSortIndex() != null ? column.getSortIndex() : null;
5109 var flex = column.getFlex() != null && column.getFlex() > 0 ? column.getFlex() : null;
5110 var res = {
5111 colId: column.getColId(),
5112 width: column.getActualWidth(),
5113 hide: !column.isVisible(),
5114 pinned: column.getPinned(),
5115 sort: sort,
5116 sortIndex: sortIndex,
5117 aggFunc: aggFunc,
5118 rowGroup: column.isRowGroupActive(),
5119 rowGroupIndex: rowGroupIndex,
5120 pivot: column.isPivotActive(),
5121 pivotIndex: pivotIndex,
5122 flex: flex
5123 };
5124 return res;
5125 };
5126 ColumnModel.prototype.getColumnState = function () {
5127 if (missing(this.primaryColumns) || !this.isAlive()) {
5128 return [];
5129 }
5130 var colsForState = this.getPrimaryAndSecondaryAndAutoColumns();
5131 var res = colsForState.map(this.createStateItemFromColumn.bind(this));
5132 this.orderColumnStateList(res);
5133 return res;
5134 };
5135 ColumnModel.prototype.orderColumnStateList = function (columnStateList) {
5136 // for fast looking, store the index of each column
5137 var colIdToGridIndexMap = convertToMap(this.gridColumns.map(function (col, index) { return [col.getColId(), index]; }));
5138 columnStateList.sort(function (itemA, itemB) {
5139 var posA = colIdToGridIndexMap.has(itemA.colId) ? colIdToGridIndexMap.get(itemA.colId) : -1;
5140 var posB = colIdToGridIndexMap.has(itemB.colId) ? colIdToGridIndexMap.get(itemB.colId) : -1;
5141 return posA - posB;
5142 });
5143 };
5144 ColumnModel.prototype.resetColumnState = function (source) {
5145 // NOTE = there is one bug here that no customer has noticed - if a column has colDef.lockPosition,
5146 // this is ignored below when ordering the cols. to work, we should always put lockPosition cols first.
5147 // As a work around, developers should just put lockPosition columns first in their colDef list.
5148 if (source === void 0) { source = "api"; }
5149 // we can't use 'allColumns' as the order might of messed up, so get the primary ordered list
5150 var primaryColumns = this.getColumnsFromTree(this.primaryColumnTree);
5151 var columnStates = [];
5152 // we start at 1000, so if user has mix of rowGroup and group specified, it will work with both.
5153 // eg IF user has ColA.rowGroupIndex=0, ColB.rowGroupIndex=1, ColC.rowGroup=true,
5154 // THEN result will be ColA.rowGroupIndex=0, ColB.rowGroupIndex=1, ColC.rowGroup=1000
5155 var letRowGroupIndex = 1000;
5156 var letPivotIndex = 1000;
5157 var colsToProcess = [];
5158 if (this.groupAutoColumns) {
5159 colsToProcess = colsToProcess.concat(this.groupAutoColumns);
5160 }
5161 if (primaryColumns) {
5162 colsToProcess = colsToProcess.concat(primaryColumns);
5163 }
5164 colsToProcess.forEach(function (column) {
5165 var getValueOrNull = function (a, b) { return a != null ? a : b != null ? b : null; };
5166 var colDef = column.getColDef();
5167 var sort = getValueOrNull(colDef.sort, colDef.initialSort);
5168 var sortIndex = getValueOrNull(colDef.sortIndex, colDef.initialSortIndex);
5169 var hide = getValueOrNull(colDef.hide, colDef.initialHide);
5170 var pinned = getValueOrNull(colDef.pinned, colDef.initialPinned);
5171 var width = getValueOrNull(colDef.width, colDef.initialWidth);
5172 var flex = getValueOrNull(colDef.flex, colDef.initialFlex);
5173 var rowGroupIndex = getValueOrNull(colDef.rowGroupIndex, colDef.initialRowGroupIndex);
5174 var rowGroup = getValueOrNull(colDef.rowGroup, colDef.initialRowGroup);
5175 if (rowGroupIndex == null && (rowGroup == null || rowGroup == false)) {
5176 rowGroupIndex = null;
5177 rowGroup = null;
5178 }
5179 var pivotIndex = getValueOrNull(colDef.pivotIndex, colDef.initialPivotIndex);
5180 var pivot = getValueOrNull(colDef.pivot, colDef.initialPivot);
5181 if (pivotIndex == null && (pivot == null || pivot == false)) {
5182 pivotIndex = null;
5183 pivot = null;
5184 }
5185 var aggFunc = getValueOrNull(colDef.aggFunc, colDef.initialAggFunc);
5186 var stateItem = {
5187 colId: column.getColId(),
5188 sort: sort,
5189 sortIndex: sortIndex,
5190 hide: hide,
5191 pinned: pinned,
5192 width: width,
5193 flex: flex,
5194 rowGroup: rowGroup,
5195 rowGroupIndex: rowGroupIndex,
5196 pivot: pivot,
5197 pivotIndex: pivotIndex,
5198 aggFunc: aggFunc,
5199 };
5200 if (missing(rowGroupIndex) && rowGroup) {
5201 stateItem.rowGroupIndex = letRowGroupIndex++;
5202 }
5203 if (missing(pivotIndex) && pivot) {
5204 stateItem.pivotIndex = letPivotIndex++;
5205 }
5206 columnStates.push(stateItem);
5207 });
5208 this.applyColumnState({ state: columnStates, applyOrder: true }, source);
5209 };
5210 ColumnModel.prototype.applyColumnState = function (params, source) {
5211 var _this = this;
5212 if (source === void 0) { source = "api"; }
5213 if (missingOrEmpty(this.primaryColumns)) {
5214 return false;
5215 }
5216 if (params && params.state && !params.state.forEach) {
5217 console.warn('AG Grid: applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state.');
5218 return false;
5219 }
5220 var applyStates = function (states, existingColumns, getById) {
5221 var raiseEventsFunc = _this.compareColumnStatesAndRaiseEvents(source);
5222 _this.autoGroupsNeedBuilding = true;
5223 // at the end below, this list will have all columns we got no state for
5224 var columnsWithNoState = existingColumns.slice();
5225 var rowGroupIndexes = {};
5226 var pivotIndexes = {};
5227 var autoGroupColumnStates = [];
5228 // If pivoting is modified, these are the states we try to reapply after
5229 // the secondary columns are re-generated
5230 var unmatchedAndAutoStates = [];
5231 var unmatchedCount = 0;
5232 var previousRowGroupCols = _this.rowGroupColumns.slice();
5233 var previousPivotCols = _this.pivotColumns.slice();
5234 states.forEach(function (state) {
5235 var colId = state.colId || '';
5236 // auto group columns are re-created so deferring syncing with ColumnState
5237 var isAutoGroupColumn = colId.startsWith(Constants.GROUP_AUTO_COLUMN_ID);
5238 if (isAutoGroupColumn) {
5239 autoGroupColumnStates.push(state);
5240 unmatchedAndAutoStates.push(state);
5241 return;
5242 }
5243 var column = getById(colId);
5244 if (!column) {
5245 unmatchedAndAutoStates.push(state);
5246 unmatchedCount += 1;
5247 }
5248 else {
5249 _this.syncColumnWithStateItem(column, state, params.defaultState, rowGroupIndexes, pivotIndexes, false, source);
5250 removeFromArray(columnsWithNoState, column);
5251 }
5252 });
5253 // anything left over, we got no data for, so add in the column as non-value, non-rowGroup and hidden
5254 var applyDefaultsFunc = function (col) {
5255 return _this.syncColumnWithStateItem(col, null, params.defaultState, rowGroupIndexes, pivotIndexes, false, source);
5256 };
5257 columnsWithNoState.forEach(applyDefaultsFunc);
5258 // sort the lists according to the indexes that were provided
5259 var comparator = function (indexes, oldList, colA, colB) {
5260 var indexA = indexes[colA.getId()];
5261 var indexB = indexes[colB.getId()];
5262 var aHasIndex = indexA != null;
5263 var bHasIndex = indexB != null;
5264 if (aHasIndex && bHasIndex) {
5265 // both a and b are new cols with index, so sort on index
5266 return indexA - indexB;
5267 }
5268 if (aHasIndex) {
5269 // a has an index, so it should be before a
5270 return -1;
5271 }
5272 if (bHasIndex) {
5273 // b has an index, so it should be before a
5274 return 1;
5275 }
5276 var oldIndexA = oldList.indexOf(colA);
5277 var oldIndexB = oldList.indexOf(colB);
5278 var aHasOldIndex = oldIndexA >= 0;
5279 var bHasOldIndex = oldIndexB >= 0;
5280 if (aHasOldIndex && bHasOldIndex) {
5281 // both a and b are old cols, so sort based on last order
5282 return oldIndexA - oldIndexB;
5283 }
5284 if (aHasOldIndex) {
5285 // a is old, b is new, so b is first
5286 return -1;
5287 }
5288 // this bit does matter, means both are new cols
5289 // but without index or that b is old and a is new
5290 return 1;
5291 };
5292 _this.rowGroupColumns.sort(comparator.bind(_this, rowGroupIndexes, previousRowGroupCols));
5293 _this.pivotColumns.sort(comparator.bind(_this, pivotIndexes, previousPivotCols));
5294 _this.updateGridColumns();
5295 // sync newly created auto group columns with ColumnState
5296 var autoGroupColsCopy = _this.groupAutoColumns ? _this.groupAutoColumns.slice() : [];
5297 autoGroupColumnStates.forEach(function (stateItem) {
5298 var autoCol = _this.getAutoColumn(stateItem.colId);
5299 removeFromArray(autoGroupColsCopy, autoCol);
5300 _this.syncColumnWithStateItem(autoCol, stateItem, params.defaultState, null, null, true, source);
5301 });
5302 // autogroup cols with nothing else, apply the default
5303 autoGroupColsCopy.forEach(applyDefaultsFunc);
5304 _this.applyOrderAfterApplyState(params);
5305 _this.updateDisplayedColumns(source);
5306 _this.dispatchEverythingChanged(source);
5307 raiseEventsFunc(); // Will trigger secondary column changes if pivoting modified
5308 return { unmatchedAndAutoStates: unmatchedAndAutoStates, unmatchedCount: unmatchedCount };
5309 };
5310 this.columnAnimationService.start();
5311 var _a = applyStates(params.state || [], this.primaryColumns || [], function (id) { return _this.getPrimaryColumn(id); }), unmatchedAndAutoStates = _a.unmatchedAndAutoStates, unmatchedCount = _a.unmatchedCount;
5312 // If there are still states left over, see if we can apply them to newly generated
5313 // secondary or auto columns. Also if defaults exist, ensure they are applied to secondary cols
5314 if (unmatchedAndAutoStates.length > 0 || exists(params.defaultState)) {
5315 unmatchedCount = applyStates(unmatchedAndAutoStates, this.secondaryColumns || [], function (id) { return _this.getSecondaryColumn(id); }).unmatchedCount;
5316 }
5317 this.columnAnimationService.finish();
5318 return unmatchedCount === 0; // Successful if no states unaccounted for
5319 };
5320 ColumnModel.prototype.applyOrderAfterApplyState = function (params) {
5321 var _this = this;
5322 if (!params.applyOrder || !params.state) {
5323 return;
5324 }
5325 var newOrder = [];
5326 var processedColIds = {};
5327 params.state.forEach(function (item) {
5328 if (!item.colId || processedColIds[item.colId]) {
5329 return;
5330 }
5331 var col = _this.gridColumnsMap[item.colId];
5332 if (col) {
5333 newOrder.push(col);
5334 processedColIds[item.colId] = true;
5335 }
5336 });
5337 // add in all other columns
5338 var autoGroupInsertIndex = 0;
5339 this.gridColumns.forEach(function (col) {
5340 var colId = col.getColId();
5341 var alreadyProcessed = processedColIds[colId] != null;
5342 if (alreadyProcessed) {
5343 return;
5344 }
5345 var isAutoGroupCol = colId.startsWith(Constants.GROUP_AUTO_COLUMN_ID);
5346 if (isAutoGroupCol) {
5347 // auto group columns, if missing from state list, are added to the start.
5348 // it's common to have autoGroup missing, as grouping could be on by default
5349 // on a column, but the user could of since removed the grouping via the UI.
5350 // if we don't inc the insert index, autoGroups will be inserted in reverse order
5351 insertIntoArray(newOrder, col, autoGroupInsertIndex++);
5352 }
5353 else {
5354 // normal columns, if missing from state list, are added at the end
5355 newOrder.push(col);
5356 }
5357 });
5358 // this is already done in updateGridColumns, however we changed the order above (to match the order of the state
5359 // columns) so we need to do it again. we could of put logic into the order above to take into account fixed
5360 // columns, however if we did then we would have logic for updating fixed columns twice. reusing the logic here
5361 // is less sexy for the code here, but it keeps consistency.
5362 newOrder = this.placeLockedColumns(newOrder);
5363 if (!this.doesMovePassMarryChildren(newOrder)) {
5364 console.warn('AG Grid: Applying column order broke a group where columns should be married together. Applying new order has been discarded.');
5365 return;
5366 }
5367 this.gridColumns = newOrder;
5368 };
5369 ColumnModel.prototype.compareColumnStatesAndRaiseEvents = function (source) {
5370 var _this = this;
5371 var startState = {
5372 rowGroupColumns: this.rowGroupColumns.slice(),
5373 pivotColumns: this.pivotColumns.slice(),
5374 valueColumns: this.valueColumns.slice()
5375 };
5376 var columnStateBefore = this.getColumnState();
5377 var columnStateBeforeMap = {};
5378 columnStateBefore.forEach(function (col) {
5379 columnStateBeforeMap[col.colId] = col;
5380 });
5381 return function () {
5382 if (_this.gridOptionsWrapper.isSuppressColumnStateEvents()) {
5383 return;
5384 }
5385 var colsForState = _this.getPrimaryAndSecondaryAndAutoColumns();
5386 // raises generic ColumnEvents where all columns are returned rather than what has changed
5387 var raiseWhenListsDifferent = function (eventType, colsBefore, colsAfter, idMapper) {
5388 var beforeList = colsBefore.map(idMapper);
5389 var afterList = colsAfter.map(idMapper);
5390 var unchanged = areEqual(beforeList, afterList);
5391 if (unchanged) {
5392 return;
5393 }
5394 // returning all columns rather than what has changed!
5395 var event = {
5396 type: eventType,
5397 columns: colsAfter,
5398 column: colsAfter.length === 1 ? colsAfter[0] : null,
5399 api: _this.gridApi,
5400 columnApi: _this.columnApi,
5401 source: source
5402 };
5403 _this.eventService.dispatchEvent(event);
5404 };
5405 // determines which columns have changed according to supplied predicate
5406 var getChangedColumns = function (changedPredicate) {
5407 var changedColumns = [];
5408 colsForState.forEach(function (column) {
5409 var colStateBefore = columnStateBeforeMap[column.getColId()];
5410 if (colStateBefore && changedPredicate(colStateBefore, column)) {
5411 changedColumns.push(column);
5412 }
5413 });
5414 return changedColumns;
5415 };
5416 var columnIdMapper = function (c) { return c.getColId(); };
5417 raiseWhenListsDifferent(Events.EVENT_COLUMN_ROW_GROUP_CHANGED, startState.rowGroupColumns, _this.rowGroupColumns, columnIdMapper);
5418 raiseWhenListsDifferent(Events.EVENT_COLUMN_PIVOT_CHANGED, startState.pivotColumns, _this.pivotColumns, columnIdMapper);
5419 var valueChangePredicate = function (cs, c) {
5420 var oldActive = cs.aggFunc != null;
5421 var activeChanged = oldActive != c.isValueActive();
5422 // we only check aggFunc if the agg is active
5423 var aggFuncChanged = oldActive && cs.aggFunc != c.getAggFunc();
5424 return activeChanged || aggFuncChanged;
5425 };
5426 var changedValues = getChangedColumns(valueChangePredicate);
5427 if (changedValues.length > 0) {
5428 // we pass all value columns, now the ones that changed. this is the same
5429 // as pivot and rowGroup cols, but different to all other properties below.
5430 // this is more for backwards compatibility, as it's always been this way.
5431 // really it should be the other way, as the order of the cols makes no difference
5432 // for valueColumns (apart from displaying them in the tool panel).
5433 _this.fireColumnEvent(Events.EVENT_COLUMN_VALUE_CHANGED, _this.valueColumns, source);
5434 }
5435 var resizeChangePredicate = function (cs, c) { return cs.width != c.getActualWidth(); };
5436 _this.fireColumnResizedEvent(getChangedColumns(resizeChangePredicate), true, source);
5437 var pinnedChangePredicate = function (cs, c) { return cs.pinned != c.getPinned(); };
5438 _this.raiseColumnPinnedEvent(getChangedColumns(pinnedChangePredicate), source);
5439 var visibilityChangePredicate = function (cs, c) { return cs.hide == c.isVisible(); };
5440 _this.raiseColumnVisibleEvent(getChangedColumns(visibilityChangePredicate), source);
5441 var sortChangePredicate = function (cs, c) { return cs.sort != c.getSort() || cs.sortIndex != c.getSortIndex(); };
5442 if (getChangedColumns(sortChangePredicate).length > 0) {
5443 _this.sortController.dispatchSortChangedEvents(source);
5444 }
5445 // special handling for moved column events
5446 _this.raiseColumnMovedEvent(columnStateBefore, source);
5447 };
5448 };
5449 ColumnModel.prototype.raiseColumnPinnedEvent = function (changedColumns, source) {
5450 if (!changedColumns.length) {
5451 return;
5452 }
5453 // if just one column, we use this, otherwise we don't include the col
5454 var column = changedColumns.length === 1 ? changedColumns[0] : null;
5455 // only include visible if it's common in all columns
5456 var pinned = this.getCommonValue(changedColumns, function (col) { return col.getPinned(); });
5457 var event = {
5458 type: Events.EVENT_COLUMN_PINNED,
5459 // mistake in typing, 'undefined' should be allowed, as 'null' means 'not pinned'
5460 pinned: pinned != null ? pinned : null,
5461 columns: changedColumns,
5462 column: column,
5463 api: this.gridApi,
5464 columnApi: this.columnApi,
5465 source: source
5466 };
5467 this.eventService.dispatchEvent(event);
5468 };
5469 ColumnModel.prototype.getCommonValue = function (cols, valueGetter) {
5470 if (!cols || cols.length == 0) {
5471 return undefined;
5472 }
5473 // compare each value to the first value. if nothing differs, then value is common so return it.
5474 var firstValue = valueGetter(cols[0]);
5475 for (var i = 1; i < cols.length; i++) {
5476 if (firstValue !== valueGetter(cols[i])) {
5477 // values differ, no common value
5478 return undefined;
5479 }
5480 }
5481 return firstValue;
5482 };
5483 ColumnModel.prototype.raiseColumnVisibleEvent = function (changedColumns, source) {
5484 if (!changedColumns.length) {
5485 return;
5486 }
5487 // if just one column, we use this, otherwise we don't include the col
5488 var column = changedColumns.length === 1 ? changedColumns[0] : null;
5489 // only include visible if it's common in all columns
5490 var visible = this.getCommonValue(changedColumns, function (col) { return col.isVisible(); });
5491 var event = {
5492 type: Events.EVENT_COLUMN_VISIBLE,
5493 visible: visible,
5494 columns: changedColumns,
5495 column: column,
5496 api: this.gridApi,
5497 columnApi: this.columnApi,
5498 source: source
5499 };
5500 this.eventService.dispatchEvent(event);
5501 };
5502 ColumnModel.prototype.raiseColumnMovedEvent = function (colStateBefore, source) {
5503 // we are only interested in columns that were both present and visible before and after
5504 var _this = this;
5505 var colStateAfter = this.getColumnState();
5506 var colStateAfterMapped = {};
5507 colStateAfter.forEach(function (s) { return colStateAfterMapped[s.colId] = s; });
5508 // get id's of cols in both before and after lists
5509 var colsIntersectIds = {};
5510 colStateBefore.forEach(function (s) {
5511 if (colStateAfterMapped[s.colId]) {
5512 colsIntersectIds[s.colId] = true;
5513 }
5514 });
5515 // filter state lists, so we only have cols that were present before and after
5516 var beforeFiltered = colStateBefore.filter(function (c) { return colsIntersectIds[c.colId]; });
5517 var afterFiltered = colStateAfter.filter(function (c) { return colsIntersectIds[c.colId]; });
5518 // see if any cols are in a different location
5519 var movedColumns = [];
5520 afterFiltered.forEach(function (csAfter, index) {
5521 var csBefore = beforeFiltered && beforeFiltered[index];
5522 if (csBefore && csBefore.colId !== csAfter.colId) {
5523 var gridCol = _this.getGridColumn(csBefore.colId);
5524 if (gridCol) {
5525 movedColumns.push(gridCol);
5526 }
5527 }
5528 });
5529 if (!movedColumns.length) {
5530 return;
5531 }
5532 var event = {
5533 type: Events.EVENT_COLUMN_MOVED,
5534 columns: movedColumns,
5535 column: null,
5536 api: this.gridApi,
5537 columnApi: this.columnApi,
5538 source: source
5539 };
5540 this.eventService.dispatchEvent(event);
5541 };
5542 ColumnModel.prototype.syncColumnWithStateItem = function (column, stateItem, defaultState, rowGroupIndexes, pivotIndexes, autoCol, source) {
5543 if (!column) {
5544 return;
5545 }
5546 var getValue = function (key1, key2) {
5547 var obj = { value1: undefined, value2: undefined };
5548 var calculated = false;
5549 if (stateItem) {
5550 if (stateItem[key1] !== undefined) {
5551 obj.value1 = stateItem[key1];
5552 calculated = true;
5553 }
5554 if (exists(key2) && stateItem[key2] !== undefined) {
5555 obj.value2 = stateItem[key2];
5556 calculated = true;
5557 }
5558 }
5559 if (!calculated && defaultState) {
5560 if (defaultState[key1] !== undefined) {
5561 obj.value1 = defaultState[key1];
5562 }
5563 if (exists(key2) && defaultState[key2] !== undefined) {
5564 obj.value2 = defaultState[key2];
5565 }
5566 }
5567 return obj;
5568 };
5569 // following ensures we are left with boolean true or false, eg converts (null, undefined, 0) all to true
5570 var hide = getValue('hide').value1;
5571 if (hide !== undefined) {
5572 column.setVisible(!hide, source);
5573 }
5574 // sets pinned to 'left' or 'right'
5575 var pinned = getValue('pinned').value1;
5576 if (pinned !== undefined) {
5577 column.setPinned(pinned);
5578 }
5579 // if width provided and valid, use it, otherwise stick with the old width
5580 var minColWidth = this.columnUtils.calculateColMinWidth(column.getColDef());
5581 // flex
5582 var flex = getValue('flex').value1;
5583 if (flex !== undefined) {
5584 column.setFlex(flex);
5585 }
5586 // width - we only set width if column is not flexing
5587 var noFlexThisCol = column.getFlex() <= 0;
5588 if (noFlexThisCol) {
5589 // both null and undefined means we skip, as it's not possible to 'clear' width (a column must have a width)
5590 var width = getValue('width').value1;
5591 if (width != null) {
5592 if (minColWidth != null && width >= minColWidth) {
5593 column.setActualWidth(width, source);
5594 }
5595 }
5596 }
5597 var sort = getValue('sort').value1;
5598 if (sort !== undefined) {
5599 if (sort === Constants.SORT_DESC || sort === Constants.SORT_ASC) {
5600 column.setSort(sort, source);
5601 }
5602 else {
5603 column.setSort(undefined, source);
5604 }
5605 }
5606 var sortIndex = getValue('sortIndex').value1;
5607 if (sortIndex !== undefined) {
5608 column.setSortIndex(sortIndex);
5609 }
5610 // we do not do aggFunc, rowGroup or pivot for auto cols or secondary cols
5611 if (autoCol || !column.isPrimary()) {
5612 return;
5613 }
5614 var aggFunc = getValue('aggFunc').value1;
5615 if (aggFunc !== undefined) {
5616 if (typeof aggFunc === 'string') {
5617 column.setAggFunc(aggFunc);
5618 if (!column.isValueActive()) {
5619 column.setValueActive(true, source);
5620 this.valueColumns.push(column);
5621 }
5622 }
5623 else {
5624 if (exists(aggFunc)) {
5625 console.warn('AG Grid: stateItem.aggFunc must be a string. if using your own aggregation ' +
5626 'functions, register the functions first before using them in get/set state. This is because it is ' +
5627 'intended for the column state to be stored and retrieved as simple JSON.');
5628 }
5629 // Note: we do not call column.setAggFunc(null), so that next time we aggregate
5630 // by this column (eg drag the column to the agg section int he toolpanel) it will
5631 // default to the last aggregation function.
5632 if (column.isValueActive()) {
5633 column.setValueActive(false, source);
5634 removeFromArray(this.valueColumns, column);
5635 }
5636 }
5637 }
5638 var _a = getValue('rowGroup', 'rowGroupIndex'), rowGroup = _a.value1, rowGroupIndex = _a.value2;
5639 if (rowGroup !== undefined || rowGroupIndex !== undefined) {
5640 if (typeof rowGroupIndex === 'number' || rowGroup) {
5641 if (!column.isRowGroupActive()) {
5642 column.setRowGroupActive(true, source);
5643 this.rowGroupColumns.push(column);
5644 }
5645 if (rowGroupIndexes && typeof rowGroupIndex === 'number') {
5646 rowGroupIndexes[column.getId()] = rowGroupIndex;
5647 }
5648 }
5649 else {
5650 if (column.isRowGroupActive()) {
5651 column.setRowGroupActive(false, source);
5652 removeFromArray(this.rowGroupColumns, column);
5653 }
5654 }
5655 }
5656 var _b = getValue('pivot', 'pivotIndex'), pivot = _b.value1, pivotIndex = _b.value2;
5657 if (pivot !== undefined || pivotIndex !== undefined) {
5658 if (typeof pivotIndex === 'number' || pivot) {
5659 if (!column.isPivotActive()) {
5660 column.setPivotActive(true, source);
5661 this.pivotColumns.push(column);
5662 }
5663 if (pivotIndexes && typeof pivotIndex === 'number') {
5664 pivotIndexes[column.getId()] = pivotIndex;
5665 }
5666 }
5667 else {
5668 if (column.isPivotActive()) {
5669 column.setPivotActive(false, source);
5670 removeFromArray(this.pivotColumns, column);
5671 }
5672 }
5673 }
5674 };
5675 ColumnModel.prototype.getGridColumns = function (keys) {
5676 return this.getColumns(keys, this.getGridColumn.bind(this));
5677 };
5678 ColumnModel.prototype.getColumns = function (keys, columnLookupCallback) {
5679 var foundColumns = [];
5680 if (keys) {
5681 keys.forEach(function (key) {
5682 var column = columnLookupCallback(key);
5683 if (column) {
5684 foundColumns.push(column);
5685 }
5686 });
5687 }
5688 return foundColumns;
5689 };
5690 // used by growGroupPanel
5691 ColumnModel.prototype.getColumnWithValidation = function (key) {
5692 if (key == null) {
5693 return null;
5694 }
5695 var column = this.getGridColumn(key);
5696 if (!column) {
5697 console.warn('AG Grid: could not find column ' + key);
5698 }
5699 return column;
5700 };
5701 ColumnModel.prototype.getPrimaryColumn = function (key) {
5702 if (!this.primaryColumns) {
5703 return null;
5704 }
5705 return this.getColumn(key, this.primaryColumns, this.primaryColumnsMap);
5706 };
5707 ColumnModel.prototype.getGridColumn = function (key) {
5708 return this.getColumn(key, this.gridColumns, this.gridColumnsMap);
5709 };
5710 ColumnModel.prototype.getSecondaryColumn = function (key) {
5711 if (!this.secondaryColumns) {
5712 return null;
5713 }
5714 return this.getColumn(key, this.secondaryColumns, this.secondaryColumnsMap);
5715 };
5716 ColumnModel.prototype.getColumn = function (key, columnList, columnMap) {
5717 if (!key) {
5718 return null;
5719 }
5720 // most of the time this method gets called the key is a string, so we put this shortcut in
5721 // for performance reasons, to see if we can match for ID (it doesn't do auto columns, that's done below)
5722 if (typeof key == 'string' && columnMap[key]) {
5723 return columnMap[key];
5724 }
5725 for (var i = 0; i < columnList.length; i++) {
5726 if (this.columnsMatch(columnList[i], key)) {
5727 return columnList[i];
5728 }
5729 }
5730 return this.getAutoColumn(key);
5731 };
5732 ColumnModel.prototype.getAutoColumn = function (key) {
5733 var _this = this;
5734 if (!this.groupAutoColumns ||
5735 !exists(this.groupAutoColumns) ||
5736 missing(this.groupAutoColumns)) {
5737 return null;
5738 }
5739 return this.groupAutoColumns.find(function (groupCol) { return _this.columnsMatch(groupCol, key); }) || null;
5740 };
5741 ColumnModel.prototype.columnsMatch = function (column, key) {
5742 var columnMatches = column === key;
5743 var colDefMatches = column.getColDef() === key;
5744 var idMatches = column.getColId() == key;
5745 return columnMatches || colDefMatches || idMatches;
5746 };
5747 ColumnModel.prototype.getDisplayNameForColumn = function (column, location, includeAggFunc) {
5748 if (includeAggFunc === void 0) { includeAggFunc = false; }
5749 if (!column) {
5750 return null;
5751 }
5752 var headerName = this.getHeaderName(column.getColDef(), column, null, null, location);
5753 if (includeAggFunc) {
5754 return this.wrapHeaderNameWithAggFunc(column, headerName);
5755 }
5756 return headerName;
5757 };
5758 ColumnModel.prototype.getDisplayNameForProvidedColumnGroup = function (columnGroup, providedColumnGroup, location) {
5759 var colGroupDef = providedColumnGroup ? providedColumnGroup.getColGroupDef() : null;
5760 if (colGroupDef) {
5761 return this.getHeaderName(colGroupDef, null, columnGroup, providedColumnGroup, location);
5762 }
5763 return null;
5764 };
5765 ColumnModel.prototype.getDisplayNameForColumnGroup = function (columnGroup, location) {
5766 return this.getDisplayNameForProvidedColumnGroup(columnGroup, columnGroup.getProvidedColumnGroup(), location);
5767 };
5768 // location is where the column is going to appear, ie who is calling us
5769 ColumnModel.prototype.getHeaderName = function (colDef, column, columnGroup, providedColumnGroup, location) {
5770 var headerValueGetter = colDef.headerValueGetter;
5771 if (headerValueGetter) {
5772 var params = {
5773 colDef: colDef,
5774 column: column,
5775 columnGroup: columnGroup,
5776 providedColumnGroup: providedColumnGroup,
5777 location: location,
5778 api: this.gridOptionsWrapper.getApi(),
5779 columnApi: this.gridOptionsWrapper.getColumnApi(),
5780 context: this.gridOptionsWrapper.getContext()
5781 };
5782 if (typeof headerValueGetter === 'function') {
5783 // valueGetter is a function, so just call it
5784 return headerValueGetter(params);
5785 }
5786 else if (typeof headerValueGetter === 'string') {
5787 // valueGetter is an expression, so execute the expression
5788 return this.expressionService.evaluate(headerValueGetter, params);
5789 }
5790 console.warn('ag-grid: headerValueGetter must be a function or a string');
5791 return '';
5792 }
5793 else if (colDef.headerName != null) {
5794 return colDef.headerName;
5795 }
5796 else if (colDef.field) {
5797 return camelCaseToHumanText(colDef.field);
5798 }
5799 return '';
5800 };
5801 ColumnModel.prototype.wrapHeaderNameWithAggFunc = function (column, headerName) {
5802 if (this.gridOptionsWrapper.isSuppressAggFuncInHeader()) {
5803 return headerName;
5804 }
5805 // only columns with aggregation active can have aggregations
5806 var pivotValueColumn = column.getColDef().pivotValueColumn;
5807 var pivotActiveOnThisColumn = exists(pivotValueColumn);
5808 var aggFunc = null;
5809 var aggFuncFound;
5810 // otherwise we have a measure that is active, and we are doing aggregation on it
5811 if (pivotActiveOnThisColumn) {
5812 var isCollapsedHeaderEnabled = this.gridOptionsWrapper.isRemovePivotHeaderRowWhenSingleValueColumn() && this.valueColumns.length === 1;
5813 var isTotalColumn = column.getColDef().pivotTotalColumnIds !== undefined;
5814 if (isCollapsedHeaderEnabled && !isTotalColumn) {
5815 return headerName; // Skip decorating the header - in this case the label is the pivot key, not the value col
5816 }
5817 aggFunc = pivotValueColumn ? pivotValueColumn.getAggFunc() : null;
5818 aggFuncFound = true;
5819 }
5820 else {
5821 var measureActive = column.isValueActive();
5822 var aggregationPresent = this.pivotMode || !this.isRowGroupEmpty();
5823 if (measureActive && aggregationPresent) {
5824 aggFunc = column.getAggFunc();
5825 aggFuncFound = true;
5826 }
5827 else {
5828 aggFuncFound = false;
5829 }
5830 }
5831 if (aggFuncFound) {
5832 var aggFuncString = (typeof aggFunc === 'string') ? aggFunc : 'func';
5833 var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
5834 var aggFuncStringTranslated = localeTextFunc(aggFuncString, aggFuncString);
5835 return aggFuncStringTranslated + "(" + headerName + ")";
5836 }
5837 return headerName;
5838 };
5839 // returns the group with matching colId and instanceId. If instanceId is missing,
5840 // matches only on the colId.
5841 ColumnModel.prototype.getColumnGroup = function (colId, instanceId) {
5842 if (!colId) {
5843 return null;
5844 }
5845 if (colId instanceof ColumnGroup) {
5846 return colId;
5847 }
5848 var allColumnGroups = this.getAllDisplayedTrees();
5849 var checkInstanceId = typeof instanceId === 'number';
5850 var result = null;
5851 this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, function (child) {
5852 if (child instanceof ColumnGroup) {
5853 var columnGroup = child;
5854 var matched = void 0;
5855 if (checkInstanceId) {
5856 matched = colId === columnGroup.getGroupId() && instanceId === columnGroup.getInstanceId();
5857 }
5858 else {
5859 matched = colId === columnGroup.getGroupId();
5860 }
5861 if (matched) {
5862 result = columnGroup;
5863 }
5864 }
5865 });
5866 return result;
5867 };
5868 ColumnModel.prototype.isReady = function () {
5869 return this.ready;
5870 };
5871 ColumnModel.prototype.extractValueColumns = function (source, oldPrimaryColumns) {
5872 this.valueColumns = this.extractColumns(oldPrimaryColumns, this.valueColumns, function (col, flag) { return col.setValueActive(flag, source); },
5873 // aggFunc doesn't have index variant, cos order of value cols doesn't matter, so always return null
5874 function () { return undefined; }, function () { return undefined; },
5875 // aggFunc is a string, so return it's existence
5876 function (colDef) {
5877 var aggFunc = colDef.aggFunc;
5878 // null or empty string means clear
5879 if (aggFunc === null || aggFunc === '') {
5880 return null;
5881 }
5882 if (aggFunc === undefined) {
5883 return;
5884 }
5885 return !!aggFunc;
5886 }, function (colDef) {
5887 // return false if any of the following: null, undefined, empty string
5888 return colDef.initialAggFunc != null && colDef.initialAggFunc != '';
5889 });
5890 // all new columns added will have aggFunc missing, so set it to what is in the colDef
5891 this.valueColumns.forEach(function (col) {
5892 var colDef = col.getColDef();
5893 // if aggFunc provided, we always override, as reactive property
5894 if (colDef.aggFunc != null && colDef.aggFunc != '') {
5895 col.setAggFunc(colDef.aggFunc);
5896 }
5897 else {
5898 // otherwise we use initialAggFunc only if no agg func set - which happens when new column only
5899 if (!col.getAggFunc()) {
5900 col.setAggFunc(colDef.initialAggFunc);
5901 }
5902 }
5903 });
5904 };
5905 ColumnModel.prototype.extractRowGroupColumns = function (source, oldPrimaryColumns) {
5906 this.rowGroupColumns = this.extractColumns(oldPrimaryColumns, this.rowGroupColumns, function (col, flag) { return col.setRowGroupActive(flag, source); }, function (colDef) { return colDef.rowGroupIndex; }, function (colDef) { return colDef.initialRowGroupIndex; }, function (colDef) { return colDef.rowGroup; }, function (colDef) { return colDef.initialRowGroup; });
5907 };
5908 ColumnModel.prototype.extractColumns = function (oldPrimaryColumns, previousCols, setFlagFunc, getIndexFunc, getInitialIndexFunc, getValueFunc, getInitialValueFunc) {
5909 if (oldPrimaryColumns === void 0) { oldPrimaryColumns = []; }
5910 if (previousCols === void 0) { previousCols = []; }
5911 var colsWithIndex = [];
5912 var colsWithValue = [];
5913 // go though all cols.
5914 // if value, change
5915 // if default only, change only if new
5916 (this.primaryColumns || []).forEach(function (col) {
5917 var colIsNew = oldPrimaryColumns.indexOf(col) < 0;
5918 var colDef = col.getColDef();
5919 var value = attrToBoolean(getValueFunc(colDef));
5920 var initialValue = attrToBoolean(getInitialValueFunc(colDef));
5921 var index = attrToNumber(getIndexFunc(colDef));
5922 var initialIndex = attrToNumber(getInitialIndexFunc(colDef));
5923 var include;
5924 var valuePresent = value !== undefined;
5925 var indexPresent = index !== undefined;
5926 var initialValuePresent = initialValue !== undefined;
5927 var initialIndexPresent = initialIndex !== undefined;
5928 if (valuePresent) {
5929 include = value; // boolean value is guaranteed as attrToBoolean() is used above
5930 }
5931 else if (indexPresent) {
5932 if (index === null) {
5933 // if col is new we don't want to use the default / initial if index is set to null. Similarly,
5934 // we don't want to include the property for existing columns, i.e. we want to 'clear' it.
5935 include = false;
5936 }
5937 else {
5938 // note that 'null >= 0' evaluates to true which means 'rowGroupIndex = null' would enable row
5939 // grouping if the null check didn't exist above.
5940 include = index >= 0;
5941 }
5942 }
5943 else {
5944 if (colIsNew) {
5945 // as no value or index is 'present' we use the default / initial when col is new
5946 if (initialValuePresent) {
5947 include = initialValue;
5948 }
5949 else if (initialIndexPresent) {
5950 include = initialIndex != null && initialIndex >= 0;
5951 }
5952 else {
5953 include = false;
5954 }
5955 }
5956 else {
5957 // otherwise include it if included last time, e.g. if we are extracting row group cols and this col
5958 // is an existing row group col (i.e. it exists in 'previousCols') then we should include it.
5959 include = previousCols.indexOf(col) >= 0;
5960 }
5961 }
5962 if (include) {
5963 var useIndex = colIsNew ? (index != null || initialIndex != null) : index != null;
5964 useIndex ? colsWithIndex.push(col) : colsWithValue.push(col);
5965 }
5966 });
5967 var getIndexForCol = function (col) {
5968 var index = getIndexFunc(col.getColDef());
5969 var defaultIndex = getInitialIndexFunc(col.getColDef());
5970 return index != null ? index : defaultIndex;
5971 };
5972 // sort cols with index, and add these first
5973 colsWithIndex.sort(function (colA, colB) {
5974 var indexA = getIndexForCol(colA);
5975 var indexB = getIndexForCol(colB);
5976 if (indexA === indexB) {
5977 return 0;
5978 }
5979 if (indexA < indexB) {
5980 return -1;
5981 }
5982 return 1;
5983 });
5984 var res = [].concat(colsWithIndex);
5985 // second add columns that were there before and in the same order as they were before,
5986 // so we are preserving order of current grouping of columns that simply have rowGroup=true
5987 previousCols.forEach(function (col) {
5988 if (colsWithValue.indexOf(col) >= 0) {
5989 res.push(col);
5990 }
5991 });
5992 // lastly put in all remaining cols
5993 colsWithValue.forEach(function (col) {
5994 if (res.indexOf(col) < 0) {
5995 res.push(col);
5996 }
5997 });
5998 // set flag=false for removed cols
5999 previousCols.forEach(function (col) {
6000 if (res.indexOf(col) < 0) {
6001 setFlagFunc(col, false);
6002 }
6003 });
6004 // set flag=true for newly added cols
6005 res.forEach(function (col) {
6006 if (previousCols.indexOf(col) < 0) {
6007 setFlagFunc(col, true);
6008 }
6009 });
6010 return res;
6011 };
6012 ColumnModel.prototype.extractPivotColumns = function (source, oldPrimaryColumns) {
6013 this.pivotColumns = this.extractColumns(oldPrimaryColumns, this.pivotColumns, function (col, flag) { return col.setPivotActive(flag, source); }, function (colDef) { return colDef.pivotIndex; }, function (colDef) { return colDef.initialPivotIndex; }, function (colDef) { return colDef.pivot; }, function (colDef) { return colDef.initialPivot; });
6014 };
6015 ColumnModel.prototype.resetColumnGroupState = function (source) {
6016 if (source === void 0) { source = "api"; }
6017 var stateItems = [];
6018 this.columnUtils.depthFirstOriginalTreeSearch(null, this.primaryColumnTree, function (child) {
6019 if (child instanceof ProvidedColumnGroup) {
6020 var colGroupDef = child.getColGroupDef();
6021 var groupState = {
6022 groupId: child.getGroupId(),
6023 open: !colGroupDef ? undefined : colGroupDef.openByDefault
6024 };
6025 stateItems.push(groupState);
6026 }
6027 });
6028 this.setColumnGroupState(stateItems, source);
6029 };
6030 ColumnModel.prototype.getColumnGroupState = function () {
6031 var columnGroupState = [];
6032 this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (node) {
6033 if (node instanceof ProvidedColumnGroup) {
6034 columnGroupState.push({
6035 groupId: node.getGroupId(),
6036 open: node.isExpanded()
6037 });
6038 }
6039 });
6040 return columnGroupState;
6041 };
6042 ColumnModel.prototype.setColumnGroupState = function (stateItems, source) {
6043 var _this = this;
6044 if (source === void 0) { source = "api"; }
6045 this.columnAnimationService.start();
6046 var impactedGroups = [];
6047 stateItems.forEach(function (stateItem) {
6048 var groupKey = stateItem.groupId;
6049 var newValue = stateItem.open;
6050 var providedColumnGroup = _this.getProvidedColumnGroup(groupKey);
6051 if (!providedColumnGroup) {
6052 return;
6053 }
6054 if (providedColumnGroup.isExpanded() === newValue) {
6055 return;
6056 }
6057 _this.logger.log('columnGroupOpened(' + providedColumnGroup.getGroupId() + ',' + newValue + ')');
6058 providedColumnGroup.setExpanded(newValue);
6059 impactedGroups.push(providedColumnGroup);
6060 });
6061 this.updateGroupsAndDisplayedColumns(source);
6062 this.setFirstRightAndLastLeftPinned(source);
6063 impactedGroups.forEach(function (providedColumnGroup) {
6064 var event = {
6065 type: Events.EVENT_COLUMN_GROUP_OPENED,
6066 columnGroup: providedColumnGroup,
6067 api: _this.gridApi,
6068 columnApi: _this.columnApi
6069 };
6070 _this.eventService.dispatchEvent(event);
6071 });
6072 this.columnAnimationService.finish();
6073 };
6074 // called by headerRenderer - when a header is opened or closed
6075 ColumnModel.prototype.setColumnGroupOpened = function (key, newValue, source) {
6076 if (source === void 0) { source = "api"; }
6077 var keyAsString;
6078 if (key instanceof ProvidedColumnGroup) {
6079 keyAsString = key.getId();
6080 }
6081 else {
6082 keyAsString = key || '';
6083 }
6084 this.setColumnGroupState([{ groupId: keyAsString, open: newValue }], source);
6085 };
6086 ColumnModel.prototype.getProvidedColumnGroup = function (key) {
6087 // if (key instanceof ProvidedColumnGroup) { return key; }
6088 if (typeof key !== 'string') {
6089 console.error('AG Grid: group key must be a string');
6090 }
6091 // otherwise, search for the column group by id
6092 var res = null;
6093 this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function (node) {
6094 if (node instanceof ProvidedColumnGroup) {
6095 if (node.getId() === key) {
6096 res = node;
6097 }
6098 }
6099 });
6100 return res;
6101 };
6102 ColumnModel.prototype.calculateColumnsForDisplay = function () {
6103 var _this = this;
6104 var columnsForDisplay;
6105 if (this.pivotMode && missing(this.secondaryColumns)) {
6106 // pivot mode is on, but we are not pivoting, so we only
6107 // show columns we are aggregating on
6108 columnsForDisplay = this.gridColumns.filter(function (column) {
6109 var isAutoGroupCol = _this.groupAutoColumns && includes(_this.groupAutoColumns, column);
6110 var isValueCol = _this.valueColumns && includes(_this.valueColumns, column);
6111 return isAutoGroupCol || isValueCol;
6112 });
6113 }
6114 else {
6115 // otherwise continue as normal. this can be working on the primary
6116 // or secondary columns, whatever the gridColumns are set to
6117 columnsForDisplay = this.gridColumns.filter(function (column) {
6118 // keep col if a) it's auto-group or b) it's visible
6119 var isAutoGroupCol = _this.groupAutoColumns && includes(_this.groupAutoColumns, column);
6120 return isAutoGroupCol || column.isVisible();
6121 });
6122 }
6123 return columnsForDisplay;
6124 };
6125 ColumnModel.prototype.checkColSpanActiveInCols = function (columns) {
6126 var result = false;
6127 columns.forEach(function (col) {
6128 if (exists(col.getColDef().colSpan)) {
6129 result = true;
6130 }
6131 });
6132 return result;
6133 };
6134 ColumnModel.prototype.calculateColumnsForGroupDisplay = function () {
6135 var _this = this;
6136 this.groupDisplayColumns = [];
6137 var checkFunc = function (col) {
6138 var colDef = col.getColDef();
6139 if (colDef && exists(colDef.showRowGroup)) {
6140 _this.groupDisplayColumns.push(col);
6141 }
6142 };
6143 this.gridColumns.forEach(checkFunc);
6144 if (this.groupAutoColumns) {
6145 this.groupAutoColumns.forEach(checkFunc);
6146 }
6147 };
6148 ColumnModel.prototype.getGroupDisplayColumns = function () {
6149 return this.groupDisplayColumns;
6150 };
6151 ColumnModel.prototype.updateDisplayedColumns = function (source) {
6152 var columnsForDisplay = this.calculateColumnsForDisplay();
6153 this.buildDisplayedTrees(columnsForDisplay);
6154 this.calculateColumnsForGroupDisplay();
6155 // also called when group opened/closed
6156 this.updateGroupsAndDisplayedColumns(source);
6157 // also called when group opened/closed
6158 this.setFirstRightAndLastLeftPinned(source);
6159 };
6160 ColumnModel.prototype.isSecondaryColumnsPresent = function () {
6161 return exists(this.secondaryColumns);
6162 };
6163 ColumnModel.prototype.setSecondaryColumns = function (colDefs, source) {
6164 var _this = this;
6165 if (source === void 0) { source = "api"; }
6166 var newColsPresent = colDefs && colDefs.length > 0;
6167 // if not cols passed, and we had no cols anyway, then do nothing
6168 if (!newColsPresent && missing(this.secondaryColumns)) {
6169 return;
6170 }
6171 if (newColsPresent) {
6172 this.processSecondaryColumnDefinitions(colDefs);
6173 var balancedTreeResult = this.columnFactory.createColumnTree(colDefs, false, this.secondaryBalancedTree || this.previousSecondaryColumns || undefined);
6174 this.secondaryBalancedTree = balancedTreeResult.columnTree;
6175 this.secondaryHeaderRowCount = balancedTreeResult.treeDept + 1;
6176 this.secondaryColumns = this.getColumnsFromTree(this.secondaryBalancedTree);
6177 this.secondaryColumnsMap = {};
6178 this.secondaryColumns.forEach(function (col) { return _this.secondaryColumnsMap[col.getId()] = col; });
6179 this.previousSecondaryColumns = null;
6180 }
6181 else {
6182 this.previousSecondaryColumns = this.secondaryBalancedTree;
6183 this.secondaryBalancedTree = null;
6184 this.secondaryHeaderRowCount = -1;
6185 this.secondaryColumns = null;
6186 this.secondaryColumnsMap = {};
6187 }
6188 this.updateGridColumns();
6189 this.updateDisplayedColumns(source);
6190 };
6191 ColumnModel.prototype.processSecondaryColumnDefinitions = function (colDefs) {
6192 var columnCallback = this.gridOptionsWrapper.getProcessSecondaryColDefFunc();
6193 var groupCallback = this.gridOptionsWrapper.getProcessSecondaryColGroupDefFunc();
6194 if (!columnCallback && !groupCallback) {
6195 return undefined;
6196 }
6197 var searchForColDefs = function (colDefs2) {
6198 colDefs2.forEach(function (abstractColDef) {
6199 var isGroup = exists(abstractColDef.children);
6200 if (isGroup) {
6201 var colGroupDef = abstractColDef;
6202 if (groupCallback) {
6203 groupCallback(colGroupDef);
6204 }
6205 searchForColDefs(colGroupDef.children);
6206 }
6207 else {
6208 var colDef = abstractColDef;
6209 if (columnCallback) {
6210 columnCallback(colDef);
6211 }
6212 }
6213 });
6214 };
6215 if (colDefs) {
6216 searchForColDefs(colDefs);
6217 }
6218 };
6219 // called from: setColumnState, setColumnDefs, setSecondaryColumns
6220 ColumnModel.prototype.updateGridColumns = function () {
6221 var _this = this;
6222 if (this.gridColsArePrimary) {
6223 this.lastPrimaryOrder = this.gridColumns;
6224 }
6225 else {
6226 this.lastSecondaryOrder = this.gridColumns;
6227 }
6228 if (this.secondaryColumns && this.secondaryBalancedTree) {
6229 var hasSameColumns = this.secondaryColumns.every(function (col) {
6230 return _this.gridColumnsMap[col.getColId()] !== undefined;
6231 });
6232 this.gridBalancedTree = this.secondaryBalancedTree.slice();
6233 this.gridHeaderRowCount = this.secondaryHeaderRowCount;
6234 this.gridColumns = this.secondaryColumns.slice();
6235 this.gridColsArePrimary = false;
6236 // If the current columns are the same or a subset of the previous
6237 // we keep the previous order, otherwise we go back to the order the pivot
6238 // cols are generated in
6239 if (hasSameColumns) {
6240 this.orderGridColsLike(this.lastSecondaryOrder);
6241 }
6242 }
6243 else if (this.primaryColumns) {
6244 this.gridBalancedTree = this.primaryColumnTree.slice();
6245 this.gridHeaderRowCount = this.primaryHeaderRowCount;
6246 this.gridColumns = this.primaryColumns.slice();
6247 this.gridColsArePrimary = true;
6248 // updateGridColumns gets called after user adds a row group. we want to maintain the order of the columns
6249 // when this happens (eg if user moved a column) rather than revert back to the original column order.
6250 // likewise if changing in/out of pivot mode, we want to maintain the order of the cols
6251 this.orderGridColsLike(this.lastPrimaryOrder);
6252 }
6253 this.addAutoGroupToGridColumns();
6254 this.gridColumns = this.placeLockedColumns(this.gridColumns);
6255 this.setupQuickFilterColumns();
6256 this.clearDisplayedAndViewportColumns();
6257 this.colSpanActive = this.checkColSpanActiveInCols(this.gridColumns);
6258 this.gridColumnsMap = {};
6259 this.gridColumns.forEach(function (col) { return _this.gridColumnsMap[col.getId()] = col; });
6260 this.setAutoHeightActive();
6261 var event = {
6262 type: Events.EVENT_GRID_COLUMNS_CHANGED,
6263 api: this.gridApi,
6264 columnApi: this.columnApi
6265 };
6266 this.eventService.dispatchEvent(event);
6267 };
6268 ColumnModel.prototype.setAutoHeightActive = function () {
6269 this.autoHeightActive = this.gridColumns.filter(function (col) { return col.isAutoHeight(); }).length > 0;
6270 if (this.autoHeightActive) {
6271 this.autoHeightActiveAtLeastOnce = true;
6272 var rowModelType = this.rowModel.getType();
6273 var supportedRowModel = rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE || rowModelType === Constants.ROW_MODEL_TYPE_SERVER_SIDE;
6274 if (!supportedRowModel) {
6275 var message_1 = 'AG Grid - autoHeight columns only work with Client Side Row Model and Server Side Row Model.';
6276 doOnce(function () { return console.warn(message_1); }, 'autoHeightActive.wrongRowModel');
6277 }
6278 }
6279 };
6280 ColumnModel.prototype.orderGridColsLike = function (colsOrder) {
6281 if (missing(colsOrder)) {
6282 return;
6283 }
6284 var lastOrderMapped = convertToMap(colsOrder.map(function (col, index) { return [col, index]; }));
6285 // only do the sort if at least one column is accounted for. columns will be not accounted for
6286 // if changing from secondary to primary columns
6287 var noColsFound = true;
6288 this.gridColumns.forEach(function (col) {
6289 if (lastOrderMapped.has(col)) {
6290 noColsFound = false;
6291 }
6292 });
6293 if (noColsFound) {
6294 return;
6295 }
6296 // order cols in the same order as before. we need to make sure that all
6297 // cols still exists, so filter out any that no longer exist.
6298 var gridColsMap = convertToMap(this.gridColumns.map(function (col) { return [col, true]; }));
6299 var oldColsOrdered = colsOrder.filter(function (col) { return gridColsMap.has(col); });
6300 var oldColsMap = convertToMap(oldColsOrdered.map(function (col) { return [col, true]; }));
6301 var newColsOrdered = this.gridColumns.filter(function (col) { return !oldColsMap.has(col); });
6302 // add in the new columns, at the end (if no group), or at the end of the group (if a group)
6303 var newGridColumns = oldColsOrdered.slice();
6304 newColsOrdered.forEach(function (newCol) {
6305 var parent = newCol.getOriginalParent();
6306 // if no parent, means we are not grouping, so just add the column to the end
6307 if (!parent) {
6308 newGridColumns.push(newCol);
6309 return;
6310 }
6311 // find the group the column belongs to. if no siblings at the current level (eg col in group on it's
6312 // own) then go up one level and look for siblings there.
6313 var siblings = [];
6314 while (!siblings.length && parent) {
6315 var leafCols = parent.getLeafColumns();
6316 leafCols.forEach(function (leafCol) {
6317 var presentInNewGriColumns = newGridColumns.indexOf(leafCol) >= 0;
6318 var noYetInSiblings = siblings.indexOf(leafCol) < 0;
6319 if (presentInNewGriColumns && noYetInSiblings) {
6320 siblings.push(leafCol);
6321 }
6322 });
6323 parent = parent.getOriginalParent();
6324 }
6325 // if no siblings exist at any level, this means the col is in a group (or parent groups) on it's own
6326 if (!siblings.length) {
6327 newGridColumns.push(newCol);
6328 return;
6329 }
6330 // find index of last column in the group
6331 var indexes = siblings.map(function (col) { return newGridColumns.indexOf(col); });
6332 var lastIndex = Math.max.apply(Math, __spread(indexes));
6333 insertIntoArray(newGridColumns, newCol, lastIndex + 1);
6334 });
6335 this.gridColumns = newGridColumns;
6336 };
6337 ColumnModel.prototype.isPrimaryColumnGroupsPresent = function () {
6338 return this.primaryHeaderRowCount > 1;
6339 };
6340 // if we are using autoGroupCols, then they should be included for quick filter. this covers the
6341 // following scenarios:
6342 // a) user provides 'field' into autoGroupCol of normal grid, so now because a valid col to filter leafs on
6343 // b) using tree data and user depends on autoGroupCol for first col, and we also want to filter on this
6344 // (tree data is a bit different, as parent rows can be filtered on, unlike row grouping)
6345 ColumnModel.prototype.setupQuickFilterColumns = function () {
6346 if (this.groupAutoColumns) {
6347 this.columnsForQuickFilter = (this.primaryColumns || []).concat(this.groupAutoColumns);
6348 }
6349 else if (this.primaryColumns) {
6350 this.columnsForQuickFilter = this.primaryColumns;
6351 }
6352 };
6353 ColumnModel.prototype.placeLockedColumns = function (cols) {
6354 var left = [];
6355 var normal = [];
6356 var right = [];
6357 cols.forEach(function (col) {
6358 var position = col.getColDef().lockPosition;
6359 if (position === 'right') {
6360 right.push(col);
6361 }
6362 else if (position === 'left' || position === true) {
6363 left.push(col);
6364 }
6365 else {
6366 normal.push(col);
6367 }
6368 });
6369 return __spread(left, normal, right);
6370 };
6371 ColumnModel.prototype.addAutoGroupToGridColumns = function () {
6372 // add in auto-group here
6373 this.createGroupAutoColumnsIfNeeded();
6374 if (missing(this.groupAutoColumns)) {
6375 return;
6376 }
6377 this.gridColumns = this.groupAutoColumns ? this.groupAutoColumns.concat(this.gridColumns) : this.gridColumns;
6378 var autoColBalancedTree = this.columnFactory.createForAutoGroups(this.groupAutoColumns, this.gridBalancedTree);
6379 this.gridBalancedTree = autoColBalancedTree.concat(this.gridBalancedTree);
6380 };
6381 // gets called after we copy down grid columns, to make sure any part of the gui
6382 // that tries to draw, eg the header, it will get empty lists of columns rather
6383 // than stale columns. for example, the header will received gridColumnsChanged
6384 // event, so will try and draw, but it will draw successfully when it acts on the
6385 // virtualColumnsChanged event
6386 ColumnModel.prototype.clearDisplayedAndViewportColumns = function () {
6387 this.displayedTreeLeft = [];
6388 this.displayedTreeRight = [];
6389 this.displayedTreeCentre = [];
6390 this.viewportRowLeft = {};
6391 this.viewportRowRight = {};
6392 this.viewportRowCenter = {};
6393 this.displayedColumnsLeft = [];
6394 this.displayedColumnsRight = [];
6395 this.displayedColumnsCenter = [];
6396 this.displayedColumns = [];
6397 this.viewportColumns = [];
6398 };
6399 ColumnModel.prototype.updateGroupsAndDisplayedColumns = function (source) {
6400 this.updateOpenClosedVisibilityInColumnGroups();
6401 this.deriveDisplayedColumns(source);
6402 this.refreshFlexedColumns();
6403 this.extractViewport();
6404 this.updateBodyWidths();
6405 // this event is picked up by the gui, headerRenderer and rowRenderer, to recalculate what columns to display
6406 var event = {
6407 type: Events.EVENT_DISPLAYED_COLUMNS_CHANGED,
6408 api: this.gridApi,
6409 columnApi: this.columnApi
6410 };
6411 this.eventService.dispatchEvent(event);
6412 };
6413 ColumnModel.prototype.deriveDisplayedColumns = function (source) {
6414 this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeLeft, this.displayedColumnsLeft);
6415 this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeCentre, this.displayedColumnsCenter);
6416 this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeRight, this.displayedColumnsRight);
6417 this.joinDisplayedColumns();
6418 this.setLeftValues(source);
6419 this.displayedAutoHeightCols = this.displayedColumns.filter(function (col) { return col.isAutoHeight(); });
6420 };
6421 ColumnModel.prototype.isAutoRowHeightActive = function () {
6422 return this.autoHeightActive;
6423 };
6424 ColumnModel.prototype.wasAutoRowHeightEverActive = function () {
6425 return this.autoHeightActiveAtLeastOnce;
6426 };
6427 ColumnModel.prototype.joinDisplayedColumns = function () {
6428 if (this.gridOptionsWrapper.isEnableRtl()) {
6429 this.displayedColumns = this.displayedColumnsRight
6430 .concat(this.displayedColumnsCenter)
6431 .concat(this.displayedColumnsLeft);
6432 }
6433 else {
6434 this.displayedColumns = this.displayedColumnsLeft
6435 .concat(this.displayedColumnsCenter)
6436 .concat(this.displayedColumnsRight);
6437 }
6438 };
6439 // sets the left pixel position of each column
6440 ColumnModel.prototype.setLeftValues = function (source) {
6441 this.setLeftValuesOfColumns(source);
6442 this.setLeftValuesOfGroups();
6443 };
6444 ColumnModel.prototype.setLeftValuesOfColumns = function (source) {
6445 var _this = this;
6446 if (!this.primaryColumns) {
6447 return;
6448 }
6449 // go through each list of displayed columns
6450 var allColumns = this.primaryColumns.slice(0);
6451 // let totalColumnWidth = this.getWidthOfColsInList()
6452 var doingRtl = this.gridOptionsWrapper.isEnableRtl();
6453 [
6454 this.displayedColumnsLeft,
6455 this.displayedColumnsRight,
6456 this.displayedColumnsCenter
6457 ].forEach(function (columns) {
6458 if (doingRtl) {
6459 // when doing RTL, we start at the top most pixel (ie RHS) and work backwards
6460 var left_1 = _this.getWidthOfColsInList(columns);
6461 columns.forEach(function (column) {
6462 left_1 -= column.getActualWidth();
6463 column.setLeft(left_1, source);
6464 });
6465 }
6466 else {
6467 // otherwise normal LTR, we start at zero
6468 var left_2 = 0;
6469 columns.forEach(function (column) {
6470 column.setLeft(left_2, source);
6471 left_2 += column.getActualWidth();
6472 });
6473 }
6474 removeAllFromArray(allColumns, columns);
6475 });
6476 // items left in allColumns are columns not displayed, so remove the left position. this is
6477 // important for the rows, as if a col is made visible, then taken out, then made visible again,
6478 // we don't want the animation of the cell floating in from the old position, whatever that was.
6479 allColumns.forEach(function (column) {
6480 column.setLeft(null, source);
6481 });
6482 };
6483 ColumnModel.prototype.setLeftValuesOfGroups = function () {
6484 // a groups left value is the lest left value of it's children
6485 [
6486 this.displayedTreeLeft,
6487 this.displayedTreeRight,
6488 this.displayedTreeCentre
6489 ].forEach(function (columns) {
6490 columns.forEach(function (column) {
6491 if (column instanceof ColumnGroup) {
6492 var columnGroup = column;
6493 columnGroup.checkLeft();
6494 }
6495 });
6496 });
6497 };
6498 ColumnModel.prototype.derivedDisplayedColumnsFromDisplayedTree = function (tree, columns) {
6499 columns.length = 0;
6500 this.columnUtils.depthFirstDisplayedColumnTreeSearch(tree, function (child) {
6501 if (child instanceof Column) {
6502 columns.push(child);
6503 }
6504 });
6505 };
6506 ColumnModel.prototype.extractViewportColumns = function () {
6507 if (this.suppressColumnVirtualisation) {
6508 // no virtualisation, so don't filter
6509 this.viewportColumnsCenter = this.displayedColumnsCenter;
6510 }
6511 else {
6512 // filter out what should be visible
6513 this.viewportColumnsCenter = this.filterOutColumnsWithinViewport();
6514 }
6515 this.viewportColumns = this.viewportColumnsCenter
6516 .concat(this.displayedColumnsLeft)
6517 .concat(this.displayedColumnsRight);
6518 };
6519 ColumnModel.prototype.getVirtualHeaderGroupRow = function (type, dept) {
6520 var result;
6521 switch (type) {
6522 case Constants.PINNED_LEFT:
6523 result = this.viewportRowLeft[dept];
6524 break;
6525 case Constants.PINNED_RIGHT:
6526 result = this.viewportRowRight[dept];
6527 break;
6528 default:
6529 result = this.viewportRowCenter[dept];
6530 break;
6531 }
6532 if (missing(result)) {
6533 result = [];
6534 }
6535 return result;
6536 };
6537 ColumnModel.prototype.extractViewportRows = function () {
6538 // go through each group, see if any of it's cols are displayed, and if yes,
6539 // then this group is included
6540 this.viewportRowLeft = {};
6541 this.viewportRowRight = {};
6542 this.viewportRowCenter = {};
6543 // for easy lookup when building the groups.
6544 var virtualColIds = {};
6545 this.viewportColumns.forEach(function (col) { return virtualColIds[col.getId()] = true; });
6546 var testGroup = function (children, result, dept) {
6547 var returnValue = false;
6548 for (var i = 0; i < children.length; i++) {
6549 // see if this item is within viewport
6550 var child = children[i];
6551 var addThisItem = false;
6552 if (child instanceof Column) {
6553 // for column, test if column is included
6554 addThisItem = virtualColIds[child.getId()] === true;
6555 }
6556 else {
6557 // if group, base decision on children
6558 var columnGroup = child;
6559 var displayedChildren = columnGroup.getDisplayedChildren();
6560 if (displayedChildren) {
6561 addThisItem = testGroup(displayedChildren, result, dept + 1);
6562 }
6563 }
6564 if (addThisItem) {
6565 returnValue = true;
6566 if (!result[dept]) {
6567 result[dept] = [];
6568 }
6569 result[dept].push(child);
6570 }
6571 }
6572 return returnValue;
6573 };
6574 testGroup(this.displayedTreeLeft, this.viewportRowLeft, 0);
6575 testGroup(this.displayedTreeRight, this.viewportRowRight, 0);
6576 testGroup(this.displayedTreeCentre, this.viewportRowCenter, 0);
6577 };
6578 ColumnModel.prototype.extractViewport = function () {
6579 this.extractViewportColumns();
6580 this.extractViewportRows();
6581 };
6582 ColumnModel.prototype.filterOutColumnsWithinViewport = function () {
6583 return this.displayedColumnsCenter.filter(this.isColumnInViewport.bind(this));
6584 };
6585 ColumnModel.prototype.refreshFlexedColumns = function (params) {
6586 var _this = this;
6587 if (params === void 0) { params = {}; }
6588 var source = params.source ? params.source : 'flex';
6589 if (params.viewportWidth != null) {
6590 this.flexViewportWidth = params.viewportWidth;
6591 }
6592 if (!this.flexViewportWidth) {
6593 return [];
6594 }
6595 // If the grid has left-over space, divide it between flexing columns in proportion to their flex value.
6596 // A "flexing column" is one that has a 'flex' value set and is not currently being constrained by its
6597 // minWidth or maxWidth rules.
6598 var flexAfterDisplayIndex = -1;
6599 if (params.resizingCols) {
6600 params.resizingCols.forEach(function (col) {
6601 var indexOfCol = _this.displayedColumnsCenter.indexOf(col);
6602 if (flexAfterDisplayIndex < indexOfCol) {
6603 flexAfterDisplayIndex = indexOfCol;
6604 }
6605 });
6606 }
6607 var isColFlex = function (col) {
6608 var afterResizingCols = _this.displayedColumnsCenter.indexOf(col) > flexAfterDisplayIndex;
6609 return col.getFlex() && afterResizingCols;
6610 };
6611 var knownWidthColumns = this.displayedColumnsCenter.filter(function (col) { return !isColFlex(col); });
6612 var flexingColumns = this.displayedColumnsCenter.filter(function (col) { return isColFlex(col); });
6613 var changedColumns = [];
6614 if (!flexingColumns.length) {
6615 return [];
6616 }
6617 var flexingColumnSizes = [];
6618 var spaceForFlexingColumns;
6619 outer: while (true) {
6620 var totalFlex = flexingColumns.reduce(function (count, col) { return count + col.getFlex(); }, 0);
6621 spaceForFlexingColumns = this.flexViewportWidth - this.getWidthOfColsInList(knownWidthColumns);
6622 for (var i = 0; i < flexingColumns.length; i++) {
6623 var col = flexingColumns[i];
6624 var widthByFlexRule = spaceForFlexingColumns * col.getFlex() / totalFlex;
6625 var constrainedWidth = 0;
6626 var minWidth = col.getMinWidth();
6627 var maxWidth = col.getMaxWidth();
6628 if (exists(minWidth) && widthByFlexRule < minWidth) {
6629 constrainedWidth = minWidth;
6630 }
6631 else if (exists(maxWidth) && widthByFlexRule > maxWidth) {
6632 constrainedWidth = maxWidth;
6633 }
6634 if (constrainedWidth) {
6635 // This column is not in fact flexing as it is being constrained to a specific size
6636 // so remove it from the list of flexing columns and start again
6637 col.setActualWidth(constrainedWidth, source);
6638 removeFromArray(flexingColumns, col);
6639 changedColumns.push(col);
6640 knownWidthColumns.push(col);
6641 continue outer;
6642 }
6643 flexingColumnSizes[i] = Math.round(widthByFlexRule);
6644 }
6645 break;
6646 }
6647 var remainingSpace = spaceForFlexingColumns;
6648 flexingColumns.forEach(function (col, i) {
6649 col.setActualWidth(Math.min(flexingColumnSizes[i], remainingSpace), source);
6650 changedColumns.push(col);
6651 remainingSpace -= flexingColumnSizes[i];
6652 });
6653 if (!params.skipSetLeft) {
6654 this.setLeftValues(source);
6655 }
6656 if (params.updateBodyWidths) {
6657 this.updateBodyWidths();
6658 }
6659 if (params.fireResizedEvent) {
6660 this.fireColumnResizedEvent(changedColumns, true, source, flexingColumns);
6661 }
6662 // if the user sets rowData directly into GridOptions, then the row data is set before
6663 // grid is attached to the DOM. this means the columns are not flexed, and then the rows
6664 // have the wrong height (as they depend on column widths). so once the columns have
6665 // been flexed for the first time (only happens once grid is attached to DOM, as dependency
6666 // on getting the grid width, which only happens after attached after ResizeObserver fires)
6667 // we get get rows to re-calc their heights.
6668 if (!this.flexColsCalculatedAtLestOnce) {
6669 if (this.gridOptionsWrapper.isRowModelDefault()) {
6670 this.rowModel.resetRowHeights();
6671 }
6672 this.flexColsCalculatedAtLestOnce = true;
6673 }
6674 return flexingColumns;
6675 };
6676 // called from api
6677 ColumnModel.prototype.sizeColumnsToFit = function (gridWidth, source, silent) {
6678 if (source === void 0) { source = "sizeColumnsToFit"; }
6679 // avoid divide by zero
6680 var allDisplayedColumns = this.getAllDisplayedColumns();
6681 if (gridWidth <= 0 || !allDisplayedColumns.length) {
6682 return;
6683 }
6684 var colsToSpread = [];
6685 var colsToNotSpread = [];
6686 allDisplayedColumns.forEach(function (column) {
6687 if (column.getColDef().suppressSizeToFit === true) {
6688 colsToNotSpread.push(column);
6689 }
6690 else {
6691 colsToSpread.push(column);
6692 }
6693 });
6694 // make a copy of the cols that are going to be resized
6695 var colsToFireEventFor = colsToSpread.slice(0);
6696 var finishedResizing = false;
6697 var moveToNotSpread = function (column) {
6698 removeFromArray(colsToSpread, column);
6699 colsToNotSpread.push(column);
6700 };
6701 // resetting cols to their original width makes the sizeColumnsToFit more deterministic,
6702 // rather than depending on the current size of the columns. most users call sizeColumnsToFit
6703 // immediately after grid is created, so will make no difference. however if application is calling
6704 // sizeColumnsToFit repeatedly (eg after column group is opened / closed repeatedly) we don't want
6705 // the columns to start shrinking / growing over time.
6706 //
6707 // NOTE: the process below will assign values to `this.actualWidth` of each column without firing events
6708 // for this reason we need to manually fire resize events after the resize has been done for each column.
6709 colsToSpread.forEach(function (column) { return column.resetActualWidth(source); });
6710 while (!finishedResizing) {
6711 finishedResizing = true;
6712 var availablePixels = gridWidth - this.getWidthOfColsInList(colsToNotSpread);
6713 if (availablePixels <= 0) {
6714 // no width, set everything to minimum
6715 colsToSpread.forEach(function (column) {
6716 column.setMinimum(source);
6717 });
6718 }
6719 else {
6720 var scale = availablePixels / this.getWidthOfColsInList(colsToSpread);
6721 // we set the pixels for the last col based on what's left, as otherwise
6722 // we could be a pixel or two short or extra because of rounding errors.
6723 var pixelsForLastCol = availablePixels;
6724 // backwards through loop, as we are removing items as we go
6725 for (var i = colsToSpread.length - 1; i >= 0; i--) {
6726 var column = colsToSpread[i];
6727 var minWidth = column.getMinWidth();
6728 var maxWidth = column.getMaxWidth();
6729 var newWidth = Math.round(column.getActualWidth() * scale);
6730 if (exists(minWidth) && newWidth < minWidth) {
6731 newWidth = minWidth;
6732 moveToNotSpread(column);
6733 finishedResizing = false;
6734 }
6735 else if (exists(maxWidth) && column.isGreaterThanMax(newWidth)) {
6736 newWidth = maxWidth;
6737 moveToNotSpread(column);
6738 finishedResizing = false;
6739 }
6740 else if (i === 0) { // if this is the last column
6741 newWidth = pixelsForLastCol;
6742 }
6743 column.setActualWidth(newWidth, source, true);
6744 pixelsForLastCol -= newWidth;
6745 }
6746 }
6747 }
6748 // see notes above
6749 colsToFireEventFor.forEach(function (col) {
6750 col.fireColumnWidthChangedEvent(source);
6751 });
6752 this.setLeftValues(source);
6753 this.updateBodyWidths();
6754 if (silent) {
6755 return;
6756 }
6757 this.fireColumnResizedEvent(colsToFireEventFor, true, source);
6758 };
6759 ColumnModel.prototype.buildDisplayedTrees = function (visibleColumns) {
6760 var leftVisibleColumns = [];
6761 var rightVisibleColumns = [];
6762 var centerVisibleColumns = [];
6763 visibleColumns.forEach(function (column) {
6764 switch (column.getPinned()) {
6765 case "left":
6766 leftVisibleColumns.push(column);
6767 break;
6768 case "right":
6769 rightVisibleColumns.push(column);
6770 break;
6771 default:
6772 centerVisibleColumns.push(column);
6773 break;
6774 }
6775 });
6776 var groupInstanceIdCreator = new GroupInstanceIdCreator();
6777 this.displayedTreeLeft = this.displayedGroupCreator.createDisplayedGroups(leftVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, Constants.PINNED_LEFT, this.displayedTreeLeft);
6778 this.displayedTreeRight = this.displayedGroupCreator.createDisplayedGroups(rightVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, Constants.PINNED_RIGHT, this.displayedTreeRight);
6779 this.displayedTreeCentre = this.displayedGroupCreator.createDisplayedGroups(centerVisibleColumns, this.gridBalancedTree, groupInstanceIdCreator, null, this.displayedTreeCentre);
6780 this.updateDisplayedMap();
6781 };
6782 ColumnModel.prototype.updateDisplayedMap = function () {
6783 var _this = this;
6784 this.displayedColumnsAndGroupsMap = {};
6785 var func = function (child) {
6786 _this.displayedColumnsAndGroupsMap[child.getUniqueId()] = child;
6787 };
6788 this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeCentre, func);
6789 this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeLeft, func);
6790 this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeRight, func);
6791 };
6792 ColumnModel.prototype.isDisplayed = function (item) {
6793 var fromMap = this.displayedColumnsAndGroupsMap[item.getUniqueId()];
6794 // check for reference, in case new column / group with same id is now present
6795 return fromMap === item;
6796 };
6797 ColumnModel.prototype.updateOpenClosedVisibilityInColumnGroups = function () {
6798 var allColumnGroups = this.getAllDisplayedTrees();
6799 this.columnUtils.depthFirstAllColumnTreeSearch(allColumnGroups, function (child) {
6800 if (child instanceof ColumnGroup) {
6801 var columnGroup = child;
6802 columnGroup.calculateDisplayedColumns();
6803 }
6804 });
6805 };
6806 ColumnModel.prototype.getGroupAutoColumns = function () {
6807 return this.groupAutoColumns;
6808 };
6809 ColumnModel.prototype.createGroupAutoColumnsIfNeeded = function () {
6810 if (!this.autoGroupsNeedBuilding) {
6811 return;
6812 }
6813 this.autoGroupsNeedBuilding = false;
6814 var groupFullWidthRow = this.gridOptionsWrapper.isGroupUseEntireRow(this.pivotMode);
6815 // we need to allow suppressing auto-column separately for group and pivot as the normal situation
6816 // is CSRM and user provides group column themselves for normal view, but when they go into pivot the
6817 // columns are generated by the grid so no opportunity for user to provide group column. so need a way
6818 // to suppress auto-col for grouping only, and not pivot.
6819 // however if using Viewport RM or SSRM and user is providing the columns, the user may wish full control
6820 // of the group column in this instance.
6821 var suppressAutoColumn = this.pivotMode ?
6822 this.gridOptionsWrapper.isPivotSuppressAutoColumn() : this.gridOptionsWrapper.isGroupSuppressAutoColumn();
6823 var groupingActive = this.rowGroupColumns.length > 0 || this.usingTreeData;
6824 var needAutoColumns = groupingActive && !suppressAutoColumn && !groupFullWidthRow;
6825 if (needAutoColumns) {
6826 var existingCols = this.groupAutoColumns || [];
6827 var newAutoGroupCols = this.autoGroupColService.createAutoGroupColumns(existingCols, this.rowGroupColumns);
6828 var autoColsDifferent = !this.autoColsEqual(newAutoGroupCols, this.groupAutoColumns);
6829 // we force recreate when suppressColumnStateEvents changes, so new group cols pick up the new
6830 // definitions. otherwise we could ignore the new cols because they appear to be the same.
6831 if (autoColsDifferent || this.forceRecreateAutoGroups) {
6832 this.groupAutoColumns = newAutoGroupCols;
6833 }
6834 }
6835 else {
6836 this.groupAutoColumns = null;
6837 }
6838 };
6839 ColumnModel.prototype.autoColsEqual = function (colsA, colsB) {
6840 return areEqual(colsA, colsB, function (a, b) { return a.getColId() === b.getColId(); });
6841 };
6842 ColumnModel.prototype.getWidthOfColsInList = function (columnList) {
6843 return columnList.reduce(function (width, col) { return width + col.getActualWidth(); }, 0);
6844 };
6845 ColumnModel.prototype.getGridBalancedTree = function () {
6846 return this.gridBalancedTree;
6847 };
6848 ColumnModel.prototype.hasFloatingFilters = function () {
6849 if (!this.gridColumns) {
6850 return false;
6851 }
6852 var res = this.gridColumns.some(function (col) { return col.getColDef().floatingFilter; });
6853 return res;
6854 };
6855 ColumnModel.prototype.getFirstDisplayedColumn = function () {
6856 var isRtl = this.gridOptionsWrapper.isEnableRtl();
6857 var queryOrder = [
6858 'getDisplayedLeftColumns',
6859 'getDisplayedCenterColumns',
6860 'getDisplayedRightColumns'
6861 ];
6862 if (isRtl) {
6863 queryOrder.reverse();
6864 }
6865 for (var i = 0; i < queryOrder.length; i++) {
6866 var container = this[queryOrder[i]]();
6867 if (container.length) {
6868 return isRtl ? last(container) : container[0];
6869 }
6870 }
6871 return null;
6872 };
6873 __decorate$5([
6874 Autowired('expressionService')
6875 ], ColumnModel.prototype, "expressionService", void 0);
6876 __decorate$5([
6877 Autowired('columnFactory')
6878 ], ColumnModel.prototype, "columnFactory", void 0);
6879 __decorate$5([
6880 Autowired('displayedGroupCreator')
6881 ], ColumnModel.prototype, "displayedGroupCreator", void 0);
6882 __decorate$5([
6883 Autowired('ctrlsService')
6884 ], ColumnModel.prototype, "ctrlsService", void 0);
6885 __decorate$5([
6886 Autowired('autoWidthCalculator')
6887 ], ColumnModel.prototype, "autoWidthCalculator", void 0);
6888 __decorate$5([
6889 Autowired('columnUtils')
6890 ], ColumnModel.prototype, "columnUtils", void 0);
6891 __decorate$5([
6892 Autowired('columnAnimationService')
6893 ], ColumnModel.prototype, "columnAnimationService", void 0);
6894 __decorate$5([
6895 Autowired('autoGroupColService')
6896 ], ColumnModel.prototype, "autoGroupColService", void 0);
6897 __decorate$5([
6898 Optional('aggFuncService')
6899 ], ColumnModel.prototype, "aggFuncService", void 0);
6900 __decorate$5([
6901 Optional('valueCache')
6902 ], ColumnModel.prototype, "valueCache", void 0);
6903 __decorate$5([
6904 Optional('animationFrameService')
6905 ], ColumnModel.prototype, "animationFrameService", void 0);
6906 __decorate$5([
6907 Autowired('rowModel')
6908 ], ColumnModel.prototype, "rowModel", void 0);
6909 __decorate$5([
6910 Autowired('columnApi')
6911 ], ColumnModel.prototype, "columnApi", void 0);
6912 __decorate$5([
6913 Autowired('gridApi')
6914 ], ColumnModel.prototype, "gridApi", void 0);
6915 __decorate$5([
6916 Autowired('sortController')
6917 ], ColumnModel.prototype, "sortController", void 0);
6918 __decorate$5([
6919 Autowired('columnDefFactory')
6920 ], ColumnModel.prototype, "columnDefFactory", void 0);
6921 __decorate$5([
6922 PostConstruct
6923 ], ColumnModel.prototype, "init", null);
6924 __decorate$5([
6925 __param$2(0, Qualifier('loggerFactory'))
6926 ], ColumnModel.prototype, "setBeans", null);
6927 ColumnModel = __decorate$5([
6928 Bean('columnModel')
6929 ], ColumnModel);
6930 return ColumnModel;
6931}(BeanStub));
6932
6933/**
6934 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
6935 * @version v27.3.0
6936 * @link https://www.ag-grid.com/
6937 * @license MIT
6938 */
6939var __extends$2 = (undefined && undefined.__extends) || (function () {
6940 var extendStatics = function (d, b) {
6941 extendStatics = Object.setPrototypeOf ||
6942 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6943 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6944 return extendStatics(d, b);
6945 };
6946 return function (d, b) {
6947 extendStatics(d, b);
6948 function __() { this.constructor = d; }
6949 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6950 };
6951})();
6952var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6953 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6954 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6955 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;
6956 return c > 3 && r && Object.defineProperty(target, key, r), r;
6957};
6958// takes in a list of columns, as specified by the column definitions, and returns column groups
6959var ColumnUtils = /** @class */ (function (_super) {
6960 __extends$2(ColumnUtils, _super);
6961 function ColumnUtils() {
6962 return _super !== null && _super.apply(this, arguments) || this;
6963 }
6964 ColumnUtils.prototype.calculateColMinWidth = function (colDef) {
6965 return colDef.minWidth != null ? colDef.minWidth : this.gridOptionsWrapper.getMinColWidth();
6966 };
6967 ColumnUtils.prototype.calculateColMaxWidth = function (colDef) {
6968 return colDef.maxWidth != null ? colDef.maxWidth : (this.gridOptionsWrapper.getMaxColWidth() || Number.MAX_SAFE_INTEGER);
6969 };
6970 ColumnUtils.prototype.calculateColInitialWidth = function (colDef) {
6971 var minColWidth = this.calculateColMinWidth(colDef);
6972 var maxColWidth = this.calculateColMaxWidth(colDef);
6973 var width;
6974 var colDefWidth = attrToNumber(colDef.width);
6975 var colDefInitialWidth = attrToNumber(colDef.initialWidth);
6976 if (colDefWidth != null) {
6977 width = colDefWidth;
6978 }
6979 else if (colDefInitialWidth != null) {
6980 width = colDefInitialWidth;
6981 }
6982 else {
6983 width = this.gridOptionsWrapper.getColWidth();
6984 }
6985 return Math.max(Math.min(width, maxColWidth), minColWidth);
6986 };
6987 ColumnUtils.prototype.getOriginalPathForColumn = function (column, originalBalancedTree) {
6988 var result = [];
6989 var found = false;
6990 var recursePath = function (balancedColumnTree, dept) {
6991 for (var i = 0; i < balancedColumnTree.length; i++) {
6992 if (found) {
6993 return;
6994 }
6995 // quit the search, so 'result' is kept with the found result
6996 var node = balancedColumnTree[i];
6997 if (node instanceof ProvidedColumnGroup) {
6998 var nextNode = node;
6999 recursePath(nextNode.getChildren(), dept + 1);
7000 result[dept] = node;
7001 }
7002 else if (node === column) {
7003 found = true;
7004 }
7005 }
7006 };
7007 recursePath(originalBalancedTree, 0);
7008 // we should always find the path, but in case there is a bug somewhere, returning null
7009 // will make it fail rather than provide a 'hard to track down' bug
7010 return found ? result : null;
7011 };
7012 ColumnUtils.prototype.depthFirstOriginalTreeSearch = function (parent, tree, callback) {
7013 var _this = this;
7014 if (!tree) {
7015 return;
7016 }
7017 tree.forEach(function (child) {
7018 if (child instanceof ProvidedColumnGroup) {
7019 _this.depthFirstOriginalTreeSearch(child, child.getChildren(), callback);
7020 }
7021 callback(child, parent);
7022 });
7023 };
7024 ColumnUtils.prototype.depthFirstAllColumnTreeSearch = function (tree, callback) {
7025 var _this = this;
7026 if (!tree) {
7027 return;
7028 }
7029 tree.forEach(function (child) {
7030 if (child instanceof ColumnGroup) {
7031 _this.depthFirstAllColumnTreeSearch(child.getChildren(), callback);
7032 }
7033 callback(child);
7034 });
7035 };
7036 ColumnUtils.prototype.depthFirstDisplayedColumnTreeSearch = function (tree, callback) {
7037 var _this = this;
7038 if (!tree) {
7039 return;
7040 }
7041 tree.forEach(function (child) {
7042 if (child instanceof ColumnGroup) {
7043 _this.depthFirstDisplayedColumnTreeSearch(child.getDisplayedChildren(), callback);
7044 }
7045 callback(child);
7046 });
7047 };
7048 ColumnUtils = __decorate$6([
7049 Bean('columnUtils')
7050 ], ColumnUtils);
7051 return ColumnUtils;
7052}(BeanStub));
7053
7054/**
7055 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
7056 * @version v27.3.0
7057 * @link https://www.ag-grid.com/
7058 * @license MIT
7059 */
7060var __extends$3 = (undefined && undefined.__extends) || (function () {
7061 var extendStatics = function (d, b) {
7062 extendStatics = Object.setPrototypeOf ||
7063 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7064 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7065 return extendStatics(d, b);
7066 };
7067 return function (d, b) {
7068 extendStatics(d, b);
7069 function __() { this.constructor = d; }
7070 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7071 };
7072})();
7073var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7074 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7075 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7076 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;
7077 return c > 3 && r && Object.defineProperty(target, key, r), r;
7078};
7079// takes in a list of columns, as specified by the column definitions, and returns column groups
7080var DisplayedGroupCreator = /** @class */ (function (_super) {
7081 __extends$3(DisplayedGroupCreator, _super);
7082 function DisplayedGroupCreator() {
7083 return _super !== null && _super.apply(this, arguments) || this;
7084 }
7085 DisplayedGroupCreator.prototype.createDisplayedGroups = function (
7086 // all displayed columns sorted - this is the columns the grid should show
7087 sortedVisibleColumns,
7088 // the tree of columns, as provided by the users, used to know what groups columns roll up into
7089 balancedColumnTree,
7090 // creates unique id's for the group
7091 groupInstanceIdCreator,
7092 // whether it's left, right or center col
7093 pinned,
7094 // we try to reuse old groups if we can, to allow gui to do animation
7095 oldDisplayedGroups) {
7096 var _this = this;
7097 var result = [];
7098 var previousRealPath;
7099 var previousOriginalPath;
7100 var oldColumnsMapped = this.mapOldGroupsById(oldDisplayedGroups);
7101 // go through each column, then do a bottom up comparison to the previous column, and start
7102 // to share groups if they converge at any point.
7103 sortedVisibleColumns.forEach(function (currentColumn) {
7104 var currentOriginalPath = _this.getOriginalPathForColumn(balancedColumnTree, currentColumn);
7105 var currentRealPath = [];
7106 var firstColumn = !previousOriginalPath;
7107 for (var i = 0; i < currentOriginalPath.length; i++) {
7108 if (firstColumn || currentOriginalPath[i] !== previousOriginalPath[i]) {
7109 // new group needed
7110 var newGroup = _this.createColumnGroup(currentOriginalPath[i], groupInstanceIdCreator, oldColumnsMapped, pinned);
7111 currentRealPath[i] = newGroup;
7112 // if top level, add to result, otherwise add to parent
7113 if (i == 0) {
7114 result.push(newGroup);
7115 }
7116 else {
7117 currentRealPath[i - 1].addChild(newGroup);
7118 }
7119 }
7120 else {
7121 // reuse old group
7122 currentRealPath[i] = previousRealPath[i];
7123 }
7124 }
7125 var noColumnGroups = currentRealPath.length === 0;
7126 if (noColumnGroups) {
7127 // if we are not grouping, then the result of the above is an empty
7128 // path (no groups), and we just add the column to the root list.
7129 result.push(currentColumn);
7130 }
7131 else {
7132 var leafGroup = last(currentRealPath);
7133 leafGroup.addChild(currentColumn);
7134 }
7135 previousRealPath = currentRealPath;
7136 previousOriginalPath = currentOriginalPath;
7137 });
7138 this.setupParentsIntoColumns(result, null);
7139 return result;
7140 };
7141 DisplayedGroupCreator.prototype.createColumnGroup = function (providedGroup, groupInstanceIdCreator, oldColumnsMapped, pinned) {
7142 var groupId = providedGroup.getGroupId();
7143 var instanceId = groupInstanceIdCreator.getInstanceIdForKey(groupId);
7144 var uniqueId = ColumnGroup.createUniqueId(groupId, instanceId);
7145 var columnGroup = oldColumnsMapped[uniqueId];
7146 // if the user is setting new colDefs, it is possible that the id's overlap, and we
7147 // would have a false match from above. so we double check we are talking about the
7148 // same original column group.
7149 if (columnGroup && columnGroup.getProvidedColumnGroup() !== providedGroup) {
7150 columnGroup = null;
7151 }
7152 if (exists(columnGroup)) {
7153 // clean out the old column group here, as we will be adding children into it again
7154 columnGroup.reset();
7155 }
7156 else {
7157 columnGroup = new ColumnGroup(providedGroup, groupId, instanceId, pinned);
7158 this.context.createBean(columnGroup);
7159 }
7160 return columnGroup;
7161 };
7162 // returns back a 2d map of ColumnGroup as follows: groupId -> instanceId -> ColumnGroup
7163 DisplayedGroupCreator.prototype.mapOldGroupsById = function (displayedGroups) {
7164 var result = {};
7165 var recursive = function (columnsOrGroups) {
7166 columnsOrGroups.forEach(function (columnOrGroup) {
7167 if (columnOrGroup instanceof ColumnGroup) {
7168 var columnGroup = columnOrGroup;
7169 result[columnOrGroup.getUniqueId()] = columnGroup;
7170 recursive(columnGroup.getChildren());
7171 }
7172 });
7173 };
7174 if (displayedGroups) {
7175 recursive(displayedGroups);
7176 }
7177 return result;
7178 };
7179 DisplayedGroupCreator.prototype.setupParentsIntoColumns = function (columnsOrGroups, parent) {
7180 var _this = this;
7181 columnsOrGroups.forEach(function (columnsOrGroup) {
7182 columnsOrGroup.setParent(parent);
7183 if (columnsOrGroup instanceof ColumnGroup) {
7184 var columnGroup = columnsOrGroup;
7185 _this.setupParentsIntoColumns(columnGroup.getChildren(), columnGroup);
7186 }
7187 });
7188 };
7189 DisplayedGroupCreator.prototype.getOriginalPathForColumn = function (balancedColumnTree, column) {
7190 var result = [];
7191 var found = false;
7192 var recursePath = function (columnTree, dept) {
7193 for (var i = 0; i < columnTree.length; i++) {
7194 // quit the search, so 'result' is kept with the found result
7195 if (found) {
7196 return;
7197 }
7198 var node = columnTree[i];
7199 if (node instanceof ProvidedColumnGroup) {
7200 recursePath(node.getChildren(), dept + 1);
7201 result[dept] = node;
7202 }
7203 else if (node === column) {
7204 found = true;
7205 }
7206 }
7207 };
7208 recursePath(balancedColumnTree, 0);
7209 // it's possible we didn't find a path. this happens if the column is generated
7210 // by the grid (auto-group), in that the definition didn't come from the client. in this case,
7211 // we create a fake original path.
7212 if (found) {
7213 return result;
7214 }
7215 console.warn('AG Grid: could not get path');
7216 return null;
7217 };
7218 DisplayedGroupCreator = __decorate$7([
7219 Bean('displayedGroupCreator')
7220 ], DisplayedGroupCreator);
7221 return DisplayedGroupCreator;
7222}(BeanStub));
7223
7224/**
7225 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
7226 * @version v27.3.0
7227 * @link https://www.ag-grid.com/
7228 * @license MIT
7229 */
7230var __read$1 = (undefined && undefined.__read) || function (o, n) {
7231 var m = typeof Symbol === "function" && o[Symbol.iterator];
7232 if (!m) return o;
7233 var i = m.call(o), r, ar = [], e;
7234 try {
7235 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7236 }
7237 catch (error) { e = { error: error }; }
7238 finally {
7239 try {
7240 if (r && !r.done && (m = i["return"])) m.call(i);
7241 }
7242 finally { if (e) throw e.error; }
7243 }
7244 return ar;
7245};
7246var __spread$1 = (undefined && undefined.__spread) || function () {
7247 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i]));
7248 return ar;
7249};
7250/**
7251 * These keys are used for validating properties supplied on a gridOptions object, and for code generation.
7252 * If you change the properties on the gridOptions interface, you *must* update this file as well to be consistent.
7253 */
7254var PropertyKeys = /** @class */ (function () {
7255 function PropertyKeys() {
7256 }
7257 PropertyKeys.STRING_PROPERTIES = [
7258 'sortingOrder', 'rowClass', 'rowSelection', 'overlayLoadingTemplate', 'overlayNoRowsTemplate',
7259 'quickFilterText', 'rowModelType', 'editType', 'domLayout', 'clipboardDelimiter', 'rowGroupPanelShow',
7260 'multiSortKey', 'pivotColumnGroupTotals', 'pivotRowTotals', 'pivotPanelShow', 'fillHandleDirection',
7261 'serverSideStoreType', 'groupDisplayType', 'treeDataDisplayType'
7262 ];
7263 PropertyKeys.OBJECT_PROPERTIES = [
7264 'components', 'frameworkComponents', 'rowStyle', 'context', 'autoGroupColumnDef', 'localeText', 'icons',
7265 'datasource', 'serverSideDatasource', 'viewportDatasource', 'groupRowRendererParams', 'aggFuncs', 'fullWidthCellRendererParams',
7266 'defaultColGroupDef', 'defaultColDef', 'defaultExportParams', 'defaultCsvExportParams', 'defaultExcelExportParams', 'columnTypes',
7267 'rowClassRules', 'detailCellRendererParams', 'loadingCellRendererParams', 'loadingOverlayComponentParams',
7268 'noRowsOverlayComponentParams', 'popupParent', 'colResizeDefault', 'statusBar', 'sideBar', 'chartThemeOverrides',
7269 'customChartThemes'
7270 ];
7271 PropertyKeys.ARRAY_PROPERTIES = [
7272 'alignedGrids', 'rowData', 'columnDefs', 'excelStyles', 'pinnedTopRowData', 'pinnedBottomRowData', 'chartThemes'
7273 ];
7274 PropertyKeys.NUMBER_PROPERTIES = [
7275 'rowHeight', 'detailRowHeight', 'rowBuffer', 'colWidth', 'headerHeight', 'groupHeaderHeight', 'floatingFiltersHeight',
7276 'pivotHeaderHeight', 'pivotGroupHeaderHeight', 'groupDefaultExpanded', 'minColWidth', 'maxColWidth', 'viewportRowModelPageSize',
7277 'viewportRowModelBufferSize', 'autoSizePadding', 'maxBlocksInCache', 'maxConcurrentDatasourceRequests', 'tooltipShowDelay',
7278 'tooltipHideDelay', 'cacheOverflowSize', 'paginationPageSize', 'cacheBlockSize', 'infiniteInitialRowCount', 'scrollbarWidth',
7279 'batchUpdateWaitMillis', 'asyncTransactionWaitMillis', 'blockLoadDebounceMillis', 'keepDetailRowsCount',
7280 'undoRedoCellEditingLimit', 'cellFlashDelay', 'cellFadeDelay', 'tabIndex'
7281 ];
7282 PropertyKeys.BOOLEAN_PROPERTIES = [
7283 'suppressMakeColumnVisibleAfterUnGroup', 'suppressRowClickSelection', 'suppressCellSelection', 'suppressCellFocus', 'suppressHorizontalScroll',
7284 'alwaysShowHorizontalScroll', 'alwaysShowVerticalScroll', 'debug', 'enableBrowserTooltips', 'enableCellExpressions',
7285 'angularCompileRows', 'angularCompileFilters', 'groupSuppressAutoColumn', 'groupSelectsChildren', 'groupIncludeFooter',
7286 'groupIncludeTotalFooter', 'groupUseEntireRow', 'groupSuppressBlankHeader', 'suppressMenuHide', 'suppressRowDeselection',
7287 'unSortIcon', 'suppressMultiSort', 'alwaysMultiSort', 'singleClickEdit', 'suppressLoadingOverlay', 'suppressNoRowsOverlay', 'suppressAutoSize',
7288 'skipHeaderOnAutoSize', 'suppressParentsInRowNodes', 'suppressColumnMoveAnimation', 'suppressMovableColumns',
7289 'suppressFieldDotNotation', 'enableRangeSelection', 'enableRangeHandle', 'enableFillHandle', 'suppressClearOnFillReduction',
7290 'deltaSort', 'suppressTouch', 'suppressAsyncEvents', 'allowContextMenuWithControlKey', 'suppressContextMenu',
7291 'rememberGroupStateWhenNewData', 'enableCellChangeFlash', 'suppressDragLeaveHidesColumns', 'suppressMiddleClickScrolls',
7292 'suppressPreventDefaultOnMouseWheel', 'suppressCopyRowsToClipboard', 'copyHeadersToClipboard', 'copyGroupHeadersToClipboard',
7293 'pivotMode', 'suppressAggFuncInHeader', 'suppressColumnVirtualisation', 'suppressAggAtRootLevel', 'suppressFocusAfterRefresh',
7294 'functionsPassive', 'functionsReadOnly', 'animateRows', 'groupSelectsFiltered', 'groupRemoveSingleChildren',
7295 'groupRemoveLowestSingleChildren', 'enableRtl', 'suppressClickEdit', 'rowDragEntireRow', 'rowDragManaged', 'suppressRowDrag',
7296 'suppressMoveWhenRowDragging', 'rowDragMultiRow', 'enableGroupEdit', 'embedFullWidthRows', 'deprecatedEmbedFullWidthRows',
7297 'suppressPaginationPanel', 'groupHideOpenParents', 'groupMultiAutoColumn', 'pagination',
7298 'stopEditingWhenGridLosesFocus', 'paginationAutoPageSize', 'suppressScrollOnNewData', 'suppressScrollWhenPopupsAreOpen',
7299 'purgeClosedRowNodes', 'cacheQuickFilter', 'deltaRowDataMode', 'ensureDomOrder', 'accentedSort', 'suppressChangeDetection',
7300 'valueCache', 'valueCacheNeverExpires', 'aggregateOnlyChangedColumns', 'suppressAnimationFrame', 'suppressExcelExport',
7301 'suppressCsvExport', 'treeData', 'masterDetail', 'suppressMultiRangeSelection', 'enterMovesDownAfterEdit', 'enterMovesDown',
7302 'suppressPropertyNamesCheck', 'rowMultiSelectWithClick', 'suppressEnterpriseResetOnNewColumns',
7303 'suppressRowHoverHighlight', 'suppressRowTransform', 'suppressClipboardPaste', 'suppressLastEmptyLineOnPaste',
7304 'serverSideSortingAlwaysResets', 'suppressSetColumnStateEvents', 'suppressColumnStateEvents', 'enableCharts', 'deltaColumnMode',
7305 'suppressMaintainUnsortedOrder', 'enableCellTextSelection', 'suppressBrowserResizeObserver', 'suppressMaxRenderedRowRestriction',
7306 'excludeChildrenWhenTreeDataFiltering', 'tooltipMouseTrack', 'keepDetailRows', 'paginateChildRows', 'preventDefaultOnContextMenu',
7307 'undoRedoCellEditing', 'allowDragFromColumnsToolPanel', 'immutableData', 'immutableColumns', 'pivotSuppressAutoColumn',
7308 'suppressExpandablePivotGroups', 'applyColumnDefOrder', 'debounceVerticalScrollbar', 'detailRowAutoHeight',
7309 'serverSideFilteringAlwaysResets', 'suppressAggFilteredOnly', 'showOpenedGroup', 'suppressClipboardApi',
7310 'suppressModelUpdateAfterUpdateTransaction', 'stopEditingWhenCellsLoseFocus', 'maintainColumnOrder', 'groupMaintainOrder',
7311 'columnHoverHighlight', 'reactUi', 'suppressReactUi', 'readOnlyEdit', 'suppressRowVirtualisation',
7312 'resetRowDataOnUpdate', 'removePivotHeaderRowWhenSingleValueColumn', 'suppressCopySingleCellRanges'
7313 ];
7314 /** You do not need to include event callbacks in this list, as they are generated automatically. */
7315 PropertyKeys.FUNCTION_PROPERTIES = [
7316 'localeTextFunc', 'getLocaleText', 'groupRowInnerRenderer', 'groupRowInnerRendererFramework',
7317 'groupRowRenderer', 'groupRowRendererFramework', 'isExternalFilterPresent', 'getRowHeight', 'doesExternalFilterPass',
7318 'getRowClass', 'getRowStyle', 'getContextMenuItems', 'getMainMenuItems', 'processRowPostCreate', 'processCellForClipboard',
7319 'groupRowAggNodes', 'getGroupRowAgg', 'getRowNodeId', 'isFullWidthCell', 'isFullWidthRow', 'fullWidthCellRenderer', 'fullWidthCellRendererFramework',
7320 'processSecondaryColDef', 'processSecondaryColGroupDef',
7321 'getBusinessKeyForNode', 'sendToClipboard', 'navigateToNextHeader',
7322 'tabToNextHeader', 'navigateToNextCell', 'tabToNextCell', 'processCellFromClipboard', 'getDocument', 'postProcessPopup',
7323 'getChildCount', 'getDataPath', 'loadingCellRenderer', 'loadingCellRendererFramework', 'loadingOverlayComponent',
7324 'loadingOverlayComponentFramework', 'noRowsOverlayComponent', 'noRowsOverlayComponentFramework', 'detailCellRenderer',
7325 'detailCellRendererFramework', 'isRowMaster', 'isRowSelectable', 'postSort', 'postSortRows', 'processHeaderForClipboard', 'processGroupHeaderForClipboard',
7326 'paginationNumberFormatter', 'processDataFromClipboard', 'getServerSideGroupKey', 'isServerSideGroup', 'suppressKeyboardEvent',
7327 'createChartContainer', 'getChartToolbarItems', 'fillOperation', 'isApplyServerSideTransaction', 'getServerSideStoreParams',
7328 'isServerSideGroupOpenByDefault', 'isGroupOpenByDefault', 'defaultGroupSortComparator', 'defaultGroupOrderComparator', 'initialGroupOrderComparator',
7329 'loadingCellRendererSelector', 'getRowId', 'groupAggFiltering'
7330 ];
7331 PropertyKeys.ALL_PROPERTIES = __spread$1(PropertyKeys.ARRAY_PROPERTIES, PropertyKeys.OBJECT_PROPERTIES, PropertyKeys.STRING_PROPERTIES, PropertyKeys.NUMBER_PROPERTIES, PropertyKeys.FUNCTION_PROPERTIES, PropertyKeys.BOOLEAN_PROPERTIES);
7332 /**
7333 * Used when performing property checks. This avoids noise caused when using frameworks, which can add their own
7334 * framework-specific properties to colDefs, gridOptions etc.
7335 */
7336 PropertyKeys.FRAMEWORK_PROPERTIES = [
7337 '__ob__', '__v_skip', '__metadata__', 'mappedColumnProperties', 'hasChildColumns', 'toColDef', 'createColDefFromGridColumn'
7338 ];
7339 return PropertyKeys;
7340}());
7341
7342/**
7343 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
7344 * @version v27.3.0
7345 * @link https://www.ag-grid.com/
7346 * @license MIT
7347 */
7348var __assign = (undefined && undefined.__assign) || function () {
7349 __assign = Object.assign || function(t) {
7350 for (var s, i = 1, n = arguments.length; i < n; i++) {
7351 s = arguments[i];
7352 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7353 t[p] = s[p];
7354 }
7355 return t;
7356 };
7357 return __assign.apply(this, arguments);
7358};
7359var __read$2 = (undefined && undefined.__read) || function (o, n) {
7360 var m = typeof Symbol === "function" && o[Symbol.iterator];
7361 if (!m) return o;
7362 var i = m.call(o), r, ar = [], e;
7363 try {
7364 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7365 }
7366 catch (error) { e = { error: error }; }
7367 finally {
7368 try {
7369 if (r && !r.done && (m = i["return"])) m.call(i);
7370 }
7371 finally { if (e) throw e.error; }
7372 }
7373 return ar;
7374};
7375var __spread$2 = (undefined && undefined.__spread) || function () {
7376 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$2(arguments[i]));
7377 return ar;
7378};
7379var ComponentUtil = /** @class */ (function () {
7380 function ComponentUtil() {
7381 }
7382 ComponentUtil.getEventCallbacks = function () {
7383 if (!ComponentUtil.EVENT_CALLBACKS) {
7384 ComponentUtil.EVENT_CALLBACKS = ComponentUtil.EVENTS.map(function (event) { return ComponentUtil.getCallbackForEvent(event); });
7385 }
7386 return ComponentUtil.EVENT_CALLBACKS;
7387 };
7388 ComponentUtil.copyAttributesToGridOptions = function (gridOptions, component, skipEventDeprecationCheck) {
7389 // create empty grid options if none were passed
7390 if (typeof gridOptions !== 'object') {
7391 gridOptions = {};
7392 }
7393 // to allow array style lookup in TypeScript, take type away from 'this' and 'gridOptions'
7394 var pGridOptions = gridOptions;
7395 var keyExists = function (key) { return typeof component[key] !== 'undefined'; };
7396 // if groupAggFiltering exists and isn't a function, handle as a boolean.
7397 if (keyExists('groupAggFiltering') && typeof component.groupAggFiltering !== 'function') {
7398 pGridOptions.groupAggFiltering = ComponentUtil.toBoolean(component.groupAggFiltering);
7399 delete component.groupAggFiltering;
7400 }
7401 // add in all the simple properties
7402 __spread$2(ComponentUtil.ARRAY_PROPERTIES, ComponentUtil.STRING_PROPERTIES, ComponentUtil.OBJECT_PROPERTIES, ComponentUtil.FUNCTION_PROPERTIES, ComponentUtil.getEventCallbacks()).filter(keyExists)
7403 .forEach(function (key) { return pGridOptions[key] = component[key]; });
7404 ComponentUtil.BOOLEAN_PROPERTIES
7405 .filter(keyExists)
7406 .forEach(function (key) { return pGridOptions[key] = ComponentUtil.toBoolean(component[key]); });
7407 ComponentUtil.NUMBER_PROPERTIES
7408 .filter(keyExists)
7409 .forEach(function (key) { return pGridOptions[key] = ComponentUtil.toNumber(component[key]); });
7410 return gridOptions;
7411 };
7412 ComponentUtil.getCallbackForEvent = function (eventName) {
7413 if (!eventName || eventName.length < 2) {
7414 return eventName;
7415 }
7416 return 'on' + eventName[0].toUpperCase() + eventName.substr(1);
7417 };
7418 ComponentUtil.processOnChange = function (changes, gridOptions, api, columnApi) {
7419 if (!changes) {
7420 return;
7421 }
7422 var changesToApply = __assign({}, changes);
7423 // to allow array style lookup in TypeScript, take type away from 'this' and 'gridOptions'
7424 var pGridOptions = gridOptions;
7425 var keyExists = function (key) { return changesToApply[key]; };
7426 // if groupAggFiltering exists and isn't a function, handle as a boolean.
7427 if (keyExists('groupAggFiltering')) {
7428 if (typeof changesToApply.groupAggFiltering === 'function') {
7429 pGridOptions.groupAggFiltering = changesToApply.groupAggFiltering;
7430 }
7431 else {
7432 pGridOptions.groupAggFiltering = ComponentUtil.toBoolean(changesToApply.groupAggFiltering);
7433 }
7434 delete changesToApply.groupAggFiltering;
7435 }
7436 // we need to do this before the generic handling, otherwise value gets set before we
7437 // try to set it, and the grid then doesn't refresh the rows as it doesn't see any change.
7438 // also it's possible we use the generic code setXXX below and put it up there instead,
7439 // cover all cases.
7440 if (changesToApply.rowClass) {
7441 api.setRowClass(changesToApply.rowClass.currentValue);
7442 delete changesToApply.rowClass;
7443 }
7444 // check if any change for the simple types, and if so, then just copy in the new value
7445 __spread$2(ComponentUtil.ARRAY_PROPERTIES, ComponentUtil.OBJECT_PROPERTIES, ComponentUtil.STRING_PROPERTIES, ComponentUtil.getEventCallbacks()).filter(keyExists)
7446 .forEach(function (key) { return pGridOptions[key] = changesToApply[key].currentValue; });
7447 ComponentUtil.BOOLEAN_PROPERTIES
7448 .filter(keyExists)
7449 .forEach(function (key) { return pGridOptions[key] = ComponentUtil.toBoolean(changesToApply[key].currentValue); });
7450 ComponentUtil.NUMBER_PROPERTIES
7451 .filter(keyExists)
7452 .forEach(function (key) { return pGridOptions[key] = ComponentUtil.toNumber(changesToApply[key].currentValue); });
7453 if (changesToApply.enableCellTextSelection) {
7454 api.setEnableCellTextSelection(ComponentUtil.toBoolean(changesToApply.enableCellTextSelection.currentValue));
7455 delete changesToApply.enableCellTextSelection;
7456 }
7457 if (changesToApply.quickFilterText) {
7458 api.setQuickFilter(changesToApply.quickFilterText.currentValue);
7459 delete changesToApply.quickFilterText;
7460 }
7461 if (changesToApply.autoGroupColumnDef) {
7462 api.setAutoGroupColumnDef(changesToApply.autoGroupColumnDef.currentValue, "gridOptionsChanged");
7463 delete changesToApply.autoGroupColumnDef;
7464 }
7465 if (changesToApply.columnDefs) {
7466 api.setColumnDefs(changesToApply.columnDefs.currentValue, "gridOptionsChanged");
7467 delete changesToApply.columnDefs;
7468 }
7469 if (changesToApply.defaultColDef) {
7470 api.setDefaultColDef(changesToApply.defaultColDef.currentValue, "gridOptionsChanged");
7471 delete changesToApply.defaultColDef;
7472 }
7473 if (changesToApply.paginationPageSize) {
7474 api.paginationSetPageSize(ComponentUtil.toNumber(changesToApply.paginationPageSize.currentValue));
7475 delete changesToApply.paginationPageSize;
7476 }
7477 if (changesToApply.pivotMode) {
7478 columnApi.setPivotMode(ComponentUtil.toBoolean(changesToApply.pivotMode.currentValue));
7479 delete changesToApply.pivotMode;
7480 }
7481 if (changesToApply.groupRemoveSingleChildren) {
7482 api.setGroupRemoveSingleChildren(ComponentUtil.toBoolean(changesToApply.groupRemoveSingleChildren.currentValue));
7483 delete changesToApply.groupRemoveSingleChildren;
7484 }
7485 if (changesToApply.suppressRowDrag) {
7486 api.setSuppressRowDrag(ComponentUtil.toBoolean(changesToApply.suppressRowDrag.currentValue));
7487 delete changesToApply.suppressRowDrag;
7488 }
7489 if (changesToApply.suppressMoveWhenRowDragging) {
7490 api.setSuppressMoveWhenRowDragging(ComponentUtil.toBoolean(changesToApply.suppressMoveWhenRowDragging.currentValue));
7491 delete changesToApply.suppressMoveWhenRowDragging;
7492 }
7493 if (changesToApply.suppressRowClickSelection) {
7494 api.setSuppressRowClickSelection(ComponentUtil.toBoolean(changesToApply.suppressRowClickSelection.currentValue));
7495 delete changesToApply.suppressRowClickSelection;
7496 }
7497 if (changesToApply.suppressClipboardPaste) {
7498 api.setSuppressClipboardPaste(ComponentUtil.toBoolean(changesToApply.suppressClipboardPaste.currentValue));
7499 delete changesToApply.suppressClipboardPaste;
7500 }
7501 if (changesToApply.headerHeight) {
7502 api.setHeaderHeight(ComponentUtil.toNumber(changesToApply.headerHeight.currentValue));
7503 delete changesToApply.headerHeight;
7504 }
7505 // any remaining properties can be set in a generic way
7506 // ie the setter takes the form of setXXX and the argument requires no formatting/translation first
7507 var dynamicApi = api;
7508 Object.keys(changesToApply)
7509 .forEach(function (property) {
7510 var setterName = "set" + property.charAt(0).toUpperCase() + property.substring(1);
7511 if (dynamicApi[setterName]) {
7512 dynamicApi[setterName](changes[property].currentValue);
7513 }
7514 });
7515 // copy changes into an event for dispatch
7516 var event = {
7517 type: Events.EVENT_COMPONENT_STATE_CHANGED,
7518 api: gridOptions.api,
7519 columnApi: gridOptions.columnApi
7520 };
7521 iterateObject(changes, function (key, value) {
7522 event[key] = value;
7523 });
7524 api.dispatchEvent(event);
7525 };
7526 ComponentUtil.toBoolean = function (value) {
7527 if (typeof value === 'boolean') {
7528 return value;
7529 }
7530 if (typeof value === 'string') {
7531 // for boolean, compare to empty String to allow attributes appearing with
7532 // no value to be treated as 'true'
7533 return value.toUpperCase() === 'TRUE' || value == '';
7534 }
7535 return false;
7536 };
7537 ComponentUtil.toNumber = function (value) {
7538 if (typeof value === 'number') {
7539 return value;
7540 }
7541 if (typeof value === 'string') {
7542 return Number(value);
7543 }
7544 };
7545 // all the events are populated in here AFTER this class (at the bottom of the file).
7546 ComponentUtil.EVENTS = [];
7547 // events that are available for use by users of AG Grid and so should be documented
7548 ComponentUtil.PUBLIC_EVENTS = [];
7549 // events that are internal to AG Grid and should not be exposed to users via documentation or generated framework components
7550 ComponentUtil.EXCLUDED_INTERNAL_EVENTS = [];
7551 ComponentUtil.STRING_PROPERTIES = PropertyKeys.STRING_PROPERTIES;
7552 ComponentUtil.OBJECT_PROPERTIES = PropertyKeys.OBJECT_PROPERTIES;
7553 ComponentUtil.ARRAY_PROPERTIES = PropertyKeys.ARRAY_PROPERTIES;
7554 ComponentUtil.NUMBER_PROPERTIES = PropertyKeys.NUMBER_PROPERTIES;
7555 ComponentUtil.BOOLEAN_PROPERTIES = PropertyKeys.BOOLEAN_PROPERTIES;
7556 ComponentUtil.FUNCTION_PROPERTIES = PropertyKeys.FUNCTION_PROPERTIES;
7557 ComponentUtil.ALL_PROPERTIES = PropertyKeys.ALL_PROPERTIES;
7558 return ComponentUtil;
7559}());
7560ComponentUtil.EVENTS = values(Events);
7561/** Exclude the following internal events from code generation to prevent exposing these events via framework components */
7562ComponentUtil.EXCLUDED_INTERNAL_EVENTS = [
7563 Events.EVENT_SCROLLBAR_WIDTH_CHANGED,
7564 Events.EVENT_CHECKBOX_CHANGED,
7565 Events.EVENT_HEIGHT_SCALE_CHANGED,
7566 Events.EVENT_BODY_HEIGHT_CHANGED,
7567 Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED,
7568 Events.EVENT_SCROLL_VISIBILITY_CHANGED,
7569 Events.EVENT_COLUMN_HOVER_CHANGED,
7570 Events.EVENT_FLASH_CELLS,
7571 Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED,
7572 Events.EVENT_DISPLAYED_ROWS_CHANGED,
7573 Events.EVENT_LEFT_PINNED_WIDTH_CHANGED,
7574 Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED,
7575 Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED,
7576 Events.EVENT_POPUP_TO_FRONT,
7577 Events.EVENT_KEYBOARD_FOCUS,
7578 Events.EVENT_MOUSE_FOCUS,
7579 Events.EVENT_STORE_UPDATED,
7580 Events.EVENT_COLUMN_PANEL_ITEM_DRAG_START,
7581 Events.EVENT_COLUMN_PANEL_ITEM_DRAG_END,
7582 Events.EVENT_FILL_START,
7583 Events.EVENT_FILL_END,
7584 Events.EVENT_FULL_WIDTH_ROW_FOCUSED
7585];
7586/** EVENTS that should be exposed via code generation for the framework components. */
7587ComponentUtil.PUBLIC_EVENTS = ComponentUtil.EVENTS.filter(function (e) { return !includes(ComponentUtil.EXCLUDED_INTERNAL_EVENTS, e); });
7588
7589/**
7590 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
7591 * @version v27.3.0
7592 * @link https://www.ag-grid.com/
7593 * @license MIT
7594 */
7595var __extends$4 = (undefined && undefined.__extends) || (function () {
7596 var extendStatics = function (d, b) {
7597 extendStatics = Object.setPrototypeOf ||
7598 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7599 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7600 return extendStatics(d, b);
7601 };
7602 return function (d, b) {
7603 extendStatics(d, b);
7604 function __() { this.constructor = d; }
7605 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7606 };
7607})();
7608var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7609 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7610 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7611 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;
7612 return c > 3 && r && Object.defineProperty(target, key, r), r;
7613};
7614var AgStackComponentsRegistry = /** @class */ (function (_super) {
7615 __extends$4(AgStackComponentsRegistry, _super);
7616 function AgStackComponentsRegistry() {
7617 var _this = _super !== null && _super.apply(this, arguments) || this;
7618 _this.componentsMappedByName = {};
7619 return _this;
7620 }
7621 AgStackComponentsRegistry.prototype.setupComponents = function (components) {
7622 var _this = this;
7623 if (components) {
7624 components.forEach(function (componentMeta) { return _this.addComponent(componentMeta); });
7625 }
7626 };
7627 AgStackComponentsRegistry.prototype.addComponent = function (componentMeta) {
7628 // get name of the class as a string
7629 // let className = getNameOfClass(ComponentClass);
7630 // insert a dash after every capital letter
7631 // let classEscaped = className.replace(/([A-Z])/g, "-$1").toLowerCase();
7632 var classEscaped = componentMeta.componentName.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
7633 // put all to upper case
7634 var classUpperCase = classEscaped.toUpperCase();
7635 // finally store
7636 this.componentsMappedByName[classUpperCase] = componentMeta.componentClass;
7637 };
7638 AgStackComponentsRegistry.prototype.getComponentClass = function (htmlTag) {
7639 return this.componentsMappedByName[htmlTag];
7640 };
7641 AgStackComponentsRegistry = __decorate$8([
7642 Bean('agStackComponentsRegistry')
7643 ], AgStackComponentsRegistry);
7644 return AgStackComponentsRegistry;
7645}(BeanStub));
7646
7647/**
7648 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
7649 * @version v27.3.0
7650 * @link https://www.ag-grid.com/
7651 * @license MIT
7652 */
7653var __read$3 = (undefined && undefined.__read) || function (o, n) {
7654 var m = typeof Symbol === "function" && o[Symbol.iterator];
7655 if (!m) return o;
7656 var i = m.call(o), r, ar = [], e;
7657 try {
7658 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7659 }
7660 catch (error) { e = { error: error }; }
7661 finally {
7662 try {
7663 if (r && !r.done && (m = i["return"])) m.call(i);
7664 }
7665 finally { if (e) throw e.error; }
7666 }
7667 return ar;
7668};
7669var __spread$3 = (undefined && undefined.__spread) || function () {
7670 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$3(arguments[i]));
7671 return ar;
7672};
7673var ColDefUtil = /** @class */ (function () {
7674 function ColDefUtil() {
7675 }
7676 ColDefUtil.STRING_PROPERTIES = [
7677 'headerName',
7678 'columnGroupShow',
7679 'headerClass',
7680 'toolPanelClass',
7681 'headerValueGetter',
7682 'pivotKeys',
7683 'groupId',
7684 'colId',
7685 'sort',
7686 'initialSort',
7687 'field',
7688 'type',
7689 'tooltipComponent',
7690 'tooltipField',
7691 'headerTooltip',
7692 'cellClass',
7693 'showRowGroup',
7694 'filter',
7695 'initialAggFunc',
7696 'defaultAggFunc',
7697 'aggFunc',
7698 'pinned',
7699 'initialPinned',
7700 'chartDataType',
7701 'cellEditorPopupPosition'
7702 ];
7703 ColDefUtil.OBJECT_PROPERTIES = [
7704 'headerGroupComponent',
7705 'headerGroupComponentFramework',
7706 'headerGroupComponentParams',
7707 'cellStyle',
7708 'cellRenderer',
7709 'cellRendererParams',
7710 'cellRendererFramework',
7711 'cellEditor',
7712 'cellEditorFramework',
7713 'cellEditorParams',
7714 'pinnedRowCellRendererFramework',
7715 'pinnedRowCellRendererParams',
7716 'filterFramework',
7717 'filterParams',
7718 'pivotValueColumn',
7719 'headerComponent',
7720 'headerComponentFramework',
7721 'headerComponentParams',
7722 'floatingFilterComponent',
7723 'floatingFilterComponentParams',
7724 'floatingFilterComponentFramework',
7725 'floatingFilterFramework',
7726 'tooltipComponent',
7727 'tooltipComponentParams',
7728 'tooltipComponentFramework',
7729 'refData',
7730 'columnsMenuParams'
7731 ];
7732 ColDefUtil.ARRAY_PROPERTIES = [
7733 'children',
7734 'sortingOrder',
7735 'allowedAggFuncs',
7736 'menuTabs',
7737 'pivotTotalColumnIds',
7738 'cellClassRules',
7739 'icons'
7740 ];
7741 ColDefUtil.NUMBER_PROPERTIES = [
7742 'sortedAt',
7743 'sortIndex',
7744 'initialSortIndex',
7745 'flex',
7746 'initialFlex',
7747 'width',
7748 'initialWidth',
7749 'minWidth',
7750 'maxWidth',
7751 'rowGroupIndex',
7752 'initialRowGroupIndex',
7753 'pivotIndex',
7754 'initialPivotIndex'
7755 ];
7756 ColDefUtil.BOOLEAN_PROPERTIES = [
7757 'suppressCellFlash',
7758 'suppressColumnsToolPanel',
7759 'suppressFiltersToolPanel',
7760 'openByDefault',
7761 'marryChildren',
7762 'hide',
7763 'initialHide',
7764 'rowGroup',
7765 'initialRowGroup',
7766 'pivot',
7767 'initialPivot',
7768 'checkboxSelection',
7769 'headerCheckboxSelection',
7770 'headerCheckboxSelectionFilteredOnly',
7771 'suppressMenu',
7772 'suppressMovable',
7773 'lockPosition',
7774 'lockVisible',
7775 'lockPinned',
7776 'unSortIcon',
7777 'suppressSizeToFit',
7778 'suppressAutoSize',
7779 'enableRowGroup',
7780 'enablePivot',
7781 'enableValue',
7782 'editable',
7783 'suppressPaste',
7784 'suppressNavigable',
7785 'enableCellChangeFlash',
7786 'rowDrag',
7787 'dndSource',
7788 'autoHeight',
7789 'wrapText',
7790 'sortable',
7791 'resizable',
7792 'singleClickEdit',
7793 'floatingFilter',
7794 'cellEditorPopup',
7795 'suppressFillHandle'
7796 ];
7797 ColDefUtil.FUNCTION_PROPERTIES = [
7798 'dndSourceOnRowDrag',
7799 'valueGetter',
7800 'valueSetter',
7801 'filterValueGetter',
7802 'keyCreator',
7803 'pinnedRowCellRenderer',
7804 'valueFormatter',
7805 'pinnedRowValueFormatter',
7806 'valueParser',
7807 'comparator',
7808 'equals',
7809 'pivotComparator',
7810 'suppressKeyboardEvent',
7811 'suppressHeaderKeyboardEvent',
7812 'colSpan',
7813 'rowSpan',
7814 'getQuickFilterText',
7815 'newValueHandler',
7816 'onCellValueChanged',
7817 'onCellClicked',
7818 'onCellDoubleClicked',
7819 'onCellContextMenu',
7820 'rowDragText',
7821 'tooltipValueGetter',
7822 'tooltipComponent',
7823 'tooltipComponentFramework',
7824 'cellRendererSelector',
7825 'cellEditorSelector'
7826 ];
7827 ColDefUtil.ALL_PROPERTIES = __spread$3(ColDefUtil.ARRAY_PROPERTIES, ColDefUtil.OBJECT_PROPERTIES, ColDefUtil.STRING_PROPERTIES, ColDefUtil.NUMBER_PROPERTIES, ColDefUtil.FUNCTION_PROPERTIES, ColDefUtil.BOOLEAN_PROPERTIES);
7828 // used when doing property checks - this causes noise when using frameworks which can add their own fw specific
7829 // properties to colDefs, gridOptions etc
7830 ColDefUtil.FRAMEWORK_PROPERTIES = [
7831 '__ob__',
7832 '__v_skip',
7833 '__metadata__',
7834 'mappedColumnProperties',
7835 'hasChildColumns',
7836 'toColDef',
7837 'createColDefFromGridColumn'
7838 ];
7839 return ColDefUtil;
7840}());
7841
7842/**
7843 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
7844 * @version v27.3.0
7845 * @link https://www.ag-grid.com/
7846 * @license MIT
7847 */
7848var __read$4 = (undefined && undefined.__read) || function (o, n) {
7849 var m = typeof Symbol === "function" && o[Symbol.iterator];
7850 if (!m) return o;
7851 var i = m.call(o), r, ar = [], e;
7852 try {
7853 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7854 }
7855 catch (error) { e = { error: error }; }
7856 finally {
7857 try {
7858 if (r && !r.done && (m = i["return"])) m.call(i);
7859 }
7860 finally { if (e) throw e.error; }
7861 }
7862 return ar;
7863};
7864var Color = /** @class */ (function () {
7865 /**
7866 * Every color component should be in the [0, 1] range.
7867 * Some easing functions (such as elastic easing) can overshoot the target value by some amount.
7868 * So, when animating colors, if the source or target color components are already near
7869 * or at the edge of the allowed [0, 1] range, it is possible for the intermediate color
7870 * component value to end up outside of that range mid-animation. For this reason the constructor
7871 * performs range checking/constraining.
7872 * @param r Red component.
7873 * @param g Green component.
7874 * @param b Blue component.
7875 * @param a Alpha (opacity) component.
7876 */
7877 function Color(r, g, b, a) {
7878 if (a === void 0) { a = 1; }
7879 // NaN is treated as 0.
7880 this.r = Math.min(1, Math.max(0, r || 0));
7881 this.g = Math.min(1, Math.max(0, g || 0));
7882 this.b = Math.min(1, Math.max(0, b || 0));
7883 this.a = Math.min(1, Math.max(0, a || 0));
7884 }
7885 /**
7886 * The given string can be in one of the following formats:
7887 * - #rgb
7888 * - #rrggbb
7889 * - rgb(r, g, b)
7890 * - rgba(r, g, b, a)
7891 * - CSS color name such as 'white', 'orange', 'cyan', etc.
7892 * @param str
7893 */
7894 Color.fromString = function (str) {
7895 // hexadecimal notation
7896 if (str.indexOf('#') >= 0) { // there can be some leading whitespace
7897 return Color.fromHexString(str);
7898 }
7899 // color name
7900 var hex = Color.nameToHex[str];
7901 if (hex) {
7902 return Color.fromHexString(hex);
7903 }
7904 // rgb(a) notation
7905 if (str.indexOf('rgb') >= 0) {
7906 return Color.fromRgbaString(str);
7907 }
7908 throw new Error("Invalid color string: '" + str + "'");
7909 };
7910 // See https://drafts.csswg.org/css-color/#hex-notation
7911 Color.parseHex = function (input) {
7912 input = input.replace(/ /g, '').slice(1);
7913 var parts;
7914 switch (input.length) {
7915 case 6:
7916 case 8:
7917 parts = [];
7918 for (var i = 0; i < input.length; i += 2) {
7919 parts.push(parseInt("" + input[i] + input[i + 1], 16));
7920 }
7921 break;
7922 case 3:
7923 case 4:
7924 parts = input.split('').map(function (p) { return parseInt(p, 16); }).map(function (p) { return p + p * 16; });
7925 break;
7926 }
7927 if (parts.length >= 3) {
7928 if (parts.every(function (p) { return p >= 0; })) {
7929 if (parts.length === 3) {
7930 parts.push(255);
7931 }
7932 return parts;
7933 }
7934 }
7935 };
7936 Color.fromHexString = function (str) {
7937 var values = Color.parseHex(str);
7938 if (values) {
7939 var _a = __read$4(values, 4), r = _a[0], g = _a[1], b = _a[2], a = _a[3];
7940 return new Color(r / 255, g / 255, b / 255, a / 255);
7941 }
7942 throw new Error("Malformed hexadecimal color string: '" + str + "'");
7943 };
7944 Color.stringToRgba = function (str) {
7945 // Find positions of opening and closing parentheses.
7946 var _a = __read$4([NaN, NaN], 2), po = _a[0], pc = _a[1];
7947 for (var i = 0; i < str.length; i++) {
7948 var c = str[i];
7949 if (!po && c === '(') {
7950 po = i;
7951 }
7952 else if (c === ')') {
7953 pc = i;
7954 break;
7955 }
7956 }
7957 var contents = po && pc && str.substring(po + 1, pc);
7958 if (!contents) {
7959 return;
7960 }
7961 var parts = contents.split(',');
7962 var rgba = [];
7963 for (var i = 0; i < parts.length; i++) {
7964 var part = parts[i];
7965 var value = parseFloat(part);
7966 if (isNaN(value)) {
7967 return;
7968 }
7969 if (part.indexOf('%') >= 0) { // percentage r, g, or b value
7970 value = Math.max(0, Math.min(100, value));
7971 value /= 100;
7972 }
7973 else {
7974 if (i === 3) { // alpha component
7975 value = Math.max(0, Math.min(1, value));
7976 }
7977 else { // absolute r, g, or b value
7978 value = Math.max(0, Math.min(255, value));
7979 value /= 255;
7980 }
7981 }
7982 rgba.push(value);
7983 }
7984 return rgba;
7985 };
7986 Color.fromRgbaString = function (str) {
7987 var rgba = Color.stringToRgba(str);
7988 if (rgba) {
7989 if (rgba.length === 3) {
7990 return new Color(rgba[0], rgba[1], rgba[2]);
7991 }
7992 else if (rgba.length === 4) {
7993 return new Color(rgba[0], rgba[1], rgba[2], rgba[3]);
7994 }
7995 }
7996 throw new Error("Malformed rgb/rgba color string: '" + str + "'");
7997 };
7998 Color.fromArray = function (arr) {
7999 if (arr.length === 4) {
8000 return new Color(arr[0], arr[1], arr[2], arr[3]);
8001 }
8002 if (arr.length === 3) {
8003 return new Color(arr[0], arr[1], arr[2]);
8004 }
8005 throw new Error('The given array should contain 3 or 4 color components (numbers).');
8006 };
8007 Color.fromHSB = function (h, s, b, alpha) {
8008 if (alpha === void 0) { alpha = 1; }
8009 var rgb = Color.HSBtoRGB(h, s, b);
8010 return new Color(rgb[0], rgb[1], rgb[2], alpha);
8011 };
8012 Color.padHex = function (str) {
8013 // Can't use `padStart(2, '0')` here because of IE.
8014 return str.length === 1 ? '0' + str : str;
8015 };
8016 Color.prototype.toHexString = function () {
8017 var hex = '#'
8018 + Color.padHex(Math.round(this.r * 255).toString(16))
8019 + Color.padHex(Math.round(this.g * 255).toString(16))
8020 + Color.padHex(Math.round(this.b * 255).toString(16));
8021 if (this.a < 1) {
8022 hex += Color.padHex(Math.round(this.a * 255).toString(16));
8023 }
8024 return hex;
8025 };
8026 Color.prototype.toRgbaString = function (fractionDigits) {
8027 if (fractionDigits === void 0) { fractionDigits = 3; }
8028 var components = [
8029 Math.round(this.r * 255),
8030 Math.round(this.g * 255),
8031 Math.round(this.b * 255)
8032 ];
8033 var k = Math.pow(10, fractionDigits);
8034 if (this.a !== 1) {
8035 components.push(Math.round(this.a * k) / k);
8036 return "rgba(" + components.join(', ') + ")";
8037 }
8038 return "rgb(" + components.join(', ') + ")";
8039 };
8040 Color.prototype.toString = function () {
8041 if (this.a === 1) {
8042 return this.toHexString();
8043 }
8044 return this.toRgbaString();
8045 };
8046 Color.prototype.toHSB = function () {
8047 return Color.RGBtoHSB(this.r, this.g, this.b);
8048 };
8049 /**
8050 * Converts the given RGB triple to an array of HSB (HSV) components.
8051 * The hue component will be `NaN` for achromatic colors.
8052 */
8053 Color.RGBtoHSB = function (r, g, b) {
8054 var min = Math.min(r, g, b);
8055 var max = Math.max(r, g, b);
8056 var S = max !== 0 ? (max - min) / max : 0;
8057 var H = NaN;
8058 // min == max, means all components are the same
8059 // and the color is a shade of gray with no hue (H is NaN)
8060 if (min !== max) {
8061 var delta = max - min;
8062 var rc = (max - r) / delta;
8063 var gc = (max - g) / delta;
8064 var bc = (max - b) / delta;
8065 if (r === max) {
8066 H = bc - gc;
8067 }
8068 else if (g === max) {
8069 H = 2.0 + rc - bc;
8070 }
8071 else {
8072 H = 4.0 + gc - rc;
8073 }
8074 H /= 6.0;
8075 if (H < 0) {
8076 H = H + 1.0;
8077 }
8078 }
8079 return [H * 360, S, max];
8080 };
8081 /**
8082 * Converts the given HSB (HSV) triple to an array of RGB components.
8083 */
8084 Color.HSBtoRGB = function (H, S, B) {
8085 if (isNaN(H)) {
8086 H = 0;
8087 }
8088 H = (((H % 360) + 360) % 360) / 360; // normalize hue to [0, 360] interval, then scale to [0, 1]
8089 var r = 0;
8090 var g = 0;
8091 var b = 0;
8092 if (S === 0) {
8093 r = g = b = B;
8094 }
8095 else {
8096 var h = (H - Math.floor(H)) * 6;
8097 var f = h - Math.floor(h);
8098 var p = B * (1 - S);
8099 var q = B * (1 - S * f);
8100 var t = B * (1 - (S * (1 - f)));
8101 switch (h >> 0) { // discard the floating point part of the number
8102 case 0:
8103 r = B;
8104 g = t;
8105 b = p;
8106 break;
8107 case 1:
8108 r = q;
8109 g = B;
8110 b = p;
8111 break;
8112 case 2:
8113 r = p;
8114 g = B;
8115 b = t;
8116 break;
8117 case 3:
8118 r = p;
8119 g = q;
8120 b = B;
8121 break;
8122 case 4:
8123 r = t;
8124 g = p;
8125 b = B;
8126 break;
8127 case 5:
8128 r = B;
8129 g = p;
8130 b = q;
8131 break;
8132 }
8133 }
8134 return [r, g, b];
8135 };
8136 Color.prototype.derive = function (hueShift, saturationFactor, brightnessFactor, opacityFactor) {
8137 var hsb = Color.RGBtoHSB(this.r, this.g, this.b);
8138 var b = hsb[2];
8139 if (b == 0 && brightnessFactor > 1.0) {
8140 b = 0.05;
8141 }
8142 var h = (((hsb[0] + hueShift) % 360) + 360) % 360;
8143 var s = Math.max(Math.min(hsb[1] * saturationFactor, 1.0), 0.0);
8144 b = Math.max(Math.min(b * brightnessFactor, 1.0), 0.0);
8145 var a = Math.max(Math.min(this.a * opacityFactor, 1.0), 0.0);
8146 var rgba = Color.HSBtoRGB(h, s, b);
8147 rgba.push(a);
8148 return Color.fromArray(rgba);
8149 };
8150 Color.prototype.brighter = function () {
8151 return this.derive(0, 1.0, 1.0 / 0.7, 1.0);
8152 };
8153 Color.prototype.darker = function () {
8154 return this.derive(0, 1.0, 0.7, 1.0);
8155 };
8156 /**
8157 * CSS Color Module Level 4:
8158 * https://drafts.csswg.org/css-color/#named-colors
8159 */
8160 Color.nameToHex = Object.freeze({
8161 aliceblue: '#F0F8FF',
8162 antiquewhite: '#FAEBD7',
8163 aqua: '#00FFFF',
8164 aquamarine: '#7FFFD4',
8165 azure: '#F0FFFF',
8166 beige: '#F5F5DC',
8167 bisque: '#FFE4C4',
8168 black: '#000000',
8169 blanchedalmond: '#FFEBCD',
8170 blue: '#0000FF',
8171 blueviolet: '#8A2BE2',
8172 brown: '#A52A2A',
8173 burlywood: '#DEB887',
8174 cadetblue: '#5F9EA0',
8175 chartreuse: '#7FFF00',
8176 chocolate: '#D2691E',
8177 coral: '#FF7F50',
8178 cornflowerblue: '#6495ED',
8179 cornsilk: '#FFF8DC',
8180 crimson: '#DC143C',
8181 cyan: '#00FFFF',
8182 darkblue: '#00008B',
8183 darkcyan: '#008B8B',
8184 darkgoldenrod: '#B8860B',
8185 darkgray: '#A9A9A9',
8186 darkgreen: '#006400',
8187 darkgrey: '#A9A9A9',
8188 darkkhaki: '#BDB76B',
8189 darkmagenta: '#8B008B',
8190 darkolivegreen: '#556B2F',
8191 darkorange: '#FF8C00',
8192 darkorchid: '#9932CC',
8193 darkred: '#8B0000',
8194 darksalmon: '#E9967A',
8195 darkseagreen: '#8FBC8F',
8196 darkslateblue: '#483D8B',
8197 darkslategray: '#2F4F4F',
8198 darkslategrey: '#2F4F4F',
8199 darkturquoise: '#00CED1',
8200 darkviolet: '#9400D3',
8201 deeppink: '#FF1493',
8202 deepskyblue: '#00BFFF',
8203 dimgray: '#696969',
8204 dimgrey: '#696969',
8205 dodgerblue: '#1E90FF',
8206 firebrick: '#B22222',
8207 floralwhite: '#FFFAF0',
8208 forestgreen: '#228B22',
8209 fuchsia: '#FF00FF',
8210 gainsboro: '#DCDCDC',
8211 ghostwhite: '#F8F8FF',
8212 gold: '#FFD700',
8213 goldenrod: '#DAA520',
8214 gray: '#808080',
8215 green: '#008000',
8216 greenyellow: '#ADFF2F',
8217 grey: '#808080',
8218 honeydew: '#F0FFF0',
8219 hotpink: '#FF69B4',
8220 indianred: '#CD5C5C',
8221 indigo: '#4B0082',
8222 ivory: '#FFFFF0',
8223 khaki: '#F0E68C',
8224 lavender: '#E6E6FA',
8225 lavenderblush: '#FFF0F5',
8226 lawngreen: '#7CFC00',
8227 lemonchiffon: '#FFFACD',
8228 lightblue: '#ADD8E6',
8229 lightcoral: '#F08080',
8230 lightcyan: '#E0FFFF',
8231 lightgoldenrodyellow: '#FAFAD2',
8232 lightgray: '#D3D3D3',
8233 lightgreen: '#90EE90',
8234 lightgrey: '#D3D3D3',
8235 lightpink: '#FFB6C1',
8236 lightsalmon: '#FFA07A',
8237 lightseagreen: '#20B2AA',
8238 lightskyblue: '#87CEFA',
8239 lightslategray: '#778899',
8240 lightslategrey: '#778899',
8241 lightsteelblue: '#B0C4DE',
8242 lightyellow: '#FFFFE0',
8243 lime: '#00FF00',
8244 limegreen: '#32CD32',
8245 linen: '#FAF0E6',
8246 magenta: '#FF00FF',
8247 maroon: '#800000',
8248 mediumaquamarine: '#66CDAA',
8249 mediumblue: '#0000CD',
8250 mediumorchid: '#BA55D3',
8251 mediumpurple: '#9370DB',
8252 mediumseagreen: '#3CB371',
8253 mediumslateblue: '#7B68EE',
8254 mediumspringgreen: '#00FA9A',
8255 mediumturquoise: '#48D1CC',
8256 mediumvioletred: '#C71585',
8257 midnightblue: '#191970',
8258 mintcream: '#F5FFFA',
8259 mistyrose: '#FFE4E1',
8260 moccasin: '#FFE4B5',
8261 navajowhite: '#FFDEAD',
8262 navy: '#000080',
8263 oldlace: '#FDF5E6',
8264 olive: '#808000',
8265 olivedrab: '#6B8E23',
8266 orange: '#FFA500',
8267 orangered: '#FF4500',
8268 orchid: '#DA70D6',
8269 palegoldenrod: '#EEE8AA',
8270 palegreen: '#98FB98',
8271 paleturquoise: '#AFEEEE',
8272 palevioletred: '#DB7093',
8273 papayawhip: '#FFEFD5',
8274 peachpuff: '#FFDAB9',
8275 peru: '#CD853F',
8276 pink: '#FFC0CB',
8277 plum: '#DDA0DD',
8278 powderblue: '#B0E0E6',
8279 purple: '#800080',
8280 rebeccapurple: '#663399',
8281 red: '#FF0000',
8282 rosybrown: '#BC8F8F',
8283 royalblue: '#4169E1',
8284 saddlebrown: '#8B4513',
8285 salmon: '#FA8072',
8286 sandybrown: '#F4A460',
8287 seagreen: '#2E8B57',
8288 seashell: '#FFF5EE',
8289 sienna: '#A0522D',
8290 silver: '#C0C0C0',
8291 skyblue: '#87CEEB',
8292 slateblue: '#6A5ACD',
8293 slategray: '#708090',
8294 slategrey: '#708090',
8295 snow: '#FFFAFA',
8296 springgreen: '#00FF7F',
8297 steelblue: '#4682B4',
8298 tan: '#D2B48C',
8299 teal: '#008080',
8300 thistle: '#D8BFD8',
8301 tomato: '#FF6347',
8302 turquoise: '#40E0D0',
8303 violet: '#EE82EE',
8304 wheat: '#F5DEB3',
8305 white: '#FFFFFF',
8306 whitesmoke: '#F5F5F5',
8307 yellow: '#FFFF00',
8308 yellowgreen: '#9ACD32'
8309 });
8310 return Color;
8311}());
8312
8313/**
8314 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
8315 * @version v27.3.0
8316 * @link https://www.ag-grid.com/
8317 * @license MIT
8318 */
8319// Based on https://stackoverflow.com/a/14991797
8320// This will parse a delimited string into an array of arrays.
8321function stringToArray(strData, delimiter) {
8322 if (delimiter === void 0) { delimiter = ','; }
8323 var data = [];
8324 var isNewline = function (char) { return char === '\r' || char === '\n'; };
8325 var insideQuotedField = false;
8326 if (strData === '') {
8327 return [['']];
8328 }
8329 var _loop_1 = function (row, column, position) {
8330 var previousChar = strData[position - 1];
8331 var currentChar = strData[position];
8332 var nextChar = strData[position + 1];
8333 var ensureDataExists = function () {
8334 if (!data[row]) {
8335 // create row if it doesn't exist
8336 data[row] = [];
8337 }
8338 if (!data[row][column]) {
8339 // create column if it doesn't exist
8340 data[row][column] = '';
8341 }
8342 };
8343 ensureDataExists();
8344 if (currentChar === '"') {
8345 if (insideQuotedField) {
8346 if (nextChar === '"') {
8347 // unescape double quote
8348 data[row][column] += '"';
8349 position++;
8350 }
8351 else {
8352 // exit quoted field
8353 insideQuotedField = false;
8354 }
8355 return out_row_1 = row, out_column_1 = column, out_position_1 = position, "continue";
8356 }
8357 else if (previousChar === undefined || previousChar === delimiter || isNewline(previousChar)) {
8358 // enter quoted field
8359 insideQuotedField = true;
8360 return out_row_1 = row, out_column_1 = column, out_position_1 = position, "continue";
8361 }
8362 }
8363 if (!insideQuotedField) {
8364 if (currentChar === delimiter) {
8365 // move to next column
8366 column++;
8367 ensureDataExists();
8368 return out_row_1 = row, out_column_1 = column, out_position_1 = position, "continue";
8369 }
8370 else if (isNewline(currentChar)) {
8371 // move to next row
8372 column = 0;
8373 row++;
8374 ensureDataExists();
8375 if (currentChar === '\r' && nextChar === '\n') {
8376 // skip over second newline character if it exists
8377 position++;
8378 }
8379 return out_row_1 = row, out_column_1 = column, out_position_1 = position, "continue";
8380 }
8381 }
8382 // add current character to current column
8383 data[row][column] += currentChar;
8384 out_row_1 = row;
8385 out_column_1 = column;
8386 out_position_1 = position;
8387 };
8388 var out_row_1, out_column_1, out_position_1;
8389 // iterate over each character, keep track of current row and column (of the returned array)
8390 for (var row = 0, column = 0, position = 0; position < strData.length; position++) {
8391 _loop_1(row, column, position);
8392 row = out_row_1;
8393 column = out_column_1;
8394 position = out_position_1;
8395 }
8396 return data;
8397}
8398
8399var CsvUtils = /*#__PURE__*/Object.freeze({
8400 stringToArray: stringToArray
8401});
8402
8403/**
8404 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
8405 * @version v27.3.0
8406 * @link https://www.ag-grid.com/
8407 * @license MIT
8408 */
8409var __values$1 = (undefined && undefined.__values) || function(o) {
8410 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
8411 if (m) return m.call(o);
8412 if (o && typeof o.length === "number") return {
8413 next: function () {
8414 if (o && i >= o.length) o = void 0;
8415 return { value: o && o[i++], done: !o };
8416 }
8417 };
8418 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
8419};
8420/**
8421 * These variables are lazy loaded, as otherwise they try and get initialised when we are loading
8422 * unit tests and we don't have references to window or document in the unit tests
8423 * from http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
8424 */
8425var isSafari;
8426var isIE;
8427var isEdge;
8428var isChrome;
8429var isFirefox;
8430var isIOS;
8431var invisibleScrollbar;
8432var browserScrollbarWidth;
8433function isBrowserIE() {
8434 if (isIE === undefined) {
8435 isIE = /*@cc_on!@*/ !!document.documentMode; // At least IE6
8436 }
8437 return isIE;
8438}
8439function isBrowserEdge() {
8440 if (isEdge === undefined) {
8441 isEdge = !isBrowserIE() && !!window.StyleMedia;
8442 }
8443 return isEdge;
8444}
8445function isBrowserSafari() {
8446 if (isSafari === undefined) {
8447 // taken from https://stackoverflow.com/a/23522755/1388233
8448 isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
8449 }
8450 return isSafari;
8451}
8452function isBrowserChrome() {
8453 if (isChrome === undefined) {
8454 var win = window;
8455 isChrome = (!!win.chrome && (!!win.chrome.webstore || !!win.chrome.runtime)) ||
8456 (/Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor));
8457 }
8458 return isChrome;
8459}
8460function isBrowserFirefox() {
8461 if (isFirefox === undefined) {
8462 var win = window;
8463 isFirefox = typeof win.InstallTrigger !== 'undefined';
8464 }
8465 return isFirefox;
8466}
8467function isIOSUserAgent() {
8468 if (isIOS === undefined) {
8469 // taken from https://stackoverflow.com/a/58064481/1388233
8470 isIOS = (/iPad|iPhone|iPod/.test(navigator.platform) ||
8471 // eslint-disable-next-line
8472 (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&
8473 // @ts-ignore
8474 !window.MSStream;
8475 }
8476 return isIOS;
8477}
8478function getTabIndex(el) {
8479 if (!el) {
8480 return null;
8481 }
8482 var numberTabIndex = el.tabIndex;
8483 var tabIndex = el.getAttribute('tabIndex');
8484 if (numberTabIndex === -1 && (tabIndex === null || (tabIndex === '' && !isBrowserFirefox()))) {
8485 return null;
8486 }
8487 return numberTabIndex.toString();
8488}
8489function getMaxDivHeight() {
8490 if (!document.body) {
8491 return -1;
8492 }
8493 var res = 1000000;
8494 // FF reports the height back but still renders blank after ~6M px
8495 var testUpTo = navigator.userAgent.toLowerCase().match(/firefox/) ? 6000000 : 1000000000;
8496 var div = document.createElement('div');
8497 document.body.appendChild(div);
8498 while (true) {
8499 var test = res * 2;
8500 div.style.height = test + 'px';
8501 if (test > testUpTo || div.clientHeight !== test) {
8502 break;
8503 }
8504 else {
8505 res = test;
8506 }
8507 }
8508 document.body.removeChild(div);
8509 return res;
8510}
8511function getScrollbarWidth() {
8512 if (browserScrollbarWidth == null) {
8513 initScrollbarWidthAndVisibility();
8514 }
8515 return browserScrollbarWidth;
8516}
8517function initScrollbarWidthAndVisibility() {
8518 var body = document.body;
8519 var div = document.createElement('div');
8520 div.style.width = div.style.height = '100px';
8521 div.style.opacity = '0';
8522 div.style.overflow = 'scroll';
8523 div.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps
8524 div.style.position = 'absolute';
8525 body.appendChild(div);
8526 var width = div.offsetWidth - div.clientWidth;
8527 // if width is 0 and client width is 0, means the DOM isn't ready
8528 if (width === 0 && div.clientWidth === 0) {
8529 width = null;
8530 }
8531 // remove div
8532 if (div.parentNode) {
8533 div.parentNode.removeChild(div);
8534 }
8535 if (width != null) {
8536 browserScrollbarWidth = width;
8537 invisibleScrollbar = width === 0;
8538 }
8539}
8540function isInvisibleScrollbar() {
8541 if (invisibleScrollbar == null) {
8542 initScrollbarWidthAndVisibility();
8543 }
8544 return invisibleScrollbar;
8545}
8546/** @deprecated */
8547function hasOverflowScrolling() {
8548 var e_1, _a;
8549 var prefixes = ['webkit', 'moz', 'o', 'ms'];
8550 var div = document.createElement('div');
8551 var body = document.getElementsByTagName('body')[0];
8552 var found = false;
8553 var p;
8554 body.appendChild(div);
8555 div.setAttribute('style', prefixes.map(function (prefix) { return "-" + prefix + "-overflow-scrolling: touch"; }).concat('overflow-scrolling: touch').join(';'));
8556 var computedStyle = window.getComputedStyle(div);
8557 if (computedStyle.overflowScrolling === 'touch') {
8558 found = true;
8559 }
8560 if (!found) {
8561 try {
8562 for (var prefixes_1 = __values$1(prefixes), prefixes_1_1 = prefixes_1.next(); !prefixes_1_1.done; prefixes_1_1 = prefixes_1.next()) {
8563 p = prefixes_1_1.value;
8564 if (computedStyle[p + "OverflowScrolling"] === 'touch') {
8565 found = true;
8566 break;
8567 }
8568 }
8569 }
8570 catch (e_1_1) { e_1 = { error: e_1_1 }; }
8571 finally {
8572 try {
8573 if (prefixes_1_1 && !prefixes_1_1.done && (_a = prefixes_1.return)) _a.call(prefixes_1);
8574 }
8575 finally { if (e_1) throw e_1.error; }
8576 }
8577 }
8578 if (div.parentNode) {
8579 div.parentNode.removeChild(div);
8580 }
8581 return found;
8582}
8583/**
8584 * Gets the document body width
8585 * from: http://stackoverflow.com/questions/1038727/how-to-get-browser-width-using-javascript-code
8586 * @returns {number}
8587 */
8588function getBodyWidth() {
8589 if (document.body) {
8590 return document.body.clientWidth;
8591 }
8592 if (window.innerHeight) {
8593 return window.innerWidth;
8594 }
8595 if (document.documentElement && document.documentElement.clientWidth) {
8596 return document.documentElement.clientWidth;
8597 }
8598 return -1;
8599}
8600/**
8601 * Gets the body height
8602 * from: http://stackoverflow.com/questions/1038727/how-to-get-browser-width-using-javascript-code
8603 * @returns {number}
8604 */
8605function getBodyHeight() {
8606 if (document.body) {
8607 return document.body.clientHeight;
8608 }
8609 if (window.innerHeight) {
8610 return window.innerHeight;
8611 }
8612 if (document.documentElement && document.documentElement.clientHeight) {
8613 return document.documentElement.clientHeight;
8614 }
8615 return -1;
8616}
8617
8618var BrowserUtils = /*#__PURE__*/Object.freeze({
8619 isBrowserEdge: isBrowserEdge,
8620 isBrowserSafari: isBrowserSafari,
8621 isBrowserChrome: isBrowserChrome,
8622 isBrowserFirefox: isBrowserFirefox,
8623 isIOSUserAgent: isIOSUserAgent,
8624 getTabIndex: getTabIndex,
8625 getMaxDivHeight: getMaxDivHeight,
8626 getScrollbarWidth: getScrollbarWidth,
8627 isInvisibleScrollbar: isInvisibleScrollbar,
8628 hasOverflowScrolling: hasOverflowScrolling,
8629 getBodyWidth: getBodyWidth,
8630 getBodyHeight: getBodyHeight
8631});
8632
8633/**
8634 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
8635 * @version v27.3.0
8636 * @link https://www.ag-grid.com/
8637 * @license MIT
8638 */
8639var rtlNegativeScroll;
8640/**
8641 * This method adds a class to an element and remove that class from all siblings.
8642 * Useful for toggling state.
8643 * @param {HTMLElement} element The element to receive the class
8644 * @param {string} elementClass The class to be assigned to the element
8645 * @param {boolean} otherElementClass The class to be assigned to siblings of the element, but not the element itself
8646 */
8647function radioCssClass(element, elementClass, otherElementClass) {
8648 var parent = element.parentElement;
8649 var sibling = parent && parent.firstChild;
8650 while (sibling) {
8651 if (elementClass) {
8652 sibling.classList.toggle(elementClass, sibling === element);
8653 }
8654 if (otherElementClass) {
8655 sibling.classList.toggle(otherElementClass, sibling !== element);
8656 }
8657 sibling = sibling.nextSibling;
8658 }
8659}
8660function isFocusableFormField(element) {
8661 var matches = Element.prototype.matches || Element.prototype.msMatchesSelector;
8662 var isFocusable = matches.call(element, Constants.INPUT_SELECTOR);
8663 var isNotFocusable = matches.call(element, Constants.FOCUSABLE_EXCLUDE);
8664 var isElementVisible = isVisible(element);
8665 var focusable = isFocusable && !isNotFocusable && isElementVisible;
8666 return focusable;
8667}
8668function setDisplayed(element, displayed) {
8669 element.classList.toggle('ag-hidden', !displayed);
8670}
8671function setVisible(element, visible) {
8672 element.classList.toggle('ag-invisible', !visible);
8673}
8674function setDisabled(element, disabled) {
8675 var attributeName = 'disabled';
8676 var addOrRemoveDisabledAttribute = disabled ?
8677 function (e) { return e.setAttribute(attributeName, ''); } :
8678 function (e) { return e.removeAttribute(attributeName); };
8679 addOrRemoveDisabledAttribute(element);
8680 nodeListForEach(element.querySelectorAll('input'), function (input) { return addOrRemoveDisabledAttribute(input); });
8681}
8682function isElementChildOfClass(element, cls, maxNest) {
8683 var counter = 0;
8684 while (element) {
8685 if (element.classList.contains(cls)) {
8686 return true;
8687 }
8688 element = element.parentElement;
8689 if (maxNest && ++counter > maxNest) {
8690 break;
8691 }
8692 }
8693 return false;
8694}
8695// returns back sizes as doubles instead of strings. similar to
8696// getBoundingClientRect, however getBoundingClientRect does not:
8697// a) work with fractions (eg browser is zooming)
8698// b) has CSS transitions applied (eg CSS scale, browser zoom), which we don't want, we want the un-transitioned values
8699function getElementSize(el) {
8700 var _a = window.getComputedStyle(el), height = _a.height, width = _a.width, paddingTop = _a.paddingTop, paddingRight = _a.paddingRight, paddingBottom = _a.paddingBottom, paddingLeft = _a.paddingLeft, marginTop = _a.marginTop, marginRight = _a.marginRight, marginBottom = _a.marginBottom, marginLeft = _a.marginLeft, boxSizing = _a.boxSizing;
8701 return {
8702 height: parseFloat(height),
8703 width: parseFloat(width),
8704 paddingTop: parseFloat(paddingTop),
8705 paddingRight: parseFloat(paddingRight),
8706 paddingBottom: parseFloat(paddingBottom),
8707 paddingLeft: parseFloat(paddingLeft),
8708 marginTop: parseFloat(marginTop),
8709 marginRight: parseFloat(marginRight),
8710 marginBottom: parseFloat(marginBottom),
8711 marginLeft: parseFloat(marginLeft),
8712 boxSizing: boxSizing
8713 };
8714}
8715function getInnerHeight(el) {
8716 var size = getElementSize(el);
8717 if (size.boxSizing === 'border-box') {
8718 return size.height - size.paddingTop - size.paddingBottom;
8719 }
8720 return size.height;
8721}
8722function getInnerWidth(el) {
8723 var size = getElementSize(el);
8724 if (size.boxSizing === 'border-box') {
8725 return size.width - size.paddingLeft - size.paddingRight;
8726 }
8727 return size.width;
8728}
8729function getAbsoluteHeight(el) {
8730 var size = getElementSize(el);
8731 var marginRight = size.marginBottom + size.marginTop;
8732 return Math.ceil(el.offsetHeight + marginRight);
8733}
8734function getAbsoluteWidth(el) {
8735 var size = getElementSize(el);
8736 var marginWidth = size.marginLeft + size.marginRight;
8737 return Math.ceil(el.offsetWidth + marginWidth);
8738}
8739function isRtlNegativeScroll() {
8740 if (typeof rtlNegativeScroll === "boolean") {
8741 return rtlNegativeScroll;
8742 }
8743 var template = document.createElement('div');
8744 template.style.direction = 'rtl';
8745 template.style.width = '1px';
8746 template.style.height = '1px';
8747 template.style.position = 'fixed';
8748 template.style.top = '0px';
8749 template.style.overflow = 'hidden';
8750 template.dir = 'rtl';
8751 template.innerHTML = /* html */
8752 "<div style=\"width: 2px\">\n <span style=\"display: inline-block; width: 1px\"></span>\n <span style=\"display: inline-block; width: 1px\"></span>\n </div>";
8753 document.body.appendChild(template);
8754 template.scrollLeft = 1;
8755 rtlNegativeScroll = Math.floor(template.scrollLeft) === 0;
8756 document.body.removeChild(template);
8757 return rtlNegativeScroll;
8758}
8759function getScrollLeft(element, rtl) {
8760 var scrollLeft = element.scrollLeft;
8761 if (rtl) {
8762 // Absolute value - for FF that reports RTL scrolls in negative numbers
8763 scrollLeft = Math.abs(scrollLeft);
8764 if (isBrowserChrome() && !isRtlNegativeScroll()) {
8765 scrollLeft = element.scrollWidth - element.clientWidth - scrollLeft;
8766 }
8767 }
8768 return scrollLeft;
8769}
8770function setScrollLeft(element, value, rtl) {
8771 if (rtl) {
8772 // Chrome and Safari when doing RTL have the END position of the scroll as zero, not the start
8773 if (isRtlNegativeScroll()) {
8774 value *= -1;
8775 }
8776 else if (isBrowserSafari() || isBrowserChrome()) {
8777 value = element.scrollWidth - element.clientWidth - value;
8778 }
8779 }
8780 element.scrollLeft = value;
8781}
8782function clearElement(el) {
8783 while (el && el.firstChild) {
8784 el.removeChild(el.firstChild);
8785 }
8786}
8787/** @deprecated */
8788function removeElement(parent, cssSelector) {
8789 removeFromParent(parent.querySelector(cssSelector));
8790}
8791function removeFromParent(node) {
8792 if (node && node.parentNode) {
8793 node.parentNode.removeChild(node);
8794 }
8795}
8796function isVisible(element) {
8797 return element.offsetParent !== null;
8798}
8799/**
8800 * Loads the template and returns it as an element. makes up for no simple way in
8801 * the dom api to load html directly, eg we cannot do this: document.createElement(template)
8802 * @param {string} template
8803 * @returns {HTMLElement}
8804 */
8805function loadTemplate(template) {
8806 // we try the DOMParser first, as SalesForce doesn't like using innerHTML on a div
8807 if (DOMParser !== null) {
8808 var parser = new DOMParser();
8809 var doc = parser.parseFromString(template, "text/html");
8810 return doc.body.firstChild;
8811 }
8812 var tempDiv = document.createElement('div');
8813 tempDiv.innerHTML = (template || '').trim();
8814 return tempDiv.firstChild;
8815}
8816function appendHtml(eContainer, htmlTemplate) {
8817 if (eContainer.lastChild) {
8818 // https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
8819 // we put the items at the start, so new items appear underneath old items,
8820 // so when expanding/collapsing groups, the new rows don't go on top of the
8821 // rows below that are moving our of the way
8822 eContainer.insertAdjacentHTML('afterbegin', htmlTemplate);
8823 }
8824 else {
8825 eContainer.innerHTML = htmlTemplate;
8826 }
8827}
8828/** @deprecated */
8829function getElementAttribute(element, attributeName) {
8830 if (element.attributes && element.attributes[attributeName]) {
8831 var attribute = element.attributes[attributeName];
8832 return attribute.value;
8833 }
8834 return null;
8835}
8836function offsetHeight(element) {
8837 return element && element.clientHeight ? element.clientHeight : 0;
8838}
8839function offsetWidth(element) {
8840 return element && element.clientWidth ? element.clientWidth : 0;
8841}
8842function ensureDomOrder(eContainer, eChild, eChildBefore) {
8843 // if already in right order, do nothing
8844 if (eChildBefore && eChildBefore.nextSibling === eChild) {
8845 return;
8846 }
8847 if (eChildBefore) {
8848 if (eChildBefore.nextSibling) {
8849 // insert between the eRowBefore and the row after it
8850 eContainer.insertBefore(eChild, eChildBefore.nextSibling);
8851 }
8852 else {
8853 // if nextSibling is missing, means other row is at end, so just append new row at the end
8854 eContainer.appendChild(eChild);
8855 }
8856 }
8857 else {
8858 // otherwise put at start
8859 if (eContainer.firstChild && eContainer.firstChild !== eChild) {
8860 // insert it at the first location
8861 eContainer.insertAdjacentElement('afterbegin', eChild);
8862 }
8863 }
8864}
8865function setDomChildOrder(eContainer, orderedChildren) {
8866 for (var i = 0; i < orderedChildren.length; i++) {
8867 var correctCellAtIndex = orderedChildren[i];
8868 var actualCellAtIndex = eContainer.children[i];
8869 if (actualCellAtIndex !== correctCellAtIndex) {
8870 eContainer.insertBefore(correctCellAtIndex, actualCellAtIndex);
8871 }
8872 }
8873}
8874function insertWithDomOrder(eContainer, eToInsert, eChildBefore) {
8875 if (eChildBefore) {
8876 // if previous element exists, just slot in after the previous element
8877 eChildBefore.insertAdjacentElement('afterend', eToInsert);
8878 }
8879 else {
8880 if (eContainer.firstChild) {
8881 // insert it at the first location
8882 eContainer.insertAdjacentElement('afterbegin', eToInsert);
8883 }
8884 else {
8885 // otherwise eContainer is empty, so just append it
8886 eContainer.appendChild(eToInsert);
8887 }
8888 }
8889}
8890/** @deprecated */
8891function prependDC(parent, documentFragment) {
8892 if (exists(parent.firstChild)) {
8893 parent.insertBefore(documentFragment, parent.firstChild);
8894 }
8895 else {
8896 parent.appendChild(documentFragment);
8897 }
8898}
8899function addStylesToElement(eElement, styles) {
8900 if (!styles) {
8901 return;
8902 }
8903 Object.keys(styles).forEach(function (key) {
8904 var keyCamelCase = hyphenToCamelCase(key);
8905 if (keyCamelCase) {
8906 eElement.style[keyCamelCase] = styles[key];
8907 }
8908 });
8909}
8910function isHorizontalScrollShowing(element) {
8911 return element.clientWidth < element.scrollWidth;
8912}
8913function isVerticalScrollShowing(element) {
8914 return element.clientHeight < element.scrollHeight;
8915}
8916function setElementWidth(element, width) {
8917 if (width === 'flex') {
8918 element.style.removeProperty('width');
8919 element.style.removeProperty('minWidth');
8920 element.style.removeProperty('maxWidth');
8921 element.style.flex = '1 1 auto';
8922 }
8923 else {
8924 setFixedWidth(element, width);
8925 }
8926}
8927function setFixedWidth(element, width) {
8928 width = formatSize(width);
8929 element.style.width = width.toString();
8930 element.style.maxWidth = width.toString();
8931 element.style.minWidth = width.toString();
8932}
8933function setElementHeight(element, height) {
8934 if (height === 'flex') {
8935 element.style.removeProperty('height');
8936 element.style.removeProperty('minHeight');
8937 element.style.removeProperty('maxHeight');
8938 element.style.flex = '1 1 auto';
8939 }
8940 else {
8941 setFixedHeight(element, height);
8942 }
8943}
8944function setFixedHeight(element, height) {
8945 height = formatSize(height);
8946 element.style.height = height.toString();
8947 element.style.maxHeight = height.toString();
8948 element.style.minHeight = height.toString();
8949}
8950function formatSize(size) {
8951 if (typeof size === 'number') {
8952 return size + "px";
8953 }
8954 return size;
8955}
8956/**
8957 * Returns true if it is a DOM node
8958 * taken from: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
8959 * @param {any} o
8960 * @return {boolean}
8961 */
8962function isNode(o) {
8963 return (typeof Node === 'function'
8964 ? o instanceof Node
8965 : o && typeof o === 'object' && typeof o.nodeType === 'number' && typeof o.nodeName === 'string');
8966}
8967//
8968/**
8969 * Returns true if it is a DOM element
8970 * taken from: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
8971 * @param {any} o
8972 * @returns {boolean}
8973 */
8974function isElement(o) {
8975 return (typeof HTMLElement === 'function'
8976 ? o instanceof HTMLElement //DOM2
8977 : o && isNonNullObject(o) && o.nodeType === 1 && typeof o.nodeName === 'string');
8978}
8979function isNodeOrElement(o) {
8980 return isNode(o) || isElement(o);
8981}
8982/**
8983 * Makes a copy of a node list into a list
8984 * @param {NodeList} nodeList
8985 * @returns {Node[]}
8986 */
8987function copyNodeList(nodeList) {
8988 if (nodeList == null) {
8989 return [];
8990 }
8991 var result = [];
8992 nodeListForEach(nodeList, function (node) { return result.push(node); });
8993 return result;
8994}
8995function iterateNamedNodeMap(map, callback) {
8996 if (!map) {
8997 return;
8998 }
8999 for (var i = 0; i < map.length; i++) {
9000 var attr = map[i];
9001 callback(attr.name, attr.value);
9002 }
9003}
9004/** @deprecated */
9005function setCheckboxState(eCheckbox, state) {
9006 if (typeof state === 'boolean') {
9007 eCheckbox.checked = state;
9008 eCheckbox.indeterminate = false;
9009 }
9010 else {
9011 // isNodeSelected returns back undefined if it's a group and the children
9012 // are a mix of selected and unselected
9013 eCheckbox.indeterminate = true;
9014 }
9015}
9016function addOrRemoveAttribute(element, name, value) {
9017 if (value == null) {
9018 element.removeAttribute(name);
9019 }
9020 else {
9021 element.setAttribute(name, value.toString());
9022 }
9023}
9024function nodeListForEach(nodeList, action) {
9025 if (nodeList == null) {
9026 return;
9027 }
9028 for (var i = 0; i < nodeList.length; i++) {
9029 action(nodeList[i]);
9030 }
9031}
9032
9033var DomUtils = /*#__PURE__*/Object.freeze({
9034 radioCssClass: radioCssClass,
9035 isFocusableFormField: isFocusableFormField,
9036 setDisplayed: setDisplayed,
9037 setVisible: setVisible,
9038 setDisabled: setDisabled,
9039 isElementChildOfClass: isElementChildOfClass,
9040 getElementSize: getElementSize,
9041 getInnerHeight: getInnerHeight,
9042 getInnerWidth: getInnerWidth,
9043 getAbsoluteHeight: getAbsoluteHeight,
9044 getAbsoluteWidth: getAbsoluteWidth,
9045 isRtlNegativeScroll: isRtlNegativeScroll,
9046 getScrollLeft: getScrollLeft,
9047 setScrollLeft: setScrollLeft,
9048 clearElement: clearElement,
9049 removeElement: removeElement,
9050 removeFromParent: removeFromParent,
9051 isVisible: isVisible,
9052 loadTemplate: loadTemplate,
9053 appendHtml: appendHtml,
9054 getElementAttribute: getElementAttribute,
9055 offsetHeight: offsetHeight,
9056 offsetWidth: offsetWidth,
9057 ensureDomOrder: ensureDomOrder,
9058 setDomChildOrder: setDomChildOrder,
9059 insertWithDomOrder: insertWithDomOrder,
9060 prependDC: prependDC,
9061 addStylesToElement: addStylesToElement,
9062 isHorizontalScrollShowing: isHorizontalScrollShowing,
9063 isVerticalScrollShowing: isVerticalScrollShowing,
9064 setElementWidth: setElementWidth,
9065 setFixedWidth: setFixedWidth,
9066 setElementHeight: setElementHeight,
9067 setFixedHeight: setFixedHeight,
9068 formatSize: formatSize,
9069 isNode: isNode,
9070 isElement: isElement,
9071 isNodeOrElement: isNodeOrElement,
9072 copyNodeList: copyNodeList,
9073 iterateNamedNodeMap: iterateNamedNodeMap,
9074 setCheckboxState: setCheckboxState,
9075 addOrRemoveAttribute: addOrRemoveAttribute,
9076 nodeListForEach: nodeListForEach
9077});
9078
9079/**
9080 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
9081 * @version v27.3.0
9082 * @link https://www.ag-grid.com/
9083 * @license MIT
9084 */
9085/** @deprecated */
9086function getNameOfClass(theClass) {
9087 var funcNameRegex = /function (.{1,})\(/;
9088 var funcAsString = theClass.toString();
9089 var results = funcNameRegex.exec(funcAsString);
9090 return results && results.length > 1 ? results[1] : "";
9091}
9092function findLineByLeastSquares(values) {
9093 var len = values.length;
9094 var maxDecimals = 0;
9095 if (len <= 1) {
9096 return values;
9097 }
9098 for (var i = 0; i < values.length; i++) {
9099 var value = values[i];
9100 var splitExponent = value.toString().split('e-');
9101 if (splitExponent.length > 1) {
9102 maxDecimals = Math.max(maxDecimals, parseInt(splitExponent[1], 10));
9103 continue;
9104 }
9105 if (Math.floor(value) === value) {
9106 continue;
9107 }
9108 maxDecimals = Math.max(maxDecimals, value.toString().split('.')[1].length);
9109 }
9110 var sum_x = 0;
9111 var sum_y = 0;
9112 var sum_xy = 0;
9113 var sum_xx = 0;
9114 var y = 0;
9115 for (var x = 0; x < len; x++) {
9116 y = values[x];
9117 sum_x += x;
9118 sum_y += y;
9119 sum_xx += x * x;
9120 sum_xy += x * y;
9121 }
9122 var m = (len * sum_xy - sum_x * sum_y) / (len * sum_xx - sum_x * sum_x);
9123 var b = (sum_y / len) - (m * sum_x) / len;
9124 var result = [];
9125 for (var x = 0; x <= len; x++) {
9126 result.push(parseFloat((x * m + b).toFixed(maxDecimals)));
9127 }
9128 return result;
9129}
9130/**
9131 * Converts a CSS object into string
9132 * @param {Object} stylesToUse an object eg: {color: 'black', top: '25px'}
9133 * @return {string} A string like "color: black; top: 25px;" for html
9134 */
9135function cssStyleObjectToMarkup(stylesToUse) {
9136 if (!stylesToUse) {
9137 return '';
9138 }
9139 var resParts = [];
9140 iterateObject(stylesToUse, function (styleKey, styleValue) {
9141 var styleKeyDashed = camelCaseToHyphen(styleKey);
9142 resParts.push(styleKeyDashed + ": " + styleValue + ";");
9143 });
9144 return resParts.join(' ');
9145}
9146/**
9147 * Displays a message to the browser. this is useful in iPad, where you can't easily see the console.
9148 * so the javascript code can use this to give feedback. this is NOT intended to be called in production.
9149 * it is intended the AG Grid developer calls this to troubleshoot, but then takes out the calls before
9150 * checking in.
9151 * @param {string} msg
9152 */
9153function message(msg) {
9154 var eMessage = document.createElement('div');
9155 var eBox = document.querySelector('#__ag__message');
9156 eMessage.innerHTML = msg;
9157 if (!eBox) {
9158 var template = "<div id=\"__ag__message\" style=\"display: inline-block; position: absolute; top: 0px; left: 0px; color: white; background-color: black; z-index: 20; padding: 2px; border: 1px solid darkred; height: 200px; overflow-y: auto;\"></div>";
9159 eBox = loadTemplate(template);
9160 if (document.body) {
9161 document.body.appendChild(eBox);
9162 }
9163 }
9164 eBox.insertBefore(eMessage, eBox.children[0]);
9165}
9166/**
9167 * cell renderers are used in a few places. they bind to dom slightly differently to other cell renderes as they
9168 * can return back strings (instead of html elemnt) in the getGui() method. common code placed here to handle that.
9169 * @param {AgPromise<ICellRendererComp>} cellRendererPromise
9170 * @param {HTMLElement} eTarget
9171 */
9172function bindCellRendererToHtmlElement(cellRendererPromise, eTarget) {
9173 cellRendererPromise.then(function (cellRenderer) {
9174 var gui = cellRenderer.getGui();
9175 if (gui != null) {
9176 if (typeof gui === 'object') {
9177 eTarget.appendChild(gui);
9178 }
9179 else {
9180 eTarget.innerHTML = gui;
9181 }
9182 }
9183 });
9184}
9185
9186var GeneralUtils = /*#__PURE__*/Object.freeze({
9187 getNameOfClass: getNameOfClass,
9188 findLineByLeastSquares: findLineByLeastSquares,
9189 cssStyleObjectToMarkup: cssStyleObjectToMarkup,
9190 message: message,
9191 bindCellRendererToHtmlElement: bindCellRendererToHtmlElement
9192});
9193
9194/**
9195 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
9196 * @version v27.3.0
9197 * @link https://www.ag-grid.com/
9198 * @license MIT
9199 */
9200// ARIA HELPER FUNCTIONS
9201function setAriaAttribute(element, attribute, value) {
9202 element.setAttribute(ariaAttributeName(attribute), value.toString());
9203}
9204function removeAriaAttribute(element, attribute) {
9205 element.removeAttribute(ariaAttributeName(attribute));
9206}
9207function ariaAttributeName(attribute) {
9208 return "aria-" + attribute;
9209}
9210function setAriaRole(element, role) {
9211 if (role) {
9212 element.setAttribute('role', role);
9213 }
9214 else {
9215 element.removeAttribute('role');
9216 }
9217}
9218function getAriaSortState(column) {
9219 var sort;
9220 if (column.isSortAscending()) {
9221 sort = 'ascending';
9222 }
9223 else if (column.isSortDescending()) {
9224 sort = 'descending';
9225 }
9226 else {
9227 sort = 'none';
9228 }
9229 return sort;
9230}
9231// ARIA ATTRIBUTE GETTERS
9232function getAriaLevel(element) {
9233 return parseInt(element.getAttribute('aria-level'), 10);
9234}
9235function getAriaPosInSet(element) {
9236 return parseInt(element.getAttribute('aria-posinset'), 10);
9237}
9238function getAriaDescribedBy(element) {
9239 return element.getAttribute('aria-describedby') || '';
9240}
9241// ARIA ATTRIBUTE SETTERS
9242function setAriaLabel(element, label) {
9243 var key = 'label';
9244 if (label) {
9245 setAriaAttribute(element, key, label);
9246 }
9247 else {
9248 removeAriaAttribute(element, key);
9249 }
9250}
9251function setAriaLabelledBy(element, labelledBy) {
9252 var key = 'labelledby';
9253 if (labelledBy) {
9254 setAriaAttribute(element, key, labelledBy);
9255 }
9256 else {
9257 removeAriaAttribute(element, key);
9258 }
9259}
9260function setAriaDescription(element, description) {
9261 var key = 'description';
9262 if (description) {
9263 setAriaAttribute(element, key, description);
9264 }
9265 else {
9266 removeAriaAttribute(element, key);
9267 }
9268}
9269function setAriaDescribedBy(element, describedby) {
9270 var key = 'describedby';
9271 if (describedby) {
9272 setAriaAttribute(element, key, describedby);
9273 }
9274 else {
9275 removeAriaAttribute(element, key);
9276 }
9277}
9278function setAriaLevel(element, level) {
9279 setAriaAttribute(element, 'level', level);
9280}
9281function setAriaDisabled(element, disabled) {
9282 setAriaAttribute(element, 'disabled', disabled);
9283}
9284function setAriaExpanded(element, expanded) {
9285 setAriaAttribute(element, 'expanded', expanded);
9286}
9287function removeAriaExpanded(element) {
9288 removeAriaAttribute(element, 'expanded');
9289}
9290function setAriaSetSize(element, setsize) {
9291 setAriaAttribute(element, 'setsize', setsize);
9292}
9293function setAriaPosInSet(element, position) {
9294 setAriaAttribute(element, 'posinset', position);
9295}
9296function setAriaMultiSelectable(element, multiSelectable) {
9297 setAriaAttribute(element, 'multiselectable', multiSelectable);
9298}
9299function setAriaRowCount(element, rowCount) {
9300 setAriaAttribute(element, 'rowcount', rowCount);
9301}
9302function setAriaRowIndex(element, rowIndex) {
9303 setAriaAttribute(element, 'rowindex', rowIndex);
9304}
9305function setAriaColCount(element, colCount) {
9306 setAriaAttribute(element, 'colcount', colCount);
9307}
9308function setAriaColIndex(element, colIndex) {
9309 setAriaAttribute(element, 'colindex', colIndex);
9310}
9311function setAriaColSpan(element, colSpan) {
9312 setAriaAttribute(element, 'colspan', colSpan);
9313}
9314function setAriaSort(element, sort) {
9315 setAriaAttribute(element, 'sort', sort);
9316}
9317function removeAriaSort(element) {
9318 removeAriaAttribute(element, 'sort');
9319}
9320function setAriaSelected(element, selected) {
9321 var attributeName = 'selected';
9322 if (selected) {
9323 setAriaAttribute(element, attributeName, selected);
9324 }
9325 else {
9326 removeAriaAttribute(element, attributeName);
9327 }
9328}
9329function setAriaChecked(element, checked) {
9330 setAriaAttribute(element, 'checked', checked === undefined ? 'mixed' : checked);
9331}
9332
9333var AriaUtils = /*#__PURE__*/Object.freeze({
9334 setAriaRole: setAriaRole,
9335 getAriaSortState: getAriaSortState,
9336 getAriaLevel: getAriaLevel,
9337 getAriaPosInSet: getAriaPosInSet,
9338 getAriaDescribedBy: getAriaDescribedBy,
9339 setAriaLabel: setAriaLabel,
9340 setAriaLabelledBy: setAriaLabelledBy,
9341 setAriaDescription: setAriaDescription,
9342 setAriaDescribedBy: setAriaDescribedBy,
9343 setAriaLevel: setAriaLevel,
9344 setAriaDisabled: setAriaDisabled,
9345 setAriaExpanded: setAriaExpanded,
9346 removeAriaExpanded: removeAriaExpanded,
9347 setAriaSetSize: setAriaSetSize,
9348 setAriaPosInSet: setAriaPosInSet,
9349 setAriaMultiSelectable: setAriaMultiSelectable,
9350 setAriaRowCount: setAriaRowCount,
9351 setAriaRowIndex: setAriaRowIndex,
9352 setAriaColCount: setAriaColCount,
9353 setAriaColIndex: setAriaColIndex,
9354 setAriaColSpan: setAriaColSpan,
9355 setAriaSort: setAriaSort,
9356 removeAriaSort: removeAriaSort,
9357 setAriaSelected: setAriaSelected,
9358 setAriaChecked: setAriaChecked
9359});
9360
9361/**
9362 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
9363 * @version v27.3.0
9364 * @link https://www.ag-grid.com/
9365 * @license MIT
9366 */
9367function padStartWidthZeros(value, totalStringSize) {
9368 return value.toString().padStart(totalStringSize, '0');
9369}
9370function createArrayOfNumbers(first, last) {
9371 var result = [];
9372 for (var i = first; i <= last; i++) {
9373 result.push(i);
9374 }
9375 return result;
9376}
9377/**
9378 * Check if a value is numeric
9379 * from http://stackoverflow.com/questions/9716468/is-there-any-function-like-isnumeric-in-javascript-to-validate-numbers
9380 * @param {any} value
9381 * @return {boolean}
9382 */
9383function isNumeric(value) {
9384 return value !== '' && !isNaN(parseFloat(value)) && isFinite(value);
9385}
9386function cleanNumber(value) {
9387 if (typeof value === 'string') {
9388 value = parseInt(value, 10);
9389 }
9390 if (typeof value === 'number') {
9391 return Math.floor(value);
9392 }
9393 return null;
9394}
9395function decToHex(number, bytes) {
9396 var hex = '';
9397 for (var i = 0; i < bytes; i++) {
9398 hex += String.fromCharCode(number & 0xff);
9399 number >>>= 8;
9400 }
9401 return hex;
9402}
9403function formatNumberTwoDecimalPlacesAndCommas(value, thousandSeparator, decimalSeparator) {
9404 if (typeof value !== 'number') {
9405 return '';
9406 }
9407 return formatNumberCommas(Math.round(value * 100) / 100, thousandSeparator, decimalSeparator);
9408}
9409/**
9410 * the native method number.toLocaleString(undefined, {minimumFractionDigits: 0})
9411 * puts in decimal places in IE, so we use this method instead
9412 * from: http://blog.tompawlak.org/number-currency-formatting-javascript
9413 * @param {number} value
9414 * @returns {string}
9415 */
9416function formatNumberCommas(value, thousandSeparator, decimalSeparator) {
9417 if (typeof value !== 'number') {
9418 return '';
9419 }
9420 return value.toString().replace('.', decimalSeparator).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1" + thousandSeparator);
9421}
9422function sum(values) {
9423 return values == null ? null : values.reduce(function (total, value) { return total + value; }, 0);
9424}
9425
9426var NumberUtils = /*#__PURE__*/Object.freeze({
9427 padStartWidthZeros: padStartWidthZeros,
9428 createArrayOfNumbers: createArrayOfNumbers,
9429 isNumeric: isNumeric,
9430 cleanNumber: cleanNumber,
9431 decToHex: decToHex,
9432 formatNumberTwoDecimalPlacesAndCommas: formatNumberTwoDecimalPlacesAndCommas,
9433 formatNumberCommas: formatNumberCommas,
9434 sum: sum
9435});
9436
9437/**
9438 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
9439 * @version v27.3.0
9440 * @link https://www.ag-grid.com/
9441 * @license MIT
9442 */
9443var __read$5 = (undefined && undefined.__read) || function (o, n) {
9444 var m = typeof Symbol === "function" && o[Symbol.iterator];
9445 if (!m) return o;
9446 var i = m.call(o), r, ar = [], e;
9447 try {
9448 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
9449 }
9450 catch (error) { e = { error: error }; }
9451 finally {
9452 try {
9453 if (r && !r.done && (m = i["return"])) m.call(i);
9454 }
9455 finally { if (e) throw e.error; }
9456 }
9457 return ar;
9458};
9459/**
9460 * Serialises a Date to a string of format `yyyy-MM-dd HH:mm:ss`.
9461 * An alternative separator can be provided to be used instead of hyphens.
9462 * @param date The date to serialise
9463 * @param includeTime Whether to include the time in the serialised string
9464 * @param separator The separator to use between date parts
9465 */
9466function serialiseDate(date, includeTime, separator) {
9467 if (includeTime === void 0) { includeTime = true; }
9468 if (separator === void 0) { separator = '-'; }
9469 if (!date) {
9470 return null;
9471 }
9472 var serialised = [date.getFullYear(), date.getMonth() + 1, date.getDate()].map(function (part) { return padStartWidthZeros(part, 2); }).join(separator);
9473 if (includeTime) {
9474 serialised += ' ' + [date.getHours(), date.getMinutes(), date.getSeconds()].map(function (part) { return padStartWidthZeros(part, 2); }).join(':');
9475 }
9476 return serialised;
9477}
9478/**
9479 * Parses a date and time from a string in the format `yyyy-MM-dd HH:mm:ss`
9480 */
9481function parseDateTimeFromString(value) {
9482 if (!value) {
9483 return null;
9484 }
9485 var _a = __read$5(value.split(' '), 2), dateStr = _a[0], timeStr = _a[1];
9486 if (!dateStr) {
9487 return null;
9488 }
9489 var fields = dateStr.split('-').map(function (f) { return parseInt(f, 10); });
9490 if (fields.filter(function (f) { return !isNaN(f); }).length !== 3) {
9491 return null;
9492 }
9493 var _b = __read$5(fields, 3), year = _b[0], month = _b[1], day = _b[2];
9494 var date = new Date(year, month - 1, day);
9495 if (date.getFullYear() !== year ||
9496 date.getMonth() !== month - 1 ||
9497 date.getDate() !== day) {
9498 // date was not parsed as expected so must have been invalid
9499 return null;
9500 }
9501 if (!timeStr || timeStr === '00:00:00') {
9502 return date;
9503 }
9504 var _c = __read$5(timeStr.split(':').map(function (part) { return parseInt(part, 10); }), 3), hours = _c[0], minutes = _c[1], seconds = _c[2];
9505 if (hours >= 0 && hours < 24) {
9506 date.setHours(hours);
9507 }
9508 if (minutes >= 0 && minutes < 60) {
9509 date.setMinutes(minutes);
9510 }
9511 if (seconds >= 0 && seconds < 60) {
9512 date.setSeconds(seconds);
9513 }
9514 return date;
9515}
9516
9517var DateUtils = /*#__PURE__*/Object.freeze({
9518 serialiseDate: serialiseDate,
9519 parseDateTimeFromString: parseDateTimeFromString
9520});
9521
9522/**
9523 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
9524 * @version v27.3.0
9525 * @link https://www.ag-grid.com/
9526 * @license MIT
9527 */
9528function fuzzyCheckStrings(inputValues, validValues, allSuggestions) {
9529 var fuzzyMatches = {};
9530 var invalidInputs = inputValues.filter(function (inputValue) {
9531 return !validValues.some(function (validValue) { return validValue === inputValue; });
9532 });
9533 if (invalidInputs.length > 0) {
9534 invalidInputs.forEach(function (invalidInput) {
9535 return fuzzyMatches[invalidInput] = fuzzySuggestions(invalidInput, allSuggestions);
9536 });
9537 }
9538 return fuzzyMatches;
9539}
9540/**
9541 *
9542 * @param {String} inputValue The value to be compared against a list of strings
9543 * @param allSuggestions The list of strings to be compared against
9544 * @param hideIrrelevant By default, fuzzy suggestions will just sort the allSuggestions list, set this to true
9545 * to filter out the irrelevant values
9546 * @param weighted Set this to true, to make letters matched in the order they were typed have priority in the results.
9547 */
9548function fuzzySuggestions(inputValue, allSuggestions, hideIrrelevant, weighted) {
9549 var search = weighted ? string_weighted_distances : string_distances;
9550 var thisSuggestions = allSuggestions.map(function (text) { return ({
9551 value: text,
9552 relevance: search(inputValue.toLowerCase(), text.toLocaleLowerCase())
9553 }); });
9554 thisSuggestions.sort(function (a, b) { return b.relevance - a.relevance; });
9555 if (hideIrrelevant) {
9556 thisSuggestions = thisSuggestions.filter(function (suggestion) { return suggestion.relevance !== 0; });
9557 }
9558 return thisSuggestions.map(function (suggestion) { return suggestion.value; });
9559}
9560/**
9561 * Algorithm to do fuzzy search
9562 * from https://stackoverflow.com/questions/23305000/javascript-fuzzy-search-that-makes-sense
9563 * @param {string} from
9564 * @return {[]}
9565 */
9566function get_bigrams(from) {
9567 var s = from.toLowerCase();
9568 var v = new Array(s.length - 1);
9569 var i;
9570 var j;
9571 var ref;
9572 for (i = j = 0, ref = v.length; j <= ref; i = j += 1) {
9573 v[i] = s.slice(i, i + 2);
9574 }
9575 return v;
9576}
9577function string_distances(str1, str2) {
9578 if (str1.length === 0 && str2.length === 0) {
9579 return 0;
9580 }
9581 var pairs1 = get_bigrams(str1);
9582 var pairs2 = get_bigrams(str2);
9583 var union = pairs1.length + pairs2.length;
9584 var hit_count = 0;
9585 var j;
9586 var len;
9587 for (j = 0, len = pairs1.length; j < len; j++) {
9588 var x = pairs1[j];
9589 var k = void 0;
9590 var len1 = void 0;
9591 for (k = 0, len1 = pairs2.length; k < len1; k++) {
9592 var y = pairs2[k];
9593 if (x === y) {
9594 hit_count++;
9595 }
9596 }
9597 }
9598 return hit_count > 0 ? (2 * hit_count) / union : 0;
9599}
9600function string_weighted_distances(str1, str2) {
9601 var a = str1.replace(/\s/g, '');
9602 var b = str2.replace(/\s/g, '');
9603 var weight = 0;
9604 var lastIndex = 0;
9605 for (var i = 0; i < a.length; i++) {
9606 var idx = b.indexOf(a[i], lastIndex);
9607 if (idx === -1) {
9608 continue;
9609 }
9610 lastIndex = idx;
9611 weight += (100 - (lastIndex * 100 / 10000) * 100);
9612 }
9613 return weight;
9614}
9615
9616var FuzzyMatchUtils = /*#__PURE__*/Object.freeze({
9617 fuzzyCheckStrings: fuzzyCheckStrings,
9618 fuzzySuggestions: fuzzySuggestions,
9619 get_bigrams: get_bigrams,
9620 string_distances: string_distances,
9621 string_weighted_distances: string_weighted_distances
9622});
9623
9624/**
9625 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
9626 * @version v27.3.0
9627 * @link https://www.ag-grid.com/
9628 * @license MIT
9629 */
9630//
9631// IMPORTANT NOTE!
9632//
9633// If you change the list below, copy/paste the new content into the docs page javascript-grid-icons
9634//
9635var iconNameClassMap = {
9636 // header column group shown when expanded (click to contract)
9637 columnGroupOpened: 'expanded',
9638 // header column group shown when contracted (click to expand)
9639 columnGroupClosed: 'contracted',
9640 // tool panel column group contracted (click to expand)
9641 columnSelectClosed: 'tree-closed',
9642 // tool panel column group expanded (click to contract)
9643 columnSelectOpen: 'tree-open',
9644 // column tool panel header expand/collapse all button, shown when some children are expanded and
9645 // others are collapsed
9646 columnSelectIndeterminate: 'tree-indeterminate',
9647 // shown on ghost icon while dragging column to the side of the grid to pin
9648 columnMovePin: 'pin',
9649 // shown on ghost icon while dragging over part of the page that is not a drop zone
9650 columnMoveHide: 'eye-slash',
9651 // shown on ghost icon while dragging columns to reorder
9652 columnMoveMove: 'arrows',
9653 // animating icon shown when dragging a column to the right of the grid causes horizontal scrolling
9654 columnMoveLeft: 'left',
9655 // animating icon shown when dragging a column to the left of the grid causes horizontal scrolling
9656 columnMoveRight: 'right',
9657 // shown on ghost icon while dragging over Row Groups drop zone
9658 columnMoveGroup: 'group',
9659 // shown on ghost icon while dragging over Values drop zone
9660 columnMoveValue: 'aggregation',
9661 // shown on ghost icon while dragging over pivot drop zone
9662 columnMovePivot: 'pivot',
9663 // shown on ghost icon while dragging over drop zone that doesn't support it, e.g.
9664 // string column over aggregation drop zone
9665 dropNotAllowed: 'not-allowed',
9666 // shown on row group when contracted (click to expand)
9667 groupContracted: 'tree-closed',
9668 // shown on row group when expanded (click to contract)
9669 groupExpanded: 'tree-open',
9670 // context menu chart item
9671 chart: 'chart',
9672 // chart window title bar
9673 close: 'cross',
9674 // X (remove) on column 'pill' after adding it to a drop zone list
9675 cancel: 'cancel',
9676 // indicates the currently active pin state in the "Pin column" sub-menu of the column menu
9677 check: 'tick',
9678 // "go to first" button in pagination controls
9679 first: 'first',
9680 // "go to previous" button in pagination controls
9681 previous: 'previous',
9682 // "go to next" button in pagination controls
9683 next: 'next',
9684 // "go to last" button in pagination controls
9685 last: 'last',
9686 // shown on top right of chart when chart is linked to range data (click to unlink)
9687 linked: 'linked',
9688 // shown on top right of chart when chart is not linked to range data (click to link)
9689 unlinked: 'unlinked',
9690 // "Choose colour" button on chart settings tab
9691 colorPicker: 'color-picker',
9692 // rotating spinner shown by the loading cell renderer
9693 groupLoading: 'loading',
9694 // button to launch enterprise column menu
9695 menu: 'menu',
9696 // filter tool panel tab
9697 filter: 'filter',
9698 // column tool panel tab
9699 columns: 'columns',
9700 // button in chart regular size window title bar (click to maximise)
9701 maximize: 'maximize',
9702 // button in chart maximised window title bar (click to make regular size)
9703 minimize: 'minimize',
9704 // "Pin column" item in column header menu
9705 menuPin: 'pin',
9706 // "Value aggregation" column menu item (shown on numeric columns when grouping is active)"
9707 menuValue: 'aggregation',
9708 // "Group by {column-name}" item in column header menu
9709 menuAddRowGroup: 'group',
9710 // "Un-Group by {column-name}" item in column header menu
9711 menuRemoveRowGroup: 'group',
9712 // context menu copy item
9713 clipboardCopy: 'copy',
9714 // context menu paste item
9715 clipboardPaste: 'paste',
9716 // identifies the pivot drop zone
9717 pivotPanel: 'pivot',
9718 // "Row groups" drop zone in column tool panel
9719 rowGroupPanel: 'group',
9720 // columns tool panel Values drop zone
9721 valuePanel: 'aggregation',
9722 // drag handle used to pick up draggable columns
9723 columnDrag: 'grip',
9724 // drag handle used to pick up draggable rows
9725 rowDrag: 'grip',
9726 // context menu export item
9727 save: 'save',
9728 // csv export
9729 csvExport: 'csv',
9730 // excel export,
9731 excelExport: 'excel',
9732 // icon on dropdown editors
9733 smallDown: 'small-down',
9734 // version of small-right used in RTL mode
9735 smallLeft: 'small-left',
9736 // separater between column 'pills' when you add multiple columns to the header drop zone
9737 smallRight: 'small-right',
9738 smallUp: 'small-up',
9739 // show on column header when column is sorted ascending
9740 sortAscending: 'asc',
9741 // show on column header when column is sorted descending
9742 sortDescending: 'desc',
9743 // show on column header when column has no sort, only when enabled with gridOptions.unSortIcon=true
9744 sortUnSort: 'none'
9745};
9746/**
9747 * If icon provided, use this (either a string, or a function callback).
9748 * if not, then use the default icon from the theme
9749 * @param {string} iconName
9750 * @param {GridOptionsWrapper} gridOptionsWrapper
9751 * @param {Column | null} [column]
9752 * @returns {HTMLElement}
9753 */
9754function createIcon(iconName, gridOptionsWrapper, column) {
9755 var iconContents = createIconNoSpan(iconName, gridOptionsWrapper, column);
9756 if (iconContents && iconContents.className.indexOf('ag-icon') > -1) {
9757 return iconContents;
9758 }
9759 var eResult = document.createElement('span');
9760 eResult.appendChild(iconContents);
9761 return eResult;
9762}
9763function createIconNoSpan(iconName, gridOptionsWrapper, column, forceCreate) {
9764 var userProvidedIcon = null;
9765 // check col for icon first
9766 var icons = column && column.getColDef().icons;
9767 if (icons) {
9768 userProvidedIcon = icons[iconName];
9769 }
9770 // if not in col, try grid options
9771 if (gridOptionsWrapper && !userProvidedIcon) {
9772 var optionsIcons = gridOptionsWrapper.getIcons();
9773 if (optionsIcons) {
9774 userProvidedIcon = optionsIcons[iconName];
9775 }
9776 }
9777 // now if user provided, use it
9778 if (userProvidedIcon) {
9779 var rendererResult = void 0;
9780 if (typeof userProvidedIcon === 'function') {
9781 rendererResult = userProvidedIcon();
9782 }
9783 else if (typeof userProvidedIcon === 'string') {
9784 rendererResult = userProvidedIcon;
9785 }
9786 else {
9787 throw new Error('icon from grid options needs to be a string or a function');
9788 }
9789 if (typeof rendererResult === 'string') {
9790 return loadTemplate(rendererResult);
9791 }
9792 if (isNodeOrElement(rendererResult)) {
9793 return rendererResult;
9794 }
9795 console.warn('AG Grid: iconRenderer should return back a string or a dom object');
9796 }
9797 else {
9798 var span = document.createElement('span');
9799 var cssClass = iconNameClassMap[iconName];
9800 if (!cssClass) {
9801 if (!forceCreate) {
9802 console.warn("AG Grid: Did not find icon " + iconName);
9803 cssClass = '';
9804 }
9805 else {
9806 cssClass = iconName;
9807 }
9808 }
9809 span.setAttribute('class', "ag-icon ag-icon-" + cssClass);
9810 span.setAttribute('unselectable', 'on');
9811 setAriaRole(span, 'presentation');
9812 return span;
9813 }
9814}
9815
9816var IconUtils = /*#__PURE__*/Object.freeze({
9817 iconNameClassMap: iconNameClassMap,
9818 createIcon: createIcon,
9819 createIconNoSpan: createIconNoSpan
9820});
9821
9822/**
9823 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
9824 * @version v27.3.0
9825 * @link https://www.ag-grid.com/
9826 * @license MIT
9827 */
9828var NUMPAD_DEL_NUMLOCK_ON_KEY = 'Del';
9829var NUMPAD_DEL_NUMLOCK_ON_CHARCODE = 46;
9830function isEventFromPrintableCharacter(event) {
9831 // no allowed printable chars have alt or ctrl key combinations
9832 if (event.altKey || event.ctrlKey || event.metaKey) {
9833 return false;
9834 }
9835 // if key is length 1, eg if it is 'a' for the a key, or '2' for the '2' key.
9836 // non-printable characters have names, eg 'Enter' or 'Backspace'.
9837 var printableCharacter = event.key.length === 1;
9838 // IE11 & Edge treat the numpad del key differently - with numlock on we get "Del" for key,
9839 // so this addition checks if its IE11/Edge and handles that specific case the same was as all other browsers
9840 var numpadDelWithNumlockOnForEdgeOrIe = isNumpadDelWithNumLockOnForEdge(event);
9841 return printableCharacter || numpadDelWithNumlockOnForEdgeOrIe;
9842}
9843/**
9844 * Allows user to tell the grid to skip specific keyboard events
9845 * @param {GridOptionsWrapper} gridOptionsWrapper
9846 * @param {KeyboardEvent} keyboardEvent
9847 * @param {RowNode} rowNode
9848 * @param {Column} column
9849 * @param {boolean} editing
9850 * @returns {boolean}
9851 */
9852function isUserSuppressingKeyboardEvent(gridOptionsWrapper, keyboardEvent, rowNode, column, editing) {
9853 var gridOptionsFunc = gridOptionsWrapper.getSuppressKeyboardEventFunc();
9854 var colDefFunc = column ? column.getColDef().suppressKeyboardEvent : undefined;
9855 // if no callbacks provided by user, then do nothing
9856 if (!gridOptionsFunc && !colDefFunc) {
9857 return false;
9858 }
9859 var params = {
9860 event: keyboardEvent,
9861 editing: editing,
9862 column: column,
9863 api: gridOptionsWrapper.getApi(),
9864 node: rowNode,
9865 data: rowNode.data,
9866 colDef: column.getColDef(),
9867 context: gridOptionsWrapper.getContext(),
9868 columnApi: gridOptionsWrapper.getColumnApi()
9869 };
9870 // colDef get first preference on suppressing events
9871 if (colDefFunc) {
9872 var colDefFuncResult = colDefFunc(params);
9873 // if colDef func suppressed, then return now, no need to call gridOption func
9874 if (colDefFuncResult) {
9875 return true;
9876 }
9877 }
9878 if (gridOptionsFunc) {
9879 // if gridOption func, return the result
9880 return gridOptionsFunc(params);
9881 }
9882 // otherwise return false, don't suppress, as colDef didn't suppress and no func on gridOptions
9883 return false;
9884}
9885function isUserSuppressingHeaderKeyboardEvent(gridOptionsWrapper, keyboardEvent, headerRowIndex, column) {
9886 var colDef = column.getDefinition();
9887 var colDefFunc = colDef && colDef.suppressHeaderKeyboardEvent;
9888 if (!exists(colDefFunc)) {
9889 return false;
9890 }
9891 var params = {
9892 api: gridOptionsWrapper.getApi(),
9893 columnApi: gridOptionsWrapper.getColumnApi(),
9894 context: gridOptionsWrapper.getContext(),
9895 colDef: colDef,
9896 column: column,
9897 headerRowIndex: headerRowIndex,
9898 event: keyboardEvent
9899 };
9900 return !!colDefFunc(params);
9901}
9902function isNumpadDelWithNumLockOnForEdge(event) {
9903 return (isBrowserEdge()) &&
9904 event.key === NUMPAD_DEL_NUMLOCK_ON_KEY &&
9905 event.charCode === NUMPAD_DEL_NUMLOCK_ON_CHARCODE;
9906}
9907
9908var KeyboardUtils = /*#__PURE__*/Object.freeze({
9909 isEventFromPrintableCharacter: isEventFromPrintableCharacter,
9910 isUserSuppressingKeyboardEvent: isUserSuppressingKeyboardEvent,
9911 isUserSuppressingHeaderKeyboardEvent: isUserSuppressingHeaderKeyboardEvent
9912});
9913
9914/**
9915 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
9916 * @version v27.3.0
9917 * @link https://www.ag-grid.com/
9918 * @license MIT
9919 */
9920/**
9921 * `True` if the event is close to the original event by X pixels either vertically or horizontally.
9922 * we only start dragging after X pixels so this allows us to know if we should start dragging yet.
9923 * @param {MouseEvent | TouchEvent} e1
9924 * @param {MouseEvent | TouchEvent} e2
9925 * @param {number} pixelCount
9926 * @returns {boolean}
9927 */
9928function areEventsNear(e1, e2, pixelCount) {
9929 // by default, we wait 4 pixels before starting the drag
9930 if (pixelCount === 0) {
9931 return false;
9932 }
9933 var diffX = Math.abs(e1.clientX - e2.clientX);
9934 var diffY = Math.abs(e1.clientY - e2.clientY);
9935 return Math.max(diffX, diffY) <= pixelCount;
9936}
9937
9938var MouseUtils = /*#__PURE__*/Object.freeze({
9939 areEventsNear: areEventsNear
9940});
9941
9942/**
9943 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
9944 * @version v27.3.0
9945 * @link https://www.ag-grid.com/
9946 * @license MIT
9947 */
9948/**
9949 * Gets called by: a) ClientSideNodeManager and b) GroupStage to do sorting.
9950 * when in ClientSideNodeManager we always have indexes (as this sorts the items the
9951 * user provided) but when in GroupStage, the nodes can contain filler nodes that
9952 * don't have order id's
9953 * @param {RowNode[]} rowNodes
9954 * @param {Object} rowNodeOrder
9955 */
9956function sortRowNodesByOrder(rowNodes, rowNodeOrder) {
9957 if (!rowNodes) {
9958 return;
9959 }
9960 var comparator = function (nodeA, nodeB) {
9961 var positionA = rowNodeOrder[nodeA.id];
9962 var positionB = rowNodeOrder[nodeB.id];
9963 var aHasIndex = positionA !== undefined;
9964 var bHasIndex = positionB !== undefined;
9965 var bothNodesAreUserNodes = aHasIndex && bHasIndex;
9966 var bothNodesAreFillerNodes = !aHasIndex && !bHasIndex;
9967 if (bothNodesAreUserNodes) {
9968 // when comparing two nodes the user has provided, they always
9969 // have indexes
9970 return positionA - positionB;
9971 }
9972 if (bothNodesAreFillerNodes) {
9973 // when comparing two filler nodes, we have no index to compare them
9974 // against, however we want this sorting to be deterministic, so that
9975 // the rows don't jump around as the user does delta updates. so we
9976 // want the same sort result. so we use the __objectId - which doesn't make sense
9977 // from a sorting point of view, but does give consistent behaviour between
9978 // calls. otherwise groups jump around as delta updates are done.
9979 // note: previously here we used nodeId, however this gave a strange order
9980 // as string ordering of numbers is wrong, so using id based on creation order
9981 // as least gives better looking order.
9982 return nodeA.__objectId - nodeB.__objectId;
9983 }
9984 if (aHasIndex) {
9985 return 1;
9986 }
9987 return -1;
9988 };
9989 // check if the list first needs sorting
9990 var rowNodeA;
9991 var rowNodeB;
9992 var atLeastOneOutOfOrder = false;
9993 for (var i = 0; i < rowNodes.length - 1; i++) {
9994 rowNodeA = rowNodes[i];
9995 rowNodeB = rowNodes[i + 1];
9996 if (comparator(rowNodeA, rowNodeB) > 0) {
9997 atLeastOneOutOfOrder = true;
9998 break;
9999 }
10000 }
10001 if (atLeastOneOutOfOrder) {
10002 rowNodes.sort(comparator);
10003 }
10004}
10005function traverseNodesWithKey(nodes, callback) {
10006 var keyParts = [];
10007 recursiveSearchNodes(nodes);
10008 function recursiveSearchNodes(currentNodes) {
10009 if (!currentNodes) {
10010 return;
10011 }
10012 currentNodes.forEach(function (node) {
10013 // also checking for children for tree data
10014 if (node.group || node.hasChildren()) {
10015 keyParts.push(node.key);
10016 var key = keyParts.join('|');
10017 callback(node, key);
10018 recursiveSearchNodes(node.childrenAfterGroup);
10019 keyParts.pop();
10020 }
10021 });
10022 }
10023}
10024
10025var RowNodeUtils = /*#__PURE__*/Object.freeze({
10026 sortRowNodesByOrder: sortRowNodesByOrder,
10027 traverseNodesWithKey: traverseNodesWithKey
10028});
10029
10030/**
10031 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10032 * @version v27.3.0
10033 * @link https://www.ag-grid.com/
10034 * @license MIT
10035 */
10036function convertToSet(list) {
10037 var set = new Set();
10038 list.forEach(function (x) { return set.add(x); });
10039 return set;
10040}
10041
10042var SetUtils = /*#__PURE__*/Object.freeze({
10043 convertToSet: convertToSet
10044});
10045
10046/**
10047 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10048 * @version v27.3.0
10049 * @link https://www.ag-grid.com/
10050 * @license MIT
10051 */
10052var __assign$1 = (undefined && undefined.__assign) || function () {
10053 __assign$1 = Object.assign || function(t) {
10054 for (var s, i = 1, n = arguments.length; i < n; i++) {
10055 s = arguments[i];
10056 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10057 t[p] = s[p];
10058 }
10059 return t;
10060 };
10061 return __assign$1.apply(this, arguments);
10062};
10063var utils = __assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1(__assign$1({}, GeneralUtils), AriaUtils), ArrayUtils), BrowserUtils), CsvUtils), DateUtils), DomUtils), EventUtils), FunctionUtils), FuzzyMatchUtils), GenericUtils), IconUtils), KeyboardUtils), MapUtils), MouseUtils), NumberUtils), ObjectUtils), RowNodeUtils), SetUtils), StringUtils);
10064var _ = utils;
10065
10066/**
10067 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10068 * @version v27.3.0
10069 * @link https://www.ag-grid.com/
10070 * @license MIT
10071 */
10072var NumberSequence = /** @class */ (function () {
10073 function NumberSequence(initValue, step) {
10074 if (initValue === void 0) { initValue = 0; }
10075 if (step === void 0) { step = 1; }
10076 this.nextValue = initValue;
10077 this.step = step;
10078 }
10079 NumberSequence.prototype.next = function () {
10080 var valToReturn = this.nextValue;
10081 this.nextValue += this.step;
10082 return valToReturn;
10083 };
10084 NumberSequence.prototype.peek = function () {
10085 return this.nextValue;
10086 };
10087 NumberSequence.prototype.skip = function (count) {
10088 this.nextValue += count;
10089 };
10090 return NumberSequence;
10091}());
10092
10093/**
10094 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10095 * @version v27.3.0
10096 * @link https://www.ag-grid.com/
10097 * @license MIT
10098 */
10099(function (AgPromiseStatus) {
10100 AgPromiseStatus[AgPromiseStatus["IN_PROGRESS"] = 0] = "IN_PROGRESS";
10101 AgPromiseStatus[AgPromiseStatus["RESOLVED"] = 1] = "RESOLVED";
10102})(exports.AgPromiseStatus || (exports.AgPromiseStatus = {}));
10103var AgPromise = /** @class */ (function () {
10104 function AgPromise(callback) {
10105 var _this = this;
10106 this.status = exports.AgPromiseStatus.IN_PROGRESS;
10107 this.resolution = null;
10108 this.waiters = [];
10109 callback(function (value) { return _this.onDone(value); }, function (params) { return _this.onReject(params); });
10110 }
10111 AgPromise.all = function (promises) {
10112 return new AgPromise(function (resolve) {
10113 var remainingToResolve = promises.length;
10114 var combinedValues = new Array(remainingToResolve);
10115 promises.forEach(function (promise, index) {
10116 promise.then(function (value) {
10117 combinedValues[index] = value;
10118 remainingToResolve--;
10119 if (remainingToResolve === 0) {
10120 resolve(combinedValues);
10121 }
10122 });
10123 });
10124 });
10125 };
10126 AgPromise.resolve = function (value) {
10127 if (value === void 0) { value = null; }
10128 return new AgPromise(function (resolve) { return resolve(value); });
10129 };
10130 AgPromise.prototype.then = function (func) {
10131 var _this = this;
10132 return new AgPromise(function (resolve) {
10133 if (_this.status === exports.AgPromiseStatus.RESOLVED) {
10134 resolve(func(_this.resolution));
10135 }
10136 else {
10137 _this.waiters.push(function (value) { return resolve(func(value)); });
10138 }
10139 });
10140 };
10141 AgPromise.prototype.resolveNow = function (ifNotResolvedValue, ifResolved) {
10142 return this.status === exports.AgPromiseStatus.RESOLVED ? ifResolved(this.resolution) : ifNotResolvedValue;
10143 };
10144 AgPromise.prototype.onDone = function (value) {
10145 this.status = exports.AgPromiseStatus.RESOLVED;
10146 this.resolution = value;
10147 this.waiters.forEach(function (waiter) { return waiter(value); });
10148 };
10149 AgPromise.prototype.onReject = function (params) {
10150 console.warn('TBI');
10151 };
10152 return AgPromise;
10153}());
10154
10155/**
10156 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10157 * @version v27.3.0
10158 * @link https://www.ag-grid.com/
10159 * @license MIT
10160 */
10161/**
10162 * A Util Class only used when debugging for printing time to console
10163 */
10164var Timer = /** @class */ (function () {
10165 function Timer() {
10166 this.timestamp = new Date().getTime();
10167 }
10168 Timer.prototype.print = function (msg) {
10169 var duration = (new Date().getTime()) - this.timestamp;
10170 console.info(msg + " = " + duration);
10171 this.timestamp = new Date().getTime();
10172 };
10173 return Timer;
10174}());
10175
10176/**
10177 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10178 * @version v27.3.0
10179 * @link https://www.ag-grid.com/
10180 * @license MIT
10181 */
10182var __extends$5 = (undefined && undefined.__extends) || (function () {
10183 var extendStatics = function (d, b) {
10184 extendStatics = Object.setPrototypeOf ||
10185 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10186 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
10187 return extendStatics(d, b);
10188 };
10189 return function (d, b) {
10190 extendStatics(d, b);
10191 function __() { this.constructor = d; }
10192 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10193 };
10194})();
10195var __assign$2 = (undefined && undefined.__assign) || function () {
10196 __assign$2 = Object.assign || function(t) {
10197 for (var s, i = 1, n = arguments.length; i < n; i++) {
10198 s = arguments[i];
10199 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10200 t[p] = s[p];
10201 }
10202 return t;
10203 };
10204 return __assign$2.apply(this, arguments);
10205};
10206var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10207 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10208 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10209 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;
10210 return c > 3 && r && Object.defineProperty(target, key, r), r;
10211};
10212var TooltipStates;
10213(function (TooltipStates) {
10214 TooltipStates[TooltipStates["NOTHING"] = 0] = "NOTHING";
10215 TooltipStates[TooltipStates["WAITING_TO_SHOW"] = 1] = "WAITING_TO_SHOW";
10216 TooltipStates[TooltipStates["SHOWING"] = 2] = "SHOWING";
10217})(TooltipStates || (TooltipStates = {}));
10218var CustomTooltipFeature = /** @class */ (function (_super) {
10219 __extends$5(CustomTooltipFeature, _super);
10220 function CustomTooltipFeature(parentComp) {
10221 var _this = _super.call(this) || this;
10222 _this.DEFAULT_SHOW_TOOLTIP_DELAY = 2000;
10223 _this.DEFAULT_HIDE_TOOLTIP_DELAY = 10000;
10224 _this.SHOW_QUICK_TOOLTIP_DIFF = 1000;
10225 _this.FADE_OUT_TOOLTIP_TIMEOUT = 1000;
10226 _this.state = TooltipStates.NOTHING;
10227 // when showing the tooltip, we need to make sure it's the most recent instance we request, as due to
10228 // async we could request two tooltips before the first instance returns, in which case we should
10229 // disregard the second instance.
10230 _this.tooltipInstanceCount = 0;
10231 _this.tooltipMouseTrack = false;
10232 _this.parentComp = parentComp;
10233 return _this;
10234 }
10235 CustomTooltipFeature.prototype.postConstruct = function () {
10236 this.tooltipShowDelay = this.gridOptionsWrapper.getTooltipDelay('show') || this.DEFAULT_SHOW_TOOLTIP_DELAY;
10237 this.tooltipHideDelay = this.gridOptionsWrapper.getTooltipDelay('hide') || this.DEFAULT_HIDE_TOOLTIP_DELAY;
10238 this.tooltipMouseTrack = this.gridOptionsWrapper.isTooltipMouseTrack();
10239 var el = this.parentComp.getGui();
10240 this.addManagedListener(el, 'mouseenter', this.onMouseEnter.bind(this));
10241 this.addManagedListener(el, 'mouseleave', this.onMouseLeave.bind(this));
10242 this.addManagedListener(el, 'mousemove', this.onMouseMove.bind(this));
10243 this.addManagedListener(el, 'mousedown', this.onMouseDown.bind(this));
10244 this.addManagedListener(el, 'keydown', this.onKeyDown.bind(this));
10245 };
10246 CustomTooltipFeature.prototype.destroy = function () {
10247 // if this component gets destroyed while tooltip is showing, need to make sure
10248 // we don't end with no mouseLeave event resulting in zombie tooltip
10249 this.setToDoNothing();
10250 _super.prototype.destroy.call(this);
10251 };
10252 CustomTooltipFeature.prototype.onMouseEnter = function (e) {
10253 if (isIOSUserAgent()) {
10254 return;
10255 }
10256 // every mouseenter should be following by a mouseleave, however for some unkonwn, it's possible for
10257 // mouseenter to be called twice in a row, which can happen if editing the cell. this was reported
10258 // in https://ag-grid.atlassian.net/browse/AG-4422. to get around this, we check the state, and if
10259 // state is !=nothing, then we know mouseenter was already received.
10260 if (this.state != TooltipStates.NOTHING) {
10261 return;
10262 }
10263 // if another tooltip was hidden very recently, we only wait 200ms to show, not the normal waiting time
10264 var delay = this.isLastTooltipHiddenRecently() ? 200 : this.tooltipShowDelay;
10265 this.showTooltipTimeoutId = window.setTimeout(this.showTooltip.bind(this), delay);
10266 this.lastMouseEvent = e;
10267 this.state = TooltipStates.WAITING_TO_SHOW;
10268 };
10269 CustomTooltipFeature.prototype.onMouseLeave = function () {
10270 this.setToDoNothing();
10271 };
10272 CustomTooltipFeature.prototype.onKeyDown = function () {
10273 this.setToDoNothing();
10274 };
10275 CustomTooltipFeature.prototype.setToDoNothing = function () {
10276 if (this.state === TooltipStates.SHOWING) {
10277 this.hideTooltip();
10278 }
10279 this.clearTimeouts();
10280 this.state = TooltipStates.NOTHING;
10281 };
10282 CustomTooltipFeature.prototype.onMouseMove = function (e) {
10283 // there is a delay from the time we mouseOver a component and the time the
10284 // tooltip is displayed, so we need to track mousemove to be able to correctly
10285 // position the tooltip when showTooltip is called.
10286 this.lastMouseEvent = e;
10287 if (this.tooltipMouseTrack &&
10288 this.state === TooltipStates.SHOWING &&
10289 this.tooltipComp) {
10290 this.positionTooltipUnderLastMouseEvent();
10291 }
10292 };
10293 CustomTooltipFeature.prototype.onMouseDown = function () {
10294 this.setToDoNothing();
10295 };
10296 CustomTooltipFeature.prototype.hideTooltip = function () {
10297 // check if comp exists - due to async, although we asked for
10298 // one, the instance may not be back yet
10299 if (this.tooltipComp) {
10300 this.destroyTooltipComp();
10301 CustomTooltipFeature.lastTooltipHideTime = new Date().getTime();
10302 }
10303 this.state = TooltipStates.NOTHING;
10304 };
10305 CustomTooltipFeature.prototype.destroyTooltipComp = function () {
10306 var _this = this;
10307 // add class to fade out the tooltip
10308 this.tooltipComp.getGui().classList.add('ag-tooltip-hiding');
10309 // make local copies of these variables, as we use them in the async function below,
10310 // and we clear then to 'undefined' later, so need to take a copy before they are undefined.
10311 var tooltipPopupDestroyFunc = this.tooltipPopupDestroyFunc;
10312 var tooltipComp = this.tooltipComp;
10313 window.setTimeout(function () {
10314 tooltipPopupDestroyFunc();
10315 _this.getContext().destroyBean(tooltipComp);
10316 }, this.FADE_OUT_TOOLTIP_TIMEOUT);
10317 this.tooltipPopupDestroyFunc = undefined;
10318 this.tooltipComp = undefined;
10319 };
10320 CustomTooltipFeature.prototype.isLastTooltipHiddenRecently = function () {
10321 // return true if <1000ms since last time we hid a tooltip
10322 var now = new Date().getTime();
10323 var then = CustomTooltipFeature.lastTooltipHideTime;
10324 return (now - then) < this.SHOW_QUICK_TOOLTIP_DIFF;
10325 };
10326 CustomTooltipFeature.prototype.showTooltip = function () {
10327 var params = __assign$2({}, this.parentComp.getTooltipParams());
10328 if (!exists(params.value)) {
10329 this.setToDoNothing();
10330 return;
10331 }
10332 this.state = TooltipStates.SHOWING;
10333 this.tooltipInstanceCount++;
10334 // we pass in tooltipInstanceCount so the callback knows what the count was when
10335 // we requested the tooltip, so if another tooltip was requested in the mean time
10336 // we disregard it
10337 var callback = this.newTooltipComponentCallback.bind(this, this.tooltipInstanceCount);
10338 var userDetails = this.userComponentFactory.getTooltipCompDetails(params);
10339 userDetails.newAgStackInstance().then(callback);
10340 };
10341 CustomTooltipFeature.prototype.newTooltipComponentCallback = function (tooltipInstanceCopy, tooltipComp) {
10342 var compNoLongerNeeded = this.state !== TooltipStates.SHOWING || this.tooltipInstanceCount !== tooltipInstanceCopy;
10343 if (compNoLongerNeeded) {
10344 this.getContext().destroyBean(tooltipComp);
10345 return;
10346 }
10347 var eGui = tooltipComp.getGui();
10348 this.tooltipComp = tooltipComp;
10349 if (!eGui.classList.contains('ag-tooltip')) {
10350 eGui.classList.add('ag-tooltip-custom');
10351 }
10352 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
10353 var addPopupRes = this.popupService.addPopup({
10354 eChild: eGui,
10355 ariaLabel: translate('ariaLabelTooltip', 'Tooltip')
10356 });
10357 if (addPopupRes) {
10358 this.tooltipPopupDestroyFunc = addPopupRes.hideFunc;
10359 }
10360 // this.tooltipPopupDestroyFunc = this.popupService.addPopup(false, eGui, false);
10361 this.positionTooltipUnderLastMouseEvent();
10362 this.hideTooltipTimeoutId = window.setTimeout(this.hideTooltip.bind(this), this.tooltipHideDelay);
10363 };
10364 CustomTooltipFeature.prototype.positionTooltipUnderLastMouseEvent = function () {
10365 this.popupService.positionPopupUnderMouseEvent({
10366 type: 'tooltip',
10367 mouseEvent: this.lastMouseEvent,
10368 ePopup: this.tooltipComp.getGui(),
10369 nudgeY: 18
10370 });
10371 };
10372 CustomTooltipFeature.prototype.clearTimeouts = function () {
10373 if (this.showTooltipTimeoutId) {
10374 window.clearTimeout(this.showTooltipTimeoutId);
10375 this.showTooltipTimeoutId = undefined;
10376 }
10377 if (this.hideTooltipTimeoutId) {
10378 window.clearTimeout(this.hideTooltipTimeoutId);
10379 this.hideTooltipTimeoutId = undefined;
10380 }
10381 };
10382 __decorate$9([
10383 Autowired('popupService')
10384 ], CustomTooltipFeature.prototype, "popupService", void 0);
10385 __decorate$9([
10386 Autowired('userComponentFactory')
10387 ], CustomTooltipFeature.prototype, "userComponentFactory", void 0);
10388 __decorate$9([
10389 Autowired('columnApi')
10390 ], CustomTooltipFeature.prototype, "columnApi", void 0);
10391 __decorate$9([
10392 Autowired('gridApi')
10393 ], CustomTooltipFeature.prototype, "gridApi", void 0);
10394 __decorate$9([
10395 PostConstruct
10396 ], CustomTooltipFeature.prototype, "postConstruct", null);
10397 return CustomTooltipFeature;
10398}(BeanStub));
10399
10400/**
10401 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10402 * @version v27.3.0
10403 * @link https://www.ag-grid.com/
10404 * @license MIT
10405 */
10406var __extends$6 = (undefined && undefined.__extends) || (function () {
10407 var extendStatics = function (d, b) {
10408 extendStatics = Object.setPrototypeOf ||
10409 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10410 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
10411 return extendStatics(d, b);
10412 };
10413 return function (d, b) {
10414 extendStatics(d, b);
10415 function __() { this.constructor = d; }
10416 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10417 };
10418})();
10419var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10420 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10421 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10422 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;
10423 return c > 3 && r && Object.defineProperty(target, key, r), r;
10424};
10425var compIdSequence = new NumberSequence();
10426var CssClassManager = /** @class */ (function () {
10427 function CssClassManager(getGui) {
10428 // to minimise DOM hits, we only apply CSS classes if they have changed. as adding a CSS class that is already
10429 // there, or removing one that wasn't present, all takes CPU.
10430 this.cssClassStates = {};
10431 this.getGui = getGui;
10432 }
10433 CssClassManager.prototype.addCssClass = function (className) {
10434 var _this = this;
10435 var list = (className || '').split(' ');
10436 if (list.length > 1) {
10437 list.forEach(function (cls) { return _this.addCssClass(cls); });
10438 return;
10439 }
10440 var updateNeeded = this.cssClassStates[className] !== true;
10441 if (updateNeeded && className.length) {
10442 this.getGui().classList.add(className);
10443 this.cssClassStates[className] = true;
10444 }
10445 };
10446 CssClassManager.prototype.removeCssClass = function (className) {
10447 var _this = this;
10448 var list = (className || '').split(' ');
10449 if (list.length > 1) {
10450 list.forEach(function (cls) { return _this.removeCssClass(cls); });
10451 return;
10452 }
10453 var updateNeeded = this.cssClassStates[className] !== false;
10454 if (updateNeeded && className.length) {
10455 this.getGui().classList.remove(className);
10456 this.cssClassStates[className] = false;
10457 }
10458 };
10459 CssClassManager.prototype.containsCssClass = function (className) {
10460 return this.getGui().classList.contains(className);
10461 };
10462 CssClassManager.prototype.addOrRemoveCssClass = function (className, addOrRemove) {
10463 var _this = this;
10464 var list = (className || '').split(' ');
10465 if (list.length > 1) {
10466 list.forEach(function (cls) { return _this.addOrRemoveCssClass(cls, addOrRemove); });
10467 return;
10468 }
10469 var updateNeeded = this.cssClassStates[className] !== addOrRemove;
10470 if (updateNeeded && className.length) {
10471 this.getGui().classList.toggle(className, addOrRemove);
10472 this.cssClassStates[className] = addOrRemove;
10473 }
10474 };
10475 return CssClassManager;
10476}());
10477var Component = /** @class */ (function (_super) {
10478 __extends$6(Component, _super);
10479 function Component(template) {
10480 var _this = _super.call(this) || this;
10481 // if false, then CSS class "ag-hidden" is applied, which sets "display: none"
10482 _this.displayed = true;
10483 // if false, then CSS class "ag-invisible" is applied, which sets "visibility: hidden"
10484 _this.visible = true;
10485 // unique id for this row component. this is used for getting a reference to the HTML dom.
10486 // we cannot use the RowNode id as this is not unique (due to animation, old rows can be lying
10487 // around as we create a new rowComp instance for the same row node).
10488 _this.compId = compIdSequence.next();
10489 _this.cssClassManager = new CssClassManager(function () { return _this.eGui; });
10490 if (template) {
10491 _this.setTemplate(template);
10492 }
10493 return _this;
10494 }
10495 Component.prototype.preConstructOnComponent = function () {
10496 this.usingBrowserTooltips = this.gridOptionsWrapper.isEnableBrowserTooltips();
10497 };
10498 Component.prototype.getCompId = function () {
10499 return this.compId;
10500 };
10501 Component.prototype.getTooltipParams = function () {
10502 return {
10503 value: this.tooltipText,
10504 location: 'UNKNOWN'
10505 };
10506 };
10507 Component.prototype.setTooltip = function (newTooltipText) {
10508 var _this = this;
10509 var removeTooltip = function () {
10510 if (_this.usingBrowserTooltips) {
10511 _this.getGui().removeAttribute('title');
10512 }
10513 else {
10514 _this.tooltipFeature = _this.destroyBean(_this.tooltipFeature);
10515 }
10516 };
10517 var addTooltip = function () {
10518 if (_this.usingBrowserTooltips) {
10519 _this.getGui().setAttribute('title', _this.tooltipText);
10520 }
10521 else {
10522 _this.tooltipFeature = _this.createBean(new CustomTooltipFeature(_this));
10523 }
10524 };
10525 if (this.tooltipText != newTooltipText) {
10526 if (this.tooltipText) {
10527 removeTooltip();
10528 }
10529 if (newTooltipText != null) {
10530 this.tooltipText = newTooltipText;
10531 if (this.tooltipText) {
10532 addTooltip();
10533 }
10534 }
10535 }
10536 };
10537 // for registered components only, eg creates AgCheckbox instance from ag-checkbox HTML tag
10538 Component.prototype.createChildComponentsFromTags = function (parentNode, paramsMap) {
10539 var _this = this;
10540 // we MUST take a copy of the list first, as the 'swapComponentForNode' adds comments into the DOM
10541 // which messes up the traversal order of the children.
10542 var childNodeList = copyNodeList(parentNode.childNodes);
10543 childNodeList.forEach(function (childNode) {
10544 if (!(childNode instanceof HTMLElement)) {
10545 return;
10546 }
10547 var childComp = _this.createComponentFromElement(childNode, function (childComp) {
10548 // copy over all attributes, including css classes, so any attributes user put on the tag
10549 // wll be carried across
10550 var childGui = childComp.getGui();
10551 if (childGui) {
10552 _this.copyAttributesFromNode(childNode, childComp.getGui());
10553 }
10554 }, paramsMap);
10555 if (childComp) {
10556 if (childComp.addItems && childNode.children.length) {
10557 _this.createChildComponentsFromTags(childNode, paramsMap);
10558 // converting from HTMLCollection to Array
10559 var items = Array.prototype.slice.call(childNode.children);
10560 childComp.addItems(items);
10561 }
10562 // replace the tag (eg ag-checkbox) with the proper HTMLElement (eg 'div') in the dom
10563 _this.swapComponentForNode(childComp, parentNode, childNode);
10564 }
10565 else if (childNode.childNodes) {
10566 _this.createChildComponentsFromTags(childNode, paramsMap);
10567 }
10568 });
10569 };
10570 Component.prototype.createComponentFromElement = function (element, afterPreCreateCallback, paramsMap) {
10571 var key = element.nodeName;
10572 var componentParams = paramsMap ? paramsMap[element.getAttribute('ref')] : undefined;
10573 var ComponentClass = this.agStackComponentsRegistry.getComponentClass(key);
10574 if (ComponentClass) {
10575 Component.elementGettingCreated = element;
10576 var newComponent = new ComponentClass(componentParams);
10577 newComponent.setParentComponent(this);
10578 this.createBean(newComponent, null, afterPreCreateCallback);
10579 return newComponent;
10580 }
10581 return null;
10582 };
10583 Component.prototype.copyAttributesFromNode = function (source, dest) {
10584 iterateNamedNodeMap(source.attributes, function (name, value) { return dest.setAttribute(name, value); });
10585 };
10586 Component.prototype.swapComponentForNode = function (newComponent, parentNode, childNode) {
10587 var eComponent = newComponent.getGui();
10588 parentNode.replaceChild(eComponent, childNode);
10589 parentNode.insertBefore(document.createComment(childNode.nodeName), eComponent);
10590 this.addDestroyFunc(this.destroyBean.bind(this, newComponent));
10591 this.swapInComponentForQuerySelectors(newComponent, childNode);
10592 };
10593 Component.prototype.swapInComponentForQuerySelectors = function (newComponent, childNode) {
10594 var thisNoType = this;
10595 this.iterateOverQuerySelectors(function (querySelector) {
10596 if (thisNoType[querySelector.attributeName] === childNode) {
10597 thisNoType[querySelector.attributeName] = newComponent;
10598 }
10599 });
10600 };
10601 Component.prototype.iterateOverQuerySelectors = function (action) {
10602 var thisPrototype = Object.getPrototypeOf(this);
10603 while (thisPrototype != null) {
10604 var metaData = thisPrototype.__agComponentMetaData;
10605 var currentProtoName = getFunctionName(thisPrototype.constructor);
10606 if (metaData && metaData[currentProtoName] && metaData[currentProtoName].querySelectors) {
10607 metaData[currentProtoName].querySelectors.forEach(function (querySelector) { return action(querySelector); });
10608 }
10609 thisPrototype = Object.getPrototypeOf(thisPrototype);
10610 }
10611 };
10612 Component.prototype.setTemplate = function (template, paramsMap) {
10613 var eGui = loadTemplate(template);
10614 this.setTemplateFromElement(eGui, paramsMap);
10615 };
10616 Component.prototype.setTemplateFromElement = function (element, paramsMap) {
10617 this.eGui = element;
10618 this.eGui.__agComponent = this;
10619 this.wireQuerySelectors();
10620 // context will not be available when user sets template in constructor
10621 if (!!this.getContext()) {
10622 this.createChildComponentsFromTags(this.getGui(), paramsMap);
10623 }
10624 };
10625 Component.prototype.createChildComponentsPreConstruct = function () {
10626 // ui exists if user sets template in constructor. when this happens, we have to wait for the context
10627 // to be autoWired first before we can create child components.
10628 if (!!this.getGui()) {
10629 this.createChildComponentsFromTags(this.getGui());
10630 }
10631 };
10632 Component.prototype.wireQuerySelectors = function () {
10633 var _this = this;
10634 if (!this.eGui) {
10635 return;
10636 }
10637 var thisNoType = this;
10638 this.iterateOverQuerySelectors(function (querySelector) {
10639 var setResult = function (result) { return thisNoType[querySelector.attributeName] = result; };
10640 // if it's a ref selector, and match is on top level component, we return
10641 // the element. otherwise no way of components putting ref=xxx on the top
10642 // level element as querySelector only looks at children.
10643 var topLevelRefMatch = querySelector.refSelector
10644 && _this.eGui.getAttribute('ref') === querySelector.refSelector;
10645 if (topLevelRefMatch) {
10646 setResult(_this.eGui);
10647 }
10648 else {
10649 // otherwise use querySelector, which looks at children
10650 var resultOfQuery = _this.eGui.querySelector(querySelector.querySelector);
10651 if (resultOfQuery) {
10652 setResult(resultOfQuery.__agComponent || resultOfQuery);
10653 }
10654 }
10655 });
10656 };
10657 Component.prototype.getGui = function () {
10658 return this.eGui;
10659 };
10660 Component.prototype.getFocusableElement = function () {
10661 return this.eGui;
10662 };
10663 Component.prototype.setParentComponent = function (component) {
10664 this.parentComponent = component;
10665 };
10666 Component.prototype.getParentComponent = function () {
10667 return this.parentComponent;
10668 };
10669 // this method is for older code, that wants to provide the gui element,
10670 // it is not intended for this to be in ag-Stack
10671 Component.prototype.setGui = function (eGui) {
10672 this.eGui = eGui;
10673 };
10674 Component.prototype.queryForHtmlElement = function (cssSelector) {
10675 return this.eGui.querySelector(cssSelector);
10676 };
10677 Component.prototype.queryForHtmlInputElement = function (cssSelector) {
10678 return this.eGui.querySelector(cssSelector);
10679 };
10680 Component.prototype.appendChild = function (newChild, container) {
10681 if (!container) {
10682 container = this.eGui;
10683 }
10684 if (newChild == null) {
10685 return;
10686 }
10687 if (isNodeOrElement(newChild)) {
10688 container.appendChild(newChild);
10689 }
10690 else {
10691 var childComponent = newChild;
10692 container.appendChild(childComponent.getGui());
10693 this.addDestroyFunc(this.destroyBean.bind(this, childComponent));
10694 }
10695 };
10696 Component.prototype.isDisplayed = function () {
10697 return this.displayed;
10698 };
10699 Component.prototype.setVisible = function (visible) {
10700 if (visible !== this.visible) {
10701 this.visible = visible;
10702 setVisible(this.eGui, visible);
10703 }
10704 };
10705 Component.prototype.setDisplayed = function (displayed) {
10706 if (displayed !== this.displayed) {
10707 this.displayed = displayed;
10708 setDisplayed(this.eGui, displayed);
10709 var event_1 = {
10710 type: Component.EVENT_DISPLAYED_CHANGED,
10711 visible: this.displayed
10712 };
10713 this.dispatchEvent(event_1);
10714 }
10715 };
10716 Component.prototype.destroy = function () {
10717 if (this.tooltipFeature) {
10718 this.tooltipFeature = this.destroyBean(this.tooltipFeature);
10719 }
10720 _super.prototype.destroy.call(this);
10721 };
10722 Component.prototype.addGuiEventListener = function (event, listener) {
10723 var _this = this;
10724 this.eGui.addEventListener(event, listener);
10725 this.addDestroyFunc(function () { return _this.eGui.removeEventListener(event, listener); });
10726 };
10727 Component.prototype.addCssClass = function (className) {
10728 this.cssClassManager.addCssClass(className);
10729 };
10730 Component.prototype.removeCssClass = function (className) {
10731 this.cssClassManager.removeCssClass(className);
10732 };
10733 Component.prototype.containsCssClass = function (className) {
10734 return this.cssClassManager.containsCssClass(className);
10735 };
10736 Component.prototype.addOrRemoveCssClass = function (className, addOrRemove) {
10737 this.cssClassManager.addOrRemoveCssClass(className, addOrRemove);
10738 };
10739 Component.prototype.getAttribute = function (key) {
10740 var eGui = this.eGui;
10741 return eGui ? eGui.getAttribute(key) : null;
10742 };
10743 Component.prototype.getRefElement = function (refName) {
10744 return this.queryForHtmlElement("[ref=\"" + refName + "\"]");
10745 };
10746 Component.EVENT_DISPLAYED_CHANGED = 'displayedChanged';
10747 __decorate$a([
10748 Autowired('agStackComponentsRegistry')
10749 ], Component.prototype, "agStackComponentsRegistry", void 0);
10750 __decorate$a([
10751 PreConstruct
10752 ], Component.prototype, "preConstructOnComponent", null);
10753 __decorate$a([
10754 PreConstruct
10755 ], Component.prototype, "createChildComponentsPreConstruct", null);
10756 return Component;
10757}(BeanStub));
10758
10759/**
10760 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10761 * @version v27.3.0
10762 * @link https://www.ag-grid.com/
10763 * @license MIT
10764 */
10765function QuerySelector(selector) {
10766 return querySelectorFunc.bind(this, selector, undefined);
10767}
10768function RefSelector(ref) {
10769 return querySelectorFunc.bind(this, "[ref=" + ref + "]", ref);
10770}
10771function querySelectorFunc(selector, refSelector, classPrototype, methodOrAttributeName, index) {
10772 if (selector === null) {
10773 console.error('AG Grid: QuerySelector selector should not be null');
10774 return;
10775 }
10776 if (typeof index === 'number') {
10777 console.error('AG Grid: QuerySelector should be on an attribute');
10778 return;
10779 }
10780 addToObjectProps(classPrototype, 'querySelectors', {
10781 attributeName: methodOrAttributeName,
10782 querySelector: selector,
10783 refSelector: refSelector
10784 });
10785}
10786// // think we should take this out, put property bindings on the
10787// export function Method(eventName?: string): Function {
10788// return methodFunc.bind(this, eventName);
10789// }
10790//
10791// function methodFunc(alias: string, target: Object, methodName: string) {
10792// if (alias === null) {
10793// console.error("AG Grid: EventListener eventName should not be null");
10794// return;
10795// }
10796//
10797// addToObjectProps(target, 'methods', {
10798// methodName: methodName,
10799// alias: alias
10800// });
10801// }
10802function addToObjectProps(target, key, value) {
10803 // it's an attribute on the class
10804 var props = getOrCreateProps$1(target, getFunctionName(target.constructor));
10805 if (!props[key]) {
10806 props[key] = [];
10807 }
10808 props[key].push(value);
10809}
10810function getOrCreateProps$1(target, instanceName) {
10811 if (!target.__agComponentMetaData) {
10812 target.__agComponentMetaData = {};
10813 }
10814 if (!target.__agComponentMetaData[instanceName]) {
10815 target.__agComponentMetaData[instanceName] = {};
10816 }
10817 return target.__agComponentMetaData[instanceName];
10818}
10819
10820/**
10821 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10822 * @version v27.3.0
10823 * @link https://www.ag-grid.com/
10824 * @license MIT
10825 */
10826var __extends$7 = (undefined && undefined.__extends) || (function () {
10827 var extendStatics = function (d, b) {
10828 extendStatics = Object.setPrototypeOf ||
10829 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10830 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
10831 return extendStatics(d, b);
10832 };
10833 return function (d, b) {
10834 extendStatics(d, b);
10835 function __() { this.constructor = d; }
10836 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10837 };
10838})();
10839var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10840 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10841 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10842 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;
10843 return c > 3 && r && Object.defineProperty(target, key, r), r;
10844};
10845// optional floating filter for user provided filters - instead of providing a floating filter,
10846// they can provide a getModelAsString() method on the filter instead. this class just displays
10847// the string returned from getModelAsString()
10848var ReadOnlyFloatingFilter = /** @class */ (function (_super) {
10849 __extends$7(ReadOnlyFloatingFilter, _super);
10850 function ReadOnlyFloatingFilter() {
10851 return _super.call(this, /* html */ "\n <div class=\"ag-floating-filter-input\" role=\"presentation\">\n <ag-input-text-field ref=\"eFloatingFilterText\"></ag-input-text-field>\n </div>") || this;
10852 }
10853 // this is a user component, and IComponent has "public destroy()" as part of the interface.
10854 // so we need to override destroy() just to make the method public.
10855 ReadOnlyFloatingFilter.prototype.destroy = function () {
10856 _super.prototype.destroy.call(this);
10857 };
10858 ReadOnlyFloatingFilter.prototype.init = function (params) {
10859 this.params = params;
10860 var displayName = this.columnModel.getDisplayNameForColumn(params.column, 'header', true);
10861 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
10862 this.eFloatingFilterText
10863 .setDisabled(true)
10864 .setInputAriaLabel(displayName + " " + translate('ariaFilterInput', 'Filter Input'));
10865 };
10866 ReadOnlyFloatingFilter.prototype.onParentModelChanged = function (parentModel) {
10867 var _this = this;
10868 if (!parentModel) {
10869 this.eFloatingFilterText.setValue('');
10870 return;
10871 }
10872 this.params.parentFilterInstance(function (filterInstance) {
10873 // it would be nice to check if getModelAsString was present before creating this component,
10874 // however that is not possible, as React Hooks and VueJS don't attached the methods to the Filter until
10875 // AFTER the filter is created, not allowing inspection before this (we create floating filters as columns
10876 // are drawn, but the parent filters are only created when needed).
10877 if (filterInstance.getModelAsString) {
10878 var modelAsString = filterInstance.getModelAsString(parentModel);
10879 _this.eFloatingFilterText.setValue(modelAsString);
10880 }
10881 });
10882 };
10883 __decorate$b([
10884 RefSelector('eFloatingFilterText')
10885 ], ReadOnlyFloatingFilter.prototype, "eFloatingFilterText", void 0);
10886 __decorate$b([
10887 Autowired('columnModel')
10888 ], ReadOnlyFloatingFilter.prototype, "columnModel", void 0);
10889 return ReadOnlyFloatingFilter;
10890}(Component));
10891
10892/**
10893 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10894 * @version v27.3.0
10895 * @link https://www.ag-grid.com/
10896 * @license MIT
10897 */
10898/** Provides sync access to async component. Date component can be lazy created - this class encapsulates
10899 * this by keeping value locally until DateComp has loaded, then passing DateComp the value. */
10900var DateCompWrapper = /** @class */ (function () {
10901 function DateCompWrapper(context, userComponentFactory, dateComponentParams, eParent) {
10902 var _this = this;
10903 this.alive = true;
10904 this.context = context;
10905 this.eParent = eParent;
10906 var compDetails = userComponentFactory.getDateCompDetails(dateComponentParams);
10907 var promise = compDetails.newAgStackInstance();
10908 promise.then(function (dateComp) {
10909 // because async, check the filter still exists after component comes back
10910 if (!_this.alive) {
10911 context.destroyBean(dateComp);
10912 return;
10913 }
10914 _this.dateComp = dateComp;
10915 if (!dateComp) {
10916 return;
10917 }
10918 eParent.appendChild(dateComp.getGui());
10919 if (dateComp.afterGuiAttached) {
10920 dateComp.afterGuiAttached();
10921 }
10922 if (_this.tempValue) {
10923 dateComp.setDate(_this.tempValue);
10924 }
10925 if (_this.disabled != null) {
10926 _this.setDateCompDisabled(_this.disabled);
10927 }
10928 });
10929 }
10930 DateCompWrapper.prototype.destroy = function () {
10931 this.alive = false;
10932 this.dateComp = this.context.destroyBean(this.dateComp);
10933 };
10934 DateCompWrapper.prototype.getDate = function () {
10935 return this.dateComp ? this.dateComp.getDate() : this.tempValue;
10936 };
10937 DateCompWrapper.prototype.setDate = function (value) {
10938 if (this.dateComp) {
10939 this.dateComp.setDate(value);
10940 }
10941 else {
10942 this.tempValue = value;
10943 }
10944 };
10945 DateCompWrapper.prototype.setDisabled = function (disabled) {
10946 if (this.dateComp) {
10947 this.setDateCompDisabled(disabled);
10948 }
10949 else {
10950 this.disabled = disabled;
10951 }
10952 };
10953 DateCompWrapper.prototype.setDisplayed = function (displayed) {
10954 setDisplayed(this.eParent, displayed);
10955 };
10956 DateCompWrapper.prototype.setInputPlaceholder = function (placeholder) {
10957 if (this.dateComp && this.dateComp.setInputPlaceholder) {
10958 this.dateComp.setInputPlaceholder(placeholder);
10959 }
10960 };
10961 DateCompWrapper.prototype.setInputAriaLabel = function (label) {
10962 if (this.dateComp && this.dateComp.setInputAriaLabel) {
10963 this.dateComp.setInputAriaLabel(label);
10964 }
10965 };
10966 DateCompWrapper.prototype.afterGuiAttached = function (params) {
10967 if (this.dateComp && typeof this.dateComp.afterGuiAttached === 'function') {
10968 this.dateComp.afterGuiAttached(params);
10969 }
10970 };
10971 DateCompWrapper.prototype.setDateCompDisabled = function (disabled) {
10972 if (this.dateComp == null) {
10973 return;
10974 }
10975 if (this.dateComp.setDisabled == null) {
10976 return;
10977 }
10978 this.dateComp.setDisabled(disabled);
10979 };
10980 return DateCompWrapper;
10981}());
10982
10983/**
10984 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
10985 * @version v27.3.0
10986 * @link https://www.ag-grid.com/
10987 * @license MIT
10988 */
10989var __assign$3 = (undefined && undefined.__assign) || function () {
10990 __assign$3 = Object.assign || function(t) {
10991 for (var s, i = 1, n = arguments.length; i < n; i++) {
10992 s = arguments[i];
10993 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10994 t[p] = s[p];
10995 }
10996 return t;
10997 };
10998 return __assign$3.apply(this, arguments);
10999};
11000/* Common logic for options, used by both filters and floating filters. */
11001var OptionsFactory = /** @class */ (function () {
11002 function OptionsFactory() {
11003 this.customFilterOptions = {};
11004 }
11005 OptionsFactory.prototype.init = function (params, defaultOptions) {
11006 this.filterOptions = params.filterOptions || defaultOptions;
11007 this.mapCustomOptions();
11008 this.selectDefaultItem(params);
11009 this.checkForDeprecatedParams();
11010 };
11011 OptionsFactory.prototype.checkForDeprecatedParams = function () {
11012 if (this.filterOptions.some(function (opt) { return typeof opt != 'string' && opt.test != null; })) {
11013 console.warn("AG Grid: [IFilterOptionDef] since v26.2.0, test() has been replaced with predicate().");
11014 }
11015 if (this.filterOptions.some(function (opt) { return typeof opt != 'string' && opt.hideFilterInput != null; })) {
11016 console.warn("AG Grid: [IFilterOptionDef] since v26.2.0, useOfHideFilterInput has been replaced with numberOfInputs.");
11017 }
11018 };
11019 OptionsFactory.prototype.getFilterOptions = function () {
11020 return this.filterOptions;
11021 };
11022 OptionsFactory.prototype.mapCustomOptions = function () {
11023 var _this = this;
11024 if (!this.filterOptions) {
11025 return;
11026 }
11027 this.filterOptions.forEach(function (filterOption) {
11028 if (typeof filterOption === 'string') {
11029 return;
11030 }
11031 var requiredProperties = [['displayKey'], ['displayName'], ['predicate', 'test']];
11032 var propertyCheck = function (keys) {
11033 if (!keys.some(function (key) { return filterOption[key] != null; })) {
11034 console.warn("AG Grid: ignoring FilterOptionDef as it doesn't contain one of '" + keys + "'");
11035 return false;
11036 }
11037 return true;
11038 };
11039 if (!requiredProperties.every(propertyCheck)) {
11040 _this.filterOptions = _this.filterOptions.filter(function (v) { return v === filterOption; }) || [];
11041 return;
11042 }
11043 var test = filterOption.test;
11044 var mutatedFilterOptions = __assign$3({}, filterOption);
11045 if (test != null && filterOption.predicate == null) {
11046 mutatedFilterOptions.predicate = function (v, cv) { return test(v[0], cv); };
11047 delete mutatedFilterOptions.test;
11048 }
11049 if (mutatedFilterOptions.hideFilterInput && mutatedFilterOptions.numberOfInputs == null) {
11050 mutatedFilterOptions.numberOfInputs = 0;
11051 delete mutatedFilterOptions.hideFilterInput;
11052 }
11053 _this.customFilterOptions[filterOption.displayKey] = mutatedFilterOptions;
11054 });
11055 };
11056 OptionsFactory.prototype.selectDefaultItem = function (params) {
11057 if (params.defaultOption) {
11058 this.defaultOption = params.defaultOption;
11059 }
11060 else if (this.filterOptions.length >= 1) {
11061 var firstFilterOption = this.filterOptions[0];
11062 if (typeof firstFilterOption === 'string') {
11063 this.defaultOption = firstFilterOption;
11064 }
11065 else if (firstFilterOption.displayKey) {
11066 this.defaultOption = firstFilterOption.displayKey;
11067 }
11068 else {
11069 console.warn("AG Grid: invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'");
11070 }
11071 }
11072 else {
11073 console.warn('AG Grid: no filter options for filter');
11074 }
11075 };
11076 OptionsFactory.prototype.getDefaultOption = function () {
11077 return this.defaultOption;
11078 };
11079 OptionsFactory.prototype.getCustomOption = function (name) {
11080 return this.customFilterOptions[name];
11081 };
11082 return OptionsFactory;
11083}());
11084
11085/**
11086 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
11087 * @version v27.3.0
11088 * @link https://www.ag-grid.com/
11089 * @license MIT
11090 */
11091var DEFAULT_FILTER_LOCALE_TEXT = {
11092 applyFilter: 'Apply',
11093 clearFilter: 'Clear',
11094 resetFilter: 'Reset',
11095 cancelFilter: 'Cancel',
11096 textFilter: 'Text Filter',
11097 numberFilter: 'Number Filter',
11098 dateFilter: 'Date Filter',
11099 setFilter: 'Set Filter',
11100 filterOoo: 'Filter...',
11101 empty: 'Choose One',
11102 equals: 'Equals',
11103 notEqual: 'Not equal',
11104 lessThan: 'Less than',
11105 greaterThan: 'Greater than',
11106 inRange: 'In range',
11107 inRangeStart: 'From',
11108 inRangeEnd: 'To',
11109 lessThanOrEqual: 'Less than or equals',
11110 greaterThanOrEqual: 'Greater than or equals',
11111 contains: 'Contains',
11112 notContains: 'Not contains',
11113 startsWith: 'Starts with',
11114 endsWith: 'Ends with',
11115 blank: 'Blank',
11116 notBlank: 'Not blank',
11117 andCondition: 'AND',
11118 orCondition: 'OR',
11119 dateFormatOoo: 'yyyy-mm-dd',
11120};
11121
11122/**
11123 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
11124 * @version v27.3.0
11125 * @link https://www.ag-grid.com/
11126 * @license MIT
11127 */
11128var KeyCode = /** @class */ (function () {
11129 function KeyCode() {
11130 }
11131 KeyCode.BACKSPACE = 'Backspace';
11132 KeyCode.TAB = 'Tab';
11133 KeyCode.ENTER = 'Enter';
11134 KeyCode.ESCAPE = 'Escape';
11135 KeyCode.SPACE = ' ';
11136 KeyCode.LEFT = 'ArrowLeft';
11137 KeyCode.UP = 'ArrowUp';
11138 KeyCode.RIGHT = 'ArrowRight';
11139 KeyCode.DOWN = 'ArrowDown';
11140 KeyCode.DELETE = 'Delete';
11141 KeyCode.F2 = 'F2';
11142 KeyCode.PAGE_UP = 'PageUp';
11143 KeyCode.PAGE_DOWN = 'PageDown';
11144 KeyCode.PAGE_HOME = 'Home';
11145 KeyCode.PAGE_END = 'End';
11146 // these should be used with `event.code` instead of `event.key`
11147 // as `event.key` changes when non-latin keyboards are used
11148 KeyCode.A = 'KeyA';
11149 KeyCode.C = 'KeyC';
11150 KeyCode.V = 'KeyV';
11151 KeyCode.D = 'KeyD';
11152 KeyCode.Z = 'KeyZ';
11153 KeyCode.Y = 'KeyY';
11154 return KeyCode;
11155}());
11156
11157/**
11158 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
11159 * @version v27.3.0
11160 * @link https://www.ag-grid.com/
11161 * @license MIT
11162 */
11163var __extends$8 = (undefined && undefined.__extends) || (function () {
11164 var extendStatics = function (d, b) {
11165 extendStatics = Object.setPrototypeOf ||
11166 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11167 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
11168 return extendStatics(d, b);
11169 };
11170 return function (d, b) {
11171 extendStatics(d, b);
11172 function __() { this.constructor = d; }
11173 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11174 };
11175})();
11176var __assign$4 = (undefined && undefined.__assign) || function () {
11177 __assign$4 = Object.assign || function(t) {
11178 for (var s, i = 1, n = arguments.length; i < n; i++) {
11179 s = arguments[i];
11180 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11181 t[p] = s[p];
11182 }
11183 return t;
11184 };
11185 return __assign$4.apply(this, arguments);
11186};
11187var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11188 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11189 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11190 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;
11191 return c > 3 && r && Object.defineProperty(target, key, r), r;
11192};
11193var ManagedFocusFeature = /** @class */ (function (_super) {
11194 __extends$8(ManagedFocusFeature, _super);
11195 function ManagedFocusFeature(eFocusableElement, callbacks) {
11196 if (callbacks === void 0) { callbacks = {}; }
11197 var _this = _super.call(this) || this;
11198 _this.eFocusableElement = eFocusableElement;
11199 _this.callbacks = callbacks;
11200 _this.callbacks = __assign$4({ shouldStopEventPropagation: function () { return false; }, onTabKeyDown: function (e) {
11201 if (e.defaultPrevented) {
11202 return;
11203 }
11204 var nextRoot = _this.focusService.findNextFocusableElement(_this.eFocusableElement, false, e.shiftKey);
11205 if (!nextRoot) {
11206 return;
11207 }
11208 nextRoot.focus();
11209 e.preventDefault();
11210 } }, callbacks);
11211 return _this;
11212 }
11213 ManagedFocusFeature.prototype.postConstruct = function () {
11214 this.eFocusableElement.classList.add(ManagedFocusFeature.FOCUS_MANAGED_CLASS);
11215 this.addKeyDownListeners(this.eFocusableElement);
11216 if (this.callbacks.onFocusIn) {
11217 this.addManagedListener(this.eFocusableElement, 'focusin', this.callbacks.onFocusIn);
11218 }
11219 if (this.callbacks.onFocusOut) {
11220 this.addManagedListener(this.eFocusableElement, 'focusout', this.callbacks.onFocusOut);
11221 }
11222 };
11223 ManagedFocusFeature.prototype.addKeyDownListeners = function (eGui) {
11224 var _this = this;
11225 this.addManagedListener(eGui, 'keydown', function (e) {
11226 if (e.defaultPrevented || isStopPropagationForAgGrid(e)) {
11227 return;
11228 }
11229 if (_this.callbacks.shouldStopEventPropagation(e)) {
11230 stopPropagationForAgGrid(e);
11231 return;
11232 }
11233 if (e.key === KeyCode.TAB) {
11234 _this.callbacks.onTabKeyDown(e);
11235 }
11236 else if (_this.callbacks.handleKeyDown) {
11237 _this.callbacks.handleKeyDown(e);
11238 }
11239 });
11240 };
11241 ManagedFocusFeature.FOCUS_MANAGED_CLASS = 'ag-focus-managed';
11242 __decorate$c([
11243 Autowired('focusService')
11244 ], ManagedFocusFeature.prototype, "focusService", void 0);
11245 __decorate$c([
11246 PostConstruct
11247 ], ManagedFocusFeature.prototype, "postConstruct", null);
11248 return ManagedFocusFeature;
11249}(BeanStub));
11250
11251/**
11252 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
11253 * @version v27.3.0
11254 * @link https://www.ag-grid.com/
11255 * @license MIT
11256 */
11257var __extends$9 = (undefined && undefined.__extends) || (function () {
11258 var extendStatics = function (d, b) {
11259 extendStatics = Object.setPrototypeOf ||
11260 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11261 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
11262 return extendStatics(d, b);
11263 };
11264 return function (d, b) {
11265 extendStatics(d, b);
11266 function __() { this.constructor = d; }
11267 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11268 };
11269})();
11270var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11271 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11272 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11273 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;
11274 return c > 3 && r && Object.defineProperty(target, key, r), r;
11275};
11276/**
11277 * Contains common logic to all provided filters (apply button, clear button, etc).
11278 * All the filters that come with AG Grid extend this class. User filters do not
11279 * extend this class.
11280 *
11281 * @param M type of filter-model managed by the concrete sub-class that extends this type
11282 * @param V type of value managed by the concrete sub-class that extends this type
11283 */
11284var ProvidedFilter = /** @class */ (function (_super) {
11285 __extends$9(ProvidedFilter, _super);
11286 function ProvidedFilter(filterNameKey) {
11287 var _this = _super.call(this) || this;
11288 _this.filterNameKey = filterNameKey;
11289 _this.applyActive = false;
11290 _this.hidePopup = null;
11291 // after the user hits 'apply' the model gets copied to here. this is then the model that we use for
11292 // all filtering. so if user changes UI but doesn't hit apply, then the UI will be out of sync with this model.
11293 // this is what we want, as the UI should only become the 'active' filter once it's applied. when apply is
11294 // inactive, this model will be in sync (following the debounce ms). if the UI is not a valid filter
11295 // (eg the value is missing so nothing to filter on, or for set filter all checkboxes are checked so filter
11296 // not active) then this appliedModel will be null/undefined.
11297 _this.appliedModel = null;
11298 return _this;
11299 }
11300 ProvidedFilter.prototype.postConstruct = function () {
11301 this.resetTemplate(); // do this first to create the DOM
11302 this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {
11303 handleKeyDown: this.handleKeyDown.bind(this)
11304 }));
11305 };
11306 // override
11307 ProvidedFilter.prototype.handleKeyDown = function (e) { };
11308 ProvidedFilter.prototype.getFilterTitle = function () {
11309 return this.translate(this.filterNameKey);
11310 };
11311 ProvidedFilter.prototype.isFilterActive = function () {
11312 // filter is active if we have a valid applied model
11313 return !!this.appliedModel;
11314 };
11315 ProvidedFilter.prototype.resetTemplate = function (paramsMap) {
11316 var templateString = /* html */ "\n <div class=\"ag-filter-wrapper\">\n <div class=\"ag-filter-body-wrapper ag-" + this.getCssIdentifier() + "-body-wrapper\">\n " + this.createBodyTemplate() + "\n </div>\n </div>";
11317 this.setTemplate(templateString, paramsMap);
11318 };
11319 ProvidedFilter.prototype.isReadOnly = function () {
11320 return !!this.providedFilterParams.readOnly;
11321 };
11322 ProvidedFilter.prototype.init = function (params) {
11323 var _this = this;
11324 this.setParams(params);
11325 this.resetUiToDefaults(true).then(function () {
11326 _this.updateUiVisibility();
11327 _this.setupOnBtApplyDebounce();
11328 });
11329 };
11330 ProvidedFilter.prototype.setParams = function (params) {
11331 this.providedFilterParams = params;
11332 this.applyActive = ProvidedFilter.isUseApplyButton(params);
11333 this.createButtonPanel();
11334 };
11335 ProvidedFilter.prototype.createButtonPanel = function () {
11336 var _this = this;
11337 var buttons = this.providedFilterParams.buttons;
11338 if (!buttons || buttons.length < 1 || this.isReadOnly()) {
11339 return;
11340 }
11341 var eButtonsPanel = document.createElement('div');
11342 eButtonsPanel.classList.add('ag-filter-apply-panel');
11343 var addButton = function (type) {
11344 var text;
11345 var clickListener;
11346 switch (type) {
11347 case 'apply':
11348 text = _this.translate('applyFilter');
11349 clickListener = function (e) { return _this.onBtApply(false, false, e); };
11350 break;
11351 case 'clear':
11352 text = _this.translate('clearFilter');
11353 clickListener = function () { return _this.onBtClear(); };
11354 break;
11355 case 'reset':
11356 text = _this.translate('resetFilter');
11357 clickListener = function () { return _this.onBtReset(); };
11358 break;
11359 case 'cancel':
11360 text = _this.translate('cancelFilter');
11361 clickListener = function (e) { _this.onBtCancel(e); };
11362 break;
11363 default:
11364 console.warn('AG Grid: Unknown button type specified');
11365 return;
11366 }
11367 var button = loadTemplate(
11368 /* html */
11369 "<button\n type=\"button\"\n ref=\"" + type + "FilterButton\"\n class=\"ag-standard-button ag-filter-apply-panel-button\"\n >" + text + "\n </button>");
11370 eButtonsPanel.appendChild(button);
11371 _this.addManagedListener(button, 'click', clickListener);
11372 };
11373 convertToSet(buttons).forEach(function (type) { return addButton(type); });
11374 this.getGui().appendChild(eButtonsPanel);
11375 };
11376 // subclasses can override this to provide alternative debounce defaults
11377 ProvidedFilter.prototype.getDefaultDebounceMs = function () {
11378 return 0;
11379 };
11380 ProvidedFilter.prototype.setupOnBtApplyDebounce = function () {
11381 var debounceMs = ProvidedFilter.getDebounceMs(this.providedFilterParams, this.getDefaultDebounceMs());
11382 this.onBtApplyDebounce = debounce(this.onBtApply.bind(this), debounceMs);
11383 };
11384 ProvidedFilter.prototype.getModel = function () {
11385 return this.appliedModel ? this.appliedModel : null;
11386 };
11387 ProvidedFilter.prototype.setModel = function (model) {
11388 var _this = this;
11389 var promise = model != null ? this.setModelIntoUi(model) : this.resetUiToDefaults();
11390 return promise.then(function () {
11391 _this.updateUiVisibility();
11392 // we set the model from the GUI, rather than the provided model,
11393 // so the model is consistent, e.g. handling of null/undefined will be the same,
11394 // or if model is case insensitive, then casing is removed.
11395 _this.applyModel();
11396 });
11397 };
11398 ProvidedFilter.prototype.onBtCancel = function (e) {
11399 var _this = this;
11400 var currentModel = this.getModel();
11401 var afterAppliedFunc = function () {
11402 _this.onUiChanged(false, 'prevent');
11403 if (_this.providedFilterParams.closeOnApply) {
11404 _this.close(e);
11405 }
11406 };
11407 if (currentModel != null) {
11408 this.setModelIntoUi(currentModel).then(afterAppliedFunc);
11409 }
11410 else {
11411 this.resetUiToDefaults().then(afterAppliedFunc);
11412 }
11413 };
11414 ProvidedFilter.prototype.onBtClear = function () {
11415 var _this = this;
11416 this.resetUiToDefaults().then(function () { return _this.onUiChanged(); });
11417 };
11418 ProvidedFilter.prototype.onBtReset = function () {
11419 this.onBtClear();
11420 this.onBtApply();
11421 };
11422 /**
11423 * Applies changes made in the UI to the filter, and returns true if the model has changed.
11424 */
11425 ProvidedFilter.prototype.applyModel = function () {
11426 var newModel = this.getModelFromUi();
11427 if (!this.isModelValid(newModel)) {
11428 return false;
11429 }
11430 var previousModel = this.appliedModel;
11431 this.appliedModel = newModel;
11432 // models can be same if user pasted same content into text field, or maybe just changed the case
11433 // and it's a case insensitive filter
11434 return !this.areModelsEqual(previousModel, newModel);
11435 };
11436 ProvidedFilter.prototype.isModelValid = function (model) {
11437 return true;
11438 };
11439 ProvidedFilter.prototype.onBtApply = function (afterFloatingFilter, afterDataChange, e) {
11440 if (afterFloatingFilter === void 0) { afterFloatingFilter = false; }
11441 if (afterDataChange === void 0) { afterDataChange = false; }
11442 if (this.applyModel()) {
11443 // the floating filter uses 'afterFloatingFilter' info, so it doesn't refresh after filter changed if change
11444 // came from floating filter
11445 this.providedFilterParams.filterChangedCallback({ afterFloatingFilter: afterFloatingFilter, afterDataChange: afterDataChange });
11446 }
11447 var closeOnApply = this.providedFilterParams.closeOnApply;
11448 // only close if an apply button is visible, otherwise we'd be closing every time a change was made!
11449 if (closeOnApply && this.applyActive && !afterFloatingFilter && !afterDataChange) {
11450 this.close(e);
11451 }
11452 };
11453 ProvidedFilter.prototype.onNewRowsLoaded = function () {
11454 };
11455 ProvidedFilter.prototype.close = function (e) {
11456 if (!this.hidePopup) {
11457 return;
11458 }
11459 var keyboardEvent = e;
11460 var key = keyboardEvent && keyboardEvent.key;
11461 var params;
11462 if (key === 'Enter' || key === 'Space') {
11463 params = { keyboardEvent: keyboardEvent };
11464 }
11465 this.hidePopup(params);
11466 this.hidePopup = null;
11467 };
11468 /**
11469 * By default, if the change came from a floating filter it will be applied immediately, otherwise if there is no
11470 * apply button it will be applied after a debounce, otherwise it will not be applied at all. This behaviour can
11471 * be adjusted by using the apply parameter.
11472 */
11473 ProvidedFilter.prototype.onUiChanged = function (fromFloatingFilter, apply) {
11474 if (fromFloatingFilter === void 0) { fromFloatingFilter = false; }
11475 this.updateUiVisibility();
11476 this.providedFilterParams.filterModifiedCallback();
11477 if (this.applyActive && !this.isReadOnly) {
11478 var isValid = this.isModelValid(this.getModelFromUi());
11479 setDisabled(this.getRefElement('applyFilterButton'), !isValid);
11480 }
11481 if ((fromFloatingFilter && !apply) || apply === 'immediately') {
11482 this.onBtApply(fromFloatingFilter);
11483 }
11484 else if ((!this.applyActive && !apply) || apply === 'debounce') {
11485 this.onBtApplyDebounce();
11486 }
11487 };
11488 ProvidedFilter.prototype.afterGuiAttached = function (params) {
11489 if (params == null) {
11490 return;
11491 }
11492 this.hidePopup = params.hidePopup;
11493 };
11494 // static, as used by floating filter also
11495 ProvidedFilter.getDebounceMs = function (params, debounceDefault) {
11496 if (ProvidedFilter.isUseApplyButton(params)) {
11497 if (params.debounceMs != null) {
11498 console.warn('AG Grid: debounceMs is ignored when apply button is present');
11499 }
11500 return 0;
11501 }
11502 return params.debounceMs != null ? params.debounceMs : debounceDefault;
11503 };
11504 // static, as used by floating filter also
11505 ProvidedFilter.isUseApplyButton = function (params) {
11506 return !!params.buttons && params.buttons.indexOf('apply') >= 0;
11507 };
11508 ProvidedFilter.prototype.destroy = function () {
11509 this.hidePopup = null;
11510 _super.prototype.destroy.call(this);
11511 };
11512 ProvidedFilter.prototype.translate = function (key) {
11513 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
11514 return translate(key, DEFAULT_FILTER_LOCALE_TEXT[key]);
11515 };
11516 ProvidedFilter.prototype.getCellValue = function (rowNode) {
11517 var _a = this.providedFilterParams, api = _a.api, colDef = _a.colDef, column = _a.column, columnApi = _a.columnApi, context = _a.context;
11518 return this.providedFilterParams.valueGetter({
11519 api: api,
11520 colDef: colDef,
11521 column: column,
11522 columnApi: columnApi,
11523 context: context,
11524 data: rowNode.data,
11525 getValue: function (field) { return rowNode.data[field]; },
11526 node: rowNode,
11527 });
11528 };
11529 __decorate$d([
11530 Autowired('rowModel')
11531 ], ProvidedFilter.prototype, "rowModel", void 0);
11532 __decorate$d([
11533 Autowired('valueService')
11534 ], ProvidedFilter.prototype, "valueService", void 0);
11535 __decorate$d([
11536 PostConstruct
11537 ], ProvidedFilter.prototype, "postConstruct", null);
11538 return ProvidedFilter;
11539}(Component));
11540
11541/**
11542 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
11543 * @version v27.3.0
11544 * @link https://www.ag-grid.com/
11545 * @license MIT
11546 */
11547var __extends$a = (undefined && undefined.__extends) || (function () {
11548 var extendStatics = function (d, b) {
11549 extendStatics = Object.setPrototypeOf ||
11550 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11551 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
11552 return extendStatics(d, b);
11553 };
11554 return function (d, b) {
11555 extendStatics(d, b);
11556 function __() { this.constructor = d; }
11557 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11558 };
11559})();
11560var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11561 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11562 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11563 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;
11564 return c > 3 && r && Object.defineProperty(target, key, r), r;
11565};
11566var AgAbstractLabel = /** @class */ (function (_super) {
11567 __extends$a(AgAbstractLabel, _super);
11568 function AgAbstractLabel(config, template) {
11569 var _this = _super.call(this, template) || this;
11570 _this.labelSeparator = '';
11571 _this.labelAlignment = 'left';
11572 _this.label = '';
11573 _this.config = config || {};
11574 return _this;
11575 }
11576 AgAbstractLabel.prototype.postConstruct = function () {
11577 this.addCssClass('ag-labeled');
11578 this.eLabel.classList.add('ag-label');
11579 var _a = this.config, labelSeparator = _a.labelSeparator, label = _a.label, labelWidth = _a.labelWidth, labelAlignment = _a.labelAlignment;
11580 if (labelSeparator != null) {
11581 this.setLabelSeparator(labelSeparator);
11582 }
11583 if (label != null) {
11584 this.setLabel(label);
11585 }
11586 if (labelWidth != null) {
11587 this.setLabelWidth(labelWidth);
11588 }
11589 this.setLabelAlignment(labelAlignment || this.labelAlignment);
11590 this.refreshLabel();
11591 };
11592 AgAbstractLabel.prototype.refreshLabel = function () {
11593 clearElement(this.eLabel);
11594 if (typeof this.label === 'string') {
11595 this.eLabel.innerText = this.label + this.labelSeparator;
11596 }
11597 else if (this.label) {
11598 this.eLabel.appendChild(this.label);
11599 }
11600 if (this.label === '') {
11601 this.eLabel.classList.add('ag-hidden');
11602 setAriaRole(this.eLabel, 'presentation');
11603 }
11604 else {
11605 this.eLabel.classList.remove('ag-hidden');
11606 setAriaRole(this.eLabel, null);
11607 }
11608 };
11609 AgAbstractLabel.prototype.setLabelSeparator = function (labelSeparator) {
11610 if (this.labelSeparator === labelSeparator) {
11611 return this;
11612 }
11613 this.labelSeparator = labelSeparator;
11614 if (this.label != null) {
11615 this.refreshLabel();
11616 }
11617 return this;
11618 };
11619 AgAbstractLabel.prototype.getLabelId = function () {
11620 this.eLabel.id = this.eLabel.id || "ag-" + this.getCompId() + "-label";
11621 return this.eLabel.id;
11622 };
11623 AgAbstractLabel.prototype.getLabel = function () {
11624 return this.label;
11625 };
11626 AgAbstractLabel.prototype.setLabel = function (label) {
11627 if (this.label === label) {
11628 return this;
11629 }
11630 this.label = label;
11631 this.refreshLabel();
11632 return this;
11633 };
11634 AgAbstractLabel.prototype.setLabelAlignment = function (alignment) {
11635 var eGui = this.getGui();
11636 var eGuiClassList = eGui.classList;
11637 eGuiClassList.toggle('ag-label-align-left', alignment === 'left');
11638 eGuiClassList.toggle('ag-label-align-right', alignment === 'right');
11639 eGuiClassList.toggle('ag-label-align-top', alignment === 'top');
11640 return this;
11641 };
11642 AgAbstractLabel.prototype.setLabelWidth = function (width) {
11643 if (this.label == null) {
11644 return this;
11645 }
11646 setElementWidth(this.eLabel, width);
11647 return this;
11648 };
11649 __decorate$e([
11650 PostConstruct
11651 ], AgAbstractLabel.prototype, "postConstruct", null);
11652 return AgAbstractLabel;
11653}(Component));
11654
11655/**
11656 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
11657 * @version v27.3.0
11658 * @link https://www.ag-grid.com/
11659 * @license MIT
11660 */
11661var __extends$b = (undefined && undefined.__extends) || (function () {
11662 var extendStatics = function (d, b) {
11663 extendStatics = Object.setPrototypeOf ||
11664 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11665 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
11666 return extendStatics(d, b);
11667 };
11668 return function (d, b) {
11669 extendStatics(d, b);
11670 function __() { this.constructor = d; }
11671 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11672 };
11673})();
11674var AgAbstractField = /** @class */ (function (_super) {
11675 __extends$b(AgAbstractField, _super);
11676 function AgAbstractField(config, template, className) {
11677 var _this = _super.call(this, config, template) || this;
11678 _this.className = className;
11679 _this.disabled = false;
11680 return _this;
11681 }
11682 AgAbstractField.prototype.postConstruct = function () {
11683 _super.prototype.postConstruct.call(this);
11684 if (this.className) {
11685 this.addCssClass(this.className);
11686 }
11687 };
11688 AgAbstractField.prototype.onValueChange = function (callbackFn) {
11689 var _this = this;
11690 this.addManagedListener(this, AgAbstractField.EVENT_CHANGED, function () { return callbackFn(_this.getValue()); });
11691 return this;
11692 };
11693 AgAbstractField.prototype.getWidth = function () {
11694 return this.getGui().clientWidth;
11695 };
11696 AgAbstractField.prototype.setWidth = function (width) {
11697 setFixedWidth(this.getGui(), width);
11698 return this;
11699 };
11700 AgAbstractField.prototype.getPreviousValue = function () {
11701 return this.previousValue;
11702 };
11703 AgAbstractField.prototype.getValue = function () {
11704 return this.value;
11705 };
11706 AgAbstractField.prototype.setValue = function (value, silent) {
11707 if (this.value === value) {
11708 return this;
11709 }
11710 this.previousValue = this.value;
11711 this.value = value;
11712 if (!silent) {
11713 this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
11714 }
11715 return this;
11716 };
11717 AgAbstractField.prototype.setDisabled = function (disabled) {
11718 disabled = !!disabled;
11719 var element = this.getGui();
11720 setDisabled(element, disabled);
11721 element.classList.toggle('ag-disabled', disabled);
11722 this.disabled = disabled;
11723 return this;
11724 };
11725 AgAbstractField.prototype.isDisabled = function () {
11726 return !!this.disabled;
11727 };
11728 AgAbstractField.EVENT_CHANGED = 'valueChange';
11729 return AgAbstractField;
11730}(AgAbstractLabel));
11731
11732/**
11733 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
11734 * @version v27.3.0
11735 * @link https://www.ag-grid.com/
11736 * @license MIT
11737 */
11738var __extends$c = (undefined && undefined.__extends) || (function () {
11739 var extendStatics = function (d, b) {
11740 extendStatics = Object.setPrototypeOf ||
11741 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11742 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
11743 return extendStatics(d, b);
11744 };
11745 return function (d, b) {
11746 extendStatics(d, b);
11747 function __() { this.constructor = d; }
11748 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11749 };
11750})();
11751var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11752 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11753 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11754 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;
11755 return c > 3 && r && Object.defineProperty(target, key, r), r;
11756};
11757var AgPickerField = /** @class */ (function (_super) {
11758 __extends$c(AgPickerField, _super);
11759 function AgPickerField(config, className, pickerIcon, ariaRole) {
11760 var _this = _super.call(this, config,
11761 /* html */ "<div class=\"ag-picker-field\" role=\"presentation\">\n <div ref=\"eLabel\"></div>\n <div ref=\"eWrapper\"\n class=\"ag-wrapper ag-picker-field-wrapper\"\n tabIndex=\"-1\"\n aria-expanded=\"false\"\n " + (ariaRole ? "role=\"" + ariaRole + "\"" : '') + "\n >\n <div ref=\"eDisplayField\" class=\"ag-picker-field-display\"></div>\n <div ref=\"eIcon\" class=\"ag-picker-field-icon\" aria-hidden=\"true\"></div>\n </div>\n </div>", className) || this;
11762 _this.pickerIcon = pickerIcon;
11763 _this.isPickerDisplayed = false;
11764 _this.isDestroyingPicker = false;
11765 _this.skipClick = false;
11766 return _this;
11767 }
11768 AgPickerField.prototype.postConstruct = function () {
11769 var _this = this;
11770 _super.prototype.postConstruct.call(this);
11771 var displayId = this.getCompId() + "-display";
11772 this.eDisplayField.setAttribute('id', displayId);
11773 setAriaDescribedBy(this.eWrapper, displayId);
11774 var clickHandler = function () {
11775 if (_this.skipClick) {
11776 _this.skipClick = false;
11777 return;
11778 }
11779 if (_this.isDisabled()) {
11780 return;
11781 }
11782 _this.pickerComponent = _this.showPicker();
11783 };
11784 var eGui = this.getGui();
11785 this.addManagedListener(eGui, 'mousedown', function (e) {
11786 if (!_this.skipClick &&
11787 _this.pickerComponent &&
11788 _this.pickerComponent.isAlive() &&
11789 isVisible(_this.pickerComponent.getGui()) &&
11790 eGui.contains(e.target)) {
11791 _this.skipClick = true;
11792 }
11793 });
11794 this.addManagedListener(eGui, 'keydown', function (e) {
11795 switch (e.key) {
11796 case KeyCode.UP:
11797 case KeyCode.DOWN:
11798 case KeyCode.ENTER:
11799 case KeyCode.SPACE:
11800 clickHandler();
11801 case KeyCode.ESCAPE:
11802 if (_this.isPickerDisplayed) {
11803 e.preventDefault();
11804 }
11805 break;
11806 }
11807 });
11808 this.addManagedListener(this.eWrapper, 'click', clickHandler);
11809 this.addManagedListener(this.eLabel, 'click', clickHandler);
11810 if (this.pickerIcon) {
11811 var icon = createIconNoSpan(this.pickerIcon, this.gridOptionsWrapper);
11812 if (icon) {
11813 this.eIcon.appendChild(icon);
11814 }
11815 }
11816 };
11817 AgPickerField.prototype.refreshLabel = function () {
11818 if (exists(this.getLabel())) {
11819 setAriaLabelledBy(this.eWrapper, this.getLabelId());
11820 }
11821 else {
11822 this.eWrapper.removeAttribute('aria-labelledby');
11823 }
11824 _super.prototype.refreshLabel.call(this);
11825 };
11826 AgPickerField.prototype.setAriaLabel = function (label) {
11827 setAriaLabel(this.eWrapper, label);
11828 return this;
11829 };
11830 AgPickerField.prototype.setInputWidth = function (width) {
11831 setElementWidth(this.eWrapper, width);
11832 return this;
11833 };
11834 AgPickerField.prototype.getFocusableElement = function () {
11835 return this.eWrapper;
11836 };
11837 __decorate$f([
11838 RefSelector('eLabel')
11839 ], AgPickerField.prototype, "eLabel", void 0);
11840 __decorate$f([
11841 RefSelector('eWrapper')
11842 ], AgPickerField.prototype, "eWrapper", void 0);
11843 __decorate$f([
11844 RefSelector('eDisplayField')
11845 ], AgPickerField.prototype, "eDisplayField", void 0);
11846 __decorate$f([
11847 RefSelector('eIcon')
11848 ], AgPickerField.prototype, "eIcon", void 0);
11849 return AgPickerField;
11850}(AgAbstractField));
11851
11852/**
11853 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
11854 * @version v27.3.0
11855 * @link https://www.ag-grid.com/
11856 * @license MIT
11857 */
11858var __extends$d = (undefined && undefined.__extends) || (function () {
11859 var extendStatics = function (d, b) {
11860 extendStatics = Object.setPrototypeOf ||
11861 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11862 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
11863 return extendStatics(d, b);
11864 };
11865 return function (d, b) {
11866 extendStatics(d, b);
11867 function __() { this.constructor = d; }
11868 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11869 };
11870})();
11871var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11872 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11873 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11874 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;
11875 return c > 3 && r && Object.defineProperty(target, key, r), r;
11876};
11877var AgList = /** @class */ (function (_super) {
11878 __extends$d(AgList, _super);
11879 function AgList(cssIdentifier) {
11880 if (cssIdentifier === void 0) { cssIdentifier = 'default'; }
11881 var _this = _super.call(this, /* html */ "<div class=\"ag-list ag-" + cssIdentifier + "-list\" role=\"listbox\"></div>") || this;
11882 _this.cssIdentifier = cssIdentifier;
11883 _this.options = [];
11884 _this.itemEls = [];
11885 return _this;
11886 }
11887 AgList.prototype.init = function () {
11888 this.addManagedListener(this.getGui(), 'keydown', this.handleKeyDown.bind(this));
11889 };
11890 AgList.prototype.handleKeyDown = function (e) {
11891 var key = e.key;
11892 switch (key) {
11893 case KeyCode.ENTER:
11894 if (!this.highlightedEl) {
11895 this.setValue(this.getValue());
11896 }
11897 else {
11898 var pos = this.itemEls.indexOf(this.highlightedEl);
11899 this.setValueByIndex(pos);
11900 }
11901 break;
11902 case KeyCode.DOWN:
11903 case KeyCode.UP:
11904 var isDown = key === KeyCode.DOWN;
11905 var itemToHighlight = void 0;
11906 e.preventDefault();
11907 if (!this.highlightedEl) {
11908 itemToHighlight = this.itemEls[isDown ? 0 : this.itemEls.length - 1];
11909 }
11910 else {
11911 var currentIdx = this.itemEls.indexOf(this.highlightedEl);
11912 var nextPos = currentIdx + (isDown ? 1 : -1);
11913 nextPos = Math.min(Math.max(nextPos, 0), this.itemEls.length - 1);
11914 itemToHighlight = this.itemEls[nextPos];
11915 }
11916 this.highlightItem(itemToHighlight);
11917 break;
11918 }
11919 };
11920 AgList.prototype.addOptions = function (listOptions) {
11921 var _this = this;
11922 listOptions.forEach(function (listOption) { return _this.addOption(listOption); });
11923 return this;
11924 };
11925 AgList.prototype.addOption = function (listOption) {
11926 var value = listOption.value, text = listOption.text;
11927 var sanitisedText = escapeString(text || value);
11928 this.options.push({ value: value, text: sanitisedText });
11929 this.renderOption(value, sanitisedText);
11930 this.updateIndices();
11931 return this;
11932 };
11933 AgList.prototype.updateIndices = function () {
11934 var options = this.getGui().querySelectorAll('.ag-list-item');
11935 options.forEach(function (option, idx) {
11936 setAriaPosInSet(option, idx + 1);
11937 setAriaSetSize(option, options.length);
11938 });
11939 };
11940 AgList.prototype.renderOption = function (value, text) {
11941 var _this = this;
11942 var itemEl = document.createElement('div');
11943 setAriaRole(itemEl, 'option');
11944 itemEl.classList.add('ag-list-item', "ag-" + this.cssIdentifier + "-list-item");
11945 itemEl.innerHTML = "<span>" + text + "</span>";
11946 itemEl.tabIndex = -1;
11947 this.itemEls.push(itemEl);
11948 this.addManagedListener(itemEl, 'mouseover', function () { return _this.highlightItem(itemEl); });
11949 this.addManagedListener(itemEl, 'mouseleave', function () { return _this.clearHighlighted(); });
11950 this.addManagedListener(itemEl, 'click', function () { return _this.setValue(value); });
11951 this.getGui().appendChild(itemEl);
11952 };
11953 AgList.prototype.setValue = function (value, silent) {
11954 if (this.value === value) {
11955 this.fireItemSelected();
11956 return this;
11957 }
11958 if (value == null) {
11959 this.reset();
11960 return this;
11961 }
11962 var idx = this.options.findIndex(function (option) { return option.value === value; });
11963 if (idx !== -1) {
11964 var option = this.options[idx];
11965 this.value = option.value;
11966 this.displayValue = option.text != null ? option.text : option.value;
11967 this.highlightItem(this.itemEls[idx]);
11968 if (!silent) {
11969 this.fireChangeEvent();
11970 }
11971 }
11972 return this;
11973 };
11974 AgList.prototype.setValueByIndex = function (idx) {
11975 return this.setValue(this.options[idx].value);
11976 };
11977 AgList.prototype.getValue = function () {
11978 return this.value;
11979 };
11980 AgList.prototype.getDisplayValue = function () {
11981 return this.displayValue;
11982 };
11983 AgList.prototype.refreshHighlighted = function () {
11984 var _this = this;
11985 this.clearHighlighted();
11986 var idx = this.options.findIndex(function (option) { return option.value === _this.value; });
11987 if (idx !== -1) {
11988 this.highlightItem(this.itemEls[idx]);
11989 }
11990 };
11991 AgList.prototype.reset = function () {
11992 this.value = null;
11993 this.displayValue = null;
11994 this.clearHighlighted();
11995 this.fireChangeEvent();
11996 };
11997 AgList.prototype.highlightItem = function (el) {
11998 if (!el.offsetParent) {
11999 return;
12000 }
12001 this.clearHighlighted();
12002 this.highlightedEl = el;
12003 this.highlightedEl.classList.add(AgList.ACTIVE_CLASS);
12004 setAriaSelected(this.highlightedEl, true);
12005 this.highlightedEl.focus();
12006 };
12007 AgList.prototype.clearHighlighted = function () {
12008 if (!this.highlightedEl || !this.highlightedEl.offsetParent) {
12009 return;
12010 }
12011 this.highlightedEl.classList.remove(AgList.ACTIVE_CLASS);
12012 setAriaSelected(this.highlightedEl, false);
12013 this.highlightedEl = null;
12014 };
12015 AgList.prototype.fireChangeEvent = function () {
12016 this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
12017 this.fireItemSelected();
12018 };
12019 AgList.prototype.fireItemSelected = function () {
12020 this.dispatchEvent({ type: AgList.EVENT_ITEM_SELECTED });
12021 };
12022 AgList.EVENT_ITEM_SELECTED = 'selectedItem';
12023 AgList.ACTIVE_CLASS = 'ag-active-item';
12024 __decorate$g([
12025 PostConstruct
12026 ], AgList.prototype, "init", null);
12027 return AgList;
12028}(Component));
12029
12030/**
12031 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
12032 * @version v27.3.0
12033 * @link https://www.ag-grid.com/
12034 * @license MIT
12035 */
12036var __extends$e = (undefined && undefined.__extends) || (function () {
12037 var extendStatics = function (d, b) {
12038 extendStatics = Object.setPrototypeOf ||
12039 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
12040 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
12041 return extendStatics(d, b);
12042 };
12043 return function (d, b) {
12044 extendStatics(d, b);
12045 function __() { this.constructor = d; }
12046 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12047 };
12048})();
12049var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12050 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12051 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12052 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;
12053 return c > 3 && r && Object.defineProperty(target, key, r), r;
12054};
12055var AgSelect = /** @class */ (function (_super) {
12056 __extends$e(AgSelect, _super);
12057 function AgSelect(config) {
12058 return _super.call(this, config, 'ag-select', 'smallDown', 'listbox') || this;
12059 }
12060 AgSelect.prototype.init = function () {
12061 var _this = this;
12062 this.listComponent = this.createBean(new AgList('select'));
12063 this.listComponent.setParentComponent(this);
12064 this.eWrapper.tabIndex = 0;
12065 this.listComponent.addManagedListener(this.listComponent, AgList.EVENT_ITEM_SELECTED, function () { if (_this.hideList) {
12066 _this.hideList();
12067 } });
12068 this.listComponent.addManagedListener(this.listComponent, AgAbstractField.EVENT_CHANGED, function () {
12069 _this.setValue(_this.listComponent.getValue(), false, true);
12070 if (_this.hideList) {
12071 _this.hideList();
12072 }
12073 });
12074 };
12075 AgSelect.prototype.showPicker = function () {
12076 var _this = this;
12077 var listGui = this.listComponent.getGui();
12078 var eDocument = this.gridOptionsWrapper.getDocument();
12079 var destroyMouseWheelFunc = this.addManagedListener(eDocument.body, 'wheel', function (e) {
12080 if (!listGui.contains(e.target) && _this.hideList) {
12081 _this.hideList();
12082 }
12083 });
12084 var destroyFocusOutFunc = this.addManagedListener(listGui, 'focusout', function (e) {
12085 if (!listGui.contains(e.relatedTarget) && _this.hideList) {
12086 _this.hideList();
12087 }
12088 });
12089 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
12090 var addPopupRes = this.popupService.addPopup({
12091 modal: true,
12092 eChild: listGui,
12093 closeOnEsc: true,
12094 closedCallback: function () {
12095 _this.hideList = null;
12096 _this.isPickerDisplayed = false;
12097 destroyFocusOutFunc();
12098 destroyMouseWheelFunc();
12099 if (_this.isAlive()) {
12100 setAriaExpanded(_this.eWrapper, false);
12101 _this.getFocusableElement().focus();
12102 }
12103 },
12104 ariaLabel: translate('ariaLabelSelectField', 'Select Field')
12105 });
12106 if (addPopupRes) {
12107 this.hideList = addPopupRes.hideFunc;
12108 }
12109 this.isPickerDisplayed = true;
12110 setElementWidth(listGui, getAbsoluteWidth(this.eWrapper));
12111 setAriaExpanded(this.eWrapper, true);
12112 listGui.style.maxHeight = getInnerHeight(this.popupService.getPopupParent()) + 'px';
12113 listGui.style.position = 'absolute';
12114 this.popupService.positionPopupUnderComponent({
12115 type: 'ag-list',
12116 eventSource: this.eWrapper,
12117 ePopup: listGui,
12118 keepWithinBounds: true
12119 });
12120 this.listComponent.refreshHighlighted();
12121 return this.listComponent;
12122 };
12123 AgSelect.prototype.addOptions = function (options) {
12124 var _this = this;
12125 options.forEach(function (option) { return _this.addOption(option); });
12126 return this;
12127 };
12128 AgSelect.prototype.addOption = function (option) {
12129 this.listComponent.addOption(option);
12130 return this;
12131 };
12132 AgSelect.prototype.setValue = function (value, silent, fromPicker) {
12133 if (this.value === value) {
12134 return this;
12135 }
12136 if (!fromPicker) {
12137 this.listComponent.setValue(value, true);
12138 }
12139 var newValue = this.listComponent.getValue();
12140 if (newValue === this.getValue()) {
12141 return this;
12142 }
12143 this.eDisplayField.innerHTML = this.listComponent.getDisplayValue();
12144 return _super.prototype.setValue.call(this, value, silent);
12145 };
12146 AgSelect.prototype.destroy = function () {
12147 if (this.hideList) {
12148 this.hideList();
12149 }
12150 this.destroyBean(this.listComponent);
12151 _super.prototype.destroy.call(this);
12152 };
12153 __decorate$h([
12154 Autowired('popupService')
12155 ], AgSelect.prototype, "popupService", void 0);
12156 __decorate$h([
12157 PostConstruct
12158 ], AgSelect.prototype, "init", null);
12159 return AgSelect;
12160}(AgPickerField));
12161
12162/**
12163 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
12164 * @version v27.3.0
12165 * @link https://www.ag-grid.com/
12166 * @license MIT
12167 */
12168var __extends$f = (undefined && undefined.__extends) || (function () {
12169 var extendStatics = function (d, b) {
12170 extendStatics = Object.setPrototypeOf ||
12171 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
12172 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
12173 return extendStatics(d, b);
12174 };
12175 return function (d, b) {
12176 extendStatics(d, b);
12177 function __() { this.constructor = d; }
12178 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12179 };
12180})();
12181var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12182 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12183 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12184 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;
12185 return c > 3 && r && Object.defineProperty(target, key, r), r;
12186};
12187var AgAbstractInputField = /** @class */ (function (_super) {
12188 __extends$f(AgAbstractInputField, _super);
12189 function AgAbstractInputField(config, className, inputType, displayFieldTag) {
12190 if (inputType === void 0) { inputType = 'text'; }
12191 if (displayFieldTag === void 0) { displayFieldTag = 'input'; }
12192 var _this = _super.call(this, config, /* html */ "\n <div role=\"presentation\">\n <div ref=\"eLabel\" class=\"ag-input-field-label\"></div>\n <div ref=\"eWrapper\" class=\"ag-wrapper ag-input-wrapper\" role=\"presentation\">\n <" + displayFieldTag + " ref=\"eInput\" class=\"ag-input-field-input\"></" + displayFieldTag + ">\n </div>\n </div>", className) || this;
12193 _this.inputType = inputType;
12194 _this.displayFieldTag = displayFieldTag;
12195 return _this;
12196 }
12197 AgAbstractInputField.prototype.postConstruct = function () {
12198 _super.prototype.postConstruct.call(this);
12199 this.setInputType();
12200 this.eLabel.classList.add(this.className + "-label");
12201 this.eWrapper.classList.add(this.className + "-input-wrapper");
12202 this.eInput.classList.add(this.className + "-input");
12203 this.addCssClass('ag-input-field');
12204 this.eInput.id = this.eInput.id || "ag-" + this.getCompId() + "-input";
12205 var _a = this.config, width = _a.width, value = _a.value;
12206 if (width != null) {
12207 this.setWidth(width);
12208 }
12209 if (value != null) {
12210 this.setValue(value);
12211 }
12212 this.addInputListeners();
12213 };
12214 AgAbstractInputField.prototype.refreshLabel = function () {
12215 if (exists(this.getLabel())) {
12216 setAriaLabelledBy(this.eInput, this.getLabelId());
12217 }
12218 else {
12219 this.eInput.removeAttribute('aria-labelledby');
12220 }
12221 _super.prototype.refreshLabel.call(this);
12222 };
12223 AgAbstractInputField.prototype.addInputListeners = function () {
12224 var _this = this;
12225 this.addManagedListener(this.eInput, 'input', function (e) { return _this.setValue(e.target.value); });
12226 };
12227 AgAbstractInputField.prototype.setInputType = function () {
12228 if (this.displayFieldTag === 'input') {
12229 this.eInput.setAttribute('type', this.inputType);
12230 }
12231 };
12232 AgAbstractInputField.prototype.getInputElement = function () {
12233 return this.eInput;
12234 };
12235 AgAbstractInputField.prototype.setInputWidth = function (width) {
12236 setElementWidth(this.eWrapper, width);
12237 return this;
12238 };
12239 AgAbstractInputField.prototype.setInputName = function (name) {
12240 this.getInputElement().setAttribute('name', name);
12241 return this;
12242 };
12243 AgAbstractInputField.prototype.getFocusableElement = function () {
12244 return this.eInput;
12245 };
12246 AgAbstractInputField.prototype.setMaxLength = function (length) {
12247 var eInput = this.eInput;
12248 eInput.maxLength = length;
12249 return this;
12250 };
12251 AgAbstractInputField.prototype.setInputPlaceholder = function (placeholder) {
12252 addOrRemoveAttribute(this.eInput, 'placeholder', placeholder);
12253 return this;
12254 };
12255 AgAbstractInputField.prototype.setInputAriaLabel = function (label) {
12256 setAriaLabel(this.eInput, label);
12257 return this;
12258 };
12259 AgAbstractInputField.prototype.setDisabled = function (disabled) {
12260 setDisabled(this.eInput, disabled);
12261 return _super.prototype.setDisabled.call(this, disabled);
12262 };
12263 __decorate$i([
12264 RefSelector('eLabel')
12265 ], AgAbstractInputField.prototype, "eLabel", void 0);
12266 __decorate$i([
12267 RefSelector('eWrapper')
12268 ], AgAbstractInputField.prototype, "eWrapper", void 0);
12269 __decorate$i([
12270 RefSelector('eInput')
12271 ], AgAbstractInputField.prototype, "eInput", void 0);
12272 return AgAbstractInputField;
12273}(AgAbstractField));
12274
12275/**
12276 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
12277 * @version v27.3.0
12278 * @link https://www.ag-grid.com/
12279 * @license MIT
12280 */
12281var __extends$g = (undefined && undefined.__extends) || (function () {
12282 var extendStatics = function (d, b) {
12283 extendStatics = Object.setPrototypeOf ||
12284 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
12285 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
12286 return extendStatics(d, b);
12287 };
12288 return function (d, b) {
12289 extendStatics(d, b);
12290 function __() { this.constructor = d; }
12291 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12292 };
12293})();
12294var __decorate$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12295 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12296 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12297 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;
12298 return c > 3 && r && Object.defineProperty(target, key, r), r;
12299};
12300var ConditionPosition;
12301(function (ConditionPosition) {
12302 ConditionPosition[ConditionPosition["One"] = 0] = "One";
12303 ConditionPosition[ConditionPosition["Two"] = 1] = "Two";
12304})(ConditionPosition || (ConditionPosition = {}));
12305/**
12306 * Every filter with a dropdown where the user can specify a comparing type against the filter values.
12307 *
12308 * @param M type of filter-model managed by the concrete sub-class that extends this type
12309 * @param V type of value managed by the concrete sub-class that extends this type
12310 * @param E type of UI element used for collecting user-input
12311 */
12312var SimpleFilter = /** @class */ (function (_super) {
12313 __extends$g(SimpleFilter, _super);
12314 function SimpleFilter() {
12315 return _super !== null && _super.apply(this, arguments) || this;
12316 }
12317 SimpleFilter.prototype.getNumberOfInputs = function (type) {
12318 var customOpts = this.optionsFactory.getCustomOption(type);
12319 if (customOpts) {
12320 var numberOfInputs = customOpts.numberOfInputs;
12321 return numberOfInputs != null ? numberOfInputs : 1;
12322 }
12323 var zeroInputTypes = [
12324 SimpleFilter.EMPTY, SimpleFilter.NOT_BLANK, SimpleFilter.BLANK,
12325 ];
12326 if (type && zeroInputTypes.indexOf(type) >= 0) {
12327 return 0;
12328 }
12329 else if (type === SimpleFilter.IN_RANGE) {
12330 return 2;
12331 }
12332 return 1;
12333 };
12334 // floating filter calls this when user applies filter from floating filter
12335 SimpleFilter.prototype.onFloatingFilterChanged = function (type, value) {
12336 this.setTypeFromFloatingFilter(type);
12337 this.setValueFromFloatingFilter(value);
12338 this.onUiChanged(true);
12339 };
12340 SimpleFilter.prototype.setTypeFromFloatingFilter = function (type) {
12341 this.eType1.setValue(type);
12342 this.eType2.setValue(this.optionsFactory.getDefaultOption());
12343 (this.isDefaultOperator('AND') ? this.eJoinOperatorAnd : this.eJoinOperatorOr).setValue(true);
12344 };
12345 SimpleFilter.prototype.getModelFromUi = function () {
12346 if (!this.isConditionUiComplete(ConditionPosition.One)) {
12347 return null;
12348 }
12349 if (this.isAllowTwoConditions() && this.isConditionUiComplete(ConditionPosition.Two)) {
12350 return {
12351 filterType: this.getFilterType(),
12352 operator: this.getJoinOperator(),
12353 condition1: this.createCondition(ConditionPosition.One),
12354 condition2: this.createCondition(ConditionPosition.Two)
12355 };
12356 }
12357 return this.createCondition(ConditionPosition.One);
12358 };
12359 SimpleFilter.prototype.getConditionTypes = function () {
12360 return [
12361 this.eType1.getValue(),
12362 this.eType2.getValue(),
12363 ];
12364 };
12365 SimpleFilter.prototype.getJoinOperator = function () {
12366 return this.eJoinOperatorOr.getValue() === true ? 'OR' : 'AND';
12367 };
12368 SimpleFilter.prototype.areModelsEqual = function (a, b) {
12369 // both are missing
12370 if (!a && !b) {
12371 return true;
12372 }
12373 // one is missing, other present
12374 if ((!a && b) || (a && !b)) {
12375 return false;
12376 }
12377 // one is combined, the other is not
12378 var aIsSimple = !a.operator;
12379 var bIsSimple = !b.operator;
12380 var oneSimpleOneCombined = (!aIsSimple && bIsSimple) || (aIsSimple && !bIsSimple);
12381 if (oneSimpleOneCombined) {
12382 return false;
12383 }
12384 var res;
12385 // otherwise both present, so compare
12386 if (aIsSimple) {
12387 var aSimple = a;
12388 var bSimple = b;
12389 res = this.areSimpleModelsEqual(aSimple, bSimple);
12390 }
12391 else {
12392 var aCombined = a;
12393 var bCombined = b;
12394 res = aCombined.operator === bCombined.operator
12395 && this.areSimpleModelsEqual(aCombined.condition1, bCombined.condition1)
12396 && this.areSimpleModelsEqual(aCombined.condition2, bCombined.condition2);
12397 }
12398 return res;
12399 };
12400 SimpleFilter.prototype.setModelIntoUi = function (model) {
12401 var isCombined = model.operator;
12402 if (isCombined) {
12403 var combinedModel = model;
12404 var orChecked = combinedModel.operator === 'OR';
12405 this.eJoinOperatorAnd.setValue(!orChecked);
12406 this.eJoinOperatorOr.setValue(orChecked);
12407 this.eType1.setValue(combinedModel.condition1.type);
12408 this.eType2.setValue(combinedModel.condition2.type);
12409 this.setConditionIntoUi(combinedModel.condition1, ConditionPosition.One);
12410 this.setConditionIntoUi(combinedModel.condition2, ConditionPosition.Two);
12411 }
12412 else {
12413 var simpleModel = model;
12414 this.eJoinOperatorAnd.setValue(this.isDefaultOperator('AND'));
12415 this.eJoinOperatorOr.setValue(this.isDefaultOperator('OR'));
12416 this.eType1.setValue(simpleModel.type);
12417 this.eType2.setValue(this.optionsFactory.getDefaultOption());
12418 this.setConditionIntoUi(simpleModel, ConditionPosition.One);
12419 this.setConditionIntoUi(null, ConditionPosition.Two);
12420 }
12421 return AgPromise.resolve();
12422 };
12423 SimpleFilter.prototype.doesFilterPass = function (params) {
12424 var _this = this;
12425 var model = this.getModel();
12426 if (model == null) {
12427 return true;
12428 }
12429 var operator = model.operator;
12430 var models = [];
12431 if (operator) {
12432 var combinedModel = model;
12433 models.push(combinedModel.condition1, combinedModel.condition2);
12434 }
12435 else {
12436 models.push(model);
12437 }
12438 var combineFunction = operator && operator === 'OR' ? 'some' : 'every';
12439 return models[combineFunction](function (m) { return _this.individualConditionPasses(params, m); });
12440 };
12441 SimpleFilter.prototype.setParams = function (params) {
12442 _super.prototype.setParams.call(this, params);
12443 this.optionsFactory = new OptionsFactory();
12444 this.optionsFactory.init(params, this.getDefaultFilterOptions());
12445 this.allowTwoConditions = !params.suppressAndOrCondition;
12446 this.alwaysShowBothConditions = !!params.alwaysShowBothConditions;
12447 this.defaultJoinOperator = this.getDefaultJoinOperator(params.defaultJoinOperator);
12448 this.putOptionsIntoDropdown();
12449 this.addChangedListeners();
12450 };
12451 SimpleFilter.prototype.getDefaultJoinOperator = function (defaultJoinOperator) {
12452 return includes(['AND', 'OR'], defaultJoinOperator) ? defaultJoinOperator : 'AND';
12453 };
12454 SimpleFilter.prototype.putOptionsIntoDropdown = function () {
12455 var _this = this;
12456 var filterOptions = this.optionsFactory.getFilterOptions();
12457 var eTypes = [this.eType1, this.eType2];
12458 // Add specified options to all condition drop-downs.
12459 filterOptions.forEach(function (option) {
12460 var listOption = typeof option === 'string' ?
12461 _this.createBoilerplateListOption(option) :
12462 _this.createCustomListOption(option);
12463 eTypes.forEach(function (eType) { return eType.addOption(listOption); });
12464 });
12465 // Make drop-downs read-only if there is only one option.
12466 eTypes.forEach(function (eType) { return eType.setDisabled(filterOptions.length <= 1); });
12467 };
12468 SimpleFilter.prototype.createBoilerplateListOption = function (option) {
12469 return { value: option, text: this.translate(option) };
12470 };
12471 SimpleFilter.prototype.createCustomListOption = function (option) {
12472 var displayKey = option.displayKey;
12473 var customOption = this.optionsFactory.getCustomOption(option.displayKey);
12474 return {
12475 value: displayKey,
12476 text: customOption ?
12477 this.gridOptionsWrapper.getLocaleTextFunc()(customOption.displayKey, customOption.displayName) :
12478 this.translate(displayKey),
12479 };
12480 };
12481 SimpleFilter.prototype.isAllowTwoConditions = function () {
12482 return this.allowTwoConditions;
12483 };
12484 SimpleFilter.prototype.createBodyTemplate = function () {
12485 return /* html */ "\n <ag-select class=\"ag-filter-select\" ref=\"eOptions1\"></ag-select>\n " + this.createValueTemplate(ConditionPosition.One) + "\n <div class=\"ag-filter-condition\" ref=\"eJoinOperatorPanel\">\n <ag-radio-button ref=\"eJoinOperatorAnd\" class=\"ag-filter-condition-operator ag-filter-condition-operator-and\"></ag-radio-button>\n <ag-radio-button ref=\"eJoinOperatorOr\" class=\"ag-filter-condition-operator ag-filter-condition-operator-or\"></ag-radio-button>\n </div>\n <ag-select class=\"ag-filter-select\" ref=\"eOptions2\"></ag-select>\n " + this.createValueTemplate(ConditionPosition.Two);
12486 };
12487 SimpleFilter.prototype.getCssIdentifier = function () {
12488 return 'simple-filter';
12489 };
12490 SimpleFilter.prototype.updateUiVisibility = function () {
12491 var _this = this;
12492 var elementConditionGroups = [
12493 [this.eType1],
12494 [this.eType2, this.eJoinOperatorPanel, this.eJoinOperatorAnd, this.eJoinOperatorOr],
12495 ];
12496 var elementBodies = [this.eCondition1Body, this.eCondition2Body];
12497 elementConditionGroups.forEach(function (group, position) {
12498 var visible = _this.isConditionVisible(position);
12499 var disabled = _this.isConditionDisabled(position);
12500 group.forEach(function (element) {
12501 if (element instanceof AgAbstractInputField || element instanceof AgSelect) {
12502 element.setDisabled(disabled);
12503 element.setDisplayed(visible);
12504 }
12505 else {
12506 setDisabled(element, disabled);
12507 setDisplayed(element, visible);
12508 }
12509 });
12510 });
12511 elementBodies.forEach(function (element, index) {
12512 setDisplayed(element, _this.isConditionBodyVisible(index));
12513 });
12514 this.forEachInput(function (element, index, position, numberOfInputs) {
12515 _this.setElementDisplayed(element, index < numberOfInputs);
12516 _this.setElementDisabled(element, _this.isConditionDisabled(position));
12517 });
12518 this.resetPlaceholder();
12519 };
12520 SimpleFilter.prototype.afterGuiAttached = function (params) {
12521 _super.prototype.afterGuiAttached.call(this, params);
12522 this.resetPlaceholder();
12523 if (!params || (!params.suppressFocus && !this.isReadOnly())) {
12524 var firstInput = this.getInputs()[0][0];
12525 if (!firstInput) {
12526 return;
12527 }
12528 if (firstInput instanceof AgAbstractInputField) {
12529 firstInput.getInputElement().focus();
12530 }
12531 }
12532 };
12533 // allow sub-classes to reset HTML placeholders after UI update.
12534 SimpleFilter.prototype.resetPlaceholder = function () {
12535 var _this = this;
12536 var globalTranslate = this.gridOptionsWrapper.getLocaleTextFunc();
12537 this.forEachInput(function (element, index, _, numberOfInputs) {
12538 if (!(element instanceof AgAbstractInputField)) {
12539 return;
12540 }
12541 var placeholder = index === 0 && numberOfInputs > 1 ? 'inRangeStart' :
12542 index === 0 ? 'filterOoo' :
12543 'inRangeEnd';
12544 var ariaLabel = index === 0 && numberOfInputs > 1 ? globalTranslate('ariaFilterFromValue', 'Filter from value') :
12545 index === 0 ? globalTranslate('ariaFilterValue', 'Filter Value') :
12546 globalTranslate('ariaFilterToValue', 'Filter to Value');
12547 element.setInputPlaceholder(_this.translate(placeholder));
12548 element.setInputAriaLabel(ariaLabel);
12549 });
12550 };
12551 SimpleFilter.prototype.setElementValue = function (element, value, silent) {
12552 if (element instanceof AgAbstractInputField) {
12553 element.setValue(value != null ? String(value) : null, silent);
12554 }
12555 };
12556 SimpleFilter.prototype.setElementDisplayed = function (element, displayed) {
12557 if (element instanceof Component) {
12558 setDisplayed(element.getGui(), displayed);
12559 }
12560 };
12561 SimpleFilter.prototype.setElementDisabled = function (element, disabled) {
12562 if (element instanceof Component) {
12563 setDisabled(element.getGui(), disabled);
12564 }
12565 };
12566 SimpleFilter.prototype.attachElementOnChange = function (element, listener) {
12567 if (element instanceof AgAbstractInputField) {
12568 element.onValueChange(listener);
12569 }
12570 };
12571 SimpleFilter.prototype.forEachInput = function (cb) {
12572 var _this = this;
12573 var inputs = this.getInputs();
12574 this.getConditionTypes().forEach(function (type, position) {
12575 var numberOfInputs = _this.getNumberOfInputs(type);
12576 for (var index = 0; index < inputs[position].length; index++) {
12577 var input = inputs[position][index];
12578 if (input != null) {
12579 cb(input, index, position, numberOfInputs);
12580 }
12581 }
12582 });
12583 };
12584 SimpleFilter.prototype.isConditionVisible = function (position) {
12585 if (position === 0) {
12586 return true;
12587 } // Position 0 should always be visible.
12588 if (!this.allowTwoConditions) {
12589 return false;
12590 } // Short-circuit if no tail conditions.
12591 if (this.isReadOnly()) {
12592 // Only display a condition when read-only if the condition is complete.
12593 return this.isConditionUiComplete(position);
12594 }
12595 if (this.alwaysShowBothConditions) {
12596 return true;
12597 }
12598 // Only display a 2nd or later condition when the previous condition is complete.
12599 return this.isConditionUiComplete(position - 1);
12600 };
12601 SimpleFilter.prototype.isConditionDisabled = function (position) {
12602 if (this.isReadOnly()) {
12603 return true;
12604 } // Read-only mode trumps everything.
12605 if (!this.isConditionVisible(position)) {
12606 return true;
12607 } // Invisible implies disabled.
12608 if (position === 0) {
12609 return false;
12610 } // Position 0 should typically be editable.
12611 // Only allow editing of a 2nd or later condition if the previous condition is complete.
12612 return !this.isConditionUiComplete(position - 1);
12613 };
12614 SimpleFilter.prototype.isConditionBodyVisible = function (position) {
12615 if (!this.isConditionVisible(position)) {
12616 return false;
12617 }
12618 // Check that the condition needs inputs.
12619 var type = this.getConditionTypes()[position];
12620 var numberOfInputs = this.getNumberOfInputs(type);
12621 return numberOfInputs > 0;
12622 };
12623 // returns true if the UI represents a working filter, eg all parts are filled out.
12624 // eg if text filter and textfield blank then returns false.
12625 SimpleFilter.prototype.isConditionUiComplete = function (position) {
12626 var type = this.getConditionTypes()[position];
12627 if (type === SimpleFilter.EMPTY) {
12628 return false;
12629 }
12630 if (this.getValues(position).some(function (v) { return v == null; })) {
12631 return false;
12632 }
12633 return true;
12634 };
12635 SimpleFilter.prototype.resetUiToDefaults = function (silent) {
12636 var _this = this;
12637 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
12638 var filteringLabel = translate('ariaFilteringOperator', 'Filtering operator');
12639 var uniqueGroupId = 'ag-simple-filter-and-or-' + this.getCompId();
12640 var defaultOption = this.optionsFactory.getDefaultOption();
12641 this.eType1
12642 .setValue(defaultOption, silent)
12643 .setAriaLabel(filteringLabel)
12644 .setDisabled(this.isReadOnly());
12645 this.eType2
12646 .setValue(this.optionsFactory.getDefaultOption(), silent)
12647 .setAriaLabel(filteringLabel)
12648 .setDisabled(this.isReadOnly());
12649 this.eJoinOperatorAnd
12650 .setValue(this.isDefaultOperator('AND'), silent)
12651 .setName(uniqueGroupId)
12652 .setLabel(this.translate('andCondition'))
12653 .setDisabled(this.isReadOnly());
12654 this.eJoinOperatorOr
12655 .setValue(this.isDefaultOperator('OR'), silent)
12656 .setName(uniqueGroupId)
12657 .setLabel(this.translate('orCondition'))
12658 .setDisabled(this.isReadOnly());
12659 this.forEachInput(function (element) {
12660 _this.setElementValue(element, null, silent);
12661 _this.setElementDisabled(element, _this.isReadOnly());
12662 });
12663 this.resetPlaceholder();
12664 return AgPromise.resolve();
12665 };
12666 // puts model values into the UI
12667 SimpleFilter.prototype.setConditionIntoUi = function (model, position) {
12668 var _this = this;
12669 var values = this.mapValuesFromModel(model);
12670 this.forEachInput(function (element, index, elPosition, _) {
12671 if (elPosition !== position) {
12672 return;
12673 }
12674 _this.setElementValue(element, values[index] != null ? values[index] : null);
12675 });
12676 };
12677 // after floating filter changes, this sets the 'value' section. this is implemented by the base class
12678 // (as that's where value is controlled), the 'type' part from the floating filter is dealt with in this class.
12679 SimpleFilter.prototype.setValueFromFloatingFilter = function (value) {
12680 var _this = this;
12681 this.forEachInput(function (element, index, position, _) {
12682 _this.setElementValue(element, index === 0 && position === 0 ? value : null);
12683 });
12684 };
12685 SimpleFilter.prototype.isDefaultOperator = function (operator) {
12686 return operator === this.defaultJoinOperator;
12687 };
12688 SimpleFilter.prototype.addChangedListeners = function () {
12689 var _this = this;
12690 if (this.isReadOnly()) {
12691 return;
12692 }
12693 var listener = function () { return _this.onUiChanged(); };
12694 this.eType1.onValueChange(listener);
12695 this.eType2.onValueChange(listener);
12696 this.eJoinOperatorOr.onValueChange(listener);
12697 this.eJoinOperatorAnd.onValueChange(listener);
12698 this.forEachInput(function (element) {
12699 _this.attachElementOnChange(element, listener);
12700 });
12701 };
12702 /** returns true if the row passes the said condition */
12703 SimpleFilter.prototype.individualConditionPasses = function (params, filterModel) {
12704 var cellValue = this.getCellValue(params.node);
12705 var values = this.mapValuesFromModel(filterModel);
12706 var customFilterOption = this.optionsFactory.getCustomOption(filterModel.type);
12707 var customFilterResult = this.evaluateCustomFilter(customFilterOption, values, cellValue);
12708 if (customFilterResult != null) {
12709 return customFilterResult;
12710 }
12711 if (cellValue == null) {
12712 return this.evaluateNullValue(filterModel.type);
12713 }
12714 return this.evaluateNonNullValue(values, cellValue, filterModel, params);
12715 };
12716 SimpleFilter.prototype.evaluateCustomFilter = function (customFilterOption, values, cellValue) {
12717 if (customFilterOption == null) {
12718 return;
12719 }
12720 var predicate = customFilterOption.predicate;
12721 // only execute the custom filter if a value exists or a value isn't required, i.e. input is hidden
12722 if (predicate != null && !values.some(function (v) { return v == null; })) {
12723 return predicate(values, cellValue);
12724 }
12725 // No custom filter invocation, indicate that to the caller.
12726 return;
12727 };
12728 SimpleFilter.prototype.isBlank = function (cellValue) {
12729 return cellValue == null ||
12730 (typeof cellValue === 'string' && cellValue.trim().length === 0);
12731 };
12732 SimpleFilter.EMPTY = 'empty';
12733 SimpleFilter.BLANK = 'blank';
12734 SimpleFilter.NOT_BLANK = 'notBlank';
12735 SimpleFilter.EQUALS = 'equals';
12736 SimpleFilter.NOT_EQUAL = 'notEqual';
12737 SimpleFilter.LESS_THAN = 'lessThan';
12738 SimpleFilter.LESS_THAN_OR_EQUAL = 'lessThanOrEqual';
12739 SimpleFilter.GREATER_THAN = 'greaterThan';
12740 SimpleFilter.GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual';
12741 SimpleFilter.IN_RANGE = 'inRange';
12742 SimpleFilter.CONTAINS = 'contains';
12743 SimpleFilter.NOT_CONTAINS = 'notContains';
12744 SimpleFilter.STARTS_WITH = 'startsWith';
12745 SimpleFilter.ENDS_WITH = 'endsWith';
12746 __decorate$j([
12747 RefSelector('eOptions1')
12748 ], SimpleFilter.prototype, "eType1", void 0);
12749 __decorate$j([
12750 RefSelector('eOptions2')
12751 ], SimpleFilter.prototype, "eType2", void 0);
12752 __decorate$j([
12753 RefSelector('eJoinOperatorPanel')
12754 ], SimpleFilter.prototype, "eJoinOperatorPanel", void 0);
12755 __decorate$j([
12756 RefSelector('eJoinOperatorAnd')
12757 ], SimpleFilter.prototype, "eJoinOperatorAnd", void 0);
12758 __decorate$j([
12759 RefSelector('eJoinOperatorOr')
12760 ], SimpleFilter.prototype, "eJoinOperatorOr", void 0);
12761 __decorate$j([
12762 RefSelector('eCondition1Body')
12763 ], SimpleFilter.prototype, "eCondition1Body", void 0);
12764 __decorate$j([
12765 RefSelector('eCondition2Body')
12766 ], SimpleFilter.prototype, "eCondition2Body", void 0);
12767 return SimpleFilter;
12768}(ProvidedFilter));
12769
12770/**
12771 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
12772 * @version v27.3.0
12773 * @link https://www.ag-grid.com/
12774 * @license MIT
12775 */
12776var __extends$h = (undefined && undefined.__extends) || (function () {
12777 var extendStatics = function (d, b) {
12778 extendStatics = Object.setPrototypeOf ||
12779 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
12780 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
12781 return extendStatics(d, b);
12782 };
12783 return function (d, b) {
12784 extendStatics(d, b);
12785 function __() { this.constructor = d; }
12786 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12787 };
12788})();
12789var ScalarFilter = /** @class */ (function (_super) {
12790 __extends$h(ScalarFilter, _super);
12791 function ScalarFilter() {
12792 return _super !== null && _super.apply(this, arguments) || this;
12793 }
12794 ScalarFilter.prototype.setParams = function (params) {
12795 _super.prototype.setParams.call(this, params);
12796 this.scalarFilterParams = params;
12797 };
12798 ScalarFilter.prototype.evaluateNullValue = function (filterType) {
12799 switch (filterType) {
12800 case ScalarFilter.EQUALS:
12801 case ScalarFilter.NOT_EQUAL:
12802 if (this.scalarFilterParams.includeBlanksInEquals) {
12803 return true;
12804 }
12805 break;
12806 case ScalarFilter.GREATER_THAN:
12807 case ScalarFilter.GREATER_THAN_OR_EQUAL:
12808 if (this.scalarFilterParams.includeBlanksInGreaterThan) {
12809 return true;
12810 }
12811 break;
12812 case ScalarFilter.LESS_THAN:
12813 case ScalarFilter.LESS_THAN_OR_EQUAL:
12814 if (this.scalarFilterParams.includeBlanksInLessThan) {
12815 return true;
12816 }
12817 break;
12818 case ScalarFilter.IN_RANGE:
12819 if (this.scalarFilterParams.includeBlanksInRange) {
12820 return true;
12821 }
12822 break;
12823 case ScalarFilter.BLANK:
12824 return true;
12825 case ScalarFilter.NOT_BLANK:
12826 return false;
12827 }
12828 return false;
12829 };
12830 ScalarFilter.prototype.evaluateNonNullValue = function (values, cellValue, filterModel) {
12831 var comparator = this.comparator();
12832 var compareResult = values[0] != null ? comparator(values[0], cellValue) : 0;
12833 switch (filterModel.type) {
12834 case ScalarFilter.EQUALS:
12835 return compareResult === 0;
12836 case ScalarFilter.NOT_EQUAL:
12837 return compareResult !== 0;
12838 case ScalarFilter.GREATER_THAN:
12839 return compareResult > 0;
12840 case ScalarFilter.GREATER_THAN_OR_EQUAL:
12841 return compareResult >= 0;
12842 case ScalarFilter.LESS_THAN:
12843 return compareResult < 0;
12844 case ScalarFilter.LESS_THAN_OR_EQUAL:
12845 return compareResult <= 0;
12846 case ScalarFilter.IN_RANGE: {
12847 var compareToResult = comparator(values[1], cellValue);
12848 return this.scalarFilterParams.inRangeInclusive ?
12849 compareResult >= 0 && compareToResult <= 0 :
12850 compareResult > 0 && compareToResult < 0;
12851 }
12852 case ScalarFilter.BLANK:
12853 return this.isBlank(cellValue);
12854 case ScalarFilter.NOT_BLANK:
12855 return !this.isBlank(cellValue);
12856 default:
12857 console.warn('AG Grid: Unexpected type of filter "' + filterModel.type + '", it looks like the filter was configured with incorrect Filter Options');
12858 return true;
12859 }
12860 };
12861 return ScalarFilter;
12862}(SimpleFilter));
12863
12864/**
12865 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
12866 * @version v27.3.0
12867 * @link https://www.ag-grid.com/
12868 * @license MIT
12869 */
12870var __extends$i = (undefined && undefined.__extends) || (function () {
12871 var extendStatics = function (d, b) {
12872 extendStatics = Object.setPrototypeOf ||
12873 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
12874 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
12875 return extendStatics(d, b);
12876 };
12877 return function (d, b) {
12878 extendStatics(d, b);
12879 function __() { this.constructor = d; }
12880 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12881 };
12882})();
12883var __assign$5 = (undefined && undefined.__assign) || function () {
12884 __assign$5 = Object.assign || function(t) {
12885 for (var s, i = 1, n = arguments.length; i < n; i++) {
12886 s = arguments[i];
12887 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
12888 t[p] = s[p];
12889 }
12890 return t;
12891 };
12892 return __assign$5.apply(this, arguments);
12893};
12894var __decorate$k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12895 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12896 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12897 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;
12898 return c > 3 && r && Object.defineProperty(target, key, r), r;
12899};
12900var DEFAULT_MIN_YEAR = 1000;
12901var DEFAULT_MAX_YEAR = Infinity;
12902var DateFilter = /** @class */ (function (_super) {
12903 __extends$i(DateFilter, _super);
12904 function DateFilter() {
12905 var _this = _super.call(this, 'dateFilter') || this;
12906 _this.minValidYear = DEFAULT_MIN_YEAR;
12907 _this.maxValidYear = DEFAULT_MAX_YEAR;
12908 return _this;
12909 }
12910 DateFilter.prototype.afterGuiAttached = function (params) {
12911 _super.prototype.afterGuiAttached.call(this, params);
12912 this.dateCondition1FromComp.afterGuiAttached(params);
12913 };
12914 DateFilter.prototype.mapValuesFromModel = function (filterModel) {
12915 // unlike the other filters, we do two things here:
12916 // 1) allow for different attribute names (same as done for other filters) (eg the 'from' and 'to'
12917 // are in different locations in Date and Number filter models)
12918 // 2) convert the type (because Date filter uses Dates, however model is 'string')
12919 //
12920 // NOTE: The conversion of string to date also removes the timezone - i.e. when user picks
12921 // a date from the UI, it will have timezone info in it. This is lost when creating
12922 // the model. When we recreate the date again here, it's without a timezone.
12923 var _a = filterModel || {}, dateFrom = _a.dateFrom, dateTo = _a.dateTo, type = _a.type;
12924 return [
12925 dateFrom && parseDateTimeFromString(dateFrom) || null,
12926 dateTo && parseDateTimeFromString(dateTo) || null,
12927 ].slice(0, this.getNumberOfInputs(type));
12928 };
12929 DateFilter.prototype.comparator = function () {
12930 return this.dateFilterParams.comparator ? this.dateFilterParams.comparator : this.defaultComparator.bind(this);
12931 };
12932 DateFilter.prototype.defaultComparator = function (filterDate, cellValue) {
12933 // The default comparator assumes that the cellValue is a date
12934 var cellAsDate = cellValue;
12935 if (cellValue == null || cellAsDate < filterDate) {
12936 return -1;
12937 }
12938 if (cellAsDate > filterDate) {
12939 return 1;
12940 }
12941 return 0;
12942 };
12943 DateFilter.prototype.setParams = function (params) {
12944 _super.prototype.setParams.call(this, params);
12945 this.dateFilterParams = params;
12946 var yearParser = function (param, fallback) {
12947 if (params[param] != null) {
12948 if (!isNaN(params[param])) {
12949 return params[param] == null ? fallback : Number(params[param]);
12950 }
12951 else {
12952 console.warn("AG Grid: DateFilter " + param + " is not a number");
12953 }
12954 }
12955 return fallback;
12956 };
12957 this.minValidYear = yearParser('minValidYear', DEFAULT_MIN_YEAR);
12958 this.maxValidYear = yearParser('maxValidYear', DEFAULT_MAX_YEAR);
12959 if (this.minValidYear > this.maxValidYear) {
12960 console.warn("AG Grid: DateFilter minValidYear should be <= maxValidYear");
12961 }
12962 this.createDateComponents();
12963 };
12964 DateFilter.prototype.createDateComponents = function () {
12965 var _this = this;
12966 var createDateCompWrapper = function (element) {
12967 return new DateCompWrapper(_this.getContext(), _this.userComponentFactory, {
12968 onDateChanged: function () { return _this.onUiChanged(); },
12969 filterParams: _this.dateFilterParams
12970 }, element);
12971 };
12972 this.dateCondition1FromComp = createDateCompWrapper(this.eCondition1PanelFrom);
12973 this.dateCondition1ToComp = createDateCompWrapper(this.eCondition1PanelTo);
12974 this.dateCondition2FromComp = createDateCompWrapper(this.eCondition2PanelFrom);
12975 this.dateCondition2ToComp = createDateCompWrapper(this.eCondition2PanelTo);
12976 this.addDestroyFunc(function () {
12977 _this.forEachInput(function (element) { return element.destroy(); });
12978 });
12979 };
12980 DateFilter.prototype.setElementValue = function (element, value, silent) {
12981 element.setDate(value);
12982 };
12983 DateFilter.prototype.setElementDisplayed = function (element, displayed) {
12984 element.setDisplayed(displayed);
12985 };
12986 DateFilter.prototype.setElementDisabled = function (element, disabled) {
12987 element.setDisabled(disabled);
12988 };
12989 DateFilter.prototype.getDefaultFilterOptions = function () {
12990 return DateFilter.DEFAULT_FILTER_OPTIONS;
12991 };
12992 DateFilter.prototype.createValueTemplate = function (position) {
12993 var pos = position === ConditionPosition.One ? '1' : '2';
12994 return /* html */ "\n <div class=\"ag-filter-body\" ref=\"eCondition" + pos + "Body\">\n <div class=\"ag-filter-from ag-filter-date-from\" ref=\"eCondition" + pos + "PanelFrom\"></div>\n <div class=\"ag-filter-to ag-filter-date-to\" ref=\"eCondition" + pos + "PanelTo\"></div>\n </div>";
12995 };
12996 DateFilter.prototype.isConditionUiComplete = function (position) {
12997 var _this = this;
12998 if (!_super.prototype.isConditionUiComplete.call(this, position)) {
12999 return false;
13000 }
13001 var isValidDate = function (value) { return value != null
13002 && value.getUTCFullYear() >= _this.minValidYear
13003 && value.getUTCFullYear() <= _this.maxValidYear; };
13004 var valid = true;
13005 this.forEachInput(function (element, index, elPosition, numberOfInputs) {
13006 if (elPosition !== position || !valid || index >= numberOfInputs) {
13007 return;
13008 }
13009 valid = valid && isValidDate(element.getDate());
13010 });
13011 return valid;
13012 };
13013 DateFilter.prototype.areSimpleModelsEqual = function (aSimple, bSimple) {
13014 return aSimple.dateFrom === bSimple.dateFrom
13015 && aSimple.dateTo === bSimple.dateTo
13016 && aSimple.type === bSimple.type;
13017 };
13018 DateFilter.prototype.getFilterType = function () {
13019 return 'date';
13020 };
13021 DateFilter.prototype.createCondition = function (position) {
13022 var type = this.getConditionTypes()[position];
13023 var model = {};
13024 var values = this.getValues(position);
13025 if (values.length > 0) {
13026 model.dateFrom = serialiseDate(values[0]);
13027 }
13028 if (values.length > 1) {
13029 model.dateTo = serialiseDate(values[1]);
13030 }
13031 return __assign$5({ dateFrom: null, dateTo: null, filterType: this.getFilterType(), type: type }, model);
13032 };
13033 DateFilter.prototype.resetPlaceholder = function () {
13034 var globalTranslate = this.gridOptionsWrapper.getLocaleTextFunc();
13035 var placeholder = this.translate('dateFormatOoo');
13036 var ariaLabel = globalTranslate('ariaFilterValue', 'Filter Value');
13037 this.forEachInput(function (element) {
13038 element.setInputPlaceholder(placeholder);
13039 element.setInputAriaLabel(ariaLabel);
13040 });
13041 };
13042 DateFilter.prototype.getInputs = function () {
13043 return [
13044 [this.dateCondition1FromComp, this.dateCondition1ToComp],
13045 [this.dateCondition2FromComp, this.dateCondition2ToComp],
13046 ];
13047 };
13048 DateFilter.prototype.getValues = function (position) {
13049 var result = [];
13050 this.forEachInput(function (element, index, elPosition, numberOfInputs) {
13051 if (position === elPosition && index < numberOfInputs) {
13052 result.push(element.getDate());
13053 }
13054 });
13055 return result;
13056 };
13057 DateFilter.DEFAULT_FILTER_OPTIONS = [
13058 ScalarFilter.EQUALS,
13059 ScalarFilter.GREATER_THAN,
13060 ScalarFilter.LESS_THAN,
13061 ScalarFilter.NOT_EQUAL,
13062 ScalarFilter.IN_RANGE,
13063 ScalarFilter.BLANK,
13064 ScalarFilter.NOT_BLANK,
13065 ];
13066 __decorate$k([
13067 RefSelector('eCondition1PanelFrom')
13068 ], DateFilter.prototype, "eCondition1PanelFrom", void 0);
13069 __decorate$k([
13070 RefSelector('eCondition1PanelTo')
13071 ], DateFilter.prototype, "eCondition1PanelTo", void 0);
13072 __decorate$k([
13073 RefSelector('eCondition2PanelFrom')
13074 ], DateFilter.prototype, "eCondition2PanelFrom", void 0);
13075 __decorate$k([
13076 RefSelector('eCondition2PanelTo')
13077 ], DateFilter.prototype, "eCondition2PanelTo", void 0);
13078 __decorate$k([
13079 Autowired('userComponentFactory')
13080 ], DateFilter.prototype, "userComponentFactory", void 0);
13081 return DateFilter;
13082}(ScalarFilter));
13083
13084/**
13085 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13086 * @version v27.3.0
13087 * @link https://www.ag-grid.com/
13088 * @license MIT
13089 */
13090var __extends$j = (undefined && undefined.__extends) || (function () {
13091 var extendStatics = function (d, b) {
13092 extendStatics = Object.setPrototypeOf ||
13093 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
13094 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
13095 return extendStatics(d, b);
13096 };
13097 return function (d, b) {
13098 extendStatics(d, b);
13099 function __() { this.constructor = d; }
13100 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13101 };
13102})();
13103var SimpleFloatingFilter = /** @class */ (function (_super) {
13104 __extends$j(SimpleFloatingFilter, _super);
13105 function SimpleFloatingFilter() {
13106 return _super !== null && _super.apply(this, arguments) || this;
13107 }
13108 SimpleFloatingFilter.prototype.getDefaultDebounceMs = function () {
13109 return 0;
13110 };
13111 // this is a user component, and IComponent has "public destroy()" as part of the interface.
13112 // so we need to override destroy() just to make the method public.
13113 SimpleFloatingFilter.prototype.destroy = function () {
13114 _super.prototype.destroy.call(this);
13115 };
13116 // used by:
13117 // 1) NumberFloatingFilter & TextFloatingFilter: Always, for both when editable and read only.
13118 // 2) DateFloatingFilter: Only when read only (as we show text rather than a date picker when read only)
13119 SimpleFloatingFilter.prototype.getTextFromModel = function (model) {
13120 if (!model) {
13121 return null;
13122 }
13123 var isCombined = model.operator != null;
13124 if (isCombined) {
13125 var combinedModel = model;
13126 var _a = combinedModel || {}, condition1 = _a.condition1, condition2 = _a.condition2;
13127 var customOption1 = this.optionsFactory.getCustomOption(condition1.type);
13128 var customOption2 = this.optionsFactory.getCustomOption(condition2.type);
13129 return [
13130 this.conditionToString(condition1, customOption1),
13131 combinedModel.operator,
13132 this.conditionToString(condition2, customOption2),
13133 ].join(' ');
13134 }
13135 else {
13136 var condition = model;
13137 var customOption = this.optionsFactory.getCustomOption(condition.type);
13138 // For custom filter options we display the Name of the filter instead
13139 // of displaying the `from` value, as it wouldn't be relevant
13140 var _b = customOption || {}, displayKey = _b.displayKey, displayName = _b.displayName, numberOfInputs = _b.numberOfInputs;
13141 if (displayKey && displayName && numberOfInputs === 0) {
13142 this.gridOptionsWrapper.getLocaleTextFunc()(displayKey, displayName);
13143 return displayName;
13144 }
13145 return this.conditionToString(condition, customOption);
13146 }
13147 };
13148 SimpleFloatingFilter.prototype.isEventFromFloatingFilter = function (event) {
13149 return event && event.afterFloatingFilter;
13150 };
13151 SimpleFloatingFilter.prototype.getLastType = function () {
13152 return this.lastType;
13153 };
13154 SimpleFloatingFilter.prototype.isReadOnly = function () {
13155 return this.readOnly;
13156 };
13157 SimpleFloatingFilter.prototype.setLastTypeFromModel = function (model) {
13158 // if no model provided by the parent filter use default
13159 if (!model) {
13160 this.lastType = this.optionsFactory.getDefaultOption();
13161 return;
13162 }
13163 var isCombined = model.operator;
13164 var condition;
13165 if (isCombined) {
13166 var combinedModel = model;
13167 condition = combinedModel.condition1;
13168 }
13169 else {
13170 condition = model;
13171 }
13172 this.lastType = condition.type;
13173 };
13174 SimpleFloatingFilter.prototype.canWeEditAfterModelFromParentFilter = function (model) {
13175 if (!model) {
13176 // if no model, then we can edit as long as the lastType is something we can edit, as this
13177 // is the type we will provide to the parent filter if the user decides to use the floating filter.
13178 return this.isTypeEditable(this.lastType);
13179 }
13180 // never allow editing if the filter is combined (ie has two parts)
13181 var isCombined = model.operator;
13182 if (isCombined) {
13183 return false;
13184 }
13185 var simpleModel = model;
13186 return this.isTypeEditable(simpleModel.type);
13187 };
13188 SimpleFloatingFilter.prototype.init = function (params) {
13189 this.optionsFactory = new OptionsFactory();
13190 this.optionsFactory.init(params.filterParams, this.getDefaultFilterOptions());
13191 this.lastType = this.optionsFactory.getDefaultOption();
13192 // readOnly is a property of IProvidedFilterParams - we need to find a better (type-safe)
13193 // way to support reading this in the future.
13194 this.readOnly = !!params.filterParams.readOnly;
13195 // we are editable if:
13196 // 1) there is a type (user has configured filter wrong if not type)
13197 // AND
13198 // 2) the default type is not 'in range'
13199 var editable = this.isTypeEditable(this.lastType);
13200 this.setEditable(editable);
13201 };
13202 SimpleFloatingFilter.prototype.doesFilterHaveSingleInput = function (filterType) {
13203 var customFilterOption = this.optionsFactory.getCustomOption(filterType);
13204 var numberOfInputs = (customFilterOption || {}).numberOfInputs;
13205 return numberOfInputs == null || numberOfInputs == 1;
13206 };
13207 SimpleFloatingFilter.prototype.isTypeEditable = function (type) {
13208 var uneditableTypes = [
13209 SimpleFilter.IN_RANGE, SimpleFilter.EMPTY, SimpleFilter.BLANK, SimpleFilter.NOT_BLANK,
13210 ];
13211 return !!type &&
13212 !this.isReadOnly() &&
13213 this.doesFilterHaveSingleInput(type) &&
13214 uneditableTypes.indexOf(type) < 0;
13215 };
13216 return SimpleFloatingFilter;
13217}(Component));
13218
13219/**
13220 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13221 * @version v27.3.0
13222 * @link https://www.ag-grid.com/
13223 * @license MIT
13224 */
13225var __extends$k = (undefined && undefined.__extends) || (function () {
13226 var extendStatics = function (d, b) {
13227 extendStatics = Object.setPrototypeOf ||
13228 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
13229 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
13230 return extendStatics(d, b);
13231 };
13232 return function (d, b) {
13233 extendStatics(d, b);
13234 function __() { this.constructor = d; }
13235 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13236 };
13237})();
13238var __decorate$l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13239 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13240 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13241 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;
13242 return c > 3 && r && Object.defineProperty(target, key, r), r;
13243};
13244var DateFloatingFilter = /** @class */ (function (_super) {
13245 __extends$k(DateFloatingFilter, _super);
13246 function DateFloatingFilter() {
13247 return _super.call(this, /* html */ "\n <div class=\"ag-floating-filter-input\" role=\"presentation\">\n <ag-input-text-field ref=\"eReadOnlyText\"></ag-input-text-field>\n <div ref=\"eDateWrapper\" style=\"display: flex;\"></div>\n </div>") || this;
13248 }
13249 DateFloatingFilter.prototype.getDefaultFilterOptions = function () {
13250 return DateFilter.DEFAULT_FILTER_OPTIONS;
13251 };
13252 DateFloatingFilter.prototype.conditionToString = function (condition, options) {
13253 var type = condition.type;
13254 var numberOfInputs = (options || {}).numberOfInputs;
13255 var isRange = type == SimpleFilter.IN_RANGE || numberOfInputs === 2;
13256 var dateFrom = parseDateTimeFromString(condition.dateFrom);
13257 var dateTo = parseDateTimeFromString(condition.dateTo);
13258 if (isRange) {
13259 return serialiseDate(dateFrom, false) + "-" + serialiseDate(dateTo, false);
13260 }
13261 if (dateFrom != null) {
13262 return "" + serialiseDate(dateFrom, false);
13263 }
13264 // cater for when the type doesn't need a value
13265 return "" + type;
13266 };
13267 DateFloatingFilter.prototype.init = function (params) {
13268 _super.prototype.init.call(this, params);
13269 this.params = params;
13270 this.createDateComponent();
13271 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
13272 this.eReadOnlyText
13273 .setDisabled(true)
13274 .setInputAriaLabel(translate('ariaDateFilterInput', 'Date Filter Input'));
13275 };
13276 DateFloatingFilter.prototype.setEditable = function (editable) {
13277 setDisplayed(this.eDateWrapper, editable);
13278 setDisplayed(this.eReadOnlyText.getGui(), !editable);
13279 };
13280 DateFloatingFilter.prototype.onParentModelChanged = function (model, event) {
13281 // We don't want to update the floating filter if the floating filter caused the change,
13282 // because the UI is already in sync. if we didn't do this, the UI would behave strangely
13283 // as it would be updating as the user is typing
13284 if (this.isEventFromFloatingFilter(event)) {
13285 return;
13286 }
13287 _super.prototype.setLastTypeFromModel.call(this, model);
13288 var allowEditing = !this.isReadOnly() &&
13289 this.canWeEditAfterModelFromParentFilter(model);
13290 this.setEditable(allowEditing);
13291 if (allowEditing) {
13292 if (model) {
13293 var dateModel = model;
13294 this.dateComp.setDate(parseDateTimeFromString(dateModel.dateFrom));
13295 }
13296 else {
13297 this.dateComp.setDate(null);
13298 }
13299 this.eReadOnlyText.setValue('');
13300 }
13301 else {
13302 this.eReadOnlyText.setValue(this.getTextFromModel(model));
13303 this.dateComp.setDate(null);
13304 }
13305 };
13306 DateFloatingFilter.prototype.onDateChanged = function () {
13307 var _this = this;
13308 var filterValueDate = this.dateComp.getDate();
13309 var filterValueText = serialiseDate(filterValueDate);
13310 this.params.parentFilterInstance(function (filterInstance) {
13311 if (filterInstance) {
13312 var date = parseDateTimeFromString(filterValueText);
13313 filterInstance.onFloatingFilterChanged(_this.getLastType() || null, date);
13314 }
13315 });
13316 };
13317 DateFloatingFilter.prototype.createDateComponent = function () {
13318 var _this = this;
13319 var debounceMs = ProvidedFilter.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs());
13320 var dateComponentParams = {
13321 onDateChanged: debounce(this.onDateChanged.bind(this), debounceMs),
13322 filterParams: this.params.column.getColDef().filterParams
13323 };
13324 this.dateComp = new DateCompWrapper(this.getContext(), this.userComponentFactory, dateComponentParams, this.eDateWrapper);
13325 this.addDestroyFunc(function () { return _this.dateComp.destroy(); });
13326 };
13327 __decorate$l([
13328 Autowired('userComponentFactory')
13329 ], DateFloatingFilter.prototype, "userComponentFactory", void 0);
13330 __decorate$l([
13331 RefSelector('eReadOnlyText')
13332 ], DateFloatingFilter.prototype, "eReadOnlyText", void 0);
13333 __decorate$l([
13334 RefSelector('eDateWrapper')
13335 ], DateFloatingFilter.prototype, "eDateWrapper", void 0);
13336 return DateFloatingFilter;
13337}(SimpleFloatingFilter));
13338
13339/**
13340 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13341 * @version v27.3.0
13342 * @link https://www.ag-grid.com/
13343 * @license MIT
13344 */
13345var __extends$l = (undefined && undefined.__extends) || (function () {
13346 var extendStatics = function (d, b) {
13347 extendStatics = Object.setPrototypeOf ||
13348 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
13349 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
13350 return extendStatics(d, b);
13351 };
13352 return function (d, b) {
13353 extendStatics(d, b);
13354 function __() { this.constructor = d; }
13355 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13356 };
13357})();
13358var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13359 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13360 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13361 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;
13362 return c > 3 && r && Object.defineProperty(target, key, r), r;
13363};
13364var DefaultDateComponent = /** @class */ (function (_super) {
13365 __extends$l(DefaultDateComponent, _super);
13366 function DefaultDateComponent() {
13367 return _super.call(this, /* html */ "\n <div class=\"ag-filter-filter\">\n <ag-input-text-field class=\"ag-date-filter\" ref=\"eDateInput\"></ag-input-text-field>\n </div>") || this;
13368 }
13369 // this is a user component, and IComponent has "public destroy()" as part of the interface.
13370 // so we need to override destroy() just to make the method public.
13371 DefaultDateComponent.prototype.destroy = function () {
13372 _super.prototype.destroy.call(this);
13373 };
13374 DefaultDateComponent.prototype.init = function (params) {
13375 var _this = this;
13376 var eDocument = this.gridOptionsWrapper.getDocument();
13377 var inputElement = this.eDateInput.getInputElement();
13378 if (this.shouldUseBrowserDatePicker(params)) {
13379 inputElement.type = 'date';
13380 }
13381 // ensures that the input element is focussed when a clear button is clicked
13382 this.addManagedListener(inputElement, 'mousedown', function () {
13383 if (_this.eDateInput.isDisabled()) {
13384 return;
13385 }
13386 inputElement.focus();
13387 });
13388 this.addManagedListener(inputElement, 'input', function (e) {
13389 if (e.target !== eDocument.activeElement) {
13390 return;
13391 }
13392 if (_this.eDateInput.isDisabled()) {
13393 return;
13394 }
13395 params.onDateChanged();
13396 });
13397 var _a = params.filterParams || {}, minValidYear = _a.minValidYear, maxValidYear = _a.maxValidYear;
13398 if (minValidYear) {
13399 inputElement.min = minValidYear + "-01-01";
13400 }
13401 if (maxValidYear) {
13402 inputElement.max = maxValidYear + "-12-31";
13403 }
13404 };
13405 DefaultDateComponent.prototype.getDate = function () {
13406 return parseDateTimeFromString(this.eDateInput.getValue());
13407 };
13408 DefaultDateComponent.prototype.setDate = function (date) {
13409 this.eDateInput.setValue(serialiseDate(date, false));
13410 };
13411 DefaultDateComponent.prototype.setInputPlaceholder = function (placeholder) {
13412 this.eDateInput.setInputPlaceholder(placeholder);
13413 };
13414 DefaultDateComponent.prototype.setDisabled = function (disabled) {
13415 this.eDateInput.setDisabled(disabled);
13416 };
13417 DefaultDateComponent.prototype.afterGuiAttached = function (params) {
13418 if (!params || !params.suppressFocus) {
13419 this.eDateInput.getInputElement().focus();
13420 }
13421 };
13422 DefaultDateComponent.prototype.shouldUseBrowserDatePicker = function (params) {
13423 if (params.filterParams && params.filterParams.browserDatePicker != null) {
13424 return params.filterParams.browserDatePicker;
13425 }
13426 return isBrowserChrome() || isBrowserFirefox();
13427 };
13428 __decorate$m([
13429 RefSelector('eDateInput')
13430 ], DefaultDateComponent.prototype, "eDateInput", void 0);
13431 return DefaultDateComponent;
13432}(Component));
13433
13434/**
13435 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13436 * @version v27.3.0
13437 * @link https://www.ag-grid.com/
13438 * @license MIT
13439 */
13440var __extends$m = (undefined && undefined.__extends) || (function () {
13441 var extendStatics = function (d, b) {
13442 extendStatics = Object.setPrototypeOf ||
13443 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
13444 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
13445 return extendStatics(d, b);
13446 };
13447 return function (d, b) {
13448 extendStatics(d, b);
13449 function __() { this.constructor = d; }
13450 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13451 };
13452})();
13453var __decorate$n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13454 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13455 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13456 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;
13457 return c > 3 && r && Object.defineProperty(target, key, r), r;
13458};
13459var NumberFilter = /** @class */ (function (_super) {
13460 __extends$m(NumberFilter, _super);
13461 function NumberFilter() {
13462 return _super.call(this, 'numberFilter') || this;
13463 }
13464 NumberFilter.prototype.mapValuesFromModel = function (filterModel) {
13465 var _a = filterModel || {}, filter = _a.filter, filterTo = _a.filterTo, type = _a.type;
13466 return [
13467 filter == null ? null : filter,
13468 filterTo == null ? null : filterTo,
13469 ].slice(0, this.getNumberOfInputs(type));
13470 };
13471 NumberFilter.prototype.getDefaultDebounceMs = function () {
13472 return 500;
13473 };
13474 NumberFilter.prototype.comparator = function () {
13475 return function (left, right) {
13476 if (left === right) {
13477 return 0;
13478 }
13479 return left < right ? 1 : -1;
13480 };
13481 };
13482 NumberFilter.prototype.setParams = function (params) {
13483 this.numberFilterParams = params;
13484 var allowedCharPattern = this.getAllowedCharPattern();
13485 if (allowedCharPattern) {
13486 var config = { allowedCharPattern: allowedCharPattern };
13487 this.resetTemplate({
13488 'eValue-index0-1': config,
13489 'eValue-index1-1': config,
13490 'eValue-index0-2': config,
13491 'eValue-index1-2': config,
13492 });
13493 }
13494 _super.prototype.setParams.call(this, params);
13495 };
13496 NumberFilter.prototype.getDefaultFilterOptions = function () {
13497 return NumberFilter.DEFAULT_FILTER_OPTIONS;
13498 };
13499 NumberFilter.prototype.createValueTemplate = function (position) {
13500 var pos = position === ConditionPosition.One ? '1' : '2';
13501 var allowedCharPattern = this.getAllowedCharPattern();
13502 var agElementTag = allowedCharPattern ? 'ag-input-text-field' : 'ag-input-number-field';
13503 return /* html */ "\n <div class=\"ag-filter-body\" ref=\"eCondition" + pos + "Body\" role=\"presentation\">\n <" + agElementTag + " class=\"ag-filter-from ag-filter-filter\" ref=\"eValue-index0-" + pos + "\"></" + agElementTag + ">\n <" + agElementTag + " class=\"ag-filter-to ag-filter-filter\" ref=\"eValue-index1-" + pos + "\"></" + agElementTag + ">\n </div>";
13504 };
13505 NumberFilter.prototype.getValues = function (position) {
13506 var _this = this;
13507 var result = [];
13508 this.forEachInput(function (element, index, elPosition, numberOfInputs) {
13509 if (position === elPosition && index < numberOfInputs) {
13510 result.push(_this.stringToFloat(element.getValue()));
13511 }
13512 });
13513 return result;
13514 };
13515 NumberFilter.prototype.areSimpleModelsEqual = function (aSimple, bSimple) {
13516 return aSimple.filter === bSimple.filter
13517 && aSimple.filterTo === bSimple.filterTo
13518 && aSimple.type === bSimple.type;
13519 };
13520 NumberFilter.prototype.getFilterType = function () {
13521 return 'number';
13522 };
13523 NumberFilter.prototype.stringToFloat = function (value) {
13524 if (typeof value === 'number') {
13525 return value;
13526 }
13527 var filterText = makeNull(value);
13528 if (filterText != null && filterText.trim() === '') {
13529 filterText = null;
13530 }
13531 if (this.numberFilterParams.numberParser) {
13532 return this.numberFilterParams.numberParser(filterText);
13533 }
13534 return filterText == null || filterText.trim() === '-' ? null : parseFloat(filterText);
13535 };
13536 NumberFilter.prototype.createCondition = function (position) {
13537 var type = this.getConditionTypes()[position];
13538 var model = {
13539 filterType: this.getFilterType(),
13540 type: type
13541 };
13542 var values = this.getValues(position);
13543 if (values.length > 0) {
13544 model.filter = values[0];
13545 }
13546 if (values.length > 1) {
13547 model.filterTo = values[1];
13548 }
13549 return model;
13550 };
13551 NumberFilter.prototype.getInputs = function () {
13552 return [
13553 [this.eValueFrom1, this.eValueTo1],
13554 [this.eValueFrom2, this.eValueTo2],
13555 ];
13556 };
13557 NumberFilter.prototype.getAllowedCharPattern = function () {
13558 var allowedCharPattern = (this.numberFilterParams || {}).allowedCharPattern;
13559 if (allowedCharPattern) {
13560 return allowedCharPattern;
13561 }
13562 if (!isBrowserChrome() && !isBrowserEdge()) {
13563 // only Chrome and Edge support the HTML5 number field, so for other browsers we provide an equivalent
13564 // constraint instead
13565 return '\\d\\-\\.';
13566 }
13567 return null;
13568 };
13569 NumberFilter.DEFAULT_FILTER_OPTIONS = [
13570 ScalarFilter.EQUALS,
13571 ScalarFilter.NOT_EQUAL,
13572 ScalarFilter.LESS_THAN,
13573 ScalarFilter.LESS_THAN_OR_EQUAL,
13574 ScalarFilter.GREATER_THAN,
13575 ScalarFilter.GREATER_THAN_OR_EQUAL,
13576 ScalarFilter.IN_RANGE,
13577 ScalarFilter.BLANK,
13578 ScalarFilter.NOT_BLANK,
13579 ];
13580 __decorate$n([
13581 RefSelector('eValue-index0-1')
13582 ], NumberFilter.prototype, "eValueFrom1", void 0);
13583 __decorate$n([
13584 RefSelector('eValue-index1-1')
13585 ], NumberFilter.prototype, "eValueTo1", void 0);
13586 __decorate$n([
13587 RefSelector('eValue-index0-2')
13588 ], NumberFilter.prototype, "eValueFrom2", void 0);
13589 __decorate$n([
13590 RefSelector('eValue-index1-2')
13591 ], NumberFilter.prototype, "eValueTo2", void 0);
13592 return NumberFilter;
13593}(ScalarFilter));
13594
13595/**
13596 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13597 * @version v27.3.0
13598 * @link https://www.ag-grid.com/
13599 * @license MIT
13600 */
13601var __extends$n = (undefined && undefined.__extends) || (function () {
13602 var extendStatics = function (d, b) {
13603 extendStatics = Object.setPrototypeOf ||
13604 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
13605 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
13606 return extendStatics(d, b);
13607 };
13608 return function (d, b) {
13609 extendStatics(d, b);
13610 function __() { this.constructor = d; }
13611 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13612 };
13613})();
13614var __assign$6 = (undefined && undefined.__assign) || function () {
13615 __assign$6 = Object.assign || function(t) {
13616 for (var s, i = 1, n = arguments.length; i < n; i++) {
13617 s = arguments[i];
13618 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
13619 t[p] = s[p];
13620 }
13621 return t;
13622 };
13623 return __assign$6.apply(this, arguments);
13624};
13625var __decorate$o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13626 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13627 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13628 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;
13629 return c > 3 && r && Object.defineProperty(target, key, r), r;
13630};
13631var TextFilter = /** @class */ (function (_super) {
13632 __extends$n(TextFilter, _super);
13633 function TextFilter() {
13634 return _super.call(this, 'textFilter') || this;
13635 }
13636 TextFilter.trimInput = function (value) {
13637 var trimmedInput = value && value.trim();
13638 // trim the input, unless it is all whitespace (this is consistent with Excel behaviour)
13639 return trimmedInput === '' ? value : trimmedInput;
13640 };
13641 TextFilter.prototype.getDefaultDebounceMs = function () {
13642 return 500;
13643 };
13644 TextFilter.prototype.setParams = function (params) {
13645 _super.prototype.setParams.call(this, params);
13646 this.textFilterParams = params;
13647 this.matcher = this.getTextMatcher();
13648 this.formatter = this.textFilterParams.textFormatter ||
13649 (this.textFilterParams.caseSensitive ? TextFilter.DEFAULT_FORMATTER : TextFilter.DEFAULT_LOWERCASE_FORMATTER);
13650 };
13651 TextFilter.prototype.getTextMatcher = function () {
13652 var legacyComparator = this.textFilterParams.textCustomComparator;
13653 if (legacyComparator) {
13654 _.doOnce(function () { return console.warn('AG Grid - textCustomComparator is deprecated, use textMatcher instead.'); }, 'textCustomComparator.deprecated');
13655 return function (_a) {
13656 var filterOption = _a.filterOption, value = _a.value, filterText = _a.filterText;
13657 return legacyComparator(filterOption, value, filterText);
13658 };
13659 }
13660 return this.textFilterParams.textMatcher || TextFilter.DEFAULT_MATCHER;
13661 };
13662 TextFilter.prototype.createCondition = function (position) {
13663 var type = this.getConditionTypes()[position];
13664 var model = {
13665 filterType: this.getFilterType(),
13666 type: type,
13667 };
13668 var values = this.getValues(position);
13669 if (values.length > 0) {
13670 model.filter = values[0];
13671 }
13672 if (values.length > 1) {
13673 model.filterTo = values[1];
13674 }
13675 return model;
13676 };
13677 TextFilter.prototype.getFilterType = function () {
13678 return 'text';
13679 };
13680 TextFilter.prototype.areSimpleModelsEqual = function (aSimple, bSimple) {
13681 return aSimple.filter === bSimple.filter &&
13682 aSimple.filterTo === bSimple.filterTo &&
13683 aSimple.type === bSimple.type;
13684 };
13685 TextFilter.prototype.getInputs = function () {
13686 return [
13687 [this.eValueFrom1, this.eValueTo1],
13688 [this.eValueFrom2, this.eValueTo2],
13689 ];
13690 };
13691 TextFilter.prototype.getValues = function (position) {
13692 var _this = this;
13693 var result = [];
13694 this.forEachInput(function (element, index, elPosition, numberOfInputs) {
13695 if (position === elPosition && index < numberOfInputs) {
13696 var value = makeNull(element.getValue());
13697 var cleanValue = (_this.textFilterParams.trimInput ? TextFilter.trimInput(value) : value) || null;
13698 result.push(cleanValue);
13699 element.setValue(cleanValue, true); // ensure clean value is visible
13700 }
13701 });
13702 return result;
13703 };
13704 TextFilter.prototype.getDefaultFilterOptions = function () {
13705 return TextFilter.DEFAULT_FILTER_OPTIONS;
13706 };
13707 TextFilter.prototype.createValueTemplate = function (position) {
13708 var pos = position === ConditionPosition.One ? '1' : '2';
13709 return /* html */ "\n <div class=\"ag-filter-body\" ref=\"eCondition" + pos + "Body\" role=\"presentation\">\n <ag-input-text-field class=\".ag-filter-from ag-filter-filter\" ref=\"eValue-index0-" + pos + "\"></ag-input-text-field>\n <ag-input-text-field class=\"ag-filter-to ag-filter-filter\" ref=\"eValue-index1-" + pos + "\"></ag-input-text-field>\n </div>";
13710 };
13711 TextFilter.prototype.mapValuesFromModel = function (filterModel) {
13712 var _a = filterModel || {}, filter = _a.filter, filterTo = _a.filterTo, type = _a.type;
13713 return [
13714 filter || null,
13715 filterTo || null,
13716 ].slice(0, this.getNumberOfInputs(type));
13717 };
13718 TextFilter.prototype.evaluateNullValue = function (filterType) {
13719 var filterTypesAllowNulls = [
13720 SimpleFilter.NOT_EQUAL, SimpleFilter.NOT_CONTAINS, SimpleFilter.BLANK,
13721 ];
13722 return filterType ? filterTypesAllowNulls.indexOf(filterType) >= 0 : false;
13723 };
13724 TextFilter.prototype.evaluateNonNullValue = function (values, cellValue, filterModel, params) {
13725 var _this = this;
13726 var formattedValues = values.map(function (v) { return _this.formatter(v); }) || [];
13727 var cellValueFormatted = this.formatter(cellValue);
13728 var _a = this.textFilterParams, api = _a.api, colDef = _a.colDef, column = _a.column, columnApi = _a.columnApi, context = _a.context, textFormatter = _a.textFormatter;
13729 if (filterModel.type === SimpleFilter.BLANK) {
13730 return this.isBlank(cellValue);
13731 }
13732 else if (filterModel.type === SimpleFilter.NOT_BLANK) {
13733 return !this.isBlank(cellValue);
13734 }
13735 var matcherParams = {
13736 api: api,
13737 colDef: colDef,
13738 column: column,
13739 columnApi: columnApi,
13740 context: context,
13741 node: params.node,
13742 data: params.data,
13743 filterOption: filterModel.type,
13744 value: cellValueFormatted,
13745 textFormatter: textFormatter,
13746 };
13747 return formattedValues.some(function (v) { return _this.matcher(__assign$6(__assign$6({}, matcherParams), { filterText: v })); });
13748 };
13749 TextFilter.DEFAULT_FILTER_OPTIONS = [
13750 SimpleFilter.CONTAINS,
13751 SimpleFilter.NOT_CONTAINS,
13752 SimpleFilter.EQUALS,
13753 SimpleFilter.NOT_EQUAL,
13754 SimpleFilter.STARTS_WITH,
13755 SimpleFilter.ENDS_WITH,
13756 SimpleFilter.BLANK,
13757 SimpleFilter.NOT_BLANK,
13758 ];
13759 TextFilter.DEFAULT_FORMATTER = function (from) { return from; };
13760 TextFilter.DEFAULT_LOWERCASE_FORMATTER = function (from) { return from == null ? null : from.toString().toLowerCase(); };
13761 TextFilter.DEFAULT_MATCHER = function (_a) {
13762 var filterOption = _a.filterOption, value = _a.value, filterText = _a.filterText;
13763 if (filterText == null) {
13764 return false;
13765 }
13766 switch (filterOption) {
13767 case TextFilter.CONTAINS:
13768 return value.indexOf(filterText) >= 0;
13769 case TextFilter.NOT_CONTAINS:
13770 return value.indexOf(filterText) < 0;
13771 case TextFilter.EQUALS:
13772 return value === filterText;
13773 case TextFilter.NOT_EQUAL:
13774 return value != filterText;
13775 case TextFilter.STARTS_WITH:
13776 return value.indexOf(filterText) === 0;
13777 case TextFilter.ENDS_WITH:
13778 var index = value.lastIndexOf(filterText);
13779 return index >= 0 && index === (value.length - filterText.length);
13780 default:
13781 return false;
13782 }
13783 };
13784 __decorate$o([
13785 RefSelector('eValue-index0-1')
13786 ], TextFilter.prototype, "eValueFrom1", void 0);
13787 __decorate$o([
13788 RefSelector('eValue-index1-1')
13789 ], TextFilter.prototype, "eValueTo1", void 0);
13790 __decorate$o([
13791 RefSelector('eValue-index0-2')
13792 ], TextFilter.prototype, "eValueFrom2", void 0);
13793 __decorate$o([
13794 RefSelector('eValue-index1-2')
13795 ], TextFilter.prototype, "eValueTo2", void 0);
13796 return TextFilter;
13797}(SimpleFilter));
13798
13799/**
13800 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13801 * @version v27.3.0
13802 * @link https://www.ag-grid.com/
13803 * @license MIT
13804 */
13805var __extends$o = (undefined && undefined.__extends) || (function () {
13806 var extendStatics = function (d, b) {
13807 extendStatics = Object.setPrototypeOf ||
13808 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
13809 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
13810 return extendStatics(d, b);
13811 };
13812 return function (d, b) {
13813 extendStatics(d, b);
13814 function __() { this.constructor = d; }
13815 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13816 };
13817})();
13818var __decorate$p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13819 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13820 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13821 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;
13822 return c > 3 && r && Object.defineProperty(target, key, r), r;
13823};
13824var TextInputFloatingFilter = /** @class */ (function (_super) {
13825 __extends$o(TextInputFloatingFilter, _super);
13826 function TextInputFloatingFilter() {
13827 return _super !== null && _super.apply(this, arguments) || this;
13828 }
13829 TextInputFloatingFilter.prototype.postConstruct = function () {
13830 this.resetTemplate();
13831 };
13832 TextInputFloatingFilter.prototype.resetTemplate = function (paramsMap) {
13833 this.setTemplate(/* html */ "\n <div class=\"ag-floating-filter-input\" role=\"presentation\">\n <ag-input-text-field ref=\"eFloatingFilterInput\"></ag-input-text-field>\n </div>\n ", paramsMap);
13834 };
13835 TextInputFloatingFilter.prototype.getDefaultDebounceMs = function () {
13836 return 500;
13837 };
13838 TextInputFloatingFilter.prototype.onParentModelChanged = function (model, event) {
13839 if (this.isEventFromFloatingFilter(event)) {
13840 // if the floating filter triggered the change, it is already in sync
13841 return;
13842 }
13843 this.setLastTypeFromModel(model);
13844 this.eFloatingFilterInput.setValue(this.getTextFromModel(model));
13845 this.setEditable(this.canWeEditAfterModelFromParentFilter(model));
13846 };
13847 TextInputFloatingFilter.prototype.init = function (params) {
13848 _super.prototype.init.call(this, params);
13849 this.params = params;
13850 this.applyActive = ProvidedFilter.isUseApplyButton(this.params.filterParams);
13851 var allowedCharPattern = this.params.filterParams.allowedCharPattern;
13852 if (allowedCharPattern != null) {
13853 this.resetTemplate({ eFloatingFilterInput: { allowedCharPattern: allowedCharPattern } });
13854 }
13855 if (!this.isReadOnly()) {
13856 var debounceMs = ProvidedFilter.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs());
13857 var toDebounce = debounce(this.syncUpWithParentFilter.bind(this), debounceMs);
13858 var filterGui = this.eFloatingFilterInput.getGui();
13859 this.addManagedListener(filterGui, 'input', toDebounce);
13860 this.addManagedListener(filterGui, 'keypress', toDebounce);
13861 this.addManagedListener(filterGui, 'keydown', toDebounce);
13862 }
13863 var columnDef = params.column.getDefinition();
13864 if (this.isReadOnly() || (columnDef.filterParams &&
13865 columnDef.filterParams.filterOptions &&
13866 columnDef.filterParams.filterOptions.length === 1 &&
13867 columnDef.filterParams.filterOptions[0] === 'inRange')) {
13868 this.eFloatingFilterInput.setDisabled(true);
13869 }
13870 var displayName = this.columnModel.getDisplayNameForColumn(params.column, 'header', true);
13871 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
13872 this.eFloatingFilterInput.setInputAriaLabel(displayName + " " + translate('ariaFilterInput', 'Filter Input'));
13873 };
13874 TextInputFloatingFilter.prototype.syncUpWithParentFilter = function (e) {
13875 var _this = this;
13876 var enterKeyPressed = e.key === KeyCode.ENTER;
13877 if (this.applyActive && !enterKeyPressed) {
13878 return;
13879 }
13880 var value = this.eFloatingFilterInput.getValue();
13881 if (this.params.filterParams.trimInput) {
13882 value = TextFilter.trimInput(value);
13883 this.eFloatingFilterInput.setValue(value, true); // ensure visible value is trimmed
13884 }
13885 this.params.parentFilterInstance(function (filterInstance) {
13886 if (filterInstance) {
13887 filterInstance.onFloatingFilterChanged(_this.getLastType() || null, value || null);
13888 }
13889 });
13890 };
13891 TextInputFloatingFilter.prototype.conditionToString = function (condition, options) {
13892 var numberOfInputs = (options || {}).numberOfInputs;
13893 var isRange = condition.type == SimpleFilter.IN_RANGE || numberOfInputs === 2;
13894 if (isRange) {
13895 return condition.filter + "-" + condition.filterTo;
13896 }
13897 // cater for when the type doesn't need a value
13898 if (condition.filter != null) {
13899 return "" + condition.filter;
13900 }
13901 return "" + condition.type;
13902 };
13903 TextInputFloatingFilter.prototype.setEditable = function (editable) {
13904 this.eFloatingFilterInput.setDisabled(!editable);
13905 };
13906 __decorate$p([
13907 Autowired('columnModel')
13908 ], TextInputFloatingFilter.prototype, "columnModel", void 0);
13909 __decorate$p([
13910 RefSelector('eFloatingFilterInput')
13911 ], TextInputFloatingFilter.prototype, "eFloatingFilterInput", void 0);
13912 __decorate$p([
13913 PostConstruct
13914 ], TextInputFloatingFilter.prototype, "postConstruct", null);
13915 return TextInputFloatingFilter;
13916}(SimpleFloatingFilter));
13917
13918/**
13919 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13920 * @version v27.3.0
13921 * @link https://www.ag-grid.com/
13922 * @license MIT
13923 */
13924var __extends$p = (undefined && undefined.__extends) || (function () {
13925 var extendStatics = function (d, b) {
13926 extendStatics = Object.setPrototypeOf ||
13927 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
13928 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
13929 return extendStatics(d, b);
13930 };
13931 return function (d, b) {
13932 extendStatics(d, b);
13933 function __() { this.constructor = d; }
13934 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13935 };
13936})();
13937var NumberFloatingFilter = /** @class */ (function (_super) {
13938 __extends$p(NumberFloatingFilter, _super);
13939 function NumberFloatingFilter() {
13940 return _super !== null && _super.apply(this, arguments) || this;
13941 }
13942 NumberFloatingFilter.prototype.getDefaultFilterOptions = function () {
13943 return NumberFilter.DEFAULT_FILTER_OPTIONS;
13944 };
13945 return NumberFloatingFilter;
13946}(TextInputFloatingFilter));
13947
13948/**
13949 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13950 * @version v27.3.0
13951 * @link https://www.ag-grid.com/
13952 * @license MIT
13953 */
13954var __extends$q = (undefined && undefined.__extends) || (function () {
13955 var extendStatics = function (d, b) {
13956 extendStatics = Object.setPrototypeOf ||
13957 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
13958 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
13959 return extendStatics(d, b);
13960 };
13961 return function (d, b) {
13962 extendStatics(d, b);
13963 function __() { this.constructor = d; }
13964 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13965 };
13966})();
13967var TextFloatingFilter = /** @class */ (function (_super) {
13968 __extends$q(TextFloatingFilter, _super);
13969 function TextFloatingFilter() {
13970 return _super !== null && _super.apply(this, arguments) || this;
13971 }
13972 TextFloatingFilter.prototype.getDefaultFilterOptions = function () {
13973 return TextFilter.DEFAULT_FILTER_OPTIONS;
13974 };
13975 return TextFloatingFilter;
13976}(TextInputFloatingFilter));
13977
13978/**
13979 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
13980 * @version v27.3.0
13981 * @link https://www.ag-grid.com/
13982 * @license MIT
13983 */
13984var TouchListener = /** @class */ (function () {
13985 function TouchListener(eElement, preventMouseClick) {
13986 var _this = this;
13987 if (preventMouseClick === void 0) { preventMouseClick = false; }
13988 this.destroyFuncs = [];
13989 this.touching = false;
13990 this.eventService = new EventService();
13991 this.eElement = eElement;
13992 this.preventMouseClick = preventMouseClick;
13993 var startListener = this.onTouchStart.bind(this);
13994 var moveListener = this.onTouchMove.bind(this);
13995 var endListener = this.onTouchEnd.bind(this);
13996 this.eElement.addEventListener("touchstart", startListener, { passive: true });
13997 this.eElement.addEventListener("touchmove", moveListener, { passive: true });
13998 // we set passive=false, as we want to prevent default on this event
13999 this.eElement.addEventListener("touchend", endListener, { passive: false });
14000 this.destroyFuncs.push(function () {
14001 _this.eElement.removeEventListener("touchstart", startListener, { passive: true });
14002 _this.eElement.removeEventListener("touchmove", moveListener, { passive: true });
14003 _this.eElement.removeEventListener("touchend", endListener, { passive: false });
14004 });
14005 }
14006 TouchListener.prototype.getActiveTouch = function (touchList) {
14007 for (var i = 0; i < touchList.length; i++) {
14008 var matches = touchList[i].identifier === this.touchStart.identifier;
14009 if (matches) {
14010 return touchList[i];
14011 }
14012 }
14013 return null;
14014 };
14015 TouchListener.prototype.addEventListener = function (eventType, listener) {
14016 this.eventService.addEventListener(eventType, listener);
14017 };
14018 TouchListener.prototype.removeEventListener = function (eventType, listener) {
14019 this.eventService.removeEventListener(eventType, listener);
14020 };
14021 TouchListener.prototype.onTouchStart = function (touchEvent) {
14022 var _this = this;
14023 // only looking at one touch point at any time
14024 if (this.touching) {
14025 return;
14026 }
14027 this.touchStart = touchEvent.touches[0];
14028 this.touching = true;
14029 this.moved = false;
14030 var touchStartCopy = this.touchStart;
14031 window.setTimeout(function () {
14032 var touchesMatch = _this.touchStart === touchStartCopy;
14033 if (_this.touching && touchesMatch && !_this.moved) {
14034 _this.moved = true;
14035 var event_1 = {
14036 type: TouchListener.EVENT_LONG_TAP,
14037 touchStart: _this.touchStart,
14038 touchEvent: touchEvent
14039 };
14040 _this.eventService.dispatchEvent(event_1);
14041 }
14042 }, 500);
14043 };
14044 TouchListener.prototype.onTouchMove = function (touchEvent) {
14045 if (!this.touching) {
14046 return;
14047 }
14048 var touch = this.getActiveTouch(touchEvent.touches);
14049 if (!touch) {
14050 return;
14051 }
14052 var eventIsFarAway = !areEventsNear(touch, this.touchStart, 4);
14053 if (eventIsFarAway) {
14054 this.moved = true;
14055 }
14056 };
14057 TouchListener.prototype.onTouchEnd = function (touchEvent) {
14058 if (!this.touching) {
14059 return;
14060 }
14061 if (!this.moved) {
14062 var event_2 = {
14063 type: TouchListener.EVENT_TAP,
14064 touchStart: this.touchStart
14065 };
14066 this.eventService.dispatchEvent(event_2);
14067 this.checkForDoubleTap();
14068 }
14069 // stops the tap from also been processed as a mouse click
14070 if (this.preventMouseClick) {
14071 touchEvent.preventDefault();
14072 }
14073 this.touching = false;
14074 };
14075 TouchListener.prototype.checkForDoubleTap = function () {
14076 var now = new Date().getTime();
14077 if (this.lastTapTime && this.lastTapTime > 0) {
14078 // if previous tap, see if duration is short enough to be considered double tap
14079 var interval = now - this.lastTapTime;
14080 if (interval > TouchListener.DOUBLE_TAP_MILLIS) {
14081 // dispatch double tap event
14082 var event_3 = {
14083 type: TouchListener.EVENT_DOUBLE_TAP,
14084 touchStart: this.touchStart
14085 };
14086 this.eventService.dispatchEvent(event_3);
14087 // this stops a tripple tap ending up as two double taps
14088 this.lastTapTime = null;
14089 }
14090 else {
14091 this.lastTapTime = now;
14092 }
14093 }
14094 else {
14095 this.lastTapTime = now;
14096 }
14097 };
14098 TouchListener.prototype.destroy = function () {
14099 this.destroyFuncs.forEach(function (func) { return func(); });
14100 };
14101 TouchListener.EVENT_TAP = "tap";
14102 TouchListener.EVENT_DOUBLE_TAP = "doubleTap";
14103 TouchListener.EVENT_LONG_TAP = "longTap";
14104 TouchListener.DOUBLE_TAP_MILLIS = 500;
14105 return TouchListener;
14106}());
14107
14108/**
14109 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
14110 * @version v27.3.0
14111 * @link https://www.ag-grid.com/
14112 * @license MIT
14113 */
14114var __extends$r = (undefined && undefined.__extends) || (function () {
14115 var extendStatics = function (d, b) {
14116 extendStatics = Object.setPrototypeOf ||
14117 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14118 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
14119 return extendStatics(d, b);
14120 };
14121 return function (d, b) {
14122 extendStatics(d, b);
14123 function __() { this.constructor = d; }
14124 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14125 };
14126})();
14127var __decorate$q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14128 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14129 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14130 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;
14131 return c > 3 && r && Object.defineProperty(target, key, r), r;
14132};
14133var HeaderComp = /** @class */ (function (_super) {
14134 __extends$r(HeaderComp, _super);
14135 function HeaderComp() {
14136 var _this = _super !== null && _super.apply(this, arguments) || this;
14137 _this.lastMovingChanged = 0;
14138 return _this;
14139 }
14140 // this is a user component, and IComponent has "public destroy()" as part of the interface.
14141 // so we need to override destroy() just to make the method public.
14142 HeaderComp.prototype.destroy = function () {
14143 _super.prototype.destroy.call(this);
14144 };
14145 HeaderComp.prototype.refresh = function (params) {
14146 this.params = params;
14147 // if template changed, then recreate the whole comp, the code required to manage
14148 // a changing template is to difficult for what it's worth.
14149 if (this.workOutTemplate() != this.currentTemplate) {
14150 return false;
14151 }
14152 if (this.workOutShowMenu() != this.currentShowMenu) {
14153 return false;
14154 }
14155 if (this.workOutSort() != this.currentSort) {
14156 return false;
14157 }
14158 this.setDisplayName(params);
14159 return true;
14160 };
14161 HeaderComp.prototype.workOutTemplate = function () {
14162 var template = firstExistingValue(this.params.template, HeaderComp.TEMPLATE);
14163 // take account of any newlines & whitespace before/after the actual template
14164 template = template && template.trim ? template.trim() : template;
14165 return template;
14166 };
14167 HeaderComp.prototype.init = function (params) {
14168 this.params = params;
14169 this.currentTemplate = this.workOutTemplate();
14170 this.setTemplate(this.currentTemplate);
14171 this.setupTap();
14172 this.setupIcons(params.column);
14173 this.setMenu();
14174 this.setupSort();
14175 this.setupFilterIcon();
14176 this.setDisplayName(params);
14177 };
14178 HeaderComp.prototype.setDisplayName = function (params) {
14179 if (this.currentDisplayName != params.displayName) {
14180 this.currentDisplayName = params.displayName;
14181 var displayNameSanitised = escapeString(this.currentDisplayName);
14182 if (this.eText) {
14183 this.eText.innerHTML = displayNameSanitised;
14184 }
14185 }
14186 };
14187 HeaderComp.prototype.setupIcons = function (column) {
14188 this.addInIcon('sortAscending', this.eSortAsc, column);
14189 this.addInIcon('sortDescending', this.eSortDesc, column);
14190 this.addInIcon('sortUnSort', this.eSortNone, column);
14191 this.addInIcon('menu', this.eMenu, column);
14192 this.addInIcon('filter', this.eFilter, column);
14193 };
14194 HeaderComp.prototype.addInIcon = function (iconName, eParent, column) {
14195 if (eParent == null) {
14196 return;
14197 }
14198 var eIcon = createIconNoSpan(iconName, this.gridOptionsWrapper, column);
14199 if (eIcon) {
14200 eParent.appendChild(eIcon);
14201 }
14202 };
14203 HeaderComp.prototype.setupTap = function () {
14204 var _this = this;
14205 var options = this.gridOptionsWrapper;
14206 if (options.isSuppressTouch()) {
14207 return;
14208 }
14209 var touchListener = new TouchListener(this.getGui(), true);
14210 var suppressMenuHide = options.isSuppressMenuHide();
14211 var tapMenuButton = suppressMenuHide && exists(this.eMenu);
14212 var menuTouchListener = tapMenuButton ? new TouchListener(this.eMenu, true) : touchListener;
14213 if (this.params.enableMenu) {
14214 var eventType = tapMenuButton ? 'EVENT_TAP' : 'EVENT_LONG_TAP';
14215 var showMenuFn = function (event) {
14216 options.getApi().showColumnMenuAfterMouseClick(_this.params.column, event.touchStart);
14217 };
14218 this.addManagedListener(menuTouchListener, TouchListener[eventType], showMenuFn);
14219 }
14220 if (this.params.enableSorting) {
14221 var tapListener = function (event) {
14222 var target = event.touchStart.target;
14223 // When suppressMenuHide is true, a tap on the menu icon will bubble up
14224 // to the header container, in that case we should not sort
14225 if (suppressMenuHide && _this.eMenu.contains(target)) {
14226 return;
14227 }
14228 _this.sortController.progressSort(_this.params.column, false, "uiColumnSorted");
14229 };
14230 this.addManagedListener(touchListener, TouchListener.EVENT_TAP, tapListener);
14231 }
14232 // if tapMenuButton is true `touchListener` and `menuTouchListener` are different
14233 // so we need to make sure to destroy both listeners here
14234 this.addDestroyFunc(function () { return touchListener.destroy(); });
14235 if (tapMenuButton) {
14236 this.addDestroyFunc(function () { return menuTouchListener.destroy(); });
14237 }
14238 };
14239 HeaderComp.prototype.workOutShowMenu = function () {
14240 // we don't show the menu if on an iPad/iPhone, as the user cannot have a pointer device/
14241 // However if suppressMenuHide is set to true the menu will be displayed alwasys, so it's ok
14242 // to show it on iPad in this case (as hover isn't needed). If suppressMenuHide
14243 // is false (default) user will need to use longpress to display the menu.
14244 var menuHides = !this.gridOptionsWrapper.isSuppressMenuHide();
14245 var onIpadAndMenuHides = isIOSUserAgent() && menuHides;
14246 var showMenu = this.params.enableMenu && !onIpadAndMenuHides;
14247 return showMenu;
14248 };
14249 HeaderComp.prototype.setMenu = function () {
14250 var _this = this;
14251 // if no menu provided in template, do nothing
14252 if (!this.eMenu) {
14253 return;
14254 }
14255 this.currentShowMenu = this.workOutShowMenu();
14256 if (!this.currentShowMenu) {
14257 removeFromParent(this.eMenu);
14258 return;
14259 }
14260 var suppressMenuHide = this.gridOptionsWrapper.isSuppressMenuHide();
14261 this.addManagedListener(this.eMenu, 'click', function () { return _this.showMenu(_this.eMenu); });
14262 this.eMenu.classList.toggle('ag-header-menu-always-show', suppressMenuHide);
14263 };
14264 HeaderComp.prototype.showMenu = function (eventSource) {
14265 if (!eventSource) {
14266 eventSource = this.eMenu;
14267 }
14268 this.menuFactory.showMenuAfterButtonClick(this.params.column, eventSource, 'columnMenu');
14269 };
14270 HeaderComp.prototype.removeSortIcons = function () {
14271 removeFromParent(this.eSortAsc);
14272 removeFromParent(this.eSortDesc);
14273 removeFromParent(this.eSortNone);
14274 removeFromParent(this.eSortOrder);
14275 };
14276 HeaderComp.prototype.workOutSort = function () {
14277 return this.params.enableSorting;
14278 };
14279 HeaderComp.prototype.setupSort = function () {
14280 var _this = this;
14281 this.currentSort = this.params.enableSorting;
14282 if (!this.currentSort) {
14283 this.removeSortIcons();
14284 return;
14285 }
14286 var sortUsingCtrl = this.gridOptionsWrapper.isMultiSortKeyCtrl();
14287 // keep track of last time the moving changed flag was set
14288 this.addManagedListener(this.params.column, Column.EVENT_MOVING_CHANGED, function () {
14289 _this.lastMovingChanged = new Date().getTime();
14290 });
14291 // add the event on the header, so when clicked, we do sorting
14292 if (this.eLabel) {
14293 this.addManagedListener(this.eLabel, 'click', function (event) {
14294 // sometimes when moving a column via dragging, this was also firing a clicked event.
14295 // here is issue raised by user: https://ag-grid.zendesk.com/agent/tickets/1076
14296 // this check stops sort if a) column is moving or b) column moved less than 200ms ago (so caters for race condition)
14297 var moving = _this.params.column.isMoving();
14298 var nowTime = new Date().getTime();
14299 // typically there is <2ms if moving flag was set recently, as it would be done in same VM turn
14300 var movedRecently = (nowTime - _this.lastMovingChanged) < 50;
14301 var columnMoving = moving || movedRecently;
14302 if (!columnMoving) {
14303 var multiSort = sortUsingCtrl ? (event.ctrlKey || event.metaKey) : event.shiftKey;
14304 _this.params.progressSort(multiSort);
14305 }
14306 });
14307 }
14308 this.addManagedListener(this.params.column, Column.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
14309 this.onSortChanged();
14310 this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.setMultiSortOrder.bind(this));
14311 this.setMultiSortOrder();
14312 };
14313 HeaderComp.prototype.onSortChanged = function () {
14314 this.addOrRemoveCssClass('ag-header-cell-sorted-asc', this.params.column.isSortAscending());
14315 this.addOrRemoveCssClass('ag-header-cell-sorted-desc', this.params.column.isSortDescending());
14316 this.addOrRemoveCssClass('ag-header-cell-sorted-none', this.params.column.isSortNone());
14317 if (this.eSortAsc) {
14318 this.eSortAsc.classList.toggle('ag-hidden', !this.params.column.isSortAscending());
14319 }
14320 if (this.eSortDesc) {
14321 this.eSortDesc.classList.toggle('ag-hidden', !this.params.column.isSortDescending());
14322 }
14323 if (this.eSortNone) {
14324 var alwaysHideNoSort = !this.params.column.getColDef().unSortIcon && !this.gridOptionsWrapper.isUnSortIcon();
14325 this.eSortNone.classList.toggle('ag-hidden', alwaysHideNoSort || !this.params.column.isSortNone());
14326 }
14327 };
14328 // we listen here for global sort events, NOT column sort events, as we want to do this
14329 // when sorting has been set on all column (if we listened just for our col (where we
14330 // set the asc / desc icons) then it's possible other cols are yet to get their sorting state.
14331 HeaderComp.prototype.setMultiSortOrder = function () {
14332 if (!this.eSortOrder) {
14333 return;
14334 }
14335 var col = this.params.column;
14336 var allColumnsWithSorting = this.sortController.getColumnsWithSortingOrdered();
14337 var indexThisCol = allColumnsWithSorting.indexOf(col);
14338 var moreThanOneColSorting = allColumnsWithSorting.length > 1;
14339 var showIndex = col.isSorting() && moreThanOneColSorting;
14340 setDisplayed(this.eSortOrder, showIndex);
14341 if (indexThisCol >= 0) {
14342 this.eSortOrder.innerHTML = (indexThisCol + 1).toString();
14343 }
14344 else {
14345 clearElement(this.eSortOrder);
14346 }
14347 };
14348 HeaderComp.prototype.setupFilterIcon = function () {
14349 if (!this.eFilter) {
14350 return;
14351 }
14352 this.addManagedListener(this.params.column, Column.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
14353 this.onFilterChanged();
14354 };
14355 HeaderComp.prototype.onFilterChanged = function () {
14356 var filterPresent = this.params.column.isFilterActive();
14357 this.eFilter.classList.toggle('ag-hidden', !filterPresent);
14358 };
14359 HeaderComp.TEMPLATE = "<div class=\"ag-cell-label-container\" role=\"presentation\">\n <span ref=\"eMenu\" class=\"ag-header-icon ag-header-cell-menu-button\" aria-hidden=\"true\"></span>\n <div ref=\"eLabel\" class=\"ag-header-cell-label\" role=\"presentation\">\n <span ref=\"eText\" class=\"ag-header-cell-text\"></span>\n <span ref=\"eFilter\" class=\"ag-header-icon ag-header-label-icon ag-filter-icon\" aria-hidden=\"true\"></span>\n <span ref=\"eSortOrder\" class=\"ag-header-icon ag-header-label-icon ag-sort-order\" aria-hidden=\"true\"></span>\n <span ref=\"eSortAsc\" class=\"ag-header-icon ag-header-label-icon ag-sort-ascending-icon\" aria-hidden=\"true\"></span>\n <span ref=\"eSortDesc\" class=\"ag-header-icon ag-header-label-icon ag-sort-descending-icon\" aria-hidden=\"true\"></span>\n <span ref=\"eSortNone\" class=\"ag-header-icon ag-header-label-icon ag-sort-none-icon\" aria-hidden=\"true\"></span>\n </div>\n </div>";
14360 __decorate$q([
14361 Autowired('sortController')
14362 ], HeaderComp.prototype, "sortController", void 0);
14363 __decorate$q([
14364 Autowired('menuFactory')
14365 ], HeaderComp.prototype, "menuFactory", void 0);
14366 __decorate$q([
14367 RefSelector('eFilter')
14368 ], HeaderComp.prototype, "eFilter", void 0);
14369 __decorate$q([
14370 RefSelector('eSortAsc')
14371 ], HeaderComp.prototype, "eSortAsc", void 0);
14372 __decorate$q([
14373 RefSelector('eSortDesc')
14374 ], HeaderComp.prototype, "eSortDesc", void 0);
14375 __decorate$q([
14376 RefSelector('eSortNone')
14377 ], HeaderComp.prototype, "eSortNone", void 0);
14378 __decorate$q([
14379 RefSelector('eSortOrder')
14380 ], HeaderComp.prototype, "eSortOrder", void 0);
14381 __decorate$q([
14382 RefSelector('eMenu')
14383 ], HeaderComp.prototype, "eMenu", void 0);
14384 __decorate$q([
14385 RefSelector('eLabel')
14386 ], HeaderComp.prototype, "eLabel", void 0);
14387 __decorate$q([
14388 RefSelector('eText')
14389 ], HeaderComp.prototype, "eText", void 0);
14390 return HeaderComp;
14391}(Component));
14392
14393/**
14394 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
14395 * @version v27.3.0
14396 * @link https://www.ag-grid.com/
14397 * @license MIT
14398 */
14399var __extends$s = (undefined && undefined.__extends) || (function () {
14400 var extendStatics = function (d, b) {
14401 extendStatics = Object.setPrototypeOf ||
14402 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14403 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
14404 return extendStatics(d, b);
14405 };
14406 return function (d, b) {
14407 extendStatics(d, b);
14408 function __() { this.constructor = d; }
14409 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14410 };
14411})();
14412var __decorate$r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14413 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14414 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14415 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;
14416 return c > 3 && r && Object.defineProperty(target, key, r), r;
14417};
14418var HeaderGroupComp = /** @class */ (function (_super) {
14419 __extends$s(HeaderGroupComp, _super);
14420 function HeaderGroupComp() {
14421 return _super.call(this, HeaderGroupComp.TEMPLATE) || this;
14422 }
14423 // this is a user component, and IComponent has "public destroy()" as part of the interface.
14424 // so we need to override destroy() just to make the method public.
14425 HeaderGroupComp.prototype.destroy = function () {
14426 _super.prototype.destroy.call(this);
14427 };
14428 HeaderGroupComp.prototype.init = function (params) {
14429 this.params = params;
14430 this.checkWarnings();
14431 this.setupLabel();
14432 this.addGroupExpandIcon();
14433 this.setupExpandIcons();
14434 };
14435 HeaderGroupComp.prototype.checkWarnings = function () {
14436 var paramsAny = this.params;
14437 if (paramsAny.template) {
14438 var message_1 = "AG Grid: A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)";
14439 doOnce(function () { return console.warn(message_1); }, 'HeaderGroupComp.templateNotSupported');
14440 }
14441 };
14442 HeaderGroupComp.prototype.setupExpandIcons = function () {
14443 var _this = this;
14444 this.addInIcon("columnGroupOpened", "agOpened");
14445 this.addInIcon("columnGroupClosed", "agClosed");
14446 var expandAction = function (event) {
14447 if (isStopPropagationForAgGrid(event)) {
14448 return;
14449 }
14450 var newExpandedValue = !_this.params.columnGroup.isExpanded();
14451 _this.columnModel.setColumnGroupOpened(_this.params.columnGroup.getProvidedColumnGroup(), newExpandedValue, "uiColumnExpanded");
14452 };
14453 this.addTouchAndClickListeners(this.eCloseIcon, expandAction);
14454 this.addTouchAndClickListeners(this.eOpenIcon, expandAction);
14455 var stopPropagationAction = function (event) {
14456 stopPropagationForAgGrid(event);
14457 };
14458 // adding stopPropagation to the double click for the icons prevents double click action happening
14459 // when the icons are clicked. if the icons are double clicked, then the groups should open and
14460 // then close again straight away. if we also listened to double click, then the group would open,
14461 // close, then open, which is not what we want. double click should only action if the user double
14462 // clicks outside of the icons.
14463 this.addManagedListener(this.eCloseIcon, "dblclick", stopPropagationAction);
14464 this.addManagedListener(this.eOpenIcon, "dblclick", stopPropagationAction);
14465 this.addManagedListener(this.getGui(), "dblclick", expandAction);
14466 this.updateIconVisibility();
14467 var providedColumnGroup = this.params.columnGroup.getProvidedColumnGroup();
14468 this.addManagedListener(providedColumnGroup, ProvidedColumnGroup.EVENT_EXPANDED_CHANGED, this.updateIconVisibility.bind(this));
14469 this.addManagedListener(providedColumnGroup, ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED, this.updateIconVisibility.bind(this));
14470 };
14471 HeaderGroupComp.prototype.addTouchAndClickListeners = function (eElement, action) {
14472 var touchListener = new TouchListener(eElement, true);
14473 this.addManagedListener(touchListener, TouchListener.EVENT_TAP, action);
14474 this.addDestroyFunc(function () { return touchListener.destroy(); });
14475 this.addManagedListener(eElement, "click", action);
14476 };
14477 HeaderGroupComp.prototype.updateIconVisibility = function () {
14478 var columnGroup = this.params.columnGroup;
14479 if (columnGroup.isExpandable()) {
14480 var expanded = this.params.columnGroup.isExpanded();
14481 setDisplayed(this.eOpenIcon, expanded);
14482 setDisplayed(this.eCloseIcon, !expanded);
14483 }
14484 else {
14485 setDisplayed(this.eOpenIcon, false);
14486 setDisplayed(this.eCloseIcon, false);
14487 }
14488 };
14489 HeaderGroupComp.prototype.addInIcon = function (iconName, refName) {
14490 var eIcon = createIconNoSpan(iconName, this.gridOptionsWrapper, null);
14491 if (eIcon) {
14492 this.getRefElement(refName).appendChild(eIcon);
14493 }
14494 };
14495 HeaderGroupComp.prototype.addGroupExpandIcon = function () {
14496 if (!this.params.columnGroup.isExpandable()) {
14497 setDisplayed(this.eOpenIcon, false);
14498 setDisplayed(this.eCloseIcon, false);
14499 return;
14500 }
14501 };
14502 HeaderGroupComp.prototype.setupLabel = function () {
14503 // no renderer, default text render
14504 var displayName = this.params.displayName;
14505 if (exists(displayName)) {
14506 var displayNameSanitised = escapeString(displayName);
14507 this.getRefElement('agLabel').innerHTML = displayNameSanitised;
14508 }
14509 };
14510 HeaderGroupComp.TEMPLATE = "<div class=\"ag-header-group-cell-label\" ref=\"agContainer\" role=\"presentation\">\n <span ref=\"agLabel\" class=\"ag-header-group-text\" role=\"presentation\"></span>\n <span ref=\"agOpened\" class=\"ag-header-icon ag-header-expand-icon ag-header-expand-icon-expanded\"></span>\n <span ref=\"agClosed\" class=\"ag-header-icon ag-header-expand-icon ag-header-expand-icon-collapsed\"></span>\n </div>";
14511 __decorate$r([
14512 Autowired("columnModel")
14513 ], HeaderGroupComp.prototype, "columnModel", void 0);
14514 __decorate$r([
14515 RefSelector("agOpened")
14516 ], HeaderGroupComp.prototype, "eOpenIcon", void 0);
14517 __decorate$r([
14518 RefSelector("agClosed")
14519 ], HeaderGroupComp.prototype, "eCloseIcon", void 0);
14520 return HeaderGroupComp;
14521}(Component));
14522
14523/**
14524 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
14525 * @version v27.3.0
14526 * @link https://www.ag-grid.com/
14527 * @license MIT
14528 */
14529var __extends$t = (undefined && undefined.__extends) || (function () {
14530 var extendStatics = function (d, b) {
14531 extendStatics = Object.setPrototypeOf ||
14532 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14533 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
14534 return extendStatics(d, b);
14535 };
14536 return function (d, b) {
14537 extendStatics(d, b);
14538 function __() { this.constructor = d; }
14539 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14540 };
14541})();
14542var PopupComponent = /** @class */ (function (_super) {
14543 __extends$t(PopupComponent, _super);
14544 function PopupComponent() {
14545 return _super !== null && _super.apply(this, arguments) || this;
14546 }
14547 PopupComponent.prototype.isPopup = function () {
14548 return true;
14549 };
14550 PopupComponent.prototype.setParentComponent = function (container) {
14551 container.addCssClass('ag-has-popup');
14552 _super.prototype.setParentComponent.call(this, container);
14553 };
14554 PopupComponent.prototype.destroy = function () {
14555 var parentComp = this.parentComponent;
14556 var hasParent = parentComp && parentComp.isAlive();
14557 if (hasParent) {
14558 parentComp.getGui().classList.remove('ag-has-popup');
14559 }
14560 _super.prototype.destroy.call(this);
14561 };
14562 return PopupComponent;
14563}(Component));
14564
14565/**
14566 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
14567 * @version v27.3.0
14568 * @link https://www.ag-grid.com/
14569 * @license MIT
14570 */
14571var __extends$u = (undefined && undefined.__extends) || (function () {
14572 var extendStatics = function (d, b) {
14573 extendStatics = Object.setPrototypeOf ||
14574 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14575 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
14576 return extendStatics(d, b);
14577 };
14578 return function (d, b) {
14579 extendStatics(d, b);
14580 function __() { this.constructor = d; }
14581 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14582 };
14583})();
14584var __decorate$s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14585 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14586 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14587 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;
14588 return c > 3 && r && Object.defineProperty(target, key, r), r;
14589};
14590var LargeTextCellEditor = /** @class */ (function (_super) {
14591 __extends$u(LargeTextCellEditor, _super);
14592 function LargeTextCellEditor() {
14593 return _super.call(this, LargeTextCellEditor.TEMPLATE) || this;
14594 }
14595 LargeTextCellEditor.prototype.init = function (params) {
14596 this.params = params;
14597 this.focusAfterAttached = params.cellStartedEdit;
14598 this.eTextArea
14599 .setMaxLength(params.maxLength || 200)
14600 .setCols(params.cols || 60)
14601 .setRows(params.rows || 10);
14602 if (exists(params.value)) {
14603 this.eTextArea.setValue(params.value.toString(), true);
14604 }
14605 this.addGuiEventListener('keydown', this.onKeyDown.bind(this));
14606 };
14607 LargeTextCellEditor.prototype.onKeyDown = function (event) {
14608 var key = event.key;
14609 if (key === KeyCode.LEFT ||
14610 key === KeyCode.UP ||
14611 key === KeyCode.RIGHT ||
14612 key === KeyCode.DOWN ||
14613 (event.shiftKey && key === KeyCode.ENTER)) { // shift+enter allows for newlines
14614 event.stopPropagation();
14615 }
14616 };
14617 LargeTextCellEditor.prototype.afterGuiAttached = function () {
14618 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
14619 this.eTextArea.setInputAriaLabel(translate('ariaInputEditor', 'Input Editor'));
14620 if (this.focusAfterAttached) {
14621 this.eTextArea.getFocusableElement().focus();
14622 }
14623 };
14624 LargeTextCellEditor.prototype.getValue = function () {
14625 return this.params.parseValue(this.eTextArea.getValue());
14626 };
14627 LargeTextCellEditor.TEMPLATE = "<div class=\"ag-large-text\" tabindex=\"0\">\n <ag-input-text-area ref=\"eTextArea\" class=\"ag-large-text-input\"></ag-input-text-area>\n </div>";
14628 __decorate$s([
14629 RefSelector("eTextArea")
14630 ], LargeTextCellEditor.prototype, "eTextArea", void 0);
14631 return LargeTextCellEditor;
14632}(PopupComponent));
14633
14634/**
14635 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
14636 * @version v27.3.0
14637 * @link https://www.ag-grid.com/
14638 * @license MIT
14639 */
14640var __extends$v = (undefined && undefined.__extends) || (function () {
14641 var extendStatics = function (d, b) {
14642 extendStatics = Object.setPrototypeOf ||
14643 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14644 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
14645 return extendStatics(d, b);
14646 };
14647 return function (d, b) {
14648 extendStatics(d, b);
14649 function __() { this.constructor = d; }
14650 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14651 };
14652})();
14653var __decorate$t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14654 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14655 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14656 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;
14657 return c > 3 && r && Object.defineProperty(target, key, r), r;
14658};
14659var SelectCellEditor = /** @class */ (function (_super) {
14660 __extends$v(SelectCellEditor, _super);
14661 function SelectCellEditor() {
14662 var _this = _super.call(this, '<div class="ag-cell-edit-wrapper"><ag-select class="ag-cell-editor" ref="eSelect"></ag-select></div>') || this;
14663 _this.startedByEnter = false;
14664 return _this;
14665 }
14666 SelectCellEditor.prototype.init = function (params) {
14667 var _this = this;
14668 this.focusAfterAttached = params.cellStartedEdit;
14669 if (missing(params.values)) {
14670 console.warn('AG Grid: no values found for select cellEditor');
14671 return;
14672 }
14673 this.startedByEnter = params.eventKey != null ? params.eventKey === KeyCode.ENTER : false;
14674 var hasValue = false;
14675 params.values.forEach(function (value) {
14676 var option = { value: value };
14677 var valueFormatted = _this.valueFormatterService.formatValue(params.column, null, null, value);
14678 var valueFormattedExits = valueFormatted !== null && valueFormatted !== undefined;
14679 option.text = valueFormattedExits ? valueFormatted : value;
14680 _this.eSelect.addOption(option);
14681 hasValue = hasValue || params.value === value;
14682 });
14683 if (hasValue) {
14684 this.eSelect.setValue(params.value, true);
14685 }
14686 else if (params.values.length) {
14687 this.eSelect.setValue(params.values[0], true);
14688 }
14689 // we don't want to add this if full row editing, otherwise selecting will stop the
14690 // full row editing.
14691 if (!this.gridOptionsWrapper.isFullRowEdit()) {
14692 this.eSelect.onValueChange(function () { return params.stopEditing(); });
14693 }
14694 };
14695 SelectCellEditor.prototype.afterGuiAttached = function () {
14696 if (this.focusAfterAttached) {
14697 this.eSelect.getFocusableElement().focus();
14698 }
14699 if (this.startedByEnter) {
14700 this.eSelect.showPicker();
14701 }
14702 };
14703 SelectCellEditor.prototype.focusIn = function () {
14704 this.eSelect.getFocusableElement().focus();
14705 };
14706 SelectCellEditor.prototype.getValue = function () {
14707 return this.eSelect.getValue();
14708 };
14709 SelectCellEditor.prototype.isPopup = function () {
14710 return false;
14711 };
14712 __decorate$t([
14713 Autowired('valueFormatterService')
14714 ], SelectCellEditor.prototype, "valueFormatterService", void 0);
14715 __decorate$t([
14716 RefSelector('eSelect')
14717 ], SelectCellEditor.prototype, "eSelect", void 0);
14718 return SelectCellEditor;
14719}(PopupComponent));
14720
14721/**
14722 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
14723 * @version v27.3.0
14724 * @link https://www.ag-grid.com/
14725 * @license MIT
14726 */
14727var __extends$w = (undefined && undefined.__extends) || (function () {
14728 var extendStatics = function (d, b) {
14729 extendStatics = Object.setPrototypeOf ||
14730 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14731 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
14732 return extendStatics(d, b);
14733 };
14734 return function (d, b) {
14735 extendStatics(d, b);
14736 function __() { this.constructor = d; }
14737 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14738 };
14739})();
14740var PopupSelectCellEditor = /** @class */ (function (_super) {
14741 __extends$w(PopupSelectCellEditor, _super);
14742 function PopupSelectCellEditor() {
14743 var _this = _super.call(this) || this;
14744 doOnce(function () { return console.warn('AG Grid: The PopupSelectCellEditor (agPopupSelectCellEditor) is deprecated. Instead use {cellEditor: "agSelectCellEditor", cellEditorPopup: true} '); }, 'PopupSelectCellEditor.deprecated');
14745 return _this;
14746 }
14747 PopupSelectCellEditor.prototype.isPopup = function () {
14748 return true;
14749 };
14750 return PopupSelectCellEditor;
14751}(SelectCellEditor));
14752
14753/**
14754 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
14755 * @version v27.3.0
14756 * @link https://www.ag-grid.com/
14757 * @license MIT
14758 */
14759var __extends$x = (undefined && undefined.__extends) || (function () {
14760 var extendStatics = function (d, b) {
14761 extendStatics = Object.setPrototypeOf ||
14762 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14763 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
14764 return extendStatics(d, b);
14765 };
14766 return function (d, b) {
14767 extendStatics(d, b);
14768 function __() { this.constructor = d; }
14769 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14770 };
14771})();
14772var __decorate$u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14773 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14774 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14775 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;
14776 return c > 3 && r && Object.defineProperty(target, key, r), r;
14777};
14778var TextCellEditor = /** @class */ (function (_super) {
14779 __extends$x(TextCellEditor, _super);
14780 function TextCellEditor() {
14781 return _super.call(this, TextCellEditor.TEMPLATE) || this;
14782 }
14783 TextCellEditor.prototype.init = function (params) {
14784 this.params = params;
14785 var eInput = this.eInput;
14786 var startValue;
14787 // cellStartedEdit is only false if we are doing fullRow editing
14788 if (params.cellStartedEdit) {
14789 this.focusAfterAttached = true;
14790 if (params.eventKey === KeyCode.BACKSPACE || params.eventKey === KeyCode.DELETE) {
14791 startValue = '';
14792 }
14793 else if (params.charPress) {
14794 startValue = params.charPress;
14795 }
14796 else {
14797 startValue = this.getStartValue(params);
14798 if (params.eventKey !== KeyCode.F2) {
14799 this.highlightAllOnFocus = true;
14800 }
14801 }
14802 }
14803 else {
14804 this.focusAfterAttached = false;
14805 startValue = this.getStartValue(params);
14806 }
14807 if (startValue != null) {
14808 eInput.setValue(startValue, true);
14809 }
14810 this.addManagedListener(eInput.getGui(), 'keydown', function (event) {
14811 var key = event.key;
14812 if (key === KeyCode.PAGE_UP || key === KeyCode.PAGE_DOWN) {
14813 event.preventDefault();
14814 }
14815 });
14816 };
14817 TextCellEditor.prototype.afterGuiAttached = function () {
14818 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
14819 var eInput = this.eInput;
14820 eInput.setInputAriaLabel(translate('ariaInputEditor', 'Input Editor'));
14821 if (!this.focusAfterAttached) {
14822 return;
14823 }
14824 // Added for AG-3238. We can't remove this explicit focus() because Chrome requires an input
14825 // to be focused before setSelectionRange will work. But it triggers a bug in Safari where
14826 // explicitly focusing then blurring an empty field will cause the parent container to scroll.
14827 if (!isBrowserSafari()) {
14828 eInput.getFocusableElement().focus();
14829 }
14830 var inputEl = eInput.getInputElement();
14831 if (this.highlightAllOnFocus) {
14832 inputEl.select();
14833 }
14834 else {
14835 // when we started editing, we want the caret at the end, not the start.
14836 // this comes into play in two scenarios:
14837 // a) when user hits F2
14838 // b) when user hits a printable character
14839 var value = eInput.getValue();
14840 var len = (exists(value) && value.length) || 0;
14841 if (len) {
14842 inputEl.setSelectionRange(len, len);
14843 }
14844 }
14845 };
14846 // gets called when tabbing trough cells and in full row edit mode
14847 TextCellEditor.prototype.focusIn = function () {
14848 var eInput = this.eInput;
14849 var focusEl = eInput.getFocusableElement();
14850 var inputEl = eInput.getInputElement();
14851 focusEl.focus();
14852 inputEl.select();
14853 };
14854 TextCellEditor.prototype.getValue = function () {
14855 var eInput = this.eInput;
14856 return this.params.parseValue(eInput.getValue());
14857 };
14858 TextCellEditor.prototype.getStartValue = function (params) {
14859 var formatValue = params.useFormatter || params.column.getColDef().refData;
14860 return formatValue ? params.formatValue(params.value) : params.value;
14861 };
14862 TextCellEditor.prototype.isPopup = function () {
14863 return false;
14864 };
14865 TextCellEditor.TEMPLATE = '<div class="ag-cell-edit-wrapper"><ag-input-text-field class="ag-cell-editor" ref="eInput"></ag-input-text-field></div>';
14866 __decorate$u([
14867 RefSelector('eInput')
14868 ], TextCellEditor.prototype, "eInput", void 0);
14869 return TextCellEditor;
14870}(PopupComponent));
14871
14872/**
14873 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
14874 * @version v27.3.0
14875 * @link https://www.ag-grid.com/
14876 * @license MIT
14877 */
14878var __extends$y = (undefined && undefined.__extends) || (function () {
14879 var extendStatics = function (d, b) {
14880 extendStatics = Object.setPrototypeOf ||
14881 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14882 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
14883 return extendStatics(d, b);
14884 };
14885 return function (d, b) {
14886 extendStatics(d, b);
14887 function __() { this.constructor = d; }
14888 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14889 };
14890})();
14891var PopupTextCellEditor = /** @class */ (function (_super) {
14892 __extends$y(PopupTextCellEditor, _super);
14893 function PopupTextCellEditor() {
14894 var _this = _super.call(this) || this;
14895 doOnce(function () { return console.warn('AG Grid: The PopupTextCellEditor (agPopupTextCellEditor) is deprecated. Instead use {cellEditor: "agTextCellEditor", cellEditorPopup: true} '); }, 'PopupTextCellEditor.deprecated');
14896 return _this;
14897 }
14898 PopupTextCellEditor.prototype.isPopup = function () {
14899 return true;
14900 };
14901 return PopupTextCellEditor;
14902}(TextCellEditor));
14903
14904/**
14905 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
14906 * @version v27.3.0
14907 * @link https://www.ag-grid.com/
14908 * @license MIT
14909 */
14910var __extends$z = (undefined && undefined.__extends) || (function () {
14911 var extendStatics = function (d, b) {
14912 extendStatics = Object.setPrototypeOf ||
14913 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14914 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
14915 return extendStatics(d, b);
14916 };
14917 return function (d, b) {
14918 extendStatics(d, b);
14919 function __() { this.constructor = d; }
14920 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14921 };
14922})();
14923var __decorate$v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14924 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14925 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14926 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;
14927 return c > 3 && r && Object.defineProperty(target, key, r), r;
14928};
14929var ARROW_UP = '\u2191';
14930var ARROW_DOWN = '\u2193';
14931var AnimateShowChangeCellRenderer = /** @class */ (function (_super) {
14932 __extends$z(AnimateShowChangeCellRenderer, _super);
14933 function AnimateShowChangeCellRenderer() {
14934 var _this = _super.call(this, AnimateShowChangeCellRenderer.TEMPLATE) || this;
14935 _this.refreshCount = 0;
14936 return _this;
14937 }
14938 AnimateShowChangeCellRenderer.prototype.init = function (params) {
14939 // this.params = params;
14940 this.eValue = this.queryForHtmlElement('.ag-value-change-value');
14941 this.eDelta = this.queryForHtmlElement('.ag-value-change-delta');
14942 this.refresh(params);
14943 };
14944 AnimateShowChangeCellRenderer.prototype.showDelta = function (params, delta) {
14945 var absDelta = Math.abs(delta);
14946 var valueFormatted = params.formatValue(absDelta);
14947 var valueToUse = exists(valueFormatted) ? valueFormatted : absDelta;
14948 var deltaUp = (delta >= 0);
14949 if (deltaUp) {
14950 this.eDelta.innerHTML = ARROW_UP + valueToUse;
14951 }
14952 else {
14953 // because negative, use ABS to remove sign
14954 this.eDelta.innerHTML = ARROW_DOWN + valueToUse;
14955 }
14956 this.eDelta.classList.toggle('ag-value-change-delta-up', deltaUp);
14957 this.eDelta.classList.toggle('ag-value-change-delta-down', !deltaUp);
14958 };
14959 AnimateShowChangeCellRenderer.prototype.setTimerToRemoveDelta = function () {
14960 var _this = this;
14961 // the refreshCount makes sure that if the value updates again while
14962 // the below timer is waiting, then the below timer will realise it
14963 // is not the most recent and will not try to remove the delta value.
14964 this.refreshCount++;
14965 var refreshCountCopy = this.refreshCount;
14966 window.setTimeout(function () {
14967 if (refreshCountCopy === _this.refreshCount) {
14968 _this.hideDeltaValue();
14969 }
14970 }, 2000);
14971 };
14972 AnimateShowChangeCellRenderer.prototype.hideDeltaValue = function () {
14973 this.eValue.classList.remove('ag-value-change-value-highlight');
14974 clearElement(this.eDelta);
14975 };
14976 AnimateShowChangeCellRenderer.prototype.refresh = function (params) {
14977 var value = params.value;
14978 if (value === this.lastValue) {
14979 return false;
14980 }
14981 if (exists(params.valueFormatted)) {
14982 this.eValue.innerHTML = params.valueFormatted;
14983 }
14984 else if (exists(params.value)) {
14985 this.eValue.innerHTML = value;
14986 }
14987 else {
14988 clearElement(this.eValue);
14989 }
14990 // we don't show the delta if we are in the middle of a filter. see comment on FilterManager
14991 // with regards processingFilterChange
14992 if (this.filterManager.isSuppressFlashingCellsBecauseFiltering()) {
14993 return false;
14994 }
14995 if (typeof value === 'number' && typeof this.lastValue === 'number') {
14996 var delta = value - this.lastValue;
14997 this.showDelta(params, delta);
14998 }
14999 // highlight the current value, but only if it's not new, otherwise it
15000 // would get highlighted first time the value is shown
15001 if (this.lastValue) {
15002 this.eValue.classList.add('ag-value-change-value-highlight');
15003 }
15004 this.setTimerToRemoveDelta();
15005 this.lastValue = value;
15006 return true;
15007 };
15008 AnimateShowChangeCellRenderer.TEMPLATE = '<span>' +
15009 '<span class="ag-value-change-delta"></span>' +
15010 '<span class="ag-value-change-value"></span>' +
15011 '</span>';
15012 __decorate$v([
15013 Autowired('filterManager')
15014 ], AnimateShowChangeCellRenderer.prototype, "filterManager", void 0);
15015 return AnimateShowChangeCellRenderer;
15016}(Component));
15017
15018/**
15019 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
15020 * @version v27.3.0
15021 * @link https://www.ag-grid.com/
15022 * @license MIT
15023 */
15024var __extends$A = (undefined && undefined.__extends) || (function () {
15025 var extendStatics = function (d, b) {
15026 extendStatics = Object.setPrototypeOf ||
15027 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
15028 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
15029 return extendStatics(d, b);
15030 };
15031 return function (d, b) {
15032 extendStatics(d, b);
15033 function __() { this.constructor = d; }
15034 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15035 };
15036})();
15037var __decorate$w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
15038 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15039 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
15040 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;
15041 return c > 3 && r && Object.defineProperty(target, key, r), r;
15042};
15043var AnimateSlideCellRenderer = /** @class */ (function (_super) {
15044 __extends$A(AnimateSlideCellRenderer, _super);
15045 function AnimateSlideCellRenderer() {
15046 var _this = _super.call(this, AnimateSlideCellRenderer.TEMPLATE) || this;
15047 _this.refreshCount = 0;
15048 _this.eCurrent = _this.queryForHtmlElement('.ag-value-slide-current');
15049 return _this;
15050 }
15051 AnimateSlideCellRenderer.prototype.init = function (params) {
15052 this.refresh(params);
15053 };
15054 AnimateSlideCellRenderer.prototype.addSlideAnimation = function () {
15055 var _this = this;
15056 this.refreshCount++;
15057 // below we keep checking this, and stop working on the animation
15058 // if it no longer matches - this means another animation has started
15059 // and this one is stale.
15060 var refreshCountCopy = this.refreshCount;
15061 // if old animation, remove it
15062 if (this.ePrevious) {
15063 this.getGui().removeChild(this.ePrevious);
15064 }
15065 this.ePrevious = loadTemplate('<span class="ag-value-slide-previous ag-value-slide-out"></span>');
15066 this.ePrevious.innerHTML = this.eCurrent.innerHTML;
15067 this.getGui().insertBefore(this.ePrevious, this.eCurrent);
15068 // having timeout of 0 allows use to skip to the next css turn,
15069 // so we know the previous css classes have been applied. so the
15070 // complex set of setTimeout below creates the animation
15071 window.setTimeout(function () {
15072 if (refreshCountCopy !== _this.refreshCount) {
15073 return;
15074 }
15075 _this.ePrevious.classList.add('ag-value-slide-out-end');
15076 }, 50);
15077 window.setTimeout(function () {
15078 if (refreshCountCopy !== _this.refreshCount) {
15079 return;
15080 }
15081 _this.getGui().removeChild(_this.ePrevious);
15082 _this.ePrevious = null;
15083 }, 3000);
15084 };
15085 AnimateSlideCellRenderer.prototype.refresh = function (params) {
15086 var value = params.value;
15087 if (missing(value)) {
15088 value = '';
15089 }
15090 if (value === this.lastValue) {
15091 return false;
15092 }
15093 // we don't show the delta if we are in the middle of a filter. see comment on FilterManager
15094 // with regards processingFilterChange
15095 if (this.filterManager.isSuppressFlashingCellsBecauseFiltering()) {
15096 return false;
15097 }
15098 this.addSlideAnimation();
15099 this.lastValue = value;
15100 if (exists(params.valueFormatted)) {
15101 this.eCurrent.innerHTML = params.valueFormatted;
15102 }
15103 else if (exists(params.value)) {
15104 this.eCurrent.innerHTML = value;
15105 }
15106 else {
15107 clearElement(this.eCurrent);
15108 }
15109 return true;
15110 };
15111 AnimateSlideCellRenderer.TEMPLATE = "<span>\n <span class=\"ag-value-slide-current\"></span>\n </span>";
15112 __decorate$w([
15113 Autowired('filterManager')
15114 ], AnimateSlideCellRenderer.prototype, "filterManager", void 0);
15115 return AnimateSlideCellRenderer;
15116}(Component));
15117
15118/**
15119 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
15120 * @version v27.3.0
15121 * @link https://www.ag-grid.com/
15122 * @license MIT
15123 */
15124(function (RowHighlightPosition) {
15125 RowHighlightPosition[RowHighlightPosition["Above"] = 0] = "Above";
15126 RowHighlightPosition[RowHighlightPosition["Below"] = 1] = "Below";
15127})(exports.RowHighlightPosition || (exports.RowHighlightPosition = {}));
15128var RowNode = /** @class */ (function () {
15129 function RowNode(beans) {
15130 /** The current row index. If the row is filtered out or in a collapsed group, this value will be `null`. */
15131 this.rowIndex = null;
15132 /** The key for the group eg Ireland, UK, USA */
15133 this.key = null;
15134 /** Children mapped by the pivot columns. */
15135 this.childrenMapped = {};
15136 /**
15137 * This will be `true` if it has a rowIndex assigned, otherwise `false`.
15138 */
15139 this.displayed = false;
15140 /** The row top position in pixels. */
15141 this.rowTop = null;
15142 /** The top pixel for this row last time, makes sense if data set was ordered or filtered,
15143 * it is used so new rows can animate in from their old position. */
15144 this.oldRowTop = null;
15145 /** `true` by default - can be overridden via gridOptions.isRowSelectable(rowNode) */
15146 this.selectable = true;
15147 /** Used by sorting service - to give deterministic sort to groups. Previously we
15148 * just id for this, however id is a string and had slower sorting compared to numbers. */
15149 this.__objectId = RowNode.OBJECT_ID_SEQUENCE++;
15150 /** When one or more Columns are using autoHeight, this keeps track of height of each autoHeight Cell,
15151 * indexed by the Column ID. */
15152 this.__autoHeights = {};
15153 /** `true` when nodes with the same id are being removed and added as part of the same batch transaction */
15154 this.alreadyRendered = false;
15155 this.highlighted = null;
15156 this.selected = false;
15157 this.onRowHeightChangedDebounced = debounce(this.onRowHeightChanged.bind(this), 100);
15158 this.beans = beans;
15159 }
15160 /** Replaces the data on the `rowNode`. When complete, the grid will refresh the the entire rendered row if it is showing. */
15161 RowNode.prototype.setData = function (data) {
15162 this.setDataCommon(data, false);
15163 };
15164 // similar to setRowData, however it is expected that the data is the same data item. this
15165 // is intended to be used with Redux type stores, where the whole data can be changed. we are
15166 // guaranteed that the data is the same entity (so grid doesn't need to worry about the id of the
15167 // underlying data changing, hence doesn't need to worry about selection). the grid, upon receiving
15168 // dataChanged event, will refresh the cells rather than rip them all out (so user can show transitions).
15169 RowNode.prototype.updateData = function (data) {
15170 this.setDataCommon(data, true);
15171 };
15172 RowNode.prototype.setDataCommon = function (data, update) {
15173 var oldData = this.data;
15174 this.data = data;
15175 this.beans.valueCache.onDataChanged();
15176 this.updateDataOnDetailNode();
15177 this.checkRowSelectable();
15178 var event = this.createDataChangedEvent(data, oldData, update);
15179 this.dispatchLocalEvent(event);
15180 };
15181 // when we are doing master / detail, the detail node is lazy created, but then kept around.
15182 // so if we show / hide the detail, the same detail rowNode is used. so we need to keep the data
15183 // in sync, otherwise expand/collapse of the detail would still show the old values.
15184 RowNode.prototype.updateDataOnDetailNode = function () {
15185 if (this.detailNode) {
15186 this.detailNode.data = this.data;
15187 }
15188 };
15189 RowNode.prototype.createDataChangedEvent = function (newData, oldData, update) {
15190 return {
15191 type: RowNode.EVENT_DATA_CHANGED,
15192 node: this,
15193 oldData: oldData,
15194 newData: newData,
15195 update: update
15196 };
15197 };
15198 RowNode.prototype.createLocalRowEvent = function (type) {
15199 return {
15200 type: type,
15201 node: this
15202 };
15203 };
15204 RowNode.prototype.getRowIndexString = function () {
15205 if (this.rowPinned === Constants.PINNED_TOP) {
15206 return 't-' + this.rowIndex;
15207 }
15208 if (this.rowPinned === Constants.PINNED_BOTTOM) {
15209 return 'b-' + this.rowIndex;
15210 }
15211 return this.rowIndex.toString();
15212 };
15213 RowNode.prototype.createDaemonNode = function () {
15214 var oldNode = new RowNode(this.beans);
15215 // just copy the id and data, this is enough for the node to be used
15216 // in the selection controller (the selection controller is the only
15217 // place where daemon nodes can live).
15218 oldNode.id = this.id;
15219 oldNode.data = this.data;
15220 oldNode.daemon = true;
15221 oldNode.selected = this.selected;
15222 oldNode.level = this.level;
15223 return oldNode;
15224 };
15225 RowNode.prototype.setDataAndId = function (data, id) {
15226 var oldNode = exists(this.id) ? this.createDaemonNode() : null;
15227 var oldData = this.data;
15228 this.data = data;
15229 this.updateDataOnDetailNode();
15230 this.setId(id);
15231 this.beans.selectionService.syncInRowNode(this, oldNode);
15232 this.checkRowSelectable();
15233 var event = this.createDataChangedEvent(data, oldData, false);
15234 this.dispatchLocalEvent(event);
15235 };
15236 RowNode.prototype.checkRowSelectable = function () {
15237 var isRowSelectableFunc = this.beans.gridOptionsWrapper.getIsRowSelectableFunc();
15238 this.setRowSelectable(isRowSelectableFunc ? isRowSelectableFunc(this) : true);
15239 };
15240 RowNode.prototype.setRowSelectable = function (newVal) {
15241 if (this.selectable !== newVal) {
15242 this.selectable = newVal;
15243 if (this.eventService) {
15244 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_SELECTABLE_CHANGED));
15245 }
15246 }
15247 };
15248 RowNode.prototype.setId = function (id) {
15249 // see if user is providing the id's
15250 var getRowIdFunc = this.beans.gridOptionsWrapper.getRowIdFunc();
15251 if (getRowIdFunc) {
15252 // if user is providing the id's, then we set the id only after the data has been set.
15253 // this is important for virtual pagination and viewport, where empty rows exist.
15254 if (this.data) {
15255 // we pass 'true' as we skip this level when generating keys,
15256 // as we don't always have the key for this level (eg when updating
15257 // data via transaction on SSRM, we are getting key to look up the
15258 // RowNode, don't have the RowNode yet, thus no way to get the current key)
15259 var parentKeys = this.getGroupKeys(true);
15260 this.id = getRowIdFunc({
15261 data: this.data,
15262 parentKeys: parentKeys.length > 0 ? parentKeys : undefined,
15263 level: this.level
15264 });
15265 // make sure id provided doesn't start with 'row-group-' as this is reserved. also check that
15266 // it has 'startsWith' in case the user provided a number.
15267 if (this.id !== null && typeof this.id === 'string' && this.id.startsWith(RowNode.ID_PREFIX_ROW_GROUP)) {
15268 console.error("AG Grid: Row IDs cannot start with " + RowNode.ID_PREFIX_ROW_GROUP + ", this is a reserved prefix for AG Grid's row grouping feature.");
15269 }
15270 // force id to be a string
15271 if (this.id !== null && typeof this.id !== 'string') {
15272 this.id = '' + this.id;
15273 }
15274 }
15275 else {
15276 // this can happen if user has set blank into the rowNode after the row previously
15277 // having data. this happens in virtual page row model, when data is delete and
15278 // the page is refreshed.
15279 this.id = undefined;
15280 }
15281 }
15282 else {
15283 this.id = id;
15284 }
15285 };
15286 RowNode.prototype.getGroupKeys = function (excludeSelf) {
15287 if (excludeSelf === void 0) { excludeSelf = false; }
15288 var keys = [];
15289 var pointer = this;
15290 if (excludeSelf) {
15291 pointer = pointer.parent;
15292 }
15293 while (pointer && pointer.level >= 0) {
15294 keys.push(pointer.key);
15295 pointer = pointer.parent;
15296 }
15297 keys.reverse();
15298 return keys;
15299 };
15300 RowNode.prototype.isPixelInRange = function (pixel) {
15301 if (!exists(this.rowTop) || !exists(this.rowHeight)) {
15302 return false;
15303 }
15304 return pixel >= this.rowTop && pixel < (this.rowTop + this.rowHeight);
15305 };
15306 RowNode.prototype.setFirstChild = function (firstChild) {
15307 if (this.firstChild === firstChild) {
15308 return;
15309 }
15310 this.firstChild = firstChild;
15311 if (this.eventService) {
15312 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_FIRST_CHILD_CHANGED));
15313 }
15314 };
15315 RowNode.prototype.setLastChild = function (lastChild) {
15316 if (this.lastChild === lastChild) {
15317 return;
15318 }
15319 this.lastChild = lastChild;
15320 if (this.eventService) {
15321 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_LAST_CHILD_CHANGED));
15322 }
15323 };
15324 RowNode.prototype.setChildIndex = function (childIndex) {
15325 if (this.childIndex === childIndex) {
15326 return;
15327 }
15328 this.childIndex = childIndex;
15329 if (this.eventService) {
15330 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_CHILD_INDEX_CHANGED));
15331 }
15332 };
15333 RowNode.prototype.setRowTop = function (rowTop) {
15334 this.oldRowTop = this.rowTop;
15335 if (this.rowTop === rowTop) {
15336 return;
15337 }
15338 this.rowTop = rowTop;
15339 if (this.eventService) {
15340 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_TOP_CHANGED));
15341 }
15342 this.setDisplayed(rowTop !== null);
15343 };
15344 RowNode.prototype.clearRowTopAndRowIndex = function () {
15345 this.oldRowTop = null;
15346 this.setRowTop(null);
15347 this.setRowIndex(null);
15348 };
15349 RowNode.prototype.setDisplayed = function (displayed) {
15350 if (this.displayed === displayed) {
15351 return;
15352 }
15353 this.displayed = displayed;
15354 if (this.eventService) {
15355 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_DISPLAYED_CHANGED));
15356 }
15357 };
15358 RowNode.prototype.setDragging = function (dragging) {
15359 if (this.dragging === dragging) {
15360 return;
15361 }
15362 this.dragging = dragging;
15363 if (this.eventService) {
15364 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_DRAGGING_CHANGED));
15365 }
15366 };
15367 RowNode.prototype.setHighlighted = function (highlighted) {
15368 if (highlighted === this.highlighted) {
15369 return;
15370 }
15371 this.highlighted = highlighted;
15372 if (this.eventService) {
15373 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HIGHLIGHT_CHANGED));
15374 }
15375 };
15376 RowNode.prototype.setAllChildrenCount = function (allChildrenCount) {
15377 if (this.allChildrenCount === allChildrenCount) {
15378 return;
15379 }
15380 this.allChildrenCount = allChildrenCount;
15381 if (this.eventService) {
15382 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED));
15383 }
15384 };
15385 RowNode.prototype.setMaster = function (master) {
15386 if (this.master === master) {
15387 return;
15388 }
15389 // if changing AWAY from master, then unexpand, otherwise
15390 // next time it's shown it is expanded again
15391 if (this.master && !master) {
15392 this.expanded = false;
15393 }
15394 this.master = master;
15395 if (this.eventService) {
15396 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_MASTER_CHANGED));
15397 }
15398 };
15399 RowNode.prototype.setGroup = function (group) {
15400 if (this.group === group) {
15401 return;
15402 }
15403 // if we used to be a group, and no longer, then close the node
15404 if (this.group && !group) {
15405 this.expanded = false;
15406 }
15407 this.group = group;
15408 this.updateHasChildren();
15409 if (this.eventService) {
15410 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_GROUP_CHANGED));
15411 }
15412 };
15413 /**
15414 * Sets the row height.
15415 * Call if you want to change the height initially assigned to the row.
15416 * After calling, you must call `api.onRowHeightChanged()` so the grid knows it needs to work out the placement of the rows. */
15417 RowNode.prototype.setRowHeight = function (rowHeight, estimated) {
15418 if (estimated === void 0) { estimated = false; }
15419 this.rowHeight = rowHeight;
15420 this.rowHeightEstimated = estimated;
15421 if (this.eventService) {
15422 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HEIGHT_CHANGED));
15423 }
15424 };
15425 RowNode.prototype.setRowAutoHeight = function (cellHeight, column) {
15426 if (!this.__autoHeights) {
15427 this.__autoHeights = {};
15428 }
15429 var autoHeights = this.__autoHeights;
15430 autoHeights[column.getId()] = cellHeight;
15431 if (cellHeight != null) {
15432 if (this.checkAutoHeightsDebounced == null) {
15433 this.checkAutoHeightsDebounced = debounce(this.checkAutoHeights.bind(this), 1);
15434 }
15435 this.checkAutoHeightsDebounced();
15436 }
15437 };
15438 RowNode.prototype.checkAutoHeights = function () {
15439 var notAllPresent = false;
15440 var nonePresent = true;
15441 var newRowHeight = 0;
15442 var autoHeights = this.__autoHeights;
15443 if (autoHeights == null) {
15444 return;
15445 }
15446 var displayedAutoHeightCols = this.beans.columnModel.getAllDisplayedAutoHeightCols();
15447 displayedAutoHeightCols.forEach(function (col) {
15448 var cellHeight = autoHeights[col.getId()];
15449 if (cellHeight == null) {
15450 notAllPresent = true;
15451 return;
15452 }
15453 nonePresent = false;
15454 if (cellHeight > newRowHeight) {
15455 newRowHeight = cellHeight;
15456 }
15457 });
15458 if (notAllPresent) {
15459 return;
15460 }
15461 // we take min of 10, so we don't adjust for empty rows. if <10, we put to default.
15462 // this prevents the row starting very small when waiting for async components,
15463 // which would then mean the grid squashes in far to many rows (as small heights
15464 // means more rows fit in) which looks crap. so best ignore small values and assume
15465 // we are still waiting for values to render.
15466 if (nonePresent || newRowHeight < 10) {
15467 newRowHeight = this.beans.gridOptionsWrapper.getRowHeightForNode(this).height;
15468 }
15469 if (newRowHeight == this.rowHeight) {
15470 return;
15471 }
15472 this.setRowHeight(newRowHeight);
15473 this.onRowHeightChangedDebounced();
15474 };
15475 /** This method is debounced. It is used for row auto-height. If we don't debounce,
15476 * then the Row Models will end up recalculating each row position
15477 * for each row height change and result in the Row Renderer laying out rows.
15478 * This is particularly bad if using print layout, and showing eg 1,000 rows,
15479 * each row will change it's height, causing Row Model to update 1,000 times.
15480 */
15481 RowNode.prototype.onRowHeightChanged = function () {
15482 var rowModel = this.beans.rowModel;
15483 if (rowModel.onRowHeightChanged) {
15484 rowModel.onRowHeightChanged();
15485 }
15486 };
15487 RowNode.prototype.setRowIndex = function (rowIndex) {
15488 if (this.rowIndex === rowIndex) {
15489 return;
15490 }
15491 this.rowIndex = rowIndex;
15492 if (this.eventService) {
15493 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_INDEX_CHANGED));
15494 }
15495 };
15496 RowNode.prototype.setUiLevel = function (uiLevel) {
15497 if (this.uiLevel === uiLevel) {
15498 return;
15499 }
15500 this.uiLevel = uiLevel;
15501 if (this.eventService) {
15502 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_UI_LEVEL_CHANGED));
15503 }
15504 };
15505 RowNode.prototype.setExpanded = function (expanded, e) {
15506 if (this.expanded === expanded) {
15507 return;
15508 }
15509 this.expanded = expanded;
15510 if (this.eventService) {
15511 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_EXPANDED_CHANGED));
15512 }
15513 var event = Object.assign({}, this.createGlobalRowEvent(Events.EVENT_ROW_GROUP_OPENED), {
15514 expanded: expanded,
15515 event: e || null
15516 });
15517 this.beans.rowNodeEventThrottle.dispatchExpanded(event);
15518 // when using footers we need to refresh the group row, as the aggregation
15519 // values jump between group and footer
15520 if (this.beans.gridOptionsWrapper.isGroupIncludeFooter()) {
15521 this.beans.rowRenderer.refreshCells({ rowNodes: [this] });
15522 }
15523 };
15524 RowNode.prototype.createGlobalRowEvent = function (type) {
15525 return {
15526 type: type,
15527 node: this,
15528 data: this.data,
15529 rowIndex: this.rowIndex,
15530 rowPinned: this.rowPinned,
15531 context: this.beans.gridOptionsWrapper.getContext(),
15532 api: this.beans.gridOptionsWrapper.getApi(),
15533 columnApi: this.beans.gridOptionsWrapper.getColumnApi()
15534 };
15535 };
15536 RowNode.prototype.dispatchLocalEvent = function (event) {
15537 if (this.eventService) {
15538 this.eventService.dispatchEvent(event);
15539 }
15540 };
15541 /**
15542 * Replaces the value on the `rowNode` for the specified column. When complete,
15543 * the grid will refresh the rendered cell on the required row only.
15544 *
15545 * @param colKey The column where the value should be updated
15546 * @param newValue The new value
15547 * @param eventSource The source of the event
15548 * @returns `True` if the value was changed, otherwise `False`.
15549 */
15550 RowNode.prototype.setDataValue = function (colKey, newValue, eventSource) {
15551 // When it is done via the editors, no 'cell changed' event gets fired, as it's assumed that
15552 // the cell knows about the change given it's in charge of the editing.
15553 // this method is for the client to call, so the cell listens for the change
15554 // event, and also flashes the cell when the change occurs.
15555 var column = this.beans.columnModel.getPrimaryColumn(colKey);
15556 var oldValue = this.beans.valueService.getValue(column, this);
15557 var valueChanged = this.beans.valueService.setValue(this, column, newValue, eventSource);
15558 this.dispatchCellChangedEvent(column, newValue, oldValue);
15559 return valueChanged;
15560 };
15561 RowNode.prototype.setGroupValue = function (colKey, newValue) {
15562 var column = this.beans.columnModel.getGridColumn(colKey);
15563 if (missing(this.groupData)) {
15564 this.groupData = {};
15565 }
15566 var columnId = column.getColId();
15567 var oldValue = this.groupData[columnId];
15568 if (oldValue === newValue) {
15569 return;
15570 }
15571 this.groupData[columnId] = newValue;
15572 this.dispatchCellChangedEvent(column, newValue, oldValue);
15573 };
15574 // sets the data for an aggregation
15575 RowNode.prototype.setAggData = function (newAggData) {
15576 var _this = this;
15577 // find out all keys that could potentially change
15578 var colIds = getAllKeysInObjects([this.aggData, newAggData]);
15579 var oldAggData = this.aggData;
15580 this.aggData = newAggData;
15581 // if no event service, nobody has registered for events, so no need fire event
15582 if (this.eventService) {
15583 colIds.forEach(function (colId) {
15584 var column = _this.beans.columnModel.getGridColumn(colId);
15585 var value = _this.aggData ? _this.aggData[colId] : undefined;
15586 var oldValue = oldAggData ? oldAggData[colId] : undefined;
15587 _this.dispatchCellChangedEvent(column, value, oldValue);
15588 });
15589 }
15590 };
15591 RowNode.prototype.updateHasChildren = function () {
15592 // we need to return true when this.group=true, as this is used by server side row model
15593 // (as children are lazy loaded and stored in a cache anyway). otherwise we return true
15594 // if children exist.
15595 var newValue = (this.group && !this.footer) || (this.childrenAfterGroup && this.childrenAfterGroup.length > 0);
15596 if (newValue !== this.__hasChildren) {
15597 this.__hasChildren = !!newValue;
15598 if (this.eventService) {
15599 this.eventService.dispatchEvent(this.createLocalRowEvent(RowNode.EVENT_HAS_CHILDREN_CHANGED));
15600 }
15601 }
15602 };
15603 RowNode.prototype.hasChildren = function () {
15604 if (this.__hasChildren == null) {
15605 this.updateHasChildren();
15606 }
15607 return this.__hasChildren;
15608 };
15609 RowNode.prototype.isEmptyRowGroupNode = function () {
15610 return this.group && missingOrEmpty(this.childrenAfterGroup);
15611 };
15612 RowNode.prototype.dispatchCellChangedEvent = function (column, newValue, oldValue) {
15613 var cellChangedEvent = {
15614 type: RowNode.EVENT_CELL_CHANGED,
15615 node: this,
15616 column: column,
15617 newValue: newValue,
15618 oldValue: oldValue
15619 };
15620 this.dispatchLocalEvent(cellChangedEvent);
15621 };
15622 /**
15623 * The first time `quickFilter` runs, the grid creates a one-off string representation of the row.
15624 * This string is then used for the quick filter instead of hitting each column separately.
15625 * When you edit, using grid editing, this string gets cleared down.
15626 * However if you edit without using grid editing, you will need to clear this string down for the row to be updated with the new values.
15627 * Otherwise new values will not work with the `quickFilter`. */
15628 RowNode.prototype.resetQuickFilterAggregateText = function () {
15629 this.quickFilterAggregateText = null;
15630 };
15631 RowNode.prototype.isExpandable = function () {
15632 return (this.hasChildren() && !this.footer) || this.master ? true : false;
15633 };
15634 /** Returns:
15635 * - `true` if node is selected,
15636 * - `false` if the node isn't selected
15637 * - `undefined` if it's partially selected (group where not all children are selected). */
15638 RowNode.prototype.isSelected = function () {
15639 // for footers, we just return what our sibling selected state is, as cannot select a footer
15640 if (this.footer) {
15641 return this.sibling.isSelected();
15642 }
15643 return this.selected;
15644 };
15645 /** Perform a depth-first search of this node and its children. */
15646 RowNode.prototype.depthFirstSearch = function (callback) {
15647 if (this.childrenAfterGroup) {
15648 this.childrenAfterGroup.forEach(function (child) { return child.depthFirstSearch(callback); });
15649 }
15650 callback(this);
15651 };
15652 // + rowController.updateGroupsInSelection()
15653 // + selectionController.calculatedSelectedForAllGroupNodes()
15654 RowNode.prototype.calculateSelectedFromChildren = function () {
15655 var _a;
15656 var atLeastOneSelected = false;
15657 var atLeastOneDeSelected = false;
15658 var atLeastOneMixed = false;
15659 var newSelectedValue;
15660 if (!((_a = this.childrenAfterGroup) === null || _a === void 0 ? void 0 : _a.length)) {
15661 return;
15662 }
15663 for (var i = 0; i < this.childrenAfterGroup.length; i++) {
15664 var child = this.childrenAfterGroup[i];
15665 // skip non-selectable nodes to prevent inconsistent selection values
15666 if (!child.selectable) {
15667 continue;
15668 }
15669 var childState = child.isSelected();
15670 switch (childState) {
15671 case true:
15672 atLeastOneSelected = true;
15673 break;
15674 case false:
15675 atLeastOneDeSelected = true;
15676 break;
15677 default:
15678 atLeastOneMixed = true;
15679 break;
15680 }
15681 }
15682 if (atLeastOneMixed) {
15683 newSelectedValue = undefined;
15684 }
15685 else if (atLeastOneSelected && !atLeastOneDeSelected) {
15686 newSelectedValue = true;
15687 }
15688 else if (!atLeastOneSelected && atLeastOneDeSelected) {
15689 newSelectedValue = false;
15690 }
15691 else {
15692 newSelectedValue = undefined;
15693 }
15694 this.selectThisNode(newSelectedValue);
15695 };
15696 RowNode.prototype.setSelectedInitialValue = function (selected) {
15697 this.selected = selected;
15698 };
15699 /**
15700 * Select (or deselect) the node.
15701 * @param newValue -`true` for selection, `false` for deselection.
15702 * @param clearSelection - If selecting, then passing `true` will select the node exclusively (i.e. NOT do multi select). If doing deselection, `clearSelection` has no impact.
15703 * @param suppressFinishActions - Pass `true` to prevent the `selectionChanged` from being fired. Note that the `rowSelected` event will still be fired.
15704 */
15705 RowNode.prototype.setSelected = function (newValue, clearSelection, suppressFinishActions) {
15706 if (clearSelection === void 0) { clearSelection = false; }
15707 if (suppressFinishActions === void 0) { suppressFinishActions = false; }
15708 this.setSelectedParams({
15709 newValue: newValue,
15710 clearSelection: clearSelection,
15711 suppressFinishActions: suppressFinishActions,
15712 rangeSelect: false
15713 });
15714 };
15715 RowNode.prototype.isRowPinned = function () {
15716 return this.rowPinned === Constants.PINNED_TOP || this.rowPinned === Constants.PINNED_BOTTOM;
15717 };
15718 // to make calling code more readable, this is the same method as setSelected except it takes names parameters
15719 RowNode.prototype.setSelectedParams = function (params) {
15720 var _a;
15721 var groupSelectsChildren = this.beans.gridOptionsWrapper.isGroupSelectsChildren();
15722 var newValue = params.newValue === true;
15723 var clearSelection = params.clearSelection === true;
15724 var suppressFinishActions = params.suppressFinishActions === true;
15725 var rangeSelect = params.rangeSelect === true;
15726 // groupSelectsFiltered only makes sense when group selects children
15727 var groupSelectsFiltered = groupSelectsChildren && (params.groupSelectsFiltered === true);
15728 if (this.id === undefined) {
15729 console.warn('AG Grid: cannot select node until id for node is known');
15730 return 0;
15731 }
15732 if (this.rowPinned) {
15733 console.warn('AG Grid: cannot select pinned rows');
15734 return 0;
15735 }
15736 // if we are a footer, we don't do selection, just pass the info
15737 // to the sibling (the parent of the group)
15738 if (this.footer) {
15739 return this.sibling.setSelectedParams(params);
15740 }
15741 if (rangeSelect && this.beans.selectionService.getLastSelectedNode()) {
15742 var newRowClicked = this.beans.selectionService.getLastSelectedNode() !== this;
15743 var allowMultiSelect = this.beans.gridOptionsWrapper.isRowSelectionMulti();
15744 if (newRowClicked && allowMultiSelect) {
15745 var nodesChanged = this.doRowRangeSelection(params.newValue);
15746 this.beans.selectionService.setLastSelectedNode(this);
15747 return nodesChanged;
15748 }
15749 }
15750 var updatedCount = 0;
15751 // when groupSelectsFiltered, then this node may end up intermediate despite
15752 // trying to set it to true / false. this group will be calculated further on
15753 // down when we call calculatedSelectedForAllGroupNodes(). we need to skip it
15754 // here, otherwise the updatedCount would include it.
15755 var skipThisNode = groupSelectsFiltered && this.group;
15756 if (!skipThisNode) {
15757 var thisNodeWasSelected = this.selectThisNode(newValue);
15758 if (thisNodeWasSelected) {
15759 updatedCount++;
15760 }
15761 }
15762 if (groupSelectsChildren && ((_a = this.childrenAfterGroup) === null || _a === void 0 ? void 0 : _a.length)) {
15763 updatedCount += this.selectChildNodes(newValue, groupSelectsFiltered);
15764 }
15765 // clear other nodes if not doing multi select
15766 if (!suppressFinishActions) {
15767 var clearOtherNodes = newValue && (clearSelection || !this.beans.gridOptionsWrapper.isRowSelectionMulti());
15768 if (clearOtherNodes) {
15769 updatedCount += this.beans.selectionService.clearOtherNodes(this);
15770 }
15771 // only if we selected something, then update groups and fire events
15772 if (updatedCount > 0) {
15773 this.beans.selectionService.updateGroupsFromChildrenSelections();
15774 // this is the very end of the 'action node', so we are finished all the updates,
15775 // include any parent / child changes that this method caused
15776 var event_1 = {
15777 type: Events.EVENT_SELECTION_CHANGED,
15778 api: this.beans.gridApi,
15779 columnApi: this.beans.columnApi
15780 };
15781 this.beans.eventService.dispatchEvent(event_1);
15782 }
15783 // so if user next does shift-select, we know where to start the selection from
15784 if (newValue) {
15785 this.beans.selectionService.setLastSelectedNode(this);
15786 }
15787 }
15788 return updatedCount;
15789 };
15790 // selects all rows between this node and the last selected node (or the top if this is the first selection).
15791 // not to be mixed up with 'cell range selection' where you drag the mouse, this is row range selection, by
15792 // holding down 'shift'.
15793 RowNode.prototype.doRowRangeSelection = function (value) {
15794 var _this = this;
15795 if (value === void 0) { value = true; }
15796 var groupsSelectChildren = this.beans.gridOptionsWrapper.isGroupSelectsChildren();
15797 var lastSelectedNode = this.beans.selectionService.getLastSelectedNode();
15798 var nodesToSelect = this.beans.rowModel.getNodesInRangeForSelection(this, lastSelectedNode);
15799 var updatedCount = 0;
15800 nodesToSelect.forEach(function (rowNode) {
15801 if (rowNode.group && groupsSelectChildren || (value === false && _this === rowNode)) {
15802 return;
15803 }
15804 var nodeWasSelected = rowNode.selectThisNode(value);
15805 if (nodeWasSelected) {
15806 updatedCount++;
15807 }
15808 });
15809 this.beans.selectionService.updateGroupsFromChildrenSelections();
15810 var event = {
15811 type: Events.EVENT_SELECTION_CHANGED,
15812 api: this.beans.gridApi,
15813 columnApi: this.beans.columnApi
15814 };
15815 this.beans.eventService.dispatchEvent(event);
15816 return updatedCount;
15817 };
15818 RowNode.prototype.isParentOfNode = function (potentialParent) {
15819 var parentNode = this.parent;
15820 while (parentNode) {
15821 if (parentNode === potentialParent) {
15822 return true;
15823 }
15824 parentNode = parentNode.parent;
15825 }
15826 return false;
15827 };
15828 RowNode.prototype.selectThisNode = function (newValue) {
15829 // we only check selectable when newValue=true (ie selecting) to allow unselecting values,
15830 // as selectable is dynamic, need a way to unselect rows when selectable becomes false.
15831 var selectionNotAllowed = !this.selectable && newValue;
15832 var selectionNotChanged = this.selected === newValue;
15833 if (selectionNotAllowed || selectionNotChanged) {
15834 return false;
15835 }
15836 this.selected = newValue;
15837 if (this.eventService) {
15838 this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_ROW_SELECTED));
15839 }
15840 var event = this.createGlobalRowEvent(Events.EVENT_ROW_SELECTED);
15841 this.beans.eventService.dispatchEvent(event);
15842 return true;
15843 };
15844 RowNode.prototype.selectChildNodes = function (newValue, groupSelectsFiltered) {
15845 var children = groupSelectsFiltered ? this.childrenAfterAggFilter : this.childrenAfterGroup;
15846 if (missing(children)) {
15847 return 0;
15848 }
15849 var updatedCount = 0;
15850 for (var i = 0; i < children.length; i++) {
15851 updatedCount += children[i].setSelectedParams({
15852 newValue: newValue,
15853 clearSelection: false,
15854 suppressFinishActions: true,
15855 groupSelectsFiltered: groupSelectsFiltered
15856 });
15857 }
15858 return updatedCount;
15859 };
15860 /** Add an event listener. */
15861 RowNode.prototype.addEventListener = function (eventType, listener) {
15862 if (!this.eventService) {
15863 this.eventService = new EventService();
15864 }
15865 this.eventService.addEventListener(eventType, listener);
15866 };
15867 /** Remove event listener. */
15868 RowNode.prototype.removeEventListener = function (eventType, listener) {
15869 if (!this.eventService) {
15870 return;
15871 }
15872 this.eventService.removeEventListener(eventType, listener);
15873 if (this.eventService.noRegisteredListenersExist()) {
15874 this.eventService = null;
15875 }
15876 };
15877 RowNode.prototype.onMouseEnter = function () {
15878 this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_ENTER));
15879 };
15880 RowNode.prototype.onMouseLeave = function () {
15881 this.dispatchLocalEvent(this.createLocalRowEvent(RowNode.EVENT_MOUSE_LEAVE));
15882 };
15883 RowNode.prototype.getFirstChildOfFirstChild = function (rowGroupColumn) {
15884 var currentRowNode = this;
15885 var isCandidate = true;
15886 var foundFirstChildPath = false;
15887 var nodeToSwapIn = null;
15888 // if we are hiding groups, then if we are the first child, of the first child,
15889 // all the way up to the column we are interested in, then we show the group cell.
15890 while (isCandidate && !foundFirstChildPath) {
15891 var parentRowNode = currentRowNode.parent;
15892 var firstChild = exists(parentRowNode) && currentRowNode.firstChild;
15893 if (firstChild) {
15894 if (parentRowNode.rowGroupColumn === rowGroupColumn) {
15895 foundFirstChildPath = true;
15896 nodeToSwapIn = parentRowNode;
15897 }
15898 }
15899 else {
15900 isCandidate = false;
15901 }
15902 currentRowNode = parentRowNode;
15903 }
15904 return foundFirstChildPath ? nodeToSwapIn : null;
15905 };
15906 RowNode.prototype.isFullWidthCell = function () {
15907 var isFullWidthCellFunc = this.beans.gridOptionsWrapper.getIsFullWidthCellFunc();
15908 return isFullWidthCellFunc ? isFullWidthCellFunc({ rowNode: this }) : false;
15909 };
15910 /**
15911 * Returns the route of the row node. If the Row Node is a group, it returns the route to that Row Node.
15912 * If the Row Node is not a group, it returns `undefined`.
15913 */
15914 RowNode.prototype.getRoute = function () {
15915 if (this.key == null) {
15916 return;
15917 }
15918 var res = [];
15919 var pointer = this;
15920 while (pointer.key != null) {
15921 res.push(pointer.key);
15922 pointer = pointer.parent;
15923 }
15924 return res.reverse();
15925 };
15926 RowNode.ID_PREFIX_ROW_GROUP = 'row-group-';
15927 RowNode.ID_PREFIX_TOP_PINNED = 't-';
15928 RowNode.ID_PREFIX_BOTTOM_PINNED = 'b-';
15929 RowNode.OBJECT_ID_SEQUENCE = 0;
15930 RowNode.EVENT_ROW_SELECTED = 'rowSelected';
15931 RowNode.EVENT_DATA_CHANGED = 'dataChanged';
15932 RowNode.EVENT_CELL_CHANGED = 'cellChanged';
15933 RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED = 'allChildrenCountChanged';
15934 RowNode.EVENT_MASTER_CHANGED = 'masterChanged';
15935 RowNode.EVENT_GROUP_CHANGED = 'groupChanged';
15936 RowNode.EVENT_MOUSE_ENTER = 'mouseEnter';
15937 RowNode.EVENT_MOUSE_LEAVE = 'mouseLeave';
15938 RowNode.EVENT_HEIGHT_CHANGED = 'heightChanged';
15939 RowNode.EVENT_TOP_CHANGED = 'topChanged';
15940 RowNode.EVENT_DISPLAYED_CHANGED = 'displayedChanged';
15941 RowNode.EVENT_FIRST_CHILD_CHANGED = 'firstChildChanged';
15942 RowNode.EVENT_LAST_CHILD_CHANGED = 'lastChildChanged';
15943 RowNode.EVENT_CHILD_INDEX_CHANGED = 'childIndexChanged';
15944 RowNode.EVENT_ROW_INDEX_CHANGED = 'rowIndexChanged';
15945 RowNode.EVENT_EXPANDED_CHANGED = 'expandedChanged';
15946 RowNode.EVENT_HAS_CHILDREN_CHANGED = 'hasChildrenChanged';
15947 RowNode.EVENT_SELECTABLE_CHANGED = 'selectableChanged';
15948 RowNode.EVENT_UI_LEVEL_CHANGED = 'uiLevelChanged';
15949 RowNode.EVENT_HIGHLIGHT_CHANGED = 'rowHighlightChanged';
15950 RowNode.EVENT_DRAGGING_CHANGED = 'draggingChanged';
15951 return RowNode;
15952}());
15953
15954/**
15955 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
15956 * @version v27.3.0
15957 * @link https://www.ag-grid.com/
15958 * @license MIT
15959 */
15960var __extends$B = (undefined && undefined.__extends) || (function () {
15961 var extendStatics = function (d, b) {
15962 extendStatics = Object.setPrototypeOf ||
15963 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
15964 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
15965 return extendStatics(d, b);
15966 };
15967 return function (d, b) {
15968 extendStatics(d, b);
15969 function __() { this.constructor = d; }
15970 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15971 };
15972})();
15973var __decorate$x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
15974 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15975 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
15976 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;
15977 return c > 3 && r && Object.defineProperty(target, key, r), r;
15978};
15979var CheckboxSelectionComponent = /** @class */ (function (_super) {
15980 __extends$B(CheckboxSelectionComponent, _super);
15981 function CheckboxSelectionComponent() {
15982 return _super.call(this, /* html*/ "\n <div class=\"ag-selection-checkbox\" role=\"presentation\">\n <ag-checkbox role=\"presentation\" ref=\"eCheckbox\"></ag-checkbox>\n </div>") || this;
15983 }
15984 CheckboxSelectionComponent.prototype.postConstruct = function () {
15985 this.eCheckbox.setPassive(true);
15986 };
15987 CheckboxSelectionComponent.prototype.getCheckboxId = function () {
15988 return this.eCheckbox.getInputElement().id;
15989 };
15990 CheckboxSelectionComponent.prototype.onDataChanged = function () {
15991 // when rows are loaded for the second time, this can impact the selection, as a row
15992 // could be loaded as already selected (if user scrolls down, and then up again).
15993 this.onSelectionChanged();
15994 };
15995 CheckboxSelectionComponent.prototype.onSelectableChanged = function () {
15996 this.showOrHideSelect();
15997 };
15998 CheckboxSelectionComponent.prototype.onSelectionChanged = function () {
15999 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
16000 var state = this.rowNode.isSelected();
16001 var stateName = state === undefined
16002 ? translate('ariaIndeterminate', 'indeterminate')
16003 : (state === true
16004 ? translate('ariaChecked', 'checked')
16005 : translate('ariaUnchecked', 'unchecked'));
16006 var ariaLabel = translate('ariaRowToggleSelection', 'Press Space to toggle row selection');
16007 this.eCheckbox.setValue(state, true);
16008 this.eCheckbox.setInputAriaLabel(ariaLabel + " (" + stateName + ")");
16009 };
16010 CheckboxSelectionComponent.prototype.onCheckedClicked = function (event) {
16011 var groupSelectsFiltered = this.gridOptionsWrapper.isGroupSelectsFiltered();
16012 var updatedCount = this.rowNode.setSelectedParams({ newValue: false, rangeSelect: event.shiftKey, groupSelectsFiltered: groupSelectsFiltered });
16013 return updatedCount;
16014 };
16015 CheckboxSelectionComponent.prototype.onUncheckedClicked = function (event) {
16016 var groupSelectsFiltered = this.gridOptionsWrapper.isGroupSelectsFiltered();
16017 var updatedCount = this.rowNode.setSelectedParams({ newValue: true, rangeSelect: event.shiftKey, groupSelectsFiltered: groupSelectsFiltered });
16018 return updatedCount;
16019 };
16020 CheckboxSelectionComponent.prototype.init = function (params) {
16021 var _this = this;
16022 this.rowNode = params.rowNode;
16023 this.column = params.column;
16024 this.onSelectionChanged();
16025 // we don't want the row clicked event to fire when selecting the checkbox, otherwise the row
16026 // would possibly get selected twice
16027 this.addGuiEventListener('click', function (event) { return stopPropagationForAgGrid(event); });
16028 // likewise we don't want double click on this icon to open a group
16029 this.addGuiEventListener('dblclick', function (event) { return stopPropagationForAgGrid(event); });
16030 this.addManagedListener(this.eCheckbox.getInputElement(), 'click', function (event) {
16031 var isSelected = _this.eCheckbox.getValue();
16032 var previousValue = _this.eCheckbox.getPreviousValue();
16033 if (previousValue === undefined || isSelected === undefined) {
16034 // Indeterminate state - try toggling children to determine action.
16035 var result = _this.onUncheckedClicked(event || {});
16036 if (result === 0) {
16037 _this.onCheckedClicked(event);
16038 }
16039 }
16040 else if (isSelected) {
16041 _this.onCheckedClicked(event);
16042 }
16043 else {
16044 _this.onUncheckedClicked(event || {});
16045 }
16046 });
16047 this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_SELECTED, this.onSelectionChanged.bind(this));
16048 this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.onDataChanged.bind(this));
16049 this.addManagedListener(this.rowNode, RowNode.EVENT_SELECTABLE_CHANGED, this.onSelectableChanged.bind(this));
16050 var isRowSelectableFunc = this.gridOptionsWrapper.getIsRowSelectableFunc();
16051 var checkboxVisibleIsDynamic = isRowSelectableFunc || this.checkboxCallbackExists();
16052 if (checkboxVisibleIsDynamic) {
16053 var showOrHideSelectListener = this.showOrHideSelect.bind(this);
16054 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, showOrHideSelectListener);
16055 this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, showOrHideSelectListener);
16056 this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, showOrHideSelectListener);
16057 this.showOrHideSelect();
16058 }
16059 this.eCheckbox.getInputElement().setAttribute('tabindex', '-1');
16060 };
16061 CheckboxSelectionComponent.prototype.showOrHideSelect = function () {
16062 // if the isRowSelectable() is not provided the row node is selectable by default
16063 var selectable = this.rowNode.selectable;
16064 // checkboxSelection callback is deemed a legacy solution however we will still consider it's result.
16065 // If selectable, then also check the colDef callback. if not selectable, this it short circuits - no need
16066 // to call the colDef callback.
16067 if (selectable && this.checkboxCallbackExists()) {
16068 selectable = this.column.isCellCheckboxSelection(this.rowNode);
16069 }
16070 // show checkbox if both conditions are true
16071 this.setVisible(selectable);
16072 };
16073 CheckboxSelectionComponent.prototype.checkboxCallbackExists = function () {
16074 // column will be missing if groupUseEntireRow=true
16075 var colDef = this.column ? this.column.getColDef() : null;
16076 return !!colDef && typeof colDef.checkboxSelection === 'function';
16077 };
16078 __decorate$x([
16079 RefSelector('eCheckbox')
16080 ], CheckboxSelectionComponent.prototype, "eCheckbox", void 0);
16081 __decorate$x([
16082 PostConstruct
16083 ], CheckboxSelectionComponent.prototype, "postConstruct", null);
16084 return CheckboxSelectionComponent;
16085}(Component));
16086
16087/**
16088 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
16089 * @version v27.3.0
16090 * @link https://www.ag-grid.com/
16091 * @license MIT
16092 */
16093var __extends$C = (undefined && undefined.__extends) || (function () {
16094 var extendStatics = function (d, b) {
16095 extendStatics = Object.setPrototypeOf ||
16096 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
16097 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
16098 return extendStatics(d, b);
16099 };
16100 return function (d, b) {
16101 extendStatics(d, b);
16102 function __() { this.constructor = d; }
16103 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16104 };
16105})();
16106var __decorate$y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
16107 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16108 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16109 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;
16110 return c > 3 && r && Object.defineProperty(target, key, r), r;
16111};
16112var __values$2 = (undefined && undefined.__values) || function(o) {
16113 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
16114 if (m) return m.call(o);
16115 if (o && typeof o.length === "number") return {
16116 next: function () {
16117 if (o && i >= o.length) o = void 0;
16118 return { value: o && o[i++], done: !o };
16119 }
16120 };
16121 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
16122};
16123(function (DragSourceType) {
16124 DragSourceType[DragSourceType["ToolPanel"] = 0] = "ToolPanel";
16125 DragSourceType[DragSourceType["HeaderCell"] = 1] = "HeaderCell";
16126 DragSourceType[DragSourceType["RowDrag"] = 2] = "RowDrag";
16127 DragSourceType[DragSourceType["ChartPanel"] = 3] = "ChartPanel";
16128})(exports.DragSourceType || (exports.DragSourceType = {}));
16129(function (VerticalDirection) {
16130 VerticalDirection[VerticalDirection["Up"] = 0] = "Up";
16131 VerticalDirection[VerticalDirection["Down"] = 1] = "Down";
16132})(exports.VerticalDirection || (exports.VerticalDirection = {}));
16133(function (HorizontalDirection) {
16134 HorizontalDirection[HorizontalDirection["Left"] = 0] = "Left";
16135 HorizontalDirection[HorizontalDirection["Right"] = 1] = "Right";
16136})(exports.HorizontalDirection || (exports.HorizontalDirection = {}));
16137var DragAndDropService = /** @class */ (function (_super) {
16138 __extends$C(DragAndDropService, _super);
16139 function DragAndDropService() {
16140 var _this = _super !== null && _super.apply(this, arguments) || this;
16141 _this.dragSourceAndParamsList = [];
16142 _this.dropTargets = [];
16143 return _this;
16144 }
16145 DragAndDropService_1 = DragAndDropService;
16146 DragAndDropService.prototype.init = function () {
16147 this.ePinnedIcon = createIcon('columnMovePin', this.gridOptionsWrapper, null);
16148 this.eHideIcon = createIcon('columnMoveHide', this.gridOptionsWrapper, null);
16149 this.eMoveIcon = createIcon('columnMoveMove', this.gridOptionsWrapper, null);
16150 this.eLeftIcon = createIcon('columnMoveLeft', this.gridOptionsWrapper, null);
16151 this.eRightIcon = createIcon('columnMoveRight', this.gridOptionsWrapper, null);
16152 this.eGroupIcon = createIcon('columnMoveGroup', this.gridOptionsWrapper, null);
16153 this.eAggregateIcon = createIcon('columnMoveValue', this.gridOptionsWrapper, null);
16154 this.ePivotIcon = createIcon('columnMovePivot', this.gridOptionsWrapper, null);
16155 this.eDropNotAllowedIcon = createIcon('dropNotAllowed', this.gridOptionsWrapper, null);
16156 };
16157 DragAndDropService.prototype.addDragSource = function (dragSource, allowTouch) {
16158 if (allowTouch === void 0) { allowTouch = false; }
16159 var params = {
16160 eElement: dragSource.eElement,
16161 dragStartPixels: dragSource.dragStartPixels,
16162 onDragStart: this.onDragStart.bind(this, dragSource),
16163 onDragStop: this.onDragStop.bind(this),
16164 onDragging: this.onDragging.bind(this)
16165 };
16166 this.dragSourceAndParamsList.push({ params: params, dragSource: dragSource });
16167 this.dragService.addDragSource(params, allowTouch);
16168 };
16169 DragAndDropService.prototype.removeDragSource = function (dragSource) {
16170 var sourceAndParams = this.dragSourceAndParamsList.find(function (item) { return item.dragSource === dragSource; });
16171 if (sourceAndParams) {
16172 this.dragService.removeDragSource(sourceAndParams.params);
16173 removeFromArray(this.dragSourceAndParamsList, sourceAndParams);
16174 }
16175 };
16176 DragAndDropService.prototype.clearDragSourceParamsList = function () {
16177 var _this = this;
16178 this.dragSourceAndParamsList.forEach(function (sourceAndParams) { return _this.dragService.removeDragSource(sourceAndParams.params); });
16179 this.dragSourceAndParamsList.length = 0;
16180 };
16181 DragAndDropService.prototype.nudge = function () {
16182 if (this.dragging) {
16183 this.onDragging(this.eventLastTime, true);
16184 }
16185 };
16186 DragAndDropService.prototype.onDragStart = function (dragSource, mouseEvent) {
16187 this.dragging = true;
16188 this.dragSource = dragSource;
16189 this.eventLastTime = mouseEvent;
16190 this.dragItem = this.dragSource.getDragItem();
16191 this.lastDropTarget = this.dragSource.dragSourceDropTarget;
16192 if (this.dragSource.onDragStarted) {
16193 this.dragSource.onDragStarted();
16194 }
16195 this.createGhost();
16196 };
16197 DragAndDropService.prototype.onDragStop = function (mouseEvent) {
16198 this.eventLastTime = null;
16199 this.dragging = false;
16200 if (this.dragSource.onDragStopped) {
16201 this.dragSource.onDragStopped();
16202 }
16203 if (this.lastDropTarget && this.lastDropTarget.onDragStop) {
16204 var draggingEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, null, null, false);
16205 this.lastDropTarget.onDragStop(draggingEvent);
16206 }
16207 this.lastDropTarget = null;
16208 this.dragItem = null;
16209 this.removeGhost();
16210 };
16211 DragAndDropService.prototype.onDragging = function (mouseEvent, fromNudge) {
16212 var _this = this;
16213 var hDirection = this.getHorizontalDirection(mouseEvent);
16214 var vDirection = this.getVerticalDirection(mouseEvent);
16215 this.eventLastTime = mouseEvent;
16216 this.positionGhost(mouseEvent);
16217 // check if mouseEvent intersects with any of the drop targets
16218 var validDropTargets = this.dropTargets.filter(function (target) { return _this.isMouseOnDropTarget(mouseEvent, target); });
16219 var len = validDropTargets.length;
16220 var dropTarget = null;
16221 if (len > 0) {
16222 dropTarget = len === 1
16223 ? validDropTargets[0]
16224 // the current mouse position could intersect with more than 1 element
16225 // if they are nested. In that case we need to get the most specific
16226 // container, which is the one that does not contain any other targets.
16227 : validDropTargets.reduce(function (prevTarget, currTarget) {
16228 if (!prevTarget) {
16229 return currTarget;
16230 }
16231 var prevContainer = prevTarget.getContainer();
16232 var currContainer = currTarget.getContainer();
16233 if (prevContainer.contains(currContainer)) {
16234 return currTarget;
16235 }
16236 return prevTarget;
16237 });
16238 }
16239 if (dropTarget !== this.lastDropTarget) {
16240 this.leaveLastTargetIfExists(mouseEvent, hDirection, vDirection, fromNudge);
16241 this.enterDragTargetIfExists(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
16242 this.lastDropTarget = dropTarget;
16243 }
16244 else if (dropTarget && dropTarget.onDragging) {
16245 var draggingEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
16246 dropTarget.onDragging(draggingEvent);
16247 }
16248 };
16249 DragAndDropService.prototype.enterDragTargetIfExists = function (dropTarget, mouseEvent, hDirection, vDirection, fromNudge) {
16250 if (!dropTarget) {
16251 return;
16252 }
16253 if (dropTarget.onDragEnter) {
16254 var dragEnterEvent = this.createDropTargetEvent(dropTarget, mouseEvent, hDirection, vDirection, fromNudge);
16255 dropTarget.onDragEnter(dragEnterEvent);
16256 }
16257 this.setGhostIcon(dropTarget.getIconName ? dropTarget.getIconName() : null);
16258 };
16259 DragAndDropService.prototype.leaveLastTargetIfExists = function (mouseEvent, hDirection, vDirection, fromNudge) {
16260 if (!this.lastDropTarget) {
16261 return;
16262 }
16263 if (this.lastDropTarget.onDragLeave) {
16264 var dragLeaveEvent = this.createDropTargetEvent(this.lastDropTarget, mouseEvent, hDirection, vDirection, fromNudge);
16265 this.lastDropTarget.onDragLeave(dragLeaveEvent);
16266 }
16267 this.setGhostIcon(null);
16268 };
16269 DragAndDropService.prototype.getAllContainersFromDropTarget = function (dropTarget) {
16270 var secondaryContainers = dropTarget.getSecondaryContainers ? dropTarget.getSecondaryContainers() : null;
16271 var containers = [[dropTarget.getContainer()]];
16272 return secondaryContainers ? containers.concat(secondaryContainers) : containers;
16273 };
16274 DragAndDropService.prototype.allContainersIntersect = function (mouseEvent, containers) {
16275 var e_1, _a;
16276 try {
16277 for (var containers_1 = __values$2(containers), containers_1_1 = containers_1.next(); !containers_1_1.done; containers_1_1 = containers_1.next()) {
16278 var container = containers_1_1.value;
16279 var rect = container.getBoundingClientRect();
16280 // if element is not visible, then width and height are zero
16281 if (rect.width === 0 || rect.height === 0) {
16282 return false;
16283 }
16284 var horizontalFit = mouseEvent.clientX >= rect.left && mouseEvent.clientX < rect.right;
16285 var verticalFit = mouseEvent.clientY >= rect.top && mouseEvent.clientY < rect.bottom;
16286 if (!horizontalFit || !verticalFit) {
16287 return false;
16288 }
16289 }
16290 }
16291 catch (e_1_1) { e_1 = { error: e_1_1 }; }
16292 finally {
16293 try {
16294 if (containers_1_1 && !containers_1_1.done && (_a = containers_1.return)) _a.call(containers_1);
16295 }
16296 finally { if (e_1) throw e_1.error; }
16297 }
16298 return true;
16299 };
16300 // checks if the mouse is on the drop target. it checks eContainer and eSecondaryContainers
16301 DragAndDropService.prototype.isMouseOnDropTarget = function (mouseEvent, dropTarget) {
16302 var e_2, _a;
16303 var allContainersFromDropTarget = this.getAllContainersFromDropTarget(dropTarget);
16304 var mouseOverTarget = false;
16305 try {
16306 for (var allContainersFromDropTarget_1 = __values$2(allContainersFromDropTarget), allContainersFromDropTarget_1_1 = allContainersFromDropTarget_1.next(); !allContainersFromDropTarget_1_1.done; allContainersFromDropTarget_1_1 = allContainersFromDropTarget_1.next()) {
16307 var currentContainers = allContainersFromDropTarget_1_1.value;
16308 if (this.allContainersIntersect(mouseEvent, currentContainers)) {
16309 mouseOverTarget = true;
16310 break;
16311 }
16312 }
16313 }
16314 catch (e_2_1) { e_2 = { error: e_2_1 }; }
16315 finally {
16316 try {
16317 if (allContainersFromDropTarget_1_1 && !allContainersFromDropTarget_1_1.done && (_a = allContainersFromDropTarget_1.return)) _a.call(allContainersFromDropTarget_1);
16318 }
16319 finally { if (e_2) throw e_2.error; }
16320 }
16321 if (dropTarget.targetContainsSource && !dropTarget.getContainer().contains(this.dragSource.eElement)) {
16322 return false;
16323 }
16324 return mouseOverTarget && dropTarget.isInterestedIn(this.dragSource.type, this.dragSource.eElement);
16325 };
16326 DragAndDropService.prototype.addDropTarget = function (dropTarget) {
16327 this.dropTargets.push(dropTarget);
16328 };
16329 DragAndDropService.prototype.removeDropTarget = function (dropTarget) {
16330 this.dropTargets = this.dropTargets.filter(function (target) { return target.getContainer() !== dropTarget.getContainer(); });
16331 };
16332 DragAndDropService.prototype.hasExternalDropZones = function () {
16333 return this.dropTargets.some(function (zones) { return zones.external; });
16334 };
16335 DragAndDropService.prototype.findExternalZone = function (params) {
16336 var externalTargets = this.dropTargets.filter(function (target) { return target.external; });
16337 return externalTargets.find(function (zone) { return zone.getContainer() === params.getContainer(); }) || null;
16338 };
16339 DragAndDropService.prototype.getHorizontalDirection = function (event) {
16340 var clientX = this.eventLastTime && this.eventLastTime.clientX;
16341 var eClientX = event.clientX;
16342 if (clientX === eClientX) {
16343 return null;
16344 }
16345 return clientX > eClientX ? exports.HorizontalDirection.Left : exports.HorizontalDirection.Right;
16346 };
16347 DragAndDropService.prototype.getVerticalDirection = function (event) {
16348 var clientY = this.eventLastTime && this.eventLastTime.clientY;
16349 var eClientY = event.clientY;
16350 if (clientY === eClientY) {
16351 return null;
16352 }
16353 return clientY > eClientY ? exports.VerticalDirection.Up : exports.VerticalDirection.Down;
16354 };
16355 DragAndDropService.prototype.createDropTargetEvent = function (dropTarget, event, hDirection, vDirection, fromNudge) {
16356 // localise x and y to the target
16357 var dropZoneTarget = dropTarget.getContainer();
16358 var rect = dropZoneTarget.getBoundingClientRect();
16359 var _a = this, api = _a.gridApi, columnApi = _a.columnApi, dragItem = _a.dragItem, dragSource = _a.dragSource;
16360 var x = event.clientX - rect.left;
16361 var y = event.clientY - rect.top;
16362 return { event: event, x: x, y: y, vDirection: vDirection, hDirection: hDirection, dragSource: dragSource, fromNudge: fromNudge, dragItem: dragItem, api: api, columnApi: columnApi, dropZoneTarget: dropZoneTarget };
16363 };
16364 DragAndDropService.prototype.positionGhost = function (event) {
16365 var ghost = this.eGhost;
16366 if (!ghost) {
16367 return;
16368 }
16369 var ghostRect = ghost.getBoundingClientRect();
16370 var ghostHeight = ghostRect.height;
16371 // for some reason, without the '-2', it still overlapped by 1 or 2 pixels, which
16372 // then brought in scrollbars to the browser. no idea why, but putting in -2 here
16373 // works around it which is good enough for me.
16374 var browserWidth = getBodyWidth() - 2;
16375 var browserHeight = getBodyHeight() - 2;
16376 var top = event.pageY - (ghostHeight / 2);
16377 var left = event.pageX - 10;
16378 var eDocument = this.gridOptionsWrapper.getDocument();
16379 var win = (eDocument.defaultView || window);
16380 var windowScrollY = win.pageYOffset || eDocument.documentElement.scrollTop;
16381 var windowScrollX = win.pageXOffset || eDocument.documentElement.scrollLeft;
16382 // check ghost is not positioned outside of the browser
16383 if (browserWidth > 0 && ((left + ghost.clientWidth) > (browserWidth + windowScrollX))) {
16384 left = browserWidth + windowScrollX - ghost.clientWidth;
16385 }
16386 if (left < 0) {
16387 left = 0;
16388 }
16389 if (browserHeight > 0 && ((top + ghost.clientHeight) > (browserHeight + windowScrollY))) {
16390 top = browserHeight + windowScrollY - ghost.clientHeight;
16391 }
16392 if (top < 0) {
16393 top = 0;
16394 }
16395 ghost.style.left = left + "px";
16396 ghost.style.top = top + "px";
16397 };
16398 DragAndDropService.prototype.removeGhost = function () {
16399 if (this.eGhost && this.eGhostParent) {
16400 this.eGhostParent.removeChild(this.eGhost);
16401 }
16402 this.eGhost = null;
16403 };
16404 DragAndDropService.prototype.createGhost = function () {
16405 this.eGhost = loadTemplate(DragAndDropService_1.GHOST_TEMPLATE);
16406 var theme = this.environment.getTheme().theme;
16407 if (theme) {
16408 this.eGhost.classList.add(theme);
16409 }
16410 this.eGhostIcon = this.eGhost.querySelector('.ag-dnd-ghost-icon');
16411 this.setGhostIcon(null);
16412 var eText = this.eGhost.querySelector('.ag-dnd-ghost-label');
16413 var dragItemName = this.dragSource.dragItemName;
16414 if (isFunction(dragItemName)) {
16415 dragItemName = dragItemName();
16416 }
16417 eText.innerHTML = escapeString(dragItemName) || '';
16418 this.eGhost.style.height = '25px';
16419 this.eGhost.style.top = '20px';
16420 this.eGhost.style.left = '20px';
16421 var eDocument = this.gridOptionsWrapper.getDocument();
16422 var targetEl = null;
16423 try {
16424 targetEl = eDocument.fullscreenElement;
16425 }
16426 catch (e) {
16427 // some environments like SalesForce will throw errors
16428 // simply by trying to read the fullscreenElement property
16429 }
16430 finally {
16431 if (!targetEl) {
16432 targetEl = eDocument.querySelector('body');
16433 }
16434 }
16435 this.eGhostParent = targetEl;
16436 if (!this.eGhostParent) {
16437 console.warn('AG Grid: could not find document body, it is needed for dragging columns');
16438 }
16439 else {
16440 this.eGhostParent.appendChild(this.eGhost);
16441 }
16442 };
16443 DragAndDropService.prototype.setGhostIcon = function (iconName, shake) {
16444 if (shake === void 0) { shake = false; }
16445 clearElement(this.eGhostIcon);
16446 var eIcon = null;
16447 if (!iconName) {
16448 iconName = this.dragSource.defaultIconName || DragAndDropService_1.ICON_NOT_ALLOWED;
16449 }
16450 switch (iconName) {
16451 case DragAndDropService_1.ICON_PINNED:
16452 eIcon = this.ePinnedIcon;
16453 break;
16454 case DragAndDropService_1.ICON_MOVE:
16455 eIcon = this.eMoveIcon;
16456 break;
16457 case DragAndDropService_1.ICON_LEFT:
16458 eIcon = this.eLeftIcon;
16459 break;
16460 case DragAndDropService_1.ICON_RIGHT:
16461 eIcon = this.eRightIcon;
16462 break;
16463 case DragAndDropService_1.ICON_GROUP:
16464 eIcon = this.eGroupIcon;
16465 break;
16466 case DragAndDropService_1.ICON_AGGREGATE:
16467 eIcon = this.eAggregateIcon;
16468 break;
16469 case DragAndDropService_1.ICON_PIVOT:
16470 eIcon = this.ePivotIcon;
16471 break;
16472 case DragAndDropService_1.ICON_NOT_ALLOWED:
16473 eIcon = this.eDropNotAllowedIcon;
16474 break;
16475 case DragAndDropService_1.ICON_HIDE:
16476 eIcon = this.eHideIcon;
16477 break;
16478 }
16479 this.eGhostIcon.classList.toggle('ag-shake-left-to-right', shake);
16480 if (eIcon === this.eHideIcon && this.gridOptionsWrapper.isSuppressDragLeaveHidesColumns()) {
16481 return;
16482 }
16483 if (eIcon) {
16484 this.eGhostIcon.appendChild(eIcon);
16485 }
16486 };
16487 var DragAndDropService_1;
16488 DragAndDropService.ICON_PINNED = 'pinned';
16489 DragAndDropService.ICON_MOVE = 'move';
16490 DragAndDropService.ICON_LEFT = 'left';
16491 DragAndDropService.ICON_RIGHT = 'right';
16492 DragAndDropService.ICON_GROUP = 'group';
16493 DragAndDropService.ICON_AGGREGATE = 'aggregate';
16494 DragAndDropService.ICON_PIVOT = 'pivot';
16495 DragAndDropService.ICON_NOT_ALLOWED = 'notAllowed';
16496 DragAndDropService.ICON_HIDE = 'hide';
16497 DragAndDropService.GHOST_TEMPLATE = "<div class=\"ag-dnd-ghost ag-unselectable\">\n <span class=\"ag-dnd-ghost-icon ag-shake-left-to-right\"></span>\n <div class=\"ag-dnd-ghost-label\"></div>\n </div>";
16498 __decorate$y([
16499 Autowired('dragService')
16500 ], DragAndDropService.prototype, "dragService", void 0);
16501 __decorate$y([
16502 Autowired('environment')
16503 ], DragAndDropService.prototype, "environment", void 0);
16504 __decorate$y([
16505 Autowired('columnApi')
16506 ], DragAndDropService.prototype, "columnApi", void 0);
16507 __decorate$y([
16508 Autowired('gridApi')
16509 ], DragAndDropService.prototype, "gridApi", void 0);
16510 __decorate$y([
16511 PostConstruct
16512 ], DragAndDropService.prototype, "init", null);
16513 __decorate$y([
16514 PreDestroy
16515 ], DragAndDropService.prototype, "clearDragSourceParamsList", null);
16516 DragAndDropService = DragAndDropService_1 = __decorate$y([
16517 Bean('dragAndDropService')
16518 ], DragAndDropService);
16519 return DragAndDropService;
16520}(BeanStub));
16521
16522/**
16523 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
16524 * @version v27.3.0
16525 * @link https://www.ag-grid.com/
16526 * @license MIT
16527 */
16528var __extends$D = (undefined && undefined.__extends) || (function () {
16529 var extendStatics = function (d, b) {
16530 extendStatics = Object.setPrototypeOf ||
16531 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
16532 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
16533 return extendStatics(d, b);
16534 };
16535 return function (d, b) {
16536 extendStatics(d, b);
16537 function __() { this.constructor = d; }
16538 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16539 };
16540})();
16541var __decorate$z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
16542 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16543 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16544 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;
16545 return c > 3 && r && Object.defineProperty(target, key, r), r;
16546};
16547var RowDragComp = /** @class */ (function (_super) {
16548 __extends$D(RowDragComp, _super);
16549 function RowDragComp(cellValueFn, rowNode, column, customGui, dragStartPixels, suppressVisibilityChange) {
16550 var _this = _super.call(this) || this;
16551 _this.cellValueFn = cellValueFn;
16552 _this.rowNode = rowNode;
16553 _this.column = column;
16554 _this.customGui = customGui;
16555 _this.dragStartPixels = dragStartPixels;
16556 _this.suppressVisibilityChange = suppressVisibilityChange;
16557 _this.dragSource = null;
16558 return _this;
16559 }
16560 RowDragComp.prototype.isCustomGui = function () {
16561 return this.customGui != null;
16562 };
16563 RowDragComp.prototype.postConstruct = function () {
16564 if (!this.customGui) {
16565 this.setTemplate(/* html */ "<div class=\"ag-drag-handle ag-row-drag\" aria-hidden=\"true\"></div>");
16566 this.getGui().appendChild(createIconNoSpan('rowDrag', this.beans.gridOptionsWrapper, null));
16567 this.addDragSource();
16568 }
16569 else {
16570 this.setDragElement(this.customGui, this.dragStartPixels);
16571 }
16572 this.checkCompatibility();
16573 if (!this.suppressVisibilityChange) {
16574 var strategy = this.beans.gridOptionsWrapper.isRowDragManaged() ?
16575 new ManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column) :
16576 new NonManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column);
16577 this.createManagedBean(strategy, this.beans.context);
16578 }
16579 };
16580 RowDragComp.prototype.setDragElement = function (dragElement, dragStartPixels) {
16581 this.setTemplateFromElement(dragElement);
16582 this.addDragSource(dragStartPixels);
16583 };
16584 RowDragComp.prototype.getSelectedCount = function () {
16585 var isRowDragMultiRow = this.beans.gridOptionsWrapper.isRowDragMultiRow();
16586 if (!isRowDragMultiRow) {
16587 return 1;
16588 }
16589 var selection = this.beans.selectionService.getSelectedNodes();
16590 return selection.indexOf(this.rowNode) !== -1 ? selection.length : 1;
16591 };
16592 // returns true if all compatibility items work out
16593 RowDragComp.prototype.checkCompatibility = function () {
16594 var managed = this.beans.gridOptionsWrapper.isRowDragManaged();
16595 var treeData = this.beans.gridOptionsWrapper.isTreeData();
16596 if (treeData && managed) {
16597 doOnce(function () {
16598 return console.warn('AG Grid: If using row drag with tree data, you cannot have rowDragManaged=true');
16599 }, 'RowDragComp.managedAndTreeData');
16600 }
16601 };
16602 RowDragComp.prototype.addDragSource = function (dragStartPixels) {
16603 var _this = this;
16604 if (dragStartPixels === void 0) { dragStartPixels = 4; }
16605 // if this is changing the drag element, delete the previous dragSource
16606 if (this.dragSource) {
16607 this.removeDragSource();
16608 }
16609 var dragItem = {
16610 rowNode: this.rowNode,
16611 columns: this.column ? [this.column] : undefined,
16612 defaultTextValue: this.cellValueFn(),
16613 };
16614 var rowDragText = this.column && this.column.getColDef().rowDragText;
16615 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
16616 this.dragSource = {
16617 type: exports.DragSourceType.RowDrag,
16618 eElement: this.getGui(),
16619 dragItemName: function () {
16620 var dragItemCount = _this.getSelectedCount();
16621 if (rowDragText) {
16622 return rowDragText(dragItem, dragItemCount);
16623 }
16624 return dragItemCount === 1 ? _this.cellValueFn() : dragItemCount + " " + translate('rowDragRows', 'rows');
16625 },
16626 getDragItem: function () { return dragItem; },
16627 dragStartPixels: dragStartPixels,
16628 dragSourceDomDataKey: this.beans.gridOptionsWrapper.getDomDataKey()
16629 };
16630 this.beans.dragAndDropService.addDragSource(this.dragSource, true);
16631 };
16632 RowDragComp.prototype.removeDragSource = function () {
16633 if (this.dragSource) {
16634 this.beans.dragAndDropService.removeDragSource(this.dragSource);
16635 }
16636 this.dragSource = null;
16637 };
16638 __decorate$z([
16639 Autowired('beans')
16640 ], RowDragComp.prototype, "beans", void 0);
16641 __decorate$z([
16642 PostConstruct
16643 ], RowDragComp.prototype, "postConstruct", null);
16644 __decorate$z([
16645 PreDestroy
16646 ], RowDragComp.prototype, "removeDragSource", null);
16647 return RowDragComp;
16648}(Component));
16649var VisibilityStrategy = /** @class */ (function (_super) {
16650 __extends$D(VisibilityStrategy, _super);
16651 function VisibilityStrategy(parent, rowNode, column) {
16652 var _this = _super.call(this) || this;
16653 _this.parent = parent;
16654 _this.rowNode = rowNode;
16655 _this.column = column;
16656 return _this;
16657 }
16658 VisibilityStrategy.prototype.setDisplayedOrVisible = function (neverDisplayed) {
16659 if (neverDisplayed) {
16660 this.parent.setDisplayed(false);
16661 }
16662 else {
16663 var shown = true;
16664 var isShownSometimes = false;
16665 if (this.column) {
16666 shown = this.column.isRowDrag(this.rowNode) || this.parent.isCustomGui();
16667 isShownSometimes = isFunction(this.column.getColDef().rowDrag);
16668 }
16669 // if shown sometimes, them some rows can have drag handle while other don't,
16670 // so we use setVisible to keep the handles horizontally aligned (as setVisible
16671 // keeps the empty space, whereas setDisplayed looses the space)
16672 if (isShownSometimes) {
16673 this.parent.setDisplayed(true);
16674 this.parent.setVisible(shown);
16675 }
16676 else {
16677 this.parent.setDisplayed(shown);
16678 this.parent.setVisible(true);
16679 }
16680 }
16681 };
16682 return VisibilityStrategy;
16683}(BeanStub));
16684// when non managed, the visibility depends on suppressRowDrag property only
16685var NonManagedVisibilityStrategy = /** @class */ (function (_super) {
16686 __extends$D(NonManagedVisibilityStrategy, _super);
16687 function NonManagedVisibilityStrategy(parent, beans, rowNode, column) {
16688 var _this = _super.call(this, parent, rowNode, column) || this;
16689 _this.beans = beans;
16690 return _this;
16691 }
16692 NonManagedVisibilityStrategy.prototype.postConstruct = function () {
16693 this.addManagedListener(this.beans.gridOptionsWrapper, 'suppressRowDrag', this.onSuppressRowDrag.bind(this));
16694 // in case data changes, then we need to update visibility of drag item
16695 this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
16696 this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
16697 this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
16698 this.addManagedListener(this.beans.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this));
16699 this.workOutVisibility();
16700 };
16701 NonManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
16702 this.workOutVisibility();
16703 };
16704 NonManagedVisibilityStrategy.prototype.workOutVisibility = function () {
16705 // only show the drag if both sort and filter are not present
16706 var neverDisplayed = this.beans.gridOptionsWrapper.isSuppressRowDrag();
16707 this.setDisplayedOrVisible(neverDisplayed);
16708 };
16709 __decorate$z([
16710 PostConstruct
16711 ], NonManagedVisibilityStrategy.prototype, "postConstruct", null);
16712 return NonManagedVisibilityStrategy;
16713}(VisibilityStrategy));
16714// when managed, the visibility depends on sort, filter and row group, as well as suppressRowDrag property
16715var ManagedVisibilityStrategy = /** @class */ (function (_super) {
16716 __extends$D(ManagedVisibilityStrategy, _super);
16717 function ManagedVisibilityStrategy(parent, beans, rowNode, column) {
16718 var _this = _super.call(this, parent, rowNode, column) || this;
16719 _this.beans = beans;
16720 return _this;
16721 }
16722 ManagedVisibilityStrategy.prototype.postConstruct = function () {
16723 // we do not show the component if sort, filter or grouping is active
16724 this.addManagedListener(this.beans.eventService, Events.EVENT_SORT_CHANGED, this.workOutVisibility.bind(this));
16725 this.addManagedListener(this.beans.eventService, Events.EVENT_FILTER_CHANGED, this.workOutVisibility.bind(this));
16726 this.addManagedListener(this.beans.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.workOutVisibility.bind(this));
16727 this.addManagedListener(this.beans.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this));
16728 // in case data changes, then we need to update visibility of drag item
16729 this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
16730 this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
16731 this.addManagedListener(this.beans.gridOptionsWrapper, 'suppressRowDrag', this.onSuppressRowDrag.bind(this));
16732 this.workOutVisibility();
16733 };
16734 ManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
16735 this.workOutVisibility();
16736 };
16737 ManagedVisibilityStrategy.prototype.workOutVisibility = function () {
16738 // only show the drag if both sort and filter are not present
16739 var gridBodyCon = this.beans.ctrlsService.getGridBodyCtrl();
16740 var rowDragFeature = gridBodyCon.getRowDragFeature();
16741 var shouldPreventRowMove = rowDragFeature && rowDragFeature.shouldPreventRowMove();
16742 var suppressRowDrag = this.beans.gridOptionsWrapper.isSuppressRowDrag();
16743 var hasExternalDropZones = this.beans.dragAndDropService.hasExternalDropZones();
16744 var neverDisplayed = (shouldPreventRowMove && !hasExternalDropZones) || suppressRowDrag;
16745 this.setDisplayedOrVisible(neverDisplayed);
16746 };
16747 __decorate$z([
16748 PostConstruct
16749 ], ManagedVisibilityStrategy.prototype, "postConstruct", null);
16750 return ManagedVisibilityStrategy;
16751}(VisibilityStrategy));
16752
16753/**
16754 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
16755 * @version v27.3.0
16756 * @link https://www.ag-grid.com/
16757 * @license MIT
16758 */
16759var __extends$E = (undefined && undefined.__extends) || (function () {
16760 var extendStatics = function (d, b) {
16761 extendStatics = Object.setPrototypeOf ||
16762 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
16763 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
16764 return extendStatics(d, b);
16765 };
16766 return function (d, b) {
16767 extendStatics(d, b);
16768 function __() { this.constructor = d; }
16769 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16770 };
16771})();
16772var __assign$7 = (undefined && undefined.__assign) || function () {
16773 __assign$7 = Object.assign || function(t) {
16774 for (var s, i = 1, n = arguments.length; i < n; i++) {
16775 s = arguments[i];
16776 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
16777 t[p] = s[p];
16778 }
16779 return t;
16780 };
16781 return __assign$7.apply(this, arguments);
16782};
16783var __decorate$A = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
16784 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16785 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16786 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;
16787 return c > 3 && r && Object.defineProperty(target, key, r), r;
16788};
16789var GroupCellRendererCtrl = /** @class */ (function (_super) {
16790 __extends$E(GroupCellRendererCtrl, _super);
16791 function GroupCellRendererCtrl() {
16792 return _super !== null && _super.apply(this, arguments) || this;
16793 }
16794 GroupCellRendererCtrl.prototype.init = function (comp, eGui, eCheckbox, eExpanded, eContracted, compClass, params) {
16795 this.params = params;
16796 this.eGui = eGui;
16797 this.eCheckbox = eCheckbox;
16798 this.eExpanded = eExpanded;
16799 this.eContracted = eContracted;
16800 this.comp = comp;
16801 this.compClass = compClass;
16802 var topLevelFooter = this.isTopLevelFooter();
16803 var embeddedRowMismatch = this.isEmbeddedRowMismatch();
16804 // This allows for empty strings to appear as groups since
16805 // it will only return for null or undefined.
16806 var nullValue = params.value == null;
16807 var skipCell = false;
16808 // if the groupCellRenderer is inside of a footer and groupHideOpenParents is true
16809 // we should only display the groupCellRenderer if the current column is the rowGroupedColumn
16810 if (this.gridOptionsWrapper.isGroupIncludeFooter() && this.gridOptionsWrapper.isGroupHideOpenParents()) {
16811 var node = params.node;
16812 if (node.footer) {
16813 var showRowGroup = params.colDef && params.colDef.showRowGroup;
16814 var rowGroupColumnId = node.rowGroupColumn && node.rowGroupColumn.getColId();
16815 skipCell = showRowGroup !== rowGroupColumnId;
16816 }
16817 }
16818 this.cellIsBlank = topLevelFooter ? false : (embeddedRowMismatch || nullValue || skipCell);
16819 if (this.cellIsBlank) {
16820 return;
16821 }
16822 this.setupShowingValueForOpenedParent();
16823 this.findDisplayedGroupNode();
16824 this.addFullWidthRowDraggerIfNeeded();
16825 this.addExpandAndContract();
16826 this.addCheckboxIfNeeded();
16827 this.addValueElement();
16828 this.setupIndent();
16829 this.refreshAriaExpanded();
16830 };
16831 GroupCellRendererCtrl.prototype.destroy = function () {
16832 _super.prototype.destroy.call(this);
16833 // property cleanup to avoid memory leaks
16834 this.expandListener = null;
16835 };
16836 GroupCellRendererCtrl.prototype.refreshAriaExpanded = function () {
16837 var _a = this.params, node = _a.node, eParentOfValue = _a.eParentOfValue;
16838 if (this.expandListener) {
16839 this.expandListener = this.expandListener();
16840 }
16841 if (!this.isExpandable()) {
16842 removeAriaExpanded(eParentOfValue);
16843 return;
16844 }
16845 var listener = function () {
16846 // for react, we don't use JSX, as setting attributes via jsx is slower
16847 setAriaExpanded(eParentOfValue, !!node.expanded);
16848 };
16849 this.expandListener = this.addManagedListener(node, RowNode.EVENT_EXPANDED_CHANGED, listener) || null;
16850 listener();
16851 };
16852 GroupCellRendererCtrl.prototype.isTopLevelFooter = function () {
16853 if (!this.gridOptionsWrapper.isGroupIncludeTotalFooter()) {
16854 return false;
16855 }
16856 if (this.params.value != null || this.params.node.level != -1) {
16857 return false;
16858 }
16859 // at this point, we know it's the root node and there is no value present, so it's a footer cell.
16860 // the only thing to work out is if we are displaying groups across multiple
16861 // columns (groupMultiAutoColumn=true), we only want 'total' to appear in the first column.
16862 var colDef = this.params.colDef;
16863 var doingFullWidth = colDef == null;
16864 if (doingFullWidth) {
16865 return true;
16866 }
16867 if (colDef.showRowGroup === true) {
16868 return true;
16869 }
16870 var rowGroupCols = this.columnModel.getRowGroupColumns();
16871 // this is a sanity check, rowGroupCols should always be present
16872 if (!rowGroupCols || rowGroupCols.length === 0) {
16873 return true;
16874 }
16875 var firstRowGroupCol = rowGroupCols[0];
16876 return firstRowGroupCol.getId() === colDef.showRowGroup;
16877 };
16878 // if we are doing embedded full width rows, we only show the renderer when
16879 // in the body, or if pinning in the pinned section, or if pinning and RTL,
16880 // in the right section. otherwise we would have the cell repeated in each section.
16881 GroupCellRendererCtrl.prototype.isEmbeddedRowMismatch = function () {
16882 if (!this.params.fullWidth || !this.gridOptionsWrapper.isEmbedFullWidthRows()) {
16883 return false;
16884 }
16885 var pinnedLeftCell = this.params.pinned === Constants.PINNED_LEFT;
16886 var pinnedRightCell = this.params.pinned === Constants.PINNED_RIGHT;
16887 var bodyCell = !pinnedLeftCell && !pinnedRightCell;
16888 if (this.gridOptionsWrapper.isEnableRtl()) {
16889 if (this.columnModel.isPinningLeft()) {
16890 return !pinnedRightCell;
16891 }
16892 return !bodyCell;
16893 }
16894 if (this.columnModel.isPinningLeft()) {
16895 return !pinnedLeftCell;
16896 }
16897 return !bodyCell;
16898 };
16899 GroupCellRendererCtrl.prototype.findDisplayedGroupNode = function () {
16900 var column = this.params.column;
16901 var rowNode = this.params.node;
16902 if (this.showingValueForOpenedParent) {
16903 var pointer = rowNode.parent;
16904 while (pointer != null) {
16905 if (pointer.rowGroupColumn && column.isRowGroupDisplayed(pointer.rowGroupColumn.getId())) {
16906 this.displayedGroupNode = pointer;
16907 break;
16908 }
16909 pointer = pointer.parent;
16910 }
16911 }
16912 // if we didn't find a displayed group, set it to the row node
16913 if (missing(this.displayedGroupNode)) {
16914 this.displayedGroupNode = rowNode;
16915 }
16916 };
16917 GroupCellRendererCtrl.prototype.setupShowingValueForOpenedParent = function () {
16918 // note - this code depends on sortService.updateGroupDataForHiddenOpenParents, where group data
16919 // is updated to reflect the dragged down parents
16920 var rowNode = this.params.node;
16921 var column = this.params.column;
16922 if (!this.gridOptionsWrapper.isGroupHideOpenParents()) {
16923 this.showingValueForOpenedParent = false;
16924 return;
16925 }
16926 // hideOpenParents means rowNode.groupData can have data for the group this column is displaying, even though
16927 // this rowNode isn't grouping by the column we are displaying
16928 // if no groupData at all, we are not showing a parent value
16929 if (!rowNode.groupData) {
16930 this.showingValueForOpenedParent = false;
16931 return;
16932 }
16933 // this is the normal case, in that we are showing a group for which this column is configured. note that
16934 // this means the Row Group is closed (if it was open, we would not be displaying it)
16935 var showingGroupNode = rowNode.rowGroupColumn != null;
16936 if (showingGroupNode) {
16937 var keyOfGroupingColumn = rowNode.rowGroupColumn.getId();
16938 var configuredToShowThisGroupLevel = column.isRowGroupDisplayed(keyOfGroupingColumn);
16939 // if showing group as normal, we didn't take group info from parent
16940 if (configuredToShowThisGroupLevel) {
16941 this.showingValueForOpenedParent = false;
16942 return;
16943 }
16944 }
16945 // see if we are showing a Group Value for the Displayed Group. if we are showing a group value, and this Row Node
16946 // is not grouping by this Displayed Group, we must of gotten the value from a parent node
16947 var valPresent = rowNode.groupData[column.getId()] != null;
16948 this.showingValueForOpenedParent = valPresent;
16949 };
16950 GroupCellRendererCtrl.prototype.addValueElement = function () {
16951 if (this.displayedGroupNode.footer) {
16952 this.addFooterValue();
16953 }
16954 else {
16955 this.addGroupValue();
16956 this.addChildCount();
16957 }
16958 };
16959 GroupCellRendererCtrl.prototype.addGroupValue = function () {
16960 // we try and use the cellRenderer of the column used for the grouping if we can
16961 var paramsAdjusted = this.adjustParamsWithDetailsFromRelatedColumn();
16962 var innerCompDetails = this.getInnerCompDetails(paramsAdjusted);
16963 var valueFormatted = paramsAdjusted.valueFormatted, value = paramsAdjusted.value;
16964 var valueWhenNoRenderer = valueFormatted != null ? valueFormatted : value;
16965 this.comp.setInnerRenderer(innerCompDetails, valueWhenNoRenderer);
16966 };
16967 GroupCellRendererCtrl.prototype.adjustParamsWithDetailsFromRelatedColumn = function () {
16968 var relatedColumn = this.displayedGroupNode.rowGroupColumn;
16969 var column = this.params.column;
16970 if (!relatedColumn) {
16971 return this.params;
16972 }
16973 var notFullWidth = column != null;
16974 if (notFullWidth) {
16975 var showingThisRowGroup = column.isRowGroupDisplayed(relatedColumn.getId());
16976 if (!showingThisRowGroup) {
16977 return this.params;
16978 }
16979 }
16980 var params = this.params;
16981 var _a = this.params, value = _a.value, node = _a.node;
16982 var valueFormatted = this.valueFormatterService.formatValue(relatedColumn, node, value);
16983 // we don't update the original params, as they could of come through React,
16984 // as react has RowGroupCellRenderer, which means the params could be props which
16985 // would be read only
16986 var paramsAdjusted = __assign$7(__assign$7({}, params), { valueFormatted: valueFormatted });
16987 return paramsAdjusted;
16988 };
16989 GroupCellRendererCtrl.prototype.addFooterValue = function () {
16990 var footerValueGetter = this.params.footerValueGetter;
16991 var footerValue = '';
16992 if (footerValueGetter) {
16993 // params is same as we were given, except we set the value as the item to display
16994 var paramsClone = cloneObject(this.params);
16995 paramsClone.value = this.params.value;
16996 if (typeof footerValueGetter === 'function') {
16997 footerValue = footerValueGetter(paramsClone);
16998 }
16999 else if (typeof footerValueGetter === 'string') {
17000 footerValue = this.expressionService.evaluate(footerValueGetter, paramsClone);
17001 }
17002 else {
17003 console.warn('AG Grid: footerValueGetter should be either a function or a string (expression)');
17004 }
17005 }
17006 else {
17007 footerValue = 'Total ' + (this.params.value != null ? this.params.value : '');
17008 }
17009 var innerCompDetails = this.getInnerCompDetails(this.params);
17010 this.comp.setInnerRenderer(innerCompDetails, footerValue);
17011 };
17012 GroupCellRendererCtrl.prototype.getInnerCompDetails = function (params) {
17013 var _this = this;
17014 // for full width rows, we don't do any of the below
17015 if (params.fullWidth) {
17016 return this.userComponentFactory.getFullWidthGroupRowInnerCellRenderer(this.gridOptions.groupRowRendererParams, params);
17017 }
17018 // when grouping, the normal case is we use the cell renderer of the grouped column. eg if grouping by country
17019 // and then rating, we will use the country cell renderer for each country group row and likewise the rating
17020 // cell renderer for each rating group row.
17021 //
17022 // however if the user has innerCellRenderer defined, this gets preference and we don't use cell renderers
17023 // of the grouped columns.
17024 //
17025 // so we check and use in the following order:
17026 //
17027 // 1) thisColDef.cellRendererParams.innerRenderer of the column showing the groups (eg auto group column)
17028 // 2) groupedColDef.cellRenderer of the grouped column
17029 // 3) groupedColDef.cellRendererParams.innerRenderer
17030 // we check if cell renderer provided for the group cell renderer, eg colDef.cellRendererParams.innerRenderer
17031 var innerCompDetails = this.userComponentFactory
17032 .getInnerRendererDetails(params, params);
17033 // avoid using GroupCellRenderer again, otherwise stack overflow, as we insert same renderer again and again.
17034 // this covers off chance user is grouping by a column that is also configured with GroupCellRenderer
17035 var isGroupRowRenderer = function (details) { return details && details.componentClass == _this.compClass; };
17036 if (innerCompDetails && !isGroupRowRenderer(innerCompDetails)) {
17037 // use the renderer defined in cellRendererParams.innerRenderer
17038 return innerCompDetails;
17039 }
17040 var relatedColumn = this.displayedGroupNode.rowGroupColumn;
17041 var relatedColDef = relatedColumn ? relatedColumn.getColDef() : undefined;
17042 if (!relatedColDef) {
17043 return;
17044 }
17045 // otherwise see if we can use the cellRenderer of the column we are grouping by
17046 var relatedCompDetails = this.userComponentFactory
17047 .getCellRendererDetails(relatedColDef, params);
17048 if (relatedCompDetails && !isGroupRowRenderer(relatedCompDetails)) {
17049 // Only if the original column is using a specific renderer, it it is a using a DEFAULT one ignore it
17050 return relatedCompDetails;
17051 }
17052 if (isGroupRowRenderer(relatedCompDetails) &&
17053 relatedColDef.cellRendererParams &&
17054 relatedColDef.cellRendererParams.innerRenderer) {
17055 // edge case - this comes from a column which has been grouped dynamically, that has a renderer 'group'
17056 // and has an inner cell renderer
17057 var res = this.userComponentFactory.getInnerRendererDetails(relatedColDef.cellRendererParams, params);
17058 return res;
17059 }
17060 };
17061 GroupCellRendererCtrl.prototype.addChildCount = function () {
17062 // only include the child count if it's included, eg if user doing custom aggregation,
17063 // then this could be left out, or set to -1, ie no child count
17064 if (this.params.suppressCount) {
17065 return;
17066 }
17067 this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED, this.updateChildCount.bind(this));
17068 // filtering changes the child count, so need to cater for it
17069 this.updateChildCount();
17070 };
17071 GroupCellRendererCtrl.prototype.updateChildCount = function () {
17072 var allChildrenCount = this.displayedGroupNode.allChildrenCount;
17073 var showingGroupForThisNode = this.isShowRowGroupForThisRow();
17074 var showCount = showingGroupForThisNode && allChildrenCount != null && allChildrenCount >= 0;
17075 var countString = showCount ? "(" + allChildrenCount + ")" : "";
17076 this.comp.setChildCount(countString);
17077 };
17078 GroupCellRendererCtrl.prototype.isShowRowGroupForThisRow = function () {
17079 if (this.gridOptionsWrapper.isTreeData()) {
17080 return true;
17081 }
17082 var rowGroupColumn = this.displayedGroupNode.rowGroupColumn;
17083 if (!rowGroupColumn) {
17084 return false;
17085 }
17086 // column is null for fullWidthRows
17087 var column = this.params.column;
17088 var thisColumnIsInterested = column == null || column.isRowGroupDisplayed(rowGroupColumn.getId());
17089 return thisColumnIsInterested;
17090 };
17091 GroupCellRendererCtrl.prototype.addExpandAndContract = function () {
17092 var params = this.params;
17093 var eExpandedIcon = createIconNoSpan('groupExpanded', this.gridOptionsWrapper, null);
17094 var eContractedIcon = createIconNoSpan('groupContracted', this.gridOptionsWrapper, null);
17095 if (eExpandedIcon) {
17096 this.eExpanded.appendChild(eExpandedIcon);
17097 }
17098 if (eContractedIcon) {
17099 this.eContracted.appendChild(eContractedIcon);
17100 }
17101 var eGroupCell = params.eGridCell;
17102 // if editing groups, then double click is to start editing
17103 if (!this.gridOptionsWrapper.isEnableGroupEdit() && this.isExpandable() && !params.suppressDoubleClickExpand) {
17104 this.addManagedListener(eGroupCell, 'dblclick', this.onCellDblClicked.bind(this));
17105 }
17106 this.addManagedListener(this.eExpanded, 'click', this.onExpandClicked.bind(this));
17107 this.addManagedListener(this.eContracted, 'click', this.onExpandClicked.bind(this));
17108 // expand / contract as the user hits enter
17109 this.addManagedListener(eGroupCell, 'keydown', this.onKeyDown.bind(this));
17110 this.addManagedListener(params.node, RowNode.EVENT_EXPANDED_CHANGED, this.showExpandAndContractIcons.bind(this));
17111 this.showExpandAndContractIcons();
17112 // because we don't show the expand / contract when there are no children, we need to check every time
17113 // the number of children change.
17114 var expandableChangedListener = this.onRowNodeIsExpandableChanged.bind(this);
17115 this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_ALL_CHILDREN_COUNT_CHANGED, expandableChangedListener);
17116 this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_MASTER_CHANGED, expandableChangedListener);
17117 this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_GROUP_CHANGED, expandableChangedListener);
17118 this.addManagedListener(this.displayedGroupNode, RowNode.EVENT_HAS_CHILDREN_CHANGED, expandableChangedListener);
17119 };
17120 GroupCellRendererCtrl.prototype.onExpandClicked = function (mouseEvent) {
17121 if (isStopPropagationForAgGrid(mouseEvent)) {
17122 return;
17123 }
17124 // so if we expand a node, it does not also get selected.
17125 stopPropagationForAgGrid(mouseEvent);
17126 this.onExpandOrContract(mouseEvent);
17127 };
17128 GroupCellRendererCtrl.prototype.onExpandOrContract = function (e) {
17129 // must use the displayedGroup, so if data was dragged down, we expand the parent, not this row
17130 var rowNode = this.displayedGroupNode;
17131 var nextExpandState = !rowNode.expanded;
17132 rowNode.setExpanded(nextExpandState, e);
17133 };
17134 GroupCellRendererCtrl.prototype.isExpandable = function () {
17135 if (this.showingValueForOpenedParent) {
17136 return true;
17137 }
17138 var rowNode = this.displayedGroupNode;
17139 var reducedLeafNode = this.columnModel.isPivotMode() && rowNode.leafGroup;
17140 var expandableGroup = rowNode.isExpandable() && !rowNode.footer && !reducedLeafNode;
17141 if (!expandableGroup) {
17142 return false;
17143 }
17144 // column is null for fullWidthRows
17145 var column = this.params.column;
17146 var displayingForOneColumnOnly = column != null && typeof column.getColDef().showRowGroup === 'string';
17147 if (displayingForOneColumnOnly) {
17148 var showing = this.isShowRowGroupForThisRow();
17149 return showing;
17150 }
17151 return true;
17152 };
17153 GroupCellRendererCtrl.prototype.showExpandAndContractIcons = function () {
17154 var _a = this, params = _a.params, displayedGroup = _a.displayedGroupNode, columnModel = _a.columnModel;
17155 var node = params.node;
17156 var isExpandable = this.isExpandable();
17157 if (isExpandable) {
17158 // if expandable, show one based on expand state.
17159 // if we were dragged down, means our parent is always expanded
17160 var expanded = this.showingValueForOpenedParent ? true : node.expanded;
17161 this.comp.setExpandedDisplayed(expanded);
17162 this.comp.setContractedDisplayed(!expanded);
17163 }
17164 else {
17165 // it not expandable, show neither
17166 this.comp.setExpandedDisplayed(false);
17167 this.comp.setContractedDisplayed(false);
17168 }
17169 // compensation padding for leaf nodes, so there is blank space instead of the expand icon
17170 var pivotMode = columnModel.isPivotMode();
17171 var pivotModeAndLeafGroup = pivotMode && displayedGroup.leafGroup;
17172 var addExpandableCss = isExpandable && !pivotModeAndLeafGroup;
17173 var isTotalFooterNode = node.footer && node.level === -1;
17174 this.comp.addOrRemoveCssClass('ag-cell-expandable', addExpandableCss);
17175 this.comp.addOrRemoveCssClass('ag-row-group', addExpandableCss);
17176 if (pivotMode) {
17177 this.comp.addOrRemoveCssClass('ag-pivot-leaf-group', pivotModeAndLeafGroup);
17178 }
17179 else if (!isTotalFooterNode) {
17180 this.comp.addOrRemoveCssClass('ag-row-group-leaf-indent', !addExpandableCss);
17181 }
17182 };
17183 GroupCellRendererCtrl.prototype.onRowNodeIsExpandableChanged = function () {
17184 // maybe if no children now, we should hide the expand / contract icons
17185 this.showExpandAndContractIcons();
17186 // if we have no children, this impacts the indent
17187 this.setIndent();
17188 this.refreshAriaExpanded();
17189 };
17190 GroupCellRendererCtrl.prototype.setupIndent = function () {
17191 // only do this if an indent - as this overwrites the padding that
17192 // the theme set, which will make things look 'not aligned' for the
17193 // first group level.
17194 var node = this.params.node;
17195 var suppressPadding = this.params.suppressPadding;
17196 if (!suppressPadding) {
17197 this.addManagedListener(node, RowNode.EVENT_UI_LEVEL_CHANGED, this.setIndent.bind(this));
17198 this.setIndent();
17199 }
17200 };
17201 GroupCellRendererCtrl.prototype.setIndent = function () {
17202 if (this.gridOptionsWrapper.isGroupHideOpenParents()) {
17203 return;
17204 }
17205 var params = this.params;
17206 var rowNode = params.node;
17207 // if we are only showing one group column, we don't want to be indenting based on level
17208 var fullWithRow = !!params.colDef;
17209 var treeData = this.gridOptionsWrapper.isTreeData();
17210 var manyDimensionThisColumn = !fullWithRow || treeData || params.colDef.showRowGroup === true;
17211 var paddingCount = manyDimensionThisColumn ? rowNode.uiLevel : 0;
17212 var userProvidedPaddingPixelsTheDeprecatedWay = params.padding >= 0;
17213 if (userProvidedPaddingPixelsTheDeprecatedWay) {
17214 doOnce(function () { return console.warn('AG Grid: cellRendererParams.padding no longer works, it was deprecated in since v14.2 and removed in v26, configuring padding for groupCellRenderer should be done with Sass variables and themes. Please see the AG Grid documentation page for Themes, in particular the property $row-group-indent-size.'); }, 'groupCellRenderer->doDeprecatedWay');
17215 }
17216 if (this.indentClass) {
17217 this.comp.addOrRemoveCssClass(this.indentClass, false);
17218 }
17219 this.indentClass = 'ag-row-group-indent-' + paddingCount;
17220 this.comp.addOrRemoveCssClass(this.indentClass, true);
17221 };
17222 GroupCellRendererCtrl.prototype.addFullWidthRowDraggerIfNeeded = function () {
17223 var _this = this;
17224 if (!this.params.fullWidth || !this.params.rowDrag) {
17225 return;
17226 }
17227 var rowDragComp = new RowDragComp(function () { return _this.params.value; }, this.params.node);
17228 this.createManagedBean(rowDragComp, this.context);
17229 this.eGui.insertAdjacentElement('afterbegin', rowDragComp.getGui());
17230 };
17231 GroupCellRendererCtrl.prototype.isUserWantsSelected = function () {
17232 var paramsCheckbox = this.params.checkbox;
17233 if (typeof paramsCheckbox === 'function') {
17234 return paramsCheckbox(this.params);
17235 }
17236 return paramsCheckbox === true;
17237 };
17238 GroupCellRendererCtrl.prototype.addCheckboxIfNeeded = function () {
17239 var _this = this;
17240 var rowNode = this.displayedGroupNode;
17241 var checkboxNeeded = this.isUserWantsSelected() &&
17242 // footers cannot be selected
17243 !rowNode.footer &&
17244 // pinned rows cannot be selected
17245 !rowNode.rowPinned &&
17246 // details cannot be selected
17247 !rowNode.detail;
17248 if (checkboxNeeded) {
17249 var cbSelectionComponent_1 = new CheckboxSelectionComponent();
17250 this.getContext().createBean(cbSelectionComponent_1);
17251 cbSelectionComponent_1.init({ rowNode: rowNode, column: this.params.column });
17252 this.eCheckbox.appendChild(cbSelectionComponent_1.getGui());
17253 this.addDestroyFunc(function () { return _this.getContext().destroyBean(cbSelectionComponent_1); });
17254 }
17255 this.comp.setCheckboxVisible(checkboxNeeded);
17256 };
17257 GroupCellRendererCtrl.prototype.onKeyDown = function (event) {
17258 var enterKeyPressed = event.key === KeyCode.ENTER;
17259 if (!enterKeyPressed || this.params.suppressEnterExpand) {
17260 return;
17261 }
17262 var cellEditable = this.params.column && this.params.column.isCellEditable(this.params.node);
17263 if (cellEditable) {
17264 return;
17265 }
17266 this.onExpandOrContract(event);
17267 };
17268 GroupCellRendererCtrl.prototype.onCellDblClicked = function (mouseEvent) {
17269 if (isStopPropagationForAgGrid(mouseEvent)) {
17270 return;
17271 }
17272 // we want to avoid acting on double click events on the expand / contract icon,
17273 // as that icons already has expand / collapse functionality on it. otherwise if
17274 // the icon was double clicked, we would get 'click', 'click', 'dblclick' which
17275 // is open->close->open, however double click should be open->close only.
17276 var targetIsExpandIcon = isElementInEventPath(this.eExpanded, mouseEvent)
17277 || isElementInEventPath(this.eContracted, mouseEvent);
17278 if (!targetIsExpandIcon) {
17279 this.onExpandOrContract(mouseEvent);
17280 }
17281 };
17282 __decorate$A([
17283 Autowired('expressionService')
17284 ], GroupCellRendererCtrl.prototype, "expressionService", void 0);
17285 __decorate$A([
17286 Autowired('valueFormatterService')
17287 ], GroupCellRendererCtrl.prototype, "valueFormatterService", void 0);
17288 __decorate$A([
17289 Autowired('columnModel')
17290 ], GroupCellRendererCtrl.prototype, "columnModel", void 0);
17291 __decorate$A([
17292 Autowired('userComponentFactory')
17293 ], GroupCellRendererCtrl.prototype, "userComponentFactory", void 0);
17294 __decorate$A([
17295 Autowired('gridOptions')
17296 ], GroupCellRendererCtrl.prototype, "gridOptions", void 0);
17297 return GroupCellRendererCtrl;
17298}(BeanStub));
17299
17300/**
17301 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
17302 * @version v27.3.0
17303 * @link https://www.ag-grid.com/
17304 * @license MIT
17305 */
17306var __extends$F = (undefined && undefined.__extends) || (function () {
17307 var extendStatics = function (d, b) {
17308 extendStatics = Object.setPrototypeOf ||
17309 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
17310 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
17311 return extendStatics(d, b);
17312 };
17313 return function (d, b) {
17314 extendStatics(d, b);
17315 function __() { this.constructor = d; }
17316 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17317 };
17318})();
17319var __decorate$B = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
17320 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17321 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17322 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;
17323 return c > 3 && r && Object.defineProperty(target, key, r), r;
17324};
17325var GroupCellRenderer = /** @class */ (function (_super) {
17326 __extends$F(GroupCellRenderer, _super);
17327 function GroupCellRenderer() {
17328 return _super.call(this, GroupCellRenderer.TEMPLATE) || this;
17329 }
17330 GroupCellRenderer.prototype.init = function (params) {
17331 var _this = this;
17332 var compProxy = {
17333 setInnerRenderer: function (compDetails, valueToDisplay) { return _this.setRenderDetails(compDetails, valueToDisplay); },
17334 setChildCount: function (count) { return _this.eChildCount.innerHTML = count; },
17335 addOrRemoveCssClass: function (cssClass, value) { return _this.addOrRemoveCssClass(cssClass, value); },
17336 setContractedDisplayed: function (expanded) { return setDisplayed(_this.eContracted, expanded); },
17337 setExpandedDisplayed: function (expanded) { return setDisplayed(_this.eExpanded, expanded); },
17338 setCheckboxVisible: function (visible) { return _this.eCheckbox.classList.toggle('ag-invisible', !visible); }
17339 };
17340 var ctrl = this.createManagedBean(new GroupCellRendererCtrl());
17341 var fullWidth = !params.colDef;
17342 var eGui = this.getGui();
17343 ctrl.init(compProxy, eGui, this.eCheckbox, this.eExpanded, this.eContracted, this.constructor, params);
17344 if (fullWidth) {
17345 setAriaRole(eGui, 'gridcell');
17346 }
17347 };
17348 GroupCellRenderer.prototype.setRenderDetails = function (compDetails, valueToDisplay) {
17349 var _this = this;
17350 if (compDetails) {
17351 var componentPromise = compDetails.newAgStackInstance();
17352 if (!componentPromise) {
17353 return;
17354 }
17355 componentPromise.then(function (comp) {
17356 if (!comp) {
17357 return;
17358 }
17359 var destroyComp = function () { return _this.context.destroyBean(comp); };
17360 if (_this.isAlive()) {
17361 _this.eValue.appendChild(comp.getGui());
17362 _this.addDestroyFunc(destroyComp);
17363 }
17364 else {
17365 destroyComp();
17366 }
17367 });
17368 }
17369 else {
17370 this.eValue.innerText = valueToDisplay;
17371 }
17372 };
17373 // this is a user component, and IComponent has "public destroy()" as part of the interface.
17374 // so we need to have public here instead of private or protected
17375 GroupCellRenderer.prototype.destroy = function () {
17376 this.getContext().destroyBean(this.innerCellRenderer);
17377 _super.prototype.destroy.call(this);
17378 };
17379 GroupCellRenderer.prototype.refresh = function () {
17380 return false;
17381 };
17382 GroupCellRenderer.TEMPLATE = "<span class=\"ag-cell-wrapper\">\n <span class=\"ag-group-expanded\" ref=\"eExpanded\"></span>\n <span class=\"ag-group-contracted\" ref=\"eContracted\"></span>\n <span class=\"ag-group-checkbox ag-invisible\" ref=\"eCheckbox\"></span>\n <span class=\"ag-group-value\" ref=\"eValue\"></span>\n <span class=\"ag-group-child-count\" ref=\"eChildCount\"></span>\n </span>";
17383 __decorate$B([
17384 RefSelector('eExpanded')
17385 ], GroupCellRenderer.prototype, "eExpanded", void 0);
17386 __decorate$B([
17387 RefSelector('eContracted')
17388 ], GroupCellRenderer.prototype, "eContracted", void 0);
17389 __decorate$B([
17390 RefSelector('eCheckbox')
17391 ], GroupCellRenderer.prototype, "eCheckbox", void 0);
17392 __decorate$B([
17393 RefSelector('eValue')
17394 ], GroupCellRenderer.prototype, "eValue", void 0);
17395 __decorate$B([
17396 RefSelector('eChildCount')
17397 ], GroupCellRenderer.prototype, "eChildCount", void 0);
17398 return GroupCellRenderer;
17399}(Component));
17400
17401/**
17402 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
17403 * @version v27.3.0
17404 * @link https://www.ag-grid.com/
17405 * @license MIT
17406 */
17407var __extends$G = (undefined && undefined.__extends) || (function () {
17408 var extendStatics = function (d, b) {
17409 extendStatics = Object.setPrototypeOf ||
17410 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
17411 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
17412 return extendStatics(d, b);
17413 };
17414 return function (d, b) {
17415 extendStatics(d, b);
17416 function __() { this.constructor = d; }
17417 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17418 };
17419})();
17420var __decorate$C = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
17421 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17422 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17423 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;
17424 return c > 3 && r && Object.defineProperty(target, key, r), r;
17425};
17426var LoadingCellRenderer = /** @class */ (function (_super) {
17427 __extends$G(LoadingCellRenderer, _super);
17428 function LoadingCellRenderer() {
17429 return _super.call(this, LoadingCellRenderer.TEMPLATE) || this;
17430 }
17431 LoadingCellRenderer.prototype.init = function (params) {
17432 params.node.failedLoad ? this.setupFailed() : this.setupLoading();
17433 };
17434 LoadingCellRenderer.prototype.setupFailed = function () {
17435 this.eLoadingText.innerText = 'ERR';
17436 };
17437 LoadingCellRenderer.prototype.setupLoading = function () {
17438 var eLoadingIcon = createIconNoSpan('groupLoading', this.gridOptionsWrapper, null);
17439 if (eLoadingIcon) {
17440 this.eLoadingIcon.appendChild(eLoadingIcon);
17441 }
17442 var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
17443 this.eLoadingText.innerText = localeTextFunc('loadingOoo', 'Loading');
17444 };
17445 LoadingCellRenderer.prototype.refresh = function (params) {
17446 return false;
17447 };
17448 // this is a user component, and IComponent has "public destroy()" as part of the interface.
17449 // so we need to override destroy() just to make the method public.
17450 LoadingCellRenderer.prototype.destroy = function () {
17451 _super.prototype.destroy.call(this);
17452 };
17453 LoadingCellRenderer.TEMPLATE = "<div class=\"ag-loading\">\n <span class=\"ag-loading-icon\" ref=\"eLoadingIcon\"></span>\n <span class=\"ag-loading-text\" ref=\"eLoadingText\"></span>\n </div>";
17454 __decorate$C([
17455 RefSelector('eLoadingIcon')
17456 ], LoadingCellRenderer.prototype, "eLoadingIcon", void 0);
17457 __decorate$C([
17458 RefSelector('eLoadingText')
17459 ], LoadingCellRenderer.prototype, "eLoadingText", void 0);
17460 return LoadingCellRenderer;
17461}(Component));
17462
17463/**
17464 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
17465 * @version v27.3.0
17466 * @link https://www.ag-grid.com/
17467 * @license MIT
17468 */
17469var __extends$H = (undefined && undefined.__extends) || (function () {
17470 var extendStatics = function (d, b) {
17471 extendStatics = Object.setPrototypeOf ||
17472 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
17473 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
17474 return extendStatics(d, b);
17475 };
17476 return function (d, b) {
17477 extendStatics(d, b);
17478 function __() { this.constructor = d; }
17479 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17480 };
17481})();
17482var LoadingOverlayComponent = /** @class */ (function (_super) {
17483 __extends$H(LoadingOverlayComponent, _super);
17484 function LoadingOverlayComponent() {
17485 return _super.call(this) || this;
17486 }
17487 // this is a user component, and IComponent has "public destroy()" as part of the interface.
17488 // so we need to override destroy() just to make the method public.
17489 LoadingOverlayComponent.prototype.destroy = function () {
17490 _super.prototype.destroy.call(this);
17491 };
17492 LoadingOverlayComponent.prototype.init = function (params) {
17493 var template = this.gridOptionsWrapper.getOverlayLoadingTemplate() ?
17494 this.gridOptionsWrapper.getOverlayLoadingTemplate() : LoadingOverlayComponent.DEFAULT_LOADING_OVERLAY_TEMPLATE;
17495 var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
17496 var localisedTemplate = template.replace('[LOADING...]', localeTextFunc('loadingOoo', 'Loading...'));
17497 this.setTemplate(localisedTemplate);
17498 };
17499 LoadingOverlayComponent.DEFAULT_LOADING_OVERLAY_TEMPLATE = '<span class="ag-overlay-loading-center">[LOADING...]</span>';
17500 return LoadingOverlayComponent;
17501}(Component));
17502
17503/**
17504 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
17505 * @version v27.3.0
17506 * @link https://www.ag-grid.com/
17507 * @license MIT
17508 */
17509var __extends$I = (undefined && undefined.__extends) || (function () {
17510 var extendStatics = function (d, b) {
17511 extendStatics = Object.setPrototypeOf ||
17512 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
17513 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
17514 return extendStatics(d, b);
17515 };
17516 return function (d, b) {
17517 extendStatics(d, b);
17518 function __() { this.constructor = d; }
17519 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17520 };
17521})();
17522var NoRowsOverlayComponent = /** @class */ (function (_super) {
17523 __extends$I(NoRowsOverlayComponent, _super);
17524 function NoRowsOverlayComponent() {
17525 return _super.call(this) || this;
17526 }
17527 // this is a user component, and IComponent has "public destroy()" as part of the interface.
17528 // so we need to override destroy() just to make the method public.
17529 NoRowsOverlayComponent.prototype.destroy = function () {
17530 _super.prototype.destroy.call(this);
17531 };
17532 NoRowsOverlayComponent.prototype.init = function (params) {
17533 var template = this.gridOptionsWrapper.getOverlayNoRowsTemplate() ?
17534 this.gridOptionsWrapper.getOverlayNoRowsTemplate() : NoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE;
17535 var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
17536 var localisedTemplate = template.replace('[NO_ROWS_TO_SHOW]', localeTextFunc('noRowsToShow', 'No Rows To Show'));
17537 this.setTemplate(localisedTemplate);
17538 };
17539 NoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE = '<span class="ag-overlay-no-rows-center">[NO_ROWS_TO_SHOW]</span>';
17540 return NoRowsOverlayComponent;
17541}(Component));
17542
17543/**
17544 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
17545 * @version v27.3.0
17546 * @link https://www.ag-grid.com/
17547 * @license MIT
17548 */
17549var __extends$J = (undefined && undefined.__extends) || (function () {
17550 var extendStatics = function (d, b) {
17551 extendStatics = Object.setPrototypeOf ||
17552 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
17553 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
17554 return extendStatics(d, b);
17555 };
17556 return function (d, b) {
17557 extendStatics(d, b);
17558 function __() { this.constructor = d; }
17559 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17560 };
17561})();
17562var TooltipComponent = /** @class */ (function (_super) {
17563 __extends$J(TooltipComponent, _super);
17564 function TooltipComponent() {
17565 return _super.call(this, /* html */ "<div class=\"ag-tooltip\"></div>") || this;
17566 }
17567 // will need to type params
17568 TooltipComponent.prototype.init = function (params) {
17569 var value = params.value;
17570 this.getGui().innerHTML = escapeString(value);
17571 };
17572 return TooltipComponent;
17573}(PopupComponent));
17574
17575/**
17576 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
17577 * @version v27.3.0
17578 * @link https://www.ag-grid.com/
17579 * @license MIT
17580 */
17581var __extends$K = (undefined && undefined.__extends) || (function () {
17582 var extendStatics = function (d, b) {
17583 extendStatics = Object.setPrototypeOf ||
17584 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
17585 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
17586 return extendStatics(d, b);
17587 };
17588 return function (d, b) {
17589 extendStatics(d, b);
17590 function __() { this.constructor = d; }
17591 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17592 };
17593})();
17594var __decorate$D = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
17595 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17596 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17597 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;
17598 return c > 3 && r && Object.defineProperty(target, key, r), r;
17599};
17600var UserComponentRegistry = /** @class */ (function (_super) {
17601 __extends$K(UserComponentRegistry, _super);
17602 function UserComponentRegistry() {
17603 var _this = _super !== null && _super.apply(this, arguments) || this;
17604 _this.agGridDefaults = {
17605 //date
17606 agDateInput: DefaultDateComponent,
17607 //header
17608 agColumnHeader: HeaderComp,
17609 agColumnGroupHeader: HeaderGroupComp,
17610 //floating filters
17611 agTextColumnFloatingFilter: TextFloatingFilter,
17612 agNumberColumnFloatingFilter: NumberFloatingFilter,
17613 agDateColumnFloatingFilter: DateFloatingFilter,
17614 agReadOnlyFloatingFilter: ReadOnlyFloatingFilter,
17615 // renderers
17616 agAnimateShowChangeCellRenderer: AnimateShowChangeCellRenderer,
17617 agAnimateSlideCellRenderer: AnimateSlideCellRenderer,
17618 agGroupCellRenderer: GroupCellRenderer,
17619 agGroupRowRenderer: GroupCellRenderer,
17620 agLoadingCellRenderer: LoadingCellRenderer,
17621 //editors
17622 agCellEditor: TextCellEditor,
17623 agTextCellEditor: TextCellEditor,
17624 agSelectCellEditor: SelectCellEditor,
17625 agPopupTextCellEditor: PopupTextCellEditor,
17626 agPopupSelectCellEditor: PopupSelectCellEditor,
17627 agLargeTextCellEditor: LargeTextCellEditor,
17628 //filter
17629 agTextColumnFilter: TextFilter,
17630 agNumberColumnFilter: NumberFilter,
17631 agDateColumnFilter: DateFilter,
17632 //overlays
17633 agLoadingOverlay: LoadingOverlayComponent,
17634 agNoRowsOverlay: NoRowsOverlayComponent,
17635 // tooltips
17636 agTooltipComponent: TooltipComponent
17637 };
17638 _this.agDeprecatedNames = {
17639 set: {
17640 newComponentName: 'agSetColumnFilter',
17641 propertyHolder: 'filter'
17642 },
17643 text: {
17644 newComponentName: 'agTextColumnFilter',
17645 propertyHolder: 'filter'
17646 },
17647 number: {
17648 newComponentName: 'agNumberColumnFilter',
17649 propertyHolder: 'filter'
17650 },
17651 date: {
17652 newComponentName: 'agDateColumnFilter',
17653 propertyHolder: 'filter'
17654 },
17655 group: {
17656 newComponentName: 'agGroupCellRenderer',
17657 propertyHolder: 'cellRenderer'
17658 },
17659 animateShowChange: {
17660 newComponentName: 'agAnimateShowChangeCellRenderer',
17661 propertyHolder: 'cellRenderer'
17662 },
17663 animateSlide: {
17664 newComponentName: 'agAnimateSlideCellRenderer',
17665 propertyHolder: 'cellRenderer'
17666 },
17667 select: {
17668 newComponentName: 'agSelectCellEditor',
17669 propertyHolder: 'cellEditor'
17670 },
17671 largeText: {
17672 newComponentName: 'agLargeTextCellEditor',
17673 propertyHolder: 'cellEditor'
17674 },
17675 popupSelect: {
17676 newComponentName: 'agPopupSelectCellEditor',
17677 propertyHolder: 'cellEditor'
17678 },
17679 popupText: {
17680 newComponentName: 'agPopupTextCellEditor',
17681 propertyHolder: 'cellEditor'
17682 },
17683 richSelect: {
17684 newComponentName: 'agRichSelectCellEditor',
17685 propertyHolder: 'cellEditor'
17686 },
17687 headerComponent: {
17688 newComponentName: 'agColumnHeader',
17689 propertyHolder: 'headerComponent'
17690 }
17691 };
17692 _this.jsComps = {};
17693 _this.fwComps = {};
17694 return _this;
17695 }
17696 UserComponentRegistry.prototype.init = function () {
17697 var _this = this;
17698 if (this.gridOptions.components != null) {
17699 iterateObject(this.gridOptions.components, function (key, component) { return _this.registerJsComponent(key, component); });
17700 }
17701 if (this.gridOptions.frameworkComponents != null) {
17702 iterateObject(this.gridOptions.frameworkComponents, function (key, component) { return _this.registerFwComponent(key, component); });
17703 }
17704 };
17705 UserComponentRegistry.prototype.registerDefaultComponent = function (rawName, component) {
17706 var name = this.translateIfDeprecated(rawName);
17707 if (this.agGridDefaults[name]) {
17708 console.error("Trying to overwrite a default component. You should call registerComponent");
17709 return;
17710 }
17711 this.agGridDefaults[name] = component;
17712 };
17713 UserComponentRegistry.prototype.registerJsComponent = function (rawName, component) {
17714 var name = this.translateIfDeprecated(rawName);
17715 if (this.fwComps[name]) {
17716 console.error("Trying to register a component that you have already registered for frameworks: " + name);
17717 return;
17718 }
17719 this.jsComps[name] = component;
17720 };
17721 /**
17722 * B the business interface (ie IHeader)
17723 * A the agGridComponent interface (ie IHeaderComp). The final object acceptable by ag-grid
17724 */
17725 UserComponentRegistry.prototype.registerFwComponent = function (rawName, component) {
17726 var warningMessage = "AG Grid: As of v27, registering components via grid property frameworkComponents is deprecated. Instead register both JavaScript AND Framework Components via the components property.";
17727 doOnce(function () { return console.warn(warningMessage); }, "UserComponentRegistry.frameworkComponentsDeprecated");
17728 var name = this.translateIfDeprecated(rawName);
17729 this.fwComps[name] = component;
17730 };
17731 UserComponentRegistry.prototype.retrieve = function (rawName) {
17732 var name = this.translateIfDeprecated(rawName);
17733 var createResult = function (component, componentFromFramework) { return ({ componentFromFramework: componentFromFramework, component: component }); };
17734 // FrameworkOverrides.frameworkComponent() is used in two locations:
17735 // 1) for Vue, user provided components get registered via a framework specific way.
17736 // 2) for React, it's how the React UI provides alternative default components (eg GroupCellRenderer and DetailCellRenderer)
17737 var registeredViaFrameworkComp = this.getFrameworkOverrides().frameworkComponent(name);
17738 if (registeredViaFrameworkComp != null) {
17739 return createResult(registeredViaFrameworkComp, true);
17740 }
17741 var frameworkComponent = this.fwComps[name];
17742 if (frameworkComponent) {
17743 return createResult(frameworkComponent, true);
17744 }
17745 var jsComponent = this.jsComps[name];
17746 if (jsComponent) {
17747 var isFwkComp = this.getFrameworkOverrides().isFrameworkComponent(jsComponent);
17748 return createResult(jsComponent, isFwkComp);
17749 }
17750 var defaultComponent = this.agGridDefaults[name];
17751 if (defaultComponent) {
17752 return createResult(defaultComponent, false);
17753 }
17754 if (Object.keys(this.agGridDefaults).indexOf(name) < 0) {
17755 console.warn("AG Grid: Looking for component [" + name + "] but it wasn't found.");
17756 }
17757 return null;
17758 };
17759 UserComponentRegistry.prototype.translateIfDeprecated = function (raw) {
17760 var deprecatedInfo = this.agDeprecatedNames[raw];
17761 if (deprecatedInfo != null) {
17762 doOnce(function () {
17763 console.warn("ag-grid. Since v15.0 component names have been renamed to be namespaced. You should rename " + deprecatedInfo.propertyHolder + ":" + raw + " to " + deprecatedInfo.propertyHolder + ":" + deprecatedInfo.newComponentName);
17764 }, 'DEPRECATE_COMPONENT_' + raw);
17765 return deprecatedInfo.newComponentName;
17766 }
17767 return raw;
17768 };
17769 __decorate$D([
17770 Autowired('gridOptions')
17771 ], UserComponentRegistry.prototype, "gridOptions", void 0);
17772 __decorate$D([
17773 Autowired('agComponentUtils')
17774 ], UserComponentRegistry.prototype, "agComponentUtils", void 0);
17775 __decorate$D([
17776 PostConstruct
17777 ], UserComponentRegistry.prototype, "init", null);
17778 UserComponentRegistry = __decorate$D([
17779 Bean('userComponentRegistry')
17780 ], UserComponentRegistry);
17781 return UserComponentRegistry;
17782}(BeanStub));
17783
17784/**
17785 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
17786 * @version v27.3.0
17787 * @link https://www.ag-grid.com/
17788 * @license MIT
17789 */
17790var DateComponent = {
17791 propertyName: 'dateComponent',
17792 cellRenderer: false
17793};
17794var HeaderComponent = {
17795 propertyName: 'headerComponent',
17796 cellRenderer: false
17797};
17798var HeaderGroupComponent = {
17799 propertyName: 'headerGroupComponent',
17800 cellRenderer: false
17801};
17802var CellRendererComponent = {
17803 propertyName: 'cellRenderer',
17804 cellRenderer: true
17805};
17806var CellEditorComponent = {
17807 propertyName: 'cellEditor',
17808 cellRenderer: false
17809};
17810var InnerRendererComponent = {
17811 propertyName: 'innerRenderer',
17812 cellRenderer: true
17813};
17814var LoadingOverlayComponent$1 = {
17815 propertyName: 'loadingOverlayComponent',
17816 cellRenderer: false
17817};
17818var NoRowsOverlayComponent$1 = {
17819 propertyName: 'noRowsOverlayComponent',
17820 cellRenderer: false
17821};
17822var TooltipComponent$1 = {
17823 propertyName: 'tooltipComponent',
17824 cellRenderer: false
17825};
17826var FilterComponent = {
17827 propertyName: 'filter',
17828 cellRenderer: false
17829};
17830var FloatingFilterComponent = {
17831 propertyName: 'floatingFilterComponent',
17832 cellRenderer: false
17833};
17834var ToolPanelComponent = {
17835 propertyName: 'toolPanel',
17836 cellRenderer: false
17837};
17838var StatusPanelComponent = {
17839 propertyName: 'statusPanel',
17840 cellRenderer: false
17841};
17842var FullWidth = {
17843 propertyName: 'fullWidthCellRenderer',
17844 cellRenderer: true
17845};
17846var FullWidthLoading = {
17847 propertyName: 'loadingCellRenderer',
17848 cellRenderer: true
17849};
17850var FullWidthGroup = {
17851 propertyName: 'groupRowRenderer',
17852 cellRenderer: true
17853};
17854var FullWidthDetail = {
17855 propertyName: 'detailCellRenderer',
17856 cellRenderer: true
17857};
17858
17859/**
17860 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
17861 * @version v27.3.0
17862 * @link https://www.ag-grid.com/
17863 * @license MIT
17864 */
17865var FloatingFilterMapper = /** @class */ (function () {
17866 function FloatingFilterMapper() {
17867 }
17868 FloatingFilterMapper.getFloatingFilterType = function (filterType) {
17869 return this.filterToFloatingFilterMapping[filterType];
17870 };
17871 FloatingFilterMapper.filterToFloatingFilterMapping = {
17872 set: 'agSetColumnFloatingFilter',
17873 agSetColumnFilter: 'agSetColumnFloatingFilter',
17874 multi: 'agMultiColumnFloatingFilter',
17875 agMultiColumnFilter: 'agMultiColumnFloatingFilter',
17876 number: 'agNumberColumnFloatingFilter',
17877 agNumberColumnFilter: 'agNumberColumnFloatingFilter',
17878 date: 'agDateColumnFloatingFilter',
17879 agDateColumnFilter: 'agDateColumnFloatingFilter',
17880 text: 'agTextColumnFloatingFilter',
17881 agTextColumnFilter: 'agTextColumnFloatingFilter'
17882 };
17883 return FloatingFilterMapper;
17884}());
17885
17886/**
17887 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
17888 * @version v27.3.0
17889 * @link https://www.ag-grid.com/
17890 * @license MIT
17891 */
17892var __extends$L = (undefined && undefined.__extends) || (function () {
17893 var extendStatics = function (d, b) {
17894 extendStatics = Object.setPrototypeOf ||
17895 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
17896 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
17897 return extendStatics(d, b);
17898 };
17899 return function (d, b) {
17900 extendStatics(d, b);
17901 function __() { this.constructor = d; }
17902 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17903 };
17904})();
17905var __decorate$E = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
17906 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17907 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17908 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;
17909 return c > 3 && r && Object.defineProperty(target, key, r), r;
17910};
17911var UserComponentFactory = /** @class */ (function (_super) {
17912 __extends$L(UserComponentFactory, _super);
17913 function UserComponentFactory() {
17914 return _super !== null && _super.apply(this, arguments) || this;
17915 }
17916 UserComponentFactory.prototype.getHeaderCompDetails = function (colDef, params) {
17917 return this.getCompDetails(colDef, HeaderComponent, 'agColumnHeader', params);
17918 };
17919 UserComponentFactory.prototype.getHeaderGroupCompDetails = function (params) {
17920 var colGroupDef = params.columnGroup.getColGroupDef();
17921 return this.getCompDetails(colGroupDef, HeaderGroupComponent, 'agColumnGroupHeader', params);
17922 };
17923 // this one is unusual, as it can be LoadingCellRenderer, DetailCellRenderer, FullWidthCellRenderer or GroupRowRenderer.
17924 // so we have to pass the type in.
17925 UserComponentFactory.prototype.getFullWidthCellRendererDetails = function (params) {
17926 return this.getCompDetails(this.gridOptions, FullWidth, null, params, true);
17927 };
17928 UserComponentFactory.prototype.getFullWidthLoadingCellRendererDetails = function (params) {
17929 return this.getCompDetails(this.gridOptions, FullWidthLoading, 'agLoadingCellRenderer', params, true);
17930 };
17931 UserComponentFactory.prototype.getFullWidthGroupCellRendererDetails = function (params) {
17932 return this.getCompDetails(this.gridOptions, FullWidthGroup, 'agGroupRowRenderer', params, true);
17933 };
17934 UserComponentFactory.prototype.getFullWidthDetailCellRendererDetails = function (params) {
17935 return this.getCompDetails(this.gridOptions, FullWidthDetail, 'agDetailCellRenderer', params, true);
17936 };
17937 // CELL RENDERER
17938 UserComponentFactory.prototype.getInnerRendererDetails = function (def, params) {
17939 return this.getCompDetails(def, InnerRendererComponent, null, params);
17940 };
17941 UserComponentFactory.prototype.getFullWidthGroupRowInnerCellRenderer = function (def, params) {
17942 return this.getCompDetails(def, InnerRendererComponent, null, params);
17943 };
17944 UserComponentFactory.prototype.getCellRendererDetails = function (def, params) {
17945 return this.getCompDetails(def, CellRendererComponent, null, params);
17946 };
17947 // CELL EDITOR
17948 UserComponentFactory.prototype.getCellEditorDetails = function (def, params) {
17949 return this.getCompDetails(def, CellEditorComponent, 'agCellEditor', params, true);
17950 };
17951 // FILTER
17952 UserComponentFactory.prototype.getFilterDetails = function (def, params, defaultFilter) {
17953 return this.getCompDetails(def, FilterComponent, defaultFilter, params, true);
17954 };
17955 UserComponentFactory.prototype.getDateCompDetails = function (params) {
17956 return this.getCompDetails(this.gridOptions, DateComponent, 'agDateInput', params, true);
17957 };
17958 UserComponentFactory.prototype.getLoadingOverlayCompDetails = function (params) {
17959 return this.getCompDetails(this.gridOptions, LoadingOverlayComponent$1, 'agLoadingOverlay', params, true);
17960 };
17961 UserComponentFactory.prototype.getNoRowsOverlayCompDetails = function (params) {
17962 return this.getCompDetails(this.gridOptions, NoRowsOverlayComponent$1, 'agNoRowsOverlay', params, true);
17963 };
17964 UserComponentFactory.prototype.getTooltipCompDetails = function (params) {
17965 return this.getCompDetails(params.colDef, TooltipComponent$1, 'agTooltipComponent', params, true);
17966 };
17967 UserComponentFactory.prototype.getSetFilterCellRendererDetails = function (def, params) {
17968 return this.getCompDetails(def, CellRendererComponent, null, params);
17969 };
17970 UserComponentFactory.prototype.getFloatingFilterCompDetails = function (def, params, defaultFloatingFilter) {
17971 return this.getCompDetails(def, FloatingFilterComponent, defaultFloatingFilter, params);
17972 };
17973 UserComponentFactory.prototype.getToolPanelCompDetails = function (toolPanelDef, params) {
17974 return this.getCompDetails(toolPanelDef, ToolPanelComponent, null, params, true);
17975 };
17976 UserComponentFactory.prototype.getStatusPanelCompDetails = function (def, params) {
17977 return this.getCompDetails(def, StatusPanelComponent, null, params, true);
17978 };
17979 UserComponentFactory.prototype.getCompDetails = function (defObject, type, defaultName, params, mandatory) {
17980 var _this = this;
17981 if (mandatory === void 0) { mandatory = false; }
17982 var propertyName = type.propertyName, cellRenderer = type.cellRenderer;
17983 var _a = this.getCompKeys(defObject, type, params), compName = _a.compName, jsComp = _a.jsComp, fwComp = _a.fwComp, paramsFromSelector = _a.paramsFromSelector, popupFromSelector = _a.popupFromSelector, popupPositionFromSelector = _a.popupPositionFromSelector;
17984 var lookupFromRegistry = function (key) {
17985 var item = _this.userComponentRegistry.retrieve(key);
17986 if (item) {
17987 jsComp = !item.componentFromFramework ? item.component : undefined;
17988 fwComp = item.componentFromFramework ? item.component : undefined;
17989 }
17990 };
17991 // if compOption is a string, means we need to look the item up
17992 if (compName != null) {
17993 lookupFromRegistry(compName);
17994 }
17995 // if lookup brought nothing back, and we have a default, lookup the default
17996 if (jsComp == null && fwComp == null && defaultName != null) {
17997 lookupFromRegistry(defaultName);
17998 }
17999 // if we have a comp option, and it's a function, replace it with an object equivalent adaptor
18000 if (jsComp && cellRenderer && !this.agComponentUtils.doesImplementIComponent(jsComp)) {
18001 jsComp = this.agComponentUtils.adaptFunction(propertyName, jsComp);
18002 }
18003 if (!jsComp && !fwComp) {
18004 if (mandatory) {
18005 console.error("Could not find component " + compName + ", did you forget to configure this component?");
18006 }
18007 return;
18008 }
18009 var paramsMerged = this.mergeParamsWithApplicationProvidedParams(defObject, type, params, paramsFromSelector);
18010 var componentFromFramework = jsComp == null;
18011 var componentClass = jsComp ? jsComp : fwComp;
18012 return {
18013 componentFromFramework: componentFromFramework,
18014 componentClass: componentClass,
18015 params: paramsMerged,
18016 type: type,
18017 popupFromSelector: popupFromSelector,
18018 popupPositionFromSelector: popupPositionFromSelector,
18019 newAgStackInstance: function () { return _this.newAgStackInstance(componentClass, componentFromFramework, paramsMerged, type); }
18020 };
18021 };
18022 UserComponentFactory.prototype.getCompKeys = function (defObject, type, params) {
18023 var _this = this;
18024 var propertyName = type.propertyName;
18025 var compName;
18026 var jsComp;
18027 var fwComp;
18028 var paramsFromSelector;
18029 var popupFromSelector;
18030 var popupPositionFromSelector;
18031 // there are two types of js comps, class based and func based. we can only check for
18032 // class based, by checking if getGui() exists. no way to differentiate js func based vs eg react func based
18033 // const isJsClassComp = (comp: any) => this.agComponentUtils.doesImplementIComponent(comp);
18034 // const fwActive = this.frameworkComponentWrapper != null;
18035 // pull from defObject if available
18036 if (defObject) {
18037 var defObjectAny = defObject;
18038 // if selector, use this
18039 var selectorFunc = defObjectAny[propertyName + 'Selector'];
18040 var selectorRes = selectorFunc ? selectorFunc(params) : null;
18041 var assignComp = function (providedJsComp, providedFwComp) {
18042 var xxxFrameworkDeprecatedWarn = function () {
18043 var warningMessage = "AG Grid: As of v27, the property " + propertyName + "Framework is deprecated. The property " + propertyName + " can now be used for JavaScript AND Framework Components.";
18044 doOnce(function () { return console.warn(warningMessage); }, "UserComponentFactory." + propertyName + "FrameworkDeprecated");
18045 };
18046 if (typeof providedJsComp === 'string') {
18047 compName = providedJsComp;
18048 }
18049 else if (typeof providedFwComp === 'string') {
18050 xxxFrameworkDeprecatedWarn();
18051 compName = providedFwComp;
18052 // comp===true for filters, which means use the default comp
18053 }
18054 else if (providedJsComp != null && providedJsComp !== true) {
18055 var isFwkComp = _this.getFrameworkOverrides().isFrameworkComponent(providedJsComp);
18056 if (isFwkComp) {
18057 fwComp = providedJsComp;
18058 }
18059 else {
18060 jsComp = providedJsComp;
18061 }
18062 }
18063 else if (providedFwComp != null) {
18064 xxxFrameworkDeprecatedWarn();
18065 fwComp = providedFwComp;
18066 }
18067 };
18068 if (selectorRes) {
18069 if (selectorRes.frameworkComponent != null) {
18070 var warningMessage_1 = "AG Grid: As of v27, the return for " + propertyName + "Selector has attributes [component, params] only. The attribute frameworkComponent is deprecated. You should now return back Framework Components using the 'component' attribute and the grid works out if it's a framework component or not.";
18071 doOnce(function () { return console.warn(warningMessage_1); }, "UserComponentFactory." + propertyName + "FrameworkSelectorDeprecated");
18072 assignComp(selectorRes.frameworkComponent, undefined);
18073 }
18074 else {
18075 assignComp(selectorRes.component, undefined);
18076 }
18077 paramsFromSelector = selectorRes.params;
18078 popupFromSelector = selectorRes.popup;
18079 popupPositionFromSelector = selectorRes.popupPosition;
18080 }
18081 else {
18082 // if no selector, or result of selector is empty, take from defObject
18083 assignComp(defObjectAny[propertyName], defObjectAny[propertyName + 'Framework']);
18084 }
18085 }
18086 return { compName: compName, jsComp: jsComp, fwComp: fwComp, paramsFromSelector: paramsFromSelector, popupFromSelector: popupFromSelector, popupPositionFromSelector: popupPositionFromSelector };
18087 };
18088 UserComponentFactory.prototype.newAgStackInstance = function (ComponentClass, componentFromFramework, params, type) {
18089 var propertyName = type.propertyName;
18090 var jsComponent = !componentFromFramework;
18091 // using javascript component
18092 var instance;
18093 if (jsComponent) {
18094 instance = new ComponentClass();
18095 }
18096 else {
18097 // Using framework component
18098 var thisComponentConfig = this.componentMetadataProvider.retrieve(propertyName);
18099 instance = this.frameworkComponentWrapper.wrap(ComponentClass, thisComponentConfig.mandatoryMethodList, thisComponentConfig.optionalMethodList, type);
18100 }
18101 var deferredInit = this.initComponent(instance, params);
18102 if (deferredInit == null) {
18103 return AgPromise.resolve(instance);
18104 }
18105 return deferredInit.then(function () { return instance; });
18106 };
18107 // used by Floating Filter
18108 UserComponentFactory.prototype.mergeParamsWithApplicationProvidedParams = function (defObject, type, paramsFromGrid, paramsFromSelector) {
18109 if (paramsFromSelector === void 0) { paramsFromSelector = null; }
18110 var params = {
18111 context: this.gridOptionsWrapper.getContext(),
18112 columnApi: this.gridOptionsWrapper.getColumnApi(),
18113 api: this.gridOptionsWrapper.getApi()
18114 };
18115 mergeDeep(params, paramsFromGrid);
18116 // pull user params from either the old prop name and new prop name
18117 // eg either cellRendererParams and cellCompParams
18118 var defObjectAny = defObject;
18119 var userParams = defObjectAny && defObjectAny[type.propertyName + 'Params'];
18120 if (typeof userParams === 'function') {
18121 var userParamsFromFunc = userParams(paramsFromGrid);
18122 mergeDeep(params, userParamsFromFunc);
18123 }
18124 else if (typeof userParams === 'object') {
18125 mergeDeep(params, userParams);
18126 }
18127 mergeDeep(params, paramsFromSelector);
18128 return params;
18129 };
18130 UserComponentFactory.prototype.initComponent = function (component, params) {
18131 this.context.createBean(component);
18132 if (component.init == null) {
18133 return;
18134 }
18135 return component.init(params);
18136 };
18137 UserComponentFactory.prototype.getDefaultFloatingFilterType = function (def) {
18138 if (def == null) {
18139 return null;
18140 }
18141 var defaultFloatingFilterType = null;
18142 var _a = this.getCompKeys(def, FilterComponent), compName = _a.compName, jsComp = _a.jsComp, fwComp = _a.fwComp;
18143 if (compName) {
18144 // will be undefined if not in the map
18145 defaultFloatingFilterType = FloatingFilterMapper.getFloatingFilterType(compName);
18146 }
18147 else {
18148 var usingDefaultFilter = (jsComp == null && fwComp == null) && (def.filter === true);
18149 if (usingDefaultFilter) {
18150 var setFilterModuleLoaded = ModuleRegistry.isRegistered(exports.ModuleNames.SetFilterModule);
18151 defaultFloatingFilterType = setFilterModuleLoaded ? 'agSetColumnFloatingFilter' : 'agTextColumnFloatingFilter';
18152 }
18153 }
18154 return defaultFloatingFilterType;
18155 };
18156 __decorate$E([
18157 Autowired('gridOptions')
18158 ], UserComponentFactory.prototype, "gridOptions", void 0);
18159 __decorate$E([
18160 Autowired('agComponentUtils')
18161 ], UserComponentFactory.prototype, "agComponentUtils", void 0);
18162 __decorate$E([
18163 Autowired('componentMetadataProvider')
18164 ], UserComponentFactory.prototype, "componentMetadataProvider", void 0);
18165 __decorate$E([
18166 Autowired('userComponentRegistry')
18167 ], UserComponentFactory.prototype, "userComponentRegistry", void 0);
18168 __decorate$E([
18169 Optional('frameworkComponentWrapper')
18170 ], UserComponentFactory.prototype, "frameworkComponentWrapper", void 0);
18171 UserComponentFactory = __decorate$E([
18172 Bean('userComponentFactory')
18173 ], UserComponentFactory);
18174 return UserComponentFactory;
18175}(BeanStub));
18176
18177/**
18178 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
18179 * @version v27.3.0
18180 * @link https://www.ag-grid.com/
18181 * @license MIT
18182 */
18183(function (ExcelFactoryMode) {
18184 ExcelFactoryMode[ExcelFactoryMode["SINGLE_SHEET"] = 0] = "SINGLE_SHEET";
18185 ExcelFactoryMode[ExcelFactoryMode["MULTI_SHEET"] = 1] = "MULTI_SHEET";
18186})(exports.ExcelFactoryMode || (exports.ExcelFactoryMode = {}));
18187
18188/**
18189 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
18190 * @version v27.3.0
18191 * @link https://www.ag-grid.com/
18192 * @license MIT
18193 */
18194var __extends$M = (undefined && undefined.__extends) || (function () {
18195 var extendStatics = function (d, b) {
18196 extendStatics = Object.setPrototypeOf ||
18197 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
18198 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
18199 return extendStatics(d, b);
18200 };
18201 return function (d, b) {
18202 extendStatics(d, b);
18203 function __() { this.constructor = d; }
18204 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18205 };
18206})();
18207var __decorate$F = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
18208 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18209 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
18210 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;
18211 return c > 3 && r && Object.defineProperty(target, key, r), r;
18212};
18213/** Adds drag listening onto an element. In AG Grid this is used twice, first is resizing columns,
18214 * second is moving the columns and column groups around (ie the 'drag' part of Drag and Drop. */
18215var DragService = /** @class */ (function (_super) {
18216 __extends$M(DragService, _super);
18217 function DragService() {
18218 var _this = _super !== null && _super.apply(this, arguments) || this;
18219 _this.dragEndFunctions = [];
18220 _this.dragSources = [];
18221 return _this;
18222 }
18223 DragService.prototype.init = function () {
18224 this.logger = this.loggerFactory.create('DragService');
18225 };
18226 DragService.prototype.removeAllListeners = function () {
18227 this.dragSources.forEach(this.removeListener.bind(this));
18228 this.dragSources.length = 0;
18229 };
18230 DragService.prototype.removeListener = function (dragSourceAndListener) {
18231 var element = dragSourceAndListener.dragSource.eElement;
18232 var mouseDownListener = dragSourceAndListener.mouseDownListener;
18233 element.removeEventListener('mousedown', mouseDownListener);
18234 // remove touch listener only if it exists
18235 if (dragSourceAndListener.touchEnabled) {
18236 var touchStartListener = dragSourceAndListener.touchStartListener;
18237 element.removeEventListener('touchstart', touchStartListener, { passive: true });
18238 }
18239 };
18240 DragService.prototype.removeDragSource = function (params) {
18241 var dragSourceAndListener = this.dragSources.find(function (item) { return item.dragSource === params; });
18242 if (!dragSourceAndListener) {
18243 return;
18244 }
18245 this.removeListener(dragSourceAndListener);
18246 removeFromArray(this.dragSources, dragSourceAndListener);
18247 };
18248 DragService.prototype.isDragging = function () {
18249 return this.dragging;
18250 };
18251 DragService.prototype.addDragSource = function (params, includeTouch) {
18252 var _this = this;
18253 if (includeTouch === void 0) { includeTouch = false; }
18254 var mouseListener = this.onMouseDown.bind(this, params);
18255 params.eElement.addEventListener('mousedown', mouseListener);
18256 var touchListener = null;
18257 var suppressTouch = this.gridOptionsWrapper.isSuppressTouch();
18258 if (includeTouch && !suppressTouch) {
18259 touchListener = function (touchEvent) {
18260 if (touchEvent.cancelable) {
18261 touchEvent.preventDefault();
18262 }
18263 _this.onTouchStart(params, touchEvent);
18264 };
18265 params.eElement.addEventListener('touchstart', touchListener, { passive: true });
18266 }
18267 this.dragSources.push({
18268 dragSource: params,
18269 mouseDownListener: mouseListener,
18270 touchStartListener: touchListener,
18271 touchEnabled: includeTouch
18272 });
18273 };
18274 // gets called whenever mouse down on any drag source
18275 DragService.prototype.onTouchStart = function (params, touchEvent) {
18276 var _this = this;
18277 this.currentDragParams = params;
18278 this.dragging = false;
18279 var touch = touchEvent.touches[0];
18280 this.touchLastTime = touch;
18281 this.touchStart = touch;
18282 var touchMoveEvent = function (e) { return _this.onTouchMove(e, params.eElement); };
18283 var touchEndEvent = function (e) { return _this.onTouchUp(e, params.eElement); };
18284 var documentTouchMove = function (e) { if (e.cancelable) {
18285 e.preventDefault();
18286 } };
18287 var target = params.eElement;
18288 var events = [
18289 // Prevents the page document from moving while we are dragging items around.
18290 // preventDefault needs to be called in the touchmove listener and never inside the
18291 // touchstart, because using touchstart causes the click event to be cancelled on touch devices.
18292 { target: document, type: 'touchmove', listener: documentTouchMove, options: { passive: false } },
18293 { target: target, type: 'touchmove', listener: touchMoveEvent, options: { passive: true } },
18294 { target: target, type: 'touchend', listener: touchEndEvent, options: { passive: true } },
18295 { target: target, type: 'touchcancel', listener: touchEndEvent, options: { passive: true } }
18296 ];
18297 // temporally add these listeners, for the duration of the drag
18298 this.addTemporaryEvents(events);
18299 // see if we want to start dragging straight away
18300 if (params.dragStartPixels === 0) {
18301 this.onCommonMove(touch, this.touchStart, params.eElement);
18302 }
18303 };
18304 // gets called whenever mouse down on any drag source
18305 DragService.prototype.onMouseDown = function (params, mouseEvent) {
18306 var _this = this;
18307 var e = mouseEvent;
18308 if (params.skipMouseEvent && params.skipMouseEvent(mouseEvent)) {
18309 return;
18310 }
18311 // if there are two elements with parent / child relationship, and both are draggable,
18312 // when we drag the child, we should NOT drag the parent. an example of this is row moving
18313 // and range selection - row moving should get preference when use drags the rowDrag component.
18314 if (e._alreadyProcessedByDragService) {
18315 return;
18316 }
18317 e._alreadyProcessedByDragService = true;
18318 // only interested in left button clicks
18319 if (mouseEvent.button !== 0) {
18320 return;
18321 }
18322 this.currentDragParams = params;
18323 this.dragging = false;
18324 this.mouseStartEvent = mouseEvent;
18325 var eDocument = this.gridOptionsWrapper.getDocument();
18326 var mouseMoveEvent = function (event) { return _this.onMouseMove(event, params.eElement); };
18327 var mouseUpEvent = function (event) { return _this.onMouseUp(event, params.eElement); };
18328 var contextEvent = function (event) { return event.preventDefault(); };
18329 var target = eDocument;
18330 var events = [
18331 { target: target, type: 'mousemove', listener: mouseMoveEvent },
18332 { target: target, type: 'mouseup', listener: mouseUpEvent },
18333 { target: target, type: 'contextmenu', listener: contextEvent }
18334 ];
18335 // temporally add these listeners, for the duration of the drag
18336 this.addTemporaryEvents(events);
18337 //see if we want to start dragging straight away
18338 if (params.dragStartPixels === 0) {
18339 this.onMouseMove(mouseEvent, params.eElement);
18340 }
18341 };
18342 DragService.prototype.addTemporaryEvents = function (events) {
18343 events.forEach(function (currentEvent) {
18344 var target = currentEvent.target, type = currentEvent.type, listener = currentEvent.listener, options = currentEvent.options;
18345 target.addEventListener(type, listener, options);
18346 });
18347 this.dragEndFunctions.push(function () {
18348 events.forEach(function (currentEvent) {
18349 var target = currentEvent.target, type = currentEvent.type, listener = currentEvent.listener, options = currentEvent.options;
18350 target.removeEventListener(type, listener, options);
18351 });
18352 });
18353 };
18354 // returns true if the event is close to the original event by X pixels either vertically or horizontally.
18355 // we only start dragging after X pixels so this allows us to know if we should start dragging yet.
18356 DragService.prototype.isEventNearStartEvent = function (currentEvent, startEvent) {
18357 // by default, we wait 4 pixels before starting the drag
18358 var dragStartPixels = this.currentDragParams.dragStartPixels;
18359 var requiredPixelDiff = exists(dragStartPixels) ? dragStartPixels : 4;
18360 return areEventsNear(currentEvent, startEvent, requiredPixelDiff);
18361 };
18362 DragService.prototype.getFirstActiveTouch = function (touchList) {
18363 for (var i = 0; i < touchList.length; i++) {
18364 if (touchList[i].identifier === this.touchStart.identifier) {
18365 return touchList[i];
18366 }
18367 }
18368 return null;
18369 };
18370 DragService.prototype.onCommonMove = function (currentEvent, startEvent, el) {
18371 if (!this.dragging) {
18372 // if mouse hasn't travelled from the start position enough, do nothing
18373 if (!this.dragging && this.isEventNearStartEvent(currentEvent, startEvent)) {
18374 return;
18375 }
18376 this.dragging = true;
18377 var event_1 = {
18378 type: Events.EVENT_DRAG_STARTED,
18379 api: this.gridApi,
18380 columnApi: this.columnApi,
18381 target: el
18382 };
18383 this.eventService.dispatchEvent(event_1);
18384 this.currentDragParams.onDragStart(startEvent);
18385 // we need ONE drag action at the startEvent, so that we are guaranteed the drop target
18386 // at the start gets notified. this is because the drag can start outside of the element
18387 // that started it, as the mouse is allowed drag away from the mouse down before it's
18388 // considered a drag (the isEventNearStartEvent() above). if we didn't do this, then
18389 // it would be possible to click a column by the edge, then drag outside of the drop zone
18390 // in less than 4 pixels and the drag officially starts outside of the header but the header
18391 // wouldn't be notified of the dragging.
18392 this.currentDragParams.onDragging(startEvent);
18393 }
18394 this.currentDragParams.onDragging(currentEvent);
18395 };
18396 DragService.prototype.onTouchMove = function (touchEvent, el) {
18397 var touch = this.getFirstActiveTouch(touchEvent.touches);
18398 if (!touch) {
18399 return;
18400 }
18401 // this.___statusPanel.setInfoText(Math.random() + ' onTouchMove preventDefault stopPropagation');
18402 this.onCommonMove(touch, this.touchStart, el);
18403 };
18404 // only gets called after a mouse down - as this is only added after mouseDown
18405 // and is removed when mouseUp happens
18406 DragService.prototype.onMouseMove = function (mouseEvent, el) {
18407 // The event type can be `mousedown` when `dragStartPixels=0`
18408 // we should only preventDefault on `mousemove`.
18409 if (isBrowserSafari() &&
18410 mouseEvent.type === 'mousemove' &&
18411 mouseEvent.cancelable &&
18412 this.mouseEventService.isEventFromThisGrid(mouseEvent) &&
18413 !this.isOverFormFieldElement(mouseEvent)) {
18414 mouseEvent.preventDefault();
18415 }
18416 this.onCommonMove(mouseEvent, this.mouseStartEvent, el);
18417 };
18418 DragService.prototype.isOverFormFieldElement = function (mouseEvent) {
18419 var _a, _b;
18420 var el = mouseEvent.target;
18421 var tagName = (_a = el) === null || _a === void 0 ? void 0 : _a.tagName.toLocaleLowerCase();
18422 return !!((_b = tagName) === null || _b === void 0 ? void 0 : _b.match('^a$|textarea|input|select|button'));
18423 };
18424 DragService.prototype.onTouchUp = function (touchEvent, el) {
18425 var touch = this.getFirstActiveTouch(touchEvent.changedTouches);
18426 // i haven't worked this out yet, but there is no matching touch
18427 // when we get the touch up event. to get around this, we swap in
18428 // the last touch. this is a hack to 'get it working' while we
18429 // figure out what's going on, why we are not getting a touch in
18430 // current event.
18431 if (!touch) {
18432 touch = this.touchLastTime;
18433 }
18434 // if mouse was left up before we started to move, then this is a tap.
18435 // we check this before onUpCommon as onUpCommon resets the dragging
18436 // let tap = !this.dragging;
18437 // let tapTarget = this.currentDragParams.eElement;
18438 this.onUpCommon(touch, el);
18439 // if tap, tell user
18440 // console.log(`${Math.random()} tap = ${tap}`);
18441 // if (tap) {
18442 // tapTarget.click();
18443 // }
18444 };
18445 DragService.prototype.onMouseUp = function (mouseEvent, el) {
18446 this.onUpCommon(mouseEvent, el);
18447 };
18448 DragService.prototype.onUpCommon = function (eventOrTouch, el) {
18449 if (this.dragging) {
18450 this.dragging = false;
18451 this.currentDragParams.onDragStop(eventOrTouch);
18452 var event_2 = {
18453 type: Events.EVENT_DRAG_STOPPED,
18454 api: this.gridApi,
18455 columnApi: this.columnApi,
18456 target: el
18457 };
18458 this.eventService.dispatchEvent(event_2);
18459 }
18460 this.mouseStartEvent = null;
18461 this.touchStart = null;
18462 this.touchLastTime = null;
18463 this.currentDragParams = null;
18464 this.dragEndFunctions.forEach(function (func) { return func(); });
18465 this.dragEndFunctions.length = 0;
18466 };
18467 __decorate$F([
18468 Autowired('loggerFactory')
18469 ], DragService.prototype, "loggerFactory", void 0);
18470 __decorate$F([
18471 Autowired('columnApi')
18472 ], DragService.prototype, "columnApi", void 0);
18473 __decorate$F([
18474 Autowired('gridApi')
18475 ], DragService.prototype, "gridApi", void 0);
18476 __decorate$F([
18477 Autowired('mouseEventService')
18478 ], DragService.prototype, "mouseEventService", void 0);
18479 __decorate$F([
18480 PostConstruct
18481 ], DragService.prototype, "init", null);
18482 __decorate$F([
18483 PreDestroy
18484 ], DragService.prototype, "removeAllListeners", null);
18485 DragService = __decorate$F([
18486 Bean('dragService')
18487 ], DragService);
18488 return DragService;
18489}(BeanStub));
18490
18491/**
18492 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
18493 * @version v27.3.0
18494 * @link https://www.ag-grid.com/
18495 * @license MIT
18496 */
18497var __extends$N = (undefined && undefined.__extends) || (function () {
18498 var extendStatics = function (d, b) {
18499 extendStatics = Object.setPrototypeOf ||
18500 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
18501 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
18502 return extendStatics(d, b);
18503 };
18504 return function (d, b) {
18505 extendStatics(d, b);
18506 function __() { this.constructor = d; }
18507 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18508 };
18509})();
18510var __assign$8 = (undefined && undefined.__assign) || function () {
18511 __assign$8 = Object.assign || function(t) {
18512 for (var s, i = 1, n = arguments.length; i < n; i++) {
18513 s = arguments[i];
18514 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
18515 t[p] = s[p];
18516 }
18517 return t;
18518 };
18519 return __assign$8.apply(this, arguments);
18520};
18521var __decorate$G = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
18522 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18523 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
18524 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;
18525 return c > 3 && r && Object.defineProperty(target, key, r), r;
18526};
18527var FilterManager = /** @class */ (function (_super) {
18528 __extends$N(FilterManager, _super);
18529 function FilterManager() {
18530 var _this = _super !== null && _super.apply(this, arguments) || this;
18531 _this.allColumnFilters = new Map();
18532 _this.activeAggregateFilters = [];
18533 _this.activeColumnFilters = [];
18534 _this.quickFilter = null;
18535 _this.quickFilterParts = null;
18536 // this is true when the grid is processing the filter change. this is used by the cell comps, so that they
18537 // don't flash when data changes due to filter changes. there is no need to flash when filter changes as the
18538 // user is in control, so doesn't make sense to show flashing changes. for example, go to main demo where
18539 // this feature is turned off (hack code to always return false for isSuppressFlashingCellsBecauseFiltering(), put in)
18540 // 100,000 rows and group by country. then do some filtering. all the cells flash, which is silly.
18541 _this.processingFilterChange = false;
18542 return _this;
18543 }
18544 FilterManager_1 = FilterManager;
18545 FilterManager.prototype.init = function () {
18546 var _this = this;
18547 this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, function () { return _this.onColumnsChanged(); });
18548 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, function () { return _this.refreshFiltersForAggregations(); });
18549 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, function () { return _this.refreshFiltersForAggregations(); });
18550 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, function () { return _this.refreshFiltersForAggregations(); });
18551 this.quickFilter = this.parseQuickFilter(this.gridOptionsWrapper.getQuickFilterText());
18552 this.setQuickFilterParts();
18553 this.allowShowChangeAfterFilter = this.gridOptionsWrapper.isAllowShowChangeAfterFilter();
18554 };
18555 FilterManager.prototype.setQuickFilterParts = function () {
18556 this.quickFilterParts = this.quickFilter ? this.quickFilter.split(' ') : null;
18557 };
18558 FilterManager.prototype.setFilterModel = function (model) {
18559 var _this = this;
18560 var allPromises = [];
18561 var previousModel = this.getFilterModel();
18562 if (model) {
18563 // mark the filters as we set them, so any active filters left over we stop
18564 var modelKeys_1 = convertToSet(Object.keys(model));
18565 this.allColumnFilters.forEach(function (filterWrapper, colId) {
18566 var newModel = model[colId];
18567 allPromises.push(_this.setModelOnFilterWrapper(filterWrapper.filterPromise, newModel));
18568 modelKeys_1.delete(colId);
18569 });
18570 // at this point, processedFields contains data for which we don't have a filter working yet
18571 modelKeys_1.forEach(function (colId) {
18572 var column = _this.columnModel.getPrimaryColumn(colId) || _this.columnModel.getGridColumn(colId);
18573 if (!column) {
18574 console.warn('AG Grid: setFilterModel() - no column found for colId: ' + colId);
18575 return;
18576 }
18577 if (!column.isFilterAllowed()) {
18578 console.warn('AG Grid: setFilterModel() - unable to fully apply model, filtering disabled for colId: ' + colId);
18579 return;
18580 }
18581 var filterWrapper = _this.getOrCreateFilterWrapper(column, 'NO_UI');
18582 if (!filterWrapper) {
18583 console.warn('AG-Grid: setFilterModel() - unable to fully apply model, unable to create filter for colId: ' + colId);
18584 return;
18585 }
18586 allPromises.push(_this.setModelOnFilterWrapper(filterWrapper.filterPromise, model[colId]));
18587 });
18588 }
18589 else {
18590 this.allColumnFilters.forEach(function (filterWrapper) {
18591 allPromises.push(_this.setModelOnFilterWrapper(filterWrapper.filterPromise, null));
18592 });
18593 }
18594 AgPromise.all(allPromises).then(function () {
18595 var currentModel = _this.getFilterModel();
18596 var columns = [];
18597 _this.allColumnFilters.forEach(function (filterWrapper, colId) {
18598 var before = previousModel ? previousModel[colId] : null;
18599 var after = currentModel ? currentModel[colId] : null;
18600 if (!_.jsonEquals(before, after)) {
18601 columns.push(filterWrapper.column);
18602 }
18603 });
18604 if (columns.length > 0) {
18605 _this.onFilterChanged({ columns: columns });
18606 }
18607 });
18608 };
18609 FilterManager.prototype.setModelOnFilterWrapper = function (filterPromise, newModel) {
18610 return new AgPromise(function (resolve) {
18611 filterPromise.then(function (filter) {
18612 if (typeof filter.setModel !== 'function') {
18613 console.warn('AG Grid: filter missing setModel method, which is needed for setFilterModel');
18614 resolve();
18615 }
18616 (filter.setModel(newModel) || AgPromise.resolve()).then(function () { return resolve(); });
18617 });
18618 });
18619 };
18620 FilterManager.prototype.getFilterModel = function () {
18621 var result = {};
18622 this.allColumnFilters.forEach(function (filterWrapper, key) {
18623 // because user can provide filters, we provide useful error checking and messages
18624 var filterPromise = filterWrapper.filterPromise;
18625 var filter = filterPromise.resolveNow(null, function (promiseFilter) { return promiseFilter; });
18626 if (filter == null) {
18627 return null;
18628 }
18629 if (typeof filter.getModel !== 'function') {
18630 console.warn('AG Grid: filter API missing getModel method, which is needed for getFilterModel');
18631 return;
18632 }
18633 var model = filter.getModel();
18634 if (exists(model)) {
18635 result[key] = model;
18636 }
18637 });
18638 return result;
18639 };
18640 FilterManager.prototype.isColumnFilterPresent = function () {
18641 return this.activeColumnFilters.length > 0;
18642 };
18643 FilterManager.prototype.isAggregateFilterPresent = function () {
18644 return !!this.activeAggregateFilters.length;
18645 };
18646 FilterManager.prototype.doAggregateFiltersPass = function (node, filterToSkip) {
18647 return this.doColumnFiltersPass(node, filterToSkip, true);
18648 };
18649 // called by:
18650 // 1) onFilterChanged()
18651 // 2) onNewRowsLoaded()
18652 FilterManager.prototype.updateActiveFilters = function () {
18653 var _this = this;
18654 this.activeColumnFilters.length = 0;
18655 this.activeAggregateFilters.length = 0;
18656 var isFilterActive = function (filter) {
18657 if (!filter) {
18658 return false;
18659 } // this never happens, including to avoid compile error
18660 if (!filter.isFilterActive) {
18661 console.warn('AG Grid: Filter is missing isFilterActive() method');
18662 return false;
18663 }
18664 return filter.isFilterActive();
18665 };
18666 var groupFilterEnabled = !!this.gridOptionsWrapper.getGroupAggFiltering();
18667 var isAggFilter = function (column) {
18668 var isSecondary = !column.isPrimary();
18669 // the only filters that can appear on secondary columns are groupAgg filters
18670 if (isSecondary) {
18671 return true;
18672 }
18673 var isShowingPrimaryColumns = !_this.columnModel.isPivotActive();
18674 var isValueActive = column.isValueActive();
18675 // primary columns are only ever groupAgg filters if a) value is active and b) showing primary columns
18676 if (!isValueActive || !isShowingPrimaryColumns) {
18677 return false;
18678 }
18679 // from here on we know: isPrimary=true, isValueActive=true, isShowingPrimaryColumns=true
18680 if (_this.columnModel.isPivotMode()) {
18681 // primary column is pretending to be a pivot column, ie pivotMode=true, but we are
18682 // still showing primary columns
18683 return true;
18684 }
18685 else {
18686 // we are not pivoting, so we groupFilter when it's an agg column
18687 return groupFilterEnabled;
18688 }
18689 };
18690 this.allColumnFilters.forEach(function (filterWrapper) {
18691 if (filterWrapper.filterPromise.resolveNow(false, isFilterActive)) {
18692 var filterComp = filterWrapper.filterPromise.resolveNow(null, function (filter) { return filter; });
18693 if (isAggFilter(filterWrapper.column)) {
18694 _this.activeAggregateFilters.push(filterComp);
18695 }
18696 else {
18697 _this.activeColumnFilters.push(filterComp);
18698 }
18699 }
18700 });
18701 };
18702 FilterManager.prototype.updateFilterFlagInColumns = function (source, additionalEventAttributes) {
18703 this.allColumnFilters.forEach(function (filterWrapper) {
18704 var isFilterActive = filterWrapper.filterPromise.resolveNow(false, function (filter) { return filter.isFilterActive(); });
18705 filterWrapper.column.setFilterActive(isFilterActive, source, additionalEventAttributes);
18706 });
18707 };
18708 FilterManager.prototype.isAnyFilterPresent = function () {
18709 return this.isQuickFilterPresent() || this.isColumnFilterPresent() || this.isAggregateFilterPresent() || this.gridOptionsWrapper.isExternalFilterPresent();
18710 };
18711 FilterManager.prototype.doColumnFiltersPass = function (node, filterToSkip, targetAggregates) {
18712 var data = node.data, aggData = node.aggData;
18713 var targetedFilters = targetAggregates ? this.activeAggregateFilters : this.activeColumnFilters;
18714 var targetedData = targetAggregates ? aggData : data;
18715 for (var i = 0; i < targetedFilters.length; i++) {
18716 var filter = targetedFilters[i];
18717 if (filter == null || filter === filterToSkip) {
18718 continue;
18719 }
18720 if (typeof filter.doesFilterPass !== 'function') {
18721 // because users can do custom filters, give nice error message
18722 throw new Error('Filter is missing method doesFilterPass');
18723 }
18724 if (!filter.doesFilterPass({ node: node, data: targetedData })) {
18725 return false;
18726 }
18727 }
18728 return true;
18729 };
18730 FilterManager.prototype.parseQuickFilter = function (newFilter) {
18731 if (!exists(newFilter)) {
18732 return null;
18733 }
18734 if (!this.gridOptionsWrapper.isRowModelDefault()) {
18735 console.warn('AG Grid - Quick filtering only works with the Client-Side Row Model');
18736 return null;
18737 }
18738 return newFilter.toUpperCase();
18739 };
18740 FilterManager.prototype.setQuickFilter = function (newFilter) {
18741 if (newFilter != null && typeof newFilter !== 'string') {
18742 console.warn("AG Grid - setQuickFilter() only supports string inputs, received: " + typeof newFilter);
18743 return;
18744 }
18745 var parsedFilter = this.parseQuickFilter(newFilter);
18746 if (this.quickFilter !== parsedFilter) {
18747 this.quickFilter = parsedFilter;
18748 this.setQuickFilterParts();
18749 this.onFilterChanged();
18750 }
18751 };
18752 FilterManager.prototype.refreshFiltersForAggregations = function () {
18753 var isAggFiltering = this.gridOptionsWrapper.getGroupAggFiltering();
18754 if (isAggFiltering) {
18755 this.onFilterChanged();
18756 }
18757 };
18758 // sometimes (especially in React) the filter can call onFilterChanged when we are in the middle
18759 // of a render cycle. this would be bad, so we wait for render cycle to complete when this happens.
18760 // this happens in react when we change React State in the grid (eg setting RowCtrl's in RowContainer)
18761 // which results in React State getting applied in the main application, triggering a useEffect() to
18762 // be kicked off adn then the application calling the grid's API. in AG-6554, the custom filter was
18763 // getting it's useEffect() triggered in this way.
18764 FilterManager.prototype.callOnFilterChangedOutsideRenderCycle = function (params) {
18765 var _this = this;
18766 if (params === void 0) { params = {}; }
18767 var action = function () { return _this.onFilterChanged(params); };
18768 if (this.rowRenderer.isRefreshInProgress()) {
18769 setTimeout(action, 0);
18770 }
18771 else {
18772 action();
18773 }
18774 };
18775 FilterManager.prototype.onFilterChanged = function (params) {
18776 if (params === void 0) { params = {}; }
18777 var filterInstance = params.filterInstance, additionalEventAttributes = params.additionalEventAttributes, columns = params.columns;
18778 this.updateActiveFilters();
18779 this.updateFilterFlagInColumns('filterChanged', additionalEventAttributes);
18780 this.allColumnFilters.forEach(function (filterWrapper) {
18781 if (!filterWrapper.filterPromise) {
18782 return;
18783 }
18784 filterWrapper.filterPromise.then(function (filter) {
18785 if (filter && filter !== filterInstance && filter.onAnyFilterChanged) {
18786 filter.onAnyFilterChanged();
18787 }
18788 });
18789 });
18790 var filterChangedEvent = {
18791 type: Events.EVENT_FILTER_CHANGED,
18792 api: this.gridApi,
18793 columnApi: this.columnApi,
18794 columns: columns || [],
18795 };
18796 if (additionalEventAttributes) {
18797 mergeDeep(filterChangedEvent, additionalEventAttributes);
18798 }
18799 // because internal events are not async in ag-grid, when the dispatchEvent
18800 // method comes back, we know all listeners have finished executing.
18801 this.processingFilterChange = true;
18802 this.eventService.dispatchEvent(filterChangedEvent);
18803 this.processingFilterChange = false;
18804 };
18805 FilterManager.prototype.isSuppressFlashingCellsBecauseFiltering = function () {
18806 // if user has elected to always flash cell changes, then always return false, otherwise we suppress flashing
18807 // changes when filtering
18808 return !this.allowShowChangeAfterFilter && this.processingFilterChange;
18809 };
18810 FilterManager.prototype.isQuickFilterPresent = function () {
18811 return this.quickFilter !== null;
18812 };
18813 FilterManager.prototype.doesRowPassOtherFilters = function (filterToSkip, node) {
18814 return this.doesRowPassFilter({ rowNode: node, filterInstanceToSkip: filterToSkip });
18815 };
18816 FilterManager.prototype.doesRowPassQuickFilterNoCache = function (node, filterPart) {
18817 var _this = this;
18818 var columns = this.columnModel.getAllColumnsForQuickFilter();
18819 return columns.some(function (column) {
18820 var part = _this.getQuickFilterTextForColumn(column, node);
18821 return exists(part) && part.indexOf(filterPart) >= 0;
18822 });
18823 };
18824 FilterManager.prototype.doesRowPassQuickFilterCache = function (node, filterPart) {
18825 if (!node.quickFilterAggregateText) {
18826 this.aggregateRowForQuickFilter(node);
18827 }
18828 return node.quickFilterAggregateText.indexOf(filterPart) >= 0;
18829 };
18830 FilterManager.prototype.doesRowPassQuickFilter = function (node) {
18831 var _this = this;
18832 var usingCache = this.gridOptionsWrapper.isCacheQuickFilter();
18833 // each part must pass, if any fails, then the whole filter fails
18834 return this.quickFilterParts.every(function (part) {
18835 return usingCache ? _this.doesRowPassQuickFilterCache(node, part) : _this.doesRowPassQuickFilterNoCache(node, part);
18836 });
18837 };
18838 FilterManager.prototype.doesRowPassAggregateFilters = function (params) {
18839 if (this.isAggregateFilterPresent() && !this.doAggregateFiltersPass(params.rowNode, params.filterInstanceToSkip)) {
18840 return false;
18841 }
18842 // got this far, all filters pass
18843 return true;
18844 };
18845 FilterManager.prototype.doesRowPassFilter = function (params) {
18846 // the row must pass ALL of the filters, so if any of them fail,
18847 // we return true. that means if a row passes the quick filter,
18848 // but fails the column filter, it fails overall
18849 // first up, check quick filter
18850 if (this.isQuickFilterPresent() && !this.doesRowPassQuickFilter(params.rowNode)) {
18851 return false;
18852 }
18853 // secondly, give the client a chance to reject this row
18854 if (this.gridOptionsWrapper.isExternalFilterPresent() && !this.gridOptionsWrapper.doesExternalFilterPass(params.rowNode)) {
18855 return false;
18856 }
18857 // lastly, check column filter
18858 if (this.isColumnFilterPresent() && !this.doColumnFiltersPass(params.rowNode, params.filterInstanceToSkip)) {
18859 return false;
18860 }
18861 // got this far, all filters pass
18862 return true;
18863 };
18864 FilterManager.prototype.getQuickFilterTextForColumn = function (column, node) {
18865 var value = this.valueService.getValue(column, node, true);
18866 var colDef = column.getColDef();
18867 if (colDef.getQuickFilterText) {
18868 var params = {
18869 value: value,
18870 node: node,
18871 data: node.data,
18872 column: column,
18873 colDef: colDef,
18874 api: this.gridOptionsWrapper.getApi(),
18875 columnApi: this.gridOptionsWrapper.getColumnApi(),
18876 context: this.gridOptionsWrapper.getContext()
18877 };
18878 value = colDef.getQuickFilterText(params);
18879 }
18880 return exists(value) ? value.toString().toUpperCase() : null;
18881 };
18882 FilterManager.prototype.aggregateRowForQuickFilter = function (node) {
18883 var _this = this;
18884 var stringParts = [];
18885 var columns = this.columnModel.getAllColumnsForQuickFilter();
18886 columns.forEach(function (column) {
18887 var part = _this.getQuickFilterTextForColumn(column, node);
18888 if (exists(part)) {
18889 stringParts.push(part);
18890 }
18891 });
18892 node.quickFilterAggregateText = stringParts.join(FilterManager_1.QUICK_FILTER_SEPARATOR);
18893 };
18894 FilterManager.prototype.onNewRowsLoaded = function (source) {
18895 this.allColumnFilters.forEach(function (filterWrapper) {
18896 filterWrapper.filterPromise.then(function (filter) {
18897 if (filter.onNewRowsLoaded) {
18898 filter.onNewRowsLoaded();
18899 }
18900 });
18901 });
18902 this.updateFilterFlagInColumns(source);
18903 this.updateActiveFilters();
18904 };
18905 FilterManager.prototype.createValueGetter = function (column) {
18906 var _this = this;
18907 return function (_a) {
18908 var node = _a.node;
18909 return _this.valueService.getValue(column, node, true);
18910 };
18911 };
18912 FilterManager.prototype.getFilterComponent = function (column, source, createIfDoesNotExist) {
18913 if (createIfDoesNotExist === void 0) { createIfDoesNotExist = true; }
18914 var _a;
18915 if (createIfDoesNotExist) {
18916 return ((_a = this.getOrCreateFilterWrapper(column, source)) === null || _a === void 0 ? void 0 : _a.filterPromise) || null;
18917 }
18918 var filterWrapper = this.cachedFilter(column);
18919 return filterWrapper ? filterWrapper.filterPromise : null;
18920 };
18921 FilterManager.prototype.isFilterActive = function (column) {
18922 var filterWrapper = this.cachedFilter(column);
18923 return !!filterWrapper && filterWrapper.filterPromise.resolveNow(false, function (filter) { return filter.isFilterActive(); });
18924 };
18925 FilterManager.prototype.getOrCreateFilterWrapper = function (column, source) {
18926 if (!column.isFilterAllowed()) {
18927 return null;
18928 }
18929 var filterWrapper = this.cachedFilter(column);
18930 if (!filterWrapper) {
18931 filterWrapper = this.createFilterWrapper(column, source);
18932 this.allColumnFilters.set(column.getColId(), filterWrapper);
18933 }
18934 else if (source !== 'NO_UI') {
18935 this.putIntoGui(filterWrapper, source);
18936 }
18937 return filterWrapper;
18938 };
18939 FilterManager.prototype.cachedFilter = function (column) {
18940 return this.allColumnFilters.get(column.getColId());
18941 };
18942 FilterManager.prototype.createFilterInstance = function (column) {
18943 var _this = this;
18944 var defaultFilter = ModuleRegistry.isRegistered(exports.ModuleNames.SetFilterModule) ? 'agSetColumnFilter' : 'agTextColumnFilter';
18945 var colDef = column.getColDef();
18946 var filterInstance;
18947 var params = __assign$8(__assign$8({}, this.createFilterParams(column, colDef)), { filterModifiedCallback: function () {
18948 var event = {
18949 type: Events.EVENT_FILTER_MODIFIED,
18950 api: _this.gridApi,
18951 columnApi: _this.columnApi,
18952 column: column,
18953 filterInstance: filterInstance
18954 };
18955 _this.eventService.dispatchEvent(event);
18956 }, filterChangedCallback: function (additionalEventAttributes) {
18957 var params = { filterInstance: filterInstance, additionalEventAttributes: additionalEventAttributes, columns: [column] };
18958 _this.callOnFilterChangedOutsideRenderCycle(params);
18959 }, doesRowPassOtherFilter: function (node) { return _this.doesRowPassOtherFilters(filterInstance, node); } });
18960 var compDetails = this.userComponentFactory.getFilterDetails(colDef, params, defaultFilter);
18961 if (!compDetails) {
18962 return null;
18963 }
18964 var componentPromise = compDetails.newAgStackInstance();
18965 if (componentPromise) {
18966 componentPromise.then(function (r) { return filterInstance = r; });
18967 }
18968 return componentPromise;
18969 };
18970 FilterManager.prototype.createFilterParams = function (column, colDef) {
18971 var params = {
18972 api: this.gridOptionsWrapper.getApi(),
18973 columnApi: this.gridOptionsWrapper.getColumnApi(),
18974 column: column,
18975 colDef: cloneObject(colDef),
18976 rowModel: this.rowModel,
18977 filterChangedCallback: function () { },
18978 filterModifiedCallback: function () { },
18979 valueGetter: this.createValueGetter(column),
18980 context: this.gridOptionsWrapper.getContext(),
18981 doesRowPassOtherFilter: function () { return true; },
18982 };
18983 return params;
18984 };
18985 FilterManager.prototype.createFilterWrapper = function (column, source) {
18986 var filterWrapper = {
18987 column: column,
18988 filterPromise: null,
18989 compiledElement: null,
18990 guiPromise: AgPromise.resolve(null)
18991 };
18992 filterWrapper.filterPromise = this.createFilterInstance(column);
18993 if (filterWrapper.filterPromise) {
18994 this.putIntoGui(filterWrapper, source);
18995 }
18996 return filterWrapper;
18997 };
18998 FilterManager.prototype.putIntoGui = function (filterWrapper, source) {
18999 var _this = this;
19000 var eFilterGui = document.createElement('div');
19001 eFilterGui.className = 'ag-filter';
19002 filterWrapper.guiPromise = new AgPromise(function (resolve) {
19003 filterWrapper.filterPromise.then(function (filter) {
19004 var guiFromFilter = filter.getGui();
19005 if (!exists(guiFromFilter)) {
19006 console.warn("AG Grid: getGui method from filter returned " + guiFromFilter + ", it should be a DOM element or an HTML template string.");
19007 }
19008 // for backwards compatibility with Angular 1 - we
19009 // used to allow providing back HTML from getGui().
19010 // once we move away from supporting Angular 1
19011 // directly, we can change this.
19012 if (typeof guiFromFilter === 'string') {
19013 guiFromFilter = loadTemplate(guiFromFilter);
19014 }
19015 eFilterGui.appendChild(guiFromFilter);
19016 resolve(eFilterGui);
19017 _this.eventService.dispatchEvent({
19018 type: Events.EVENT_FILTER_OPENED,
19019 column: filterWrapper.column,
19020 source: source,
19021 eGui: eFilterGui,
19022 api: _this.gridApi,
19023 columnApi: _this.columnApi
19024 });
19025 });
19026 });
19027 };
19028 FilterManager.prototype.onColumnsChanged = function () {
19029 var _this = this;
19030 var columns = [];
19031 this.allColumnFilters.forEach(function (wrapper, colId) {
19032 var currentColumn;
19033 if (wrapper.column.isPrimary()) {
19034 currentColumn = _this.columnModel.getPrimaryColumn(colId);
19035 }
19036 else {
19037 currentColumn = _this.columnModel.getGridColumn(colId);
19038 }
19039 if (currentColumn) {
19040 return;
19041 }
19042 columns.push(wrapper.column);
19043 _this.disposeFilterWrapper(wrapper, 'filterDestroyed');
19044 });
19045 if (columns.length > 0) {
19046 this.onFilterChanged({ columns: columns });
19047 }
19048 };
19049 // destroys the filter, so it not longer takes part
19050 FilterManager.prototype.destroyFilter = function (column, source) {
19051 if (source === void 0) { source = 'api'; }
19052 var filterWrapper = this.allColumnFilters.get(column.getColId());
19053 if (filterWrapper) {
19054 this.disposeFilterWrapper(filterWrapper, source);
19055 this.onFilterChanged({ columns: [column] });
19056 }
19057 };
19058 FilterManager.prototype.disposeFilterWrapper = function (filterWrapper, source) {
19059 var _this = this;
19060 filterWrapper.filterPromise.then(function (filter) {
19061 (filter.setModel(null) || AgPromise.resolve()).then(function () {
19062 _this.getContext().destroyBean(filter);
19063 filterWrapper.column.setFilterActive(false, source);
19064 _this.allColumnFilters.delete(filterWrapper.column.getColId());
19065 });
19066 });
19067 };
19068 FilterManager.prototype.destroy = function () {
19069 var _this = this;
19070 _super.prototype.destroy.call(this);
19071 this.allColumnFilters.forEach(function (filterWrapper) { return _this.disposeFilterWrapper(filterWrapper, 'filterDestroyed'); });
19072 };
19073 var FilterManager_1;
19074 FilterManager.QUICK_FILTER_SEPARATOR = '\n';
19075 __decorate$G([
19076 Autowired('valueService')
19077 ], FilterManager.prototype, "valueService", void 0);
19078 __decorate$G([
19079 Autowired('columnModel')
19080 ], FilterManager.prototype, "columnModel", void 0);
19081 __decorate$G([
19082 Autowired('rowModel')
19083 ], FilterManager.prototype, "rowModel", void 0);
19084 __decorate$G([
19085 Autowired('columnApi')
19086 ], FilterManager.prototype, "columnApi", void 0);
19087 __decorate$G([
19088 Autowired('gridApi')
19089 ], FilterManager.prototype, "gridApi", void 0);
19090 __decorate$G([
19091 Autowired('userComponentFactory')
19092 ], FilterManager.prototype, "userComponentFactory", void 0);
19093 __decorate$G([
19094 Autowired('rowRenderer')
19095 ], FilterManager.prototype, "rowRenderer", void 0);
19096 __decorate$G([
19097 PostConstruct
19098 ], FilterManager.prototype, "init", null);
19099 __decorate$G([
19100 PreDestroy
19101 ], FilterManager.prototype, "destroy", null);
19102 FilterManager = FilterManager_1 = __decorate$G([
19103 Bean('filterManager')
19104 ], FilterManager);
19105 return FilterManager;
19106}(BeanStub));
19107
19108/**
19109 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
19110 * @version v27.3.0
19111 * @link https://www.ag-grid.com/
19112 * @license MIT
19113 */
19114var __extends$O = (undefined && undefined.__extends) || (function () {
19115 var extendStatics = function (d, b) {
19116 extendStatics = Object.setPrototypeOf ||
19117 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19118 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
19119 return extendStatics(d, b);
19120 };
19121 return function (d, b) {
19122 extendStatics(d, b);
19123 function __() { this.constructor = d; }
19124 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19125 };
19126})();
19127var AbstractHeaderCellComp = /** @class */ (function (_super) {
19128 __extends$O(AbstractHeaderCellComp, _super);
19129 function AbstractHeaderCellComp(template, ctrl) {
19130 var _this = _super.call(this, template) || this;
19131 _this.ctrl = ctrl;
19132 return _this;
19133 }
19134 AbstractHeaderCellComp.prototype.getCtrl = function () {
19135 return this.ctrl;
19136 };
19137 return AbstractHeaderCellComp;
19138}(Component));
19139
19140/**
19141 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
19142 * @version v27.3.0
19143 * @link https://www.ag-grid.com/
19144 * @license MIT
19145 */
19146var __extends$P = (undefined && undefined.__extends) || (function () {
19147 var extendStatics = function (d, b) {
19148 extendStatics = Object.setPrototypeOf ||
19149 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19150 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
19151 return extendStatics(d, b);
19152 };
19153 return function (d, b) {
19154 extendStatics(d, b);
19155 function __() { this.constructor = d; }
19156 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19157 };
19158})();
19159var __decorate$H = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
19160 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19161 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
19162 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;
19163 return c > 3 && r && Object.defineProperty(target, key, r), r;
19164};
19165var HeaderFilterCellComp = /** @class */ (function (_super) {
19166 __extends$P(HeaderFilterCellComp, _super);
19167 function HeaderFilterCellComp(ctrl) {
19168 return _super.call(this, HeaderFilterCellComp.TEMPLATE, ctrl) || this;
19169 }
19170 HeaderFilterCellComp.prototype.postConstruct = function () {
19171 var _this = this;
19172 var eGui = this.getGui();
19173 var compProxy = {
19174 addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
19175 addOrRemoveBodyCssClass: function (cssClassName, on) { return _this.eFloatingFilterBody.classList.toggle(cssClassName, on); },
19176 addOrRemoveButtonWrapperCssClass: function (cssClassName, on) { return _this.eButtonWrapper.classList.toggle(cssClassName, on); },
19177 setCompDetails: function (compDetails) { return _this.setCompDetails(compDetails); },
19178 getFloatingFilterComp: function () { return _this.compPromise; },
19179 setWidth: function (width) { return eGui.style.width = width; },
19180 setMenuIcon: function (eIcon) { return _this.eButtonShowMainFilter.appendChild(eIcon); }
19181 };
19182 this.ctrl.setComp(compProxy, eGui, this.eButtonShowMainFilter, this.eFloatingFilterBody);
19183 };
19184 HeaderFilterCellComp.prototype.setCompDetails = function (compDetails) {
19185 var _this = this;
19186 // because we are providing defaultFloatingFilterType, we know it will never be undefined;
19187 this.compPromise = compDetails.newAgStackInstance();
19188 this.compPromise.then(function (comp) { return _this.afterCompCreated(comp); });
19189 };
19190 HeaderFilterCellComp.prototype.afterCompCreated = function (comp) {
19191 var _this = this;
19192 if (!comp) {
19193 return;
19194 }
19195 this.addDestroyFunc(function () { return _this.context.destroyBean(comp); });
19196 if (!this.isAlive()) {
19197 return;
19198 }
19199 this.eFloatingFilterBody.appendChild(comp.getGui());
19200 if (comp.afterGuiAttached) {
19201 comp.afterGuiAttached();
19202 }
19203 };
19204 HeaderFilterCellComp.TEMPLATE = "<div class=\"ag-header-cell ag-floating-filter\" role=\"gridcell\" tabindex=\"-1\">\n <div ref=\"eFloatingFilterBody\" role=\"presentation\"></div>\n <div class=\"ag-floating-filter-button ag-hidden\" ref=\"eButtonWrapper\" role=\"presentation\">\n <button type=\"button\" aria-label=\"Open Filter Menu\" class=\"ag-floating-filter-button-button\" ref=\"eButtonShowMainFilter\" tabindex=\"-1\"></button>\n </div>\n </div>";
19205 __decorate$H([
19206 RefSelector('eFloatingFilterBody')
19207 ], HeaderFilterCellComp.prototype, "eFloatingFilterBody", void 0);
19208 __decorate$H([
19209 RefSelector('eButtonWrapper')
19210 ], HeaderFilterCellComp.prototype, "eButtonWrapper", void 0);
19211 __decorate$H([
19212 RefSelector('eButtonShowMainFilter')
19213 ], HeaderFilterCellComp.prototype, "eButtonShowMainFilter", void 0);
19214 __decorate$H([
19215 PostConstruct
19216 ], HeaderFilterCellComp.prototype, "postConstruct", null);
19217 return HeaderFilterCellComp;
19218}(AbstractHeaderCellComp));
19219
19220/**
19221 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
19222 * @version v27.3.0
19223 * @link https://www.ag-grid.com/
19224 * @license MIT
19225 */
19226var SideBarDefParser = /** @class */ (function () {
19227 function SideBarDefParser() {
19228 }
19229 SideBarDefParser.parse = function (toParse) {
19230 if (!toParse) {
19231 return null;
19232 }
19233 if (toParse === true) {
19234 return {
19235 toolPanels: [
19236 SideBarDefParser.DEFAULT_COLUMN_COMP,
19237 SideBarDefParser.DEFAULT_FILTER_COMP,
19238 ],
19239 defaultToolPanel: 'columns'
19240 };
19241 }
19242 if (typeof toParse === 'string') {
19243 return SideBarDefParser.parse([toParse]);
19244 }
19245 if (Array.isArray(toParse)) {
19246 var comps_1 = [];
19247 toParse.forEach(function (key) {
19248 var lookupResult = SideBarDefParser.DEFAULT_BY_KEY[key];
19249 if (!lookupResult) {
19250 console.warn("AG Grid: the key " + key + " is not a valid key for specifying a tool panel, valid keys are: " + Object.keys(SideBarDefParser.DEFAULT_BY_KEY).join(','));
19251 return;
19252 }
19253 comps_1.push(lookupResult);
19254 });
19255 if (comps_1.length === 0) {
19256 return null;
19257 }
19258 return {
19259 toolPanels: comps_1,
19260 defaultToolPanel: comps_1[0].id
19261 };
19262 }
19263 var result = {
19264 toolPanels: SideBarDefParser.parseComponents(toParse.toolPanels),
19265 defaultToolPanel: toParse.defaultToolPanel,
19266 hiddenByDefault: toParse.hiddenByDefault,
19267 position: toParse.position
19268 };
19269 return result;
19270 };
19271 SideBarDefParser.parseComponents = function (from) {
19272 var result = [];
19273 if (!from) {
19274 return result;
19275 }
19276 from.forEach(function (it) {
19277 var toAdd = null;
19278 if (typeof it === 'string') {
19279 var lookupResult = SideBarDefParser.DEFAULT_BY_KEY[it];
19280 if (!lookupResult) {
19281 console.warn("AG Grid: the key " + it + " is not a valid key for specifying a tool panel, valid keys are: " + Object.keys(SideBarDefParser.DEFAULT_BY_KEY).join(','));
19282 return;
19283 }
19284 toAdd = lookupResult;
19285 }
19286 else {
19287 toAdd = it;
19288 }
19289 result.push(toAdd);
19290 });
19291 return result;
19292 };
19293 SideBarDefParser.DEFAULT_COLUMN_COMP = {
19294 id: 'columns',
19295 labelDefault: 'Columns',
19296 labelKey: 'columns',
19297 iconKey: 'columns',
19298 toolPanel: 'agColumnsToolPanel',
19299 };
19300 SideBarDefParser.DEFAULT_FILTER_COMP = {
19301 id: 'filters',
19302 labelDefault: 'Filters',
19303 labelKey: 'filters',
19304 iconKey: 'filter',
19305 toolPanel: 'agFiltersToolPanel',
19306 };
19307 SideBarDefParser.DEFAULT_BY_KEY = {
19308 columns: SideBarDefParser.DEFAULT_COLUMN_COMP,
19309 filters: SideBarDefParser.DEFAULT_FILTER_COMP
19310 };
19311 return SideBarDefParser;
19312}());
19313
19314/**
19315 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
19316 * @version v27.3.0
19317 * @link https://www.ag-grid.com/
19318 * @license MIT
19319 */
19320var __assign$9 = (undefined && undefined.__assign) || function () {
19321 __assign$9 = Object.assign || function(t) {
19322 for (var s, i = 1, n = arguments.length; i < n; i++) {
19323 s = arguments[i];
19324 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19325 t[p] = s[p];
19326 }
19327 return t;
19328 };
19329 return __assign$9.apply(this, arguments);
19330};
19331var __decorate$I = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
19332 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19333 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
19334 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;
19335 return c > 3 && r && Object.defineProperty(target, key, r), r;
19336};
19337var __param$3 = (undefined && undefined.__param) || function (paramIndex, decorator) {
19338 return function (target, key) { decorator(target, key, paramIndex); }
19339};
19340var __read$6 = (undefined && undefined.__read) || function (o, n) {
19341 var m = typeof Symbol === "function" && o[Symbol.iterator];
19342 if (!m) return o;
19343 var i = m.call(o), r, ar = [], e;
19344 try {
19345 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19346 }
19347 catch (error) { e = { error: error }; }
19348 finally {
19349 try {
19350 if (r && !r.done && (m = i["return"])) m.call(i);
19351 }
19352 finally { if (e) throw e.error; }
19353 }
19354 return ar;
19355};
19356var __spread$4 = (undefined && undefined.__spread) || function () {
19357 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$6(arguments[i]));
19358 return ar;
19359};
19360var DEFAULT_ROW_HEIGHT = 25;
19361var DEFAULT_DETAIL_ROW_HEIGHT = 300;
19362var DEFAULT_VIEWPORT_ROW_MODEL_PAGE_SIZE = 5;
19363var DEFAULT_VIEWPORT_ROW_MODEL_BUFFER_SIZE = 5;
19364var DEFAULT_KEEP_DETAIL_ROW_COUNT = 10;
19365function isTrue(value) {
19366 return value === true || value === 'true';
19367}
19368function toNumber(value) {
19369 if (typeof value == 'number') {
19370 return value;
19371 }
19372 if (typeof value == 'string') {
19373 return parseInt(value, 10);
19374 }
19375}
19376function zeroOrGreater(value, defaultValue) {
19377 if (value >= 0) {
19378 return value;
19379 }
19380 // zero gets returned if number is missing or the wrong type
19381 return defaultValue;
19382}
19383function oneOrGreater(value, defaultValue) {
19384 var valueNumber = parseInt(value, 10);
19385 if (isNumeric(valueNumber) && valueNumber > 0) {
19386 return valueNumber;
19387 }
19388 return defaultValue;
19389}
19390var GridOptionsWrapper = /** @class */ (function () {
19391 function GridOptionsWrapper() {
19392 this.propertyEventService = new EventService();
19393 this.domDataKey = '__AG_' + Math.random().toString();
19394 this.destroyed = false;
19395 }
19396 GridOptionsWrapper_1 = GridOptionsWrapper;
19397 GridOptionsWrapper.prototype.agWire = function (gridApi, columnApi) {
19398 this.gridOptions.api = gridApi;
19399 this.gridOptions.columnApi = columnApi;
19400 this.checkForDeprecated();
19401 this.checkForViolations();
19402 };
19403 GridOptionsWrapper.prototype.destroy = function () {
19404 // need to remove these, as we don't own the lifecycle of the gridOptions, we need to
19405 // remove the references in case the user keeps the grid options, we want the rest
19406 // of the grid to be picked up by the garbage collector
19407 this.gridOptions.api = null;
19408 this.gridOptions.columnApi = null;
19409 this.destroyed = true;
19410 };
19411 GridOptionsWrapper.prototype.init = function () {
19412 var _this = this;
19413 if (this.gridOptions.suppressPropertyNamesCheck !== true) {
19414 this.checkGridOptionsProperties();
19415 this.checkColumnDefProperties();
19416 }
19417 // parse side bar options into correct format
19418 if (this.gridOptions.sideBar != null) {
19419 this.gridOptions.sideBar = SideBarDefParser.parse(this.gridOptions.sideBar);
19420 }
19421 var async = this.useAsyncEvents();
19422 this.eventService.addGlobalListener(this.globalEventHandler.bind(this), async);
19423 if (this.isGroupSelectsChildren() && this.isSuppressParentsInRowNodes()) {
19424 console.warn("AG Grid: 'groupSelectsChildren' does not work with 'suppressParentsInRowNodes', this selection method needs the part in rowNode to work");
19425 }
19426 if (this.isGroupSelectsChildren()) {
19427 if (!this.isRowSelectionMulti()) {
19428 console.warn("AG Grid: rowSelection must be 'multiple' for groupSelectsChildren to make sense");
19429 }
19430 if (this.isRowModelServerSide()) {
19431 console.warn('AG Grid: group selects children is NOT support for Server Side Row Model. ' +
19432 'This is because the rows are lazy loaded, so selecting a group is not possible as' +
19433 'the grid has no way of knowing what the children are.');
19434 }
19435 }
19436 if (this.isGroupRemoveSingleChildren() && this.isGroupHideOpenParents()) {
19437 console.warn("AG Grid: groupRemoveSingleChildren and groupHideOpenParents do not work with each other, you need to pick one. And don't ask us how to us these together on our support forum either you will get the same answer!");
19438 }
19439 if (this.isRowModelServerSide()) {
19440 var msg = function (prop) { return "AG Grid: '" + prop + "' is not supported on the Server-Side Row Model"; };
19441 if (exists(this.gridOptions.groupDefaultExpanded)) {
19442 console.warn(msg('groupDefaultExpanded'));
19443 }
19444 if (exists(this.gridOptions.groupDefaultExpanded)) {
19445 console.warn(msg('groupIncludeFooter'));
19446 }
19447 if (exists(this.gridOptions.groupDefaultExpanded)) {
19448 console.warn(msg('groupIncludeTotalFooter'));
19449 }
19450 }
19451 if (this.isEnableRangeSelection()) {
19452 ModuleRegistry.assertRegistered(exports.ModuleNames.RangeSelectionModule, 'enableRangeSelection');
19453 }
19454 if (!this.isEnableRangeSelection() && (this.isEnableRangeHandle() || this.isEnableFillHandle())) {
19455 console.warn("AG Grid: 'enableRangeHandle' and 'enableFillHandle' will not work unless 'enableRangeSelection' is set to true");
19456 }
19457 var warnOfDeprecaredIcon = function (name) {
19458 if (_this.gridOptions.icons && _this.gridOptions.icons[name]) {
19459 console.warn("gridOptions.icons." + name + " is no longer supported. For information on how to style checkboxes and radio buttons, see https://www.ag-grid.com/javascript-grid-icons/");
19460 }
19461 };
19462 warnOfDeprecaredIcon('radioButtonOff');
19463 warnOfDeprecaredIcon('radioButtonOn');
19464 warnOfDeprecaredIcon('checkboxChecked');
19465 warnOfDeprecaredIcon('checkboxUnchecked');
19466 warnOfDeprecaredIcon('checkboxIndeterminate');
19467 // sets an initial calculation for the scrollbar width
19468 this.getScrollbarWidth();
19469 };
19470 GridOptionsWrapper.prototype.checkColumnDefProperties = function () {
19471 var _this = this;
19472 if (this.gridOptions.columnDefs == null) {
19473 return;
19474 }
19475 this.gridOptions.columnDefs.forEach(function (colDef) {
19476 var userProperties = Object.getOwnPropertyNames(colDef);
19477 var validProperties = __spread$4(ColDefUtil.ALL_PROPERTIES, ColDefUtil.FRAMEWORK_PROPERTIES);
19478 _this.checkProperties(userProperties, validProperties, validProperties, 'colDef', 'https://www.ag-grid.com/javascript-grid-column-properties/');
19479 });
19480 };
19481 GridOptionsWrapper.prototype.checkGridOptionsProperties = function () {
19482 var userProperties = Object.getOwnPropertyNames(this.gridOptions);
19483 var validProperties = __spread$4(PropertyKeys.ALL_PROPERTIES, PropertyKeys.FRAMEWORK_PROPERTIES, values(Events).map(function (event) { return ComponentUtil.getCallbackForEvent(event); }));
19484 var validPropertiesAndExceptions = __spread$4(validProperties, ['api', 'columnApi']);
19485 this.checkProperties(userProperties, validPropertiesAndExceptions, validProperties, 'gridOptions', 'https://www.ag-grid.com/javascript-data-grid/grid-options/');
19486 };
19487 GridOptionsWrapper.prototype.checkProperties = function (userProperties, validPropertiesAndExceptions, validProperties, containerName, docsUrl) {
19488 var invalidProperties = fuzzyCheckStrings(userProperties, validPropertiesAndExceptions, validProperties);
19489 iterateObject(invalidProperties, function (key, value) {
19490 console.warn("ag-grid: invalid " + containerName + " property '" + key + "' did you mean any of these: " + value.slice(0, 8).join(", "));
19491 });
19492 if (Object.keys(invalidProperties).length > 0) {
19493 console.warn("ag-grid: to see all the valid " + containerName + " properties please check: " + docsUrl);
19494 }
19495 };
19496 /**
19497 * Wrap the user callback and attach the api, columnApi and context to the params object on the way through.
19498 * @param callback User provided callback
19499 * @returns Wrapped callback where the params object not require api, columnApi and context
19500 */
19501 GridOptionsWrapper.prototype.mergeGridCommonParams = function (callback) {
19502 var _this = this;
19503 if (callback) {
19504 var wrapped = function (callbackParams) {
19505 var mergedParams = __assign$9(__assign$9({}, callbackParams), { api: _this.getApi(), columnApi: _this.getColumnApi(), context: _this.getContext() });
19506 return callback(mergedParams);
19507 };
19508 return wrapped;
19509 }
19510 return callback;
19511 };
19512 GridOptionsWrapper.prototype.getDomDataKey = function () {
19513 return this.domDataKey;
19514 };
19515 // returns the dom data, or undefined if not found
19516 GridOptionsWrapper.prototype.getDomData = function (element, key) {
19517 var domData = element[this.getDomDataKey()];
19518 return domData ? domData[key] : undefined;
19519 };
19520 GridOptionsWrapper.prototype.setDomData = function (element, key, value) {
19521 var domDataKey = this.getDomDataKey();
19522 var domData = element[domDataKey];
19523 if (missing(domData)) {
19524 domData = {};
19525 element[domDataKey] = domData;
19526 }
19527 domData[key] = value;
19528 };
19529 GridOptionsWrapper.prototype.isRowSelection = function () {
19530 return this.gridOptions.rowSelection === 'single' || this.gridOptions.rowSelection === 'multiple';
19531 };
19532 GridOptionsWrapper.prototype.isSuppressRowDeselection = function () {
19533 return isTrue(this.gridOptions.suppressRowDeselection);
19534 };
19535 GridOptionsWrapper.prototype.isRowSelectionMulti = function () {
19536 return this.gridOptions.rowSelection === 'multiple';
19537 };
19538 GridOptionsWrapper.prototype.isRowMultiSelectWithClick = function () {
19539 return isTrue(this.gridOptions.rowMultiSelectWithClick);
19540 };
19541 GridOptionsWrapper.prototype.getContext = function () {
19542 return this.gridOptions.context;
19543 };
19544 GridOptionsWrapper.prototype.isPivotMode = function () {
19545 return isTrue(this.gridOptions.pivotMode);
19546 };
19547 GridOptionsWrapper.prototype.isSuppressExpandablePivotGroups = function () {
19548 return isTrue(this.gridOptions.suppressExpandablePivotGroups);
19549 };
19550 GridOptionsWrapper.prototype.getPivotColumnGroupTotals = function () {
19551 return this.gridOptions.pivotColumnGroupTotals;
19552 };
19553 GridOptionsWrapper.prototype.getPivotRowTotals = function () {
19554 return this.gridOptions.pivotRowTotals;
19555 };
19556 GridOptionsWrapper.prototype.isRowModelInfinite = function () {
19557 return this.gridOptions.rowModelType === Constants.ROW_MODEL_TYPE_INFINITE;
19558 };
19559 GridOptionsWrapper.prototype.isRowModelViewport = function () {
19560 return this.gridOptions.rowModelType === Constants.ROW_MODEL_TYPE_VIEWPORT;
19561 };
19562 GridOptionsWrapper.prototype.isRowModelServerSide = function () {
19563 return this.gridOptions.rowModelType === Constants.ROW_MODEL_TYPE_SERVER_SIDE;
19564 };
19565 GridOptionsWrapper.prototype.isRowModelDefault = function () {
19566 return (missing(this.gridOptions.rowModelType) ||
19567 this.gridOptions.rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE);
19568 };
19569 GridOptionsWrapper.prototype.isFullRowEdit = function () {
19570 return this.gridOptions.editType === 'fullRow';
19571 };
19572 GridOptionsWrapper.prototype.isSuppressFocusAfterRefresh = function () {
19573 return isTrue(this.gridOptions.suppressFocusAfterRefresh);
19574 };
19575 GridOptionsWrapper.prototype.isSuppressBrowserResizeObserver = function () {
19576 return isTrue(this.gridOptions.suppressBrowserResizeObserver);
19577 };
19578 GridOptionsWrapper.prototype.isSuppressMaintainUnsortedOrder = function () {
19579 return isTrue(this.gridOptions.suppressMaintainUnsortedOrder);
19580 };
19581 GridOptionsWrapper.prototype.isSuppressClearOnFillReduction = function () {
19582 return isTrue(this.gridOptions.suppressClearOnFillReduction);
19583 };
19584 GridOptionsWrapper.prototype.isShowToolPanel = function () {
19585 return isTrue(this.gridOptions.sideBar && Array.isArray(this.getSideBar().toolPanels));
19586 };
19587 GridOptionsWrapper.prototype.getSideBar = function () {
19588 return this.gridOptions.sideBar;
19589 };
19590 GridOptionsWrapper.prototype.isSuppressTouch = function () {
19591 return isTrue(this.gridOptions.suppressTouch);
19592 };
19593 GridOptionsWrapper.prototype.isMaintainColumnOrder = function () {
19594 return isTrue(this.gridOptions.maintainColumnOrder);
19595 };
19596 GridOptionsWrapper.prototype.isSuppressRowTransform = function () {
19597 return isTrue(this.gridOptions.suppressRowTransform);
19598 };
19599 GridOptionsWrapper.prototype.isSuppressColumnStateEvents = function () {
19600 return isTrue(this.gridOptions.suppressColumnStateEvents);
19601 };
19602 GridOptionsWrapper.prototype.isAllowDragFromColumnsToolPanel = function () {
19603 return isTrue(this.gridOptions.allowDragFromColumnsToolPanel);
19604 };
19605 GridOptionsWrapper.prototype.useAsyncEvents = function () {
19606 return !isTrue(this.gridOptions.suppressAsyncEvents);
19607 };
19608 GridOptionsWrapper.prototype.isEnableCellChangeFlash = function () {
19609 return isTrue(this.gridOptions.enableCellChangeFlash);
19610 };
19611 GridOptionsWrapper.prototype.getCellFlashDelay = function () {
19612 return this.gridOptions.cellFlashDelay || 500;
19613 };
19614 GridOptionsWrapper.prototype.getCellFadeDelay = function () {
19615 return this.gridOptions.cellFadeDelay || 1000;
19616 };
19617 GridOptionsWrapper.prototype.isGroupSelectsChildren = function () {
19618 return isTrue(this.gridOptions.groupSelectsChildren);
19619 };
19620 GridOptionsWrapper.prototype.isSuppressRowHoverHighlight = function () {
19621 return isTrue(this.gridOptions.suppressRowHoverHighlight);
19622 };
19623 GridOptionsWrapper.prototype.isColumnHoverHighlight = function () {
19624 return isTrue(this.gridOptions.columnHoverHighlight);
19625 };
19626 GridOptionsWrapper.prototype.isGroupSelectsFiltered = function () {
19627 return isTrue(this.gridOptions.groupSelectsFiltered);
19628 };
19629 GridOptionsWrapper.prototype.isGroupHideOpenParents = function () {
19630 return isTrue(this.gridOptions.groupHideOpenParents);
19631 };
19632 GridOptionsWrapper.prototype.isGroupMaintainOrder = function () {
19633 return isTrue(this.gridOptions.groupMaintainOrder);
19634 };
19635 GridOptionsWrapper.prototype.getAutoGroupColumnDef = function () {
19636 return this.gridOptions.autoGroupColumnDef;
19637 };
19638 GridOptionsWrapper.prototype.isGroupMultiAutoColumn = function () {
19639 if (this.gridOptions.groupDisplayType) {
19640 return this.matchesGroupDisplayType('multipleColumns', this.gridOptions.groupDisplayType);
19641 }
19642 // if we are doing hideOpenParents we also show multiple columns, otherwise hideOpenParents would not work
19643 return isTrue(this.gridOptions.groupHideOpenParents);
19644 };
19645 GridOptionsWrapper.prototype.isGroupUseEntireRow = function (pivotMode) {
19646 // we never allow groupUseEntireRow if in pivot mode, otherwise we won't see the pivot values.
19647 if (pivotMode) {
19648 return false;
19649 }
19650 return this.gridOptions.groupDisplayType ?
19651 this.matchesGroupDisplayType('groupRows', this.gridOptions.groupDisplayType) : false;
19652 };
19653 GridOptionsWrapper.prototype.isGroupSuppressAutoColumn = function () {
19654 var isCustomRowGroups = this.gridOptions.groupDisplayType ?
19655 this.matchesGroupDisplayType('custom', this.gridOptions.groupDisplayType) : false;
19656 if (isCustomRowGroups) {
19657 return true;
19658 }
19659 return this.gridOptions.treeDataDisplayType ?
19660 this.matchesTreeDataDisplayType('custom', this.gridOptions.treeDataDisplayType) : false;
19661 };
19662 GridOptionsWrapper.prototype.isGroupRemoveSingleChildren = function () {
19663 return isTrue(this.gridOptions.groupRemoveSingleChildren);
19664 };
19665 GridOptionsWrapper.prototype.isGroupRemoveLowestSingleChildren = function () {
19666 return isTrue(this.gridOptions.groupRemoveLowestSingleChildren);
19667 };
19668 GridOptionsWrapper.prototype.isGroupIncludeFooter = function () {
19669 return isTrue(this.gridOptions.groupIncludeFooter);
19670 };
19671 GridOptionsWrapper.prototype.isGroupIncludeTotalFooter = function () {
19672 return isTrue(this.gridOptions.groupIncludeTotalFooter);
19673 };
19674 GridOptionsWrapper.prototype.isGroupSuppressBlankHeader = function () {
19675 return isTrue(this.gridOptions.groupSuppressBlankHeader);
19676 };
19677 GridOptionsWrapper.prototype.isSuppressRowClickSelection = function () {
19678 return isTrue(this.gridOptions.suppressRowClickSelection);
19679 };
19680 GridOptionsWrapper.prototype.isSuppressCellFocus = function () {
19681 return isTrue(this.gridOptions.suppressCellFocus);
19682 };
19683 GridOptionsWrapper.prototype.isSuppressMultiSort = function () {
19684 return isTrue(this.gridOptions.suppressMultiSort);
19685 };
19686 GridOptionsWrapper.prototype.isAlwaysMultiSort = function () {
19687 return isTrue(this.gridOptions.alwaysMultiSort);
19688 };
19689 GridOptionsWrapper.prototype.isMultiSortKeyCtrl = function () {
19690 return this.gridOptions.multiSortKey === 'ctrl';
19691 };
19692 GridOptionsWrapper.prototype.isPivotSuppressAutoColumn = function () {
19693 return isTrue(this.gridOptions.pivotSuppressAutoColumn);
19694 };
19695 GridOptionsWrapper.prototype.isSuppressDragLeaveHidesColumns = function () {
19696 return isTrue(this.gridOptions.suppressDragLeaveHidesColumns);
19697 };
19698 GridOptionsWrapper.prototype.isSuppressScrollOnNewData = function () {
19699 return isTrue(this.gridOptions.suppressScrollOnNewData);
19700 };
19701 GridOptionsWrapper.prototype.isSuppressScrollWhenPopupsAreOpen = function () {
19702 return isTrue(this.gridOptions.suppressScrollWhenPopupsAreOpen);
19703 };
19704 GridOptionsWrapper.prototype.isRowDragEntireRow = function () {
19705 return isTrue(this.gridOptions.rowDragEntireRow);
19706 };
19707 GridOptionsWrapper.prototype.isSuppressRowDrag = function () {
19708 return isTrue(this.gridOptions.suppressRowDrag);
19709 };
19710 GridOptionsWrapper.prototype.isRowDragManaged = function () {
19711 return isTrue(this.gridOptions.rowDragManaged);
19712 };
19713 GridOptionsWrapper.prototype.isSuppressMoveWhenRowDragging = function () {
19714 return isTrue(this.gridOptions.suppressMoveWhenRowDragging);
19715 };
19716 GridOptionsWrapper.prototype.isRowDragMultiRow = function () {
19717 return isTrue(this.gridOptions.rowDragMultiRow);
19718 };
19719 // returns either 'print', 'autoHeight' or 'normal' (normal is the default)
19720 GridOptionsWrapper.prototype.getDomLayout = function () {
19721 var domLayout = this.gridOptions.domLayout || Constants.DOM_LAYOUT_NORMAL;
19722 var validLayouts = [
19723 Constants.DOM_LAYOUT_PRINT,
19724 Constants.DOM_LAYOUT_AUTO_HEIGHT,
19725 Constants.DOM_LAYOUT_NORMAL
19726 ];
19727 if (validLayouts.indexOf(domLayout) === -1) {
19728 doOnce(function () {
19729 return console.warn("AG Grid: " + domLayout + " is not valid for DOM Layout, valid values are " + Constants.DOM_LAYOUT_NORMAL + ", " + Constants.DOM_LAYOUT_AUTO_HEIGHT + " and " + Constants.DOM_LAYOUT_PRINT);
19730 }, 'warn about dom layout values');
19731 return Constants.DOM_LAYOUT_NORMAL;
19732 }
19733 return domLayout;
19734 };
19735 GridOptionsWrapper.prototype.isSuppressHorizontalScroll = function () {
19736 return isTrue(this.gridOptions.suppressHorizontalScroll);
19737 };
19738 GridOptionsWrapper.prototype.isSuppressMaxRenderedRowRestriction = function () {
19739 return isTrue(this.gridOptions.suppressMaxRenderedRowRestriction);
19740 };
19741 GridOptionsWrapper.prototype.isExcludeChildrenWhenTreeDataFiltering = function () {
19742 return isTrue(this.gridOptions.excludeChildrenWhenTreeDataFiltering);
19743 };
19744 GridOptionsWrapper.prototype.isAlwaysShowHorizontalScroll = function () {
19745 return isTrue(this.gridOptions.alwaysShowHorizontalScroll);
19746 };
19747 GridOptionsWrapper.prototype.isAlwaysShowVerticalScroll = function () {
19748 return isTrue(this.gridOptions.alwaysShowVerticalScroll);
19749 };
19750 GridOptionsWrapper.prototype.isDebounceVerticalScrollbar = function () {
19751 return isTrue(this.gridOptions.debounceVerticalScrollbar);
19752 };
19753 GridOptionsWrapper.prototype.isSuppressLoadingOverlay = function () {
19754 return isTrue(this.gridOptions.suppressLoadingOverlay);
19755 };
19756 GridOptionsWrapper.prototype.isSuppressNoRowsOverlay = function () {
19757 return isTrue(this.gridOptions.suppressNoRowsOverlay);
19758 };
19759 GridOptionsWrapper.prototype.isSuppressFieldDotNotation = function () {
19760 return isTrue(this.gridOptions.suppressFieldDotNotation);
19761 };
19762 GridOptionsWrapper.prototype.getPinnedTopRowData = function () {
19763 return this.gridOptions.pinnedTopRowData;
19764 };
19765 GridOptionsWrapper.prototype.getPinnedBottomRowData = function () {
19766 return this.gridOptions.pinnedBottomRowData;
19767 };
19768 GridOptionsWrapper.prototype.isFunctionsPassive = function () {
19769 return isTrue(this.gridOptions.functionsPassive);
19770 };
19771 GridOptionsWrapper.prototype.isSuppressChangeDetection = function () {
19772 return isTrue(this.gridOptions.suppressChangeDetection);
19773 };
19774 GridOptionsWrapper.prototype.isSuppressAnimationFrame = function () {
19775 return isTrue(this.gridOptions.suppressAnimationFrame);
19776 };
19777 GridOptionsWrapper.prototype.getQuickFilterText = function () {
19778 return this.gridOptions.quickFilterText;
19779 };
19780 GridOptionsWrapper.prototype.isCacheQuickFilter = function () {
19781 return isTrue(this.gridOptions.cacheQuickFilter);
19782 };
19783 GridOptionsWrapper.prototype.isUnSortIcon = function () {
19784 return isTrue(this.gridOptions.unSortIcon);
19785 };
19786 GridOptionsWrapper.prototype.isSuppressMenuHide = function () {
19787 return isTrue(this.gridOptions.suppressMenuHide);
19788 };
19789 GridOptionsWrapper.prototype.isEnterMovesDownAfterEdit = function () {
19790 return isTrue(this.gridOptions.enterMovesDownAfterEdit);
19791 };
19792 GridOptionsWrapper.prototype.isEnterMovesDown = function () {
19793 return isTrue(this.gridOptions.enterMovesDown);
19794 };
19795 GridOptionsWrapper.prototype.isUndoRedoCellEditing = function () {
19796 return isTrue(this.gridOptions.undoRedoCellEditing);
19797 };
19798 GridOptionsWrapper.prototype.getUndoRedoCellEditingLimit = function () {
19799 return toNumber(this.gridOptions.undoRedoCellEditingLimit);
19800 };
19801 GridOptionsWrapper.prototype.getRowStyle = function () {
19802 return this.gridOptions.rowStyle;
19803 };
19804 GridOptionsWrapper.prototype.getRowClass = function () {
19805 return this.gridOptions.rowClass;
19806 };
19807 GridOptionsWrapper.prototype.getRowStyleFunc = function () {
19808 return this.mergeGridCommonParams(this.gridOptions.getRowStyle);
19809 };
19810 GridOptionsWrapper.prototype.getRowClassFunc = function () {
19811 return this.mergeGridCommonParams(this.gridOptions.getRowClass);
19812 };
19813 GridOptionsWrapper.prototype.rowClassRules = function () {
19814 return this.gridOptions.rowClassRules;
19815 };
19816 GridOptionsWrapper.prototype.getServerSideStoreType = function () {
19817 return this.gridOptions.serverSideStoreType;
19818 };
19819 GridOptionsWrapper.prototype.getServerSideStoreParamsFunc = function () {
19820 return this.mergeGridCommonParams(this.gridOptions.getServerSideStoreParams);
19821 };
19822 GridOptionsWrapper.prototype.getCreateChartContainerFunc = function () {
19823 return this.mergeGridCommonParams(this.gridOptions.createChartContainer);
19824 };
19825 GridOptionsWrapper.prototype.getPopupParent = function () {
19826 return this.gridOptions.popupParent;
19827 };
19828 GridOptionsWrapper.prototype.getBlockLoadDebounceMillis = function () {
19829 return this.gridOptions.blockLoadDebounceMillis;
19830 };
19831 GridOptionsWrapper.prototype.getPostProcessPopupFunc = function () {
19832 return this.mergeGridCommonParams(this.gridOptions.postProcessPopup);
19833 };
19834 GridOptionsWrapper.prototype.getPaginationNumberFormatterFunc = function () {
19835 return this.mergeGridCommonParams(this.gridOptions.paginationNumberFormatter);
19836 };
19837 GridOptionsWrapper.prototype.getChildCountFunc = function () {
19838 return this.gridOptions.getChildCount;
19839 };
19840 GridOptionsWrapper.prototype.getIsApplyServerSideTransactionFunc = function () {
19841 return this.mergeGridCommonParams(this.gridOptions.isApplyServerSideTransaction);
19842 };
19843 GridOptionsWrapper.prototype.getInitialGroupOrderComparator = function () {
19844 var _a = this.gridOptions, initialGroupOrderComparator = _a.initialGroupOrderComparator, defaultGroupOrderComparator = _a.defaultGroupOrderComparator;
19845 if (initialGroupOrderComparator) {
19846 return this.mergeGridCommonParams(initialGroupOrderComparator);
19847 }
19848 // this is the deprecated way, so provide a proxy to make it compatible
19849 if (defaultGroupOrderComparator) {
19850 return function (params) { return defaultGroupOrderComparator(params.nodeA, params.nodeB); };
19851 }
19852 };
19853 GridOptionsWrapper.prototype.getIsFullWidthCellFunc = function () {
19854 var _a = this.gridOptions, isFullWidthRow = _a.isFullWidthRow, isFullWidthCell = _a.isFullWidthCell;
19855 if (isFullWidthRow) {
19856 return this.mergeGridCommonParams(isFullWidthRow);
19857 }
19858 // this is the deprecated way, so provide a proxy to make it compatible
19859 if (isFullWidthCell) {
19860 return function (params) { return isFullWidthCell(params.rowNode); };
19861 }
19862 };
19863 GridOptionsWrapper.prototype.getFullWidthCellRendererParams = function () {
19864 return this.gridOptions.fullWidthCellRendererParams;
19865 };
19866 GridOptionsWrapper.prototype.isEmbedFullWidthRows = function () {
19867 return isTrue(this.gridOptions.embedFullWidthRows) || isTrue(this.gridOptions.deprecatedEmbedFullWidthRows);
19868 };
19869 GridOptionsWrapper.prototype.isDetailRowAutoHeight = function () {
19870 return isTrue(this.gridOptions.detailRowAutoHeight);
19871 };
19872 GridOptionsWrapper.prototype.getSuppressKeyboardEventFunc = function () {
19873 return this.gridOptions.suppressKeyboardEvent;
19874 };
19875 GridOptionsWrapper.prototype.getBusinessKeyForNodeFunc = function () {
19876 return this.gridOptions.getBusinessKeyForNode;
19877 };
19878 GridOptionsWrapper.prototype.getApi = function () {
19879 return this.gridOptions.api;
19880 };
19881 GridOptionsWrapper.prototype.getColumnApi = function () {
19882 return this.gridOptions.columnApi;
19883 };
19884 GridOptionsWrapper.prototype.isReadOnlyEdit = function () {
19885 return isTrue(this.gridOptions.readOnlyEdit);
19886 };
19887 GridOptionsWrapper.prototype.isImmutableData = function () {
19888 // we used to have a property immutableData for this. however this was deprecated
19889 // in favour of having Immutable Data on by default when getRowId is provided
19890 var getRowIdProvided = this.gridOptions.getRowId != null;
19891 var immutableData = isTrue(this.gridOptions.immutableData);
19892 // this property is a backwards compatibility property, for those who want
19893 // the old behaviour of Row ID's but NOT Immutable Data.
19894 var resetRowDataOnUpdate = isTrue(this.gridOptions.resetRowDataOnUpdate);
19895 if (resetRowDataOnUpdate) {
19896 return false;
19897 }
19898 return getRowIdProvided || immutableData;
19899 };
19900 GridOptionsWrapper.prototype.isEnsureDomOrder = function () {
19901 return isTrue(this.gridOptions.ensureDomOrder);
19902 };
19903 GridOptionsWrapper.prototype.isEnableCharts = function () {
19904 if (isTrue(this.gridOptions.enableCharts)) {
19905 return ModuleRegistry.assertRegistered(exports.ModuleNames.GridChartsModule, 'enableCharts');
19906 }
19907 return false;
19908 };
19909 GridOptionsWrapper.prototype.getColResizeDefault = function () {
19910 return this.gridOptions.colResizeDefault;
19911 };
19912 GridOptionsWrapper.prototype.isSingleClickEdit = function () {
19913 return isTrue(this.gridOptions.singleClickEdit);
19914 };
19915 GridOptionsWrapper.prototype.isSuppressClickEdit = function () {
19916 return isTrue(this.gridOptions.suppressClickEdit);
19917 };
19918 GridOptionsWrapper.prototype.isStopEditingWhenCellsLoseFocus = function () {
19919 return isTrue(this.gridOptions.stopEditingWhenCellsLoseFocus);
19920 };
19921 GridOptionsWrapper.prototype.getGroupDefaultExpanded = function () {
19922 return this.gridOptions.groupDefaultExpanded;
19923 };
19924 GridOptionsWrapper.prototype.getMaxConcurrentDatasourceRequests = function () {
19925 var res = toNumber(this.gridOptions.maxConcurrentDatasourceRequests);
19926 if (res == null) {
19927 return 2;
19928 } // 2 is the default
19929 if (res <= 0) {
19930 return;
19931 } // negative number, eg -1, means no max restriction
19932 return res;
19933 };
19934 GridOptionsWrapper.prototype.getMaxBlocksInCache = function () {
19935 return this.gridOptions.maxBlocksInCache;
19936 };
19937 GridOptionsWrapper.prototype.getCacheOverflowSize = function () {
19938 return this.gridOptions.cacheOverflowSize;
19939 };
19940 GridOptionsWrapper.prototype.getPaginationPageSize = function () {
19941 return toNumber(this.gridOptions.paginationPageSize);
19942 };
19943 GridOptionsWrapper.prototype.isPaginateChildRows = function () {
19944 var shouldPaginate = this.isGroupRemoveSingleChildren() || this.isGroupRemoveLowestSingleChildren();
19945 if (shouldPaginate) {
19946 return true;
19947 }
19948 return isTrue(this.gridOptions.paginateChildRows);
19949 };
19950 GridOptionsWrapper.prototype.getCacheBlockSize = function () {
19951 return oneOrGreater(this.gridOptions.cacheBlockSize);
19952 };
19953 GridOptionsWrapper.prototype.getInfiniteInitialRowCount = function () {
19954 return this.gridOptions.infiniteInitialRowCount;
19955 };
19956 GridOptionsWrapper.prototype.isPurgeClosedRowNodes = function () {
19957 return isTrue(this.gridOptions.purgeClosedRowNodes);
19958 };
19959 GridOptionsWrapper.prototype.isSuppressPaginationPanel = function () {
19960 return isTrue(this.gridOptions.suppressPaginationPanel);
19961 };
19962 GridOptionsWrapper.prototype.getRowData = function () {
19963 return this.gridOptions.rowData;
19964 };
19965 GridOptionsWrapper.prototype.isEnableRtl = function () {
19966 return isTrue(this.gridOptions.enableRtl);
19967 };
19968 GridOptionsWrapper.prototype.getRowGroupPanelShow = function () {
19969 return this.gridOptions.rowGroupPanelShow;
19970 };
19971 GridOptionsWrapper.prototype.getPivotPanelShow = function () {
19972 return this.gridOptions.pivotPanelShow;
19973 };
19974 GridOptionsWrapper.prototype.isAngularCompileRows = function () {
19975 return isTrue(this.gridOptions.angularCompileRows);
19976 };
19977 GridOptionsWrapper.prototype.isAngularCompileFilters = function () {
19978 return isTrue(this.gridOptions.angularCompileFilters);
19979 };
19980 GridOptionsWrapper.prototype.isDebug = function () {
19981 return isTrue(this.gridOptions.debug);
19982 };
19983 GridOptionsWrapper.prototype.getColumnDefs = function () {
19984 return this.gridOptions.columnDefs;
19985 };
19986 GridOptionsWrapper.prototype.getColumnTypes = function () {
19987 return this.gridOptions.columnTypes;
19988 };
19989 GridOptionsWrapper.prototype.getDatasource = function () {
19990 return this.gridOptions.datasource;
19991 };
19992 GridOptionsWrapper.prototype.getViewportDatasource = function () {
19993 return this.gridOptions.viewportDatasource;
19994 };
19995 GridOptionsWrapper.prototype.getServerSideDatasource = function () {
19996 return this.gridOptions.serverSideDatasource;
19997 };
19998 GridOptionsWrapper.prototype.isAccentedSort = function () {
19999 return isTrue(this.gridOptions.accentedSort);
20000 };
20001 GridOptionsWrapper.prototype.isEnableBrowserTooltips = function () {
20002 return isTrue(this.gridOptions.enableBrowserTooltips);
20003 };
20004 GridOptionsWrapper.prototype.isEnableCellExpressions = function () {
20005 return isTrue(this.gridOptions.enableCellExpressions);
20006 };
20007 GridOptionsWrapper.prototype.isEnableGroupEdit = function () {
20008 return isTrue(this.gridOptions.enableGroupEdit);
20009 };
20010 GridOptionsWrapper.prototype.isSuppressMiddleClickScrolls = function () {
20011 return isTrue(this.gridOptions.suppressMiddleClickScrolls);
20012 };
20013 GridOptionsWrapper.prototype.isPreventDefaultOnContextMenu = function () {
20014 return isTrue(this.gridOptions.preventDefaultOnContextMenu);
20015 };
20016 GridOptionsWrapper.prototype.isSuppressPreventDefaultOnMouseWheel = function () {
20017 return isTrue(this.gridOptions.suppressPreventDefaultOnMouseWheel);
20018 };
20019 GridOptionsWrapper.prototype.isSuppressColumnVirtualisation = function () {
20020 return isTrue(this.gridOptions.suppressColumnVirtualisation);
20021 };
20022 GridOptionsWrapper.prototype.isSuppressRowVirtualisation = function () {
20023 return isTrue(this.gridOptions.suppressRowVirtualisation);
20024 };
20025 GridOptionsWrapper.prototype.isSuppressContextMenu = function () {
20026 return isTrue(this.gridOptions.suppressContextMenu);
20027 };
20028 GridOptionsWrapper.prototype.isAllowContextMenuWithControlKey = function () {
20029 return isTrue(this.gridOptions.allowContextMenuWithControlKey);
20030 };
20031 GridOptionsWrapper.prototype.isSuppressCopyRowsToClipboard = function () {
20032 return isTrue(this.gridOptions.suppressCopyRowsToClipboard);
20033 };
20034 GridOptionsWrapper.prototype.isSuppressCopySingleCellRanges = function () {
20035 return isTrue(this.gridOptions.suppressCopySingleCellRanges);
20036 };
20037 GridOptionsWrapper.prototype.isCopyHeadersToClipboard = function () {
20038 return isTrue(this.gridOptions.copyHeadersToClipboard);
20039 };
20040 GridOptionsWrapper.prototype.isCopyGroupHeadersToClipboard = function () {
20041 return isTrue(this.gridOptions.copyGroupHeadersToClipboard);
20042 };
20043 GridOptionsWrapper.prototype.isSuppressClipboardPaste = function () {
20044 return isTrue(this.gridOptions.suppressClipboardPaste);
20045 };
20046 GridOptionsWrapper.prototype.isSuppressLastEmptyLineOnPaste = function () {
20047 return isTrue(this.gridOptions.suppressLastEmptyLineOnPaste);
20048 };
20049 GridOptionsWrapper.prototype.isPagination = function () {
20050 return isTrue(this.gridOptions.pagination);
20051 };
20052 GridOptionsWrapper.prototype.isSuppressEnterpriseResetOnNewColumns = function () {
20053 return isTrue(this.gridOptions.suppressEnterpriseResetOnNewColumns);
20054 };
20055 GridOptionsWrapper.prototype.getProcessDataFromClipboardFunc = function () {
20056 return this.mergeGridCommonParams(this.gridOptions.processDataFromClipboard);
20057 };
20058 GridOptionsWrapper.prototype.getAsyncTransactionWaitMillis = function () {
20059 return exists(this.gridOptions.asyncTransactionWaitMillis) ? this.gridOptions.asyncTransactionWaitMillis : Constants.BATCH_WAIT_MILLIS;
20060 };
20061 GridOptionsWrapper.prototype.isSuppressMovableColumns = function () {
20062 return isTrue(this.gridOptions.suppressMovableColumns);
20063 };
20064 GridOptionsWrapper.prototype.isAnimateRows = function () {
20065 // never allow animating if enforcing the row order
20066 if (this.isEnsureDomOrder()) {
20067 return false;
20068 }
20069 return isTrue(this.gridOptions.animateRows);
20070 };
20071 GridOptionsWrapper.prototype.isSuppressColumnMoveAnimation = function () {
20072 return isTrue(this.gridOptions.suppressColumnMoveAnimation);
20073 };
20074 GridOptionsWrapper.prototype.isSuppressAggFuncInHeader = function () {
20075 return isTrue(this.gridOptions.suppressAggFuncInHeader);
20076 };
20077 GridOptionsWrapper.prototype.isSuppressAggAtRootLevel = function () {
20078 return isTrue(this.gridOptions.suppressAggAtRootLevel);
20079 };
20080 GridOptionsWrapper.prototype.isSuppressAggFilteredOnly = function () {
20081 var isGroupAggFiltering = this.getGroupAggFiltering() !== undefined;
20082 return isGroupAggFiltering || isTrue(this.gridOptions.suppressAggFilteredOnly);
20083 };
20084 GridOptionsWrapper.prototype.isRemovePivotHeaderRowWhenSingleValueColumn = function () {
20085 return isTrue(this.gridOptions.removePivotHeaderRowWhenSingleValueColumn);
20086 };
20087 GridOptionsWrapper.prototype.isShowOpenedGroup = function () {
20088 return isTrue(this.gridOptions.showOpenedGroup);
20089 };
20090 GridOptionsWrapper.prototype.isReactUi = function () {
20091 return isTrue(this.gridOptions.reactUi);
20092 };
20093 GridOptionsWrapper.prototype.isSuppressReactUi = function () {
20094 return isTrue(this.gridOptions.suppressReactUi);
20095 };
20096 GridOptionsWrapper.prototype.isEnableRangeSelection = function () {
20097 return ModuleRegistry.isRegistered(exports.ModuleNames.RangeSelectionModule) && isTrue(this.gridOptions.enableRangeSelection);
20098 };
20099 GridOptionsWrapper.prototype.isEnableRangeHandle = function () {
20100 return isTrue(this.gridOptions.enableRangeHandle);
20101 };
20102 GridOptionsWrapper.prototype.isEnableFillHandle = function () {
20103 return isTrue(this.gridOptions.enableFillHandle);
20104 };
20105 GridOptionsWrapper.prototype.getFillHandleDirection = function () {
20106 var direction = this.gridOptions.fillHandleDirection;
20107 if (!direction) {
20108 return 'xy';
20109 }
20110 if (direction !== 'x' && direction !== 'y' && direction !== 'xy') {
20111 doOnce(function () { return console.warn("AG Grid: valid values for fillHandleDirection are 'x', 'y' and 'xy'. Default to 'xy'."); }, 'warn invalid fill direction');
20112 return 'xy';
20113 }
20114 return direction;
20115 };
20116 GridOptionsWrapper.prototype.getFillOperation = function () {
20117 return this.mergeGridCommonParams(this.gridOptions.fillOperation);
20118 };
20119 GridOptionsWrapper.prototype.isSuppressMultiRangeSelection = function () {
20120 return isTrue(this.gridOptions.suppressMultiRangeSelection);
20121 };
20122 GridOptionsWrapper.prototype.isPaginationAutoPageSize = function () {
20123 return isTrue(this.gridOptions.paginationAutoPageSize);
20124 };
20125 GridOptionsWrapper.prototype.isRememberGroupStateWhenNewData = function () {
20126 return isTrue(this.gridOptions.rememberGroupStateWhenNewData);
20127 };
20128 GridOptionsWrapper.prototype.getIcons = function () {
20129 return this.gridOptions.icons;
20130 };
20131 GridOptionsWrapper.prototype.getGroupAggFiltering = function () {
20132 var userValue = this.gridOptions.groupAggFiltering;
20133 if (typeof userValue === 'function') {
20134 return this.mergeGridCommonParams(userValue);
20135 }
20136 if (isTrue(userValue)) {
20137 return function () { return true; };
20138 }
20139 return undefined;
20140 };
20141 GridOptionsWrapper.prototype.getAggFuncs = function () {
20142 return this.gridOptions.aggFuncs;
20143 };
20144 GridOptionsWrapper.prototype.getSortingOrder = function () {
20145 return this.gridOptions.sortingOrder;
20146 };
20147 GridOptionsWrapper.prototype.getAlignedGrids = function () {
20148 return this.gridOptions.alignedGrids;
20149 };
20150 GridOptionsWrapper.prototype.isMasterDetail = function () {
20151 var masterDetail = isTrue(this.gridOptions.masterDetail);
20152 if (masterDetail) {
20153 return ModuleRegistry.assertRegistered(exports.ModuleNames.MasterDetailModule, 'masterDetail');
20154 }
20155 else {
20156 return false;
20157 }
20158 };
20159 GridOptionsWrapper.prototype.isKeepDetailRows = function () {
20160 return isTrue(this.gridOptions.keepDetailRows);
20161 };
20162 GridOptionsWrapper.prototype.getKeepDetailRowsCount = function () {
20163 var keepDetailRowsCount = this.gridOptions.keepDetailRowsCount;
20164 if (exists(keepDetailRowsCount) && keepDetailRowsCount > 0) {
20165 return this.gridOptions.keepDetailRowsCount;
20166 }
20167 return DEFAULT_KEEP_DETAIL_ROW_COUNT;
20168 };
20169 GridOptionsWrapper.prototype.getIsRowMasterFunc = function () {
20170 return this.gridOptions.isRowMaster;
20171 };
20172 GridOptionsWrapper.prototype.getIsRowSelectableFunc = function () {
20173 return this.gridOptions.isRowSelectable;
20174 };
20175 GridOptionsWrapper.prototype.getGroupRowRendererParams = function () {
20176 return this.gridOptions.groupRowRendererParams;
20177 };
20178 GridOptionsWrapper.prototype.getOverlayLoadingTemplate = function () {
20179 return this.gridOptions.overlayLoadingTemplate;
20180 };
20181 GridOptionsWrapper.prototype.getOverlayNoRowsTemplate = function () {
20182 return this.gridOptions.overlayNoRowsTemplate;
20183 };
20184 GridOptionsWrapper.prototype.isSuppressAutoSize = function () {
20185 return isTrue(this.gridOptions.suppressAutoSize);
20186 };
20187 GridOptionsWrapper.prototype.isEnableCellTextSelection = function () {
20188 return isTrue(this.gridOptions.enableCellTextSelection);
20189 };
20190 GridOptionsWrapper.prototype.isSuppressParentsInRowNodes = function () {
20191 return isTrue(this.gridOptions.suppressParentsInRowNodes);
20192 };
20193 GridOptionsWrapper.prototype.isSuppressClipboardApi = function () {
20194 return isTrue(this.gridOptions.suppressClipboardApi);
20195 };
20196 GridOptionsWrapper.prototype.isFunctionsReadOnly = function () {
20197 return isTrue(this.gridOptions.functionsReadOnly);
20198 };
20199 GridOptionsWrapper.prototype.isEnableCellTextSelect = function () {
20200 return isTrue(this.gridOptions.enableCellTextSelection);
20201 };
20202 GridOptionsWrapper.prototype.getDefaultColDef = function () {
20203 return this.gridOptions.defaultColDef;
20204 };
20205 GridOptionsWrapper.prototype.getDefaultColGroupDef = function () {
20206 return this.gridOptions.defaultColGroupDef;
20207 };
20208 GridOptionsWrapper.prototype.getDefaultExportParams = function (type) {
20209 if (this.gridOptions.defaultExportParams) {
20210 console.warn("AG Grid: Since v25.2 `defaultExportParams` has been replaced by `default" + capitalise(type) + "ExportParams`'");
20211 if (type === 'csv') {
20212 return this.gridOptions.defaultExportParams;
20213 }
20214 return this.gridOptions.defaultExportParams;
20215 }
20216 if (type === 'csv' && this.gridOptions.defaultCsvExportParams) {
20217 return this.gridOptions.defaultCsvExportParams;
20218 }
20219 if (type === 'excel' && this.gridOptions.defaultExcelExportParams) {
20220 return this.gridOptions.defaultExcelExportParams;
20221 }
20222 };
20223 GridOptionsWrapper.prototype.isSuppressCsvExport = function () {
20224 return isTrue(this.gridOptions.suppressCsvExport);
20225 };
20226 GridOptionsWrapper.prototype.isAllowShowChangeAfterFilter = function () {
20227 return isTrue(this.gridOptions.allowShowChangeAfterFilter);
20228 };
20229 GridOptionsWrapper.prototype.isSuppressExcelExport = function () {
20230 return isTrue(this.gridOptions.suppressExcelExport);
20231 };
20232 GridOptionsWrapper.prototype.isSuppressMakeColumnVisibleAfterUnGroup = function () {
20233 return isTrue(this.gridOptions.suppressMakeColumnVisibleAfterUnGroup);
20234 };
20235 GridOptionsWrapper.prototype.getDataPathFunc = function () {
20236 return this.gridOptions.getDataPath;
20237 };
20238 GridOptionsWrapper.prototype.getIsServerSideGroupFunc = function () {
20239 return this.gridOptions.isServerSideGroup;
20240 };
20241 GridOptionsWrapper.prototype.getIsServerSideGroupOpenByDefaultFunc = function () {
20242 return this.mergeGridCommonParams(this.gridOptions.isServerSideGroupOpenByDefault);
20243 };
20244 GridOptionsWrapper.prototype.getIsGroupOpenByDefaultFunc = function () {
20245 return this.mergeGridCommonParams(this.gridOptions.isGroupOpenByDefault);
20246 };
20247 GridOptionsWrapper.prototype.getServerSideGroupKeyFunc = function () {
20248 return this.gridOptions.getServerSideGroupKey;
20249 };
20250 GridOptionsWrapper.prototype.getGroupRowAggFunc = function () {
20251 var _a = this.gridOptions, getGroupRowAgg = _a.getGroupRowAgg, groupRowAggNodes = _a.groupRowAggNodes;
20252 if (getGroupRowAgg) {
20253 return this.mergeGridCommonParams(getGroupRowAgg);
20254 }
20255 // this is the deprecated way, so provide a proxy to make it compatible
20256 if (groupRowAggNodes) {
20257 return function (params) { return groupRowAggNodes(params.nodes); };
20258 }
20259 };
20260 GridOptionsWrapper.prototype.getContextMenuItemsFunc = function () {
20261 return this.mergeGridCommonParams(this.gridOptions.getContextMenuItems);
20262 };
20263 GridOptionsWrapper.prototype.getMainMenuItemsFunc = function () {
20264 return this.mergeGridCommonParams(this.gridOptions.getMainMenuItems);
20265 };
20266 GridOptionsWrapper.prototype.getRowIdFunc = function () {
20267 var _a = this.gridOptions, getRowId = _a.getRowId, getRowNodeId = _a.getRowNodeId;
20268 if (getRowId) {
20269 return this.mergeGridCommonParams(getRowId);
20270 }
20271 // this is the deprecated way, so provide a proxy to make it compatible
20272 if (getRowNodeId) {
20273 return function (params) { return getRowNodeId(params.data); };
20274 }
20275 };
20276 GridOptionsWrapper.prototype.getNavigateToNextHeaderFunc = function () {
20277 return this.mergeGridCommonParams(this.gridOptions.navigateToNextHeader);
20278 };
20279 GridOptionsWrapper.prototype.getTabToNextHeaderFunc = function () {
20280 return this.mergeGridCommonParams(this.gridOptions.tabToNextHeader);
20281 };
20282 GridOptionsWrapper.prototype.getNavigateToNextCellFunc = function () {
20283 return this.mergeGridCommonParams(this.gridOptions.navigateToNextCell);
20284 };
20285 GridOptionsWrapper.prototype.getTabToNextCellFunc = function () {
20286 return this.mergeGridCommonParams(this.gridOptions.tabToNextCell);
20287 };
20288 GridOptionsWrapper.prototype.getGridTabIndex = function () {
20289 return (this.gridOptions.tabIndex || 0).toString();
20290 };
20291 GridOptionsWrapper.prototype.isTreeData = function () {
20292 var usingTreeData = isTrue(this.gridOptions.treeData);
20293 if (usingTreeData) {
20294 return ModuleRegistry.assertRegistered(exports.ModuleNames.RowGroupingModule, 'Tree Data');
20295 }
20296 return false;
20297 };
20298 GridOptionsWrapper.prototype.isValueCache = function () {
20299 return isTrue(this.gridOptions.valueCache);
20300 };
20301 GridOptionsWrapper.prototype.isValueCacheNeverExpires = function () {
20302 return isTrue(this.gridOptions.valueCacheNeverExpires);
20303 };
20304 GridOptionsWrapper.prototype.isDeltaSort = function () {
20305 return isTrue(this.gridOptions.deltaSort);
20306 };
20307 GridOptionsWrapper.prototype.isAggregateOnlyChangedColumns = function () {
20308 return isTrue(this.gridOptions.aggregateOnlyChangedColumns);
20309 };
20310 GridOptionsWrapper.prototype.getProcessSecondaryColDefFunc = function () {
20311 return this.gridOptions.processSecondaryColDef;
20312 };
20313 GridOptionsWrapper.prototype.getProcessSecondaryColGroupDefFunc = function () {
20314 return this.gridOptions.processSecondaryColGroupDef;
20315 };
20316 GridOptionsWrapper.prototype.getSendToClipboardFunc = function () {
20317 return this.mergeGridCommonParams(this.gridOptions.sendToClipboard);
20318 };
20319 GridOptionsWrapper.prototype.getProcessRowPostCreateFunc = function () {
20320 return this.mergeGridCommonParams(this.gridOptions.processRowPostCreate);
20321 };
20322 GridOptionsWrapper.prototype.getProcessCellForClipboardFunc = function () {
20323 return this.mergeGridCommonParams(this.gridOptions.processCellForClipboard);
20324 };
20325 GridOptionsWrapper.prototype.getProcessHeaderForClipboardFunc = function () {
20326 return this.mergeGridCommonParams(this.gridOptions.processHeaderForClipboard);
20327 };
20328 GridOptionsWrapper.prototype.getProcessGroupHeaderForClipboardFunc = function () {
20329 return this.mergeGridCommonParams(this.gridOptions.processGroupHeaderForClipboard);
20330 };
20331 GridOptionsWrapper.prototype.getProcessCellFromClipboardFunc = function () {
20332 return this.mergeGridCommonParams(this.gridOptions.processCellFromClipboard);
20333 };
20334 GridOptionsWrapper.prototype.getViewportRowModelPageSize = function () {
20335 return oneOrGreater(this.gridOptions.viewportRowModelPageSize, DEFAULT_VIEWPORT_ROW_MODEL_PAGE_SIZE);
20336 };
20337 GridOptionsWrapper.prototype.getViewportRowModelBufferSize = function () {
20338 return zeroOrGreater(this.gridOptions.viewportRowModelBufferSize, DEFAULT_VIEWPORT_ROW_MODEL_BUFFER_SIZE);
20339 };
20340 GridOptionsWrapper.prototype.isServerSideSortingAlwaysResets = function () {
20341 return isTrue(this.gridOptions.serverSideSortingAlwaysResets);
20342 };
20343 GridOptionsWrapper.prototype.isServerSideFilteringAlwaysResets = function () {
20344 return isTrue(this.gridOptions.serverSideFilteringAlwaysResets);
20345 };
20346 GridOptionsWrapper.prototype.getPostSortFunc = function () {
20347 var _a = this.gridOptions, postSortRows = _a.postSortRows, postSort = _a.postSort;
20348 if (postSortRows) {
20349 return this.mergeGridCommonParams(postSortRows);
20350 }
20351 // this is the deprecated way, so provide a proxy to make it compatible
20352 if (postSort) {
20353 return function (params) { return postSort(params.nodes); };
20354 }
20355 };
20356 GridOptionsWrapper.prototype.getChartToolbarItemsFunc = function () {
20357 return this.mergeGridCommonParams(this.gridOptions.getChartToolbarItems);
20358 };
20359 GridOptionsWrapper.prototype.getChartThemeOverrides = function () {
20360 return this.gridOptions.chartThemeOverrides;
20361 };
20362 GridOptionsWrapper.prototype.getCustomChartThemes = function () {
20363 return this.gridOptions.customChartThemes;
20364 };
20365 GridOptionsWrapper.prototype.getChartThemes = function () {
20366 // return default themes if user hasn't supplied any
20367 return this.gridOptions.chartThemes || ['ag-default', 'ag-material', 'ag-pastel', 'ag-vivid', 'ag-solar'];
20368 };
20369 GridOptionsWrapper.prototype.getClipboardDelimiter = function () {
20370 return exists(this.gridOptions.clipboardDelimiter) ? this.gridOptions.clipboardDelimiter : '\t';
20371 };
20372 GridOptionsWrapper.prototype.setProperty = function (key, value, force) {
20373 if (force === void 0) { force = false; }
20374 var gridOptionsNoType = this.gridOptions;
20375 var previousValue = gridOptionsNoType[key];
20376 if (force || previousValue !== value) {
20377 gridOptionsNoType[key] = value;
20378 var event_1 = {
20379 type: key,
20380 currentValue: value,
20381 previousValue: previousValue
20382 };
20383 this.propertyEventService.dispatchEvent(event_1);
20384 }
20385 };
20386 GridOptionsWrapper.prototype.addEventListener = function (key, listener) {
20387 this.propertyEventService.addEventListener(key, listener);
20388 };
20389 GridOptionsWrapper.prototype.removeEventListener = function (key, listener) {
20390 this.propertyEventService.removeEventListener(key, listener);
20391 };
20392 GridOptionsWrapper.prototype.isSkipHeaderOnAutoSize = function () {
20393 return !!this.gridOptions.skipHeaderOnAutoSize;
20394 };
20395 GridOptionsWrapper.prototype.getAutoSizePadding = function () {
20396 var value = this.gridOptions.autoSizePadding;
20397 return value != null && value >= 0 ? value : 20;
20398 };
20399 // properties
20400 GridOptionsWrapper.prototype.getHeaderHeight = function () {
20401 if (typeof this.gridOptions.headerHeight === 'number') {
20402 return this.gridOptions.headerHeight;
20403 }
20404 return this.getFromTheme(25, 'headerHeight');
20405 };
20406 GridOptionsWrapper.prototype.getFloatingFiltersHeight = function () {
20407 if (typeof this.gridOptions.floatingFiltersHeight === 'number') {
20408 return this.gridOptions.floatingFiltersHeight;
20409 }
20410 return this.getFromTheme(25, 'headerHeight');
20411 };
20412 GridOptionsWrapper.prototype.getGroupHeaderHeight = function () {
20413 if (typeof this.gridOptions.groupHeaderHeight === 'number') {
20414 return this.gridOptions.groupHeaderHeight;
20415 }
20416 return this.getHeaderHeight();
20417 };
20418 GridOptionsWrapper.prototype.getPivotHeaderHeight = function () {
20419 if (typeof this.gridOptions.pivotHeaderHeight === 'number') {
20420 return this.gridOptions.pivotHeaderHeight;
20421 }
20422 return this.getHeaderHeight();
20423 };
20424 GridOptionsWrapper.prototype.getPivotGroupHeaderHeight = function () {
20425 if (typeof this.gridOptions.pivotGroupHeaderHeight === 'number') {
20426 return this.gridOptions.pivotGroupHeaderHeight;
20427 }
20428 return this.getGroupHeaderHeight();
20429 };
20430 GridOptionsWrapper.prototype.isExternalFilterPresent = function () {
20431 if (typeof this.gridOptions.isExternalFilterPresent === 'function') {
20432 return this.gridOptions.isExternalFilterPresent({ api: this.getApi(), columnApi: this.getColumnApi(), context: this.getContext() });
20433 }
20434 return false;
20435 };
20436 GridOptionsWrapper.prototype.doesExternalFilterPass = function (node) {
20437 if (typeof this.gridOptions.doesExternalFilterPass === 'function') {
20438 return this.gridOptions.doesExternalFilterPass(node);
20439 }
20440 return false;
20441 };
20442 GridOptionsWrapper.prototype.getTooltipDelay = function (type) {
20443 var _a = this.gridOptions, tooltipShowDelay = _a.tooltipShowDelay, tooltipHideDelay = _a.tooltipHideDelay;
20444 var delay = type === 'show' ? tooltipShowDelay : tooltipHideDelay;
20445 var capitalisedType = capitalise(type);
20446 if (exists(delay)) {
20447 if (delay < 0) {
20448 doOnce(function () { return console.warn("ag-grid: tooltip" + capitalisedType + "Delay should not be lower than 0"); }, "tooltip" + capitalisedType + "DelayWarn");
20449 }
20450 return Math.max(200, delay);
20451 }
20452 return null;
20453 };
20454 GridOptionsWrapper.prototype.isTooltipMouseTrack = function () {
20455 return isTrue(this.gridOptions.tooltipMouseTrack);
20456 };
20457 GridOptionsWrapper.prototype.isSuppressModelUpdateAfterUpdateTransaction = function () {
20458 return isTrue(this.gridOptions.suppressModelUpdateAfterUpdateTransaction);
20459 };
20460 GridOptionsWrapper.prototype.getDocument = function () {
20461 // if user is providing document, we use the users one,
20462 // otherwise we use the document on the global namespace.
20463 var result = null;
20464 if (this.gridOptions.getDocument && exists(this.gridOptions.getDocument)) {
20465 result = this.gridOptions.getDocument();
20466 }
20467 else if (this.eGridDiv) {
20468 result = this.eGridDiv.ownerDocument;
20469 }
20470 if (result && exists(result)) {
20471 return result;
20472 }
20473 return document;
20474 };
20475 GridOptionsWrapper.prototype.getMinColWidth = function () {
20476 var minColWidth = this.gridOptions.minColWidth;
20477 if (exists(minColWidth) && minColWidth > GridOptionsWrapper_1.MIN_COL_WIDTH) {
20478 return this.gridOptions.minColWidth;
20479 }
20480 var measuredMin = this.getFromTheme(null, 'headerCellMinWidth');
20481 return exists(measuredMin) ? Math.max(measuredMin, GridOptionsWrapper_1.MIN_COL_WIDTH) : GridOptionsWrapper_1.MIN_COL_WIDTH;
20482 };
20483 GridOptionsWrapper.prototype.getMaxColWidth = function () {
20484 if (this.gridOptions.maxColWidth && this.gridOptions.maxColWidth > GridOptionsWrapper_1.MIN_COL_WIDTH) {
20485 return this.gridOptions.maxColWidth;
20486 }
20487 return null;
20488 };
20489 GridOptionsWrapper.prototype.getColWidth = function () {
20490 if (typeof this.gridOptions.colWidth !== 'number' || this.gridOptions.colWidth < GridOptionsWrapper_1.MIN_COL_WIDTH) {
20491 return 200;
20492 }
20493 return this.gridOptions.colWidth;
20494 };
20495 GridOptionsWrapper.prototype.getRowBuffer = function () {
20496 var rowBuffer = this.gridOptions.rowBuffer;
20497 if (typeof rowBuffer === 'number') {
20498 if (rowBuffer < 0) {
20499 doOnce(function () { return console.warn("AG Grid: rowBuffer should not be negative"); }, 'warn rowBuffer negative');
20500 this.gridOptions.rowBuffer = rowBuffer = 0;
20501 }
20502 }
20503 else {
20504 rowBuffer = Constants.ROW_BUFFER_SIZE;
20505 }
20506 return rowBuffer;
20507 };
20508 GridOptionsWrapper.prototype.getRowBufferInPixels = function () {
20509 var rowsToBuffer = this.getRowBuffer();
20510 var defaultRowHeight = this.getRowHeightAsNumber();
20511 return rowsToBuffer * defaultRowHeight;
20512 };
20513 // the user might be using some non-standard scrollbar, eg a scrollbar that has zero
20514 // width and overlays (like the Safari scrollbar, but presented in Chrome). so we
20515 // allow the user to provide the scroll width before we work it out.
20516 GridOptionsWrapper.prototype.getScrollbarWidth = function () {
20517 if (this.scrollbarWidth == null) {
20518 var useGridOptions = typeof this.gridOptions.scrollbarWidth === 'number' && this.gridOptions.scrollbarWidth >= 0;
20519 var scrollbarWidth = useGridOptions ? this.gridOptions.scrollbarWidth : getScrollbarWidth();
20520 if (scrollbarWidth != null) {
20521 this.scrollbarWidth = scrollbarWidth;
20522 this.eventService.dispatchEvent({
20523 type: Events.EVENT_SCROLLBAR_WIDTH_CHANGED
20524 });
20525 }
20526 }
20527 return this.scrollbarWidth;
20528 };
20529 GridOptionsWrapper.prototype.checkForDeprecated = function () {
20530 // casting to generic object, so typescript compiles even though
20531 // we are looking for attributes that don't exist
20532 var options = this.gridOptions;
20533 if (options.deprecatedEmbedFullWidthRows) {
20534 console.warn("AG Grid: since v21.2, deprecatedEmbedFullWidthRows has been replaced with embedFullWidthRows.");
20535 }
20536 if (options.rowDeselection) {
20537 console.warn('AG Grid: since v24.x, rowDeselection is deprecated and the behaviour is true by default. Please use `suppressRowDeselection` to prevent rows from being deselected.');
20538 }
20539 if (options.enableMultiRowDragging) {
20540 options.rowDragMultiRow = true;
20541 delete options.enableMultiRowDragging;
20542 console.warn('AG Grid: since v26.1, `enableMultiRowDragging` is deprecated. Please use `rowDragMultiRow`.');
20543 }
20544 var checkRenamedProperty = function (oldProp, newProp, version) {
20545 if (options[oldProp] != null) {
20546 console.warn("AG Grid: since version " + version + ", '" + oldProp + "' is deprecated / renamed, please use the new property name '" + newProp + "' instead.");
20547 if (options[newProp] == null) {
20548 options[newProp] = options[oldProp];
20549 }
20550 }
20551 };
20552 checkRenamedProperty('batchUpdateWaitMillis', 'asyncTransactionWaitMillis', '23.1.x');
20553 checkRenamedProperty('deltaRowDataMode', 'immutableData', '23.1.x');
20554 if (options.immutableColumns || options.deltaColumnMode) {
20555 console.warn('AG Grid: since v24.0, immutableColumns and deltaColumnMode properties are gone. The grid now works like this as default. To keep column order maintained, set grid property applyColumnDefOrder=true');
20556 }
20557 checkRenamedProperty('suppressSetColumnStateEvents', 'suppressColumnStateEvents', '24.0.x');
20558 if (options.groupRowInnerRenderer || options.groupRowInnerRendererParams || options.groupRowInnerRendererFramework) {
20559 console.warn('AG Grid: since v24.0, grid properties groupRowInnerRenderer, groupRowInnerRendererFramework and groupRowInnerRendererParams are no longer used.');
20560 console.warn(' Instead use the grid properties groupRowRendererParams.innerRenderer, groupRowRendererParams.innerRendererFramework and groupRowRendererParams.innerRendererParams.');
20561 console.warn(' For example instead of this:');
20562 console.warn(' groupRowInnerRenderer: "myRenderer"');
20563 console.warn(' groupRowInnerRendererParams: {x: a}');
20564 console.warn(' Replace with this:');
20565 console.warn(' groupRowRendererParams: {');
20566 console.warn(' innerRenderer: "myRenderer",');
20567 console.warn(' innerRendererParams: {x: a}');
20568 console.warn(' }');
20569 console.warn(' We have copied the properties over for you. However to stop this error message, please change your application code.');
20570 if (!options.groupRowRendererParams) {
20571 options.groupRowRendererParams = {};
20572 }
20573 var params = options.groupRowRendererParams;
20574 if (options.groupRowInnerRenderer) {
20575 params.innerRenderer = options.groupRowInnerRenderer;
20576 }
20577 if (options.groupRowInnerRendererParams) {
20578 params.innerRendererParams = options.groupRowInnerRendererParams;
20579 }
20580 if (options.groupRowInnerRendererFramework) {
20581 params.innerRendererFramework = options.groupRowInnerRendererFramework;
20582 }
20583 }
20584 if (options.rememberGroupStateWhenNewData) {
20585 console.warn('AG Grid: since v24.0, grid property rememberGroupStateWhenNewData is deprecated. This feature was provided before Transaction Updates worked (which keep group state). Now that transaction updates are possible and they keep group state, this feature is no longer needed.');
20586 }
20587 if (options.detailCellRendererParams && options.detailCellRendererParams.autoHeight) {
20588 console.warn('AG Grid: since v24.1, grid property detailCellRendererParams.autoHeight is replaced with grid property detailRowAutoHeight. This allows this feature to work when you provide a custom DetailCellRenderer');
20589 options.detailRowAutoHeight = true;
20590 }
20591 if (options.suppressKeyboardEvent) {
20592 console.warn("AG Grid: since v24.1 suppressKeyboardEvent in the gridOptions has been deprecated and will be removed in\n future versions of AG Grid. If you need this to be set for every column use the defaultColDef property.");
20593 }
20594 if (options.suppressEnterpriseResetOnNewColumns) {
20595 console.warn('AG Grid: since v25, grid property suppressEnterpriseResetOnNewColumns is deprecated. This was a temporary property to allow changing columns in Server Side Row Model without triggering a reload. Now that it is possible to dynamically change columns in the grid, this is no longer needed.');
20596 }
20597 if (options.suppressColumnStateEvents) {
20598 console.warn('AG Grid: since v25, grid property suppressColumnStateEvents no longer works due to a refactor that we did. It should be possible to achieve similar using event.source, which would be "api" if the event was due to setting column state via the API');
20599 }
20600 if (options.defaultExportParams) {
20601 console.warn('AG Grid: since v25.2, the grid property `defaultExportParams` has been replaced by `defaultCsvExportParams` and `defaultExcelExportParams`.');
20602 }
20603 if (options.stopEditingWhenGridLosesFocus) {
20604 console.warn('AG Grid: since v25.2.2, the grid property `stopEditingWhenGridLosesFocus` has been replaced by `stopEditingWhenCellsLoseFocus`.');
20605 options.stopEditingWhenCellsLoseFocus = true;
20606 }
20607 if (options.applyColumnDefOrder) {
20608 console.warn('AG Grid: since v26.0, the grid property `applyColumnDefOrder` is no longer needed, as this is the default behaviour. To turn this behaviour off, set maintainColumnOrder=true');
20609 }
20610 if (options.groupMultiAutoColumn) {
20611 console.warn("AG Grid: since v26.0, the grid property `groupMultiAutoColumn` has been replaced by `groupDisplayType = 'multipleColumns'`");
20612 options.groupDisplayType = 'multipleColumns';
20613 }
20614 if (options.groupUseEntireRow) {
20615 console.warn("AG Grid: since v26.0, the grid property `groupUseEntireRow` has been replaced by `groupDisplayType = 'groupRows'`");
20616 options.groupDisplayType = 'groupRows';
20617 }
20618 if (options.groupSuppressAutoColumn) {
20619 var propName = options.treeData ? 'treeDataDisplayType' : 'groupDisplayType';
20620 console.warn("AG Grid: since v26.0, the grid property `groupSuppressAutoColumn` has been replaced by `" + propName + " = 'custom'`");
20621 options.groupDisplayType = 'custom';
20622 }
20623 if (options.defaultGroupOrderComparator) {
20624 console.warn("AG Grid: since v27.2, the grid property `defaultGroupOrderComparator` is deprecated and has been replaced by `initialGroupOrderComparator` and now receives a single params object.");
20625 }
20626 if (options.defaultGroupSortComparator) {
20627 console.warn("AG Grid: since v26.0, the grid property `defaultGroupSortComparator` has been replaced by `initialGroupOrderComparator`");
20628 options.defaultGroupOrderComparator = options.defaultGroupSortComparator;
20629 }
20630 if (options.groupRowAggNodes) {
20631 console.warn("AG Grid: since v27.2, the grid property `groupRowAggNodes` is deprecated and has been replaced by `getGroupRowAgg` and now receives a single params object.");
20632 }
20633 if (options.postSort) {
20634 console.warn("AG Grid: since v27.2, the grid property `postSort` is deprecated and has been replaced by `postSortRows` and now receives a single params object.");
20635 }
20636 if (options.isFullWidthCell) {
20637 console.warn("AG Grid: since v27.2, the grid property `isFullWidthCell` is deprecated and has been replaced by `isFullWidthRow` and now receives a single params object.");
20638 }
20639 if (options.localeTextFunc) {
20640 console.warn("AG Grid: since v27.2, the grid property `localeTextFunc` is deprecated and has been replaced by `getLocaleText` and now receives a single params object.");
20641 }
20642 if (options.colWidth) {
20643 console.warn('AG Grid: since v26.1, the grid property `colWidth` is deprecated and should be set via `defaultColDef.width`.');
20644 }
20645 if (options.minColWidth) {
20646 console.warn('AG Grid: since v26.1, the grid property `minColWidth` is deprecated and should be set via `defaultColDef.minWidth`.');
20647 }
20648 if (options.maxColWidth) {
20649 console.warn('AG Grid: since v26.1, the grid property `maxColWidth` is deprecated and should be set via `defaultColDef.maxWidth`.');
20650 }
20651 if (options.reactUi) {
20652 console.warn('AG Grid: since v27.0, React UI is on by default, so no need for reactUi=true. To turn it off, set suppressReactUi=true.');
20653 }
20654 if (options.suppressReactUi) {
20655 console.warn('AG Grid: The legacy React rendering engine is deprecated and will be removed in the next major version of the grid.');
20656 }
20657 if (options.suppressCellSelection) {
20658 console.warn('AG Grid: since v27.0, `suppressCellSelection` has been replaced by `suppressCellFocus`.');
20659 options.suppressCellFocus = options.suppressCellSelection;
20660 }
20661 if (options.getRowNodeId) {
20662 console.warn('AG Grid: since v27.1, `getRowNodeId` is deprecated and has been replaced by `getRowId`. The difference: if getRowId() is implemented then immutable data is enabled by default.');
20663 }
20664 if (options.immutableData) {
20665 if (options.getRowId) {
20666 console.warn('AG Grid: since v27.1, `immutableData` is deprecated. With the `getRowId` callback implemented, immutable data is enabled by default so you can remove `immutableData=true`.');
20667 }
20668 else {
20669 console.warn('AG Grid: since v27.1, `immutableData` is deprecated. To enable immutable data you must implement the `getRowId()` callback.');
20670 }
20671 }
20672 if (options.clipboardDeliminator) {
20673 console.warn('AG Grid: since v27.1, `clipboardDeliminator` has been replaced by `clipboardDelimiter`.');
20674 options.clipboardDelimiter = options.clipboardDeliminator;
20675 }
20676 };
20677 GridOptionsWrapper.prototype.checkForViolations = function () {
20678 if (this.isTreeData()) {
20679 this.treeDataViolations();
20680 }
20681 };
20682 GridOptionsWrapper.prototype.treeDataViolations = function () {
20683 if (this.isRowModelDefault()) {
20684 if (missing(this.getDataPathFunc())) {
20685 console.warn('AG Grid: property usingTreeData=true with rowModel=clientSide, but you did not ' +
20686 'provide getDataPath function, please provide getDataPath function if using tree data.');
20687 }
20688 }
20689 if (this.isRowModelServerSide()) {
20690 if (missing(this.getIsServerSideGroupFunc())) {
20691 console.warn('AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +
20692 'provide isServerSideGroup function, please provide isServerSideGroup function if using tree data.');
20693 }
20694 if (missing(this.getServerSideGroupKeyFunc())) {
20695 console.warn('AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not ' +
20696 'provide getServerSideGroupKey function, please provide getServerSideGroupKey function if using tree data.');
20697 }
20698 }
20699 };
20700 GridOptionsWrapper.prototype.getLocaleTextFunc = function () {
20701 var _this = this;
20702 var _a = this.gridOptions, localeText = _a.localeText, getLocaleText = _a.getLocaleText, localeTextFunc = _a.localeTextFunc;
20703 if (getLocaleText) {
20704 //key: string, defaultValue: string, variableValues?: string[]
20705 return function (key, defaultValue, variableValues) {
20706 var params = {
20707 key: key,
20708 defaultValue: defaultValue,
20709 variableValues: variableValues,
20710 api: _this.getApi(),
20711 columnApi: _this.getColumnApi(),
20712 context: _this.getContext()
20713 };
20714 return getLocaleText(params);
20715 };
20716 }
20717 if (localeTextFunc) {
20718 return localeTextFunc;
20719 }
20720 return function (key, defaultValue, variableValues) {
20721 var localisedText = localeText && localeText[key];
20722 if (localisedText && variableValues && variableValues.length) {
20723 var found = 0;
20724 while (true) {
20725 if (found >= variableValues.length) {
20726 break;
20727 }
20728 var idx = localisedText.indexOf('${variable}');
20729 if (idx === -1) {
20730 break;
20731 }
20732 localisedText = localisedText.replace('${variable}', variableValues[found++]);
20733 }
20734 }
20735 return (localisedText !== null && localisedText !== void 0 ? localisedText : defaultValue);
20736 };
20737 };
20738 // responsible for calling the onXXX functions on gridOptions
20739 GridOptionsWrapper.prototype.globalEventHandler = function (eventName, event) {
20740 // prevent events from being fired _after_ the grid has been destroyed
20741 if (this.destroyed) {
20742 return;
20743 }
20744 var callbackMethodName = ComponentUtil.getCallbackForEvent(eventName);
20745 if (typeof this.gridOptions[callbackMethodName] === 'function') {
20746 this.gridOptions[callbackMethodName](event);
20747 }
20748 };
20749 GridOptionsWrapper.prototype.setRowHeightVariable = function (height) {
20750 var oldRowHeight = this.eGridDiv.style.getPropertyValue('--ag-line-height').trim();
20751 var newRowHeight = height + "px";
20752 if (oldRowHeight != newRowHeight) {
20753 this.eGridDiv.style.setProperty('--ag-line-height', newRowHeight);
20754 }
20755 };
20756 // we don't allow dynamic row height for virtual paging
20757 GridOptionsWrapper.prototype.getRowHeightAsNumber = function () {
20758 if (!this.gridOptions.rowHeight || missing(this.gridOptions.rowHeight)) {
20759 return this.getDefaultRowHeight();
20760 }
20761 var rowHeight = this.gridOptions.rowHeight;
20762 if (rowHeight && this.isNumeric(rowHeight)) {
20763 this.setRowHeightVariable(rowHeight);
20764 return rowHeight;
20765 }
20766 console.warn('AG Grid row height must be a number if not using standard row model');
20767 return this.getDefaultRowHeight();
20768 };
20769 GridOptionsWrapper.prototype.isGetRowHeightFunction = function () {
20770 return typeof this.gridOptions.getRowHeight === 'function';
20771 };
20772 GridOptionsWrapper.prototype.getRowHeightForNode = function (rowNode, allowEstimate, defaultRowHeight) {
20773 if (allowEstimate === void 0) { allowEstimate = false; }
20774 if (defaultRowHeight == null) {
20775 defaultRowHeight = this.getDefaultRowHeight();
20776 }
20777 // check the function first, in case use set both function and
20778 // number, when using virtual pagination then function can be
20779 // used for pinned rows and the number for the body rows.
20780 if (this.isGetRowHeightFunction()) {
20781 if (allowEstimate) {
20782 return { height: defaultRowHeight, estimated: true };
20783 }
20784 var params = {
20785 node: rowNode,
20786 data: rowNode.data
20787 };
20788 var height = this.mergeGridCommonParams(this.gridOptions.getRowHeight)(params);
20789 if (this.isNumeric(height)) {
20790 if (height === 0) {
20791 doOnce(function () { return console.warn('AG Grid: The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead.'); }, 'invalidRowHeight');
20792 }
20793 return { height: Math.max(1, height), estimated: false };
20794 }
20795 }
20796 if (rowNode.detail && this.isMasterDetail()) {
20797 // if autoHeight, we want the height to grow to the new height starting at 1, as otherwise a flicker would happen,
20798 // as the detail goes to the default (eg 200px) and then immediately shrink up/down to the new measured height
20799 // (due to auto height) which looks bad, especially if doing row animation.
20800 if (this.isDetailRowAutoHeight()) {
20801 return { height: 1, estimated: false };
20802 }
20803 if (this.isNumeric(this.gridOptions.detailRowHeight)) {
20804 return { height: this.gridOptions.detailRowHeight, estimated: false };
20805 }
20806 return { height: DEFAULT_DETAIL_ROW_HEIGHT, estimated: false };
20807 }
20808 var rowHeight = this.gridOptions.rowHeight && this.isNumeric(this.gridOptions.rowHeight) ? this.gridOptions.rowHeight : defaultRowHeight;
20809 return { height: rowHeight, estimated: false };
20810 };
20811 GridOptionsWrapper.prototype.isDynamicRowHeight = function () {
20812 return typeof this.gridOptions.getRowHeight === 'function';
20813 };
20814 GridOptionsWrapper.prototype.getListItemHeight = function () {
20815 return this.getFromTheme(20, 'listItemHeight');
20816 };
20817 GridOptionsWrapper.prototype.chartMenuPanelWidth = function () {
20818 return this.environment.chartMenuPanelWidth();
20819 };
20820 GridOptionsWrapper.prototype.isNumeric = function (value) {
20821 return !isNaN(value) && typeof value === 'number' && isFinite(value);
20822 };
20823 GridOptionsWrapper.prototype.getFromTheme = function (defaultValue, sassVariableName) {
20824 var theme = this.environment.getTheme().theme;
20825 if (theme && theme.indexOf('ag-theme') === 0) {
20826 return this.environment.getSassVariable(theme, sassVariableName);
20827 }
20828 return defaultValue;
20829 };
20830 GridOptionsWrapper.prototype.getDefaultRowHeight = function () {
20831 return this.getFromTheme(DEFAULT_ROW_HEIGHT, 'rowHeight');
20832 };
20833 GridOptionsWrapper.prototype.matchesGroupDisplayType = function (toMatch, supplied) {
20834 var groupDisplayTypeValues = ['groupRows', 'multipleColumns', 'custom', 'singleColumn'];
20835 if (groupDisplayTypeValues.indexOf(supplied) < 0) {
20836 console.warn("AG Grid: '" + supplied + "' is not a valid groupDisplayType value - possible values are: '" + groupDisplayTypeValues.join("', '") + "'");
20837 return false;
20838 }
20839 return supplied === toMatch;
20840 };
20841 GridOptionsWrapper.prototype.matchesTreeDataDisplayType = function (toMatch, supplied) {
20842 var treeDataDisplayTypeValues = ['auto', 'custom'];
20843 if (treeDataDisplayTypeValues.indexOf(supplied) < 0) {
20844 console.warn("AG Grid: '" + supplied + "' is not a valid treeDataDisplayType value - possible values are: '" + treeDataDisplayTypeValues.join("', '") + "'");
20845 return false;
20846 }
20847 return supplied === toMatch;
20848 };
20849 var GridOptionsWrapper_1;
20850 GridOptionsWrapper.MIN_COL_WIDTH = 10;
20851 GridOptionsWrapper.PROP_HEADER_HEIGHT = 'headerHeight';
20852 GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN = 'groupRemoveSingleChildren';
20853 GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN = 'groupRemoveLowestSingleChildren';
20854 GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT = 'pivotHeaderHeight';
20855 GridOptionsWrapper.PROP_SUPPRESS_CLIPBOARD_PASTE = 'suppressClipboardPaste';
20856 GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT = 'groupHeaderHeight';
20857 GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT = 'pivotGroupHeaderHeight';
20858 GridOptionsWrapper.PROP_NAVIGATE_TO_NEXT_CELL = 'navigateToNextCell';
20859 GridOptionsWrapper.PROP_TAB_TO_NEXT_CELL = 'tabToNextCell';
20860 GridOptionsWrapper.PROP_NAVIGATE_TO_NEXT_HEADER = 'navigateToNextHeader';
20861 GridOptionsWrapper.PROP_TAB_TO_NEXT_HEADER = 'tabToNextHeader';
20862 GridOptionsWrapper.PROP_IS_EXTERNAL_FILTER_PRESENT = 'isExternalFilterPresent';
20863 GridOptionsWrapper.PROP_DOES_EXTERNAL_FILTER_PASS = 'doesExternalFilterPass';
20864 GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT = 'floatingFiltersHeight';
20865 GridOptionsWrapper.PROP_SUPPRESS_ROW_CLICK_SELECTION = 'suppressRowClickSelection';
20866 GridOptionsWrapper.PROP_SUPPRESS_ROW_DRAG = 'suppressRowDrag';
20867 GridOptionsWrapper.PROP_SUPPRESS_MOVE_WHEN_ROW_DRAG = 'suppressMoveWhenRowDragging';
20868 GridOptionsWrapper.PROP_GET_ROW_CLASS = 'getRowClass';
20869 GridOptionsWrapper.PROP_GET_ROW_STYLE = 'getRowStyle';
20870 GridOptionsWrapper.PROP_GET_ROW_HEIGHT = 'getRowHeight';
20871 GridOptionsWrapper.PROP_POPUP_PARENT = 'popupParent';
20872 GridOptionsWrapper.PROP_DOM_LAYOUT = 'domLayout';
20873 GridOptionsWrapper.PROP_ROW_CLASS = 'rowClass';
20874 GridOptionsWrapper.PROP_FILL_HANDLE_DIRECTION = 'fillHandleDirection';
20875 GridOptionsWrapper.PROP_GROUP_ROW_AGG_NODES = 'groupRowAggNodes';
20876 GridOptionsWrapper.PROP_GET_GROUP_ROW_AGG = 'getGroupRowAgg';
20877 GridOptionsWrapper.PROP_GET_BUSINESS_KEY_FOR_NODE = 'getBusinessKeyForNode';
20878 GridOptionsWrapper.PROP_GET_CHILD_COUNT = 'getChildCount';
20879 GridOptionsWrapper.PROP_PROCESS_ROW_POST_CREATE = 'processRowPostCreate';
20880 GridOptionsWrapper.PROP_GET_ROW_NODE_ID = 'getRowNodeId';
20881 GridOptionsWrapper.PROP_GET_ROW_ID = 'getRowId';
20882 GridOptionsWrapper.PROP_IS_FULL_WIDTH_CELL = 'isFullWidthCell';
20883 GridOptionsWrapper.PROP_IS_FULL_WIDTH_ROW = 'isFullWidthRow';
20884 GridOptionsWrapper.PROP_IS_ROW_SELECTABLE = 'isRowSelectable';
20885 GridOptionsWrapper.PROP_IS_ROW_MASTER = 'isRowMaster';
20886 GridOptionsWrapper.PROP_POST_SORT = 'postSort';
20887 GridOptionsWrapper.PROP_POST_SORT_ROWS = 'postSortRows';
20888 GridOptionsWrapper.PROP_GET_DOCUMENT = 'getDocument';
20889 GridOptionsWrapper.PROP_POST_PROCESS_POPUP = 'postProcessPopup';
20890 GridOptionsWrapper.PROP_DEFAULT_GROUP_ORDER_COMPARATOR = 'defaultGroupOrderComparator';
20891 GridOptionsWrapper.PROP_INITIAL_GROUP_ORDER_COMPARATOR = 'initialGroupOrderComparator';
20892 GridOptionsWrapper.PROP_PAGINATION_NUMBER_FORMATTER = 'paginationNumberFormatter';
20893 GridOptionsWrapper.PROP_GET_CONTEXT_MENU_ITEMS = 'getContextMenuItems';
20894 GridOptionsWrapper.PROP_GET_MAIN_MENU_ITEMS = 'getMainMenuItems';
20895 GridOptionsWrapper.PROP_PROCESS_CELL_FOR_CLIPBOARD = 'processCellForClipboard';
20896 GridOptionsWrapper.PROP_PROCESS_CELL_FROM_CLIPBOARD = 'processCellFromClipboard';
20897 GridOptionsWrapper.PROP_SEND_TO_CLIPBOARD = 'sendToClipboard';
20898 GridOptionsWrapper.PROP_PROCESS_TO_SECONDARY_COLDEF = 'processSecondaryColDef';
20899 GridOptionsWrapper.PROP_PROCESS_SECONDARY_COL_GROUP_DEF = 'processSecondaryColGroupDef';
20900 GridOptionsWrapper.PROP_GET_CHART_TOOLBAR_ITEMS = 'getChartToolbarItems';
20901 GridOptionsWrapper.PROP_GET_SERVER_SIDE_STORE_PARAMS = 'getServerSideStoreParams';
20902 GridOptionsWrapper.PROP_IS_SERVER_SIDE_GROUPS_OPEN_BY_DEFAULT = 'isServerSideGroupOpenByDefault';
20903 GridOptionsWrapper.PROP_IS_APPLY_SERVER_SIDE_TRANSACTION = 'isApplyServerSideTransaction';
20904 GridOptionsWrapper.PROP_IS_SERVER_SIDE_GROUP = 'isServerSideGroup';
20905 GridOptionsWrapper.PROP_GET_SERVER_SIDE_GROUP_KEY = 'getServerSideGroupKey';
20906 __decorate$I([
20907 Autowired('gridOptions')
20908 ], GridOptionsWrapper.prototype, "gridOptions", void 0);
20909 __decorate$I([
20910 Autowired('eventService')
20911 ], GridOptionsWrapper.prototype, "eventService", void 0);
20912 __decorate$I([
20913 Autowired('environment')
20914 ], GridOptionsWrapper.prototype, "environment", void 0);
20915 __decorate$I([
20916 Autowired('eGridDiv')
20917 ], GridOptionsWrapper.prototype, "eGridDiv", void 0);
20918 __decorate$I([
20919 __param$3(0, Qualifier('gridApi')), __param$3(1, Qualifier('columnApi'))
20920 ], GridOptionsWrapper.prototype, "agWire", null);
20921 __decorate$I([
20922 PreDestroy
20923 ], GridOptionsWrapper.prototype, "destroy", null);
20924 __decorate$I([
20925 PostConstruct
20926 ], GridOptionsWrapper.prototype, "init", null);
20927 GridOptionsWrapper = GridOptionsWrapper_1 = __decorate$I([
20928 Bean('gridOptionsWrapper')
20929 ], GridOptionsWrapper);
20930 return GridOptionsWrapper;
20931}());
20932
20933/**
20934 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
20935 * @version v27.3.0
20936 * @link https://www.ag-grid.com/
20937 * @license MIT
20938 */
20939var __extends$Q = (undefined && undefined.__extends) || (function () {
20940 var extendStatics = function (d, b) {
20941 extendStatics = Object.setPrototypeOf ||
20942 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20943 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
20944 return extendStatics(d, b);
20945 };
20946 return function (d, b) {
20947 extendStatics(d, b);
20948 function __() { this.constructor = d; }
20949 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
20950 };
20951})();
20952var __decorate$J = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
20953 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20954 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20955 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;
20956 return c > 3 && r && Object.defineProperty(target, key, r), r;
20957};
20958(function (LayoutCssClasses) {
20959 LayoutCssClasses["AUTO_HEIGHT"] = "ag-layout-auto-height";
20960 LayoutCssClasses["NORMAL"] = "ag-layout-normal";
20961 LayoutCssClasses["PRINT"] = "ag-layout-print";
20962})(exports.LayoutCssClasses || (exports.LayoutCssClasses = {}));
20963var LayoutFeature = /** @class */ (function (_super) {
20964 __extends$Q(LayoutFeature, _super);
20965 function LayoutFeature(view) {
20966 var _this = _super.call(this) || this;
20967 _this.view = view;
20968 return _this;
20969 }
20970 LayoutFeature.prototype.postConstruct = function () {
20971 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, this.updateLayoutClasses.bind(this));
20972 this.updateLayoutClasses();
20973 };
20974 LayoutFeature.prototype.updateLayoutClasses = function () {
20975 var domLayout = this.gridOptionsWrapper.getDomLayout();
20976 var params = {
20977 autoHeight: domLayout === Constants.DOM_LAYOUT_AUTO_HEIGHT,
20978 normal: domLayout === Constants.DOM_LAYOUT_NORMAL,
20979 print: domLayout === Constants.DOM_LAYOUT_PRINT
20980 };
20981 var cssClass = params.autoHeight ? exports.LayoutCssClasses.AUTO_HEIGHT :
20982 params.print ? exports.LayoutCssClasses.PRINT : exports.LayoutCssClasses.NORMAL;
20983 this.view.updateLayoutClasses(cssClass, params);
20984 };
20985 __decorate$J([
20986 Autowired('gridOptionsWrapper')
20987 ], LayoutFeature.prototype, "gridOptionsWrapper", void 0);
20988 __decorate$J([
20989 PostConstruct
20990 ], LayoutFeature.prototype, "postConstruct", null);
20991 return LayoutFeature;
20992}(BeanStub));
20993
20994/**
20995 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
20996 * @version v27.3.0
20997 * @link https://www.ag-grid.com/
20998 * @license MIT
20999 */
21000var __extends$R = (undefined && undefined.__extends) || (function () {
21001 var extendStatics = function (d, b) {
21002 extendStatics = Object.setPrototypeOf ||
21003 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
21004 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
21005 return extendStatics(d, b);
21006 };
21007 return function (d, b) {
21008 extendStatics(d, b);
21009 function __() { this.constructor = d; }
21010 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
21011 };
21012})();
21013var __decorate$K = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
21014 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
21015 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21016 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;
21017 return c > 3 && r && Object.defineProperty(target, key, r), r;
21018};
21019var GridBodyScrollFeature = /** @class */ (function (_super) {
21020 __extends$R(GridBodyScrollFeature, _super);
21021 function GridBodyScrollFeature(eBodyViewport) {
21022 var _this = _super.call(this) || this;
21023 _this.scrollLeft = -1;
21024 _this.nextScrollTop = -1;
21025 _this.scrollTop = -1;
21026 _this.eBodyViewport = eBodyViewport;
21027 _this.resetLastHorizontalScrollElementDebounced = debounce(_this.resetLastHorizontalScrollElement.bind(_this), 500);
21028 return _this;
21029 }
21030 GridBodyScrollFeature.prototype.postConstruct = function () {
21031 var _this = this;
21032 this.enableRtl = this.gridOptionsWrapper.isEnableRtl();
21033 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this));
21034 this.ctrlsService.whenReady(function (p) {
21035 _this.centerRowContainerCtrl = p.centerRowContainerCtrl;
21036 _this.onDisplayedColumnsWidthChanged();
21037 _this.addScrollListener();
21038 });
21039 };
21040 GridBodyScrollFeature.prototype.addScrollListener = function () {
21041 var fakeHScroll = this.ctrlsService.getFakeHScrollCtrl();
21042 this.addManagedListener(this.centerRowContainerCtrl.getViewportElement(), 'scroll', this.onCenterViewportScroll.bind(this));
21043 this.addManagedListener(fakeHScroll.getViewport(), 'scroll', this.onFakeHorizontalScroll.bind(this));
21044 var onVerticalScroll = this.gridOptionsWrapper.isDebounceVerticalScrollbar() ?
21045 debounce(this.onVerticalScroll.bind(this), 100)
21046 : this.onVerticalScroll.bind(this);
21047 this.addManagedListener(this.eBodyViewport, 'scroll', onVerticalScroll);
21048 };
21049 GridBodyScrollFeature.prototype.onDisplayedColumnsWidthChanged = function () {
21050 if (this.enableRtl) {
21051 // because RTL is all backwards, a change in the width of the row
21052 // can cause a change in the scroll position, without a scroll event,
21053 // because the scroll position in RTL is a function that depends on
21054 // the width. to be convinced of this, take out this line, enable RTL,
21055 // scroll all the way to the left and then resize a column
21056 this.horizontallyScrollHeaderCenterAndFloatingCenter();
21057 }
21058 };
21059 GridBodyScrollFeature.prototype.horizontallyScrollHeaderCenterAndFloatingCenter = function (scrollLeft) {
21060 // when doing RTL, this method gets called once prematurely
21061 var notYetInitialised = this.centerRowContainerCtrl == null;
21062 if (notYetInitialised) {
21063 return;
21064 }
21065 if (scrollLeft === undefined) {
21066 scrollLeft = this.centerRowContainerCtrl.getCenterViewportScrollLeft();
21067 }
21068 var offset = this.enableRtl ? scrollLeft : -scrollLeft;
21069 var topCenterContainer = this.ctrlsService.getTopCenterRowContainerCtrl();
21070 var bottomCenterContainer = this.ctrlsService.getBottomCenterRowContainerCtrl();
21071 var fakeHScroll = this.ctrlsService.getFakeHScrollCtrl();
21072 var centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();
21073 centerHeaderContainer.setHorizontalScroll(offset);
21074 bottomCenterContainer.setContainerTranslateX(offset);
21075 topCenterContainer.setContainerTranslateX(offset);
21076 var partner = this.lastHorizontalScrollElement === this.centerRowContainerCtrl.getViewportElement() ?
21077 fakeHScroll.getViewport() : this.centerRowContainerCtrl.getViewportElement();
21078 setScrollLeft(partner, Math.abs(scrollLeft), this.enableRtl);
21079 };
21080 GridBodyScrollFeature.prototype.isControllingScroll = function (eDiv) {
21081 if (!this.lastHorizontalScrollElement) {
21082 this.lastHorizontalScrollElement = eDiv;
21083 return true;
21084 }
21085 return eDiv === this.lastHorizontalScrollElement;
21086 };
21087 GridBodyScrollFeature.prototype.onFakeHorizontalScroll = function () {
21088 var fakeHScrollViewport = this.ctrlsService.getFakeHScrollCtrl().getViewport();
21089 if (!this.isControllingScroll(fakeHScrollViewport)) {
21090 return;
21091 }
21092 this.onBodyHorizontalScroll(fakeHScrollViewport);
21093 };
21094 GridBodyScrollFeature.prototype.onCenterViewportScroll = function () {
21095 var centerContainerViewport = this.centerRowContainerCtrl.getViewportElement();
21096 if (!this.isControllingScroll(centerContainerViewport)) {
21097 return;
21098 }
21099 this.onBodyHorizontalScroll(centerContainerViewport);
21100 };
21101 GridBodyScrollFeature.prototype.onBodyHorizontalScroll = function (eSource) {
21102 var centerContainerViewport = this.centerRowContainerCtrl.getViewportElement();
21103 var scrollLeft = centerContainerViewport.scrollLeft;
21104 if (this.shouldBlockScrollUpdate('horizontal', scrollLeft, true)) {
21105 return;
21106 }
21107 // we do Math.round() rather than Math.floor(), to mirror how scroll values are applied.
21108 // eg if a scale is applied (ie user has zoomed the browser), then applying scroll=200
21109 // could result in 199.88, which then floor(199.88) = 199, however round(199.88) = 200.
21110 // initially Math.floor() was used, however this caused (almost) infinite loop with aligned grids,
21111 // as the scroll would move 1px at at time bouncing from one grid to the next (eg one grid would cause
21112 // scroll to 200px, the next to 199px, then the first back to 198px and so on).
21113 this.doHorizontalScroll(Math.round(getScrollLeft(eSource, this.enableRtl)));
21114 this.resetLastHorizontalScrollElementDebounced();
21115 };
21116 GridBodyScrollFeature.prototype.onVerticalScroll = function () {
21117 var scrollTop = this.eBodyViewport.scrollTop;
21118 if (this.shouldBlockScrollUpdate('vertical', scrollTop, true)) {
21119 return;
21120 }
21121 this.animationFrameService.setScrollTop(scrollTop);
21122 this.nextScrollTop = scrollTop;
21123 if (this.gridOptionsWrapper.isSuppressAnimationFrame()) {
21124 this.scrollTop = this.nextScrollTop;
21125 this.redrawRowsAfterScroll();
21126 }
21127 else {
21128 this.animationFrameService.schedule();
21129 }
21130 };
21131 GridBodyScrollFeature.prototype.resetLastHorizontalScrollElement = function () {
21132 this.lastHorizontalScrollElement = null;
21133 };
21134 GridBodyScrollFeature.prototype.doHorizontalScroll = function (scrollLeft) {
21135 var fakeHScrollViewport = this.ctrlsService.getFakeHScrollCtrl().getViewport();
21136 var fakeScrollLeft = getScrollLeft(fakeHScrollViewport, this.enableRtl);
21137 if (this.scrollLeft === scrollLeft && scrollLeft === fakeScrollLeft) {
21138 return;
21139 }
21140 this.scrollLeft = scrollLeft;
21141 this.fireScrollEvent('horizontal');
21142 this.horizontallyScrollHeaderCenterAndFloatingCenter(scrollLeft);
21143 this.onHorizontalViewportChanged();
21144 };
21145 GridBodyScrollFeature.prototype.fireScrollEvent = function (direction) {
21146 var _this = this;
21147 var bodyScrollEvent = {
21148 type: Events.EVENT_BODY_SCROLL,
21149 api: this.gridApi,
21150 columnApi: this.columnApi,
21151 direction: direction,
21152 left: this.scrollLeft,
21153 top: this.scrollTop
21154 };
21155 this.eventService.dispatchEvent(bodyScrollEvent);
21156 window.clearTimeout(this.scrollTimer);
21157 this.scrollTimer = undefined;
21158 this.scrollTimer = window.setTimeout(function () {
21159 var bodyScrollEndEvent = Object.assign({}, bodyScrollEvent, {
21160 type: Events.EVENT_BODY_SCROLL_END
21161 });
21162 _this.eventService.dispatchEvent(bodyScrollEndEvent);
21163 }, 100);
21164 };
21165 GridBodyScrollFeature.prototype.shouldBlockScrollUpdate = function (direction, scrollTo, touchOnly) {
21166 // touch devices allow elastic scroll - which temporally scrolls the panel outside of the viewport
21167 // (eg user uses touch to go to the left of the grid, but drags past the left, the rows will actually
21168 // scroll past the left until the user releases the mouse). when this happens, we want ignore the scroll,
21169 // as otherwise it was causing the rows and header to flicker.
21170 if (touchOnly === void 0) { touchOnly = false; }
21171 // sometimes when scrolling, we got values that extended the maximum scroll allowed. we used to
21172 // ignore these scrolls. problem is the max scroll position could be skipped (eg the previous scroll event
21173 // could be 10px before the max position, and then current scroll event could be 20px after the max position).
21174 // if we just ignored the last event, we would be setting the scroll to 10px before the max position, when in
21175 // actual fact the user has exceeded the max scroll and thus scroll should be set to the max.
21176 if (touchOnly && !isIOSUserAgent()) {
21177 return false;
21178 }
21179 if (direction === 'vertical') {
21180 var clientHeight = getInnerHeight(this.eBodyViewport);
21181 var scrollHeight = this.eBodyViewport.scrollHeight;
21182 if (scrollTo < 0 || (scrollTo + clientHeight > scrollHeight)) {
21183 return true;
21184 }
21185 }
21186 if (direction === 'horizontal') {
21187 var clientWidth = this.centerRowContainerCtrl.getCenterWidth();
21188 var scrollWidth = this.centerRowContainerCtrl.getViewportElement().scrollWidth;
21189 if (this.enableRtl && isRtlNegativeScroll()) {
21190 if (scrollTo > 0) {
21191 return true;
21192 }
21193 }
21194 else if (scrollTo < 0) {
21195 return true;
21196 }
21197 if (Math.abs(scrollTo) + clientWidth > scrollWidth) {
21198 return true;
21199 }
21200 }
21201 return false;
21202 };
21203 GridBodyScrollFeature.prototype.redrawRowsAfterScroll = function () {
21204 this.fireScrollEvent('vertical');
21205 };
21206 GridBodyScrollFeature.prototype.onHorizontalViewportChanged = function () {
21207 this.centerRowContainerCtrl.onHorizontalViewportChanged();
21208 };
21209 // this is to cater for AG-3274, where grid is removed from the dom and then inserted back in again.
21210 // (which happens with some implementations of tabbing). this can result in horizontal scroll getting
21211 // reset back to the left, however no scroll event is fired. so we need to get header to also scroll
21212 // back to the left to be kept in sync.
21213 // adding and removing the grid from the DOM both resets the scroll position and
21214 // triggers a resize event, so notify listeners if the scroll position has changed
21215 GridBodyScrollFeature.prototype.checkScrollLeft = function () {
21216 if (this.scrollLeft !== this.centerRowContainerCtrl.getCenterViewportScrollLeft()) {
21217 this.onBodyHorizontalScroll(this.centerRowContainerCtrl.getViewportElement());
21218 }
21219 };
21220 GridBodyScrollFeature.prototype.executeAnimationFrameScroll = function () {
21221 var frameNeeded = this.scrollTop != this.nextScrollTop;
21222 if (frameNeeded) {
21223 this.scrollTop = this.nextScrollTop;
21224 this.redrawRowsAfterScroll();
21225 }
21226 return frameNeeded;
21227 };
21228 // called by scrollHorizontally method and alignedGridsService
21229 GridBodyScrollFeature.prototype.setHorizontalScrollPosition = function (hScrollPosition) {
21230 var minScrollLeft = 0;
21231 var maxScrollLeft = this.centerRowContainerCtrl.getViewportElement().scrollWidth - this.centerRowContainerCtrl.getCenterWidth();
21232 if (this.shouldBlockScrollUpdate('horizontal', hScrollPosition)) {
21233 if (this.enableRtl && isRtlNegativeScroll()) {
21234 hScrollPosition = hScrollPosition > 0 ? 0 : maxScrollLeft;
21235 }
21236 else {
21237 hScrollPosition = Math.min(Math.max(hScrollPosition, minScrollLeft), maxScrollLeft);
21238 }
21239 }
21240 setScrollLeft(this.centerRowContainerCtrl.getViewportElement(), Math.abs(hScrollPosition), this.enableRtl);
21241 // we need to manually do the event handling (rather than wait for the event)
21242 // for the alignedGridsService, as if we don't, the aligned grid service gets
21243 // notified async, and then it's 'consuming' flag doesn't get used right, and
21244 // we can end up with an infinite loop
21245 this.doHorizontalScroll(hScrollPosition);
21246 };
21247 GridBodyScrollFeature.prototype.setVerticalScrollPosition = function (vScrollPosition) {
21248 this.eBodyViewport.scrollTop = vScrollPosition;
21249 };
21250 GridBodyScrollFeature.prototype.getVScrollPosition = function () {
21251 var result = {
21252 top: this.eBodyViewport.scrollTop,
21253 bottom: this.eBodyViewport.scrollTop + this.eBodyViewport.offsetHeight
21254 };
21255 return result;
21256 };
21257 GridBodyScrollFeature.prototype.getHScrollPosition = function () {
21258 return this.centerRowContainerCtrl.getHScrollPosition();
21259 };
21260 GridBodyScrollFeature.prototype.isHorizontalScrollShowing = function () {
21261 return this.centerRowContainerCtrl.isHorizontalScrollShowing();
21262 };
21263 // called by the headerRootComp and moveColumnController
21264 GridBodyScrollFeature.prototype.scrollHorizontally = function (pixels) {
21265 var oldScrollPosition = this.centerRowContainerCtrl.getViewportElement().scrollLeft;
21266 this.setHorizontalScrollPosition(oldScrollPosition + pixels);
21267 return this.centerRowContainerCtrl.getViewportElement().scrollLeft - oldScrollPosition;
21268 };
21269 // gets called by rowRenderer when new data loaded, as it will want to scroll to the top
21270 GridBodyScrollFeature.prototype.scrollToTop = function () {
21271 this.eBodyViewport.scrollTop = 0;
21272 };
21273 // Valid values for position are bottom, middle and top
21274 GridBodyScrollFeature.prototype.ensureNodeVisible = function (comparator, position) {
21275 if (position === void 0) { position = null; }
21276 // look for the node index we want to display
21277 var rowCount = this.rowModel.getRowCount();
21278 var comparatorIsAFunction = typeof comparator === 'function';
21279 var indexToSelect = -1;
21280 // go through all the nodes, find the one we want to show
21281 for (var i = 0; i < rowCount; i++) {
21282 var node = this.rowModel.getRow(i);
21283 if (comparatorIsAFunction) {
21284 if (comparator(node)) {
21285 indexToSelect = i;
21286 break;
21287 }
21288 }
21289 else {
21290 // check object equality against node and data
21291 if (comparator === node || comparator === node.data) {
21292 indexToSelect = i;
21293 break;
21294 }
21295 }
21296 }
21297 if (indexToSelect >= 0) {
21298 this.ensureIndexVisible(indexToSelect, position);
21299 }
21300 };
21301 // Valid values for position are bottom, middle and top
21302 // position should be {'top','middle','bottom', or undefined/null}.
21303 // if undefined/null, then the grid will to the minimal amount of scrolling,
21304 // eg if grid needs to scroll up, it scrolls until row is on top,
21305 // if grid needs to scroll down, it scrolls until row is on bottom,
21306 // if row is already in view, grid does not scroll
21307 GridBodyScrollFeature.prototype.ensureIndexVisible = function (index, position) {
21308 // if for print or auto height, everything is always visible
21309 if (this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT) {
21310 return;
21311 }
21312 var rowCount = this.paginationProxy.getRowCount();
21313 if (typeof index !== 'number' || index < 0 || index >= rowCount) {
21314 console.warn('invalid row index for ensureIndexVisible: ' + index);
21315 return;
21316 }
21317 var isPaging = this.gridOptionsWrapper.isPagination();
21318 var paginationPanelEnabled = isPaging && !this.gridOptionsWrapper.isSuppressPaginationPanel();
21319 if (!paginationPanelEnabled) {
21320 this.paginationProxy.goToPageWithIndex(index);
21321 }
21322 var rowNode = this.paginationProxy.getRow(index);
21323 var rowGotShiftedDuringOperation;
21324 do {
21325 var startingRowTop = rowNode.rowTop;
21326 var startingRowHeight = rowNode.rowHeight;
21327 var paginationOffset = this.paginationProxy.getPixelOffset();
21328 var rowTopPixel = rowNode.rowTop - paginationOffset;
21329 var rowBottomPixel = rowTopPixel + rowNode.rowHeight;
21330 var scrollPosition = this.getVScrollPosition();
21331 var heightOffset = this.heightScaler.getDivStretchOffset();
21332 var vScrollTop = scrollPosition.top + heightOffset;
21333 var vScrollBottom = scrollPosition.bottom + heightOffset;
21334 var viewportHeight = vScrollBottom - vScrollTop;
21335 // work out the pixels for top, middle and bottom up front,
21336 // make the if/else below easier to read
21337 var pxTop = this.heightScaler.getScrollPositionForPixel(rowTopPixel);
21338 var pxBottom = this.heightScaler.getScrollPositionForPixel(rowBottomPixel - viewportHeight);
21339 // make sure if middle, the row is not outside the top of the grid
21340 var pxMiddle = Math.min((pxTop + pxBottom) / 2, rowTopPixel);
21341 var rowBelowViewport = vScrollTop > rowTopPixel;
21342 var rowAboveViewport = vScrollBottom < rowBottomPixel;
21343 var newScrollPosition = null;
21344 if (position === 'top') {
21345 newScrollPosition = pxTop;
21346 }
21347 else if (position === 'bottom') {
21348 newScrollPosition = pxBottom;
21349 }
21350 else if (position === 'middle') {
21351 newScrollPosition = pxMiddle;
21352 }
21353 else if (rowBelowViewport) {
21354 // if row is before, scroll up with row at top
21355 newScrollPosition = pxTop;
21356 }
21357 else if (rowAboveViewport) {
21358 // if row is below, scroll down with row at bottom
21359 newScrollPosition = pxBottom;
21360 }
21361 if (newScrollPosition !== null) {
21362 this.eBodyViewport.scrollTop = newScrollPosition;
21363 this.rowRenderer.redrawAfterScroll();
21364 }
21365 // the row can get shifted if during the rendering (during rowRenderer.redrawAfterScroll()),
21366 // the height of a row changes due to lazy calculation of row heights when using
21367 // colDef.autoHeight or gridOptions.getRowHeight.
21368 // if row was shifted, then the position we scrolled to is incorrect.
21369 rowGotShiftedDuringOperation = (startingRowTop !== rowNode.rowTop)
21370 || (startingRowHeight !== rowNode.rowHeight);
21371 } while (rowGotShiftedDuringOperation);
21372 // so when we return back to user, the cells have rendered
21373 this.animationFrameService.flushAllFrames();
21374 };
21375 GridBodyScrollFeature.prototype.ensureColumnVisible = function (key, position) {
21376 if (position === void 0) { position = 'auto'; }
21377 var column = this.columnModel.getGridColumn(key);
21378 if (!column) {
21379 return;
21380 }
21381 // calling ensureColumnVisible on a pinned column doesn't make sense
21382 if (column.isPinned()) {
21383 return;
21384 }
21385 // defensive
21386 if (!this.columnModel.isColumnDisplayed(column)) {
21387 return;
21388 }
21389 var newHorizontalScroll = this.getPositionedHorizontalScroll(column, position);
21390 if (newHorizontalScroll !== null) {
21391 this.centerRowContainerCtrl.setCenterViewportScrollLeft(newHorizontalScroll);
21392 }
21393 // this will happen anyway, as the move will cause a 'scroll' event on the body, however
21394 // it is possible that the ensureColumnVisible method is called from within AG Grid and
21395 // the caller will need to have the columns rendered to continue, which will be before
21396 // the event has been worked on (which is the case for cell navigation).
21397 this.centerRowContainerCtrl.onHorizontalViewportChanged();
21398 // so when we return back to user, the cells have rendered
21399 this.animationFrameService.flushAllFrames();
21400 };
21401 GridBodyScrollFeature.prototype.getPositionedHorizontalScroll = function (column, position) {
21402 var _a = this.isColumnOutsideViewport(column), columnBeforeStart = _a.columnBeforeStart, columnAfterEnd = _a.columnAfterEnd;
21403 var viewportTooSmallForColumn = this.centerRowContainerCtrl.getCenterWidth() < column.getActualWidth();
21404 var viewportWidth = this.centerRowContainerCtrl.getCenterWidth();
21405 var isRtl = this.enableRtl;
21406 var alignColToStart = (isRtl ? columnBeforeStart : columnAfterEnd) || viewportTooSmallForColumn;
21407 var alignColToEnd = isRtl ? columnAfterEnd : columnBeforeStart;
21408 if (position !== 'auto') {
21409 alignColToStart = position === 'start';
21410 alignColToEnd = position === 'end';
21411 }
21412 var isMiddle = position === 'middle';
21413 if (alignColToStart || alignColToEnd || isMiddle) {
21414 var _b = this.getColumnBounds(column), colLeft = _b.colLeft, colMiddle = _b.colMiddle, colRight = _b.colRight;
21415 if (isMiddle) {
21416 return colMiddle - viewportWidth / 2;
21417 }
21418 if (alignColToStart) {
21419 return isRtl ? colRight : colLeft;
21420 }
21421 return isRtl ? (colLeft - viewportWidth) : (colRight - viewportWidth);
21422 }
21423 return null;
21424 };
21425 GridBodyScrollFeature.prototype.isColumnOutsideViewport = function (column) {
21426 var _a = this.getViewportBounds(), viewportStart = _a.start, viewportEnd = _a.end;
21427 var _b = this.getColumnBounds(column), colLeft = _b.colLeft, colRight = _b.colRight;
21428 var isRtl = this.enableRtl;
21429 var columnBeforeStart = isRtl ? (viewportStart > colRight) : (viewportEnd < colRight);
21430 var columnAfterEnd = isRtl ? (viewportEnd < colLeft) : (viewportStart > colLeft);
21431 return { columnBeforeStart: columnBeforeStart, columnAfterEnd: columnAfterEnd };
21432 };
21433 GridBodyScrollFeature.prototype.getColumnBounds = function (column) {
21434 var isRtl = this.enableRtl;
21435 var bodyWidth = this.columnModel.getBodyContainerWidth();
21436 var colWidth = column.getActualWidth();
21437 var colLeft = column.getLeft();
21438 var multiplier = isRtl ? -1 : 1;
21439 var colLeftPixel = isRtl ? (bodyWidth - colLeft) : colLeft;
21440 var colRightPixel = colLeftPixel + colWidth * multiplier;
21441 var colMidPixel = colLeftPixel + colWidth / 2 * multiplier;
21442 return { colLeft: colLeftPixel, colMiddle: colMidPixel, colRight: colRightPixel };
21443 };
21444 GridBodyScrollFeature.prototype.getViewportBounds = function () {
21445 var viewportWidth = this.centerRowContainerCtrl.getCenterWidth();
21446 var scrollPosition = this.centerRowContainerCtrl.getCenterViewportScrollLeft();
21447 var viewportStartPixel = scrollPosition;
21448 var viewportEndPixel = viewportWidth + scrollPosition;
21449 return { start: viewportStartPixel, end: viewportEndPixel, width: viewportWidth };
21450 };
21451 __decorate$K([
21452 Autowired('ctrlsService')
21453 ], GridBodyScrollFeature.prototype, "ctrlsService", void 0);
21454 __decorate$K([
21455 Autowired('animationFrameService')
21456 ], GridBodyScrollFeature.prototype, "animationFrameService", void 0);
21457 __decorate$K([
21458 Autowired('columnApi')
21459 ], GridBodyScrollFeature.prototype, "columnApi", void 0);
21460 __decorate$K([
21461 Autowired('gridApi')
21462 ], GridBodyScrollFeature.prototype, "gridApi", void 0);
21463 __decorate$K([
21464 Autowired('paginationProxy')
21465 ], GridBodyScrollFeature.prototype, "paginationProxy", void 0);
21466 __decorate$K([
21467 Autowired('rowModel')
21468 ], GridBodyScrollFeature.prototype, "rowModel", void 0);
21469 __decorate$K([
21470 Autowired('rowContainerHeightService')
21471 ], GridBodyScrollFeature.prototype, "heightScaler", void 0);
21472 __decorate$K([
21473 Autowired('rowRenderer')
21474 ], GridBodyScrollFeature.prototype, "rowRenderer", void 0);
21475 __decorate$K([
21476 Autowired('columnModel')
21477 ], GridBodyScrollFeature.prototype, "columnModel", void 0);
21478 __decorate$K([
21479 PostConstruct
21480 ], GridBodyScrollFeature.prototype, "postConstruct", null);
21481 return GridBodyScrollFeature;
21482}(BeanStub));
21483
21484/**
21485 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
21486 * @version v27.3.0
21487 * @link https://www.ag-grid.com/
21488 * @license MIT
21489 */
21490var AutoScrollService = /** @class */ (function () {
21491 function AutoScrollService(params) {
21492 this.tickingInterval = null;
21493 this.onScrollCallback = null;
21494 this.scrollContainer = params.scrollContainer;
21495 this.scrollHorizontally = params.scrollAxis.indexOf('x') !== -1;
21496 this.scrollVertically = params.scrollAxis.indexOf('y') !== -1;
21497 this.scrollByTick = params.scrollByTick != null ? params.scrollByTick : 20;
21498 if (params.onScrollCallback) {
21499 this.onScrollCallback = params.onScrollCallback;
21500 }
21501 if (this.scrollVertically) {
21502 this.getVerticalPosition = params.getVerticalPosition;
21503 this.setVerticalPosition = params.setVerticalPosition;
21504 }
21505 if (this.scrollHorizontally) {
21506 this.getHorizontalPosition = params.getHorizontalPosition;
21507 this.setHorizontalPosition = params.setHorizontalPosition;
21508 }
21509 this.shouldSkipVerticalScroll = params.shouldSkipVerticalScroll || (function () { return false; });
21510 this.shouldSkipHorizontalScroll = params.shouldSkipHorizontalScroll || (function () { return false; });
21511 }
21512 AutoScrollService.prototype.check = function (mouseEvent, forceSkipVerticalScroll) {
21513 if (forceSkipVerticalScroll === void 0) { forceSkipVerticalScroll = false; }
21514 var skipVerticalScroll = forceSkipVerticalScroll || this.shouldSkipVerticalScroll();
21515 if (skipVerticalScroll && this.shouldSkipHorizontalScroll()) {
21516 return;
21517 }
21518 var rect = this.scrollContainer.getBoundingClientRect();
21519 var scrollTick = this.scrollByTick;
21520 this.tickLeft = mouseEvent.clientX < (rect.left + scrollTick);
21521 this.tickRight = mouseEvent.clientX > (rect.right - scrollTick);
21522 this.tickUp = mouseEvent.clientY < (rect.top + scrollTick) && !skipVerticalScroll;
21523 this.tickDown = mouseEvent.clientY > (rect.bottom - scrollTick) && !skipVerticalScroll;
21524 if (this.tickLeft || this.tickRight || this.tickUp || this.tickDown) {
21525 this.ensureTickingStarted();
21526 }
21527 else {
21528 this.ensureCleared();
21529 }
21530 };
21531 AutoScrollService.prototype.ensureTickingStarted = function () {
21532 if (this.tickingInterval === null) {
21533 this.tickingInterval = window.setInterval(this.doTick.bind(this), 100);
21534 this.tickCount = 0;
21535 }
21536 };
21537 AutoScrollService.prototype.doTick = function () {
21538 this.tickCount++;
21539 var tickAmount;
21540 tickAmount = this.tickCount > 20 ? 200 : (this.tickCount > 10 ? 80 : 40);
21541 if (this.scrollVertically) {
21542 var vScrollPosition = this.getVerticalPosition();
21543 if (this.tickUp) {
21544 this.setVerticalPosition(vScrollPosition - tickAmount);
21545 }
21546 if (this.tickDown) {
21547 this.setVerticalPosition(vScrollPosition + tickAmount);
21548 }
21549 }
21550 if (this.scrollHorizontally) {
21551 var hScrollPosition = this.getHorizontalPosition();
21552 if (this.tickLeft) {
21553 this.setHorizontalPosition(hScrollPosition - tickAmount);
21554 }
21555 if (this.tickRight) {
21556 this.setHorizontalPosition(hScrollPosition + tickAmount);
21557 }
21558 }
21559 if (this.onScrollCallback) {
21560 this.onScrollCallback();
21561 }
21562 };
21563 AutoScrollService.prototype.ensureCleared = function () {
21564 if (this.tickingInterval) {
21565 window.clearInterval(this.tickingInterval);
21566 this.tickingInterval = null;
21567 }
21568 };
21569 return AutoScrollService;
21570}());
21571
21572/**
21573 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
21574 * @version v27.3.0
21575 * @link https://www.ag-grid.com/
21576 * @license MIT
21577 */
21578var __extends$S = (undefined && undefined.__extends) || (function () {
21579 var extendStatics = function (d, b) {
21580 extendStatics = Object.setPrototypeOf ||
21581 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
21582 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
21583 return extendStatics(d, b);
21584 };
21585 return function (d, b) {
21586 extendStatics(d, b);
21587 function __() { this.constructor = d; }
21588 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
21589 };
21590})();
21591var __assign$a = (undefined && undefined.__assign) || function () {
21592 __assign$a = Object.assign || function(t) {
21593 for (var s, i = 1, n = arguments.length; i < n; i++) {
21594 s = arguments[i];
21595 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21596 t[p] = s[p];
21597 }
21598 return t;
21599 };
21600 return __assign$a.apply(this, arguments);
21601};
21602var __decorate$L = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
21603 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
21604 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21605 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;
21606 return c > 3 && r && Object.defineProperty(target, key, r), r;
21607};
21608var __read$7 = (undefined && undefined.__read) || function (o, n) {
21609 var m = typeof Symbol === "function" && o[Symbol.iterator];
21610 if (!m) return o;
21611 var i = m.call(o), r, ar = [], e;
21612 try {
21613 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
21614 }
21615 catch (error) { e = { error: error }; }
21616 finally {
21617 try {
21618 if (r && !r.done && (m = i["return"])) m.call(i);
21619 }
21620 finally { if (e) throw e.error; }
21621 }
21622 return ar;
21623};
21624var __spread$5 = (undefined && undefined.__spread) || function () {
21625 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$7(arguments[i]));
21626 return ar;
21627};
21628var RowDragFeature = /** @class */ (function (_super) {
21629 __extends$S(RowDragFeature, _super);
21630 function RowDragFeature(eContainer) {
21631 var _this = _super.call(this) || this;
21632 _this.isMultiRowDrag = false;
21633 _this.isGridSorted = false;
21634 _this.isGridFiltered = false;
21635 _this.isRowGroupActive = false;
21636 _this.eContainer = eContainer;
21637 return _this;
21638 }
21639 RowDragFeature.prototype.postConstruct = function () {
21640 var _this = this;
21641 if (this.gridOptionsWrapper.isRowModelDefault()) {
21642 this.clientSideRowModel = this.rowModel;
21643 }
21644 var refreshStatus = function () {
21645 _this.onSortChanged();
21646 _this.onFilterChanged();
21647 _this.onRowGroupChanged();
21648 };
21649 this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
21650 this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
21651 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onRowGroupChanged.bind(this));
21652 this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, function () {
21653 refreshStatus();
21654 });
21655 refreshStatus();
21656 this.ctrlsService.whenReady(function () {
21657 var gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
21658 _this.autoScrollService = new AutoScrollService({
21659 scrollContainer: gridBodyCon.getBodyViewportElement(),
21660 scrollAxis: 'y',
21661 getVerticalPosition: function () { return gridBodyCon.getScrollFeature().getVScrollPosition().top; },
21662 setVerticalPosition: function (position) { return gridBodyCon.getScrollFeature().setVerticalScrollPosition(position); },
21663 onScrollCallback: function () { _this.onDragging(_this.lastDraggingEvent); }
21664 });
21665 });
21666 };
21667 RowDragFeature.prototype.onSortChanged = function () {
21668 this.isGridSorted = this.sortController.isSortActive();
21669 };
21670 RowDragFeature.prototype.onFilterChanged = function () {
21671 this.isGridFiltered = this.filterManager.isAnyFilterPresent();
21672 };
21673 RowDragFeature.prototype.onRowGroupChanged = function () {
21674 var rowGroups = this.columnModel.getRowGroupColumns();
21675 this.isRowGroupActive = !missingOrEmpty(rowGroups);
21676 };
21677 RowDragFeature.prototype.getContainer = function () {
21678 return this.eContainer;
21679 };
21680 RowDragFeature.prototype.isInterestedIn = function (type) {
21681 return type === exports.DragSourceType.RowDrag;
21682 };
21683 RowDragFeature.prototype.getIconName = function () {
21684 var managedDrag = this.gridOptionsWrapper.isRowDragManaged();
21685 if (managedDrag && this.shouldPreventRowMove()) {
21686 return DragAndDropService.ICON_NOT_ALLOWED;
21687 }
21688 return DragAndDropService.ICON_MOVE;
21689 };
21690 RowDragFeature.prototype.shouldPreventRowMove = function () {
21691 return this.isGridSorted || this.isGridFiltered || this.isRowGroupActive;
21692 };
21693 RowDragFeature.prototype.getRowNodes = function (draggingEvent) {
21694 var _this = this;
21695 if (!this.isFromThisGrid(draggingEvent)) {
21696 return draggingEvent.dragItem.rowNodes || [];
21697 }
21698 var isRowDragMultiRow = this.gridOptionsWrapper.isRowDragMultiRow();
21699 var selectedNodes = __spread$5(this.selectionService.getSelectedNodes()).sort(function (a, b) { return _this.getRowIndexNumber(a) - _this.getRowIndexNumber(b); });
21700 var currentNode = draggingEvent.dragItem.rowNode;
21701 if (isRowDragMultiRow && selectedNodes.indexOf(currentNode) !== -1) {
21702 this.isMultiRowDrag = true;
21703 return selectedNodes;
21704 }
21705 this.isMultiRowDrag = false;
21706 return [currentNode];
21707 };
21708 RowDragFeature.prototype.onDragEnter = function (draggingEvent) {
21709 // builds a lits of all rows being dragged before firing events
21710 draggingEvent.dragItem.rowNodes = this.getRowNodes(draggingEvent);
21711 // when entering, we fire the enter event, then in onEnterOrDragging,
21712 // we also fire the move event. so we get both events when entering.
21713 this.dispatchGridEvent(Events.EVENT_ROW_DRAG_ENTER, draggingEvent);
21714 this.getRowNodes(draggingEvent).forEach(function (rowNode) {
21715 rowNode.setDragging(true);
21716 });
21717 this.onEnterOrDragging(draggingEvent);
21718 };
21719 RowDragFeature.prototype.onDragging = function (draggingEvent) {
21720 this.onEnterOrDragging(draggingEvent);
21721 };
21722 RowDragFeature.prototype.isFromThisGrid = function (draggingEvent) {
21723 var dragSourceDomDataKey = draggingEvent.dragSource.dragSourceDomDataKey;
21724 return dragSourceDomDataKey === this.gridOptionsWrapper.getDomDataKey();
21725 };
21726 RowDragFeature.prototype.isDropZoneWithinThisGrid = function (draggingEvent) {
21727 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
21728 var gridGui = gridBodyCon.getGui();
21729 var dropZoneTarget = draggingEvent.dropZoneTarget;
21730 return !gridGui.contains(dropZoneTarget);
21731 };
21732 RowDragFeature.prototype.onEnterOrDragging = function (draggingEvent) {
21733 // this event is fired for enter and move
21734 this.dispatchGridEvent(Events.EVENT_ROW_DRAG_MOVE, draggingEvent);
21735 this.lastDraggingEvent = draggingEvent;
21736 var pixel = this.mouseEventService.getNormalisedPosition(draggingEvent).y;
21737 var managedDrag = this.gridOptionsWrapper.isRowDragManaged();
21738 if (managedDrag) {
21739 this.doManagedDrag(draggingEvent, pixel);
21740 }
21741 this.autoScrollService.check(draggingEvent.event);
21742 };
21743 RowDragFeature.prototype.doManagedDrag = function (draggingEvent, pixel) {
21744 var isFromThisGrid = this.isFromThisGrid(draggingEvent);
21745 var managedDrag = this.gridOptionsWrapper.isRowDragManaged();
21746 var rowNodes = draggingEvent.dragItem.rowNodes;
21747 if (managedDrag && this.shouldPreventRowMove()) {
21748 return;
21749 }
21750 if (this.gridOptionsWrapper.isSuppressMoveWhenRowDragging() || !isFromThisGrid) {
21751 if (!this.isDropZoneWithinThisGrid(draggingEvent)) {
21752 this.clientSideRowModel.highlightRowAtPixel(rowNodes[0], pixel);
21753 }
21754 }
21755 else {
21756 this.moveRows(rowNodes, pixel);
21757 }
21758 };
21759 RowDragFeature.prototype.getRowIndexNumber = function (rowNode) {
21760 return parseInt(last(rowNode.getRowIndexString().split('-')), 10);
21761 };
21762 RowDragFeature.prototype.moveRowAndClearHighlight = function (draggingEvent) {
21763 var _this = this;
21764 var lastHighlightedRowNode = this.clientSideRowModel.getLastHighlightedRowNode();
21765 var isBelow = lastHighlightedRowNode && lastHighlightedRowNode.highlighted === exports.RowHighlightPosition.Below;
21766 var pixel = this.mouseEventService.getNormalisedPosition(draggingEvent).y;
21767 var rowNodes = draggingEvent.dragItem.rowNodes;
21768 var increment = isBelow ? 1 : 0;
21769 if (this.isFromThisGrid(draggingEvent)) {
21770 rowNodes.forEach(function (rowNode) {
21771 if (rowNode.rowTop < pixel) {
21772 increment -= 1;
21773 }
21774 });
21775 this.moveRows(rowNodes, pixel, increment);
21776 }
21777 else {
21778 var getRowIdFunc_1 = this.gridOptionsWrapper.getRowIdFunc();
21779 var addIndex = this.clientSideRowModel.getRowIndexAtPixel(pixel) + 1;
21780 if (this.clientSideRowModel.getHighlightPosition(pixel) === exports.RowHighlightPosition.Above) {
21781 addIndex--;
21782 }
21783 this.clientSideRowModel.updateRowData({
21784 add: rowNodes
21785 .map(function (node) { return node.data; })
21786 .filter(function (data) { return !_this.clientSideRowModel.getRowNode(getRowIdFunc_1 ? getRowIdFunc_1({ data: data, level: 0 }) : data.id); }),
21787 addIndex: addIndex
21788 });
21789 }
21790 this.clearRowHighlight();
21791 };
21792 RowDragFeature.prototype.clearRowHighlight = function () {
21793 this.clientSideRowModel.highlightRowAtPixel(null);
21794 };
21795 RowDragFeature.prototype.moveRows = function (rowNodes, pixel, increment) {
21796 if (increment === void 0) { increment = 0; }
21797 var rowWasMoved = this.clientSideRowModel.ensureRowsAtPixel(rowNodes, pixel, increment);
21798 if (rowWasMoved) {
21799 this.focusService.clearFocusedCell();
21800 if (this.rangeService) {
21801 this.rangeService.removeAllCellRanges();
21802 }
21803 }
21804 };
21805 RowDragFeature.prototype.addRowDropZone = function (params) {
21806 var _this = this;
21807 if (!params.getContainer()) {
21808 doOnce(function () { return console.warn('AG Grid: addRowDropZone - A container target needs to be provided'); }, 'add-drop-zone-empty-target');
21809 return;
21810 }
21811 if (this.dragAndDropService.findExternalZone(params)) {
21812 console.warn('AG Grid: addRowDropZone - target already exists in the list of DropZones. Use `removeRowDropZone` before adding it again.');
21813 return;
21814 }
21815 var processedParams = {
21816 getContainer: params.getContainer
21817 };
21818 if (params.fromGrid) {
21819 params.fromGrid = undefined;
21820 processedParams = params;
21821 }
21822 else {
21823 if (params.onDragEnter) {
21824 processedParams.onDragEnter = function (e) {
21825 params.onDragEnter(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_ENTER, e));
21826 };
21827 }
21828 if (params.onDragLeave) {
21829 processedParams.onDragLeave = function (e) {
21830 params.onDragLeave(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_LEAVE, e));
21831 };
21832 }
21833 if (params.onDragging) {
21834 processedParams.onDragging = function (e) {
21835 params.onDragging(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_MOVE, e));
21836 };
21837 }
21838 if (params.onDragStop) {
21839 processedParams.onDragStop = function (e) {
21840 params.onDragStop(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_END, e));
21841 };
21842 }
21843 }
21844 this.dragAndDropService.addDropTarget(__assign$a({ isInterestedIn: function (type) { return type === exports.DragSourceType.RowDrag; }, getIconName: function () { return DragAndDropService.ICON_MOVE; }, external: true }, processedParams));
21845 };
21846 RowDragFeature.prototype.getRowDropZone = function (events) {
21847 var _this = this;
21848 var getContainer = this.getContainer.bind(this);
21849 var onDragEnter = this.onDragEnter.bind(this);
21850 var onDragLeave = this.onDragLeave.bind(this);
21851 var onDragging = this.onDragging.bind(this);
21852 var onDragStop = this.onDragStop.bind(this);
21853 if (!events) {
21854 return { getContainer: getContainer, onDragEnter: onDragEnter, onDragLeave: onDragLeave, onDragging: onDragging, onDragStop: onDragStop, /* @private */ fromGrid: true };
21855 }
21856 return {
21857 getContainer: getContainer,
21858 onDragEnter: events.onDragEnter
21859 ? (function (e) {
21860 onDragEnter(e);
21861 events.onDragEnter(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_ENTER, e));
21862 })
21863 : onDragEnter,
21864 onDragLeave: events.onDragLeave
21865 ? (function (e) {
21866 onDragLeave(e);
21867 events.onDragLeave(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_LEAVE, e));
21868 })
21869 : onDragLeave,
21870 onDragging: events.onDragging
21871 ? (function (e) {
21872 onDragging(e);
21873 events.onDragging(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_MOVE, e));
21874 })
21875 : onDragging,
21876 onDragStop: events.onDragStop
21877 ? (function (e) {
21878 onDragStop(e);
21879 events.onDragStop(_this.draggingToRowDragEvent(Events.EVENT_ROW_DRAG_END, e));
21880 })
21881 : onDragStop,
21882 fromGrid: true /* @private */
21883 };
21884 };
21885 RowDragFeature.prototype.draggingToRowDragEvent = function (type, draggingEvent) {
21886 var yNormalised = this.mouseEventService.getNormalisedPosition(draggingEvent).y;
21887 var mouseIsPastLastRow = yNormalised > this.paginationProxy.getCurrentPageHeight();
21888 var overIndex = -1;
21889 var overNode;
21890 if (!mouseIsPastLastRow) {
21891 overIndex = this.rowModel.getRowIndexAtPixel(yNormalised);
21892 overNode = this.rowModel.getRow(overIndex);
21893 }
21894 var vDirectionString;
21895 switch (draggingEvent.vDirection) {
21896 case exports.VerticalDirection.Down:
21897 vDirectionString = 'down';
21898 break;
21899 case exports.VerticalDirection.Up:
21900 vDirectionString = 'up';
21901 break;
21902 default:
21903 vDirectionString = null;
21904 break;
21905 }
21906 var event = {
21907 type: type,
21908 api: this.gridOptionsWrapper.getApi(),
21909 columnApi: this.gridOptionsWrapper.getColumnApi(),
21910 event: draggingEvent.event,
21911 node: draggingEvent.dragItem.rowNode,
21912 nodes: draggingEvent.dragItem.rowNodes,
21913 overIndex: overIndex,
21914 overNode: overNode,
21915 y: yNormalised,
21916 vDirection: vDirectionString
21917 };
21918 return event;
21919 };
21920 RowDragFeature.prototype.dispatchGridEvent = function (type, draggingEvent) {
21921 var event = this.draggingToRowDragEvent(type, draggingEvent);
21922 this.eventService.dispatchEvent(event);
21923 };
21924 RowDragFeature.prototype.onDragLeave = function (draggingEvent) {
21925 this.dispatchGridEvent(Events.EVENT_ROW_DRAG_LEAVE, draggingEvent);
21926 this.stopDragging(draggingEvent);
21927 if (this.gridOptionsWrapper.isRowDragManaged()) {
21928 this.clearRowHighlight();
21929 }
21930 if (this.isFromThisGrid(draggingEvent)) {
21931 this.isMultiRowDrag = false;
21932 }
21933 };
21934 RowDragFeature.prototype.onDragStop = function (draggingEvent) {
21935 this.dispatchGridEvent(Events.EVENT_ROW_DRAG_END, draggingEvent);
21936 this.stopDragging(draggingEvent);
21937 if (this.gridOptionsWrapper.isRowDragManaged() &&
21938 (this.gridOptionsWrapper.isSuppressMoveWhenRowDragging() || !this.isFromThisGrid(draggingEvent)) &&
21939 !this.isDropZoneWithinThisGrid(draggingEvent)) {
21940 this.moveRowAndClearHighlight(draggingEvent);
21941 }
21942 };
21943 RowDragFeature.prototype.stopDragging = function (draggingEvent) {
21944 this.autoScrollService.ensureCleared();
21945 this.getRowNodes(draggingEvent).forEach(function (rowNode) {
21946 rowNode.setDragging(false);
21947 });
21948 };
21949 __decorate$L([
21950 Autowired('dragAndDropService')
21951 ], RowDragFeature.prototype, "dragAndDropService", void 0);
21952 __decorate$L([
21953 Autowired('rowModel')
21954 ], RowDragFeature.prototype, "rowModel", void 0);
21955 __decorate$L([
21956 Autowired('paginationProxy')
21957 ], RowDragFeature.prototype, "paginationProxy", void 0);
21958 __decorate$L([
21959 Autowired('columnModel')
21960 ], RowDragFeature.prototype, "columnModel", void 0);
21961 __decorate$L([
21962 Autowired('focusService')
21963 ], RowDragFeature.prototype, "focusService", void 0);
21964 __decorate$L([
21965 Autowired('sortController')
21966 ], RowDragFeature.prototype, "sortController", void 0);
21967 __decorate$L([
21968 Autowired('filterManager')
21969 ], RowDragFeature.prototype, "filterManager", void 0);
21970 __decorate$L([
21971 Autowired('selectionService')
21972 ], RowDragFeature.prototype, "selectionService", void 0);
21973 __decorate$L([
21974 Autowired('mouseEventService')
21975 ], RowDragFeature.prototype, "mouseEventService", void 0);
21976 __decorate$L([
21977 Autowired('ctrlsService')
21978 ], RowDragFeature.prototype, "ctrlsService", void 0);
21979 __decorate$L([
21980 Optional('rangeService')
21981 ], RowDragFeature.prototype, "rangeService", void 0);
21982 __decorate$L([
21983 Autowired('columnApi')
21984 ], RowDragFeature.prototype, "columnApi", void 0);
21985 __decorate$L([
21986 Autowired('gridApi')
21987 ], RowDragFeature.prototype, "gridApi", void 0);
21988 __decorate$L([
21989 PostConstruct
21990 ], RowDragFeature.prototype, "postConstruct", null);
21991 return RowDragFeature;
21992}(BeanStub));
21993
21994/**
21995 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
21996 * @version v27.3.0
21997 * @link https://www.ag-grid.com/
21998 * @license MIT
21999 */
22000var __extends$T = (undefined && undefined.__extends) || (function () {
22001 var extendStatics = function (d, b) {
22002 extendStatics = Object.setPrototypeOf ||
22003 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22004 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
22005 return extendStatics(d, b);
22006 };
22007 return function (d, b) {
22008 extendStatics(d, b);
22009 function __() { this.constructor = d; }
22010 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
22011 };
22012})();
22013var __decorate$M = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
22014 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22015 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
22016 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;
22017 return c > 3 && r && Object.defineProperty(target, key, r), r;
22018};
22019(function (RowAnimationCssClasses) {
22020 RowAnimationCssClasses["ANIMATION_ON"] = "ag-row-animation";
22021 RowAnimationCssClasses["ANIMATION_OFF"] = "ag-row-no-animation";
22022})(exports.RowAnimationCssClasses || (exports.RowAnimationCssClasses = {}));
22023var CSS_CLASS_CELL_SELECTABLE = 'ag-selectable';
22024var CSS_CLASS_FORCE_VERTICAL_SCROLL = 'ag-force-vertical-scroll';
22025var CSS_CLASS_COLUMN_MOVING = 'ag-column-moving';
22026var GridBodyCtrl = /** @class */ (function (_super) {
22027 __extends$T(GridBodyCtrl, _super);
22028 function GridBodyCtrl() {
22029 return _super !== null && _super.apply(this, arguments) || this;
22030 }
22031 GridBodyCtrl.prototype.getScrollFeature = function () {
22032 return this.bodyScrollFeature;
22033 };
22034 GridBodyCtrl.prototype.getBodyViewportElement = function () {
22035 return this.eBodyViewport;
22036 };
22037 GridBodyCtrl.prototype.setComp = function (comp, eGridBody, eBodyViewport, eTop, eBottom) {
22038 this.comp = comp;
22039 this.eGridBody = eGridBody;
22040 this.eBodyViewport = eBodyViewport;
22041 this.eTop = eTop;
22042 this.eBottom = eBottom;
22043 this.setCellTextSelection(this.gridOptionsWrapper.isEnableCellTextSelect());
22044 this.createManagedBean(new LayoutFeature(this.comp));
22045 this.bodyScrollFeature = this.createManagedBean(new GridBodyScrollFeature(this.eBodyViewport));
22046 this.addRowDragListener();
22047 this.setupRowAnimationCssClass();
22048 this.addEventListeners();
22049 this.addFocusListeners([eTop, eBodyViewport, eBottom]);
22050 this.onGridColumnsChanged();
22051 this.addBodyViewportListener();
22052 this.setFloatingHeights();
22053 this.disableBrowserDragging();
22054 this.addStopEditingWhenGridLosesFocus();
22055 this.ctrlsService.registerGridBodyCtrl(this);
22056 };
22057 GridBodyCtrl.prototype.getComp = function () {
22058 return this.comp;
22059 };
22060 GridBodyCtrl.prototype.addEventListeners = function () {
22061 this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this));
22062 this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, this.onScrollVisibilityChanged.bind(this));
22063 this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.setFloatingHeights.bind(this));
22064 };
22065 GridBodyCtrl.prototype.addFocusListeners = function (elements) {
22066 var _this = this;
22067 elements.forEach(function (element) {
22068 _this.addManagedListener(element, 'focusin', function () {
22069 element.classList.add('ag-has-focus');
22070 });
22071 _this.addManagedListener(element, 'focusout', function (e) {
22072 if (!element.contains(e.relatedTarget)) {
22073 element.classList.remove('ag-has-focus');
22074 }
22075 });
22076 });
22077 };
22078 // used by ColumnAnimationService
22079 GridBodyCtrl.prototype.setColumnMovingCss = function (moving) {
22080 this.comp.setColumnMovingCss(moving ? CSS_CLASS_COLUMN_MOVING : null, moving);
22081 };
22082 GridBodyCtrl.prototype.setCellTextSelection = function (selectable) {
22083 if (selectable === void 0) { selectable = false; }
22084 var cssClass = selectable ? CSS_CLASS_CELL_SELECTABLE : null;
22085 this.comp.setCellSelectableCss(cssClass, selectable);
22086 };
22087 GridBodyCtrl.prototype.onScrollVisibilityChanged = function () {
22088 var visible = this.scrollVisibleService.isVerticalScrollShowing();
22089 this.setVerticalScrollPaddingVisible(visible);
22090 };
22091 GridBodyCtrl.prototype.onGridColumnsChanged = function () {
22092 var columns = this.columnModel.getAllGridColumns();
22093 this.comp.setColumnCount(columns ? columns.length : 0);
22094 };
22095 // if we do not do this, then the user can select a pic in the grid (eg an image in a custom cell renderer)
22096 // and then that will start the browser native drag n' drop, which messes up with our own drag and drop.
22097 GridBodyCtrl.prototype.disableBrowserDragging = function () {
22098 this.addManagedListener(this.eGridBody, 'dragstart', function (event) {
22099 if (event.target instanceof HTMLImageElement) {
22100 event.preventDefault();
22101 return false;
22102 }
22103 });
22104 };
22105 GridBodyCtrl.prototype.addStopEditingWhenGridLosesFocus = function () {
22106 var _this = this;
22107 if (!this.gridOptionsWrapper.isStopEditingWhenCellsLoseFocus()) {
22108 return;
22109 }
22110 var focusOutListener = function (event) {
22111 // this is the element the focus is moving to
22112 var elementWithFocus = event.relatedTarget;
22113 if (getTabIndex(elementWithFocus) === null) {
22114 _this.rowRenderer.stopEditing();
22115 return;
22116 }
22117 var clickInsideGrid =
22118 // see if click came from inside the viewports
22119 viewports.some(function (viewport) { return viewport.contains(elementWithFocus); })
22120 // and also that it's not from a detail grid
22121 && _this.mouseEventService.isElementInThisGrid(elementWithFocus);
22122 if (!clickInsideGrid) {
22123 var popupService = _this.popupService;
22124 clickInsideGrid =
22125 popupService.getActivePopups().some(function (popup) { return popup.contains(elementWithFocus); }) ||
22126 popupService.isElementWithinCustomPopup(elementWithFocus);
22127 }
22128 if (!clickInsideGrid) {
22129 _this.rowRenderer.stopEditing();
22130 }
22131 };
22132 var viewports = [this.eBodyViewport, this.eBottom, this.eTop];
22133 viewports.forEach(function (viewport) { return _this.addManagedListener(viewport, 'focusout', focusOutListener); });
22134 };
22135 GridBodyCtrl.prototype.updateRowCount = function () {
22136 var headerCount = this.headerNavigationService.getHeaderRowCount();
22137 var modelType = this.paginationProxy.getType();
22138 var rowCount = -1;
22139 if (modelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
22140 rowCount = 0;
22141 this.paginationProxy.forEachNode(function (node) {
22142 if (!node.group) {
22143 rowCount++;
22144 }
22145 });
22146 }
22147 var total = rowCount === -1 ? -1 : (headerCount + rowCount);
22148 this.comp.setRowCount(total);
22149 };
22150 GridBodyCtrl.prototype.registerBodyViewportResizeListener = function (listener) {
22151 this.comp.registerBodyViewportResizeListener(listener);
22152 };
22153 GridBodyCtrl.prototype.setVerticalScrollPaddingVisible = function (visible) {
22154 var overflowY = visible ? 'scroll' : 'hidden';
22155 this.comp.setPinnedTopBottomOverflowY(overflowY);
22156 };
22157 GridBodyCtrl.prototype.isVerticalScrollShowing = function () {
22158 var show = this.gridOptionsWrapper.isAlwaysShowVerticalScroll();
22159 var cssClass = show ? CSS_CLASS_FORCE_VERTICAL_SCROLL : null;
22160 this.comp.setAlwaysVerticalScrollClass(cssClass, show);
22161 return show || isVerticalScrollShowing(this.eBodyViewport);
22162 };
22163 GridBodyCtrl.prototype.setupRowAnimationCssClass = function () {
22164 var _this = this;
22165 var listener = function () {
22166 // we don't want to use row animation if scaling, as rows jump strangely as you scroll,
22167 // when scaling and doing row animation.
22168 var animateRows = _this.gridOptionsWrapper.isAnimateRows() && !_this.rowContainerHeightService.isStretching();
22169 var animateRowsCssClass = animateRows ? exports.RowAnimationCssClasses.ANIMATION_ON : exports.RowAnimationCssClasses.ANIMATION_OFF;
22170 _this.comp.setRowAnimationCssOnBodyViewport(animateRowsCssClass, animateRows);
22171 };
22172 listener();
22173 this.addManagedListener(this.eventService, Events.EVENT_HEIGHT_SCALE_CHANGED, listener);
22174 };
22175 GridBodyCtrl.prototype.getGridBodyElement = function () {
22176 return this.eGridBody;
22177 };
22178 GridBodyCtrl.prototype.addBodyViewportListener = function () {
22179 var _this = this;
22180 // we want to listen for clicks directly on the eBodyViewport, so the user has a way of showing
22181 // the context menu if no rows or columns are displayed, or user simply clicks outside of a cell
22182 var listener = function (mouseEvent) {
22183 if (_this.gridOptionsWrapper.isPreventDefaultOnContextMenu()) {
22184 mouseEvent.preventDefault();
22185 }
22186 var target = mouseEvent.target;
22187 if (target === _this.eBodyViewport || target === _this.ctrlsService.getCenterRowContainerCtrl().getViewportElement()) {
22188 // show it
22189 if (_this.contextMenuFactory) {
22190 _this.contextMenuFactory.onContextMenu(mouseEvent, null, null, null, null, _this.eGridBody);
22191 }
22192 }
22193 };
22194 this.addManagedListener(this.eBodyViewport, 'contextmenu', listener);
22195 this.addManagedListener(this.eBodyViewport, 'wheel', this.onWheel.bind(this));
22196 };
22197 GridBodyCtrl.prototype.onWheel = function (e) {
22198 if (!this.gridOptionsWrapper.isSuppressScrollWhenPopupsAreOpen()) {
22199 return;
22200 }
22201 if (this.popupService.hasAnchoredPopup()) {
22202 e.preventDefault();
22203 }
22204 };
22205 GridBodyCtrl.prototype.getGui = function () {
22206 return this.eGridBody;
22207 };
22208 // called by rowDragFeature
22209 GridBodyCtrl.prototype.scrollVertically = function (pixels) {
22210 var oldScrollPosition = this.eBodyViewport.scrollTop;
22211 this.bodyScrollFeature.setVerticalScrollPosition(oldScrollPosition + pixels);
22212 return this.eBodyViewport.scrollTop - oldScrollPosition;
22213 };
22214 GridBodyCtrl.prototype.addRowDragListener = function () {
22215 this.rowDragFeature = this.createManagedBean(new RowDragFeature(this.eBodyViewport));
22216 this.dragAndDropService.addDropTarget(this.rowDragFeature);
22217 };
22218 GridBodyCtrl.prototype.getRowDragFeature = function () {
22219 return this.rowDragFeature;
22220 };
22221 GridBodyCtrl.prototype.setFloatingHeights = function () {
22222 var pinnedRowModel = this.pinnedRowModel;
22223 var floatingTopHeight = pinnedRowModel.getPinnedTopTotalHeight();
22224 if (floatingTopHeight) {
22225 // adding 1px for cell bottom border
22226 floatingTopHeight += 1;
22227 }
22228 var floatingBottomHeight = pinnedRowModel.getPinnedBottomTotalHeight();
22229 if (floatingBottomHeight) {
22230 // adding 1px for cell bottom border
22231 floatingBottomHeight += 1;
22232 }
22233 this.comp.setTopHeight(floatingTopHeight);
22234 this.comp.setBottomHeight(floatingBottomHeight);
22235 this.comp.setTopDisplay(floatingTopHeight ? 'inherit' : 'none');
22236 this.comp.setBottomDisplay(floatingBottomHeight ? 'inherit' : 'none');
22237 };
22238 // method will call itself if no available width. this covers if the grid
22239 // isn't visible, but is just about to be visible.
22240 GridBodyCtrl.prototype.sizeColumnsToFit = function (nextTimeout) {
22241 var _this = this;
22242 var removeScrollWidth = this.isVerticalScrollShowing();
22243 var scrollWidthToRemove = removeScrollWidth ? this.gridOptionsWrapper.getScrollbarWidth() : 0;
22244 var bodyViewportWidth = getInnerWidth(this.eBodyViewport);
22245 var availableWidth = bodyViewportWidth - scrollWidthToRemove;
22246 if (availableWidth > 0) {
22247 this.columnModel.sizeColumnsToFit(availableWidth, "sizeColumnsToFit");
22248 return;
22249 }
22250 if (nextTimeout === undefined) {
22251 window.setTimeout(function () {
22252 _this.sizeColumnsToFit(100);
22253 }, 0);
22254 }
22255 else if (nextTimeout === 100) {
22256 window.setTimeout(function () {
22257 _this.sizeColumnsToFit(500);
22258 }, 100);
22259 }
22260 else if (nextTimeout === 500) {
22261 window.setTimeout(function () {
22262 _this.sizeColumnsToFit(-1);
22263 }, 500);
22264 }
22265 else {
22266 console.warn('AG Grid: tried to call sizeColumnsToFit() but the grid is coming back with ' +
22267 'zero width, maybe the grid is not visible yet on the screen?');
22268 }
22269 };
22270 // + rangeService
22271 GridBodyCtrl.prototype.addScrollEventListener = function (listener) {
22272 this.eBodyViewport.addEventListener('scroll', listener);
22273 };
22274 // + focusService
22275 GridBodyCtrl.prototype.removeScrollEventListener = function (listener) {
22276 this.eBodyViewport.removeEventListener('scroll', listener);
22277 };
22278 __decorate$M([
22279 Autowired('rowContainerHeightService')
22280 ], GridBodyCtrl.prototype, "rowContainerHeightService", void 0);
22281 __decorate$M([
22282 Autowired('ctrlsService')
22283 ], GridBodyCtrl.prototype, "ctrlsService", void 0);
22284 __decorate$M([
22285 Autowired('columnModel')
22286 ], GridBodyCtrl.prototype, "columnModel", void 0);
22287 __decorate$M([
22288 Autowired('scrollVisibleService')
22289 ], GridBodyCtrl.prototype, "scrollVisibleService", void 0);
22290 __decorate$M([
22291 Optional('contextMenuFactory')
22292 ], GridBodyCtrl.prototype, "contextMenuFactory", void 0);
22293 __decorate$M([
22294 Autowired('headerNavigationService')
22295 ], GridBodyCtrl.prototype, "headerNavigationService", void 0);
22296 __decorate$M([
22297 Autowired('paginationProxy')
22298 ], GridBodyCtrl.prototype, "paginationProxy", void 0);
22299 __decorate$M([
22300 Autowired('dragAndDropService')
22301 ], GridBodyCtrl.prototype, "dragAndDropService", void 0);
22302 __decorate$M([
22303 Autowired('pinnedRowModel')
22304 ], GridBodyCtrl.prototype, "pinnedRowModel", void 0);
22305 __decorate$M([
22306 Autowired('rowRenderer')
22307 ], GridBodyCtrl.prototype, "rowRenderer", void 0);
22308 __decorate$M([
22309 Autowired('popupService')
22310 ], GridBodyCtrl.prototype, "popupService", void 0);
22311 __decorate$M([
22312 Autowired('mouseEventService')
22313 ], GridBodyCtrl.prototype, "mouseEventService", void 0);
22314 return GridBodyCtrl;
22315}(BeanStub));
22316
22317/**
22318 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
22319 * @version v27.3.0
22320 * @link https://www.ag-grid.com/
22321 * @license MIT
22322 */
22323(function (SelectionHandleType) {
22324 SelectionHandleType[SelectionHandleType["FILL"] = 0] = "FILL";
22325 SelectionHandleType[SelectionHandleType["RANGE"] = 1] = "RANGE";
22326})(exports.SelectionHandleType || (exports.SelectionHandleType = {}));
22327(function (CellRangeType) {
22328 CellRangeType[CellRangeType["VALUE"] = 0] = "VALUE";
22329 CellRangeType[CellRangeType["DIMENSION"] = 1] = "DIMENSION";
22330})(exports.CellRangeType || (exports.CellRangeType = {}));
22331
22332/**
22333 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
22334 * @version v27.3.0
22335 * @link https://www.ag-grid.com/
22336 * @license MIT
22337 */
22338var CSS_CELL_RANGE_SELECTED = 'ag-cell-range-selected';
22339var CSS_CELL_RANGE_CHART = 'ag-cell-range-chart';
22340var CSS_CELL_RANGE_SINGLE_CELL = 'ag-cell-range-single-cell';
22341var CSS_CELL_RANGE_CHART_CATEGORY = 'ag-cell-range-chart-category';
22342var CSS_CELL_RANGE_HANDLE = 'ag-cell-range-handle';
22343var CSS_CELL_RANGE_TOP = 'ag-cell-range-top';
22344var CSS_CELL_RANGE_RIGHT = 'ag-cell-range-right';
22345var CSS_CELL_RANGE_BOTTOM = 'ag-cell-range-bottom';
22346var CSS_CELL_RANGE_LEFT = 'ag-cell-range-left';
22347var CellRangeFeature = /** @class */ (function () {
22348 function CellRangeFeature(beans, ctrl) {
22349 this.beans = beans;
22350 this.cellCtrl = ctrl;
22351 }
22352 CellRangeFeature.prototype.setComp = function (cellComp, eGui) {
22353 this.cellComp = cellComp;
22354 this.eGui = eGui;
22355 this.onRangeSelectionChanged();
22356 };
22357 CellRangeFeature.prototype.onRangeSelectionChanged = function () {
22358 // when using reactUi, given UI is async, it's possible this method is called before the comp is registered
22359 if (!this.cellComp) {
22360 return;
22361 }
22362 this.rangeCount = this.beans.rangeService.getCellRangeCount(this.cellCtrl.getCellPosition());
22363 this.hasChartRange = this.getHasChartRange();
22364 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED, this.rangeCount !== 0);
22365 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-1", this.rangeCount === 1);
22366 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-2", this.rangeCount === 2);
22367 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-3", this.rangeCount === 3);
22368 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SELECTED + "-4", this.rangeCount >= 4);
22369 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_CHART, this.hasChartRange);
22370 setAriaSelected(this.eGui, this.rangeCount > 0 ? true : undefined);
22371 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_SINGLE_CELL, this.isSingleCell());
22372 this.updateRangeBorders();
22373 this.refreshHandle();
22374 };
22375 CellRangeFeature.prototype.updateRangeBorders = function () {
22376 var rangeBorders = this.getRangeBorders();
22377 var isSingleCell = this.isSingleCell();
22378 var isTop = !isSingleCell && rangeBorders.top;
22379 var isRight = !isSingleCell && rangeBorders.right;
22380 var isBottom = !isSingleCell && rangeBorders.bottom;
22381 var isLeft = !isSingleCell && rangeBorders.left;
22382 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_TOP, isTop);
22383 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_RIGHT, isRight);
22384 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_BOTTOM, isBottom);
22385 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_LEFT, isLeft);
22386 };
22387 CellRangeFeature.prototype.isSingleCell = function () {
22388 var rangeService = this.beans.rangeService;
22389 return this.rangeCount === 1 && rangeService && !rangeService.isMoreThanOneCell();
22390 };
22391 CellRangeFeature.prototype.getHasChartRange = function () {
22392 var rangeService = this.beans.rangeService;
22393 if (!this.rangeCount || !rangeService) {
22394 return false;
22395 }
22396 var cellRanges = rangeService.getCellRanges();
22397 return cellRanges.length > 0 && cellRanges.every(function (range) { return includes([exports.CellRangeType.DIMENSION, exports.CellRangeType.VALUE], range.type); });
22398 };
22399 CellRangeFeature.prototype.updateRangeBordersIfRangeCount = function () {
22400 // we only need to update range borders if we are in a range
22401 if (this.rangeCount > 0) {
22402 this.updateRangeBorders();
22403 this.refreshHandle();
22404 }
22405 };
22406 CellRangeFeature.prototype.getRangeBorders = function () {
22407 var _this = this;
22408 var isRtl = this.beans.gridOptionsWrapper.isEnableRtl();
22409 var top = false;
22410 var right = false;
22411 var bottom = false;
22412 var left = false;
22413 var thisCol = this.cellCtrl.getCellPosition().column;
22414 var _a = this.beans, rangeService = _a.rangeService, columnModel = _a.columnModel;
22415 var leftCol;
22416 var rightCol;
22417 if (isRtl) {
22418 leftCol = columnModel.getDisplayedColAfter(thisCol);
22419 rightCol = columnModel.getDisplayedColBefore(thisCol);
22420 }
22421 else {
22422 leftCol = columnModel.getDisplayedColBefore(thisCol);
22423 rightCol = columnModel.getDisplayedColAfter(thisCol);
22424 }
22425 var ranges = rangeService.getCellRanges().filter(function (range) { return rangeService.isCellInSpecificRange(_this.cellCtrl.getCellPosition(), range); });
22426 // this means we are the first column in the grid
22427 if (!leftCol) {
22428 left = true;
22429 }
22430 // this means we are the last column in the grid
22431 if (!rightCol) {
22432 right = true;
22433 }
22434 for (var i = 0; i < ranges.length; i++) {
22435 if (top && right && bottom && left) {
22436 break;
22437 }
22438 var range = ranges[i];
22439 var startRow = rangeService.getRangeStartRow(range);
22440 var endRow = rangeService.getRangeEndRow(range);
22441 if (!top && this.beans.rowPositionUtils.sameRow(startRow, this.cellCtrl.getCellPosition())) {
22442 top = true;
22443 }
22444 if (!bottom && this.beans.rowPositionUtils.sameRow(endRow, this.cellCtrl.getCellPosition())) {
22445 bottom = true;
22446 }
22447 if (!left && leftCol && range.columns.indexOf(leftCol) < 0) {
22448 left = true;
22449 }
22450 if (!right && rightCol && range.columns.indexOf(rightCol) < 0) {
22451 right = true;
22452 }
22453 }
22454 return { top: top, right: right, bottom: bottom, left: left };
22455 };
22456 CellRangeFeature.prototype.refreshHandle = function () {
22457 if (!this.beans.rangeService) {
22458 return;
22459 }
22460 var shouldHaveSelectionHandle = this.shouldHaveSelectionHandle();
22461 if (this.selectionHandle && !shouldHaveSelectionHandle) {
22462 this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle);
22463 }
22464 if (shouldHaveSelectionHandle) {
22465 this.addSelectionHandle();
22466 }
22467 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_HANDLE, !!this.selectionHandle);
22468 };
22469 CellRangeFeature.prototype.shouldHaveSelectionHandle = function () {
22470 var _a = this.beans, gridOptionsWrapper = _a.gridOptionsWrapper, rangeService = _a.rangeService;
22471 var cellRanges = rangeService.getCellRanges();
22472 var rangesLen = cellRanges.length;
22473 if (this.rangeCount < 1 || rangesLen < 1) {
22474 return false;
22475 }
22476 var cellRange = last(cellRanges);
22477 var cellPosition = this.cellCtrl.getCellPosition();
22478 var isFillHandleAvailable = gridOptionsWrapper.isEnableFillHandle() && !this.cellCtrl.isSuppressFillHandle();
22479 var isRangeHandleAvailable = gridOptionsWrapper.isEnableRangeHandle();
22480 var handleIsAvailable = rangesLen === 1 && !this.cellCtrl.isEditing() && (isFillHandleAvailable || isRangeHandleAvailable);
22481 if (this.hasChartRange) {
22482 var hasCategoryRange = cellRanges[0].type === exports.CellRangeType.DIMENSION;
22483 var isCategoryCell = hasCategoryRange && rangeService.isCellInSpecificRange(cellPosition, cellRanges[0]);
22484 this.cellComp.addOrRemoveCssClass(CSS_CELL_RANGE_CHART_CATEGORY, isCategoryCell);
22485 handleIsAvailable = cellRange.type === exports.CellRangeType.VALUE;
22486 }
22487 return handleIsAvailable &&
22488 cellRange.endRow != null &&
22489 rangeService.isContiguousRange(cellRange) &&
22490 rangeService.isBottomRightCell(cellRange, cellPosition);
22491 };
22492 CellRangeFeature.prototype.addSelectionHandle = function () {
22493 var _a = this.beans, gridOptionsWrapper = _a.gridOptionsWrapper, rangeService = _a.rangeService;
22494 var cellRangeType = last(rangeService.getCellRanges()).type;
22495 var selectionHandleFill = gridOptionsWrapper.isEnableFillHandle() && missing(cellRangeType);
22496 var type = selectionHandleFill ? exports.SelectionHandleType.FILL : exports.SelectionHandleType.RANGE;
22497 if (this.selectionHandle && this.selectionHandle.getType() !== type) {
22498 this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle);
22499 }
22500 if (!this.selectionHandle) {
22501 this.selectionHandle = this.beans.selectionHandleFactory.createSelectionHandle(type);
22502 }
22503 this.selectionHandle.refresh(this.cellCtrl);
22504 };
22505 CellRangeFeature.prototype.destroy = function () {
22506 this.beans.context.destroyBean(this.selectionHandle);
22507 };
22508 return CellRangeFeature;
22509}());
22510
22511/**
22512 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
22513 * @version v27.3.0
22514 * @link https://www.ag-grid.com/
22515 * @license MIT
22516 */
22517var __extends$U = (undefined && undefined.__extends) || (function () {
22518 var extendStatics = function (d, b) {
22519 extendStatics = Object.setPrototypeOf ||
22520 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22521 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
22522 return extendStatics(d, b);
22523 };
22524 return function (d, b) {
22525 extendStatics(d, b);
22526 function __() { this.constructor = d; }
22527 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
22528 };
22529})();
22530/**
22531 * Takes care of:
22532 * #) Cell Width (including when doing cell spanning, which makes width cover many columns)
22533 * #) Cell Height (when doing row span, otherwise we don't touch the height as it's just row height)
22534 * #) Cell Left (the horizontal positioning of the cell, the vertical positioning is on the row)
22535 */
22536var CellPositionFeature = /** @class */ (function (_super) {
22537 __extends$U(CellPositionFeature, _super);
22538 function CellPositionFeature(ctrl, beans) {
22539 var _this = _super.call(this) || this;
22540 _this.cellCtrl = ctrl;
22541 _this.beans = beans;
22542 _this.column = ctrl.getColumn();
22543 _this.rowNode = ctrl.getRowNode();
22544 _this.setupColSpan();
22545 _this.setupRowSpan();
22546 return _this;
22547 }
22548 CellPositionFeature.prototype.setupRowSpan = function () {
22549 this.rowSpan = this.column.getRowSpan(this.rowNode);
22550 };
22551 CellPositionFeature.prototype.setComp = function (eGui) {
22552 this.eGui = eGui;
22553 this.onLeftChanged();
22554 this.onWidthChanged();
22555 this.applyRowSpan();
22556 };
22557 CellPositionFeature.prototype.onDisplayColumnsChanged = function () {
22558 var colsSpanning = this.getColSpanningList();
22559 if (!areEqual(this.colsSpanning, colsSpanning)) {
22560 this.colsSpanning = colsSpanning;
22561 this.onWidthChanged();
22562 this.onLeftChanged(); // left changes when doing RTL
22563 }
22564 };
22565 CellPositionFeature.prototype.setupColSpan = function () {
22566 // if no col span is active, then we don't set it up, as it would be wasteful of CPU
22567 if (this.column.getColDef().colSpan == null) {
22568 return;
22569 }
22570 this.colsSpanning = this.getColSpanningList();
22571 // because we are col spanning, a reorder of the cols can change what cols we are spanning over
22572 this.addManagedListener(this.beans.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayColumnsChanged.bind(this));
22573 // because we are spanning over multiple cols, we check for width any time any cols width changes.
22574 // this is expensive - really we should be explicitly checking only the cols we are spanning over
22575 // instead of every col, however it would be tricky code to track the cols we are spanning over, so
22576 // because hardly anyone will be using colSpan, am favouring this easier way for more maintainable code.
22577 this.addManagedListener(this.beans.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onWidthChanged.bind(this));
22578 };
22579 CellPositionFeature.prototype.onWidthChanged = function () {
22580 if (!this.eGui) {
22581 return;
22582 }
22583 var width = this.getCellWidth();
22584 this.eGui.style.width = width + "px";
22585 };
22586 CellPositionFeature.prototype.getCellWidth = function () {
22587 if (!this.colsSpanning) {
22588 return this.column.getActualWidth();
22589 }
22590 return this.colsSpanning.reduce(function (width, col) { return width + col.getActualWidth(); }, 0);
22591 };
22592 CellPositionFeature.prototype.getColSpanningList = function () {
22593 var colSpan = this.column.getColSpan(this.rowNode);
22594 var colsSpanning = [];
22595 // if just one col, the col span is just the column we are in
22596 if (colSpan === 1) {
22597 colsSpanning.push(this.column);
22598 }
22599 else {
22600 var pointer = this.column;
22601 var pinned = this.column.getPinned();
22602 for (var i = 0; pointer && i < colSpan; i++) {
22603 colsSpanning.push(pointer);
22604 pointer = this.beans.columnModel.getDisplayedColAfter(pointer);
22605 if (!pointer || missing(pointer)) {
22606 break;
22607 }
22608 // we do not allow col spanning to span outside of pinned areas
22609 if (pinned !== pointer.getPinned()) {
22610 break;
22611 }
22612 }
22613 }
22614 return colsSpanning;
22615 };
22616 CellPositionFeature.prototype.onLeftChanged = function () {
22617 if (!this.eGui) {
22618 return;
22619 }
22620 var left = this.modifyLeftForPrintLayout(this.getCellLeft());
22621 this.eGui.style.left = left + 'px';
22622 };
22623 CellPositionFeature.prototype.getCellLeft = function () {
22624 var mostLeftCol;
22625 if (this.beans.gridOptionsWrapper.isEnableRtl() && this.colsSpanning) {
22626 mostLeftCol = last(this.colsSpanning);
22627 }
22628 else {
22629 mostLeftCol = this.column;
22630 }
22631 return mostLeftCol.getLeft();
22632 };
22633 CellPositionFeature.prototype.modifyLeftForPrintLayout = function (leftPosition) {
22634 if (!this.cellCtrl.isPrintLayout() || this.column.getPinned() === Constants.PINNED_LEFT) {
22635 return leftPosition;
22636 }
22637 var leftWidth = this.beans.columnModel.getDisplayedColumnsLeftWidth();
22638 if (this.column.getPinned() === Constants.PINNED_RIGHT) {
22639 var bodyWidth = this.beans.columnModel.getBodyContainerWidth();
22640 return leftWidth + bodyWidth + (leftPosition || 0);
22641 }
22642 // is in body
22643 return leftWidth + (leftPosition || 0);
22644 };
22645 CellPositionFeature.prototype.applyRowSpan = function () {
22646 if (this.rowSpan === 1) {
22647 return;
22648 }
22649 var singleRowHeight = this.beans.gridOptionsWrapper.getRowHeightAsNumber();
22650 var totalRowHeight = singleRowHeight * this.rowSpan;
22651 this.eGui.style.height = totalRowHeight + "px";
22652 this.eGui.style.zIndex = '1';
22653 };
22654 // overriding to make public, as we don't dispose this bean via context
22655 CellPositionFeature.prototype.destroy = function () {
22656 _super.prototype.destroy.call(this);
22657 };
22658 return CellPositionFeature;
22659}(BeanStub));
22660
22661/**
22662 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
22663 * @version v27.3.0
22664 * @link https://www.ag-grid.com/
22665 * @license MIT
22666 */
22667var __extends$V = (undefined && undefined.__extends) || (function () {
22668 var extendStatics = function (d, b) {
22669 extendStatics = Object.setPrototypeOf ||
22670 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22671 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
22672 return extendStatics(d, b);
22673 };
22674 return function (d, b) {
22675 extendStatics(d, b);
22676 function __() { this.constructor = d; }
22677 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
22678 };
22679})();
22680var CellCustomStyleFeature = /** @class */ (function (_super) {
22681 __extends$V(CellCustomStyleFeature, _super);
22682 function CellCustomStyleFeature(ctrl, beans) {
22683 var _this = _super.call(this) || this;
22684 _this.staticClasses = [];
22685 _this.cellCtrl = ctrl;
22686 _this.beans = beans;
22687 _this.column = ctrl.getColumn();
22688 _this.rowNode = ctrl.getRowNode();
22689 return _this;
22690 }
22691 CellCustomStyleFeature.prototype.setComp = function (comp) {
22692 this.cellComp = comp;
22693 this.applyUserStyles();
22694 this.applyCellClassRules();
22695 this.applyClassesFromColDef();
22696 };
22697 CellCustomStyleFeature.prototype.applyCellClassRules = function () {
22698 var _this = this;
22699 var colDef = this.column.getColDef();
22700 var cellClassParams = {
22701 value: this.cellCtrl.getValue(),
22702 data: this.rowNode.data,
22703 node: this.rowNode,
22704 colDef: colDef,
22705 rowIndex: this.rowNode.rowIndex,
22706 api: this.beans.gridOptionsWrapper.getApi(),
22707 columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
22708 context: this.beans.gridOptionsWrapper.getContext()
22709 };
22710 this.beans.stylingService.processClassRules(colDef.cellClassRules, cellClassParams, function (className) { return _this.cellComp.addOrRemoveCssClass(className, true); }, function (className) { return _this.cellComp.addOrRemoveCssClass(className, false); });
22711 };
22712 CellCustomStyleFeature.prototype.applyUserStyles = function () {
22713 var colDef = this.column.getColDef();
22714 if (!colDef.cellStyle) {
22715 return;
22716 }
22717 var styles;
22718 if (typeof colDef.cellStyle === 'function') {
22719 var cellStyleParams = {
22720 column: this.column,
22721 value: this.cellCtrl.getValue(),
22722 colDef: colDef,
22723 data: this.rowNode.data,
22724 node: this.rowNode,
22725 rowIndex: this.rowNode.rowIndex,
22726 api: this.beans.gridOptionsWrapper.getApi(),
22727 columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
22728 context: this.beans.gridOptionsWrapper.getContext(),
22729 };
22730 var cellStyleFunc = colDef.cellStyle;
22731 styles = cellStyleFunc(cellStyleParams);
22732 }
22733 else {
22734 styles = colDef.cellStyle;
22735 }
22736 this.cellComp.setUserStyles(styles);
22737 };
22738 CellCustomStyleFeature.prototype.applyClassesFromColDef = function () {
22739 var _this = this;
22740 var colDef = this.column.getColDef();
22741 var cellClassParams = {
22742 value: this.cellCtrl.getValue(),
22743 data: this.rowNode.data,
22744 node: this.rowNode,
22745 colDef: colDef,
22746 rowIndex: this.rowNode.rowIndex,
22747 api: this.beans.gridOptionsWrapper.getApi(),
22748 columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
22749 context: this.beans.gridOptionsWrapper.getContext()
22750 };
22751 if (this.staticClasses.length) {
22752 this.staticClasses.forEach(function (className) { return _this.cellComp.addOrRemoveCssClass(className, false); });
22753 }
22754 this.staticClasses = this.beans.stylingService.getStaticCellClasses(colDef, cellClassParams);
22755 if (this.staticClasses.length) {
22756 this.staticClasses.forEach(function (className) { return _this.cellComp.addOrRemoveCssClass(className, true); });
22757 }
22758 };
22759 // overriding to make public, as we don't dispose this bean via context
22760 CellCustomStyleFeature.prototype.destroy = function () {
22761 _super.prototype.destroy.call(this);
22762 };
22763 return CellCustomStyleFeature;
22764}(BeanStub));
22765
22766/**
22767 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
22768 * @version v27.3.0
22769 * @link https://www.ag-grid.com/
22770 * @license MIT
22771 */
22772var __extends$W = (undefined && undefined.__extends) || (function () {
22773 var extendStatics = function (d, b) {
22774 extendStatics = Object.setPrototypeOf ||
22775 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22776 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
22777 return extendStatics(d, b);
22778 };
22779 return function (d, b) {
22780 extendStatics(d, b);
22781 function __() { this.constructor = d; }
22782 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
22783 };
22784})();
22785var TooltipFeature = /** @class */ (function (_super) {
22786 __extends$W(TooltipFeature, _super);
22787 function TooltipFeature(ctrl, beans) {
22788 var _this = _super.call(this) || this;
22789 _this.ctrl = ctrl;
22790 _this.beans = beans;
22791 return _this;
22792 }
22793 TooltipFeature.prototype.setComp = function (comp) {
22794 this.comp = comp;
22795 this.setupTooltip();
22796 };
22797 TooltipFeature.prototype.setupTooltip = function () {
22798 this.browserTooltips = this.beans.gridOptionsWrapper.isEnableBrowserTooltips();
22799 this.updateTooltipText();
22800 if (this.browserTooltips) {
22801 this.comp.setTitle(this.tooltip != null ? this.tooltip : undefined);
22802 }
22803 else {
22804 this.createTooltipFeatureIfNeeded();
22805 }
22806 };
22807 TooltipFeature.prototype.updateTooltipText = function () {
22808 this.tooltip = this.ctrl.getTooltipValue();
22809 };
22810 TooltipFeature.prototype.createTooltipFeatureIfNeeded = function () {
22811 var _this = this;
22812 if (this.genericTooltipFeature != null) {
22813 return;
22814 }
22815 var parent = {
22816 getTooltipParams: function () { return _this.getTooltipParams(); },
22817 getGui: function () { return _this.ctrl.getGui(); }
22818 };
22819 this.genericTooltipFeature = this.createManagedBean(new CustomTooltipFeature(parent), this.beans.context);
22820 };
22821 TooltipFeature.prototype.refreshToolTip = function () {
22822 this.updateTooltipText();
22823 if (this.browserTooltips) {
22824 this.comp.setTitle(this.tooltip != null ? this.tooltip : undefined);
22825 }
22826 };
22827 TooltipFeature.prototype.getTooltipParams = function () {
22828 var ctrl = this.ctrl;
22829 var column = ctrl.getColumn ? ctrl.getColumn() : undefined;
22830 var colDef = ctrl.getColDef ? ctrl.getColDef() : undefined;
22831 var rowNode = ctrl.getRowNode ? ctrl.getRowNode() : undefined;
22832 return {
22833 location: ctrl.getLocation(),
22834 colDef: colDef,
22835 column: column,
22836 rowIndex: ctrl.getRowIndex ? ctrl.getRowIndex() : undefined,
22837 node: rowNode,
22838 data: rowNode ? rowNode.data : undefined,
22839 value: this.getTooltipText(),
22840 valueFormatted: ctrl.getValueFormatted ? ctrl.getValueFormatted() : undefined,
22841 };
22842 };
22843 TooltipFeature.prototype.getTooltipText = function () {
22844 return this.tooltip;
22845 };
22846 // overriding to make public, as we don't dispose this bean via context
22847 TooltipFeature.prototype.destroy = function () {
22848 _super.prototype.destroy.call(this);
22849 };
22850 return TooltipFeature;
22851}(BeanStub));
22852
22853/**
22854 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
22855 * @version v27.3.0
22856 * @link https://www.ag-grid.com/
22857 * @license MIT
22858 */
22859var __decorate$N = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
22860 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22861 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
22862 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;
22863 return c > 3 && r && Object.defineProperty(target, key, r), r;
22864};
22865/** Using the IoC has a slight performance consideration, which is no problem most of the
22866 * time, unless we are trashing objects - which is the case when scrolling and rowComp
22867 * and cellComp. So for performance reasons, RowComp and CellComp do not get autowired
22868 * with the IoC. Instead they get passed this object which is all the beans the RowComp
22869 * and CellComp need. Not autowiring all the cells gives performance improvement. */
22870var Beans = /** @class */ (function () {
22871 function Beans() {
22872 }
22873 Beans.prototype.postConstruct = function () {
22874 this.doingMasterDetail = this.gridOptionsWrapper.isMasterDetail();
22875 if (this.gridOptionsWrapper.isRowModelDefault()) {
22876 this.clientSideRowModel = this.rowModel;
22877 }
22878 if (this.gridOptionsWrapper.isRowModelServerSide()) {
22879 this.serverSideRowModel = this.rowModel;
22880 }
22881 };
22882 __decorate$N([
22883 Autowired('resizeObserverService')
22884 ], Beans.prototype, "resizeObserverService", void 0);
22885 __decorate$N([
22886 Autowired('paginationProxy')
22887 ], Beans.prototype, "paginationProxy", void 0);
22888 __decorate$N([
22889 Autowired('context')
22890 ], Beans.prototype, "context", void 0);
22891 __decorate$N([
22892 Autowired('columnApi')
22893 ], Beans.prototype, "columnApi", void 0);
22894 __decorate$N([
22895 Autowired('gridApi')
22896 ], Beans.prototype, "gridApi", void 0);
22897 __decorate$N([
22898 Autowired('gridOptionsWrapper')
22899 ], Beans.prototype, "gridOptionsWrapper", void 0);
22900 __decorate$N([
22901 Autowired('expressionService')
22902 ], Beans.prototype, "expressionService", void 0);
22903 __decorate$N([
22904 Autowired('rowRenderer')
22905 ], Beans.prototype, "rowRenderer", void 0);
22906 __decorate$N([
22907 Autowired('templateService')
22908 ], Beans.prototype, "templateService", void 0);
22909 __decorate$N([
22910 Autowired('valueService')
22911 ], Beans.prototype, "valueService", void 0);
22912 __decorate$N([
22913 Autowired('eventService')
22914 ], Beans.prototype, "eventService", void 0);
22915 __decorate$N([
22916 Autowired('columnModel')
22917 ], Beans.prototype, "columnModel", void 0);
22918 __decorate$N([
22919 Autowired('headerNavigationService')
22920 ], Beans.prototype, "headerNavigationService", void 0);
22921 __decorate$N([
22922 Autowired('navigationService')
22923 ], Beans.prototype, "navigationService", void 0);
22924 __decorate$N([
22925 Autowired('columnAnimationService')
22926 ], Beans.prototype, "columnAnimationService", void 0);
22927 __decorate$N([
22928 Optional('rangeService')
22929 ], Beans.prototype, "rangeService", void 0);
22930 __decorate$N([
22931 Autowired('focusService')
22932 ], Beans.prototype, "focusService", void 0);
22933 __decorate$N([
22934 Optional('contextMenuFactory')
22935 ], Beans.prototype, "contextMenuFactory", void 0);
22936 __decorate$N([
22937 Autowired('popupService')
22938 ], Beans.prototype, "popupService", void 0);
22939 __decorate$N([
22940 Autowired('valueFormatterService')
22941 ], Beans.prototype, "valueFormatterService", void 0);
22942 __decorate$N([
22943 Autowired('stylingService')
22944 ], Beans.prototype, "stylingService", void 0);
22945 __decorate$N([
22946 Autowired('columnHoverService')
22947 ], Beans.prototype, "columnHoverService", void 0);
22948 __decorate$N([
22949 Autowired('userComponentFactory')
22950 ], Beans.prototype, "userComponentFactory", void 0);
22951 __decorate$N([
22952 Autowired('userComponentRegistry')
22953 ], Beans.prototype, "userComponentRegistry", void 0);
22954 __decorate$N([
22955 Autowired('animationFrameService')
22956 ], Beans.prototype, "animationFrameService", void 0);
22957 __decorate$N([
22958 Autowired('dragAndDropService')
22959 ], Beans.prototype, "dragAndDropService", void 0);
22960 __decorate$N([
22961 Autowired('sortController')
22962 ], Beans.prototype, "sortController", void 0);
22963 __decorate$N([
22964 Autowired('filterManager')
22965 ], Beans.prototype, "filterManager", void 0);
22966 __decorate$N([
22967 Autowired('rowContainerHeightService')
22968 ], Beans.prototype, "rowContainerHeightService", void 0);
22969 __decorate$N([
22970 Autowired('frameworkOverrides')
22971 ], Beans.prototype, "frameworkOverrides", void 0);
22972 __decorate$N([
22973 Autowired('cellPositionUtils')
22974 ], Beans.prototype, "cellPositionUtils", void 0);
22975 __decorate$N([
22976 Autowired('rowPositionUtils')
22977 ], Beans.prototype, "rowPositionUtils", void 0);
22978 __decorate$N([
22979 Autowired('selectionService')
22980 ], Beans.prototype, "selectionService", void 0);
22981 __decorate$N([
22982 Optional('selectionHandleFactory')
22983 ], Beans.prototype, "selectionHandleFactory", void 0);
22984 __decorate$N([
22985 Autowired('rowCssClassCalculator')
22986 ], Beans.prototype, "rowCssClassCalculator", void 0);
22987 __decorate$N([
22988 Autowired('rowModel')
22989 ], Beans.prototype, "rowModel", void 0);
22990 __decorate$N([
22991 Autowired('ctrlsService')
22992 ], Beans.prototype, "ctrlsService", void 0);
22993 __decorate$N([
22994 Autowired('ctrlsFactory')
22995 ], Beans.prototype, "ctrlsFactory", void 0);
22996 __decorate$N([
22997 Autowired('agStackComponentsRegistry')
22998 ], Beans.prototype, "agStackComponentsRegistry", void 0);
22999 __decorate$N([
23000 Autowired('valueCache')
23001 ], Beans.prototype, "valueCache", void 0);
23002 __decorate$N([
23003 Autowired('rowNodeEventThrottle')
23004 ], Beans.prototype, "rowNodeEventThrottle", void 0);
23005 __decorate$N([
23006 PostConstruct
23007 ], Beans.prototype, "postConstruct", null);
23008 Beans = __decorate$N([
23009 Bean('beans')
23010 ], Beans);
23011 return Beans;
23012}());
23013
23014/**
23015 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
23016 * @version v27.3.0
23017 * @link https://www.ag-grid.com/
23018 * @license MIT
23019 */
23020var __extends$X = (undefined && undefined.__extends) || (function () {
23021 var extendStatics = function (d, b) {
23022 extendStatics = Object.setPrototypeOf ||
23023 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23024 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
23025 return extendStatics(d, b);
23026 };
23027 return function (d, b) {
23028 extendStatics(d, b);
23029 function __() { this.constructor = d; }
23030 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
23031 };
23032})();
23033var CellMouseListenerFeature = /** @class */ (function (_super) {
23034 __extends$X(CellMouseListenerFeature, _super);
23035 function CellMouseListenerFeature(ctrl, beans, column) {
23036 var _this = _super.call(this) || this;
23037 _this.cellCtrl = ctrl;
23038 _this.beans = beans;
23039 _this.column = column;
23040 return _this;
23041 }
23042 CellMouseListenerFeature.prototype.onMouseEvent = function (eventName, mouseEvent) {
23043 if (isStopPropagationForAgGrid(mouseEvent)) {
23044 return;
23045 }
23046 switch (eventName) {
23047 case 'click':
23048 this.onCellClicked(mouseEvent);
23049 break;
23050 case 'mousedown':
23051 case 'touchstart':
23052 this.onMouseDown(mouseEvent);
23053 break;
23054 case 'dblclick':
23055 this.onCellDoubleClicked(mouseEvent);
23056 break;
23057 case 'mouseout':
23058 this.onMouseOut(mouseEvent);
23059 break;
23060 case 'mouseover':
23061 this.onMouseOver(mouseEvent);
23062 break;
23063 }
23064 };
23065 CellMouseListenerFeature.prototype.onCellClicked = function (mouseEvent) {
23066 // iPad doesn't have double click - so we need to mimic it to enable editing for iPad.
23067 if (this.isDoubleClickOnIPad()) {
23068 this.onCellDoubleClicked(mouseEvent);
23069 mouseEvent.preventDefault(); // if we don't do this, then iPad zooms in
23070 return;
23071 }
23072 var _a = this.beans, eventService = _a.eventService, gridOptionsWrapper = _a.gridOptionsWrapper;
23073 var cellClickedEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_CLICKED);
23074 eventService.dispatchEvent(cellClickedEvent);
23075 var colDef = this.column.getColDef();
23076 if (colDef.onCellClicked) {
23077 // to make callback async, do in a timeout
23078 window.setTimeout(function () { return colDef.onCellClicked(cellClickedEvent); }, 0);
23079 }
23080 var editOnSingleClick = (gridOptionsWrapper.isSingleClickEdit() || colDef.singleClickEdit)
23081 && !gridOptionsWrapper.isSuppressClickEdit();
23082 if (editOnSingleClick) {
23083 this.cellCtrl.startRowOrCellEdit();
23084 }
23085 };
23086 // returns true if on iPad and this is second 'click' event in 200ms
23087 CellMouseListenerFeature.prototype.isDoubleClickOnIPad = function () {
23088 if (!isIOSUserAgent() || isEventSupported('dblclick')) {
23089 return false;
23090 }
23091 var nowMillis = new Date().getTime();
23092 var res = nowMillis - this.lastIPadMouseClickEvent < 200;
23093 this.lastIPadMouseClickEvent = nowMillis;
23094 return res;
23095 };
23096 CellMouseListenerFeature.prototype.onCellDoubleClicked = function (mouseEvent) {
23097 var colDef = this.column.getColDef();
23098 // always dispatch event to eventService
23099 var cellDoubleClickedEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_DOUBLE_CLICKED);
23100 this.beans.eventService.dispatchEvent(cellDoubleClickedEvent);
23101 // check if colDef also wants to handle event
23102 if (typeof colDef.onCellDoubleClicked === 'function') {
23103 // to make the callback async, do in a timeout
23104 window.setTimeout(function () { return colDef.onCellDoubleClicked(cellDoubleClickedEvent); }, 0);
23105 }
23106 var editOnDoubleClick = !this.beans.gridOptionsWrapper.isSingleClickEdit()
23107 && !this.beans.gridOptionsWrapper.isSuppressClickEdit();
23108 if (editOnDoubleClick) {
23109 this.cellCtrl.startRowOrCellEdit(null, null, mouseEvent);
23110 }
23111 };
23112 CellMouseListenerFeature.prototype.onMouseDown = function (mouseEvent) {
23113 var ctrlKey = mouseEvent.ctrlKey, metaKey = mouseEvent.metaKey, shiftKey = mouseEvent.shiftKey;
23114 var target = mouseEvent.target;
23115 var _a = this.beans, eventService = _a.eventService, rangeService = _a.rangeService;
23116 // do not change the range for right-clicks inside an existing range
23117 if (this.isRightClickInExistingRange(mouseEvent)) {
23118 return;
23119 }
23120 var ranges = rangeService && rangeService.getCellRanges().length != 0;
23121 if (!shiftKey || !ranges) {
23122 // We only need to pass true to focusCell when the browser is IE/Edge and we are trying
23123 // to focus the cell itself. This should never be true if the mousedown was triggered
23124 // due to a click on a cell editor for example.
23125 var forceBrowserFocus = (isBrowserEdge()) && !this.cellCtrl.isEditing() && !isFocusableFormField(target);
23126 this.cellCtrl.focusCell(forceBrowserFocus);
23127 }
23128 // if shift clicking, and a range exists, we keep the focus on the cell that started the
23129 // range as the user then changes the range selection.
23130 if (shiftKey && ranges) {
23131 // this stops the cell from getting focused
23132 mouseEvent.preventDefault();
23133 }
23134 // if we are clicking on a checkbox, we need to make sure the cell wrapping that checkbox
23135 // is focused but we don't want to change the range selection, so return here.
23136 if (this.containsWidget(target)) {
23137 return;
23138 }
23139 if (rangeService) {
23140 var thisCell = this.cellCtrl.getCellPosition();
23141 if (shiftKey) {
23142 rangeService.extendLatestRangeToCell(thisCell);
23143 }
23144 else {
23145 var ctrlKeyPressed = ctrlKey || metaKey;
23146 rangeService.setRangeToCell(thisCell, ctrlKeyPressed);
23147 }
23148 }
23149 eventService.dispatchEvent(this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_DOWN));
23150 };
23151 CellMouseListenerFeature.prototype.isRightClickInExistingRange = function (mouseEvent) {
23152 var rangeService = this.beans.rangeService;
23153 if (rangeService) {
23154 var cellInRange = rangeService.isCellInAnyRange(this.cellCtrl.getCellPosition());
23155 if (cellInRange && mouseEvent.button === 2) {
23156 return true;
23157 }
23158 }
23159 return false;
23160 };
23161 CellMouseListenerFeature.prototype.containsWidget = function (target) {
23162 return isElementChildOfClass(target, 'ag-selection-checkbox', 3);
23163 };
23164 CellMouseListenerFeature.prototype.onMouseOut = function (mouseEvent) {
23165 if (this.mouseStayingInsideCell(mouseEvent)) {
23166 return;
23167 }
23168 var cellMouseOutEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_OUT);
23169 this.beans.eventService.dispatchEvent(cellMouseOutEvent);
23170 this.beans.columnHoverService.clearMouseOver();
23171 };
23172 CellMouseListenerFeature.prototype.onMouseOver = function (mouseEvent) {
23173 if (this.mouseStayingInsideCell(mouseEvent)) {
23174 return;
23175 }
23176 var cellMouseOverEvent = this.cellCtrl.createEvent(mouseEvent, Events.EVENT_CELL_MOUSE_OVER);
23177 this.beans.eventService.dispatchEvent(cellMouseOverEvent);
23178 this.beans.columnHoverService.setMouseOver([this.column]);
23179 };
23180 CellMouseListenerFeature.prototype.mouseStayingInsideCell = function (e) {
23181 if (!e.target || !e.relatedTarget) {
23182 return false;
23183 }
23184 var eGui = this.cellCtrl.getGui();
23185 var cellContainsTarget = eGui.contains(e.target);
23186 var cellContainsRelatedTarget = eGui.contains(e.relatedTarget);
23187 return cellContainsTarget && cellContainsRelatedTarget;
23188 };
23189 CellMouseListenerFeature.prototype.destroy = function () {
23190 };
23191 return CellMouseListenerFeature;
23192}(Beans));
23193
23194/**
23195 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
23196 * @version v27.3.0
23197 * @link https://www.ag-grid.com/
23198 * @license MIT
23199 */
23200var __extends$Y = (undefined && undefined.__extends) || (function () {
23201 var extendStatics = function (d, b) {
23202 extendStatics = Object.setPrototypeOf ||
23203 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23204 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
23205 return extendStatics(d, b);
23206 };
23207 return function (d, b) {
23208 extendStatics(d, b);
23209 function __() { this.constructor = d; }
23210 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
23211 };
23212})();
23213var CellKeyboardListenerFeature = /** @class */ (function (_super) {
23214 __extends$Y(CellKeyboardListenerFeature, _super);
23215 function CellKeyboardListenerFeature(ctrl, beans, column, rowNode, rowCtrl) {
23216 var _this = _super.call(this) || this;
23217 _this.cellCtrl = ctrl;
23218 _this.beans = beans;
23219 _this.rowNode = rowNode;
23220 _this.rowCtrl = rowCtrl;
23221 return _this;
23222 }
23223 CellKeyboardListenerFeature.prototype.setComp = function (eGui) {
23224 this.eGui = eGui;
23225 };
23226 CellKeyboardListenerFeature.prototype.onKeyDown = function (event) {
23227 var key = event.key;
23228 switch (key) {
23229 case KeyCode.ENTER:
23230 this.onEnterKeyDown(event);
23231 break;
23232 case KeyCode.F2:
23233 this.onF2KeyDown(event);
23234 break;
23235 case KeyCode.ESCAPE:
23236 this.onEscapeKeyDown(event);
23237 break;
23238 case KeyCode.TAB:
23239 this.onTabKeyDown(event);
23240 break;
23241 case KeyCode.BACKSPACE:
23242 case KeyCode.DELETE:
23243 this.onBackspaceOrDeleteKeyPressed(key, event);
23244 break;
23245 case KeyCode.DOWN:
23246 case KeyCode.UP:
23247 case KeyCode.RIGHT:
23248 case KeyCode.LEFT:
23249 this.onNavigationKeyPressed(event, key);
23250 break;
23251 }
23252 };
23253 CellKeyboardListenerFeature.prototype.onNavigationKeyPressed = function (event, key) {
23254 if (this.cellCtrl.isEditing()) {
23255 return;
23256 }
23257 if (event.shiftKey && this.cellCtrl.isRangeSelectionEnabled()) {
23258 this.onShiftRangeSelect(event);
23259 }
23260 else {
23261 this.beans.navigationService.navigateToNextCell(event, key, this.cellCtrl.getCellPosition(), true);
23262 }
23263 // if we don't prevent default, the grid will scroll with the navigation keys
23264 event.preventDefault();
23265 };
23266 CellKeyboardListenerFeature.prototype.onShiftRangeSelect = function (event) {
23267 if (!this.beans.rangeService) {
23268 return;
23269 }
23270 var endCell = this.beans.rangeService.extendLatestRangeInDirection(event);
23271 if (endCell) {
23272 this.beans.navigationService.ensureCellVisible(endCell);
23273 }
23274 };
23275 CellKeyboardListenerFeature.prototype.onTabKeyDown = function (event) {
23276 this.beans.navigationService.onTabKeyDown(this.cellCtrl, event);
23277 };
23278 CellKeyboardListenerFeature.prototype.onBackspaceOrDeleteKeyPressed = function (key, event) {
23279 if (!this.cellCtrl.isEditing()) {
23280 this.cellCtrl.startRowOrCellEdit(key, undefined, event);
23281 }
23282 };
23283 CellKeyboardListenerFeature.prototype.onEnterKeyDown = function (e) {
23284 if (this.cellCtrl.isEditing() || this.rowCtrl.isEditing()) {
23285 this.cellCtrl.stopEditingAndFocus();
23286 }
23287 else {
23288 if (this.beans.gridOptionsWrapper.isEnterMovesDown()) {
23289 this.beans.navigationService.navigateToNextCell(null, KeyCode.DOWN, this.cellCtrl.getCellPosition(), false);
23290 }
23291 else {
23292 this.cellCtrl.startRowOrCellEdit(KeyCode.ENTER, undefined, e);
23293 if (this.cellCtrl.isEditing()) {
23294 // if we started editing, then we need to prevent default, otherwise the Enter action can get
23295 // applied to the cell editor. this happened, for example, with largeTextCellEditor where not
23296 // preventing default results in a 'new line' character getting inserted in the text area
23297 // when the editing was started
23298 e.preventDefault();
23299 }
23300 }
23301 }
23302 };
23303 CellKeyboardListenerFeature.prototype.onF2KeyDown = function (event) {
23304 if (!this.cellCtrl.isEditing()) {
23305 this.cellCtrl.startRowOrCellEdit(KeyCode.F2, undefined, event);
23306 }
23307 };
23308 CellKeyboardListenerFeature.prototype.onEscapeKeyDown = function (event) {
23309 if (this.cellCtrl.isEditing()) {
23310 this.cellCtrl.stopRowOrCellEdit(true);
23311 this.cellCtrl.focusCell(true);
23312 }
23313 };
23314 CellKeyboardListenerFeature.prototype.onKeyPress = function (event) {
23315 // check this, in case focus is on a (for example) a text field inside the cell,
23316 // in which cse we should not be listening for these key pressed
23317 var eventTarget = event.target;
23318 var eventOnChildComponent = eventTarget !== this.eGui;
23319 if (eventOnChildComponent || this.cellCtrl.isEditing()) {
23320 return;
23321 }
23322 var pressedChar = String.fromCharCode(event.charCode);
23323 if (pressedChar === ' ') {
23324 this.onSpaceKeyPressed(event);
23325 }
23326 else if (isEventFromPrintableCharacter(event)) {
23327 this.cellCtrl.startRowOrCellEdit(null, pressedChar, event);
23328 // if we don't prevent default, then the keypress also gets applied to the text field
23329 // (at least when doing the default editor), but we need to allow the editor to decide
23330 // what it wants to do. we only do this IF editing was started - otherwise it messes
23331 // up when the use is not doing editing, but using rendering with text fields in cellRenderer
23332 // (as it would block the the user from typing into text fields).
23333 event.preventDefault();
23334 }
23335 };
23336 CellKeyboardListenerFeature.prototype.onSpaceKeyPressed = function (event) {
23337 var gridOptionsWrapper = this.beans.gridOptionsWrapper;
23338 if (!this.cellCtrl.isEditing() && gridOptionsWrapper.isRowSelection()) {
23339 var currentSelection = this.rowNode.isSelected();
23340 var newSelection = !currentSelection;
23341 if (newSelection || !gridOptionsWrapper.isSuppressRowDeselection()) {
23342 var groupSelectsFiltered = this.beans.gridOptionsWrapper.isGroupSelectsFiltered();
23343 var updatedCount = this.rowNode.setSelectedParams({
23344 newValue: newSelection,
23345 rangeSelect: event.shiftKey,
23346 groupSelectsFiltered: groupSelectsFiltered
23347 });
23348 if (currentSelection === undefined && updatedCount === 0) {
23349 this.rowNode.setSelectedParams({
23350 newValue: false,
23351 rangeSelect: event.shiftKey,
23352 groupSelectsFiltered: groupSelectsFiltered
23353 });
23354 }
23355 }
23356 }
23357 // prevent default as space key, by default, moves browser scroll down
23358 event.preventDefault();
23359 };
23360 CellKeyboardListenerFeature.prototype.destroy = function () {
23361 };
23362 return CellKeyboardListenerFeature;
23363}(BeanStub));
23364
23365/**
23366 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
23367 * @version v27.3.0
23368 * @link https://www.ag-grid.com/
23369 * @license MIT
23370 */
23371var __extends$Z = (undefined && undefined.__extends) || (function () {
23372 var extendStatics = function (d, b) {
23373 extendStatics = Object.setPrototypeOf ||
23374 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23375 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
23376 return extendStatics(d, b);
23377 };
23378 return function (d, b) {
23379 extendStatics(d, b);
23380 function __() { this.constructor = d; }
23381 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
23382 };
23383})();
23384var __decorate$O = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
23385 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23386 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
23387 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;
23388 return c > 3 && r && Object.defineProperty(target, key, r), r;
23389};
23390var DndSourceComp = /** @class */ (function (_super) {
23391 __extends$Z(DndSourceComp, _super);
23392 function DndSourceComp(rowNode, column, beans, eCell) {
23393 var _this = _super.call(this, "<div class=\"ag-drag-handle ag-row-drag\" draggable=\"true\"></div>") || this;
23394 _this.rowNode = rowNode;
23395 _this.column = column;
23396 _this.beans = beans;
23397 _this.eCell = eCell;
23398 return _this;
23399 }
23400 DndSourceComp.prototype.postConstruct = function () {
23401 var eGui = this.getGui();
23402 eGui.appendChild(createIconNoSpan('rowDrag', this.beans.gridOptionsWrapper, null));
23403 // we need to stop the event propagation here to avoid starting a range selection while dragging
23404 this.addGuiEventListener('mousedown', function (e) {
23405 e.stopPropagation();
23406 });
23407 this.addDragSource();
23408 this.checkVisibility();
23409 };
23410 DndSourceComp.prototype.addDragSource = function () {
23411 this.addGuiEventListener('dragstart', this.onDragStart.bind(this));
23412 };
23413 DndSourceComp.prototype.onDragStart = function (dragEvent) {
23414 var _this = this;
23415 var providedOnRowDrag = this.column.getColDef().dndSourceOnRowDrag;
23416 dragEvent.dataTransfer.setDragImage(this.eCell, 0, 0);
23417 // default behaviour is to convert data to json and set into drag component
23418 var defaultOnRowDrag = function () {
23419 try {
23420 var jsonData = JSON.stringify(_this.rowNode.data);
23421 dragEvent.dataTransfer.setData('application/json', jsonData);
23422 dragEvent.dataTransfer.setData('text/plain', jsonData);
23423 }
23424 catch (e) {
23425 // if we cannot convert the data to json, then we do not set the type
23426 }
23427 };
23428 if (providedOnRowDrag) {
23429 var params = {
23430 rowNode: this.rowNode, dragEvent: dragEvent,
23431 api: this.gridOptionsWrapper.getApi(),
23432 columnApi: this.gridOptionsWrapper.getColumnApi(),
23433 context: this.gridOptionsWrapper.getContext()
23434 };
23435 providedOnRowDrag(params);
23436 }
23437 else {
23438 defaultOnRowDrag();
23439 }
23440 };
23441 DndSourceComp.prototype.checkVisibility = function () {
23442 var visible = this.column.isDndSource(this.rowNode);
23443 this.setDisplayed(visible);
23444 };
23445 __decorate$O([
23446 PostConstruct
23447 ], DndSourceComp.prototype, "postConstruct", null);
23448 return DndSourceComp;
23449}(Component));
23450
23451/**
23452 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
23453 * @version v27.3.0
23454 * @link https://www.ag-grid.com/
23455 * @license MIT
23456 */
23457var __extends$_ = (undefined && undefined.__extends) || (function () {
23458 var extendStatics = function (d, b) {
23459 extendStatics = Object.setPrototypeOf ||
23460 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23461 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
23462 return extendStatics(d, b);
23463 };
23464 return function (d, b) {
23465 extendStatics(d, b);
23466 function __() { this.constructor = d; }
23467 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
23468 };
23469})();
23470var __assign$b = (undefined && undefined.__assign) || function () {
23471 __assign$b = Object.assign || function(t) {
23472 for (var s, i = 1, n = arguments.length; i < n; i++) {
23473 s = arguments[i];
23474 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
23475 t[p] = s[p];
23476 }
23477 return t;
23478 };
23479 return __assign$b.apply(this, arguments);
23480};
23481var CSS_CELL = 'ag-cell';
23482var CSS_AUTO_HEIGHT = 'ag-cell-auto-height';
23483var CSS_NORMAL_HEIGHT = 'ag-cell-normal-height';
23484var CSS_CELL_FOCUS = 'ag-cell-focus';
23485var CSS_CELL_FIRST_RIGHT_PINNED = 'ag-cell-first-right-pinned';
23486var CSS_CELL_LAST_LEFT_PINNED = 'ag-cell-last-left-pinned';
23487var CSS_CELL_NOT_INLINE_EDITING = 'ag-cell-not-inline-editing';
23488var CSS_CELL_INLINE_EDITING = 'ag-cell-inline-editing';
23489var CSS_CELL_POPUP_EDITING = 'ag-cell-popup-editing';
23490var CSS_COLUMN_HOVER = 'ag-column-hover';
23491var CSS_CELL_WRAP_TEXT = 'ag-cell-wrap-text';
23492var instanceIdSequence$1 = 0;
23493var CellCtrl = /** @class */ (function (_super) {
23494 __extends$_(CellCtrl, _super);
23495 function CellCtrl(column, rowNode, beans, rowCtrl) {
23496 var _this = _super.call(this) || this;
23497 _this.suppressRefreshCell = false;
23498 _this.column = column;
23499 _this.rowNode = rowNode;
23500 _this.beans = beans;
23501 _this.rowCtrl = rowCtrl;
23502 // unique id to this instance, including the column ID to help with debugging in React as it's used in 'key'
23503 _this.instanceId = column.getId() + '-' + instanceIdSequence$1++;
23504 _this.createCellPosition();
23505 _this.addFeatures();
23506 return _this;
23507 }
23508 CellCtrl.prototype.addFeatures = function () {
23509 var _this = this;
23510 this.cellPositionFeature = new CellPositionFeature(this, this.beans);
23511 this.addDestroyFunc(function () { return _this.cellPositionFeature.destroy(); });
23512 this.cellCustomStyleFeature = new CellCustomStyleFeature(this, this.beans);
23513 this.addDestroyFunc(function () { return _this.cellCustomStyleFeature.destroy(); });
23514 this.cellMouseListenerFeature = new CellMouseListenerFeature(this, this.beans, this.column);
23515 this.addDestroyFunc(function () { return _this.cellMouseListenerFeature.destroy(); });
23516 this.cellKeyboardListenerFeature = new CellKeyboardListenerFeature(this, this.beans, this.column, this.rowNode, this.rowCtrl);
23517 this.addDestroyFunc(function () { return _this.cellKeyboardListenerFeature.destroy(); });
23518 var rangeSelectionEnabled = this.beans.rangeService && this.beans.gridOptionsWrapper.isEnableRangeSelection();
23519 if (rangeSelectionEnabled) {
23520 this.cellRangeFeature = new CellRangeFeature(this.beans, this);
23521 this.addDestroyFunc(function () { return _this.cellRangeFeature.destroy(); });
23522 }
23523 this.addTooltipFeature();
23524 };
23525 CellCtrl.prototype.addTooltipFeature = function () {
23526 var _this = this;
23527 var getTooltipValue = function () {
23528 var colDef = _this.column.getColDef();
23529 var data = _this.rowNode.data;
23530 if (colDef.tooltipField && exists(data)) {
23531 return getValueUsingField(data, colDef.tooltipField, _this.column.isTooltipFieldContainsDots());
23532 }
23533 var valueGetter = colDef.tooltipValueGetter;
23534 if (valueGetter) {
23535 return valueGetter({
23536 location: 'cell',
23537 api: _this.beans.gridOptionsWrapper.getApi(),
23538 columnApi: _this.beans.gridOptionsWrapper.getColumnApi(),
23539 context: _this.beans.gridOptionsWrapper.getContext(),
23540 colDef: _this.column.getColDef(),
23541 column: _this.column,
23542 rowIndex: _this.cellPosition.rowIndex,
23543 node: _this.rowNode,
23544 data: _this.rowNode.data,
23545 value: _this.value,
23546 valueFormatted: _this.valueFormatted,
23547 });
23548 }
23549 return null;
23550 };
23551 var tooltipCtrl = {
23552 getColumn: function () { return _this.column; },
23553 getColDef: function () { return _this.column.getColDef(); },
23554 getRowIndex: function () { return _this.cellPosition.rowIndex; },
23555 getRowNode: function () { return _this.rowNode; },
23556 getGui: function () { return _this.getGui(); },
23557 getLocation: function () { return 'cell'; },
23558 getTooltipValue: getTooltipValue,
23559 // this makes no sense, why is the cell formatted value passed to the tooltip???
23560 getValueFormatted: function () { return _this.valueFormatted; }
23561 };
23562 this.tooltipFeature = new TooltipFeature(tooltipCtrl, this.beans);
23563 this.addDestroyFunc(function () { return _this.tooltipFeature.destroy(); });
23564 };
23565 CellCtrl.prototype.setComp = function (comp, eGui, eCellWrapper, printLayout, startEditing) {
23566 this.cellComp = comp;
23567 this.gow = this.beans.gridOptionsWrapper;
23568 this.eGui = eGui;
23569 this.eCellWrapper = eCellWrapper;
23570 this.printLayout = printLayout;
23571 // we force to make sure formatter gets called at least once,
23572 // even if value has not changed (is is undefined)
23573 this.updateAndFormatValue(true);
23574 this.addDomData();
23575 this.onCellFocused();
23576 this.applyStaticCssClasses();
23577 this.setWrapText();
23578 this.onFirstRightPinnedChanged();
23579 this.onLastLeftPinnedChanged();
23580 this.onColumnHover();
23581 this.setupControlComps();
23582 this.setupAutoHeight();
23583 this.setAriaColIndex();
23584 if (!this.gow.isSuppressCellFocus()) {
23585 this.cellComp.setTabIndex(-1);
23586 }
23587 var colIdSanitised = escapeString(this.column.getId());
23588 this.cellComp.setColId(colIdSanitised);
23589 this.cellComp.setRole('gridcell');
23590 this.cellPositionFeature.setComp(eGui);
23591 this.cellCustomStyleFeature.setComp(comp);
23592 this.tooltipFeature.setComp(comp);
23593 this.cellKeyboardListenerFeature.setComp(this.eGui);
23594 if (this.cellRangeFeature) {
23595 this.cellRangeFeature.setComp(comp, eGui);
23596 }
23597 if (startEditing && this.isCellEditable()) {
23598 this.startEditing();
23599 }
23600 else {
23601 this.showValue();
23602 }
23603 };
23604 CellCtrl.prototype.setupAutoHeight = function () {
23605 var _this = this;
23606 if (!this.column.isAutoHeight()) {
23607 return;
23608 }
23609 var eAutoHeightContainer = this.eCellWrapper;
23610 var eParentCell = eAutoHeightContainer.parentElement;
23611 // taking minRowHeight from getRowHeightForNode means the getRowHeight() callback is used,
23612 // thus allowing different min heights for different rows.
23613 var minRowHeight = this.beans.gridOptionsWrapper.getRowHeightForNode(this.rowNode).height;
23614 var measureHeight = function (timesCalled) {
23615 if (_this.editing) {
23616 return;
23617 }
23618 // because of the retry's below, it's possible the retry's go beyond
23619 // the rows life.
23620 if (!_this.isAlive()) {
23621 return;
23622 }
23623 var _a = getElementSize(eParentCell), paddingTop = _a.paddingTop, paddingBottom = _a.paddingBottom;
23624 var wrapperHeight = eAutoHeightContainer.offsetHeight;
23625 var autoHeight = wrapperHeight + paddingTop + paddingBottom;
23626 if (timesCalled < 5) {
23627 // if not in doc yet, means framework not yet inserted, so wait for next VM turn,
23628 // maybe it will be ready next VM turn
23629 var doc = _this.beans.gridOptionsWrapper.getDocument();
23630 var notYetInDom = !doc || !doc.contains(eAutoHeightContainer);
23631 // this happens in React, where React hasn't put any content in. we say 'possibly'
23632 // as a) may not be React and b) the cell could be empty anyway
23633 var possiblyNoContentYet = autoHeight == 0;
23634 if (notYetInDom || possiblyNoContentYet) {
23635 _this.beans.frameworkOverrides.setTimeout(function () { return measureHeight(timesCalled + 1); }, 0);
23636 return;
23637 }
23638 }
23639 var newHeight = Math.max(autoHeight, minRowHeight);
23640 _this.rowNode.setRowAutoHeight(newHeight, _this.column);
23641 };
23642 var listener = function () { return measureHeight(0); };
23643 // do once to set size in case size doesn't change, common when cell is blank
23644 listener();
23645 var destroyResizeObserver = this.beans.resizeObserverService.observeResize(eAutoHeightContainer, listener);
23646 this.addDestroyFunc(function () {
23647 destroyResizeObserver();
23648 _this.rowNode.setRowAutoHeight(undefined, _this.column);
23649 });
23650 };
23651 CellCtrl.prototype.getInstanceId = function () {
23652 return this.instanceId;
23653 };
23654 CellCtrl.prototype.showValue = function (forceNewCellRendererInstance) {
23655 if (forceNewCellRendererInstance === void 0) { forceNewCellRendererInstance = false; }
23656 var valueToDisplay = this.valueFormatted != null ? this.valueFormatted : this.value;
23657 var params = this.createCellRendererParams();
23658 var compDetails = this.beans.userComponentFactory.getCellRendererDetails(this.column.getColDef(), params);
23659 this.cellComp.setRenderDetails(compDetails, valueToDisplay, forceNewCellRendererInstance);
23660 this.refreshHandle();
23661 };
23662 CellCtrl.prototype.setupControlComps = function () {
23663 var colDef = this.column.getColDef();
23664 this.includeSelection = this.isIncludeControl(colDef.checkboxSelection);
23665 this.includeRowDrag = this.isIncludeControl(colDef.rowDrag);
23666 this.includeDndSource = this.isIncludeControl(colDef.dndSource);
23667 this.cellComp.setIncludeSelection(this.includeSelection);
23668 this.cellComp.setIncludeDndSource(this.includeDndSource);
23669 this.cellComp.setIncludeRowDrag(this.includeRowDrag);
23670 };
23671 CellCtrl.prototype.isForceWrapper = function () {
23672 // text selection requires the value to be wrapped in another element
23673 var forceWrapper = this.beans.gridOptionsWrapper.isEnableCellTextSelection() || this.column.isAutoHeight();
23674 return forceWrapper;
23675 };
23676 CellCtrl.prototype.isIncludeControl = function (value) {
23677 var rowNodePinned = this.rowNode.rowPinned != null;
23678 var isFunc = typeof value === 'function';
23679 var res = rowNodePinned ? false : isFunc || value === true;
23680 return res;
23681 };
23682 CellCtrl.prototype.refreshShouldDestroy = function () {
23683 var colDef = this.column.getColDef();
23684 var selectionChanged = this.includeSelection != this.isIncludeControl(colDef.checkboxSelection);
23685 var rowDragChanged = this.includeRowDrag != this.isIncludeControl(colDef.rowDrag);
23686 var dndSourceChanged = this.includeDndSource != this.isIncludeControl(colDef.dndSource);
23687 return selectionChanged || rowDragChanged || dndSourceChanged;
23688 };
23689 // either called internally if single cell editing, or called by rowRenderer if row editing
23690 CellCtrl.prototype.startEditing = function (key, charPress, cellStartedEdit, event) {
23691 if (key === void 0) { key = null; }
23692 if (charPress === void 0) { charPress = null; }
23693 if (cellStartedEdit === void 0) { cellStartedEdit = false; }
23694 if (event === void 0) { event = null; }
23695 var _a, _b;
23696 if (!this.isCellEditable() || this.editing) {
23697 return;
23698 }
23699 var editorParams = this.createCellEditorParams(key, charPress, cellStartedEdit);
23700 var colDef = this.column.getColDef();
23701 var compDetails = this.beans.userComponentFactory.getCellEditorDetails(colDef, editorParams);
23702 // if cellEditorSelector was used, we give preference to popup and popupPosition from the selector
23703 var popup = ((_a = compDetails) === null || _a === void 0 ? void 0 : _a.popupFromSelector) != null ? compDetails.popupFromSelector : !!colDef.cellEditorPopup;
23704 var position = ((_b = compDetails) === null || _b === void 0 ? void 0 : _b.popupPositionFromSelector) != null ? compDetails.popupPositionFromSelector : colDef.cellEditorPopupPosition;
23705 this.setEditing(true, popup);
23706 this.cellComp.setEditDetails(compDetails, popup, position);
23707 var e = this.createEvent(event, Events.EVENT_CELL_EDITING_STARTED);
23708 this.beans.eventService.dispatchEvent(e);
23709 };
23710 CellCtrl.prototype.setEditing = function (editing, inPopup) {
23711 if (inPopup === void 0) { inPopup = false; }
23712 if (this.editing === editing) {
23713 return;
23714 }
23715 this.editing = editing;
23716 this.editingInPopup = inPopup;
23717 this.setInlineEditingClass();
23718 };
23719 // pass in 'true' to cancel the editing.
23720 CellCtrl.prototype.stopRowOrCellEdit = function (cancel) {
23721 if (cancel === void 0) { cancel = false; }
23722 if (this.beans.gridOptionsWrapper.isFullRowEdit()) {
23723 this.rowCtrl.stopRowEditing(cancel);
23724 }
23725 else {
23726 this.stopEditing(cancel);
23727 }
23728 };
23729 CellCtrl.prototype.onPopupEditorClosed = function () {
23730 if (!this.isEditing()) {
23731 return;
23732 }
23733 // note: this happens because of a click outside of the grid or if the popupEditor
23734 // is closed with `Escape` key. if another cell was clicked, then the editing will
23735 // have already stopped and returned on the conditional above.
23736 this.stopEditingAndFocus();
23737 };
23738 CellCtrl.prototype.takeValueFromCellEditor = function (cancel) {
23739 var noValueResult = { newValueExists: false };
23740 if (cancel) {
23741 return noValueResult;
23742 }
23743 var cellEditor = this.cellComp.getCellEditor();
23744 if (!cellEditor) {
23745 return noValueResult;
23746 }
23747 var userWantsToCancel = cellEditor.isCancelAfterEnd && cellEditor.isCancelAfterEnd();
23748 if (userWantsToCancel) {
23749 return noValueResult;
23750 }
23751 var newValue = cellEditor.getValue();
23752 return {
23753 newValue: newValue,
23754 newValueExists: true
23755 };
23756 };
23757 /**
23758 * @returns `True` if the value changes, otherwise `False`.
23759 */
23760 CellCtrl.prototype.saveNewValue = function (oldValue, newValue) {
23761 if (newValue === oldValue) {
23762 return false;
23763 }
23764 if (this.beans.gridOptionsWrapper.isReadOnlyEdit()) {
23765 this.dispatchEventForSaveValueReadOnly(oldValue, newValue);
23766 return false;
23767 }
23768 // we suppressRefreshCell because the call to rowNode.setDataValue() results in change detection
23769 // getting triggered, which results in all cells getting refreshed. we do not want this refresh
23770 // to happen on this call as we want to call it explicitly below. otherwise refresh gets called twice.
23771 // if we only did this refresh (and not the one below) then the cell would flash and not be forced.
23772 this.suppressRefreshCell = true;
23773 var valueChanged = this.rowNode.setDataValue(this.column, newValue);
23774 this.suppressRefreshCell = false;
23775 return valueChanged;
23776 };
23777 CellCtrl.prototype.dispatchEventForSaveValueReadOnly = function (oldValue, newValue) {
23778 var rowNode = this.rowNode;
23779 var event = {
23780 type: Events.EVENT_CELL_EDIT_REQUEST,
23781 event: null,
23782 rowIndex: rowNode.rowIndex,
23783 rowPinned: rowNode.rowPinned,
23784 column: this.column,
23785 api: this.beans.gridApi,
23786 columnApi: this.beans.columnApi,
23787 colDef: this.column.getColDef(),
23788 context: this.beans.gridOptionsWrapper.getContext(),
23789 data: rowNode.data,
23790 node: rowNode,
23791 oldValue: oldValue,
23792 newValue: newValue,
23793 value: newValue,
23794 source: undefined
23795 };
23796 this.beans.eventService.dispatchEvent(event);
23797 };
23798 /**
23799 * Ends the Cell Editing
23800 * @param cancel `True` if the edit process is being canceled.
23801 * @returns `True` if the value of the `GridCell` has been updated, otherwise `False`.
23802 */
23803 CellCtrl.prototype.stopEditing = function (cancel) {
23804 if (cancel === void 0) { cancel = false; }
23805 if (!this.editing) {
23806 return false;
23807 }
23808 var _a = this.takeValueFromCellEditor(cancel), newValue = _a.newValue, newValueExists = _a.newValueExists;
23809 var oldValue = this.getValueFromValueService();
23810 var valueChanged = false;
23811 if (newValueExists) {
23812 valueChanged = this.saveNewValue(oldValue, newValue);
23813 }
23814 this.setEditing(false);
23815 this.cellComp.setEditDetails(); // passing nothing stops editing
23816 this.updateAndFormatValue();
23817 this.refreshCell({ forceRefresh: true, suppressFlash: true });
23818 this.dispatchEditingStoppedEvent(oldValue, newValue);
23819 return valueChanged;
23820 };
23821 CellCtrl.prototype.dispatchEditingStoppedEvent = function (oldValue, newValue) {
23822 var editingStoppedEvent = __assign$b(__assign$b({}, this.createEvent(null, Events.EVENT_CELL_EDITING_STOPPED)), { oldValue: oldValue,
23823 newValue: newValue });
23824 this.beans.eventService.dispatchEvent(editingStoppedEvent);
23825 };
23826 // if we are editing inline, then we don't have the padding in the cell (set in the themes)
23827 // to allow the text editor full access to the entire cell
23828 CellCtrl.prototype.setInlineEditingClass = function () {
23829 if (!this.isAlive()) {
23830 return;
23831 }
23832 // ag-cell-inline-editing - appears when user is inline editing
23833 // ag-cell-not-inline-editing - appears when user is no inline editing
23834 // ag-cell-popup-editing - appears when user is editing cell in popup (appears on the cell, not on the popup)
23835 // note: one of {ag-cell-inline-editing, ag-cell-not-inline-editing} is always present, they toggle.
23836 // however {ag-cell-popup-editing} shows when popup, so you have both {ag-cell-popup-editing}
23837 // and {ag-cell-not-inline-editing} showing at the same time.
23838 var editingInline = this.editing && !this.editingInPopup;
23839 var popupEditorShowing = this.editing && this.editingInPopup;
23840 this.cellComp.addOrRemoveCssClass(CSS_CELL_INLINE_EDITING, editingInline);
23841 this.cellComp.addOrRemoveCssClass(CSS_CELL_NOT_INLINE_EDITING, !editingInline);
23842 this.cellComp.addOrRemoveCssClass(CSS_CELL_POPUP_EDITING, popupEditorShowing);
23843 this.rowCtrl.setInlineEditingCss(this.editing);
23844 };
23845 // this is needed as the JS CellComp still allows isPopup() on the CellEditor class, so
23846 // it's possible the editor is in a popup even though it's not configured via the colDef as so
23847 CellCtrl.prototype.hackSayEditingInPopup = function () {
23848 if (this.editingInPopup) {
23849 return;
23850 }
23851 this.editingInPopup = true;
23852 this.setInlineEditingClass();
23853 };
23854 CellCtrl.prototype.createCellEditorParams = function (key, charPress, cellStartedEdit) {
23855 var res = {
23856 value: this.getValueFromValueService(),
23857 key: key,
23858 eventKey: key,
23859 charPress: charPress,
23860 column: this.column,
23861 colDef: this.column.getColDef(),
23862 rowIndex: this.getCellPosition().rowIndex,
23863 node: this.rowNode,
23864 data: this.rowNode.data,
23865 api: this.beans.gridOptionsWrapper.getApi(),
23866 cellStartedEdit: cellStartedEdit,
23867 columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
23868 context: this.beans.gridOptionsWrapper.getContext(),
23869 onKeyDown: this.onKeyDown.bind(this),
23870 stopEditing: this.stopEditingAndFocus.bind(this),
23871 eGridCell: this.getGui(),
23872 parseValue: this.parseValue.bind(this),
23873 formatValue: this.formatValue.bind(this)
23874 };
23875 return res;
23876 };
23877 CellCtrl.prototype.createCellRendererParams = function () {
23878 var _this = this;
23879 var addRowCompListener = function (eventType, listener) {
23880 console.warn('AG Grid: since AG Grid v26, params.addRowCompListener() is deprecated. If you need this functionality, please contact AG Grid support and advise why so that we can revert with an appropriate workaround, as we dont have any valid use cases for it. This method was originally provided as a work around to know when cells were destroyed in AG Grid before custom Cell Renderers could be provided.');
23881 _this.rowCtrl.addEventListener(eventType, listener);
23882 };
23883 var res = {
23884 value: this.value,
23885 valueFormatted: this.valueFormatted,
23886 getValue: this.getValueFromValueService.bind(this),
23887 setValue: function (value) { return _this.beans.valueService.setValue(_this.rowNode, _this.column, value); },
23888 formatValue: this.formatValue.bind(this),
23889 data: this.rowNode.data,
23890 node: this.rowNode,
23891 colDef: this.column.getColDef(),
23892 column: this.column,
23893 rowIndex: this.getCellPosition().rowIndex,
23894 api: this.beans.gridOptionsWrapper.getApi(),
23895 columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
23896 context: this.beans.gridOptionsWrapper.getContext(),
23897 refreshCell: this.refreshCell.bind(this),
23898 eGridCell: this.getGui(),
23899 eParentOfValue: this.cellComp.getParentOfValue(),
23900 registerRowDragger: function (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) { return _this.registerRowDragger(rowDraggerElement, dragStartPixels, suppressVisibilityChange); },
23901 // this function is not documented anywhere, so we could drop it
23902 // it was in the olden days to allow user to register for when rendered
23903 // row was removed (the row comp was removed), however now that the user
23904 // can provide components for cells, the destroy method gets call when this
23905 // happens so no longer need to fire event.
23906 addRowCompListener: addRowCompListener
23907 };
23908 return res;
23909 };
23910 CellCtrl.prototype.parseValue = function (newValue) {
23911 var colDef = this.column.getColDef();
23912 var params = {
23913 node: this.rowNode,
23914 data: this.rowNode.data,
23915 oldValue: this.getValue(),
23916 newValue: newValue,
23917 colDef: colDef,
23918 column: this.column,
23919 api: this.beans.gridOptionsWrapper.getApi(),
23920 columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
23921 context: this.beans.gridOptionsWrapper.getContext()
23922 };
23923 var valueParser = colDef.valueParser;
23924 return exists(valueParser) ? this.beans.expressionService.evaluate(valueParser, params) : newValue;
23925 };
23926 CellCtrl.prototype.setFocusOutOnEditor = function () {
23927 if (!this.editing) {
23928 return;
23929 }
23930 var cellEditor = this.cellComp.getCellEditor();
23931 if (cellEditor && cellEditor.focusOut) {
23932 cellEditor.focusOut();
23933 }
23934 };
23935 CellCtrl.prototype.setFocusInOnEditor = function () {
23936 if (!this.editing) {
23937 return;
23938 }
23939 var cellEditor = this.cellComp.getCellEditor();
23940 if (cellEditor && cellEditor.focusIn) {
23941 // if the editor is present, then we just focus it
23942 cellEditor.focusIn();
23943 }
23944 else {
23945 // if the editor is not present, it means async cell editor (eg React fibre)
23946 // and we are trying to set focus before the cell editor is present, so we
23947 // focus the cell instead
23948 this.focusCell(true);
23949 }
23950 };
23951 CellCtrl.prototype.onCellChanged = function (event) {
23952 // because of async in React, the cellComp may not be set yet, if no cellComp then we are
23953 // yet to initialise the cell, so no need to refresh.
23954 if (!this.cellComp) {
23955 return;
23956 }
23957 var eventImpactsThisCell = event.column === this.column;
23958 if (eventImpactsThisCell) {
23959 this.refreshCell({});
23960 }
23961 };
23962 // + stop editing {forceRefresh: true, suppressFlash: true}
23963 // + event cellChanged {}
23964 // + cellRenderer.params.refresh() {} -> method passes 'as is' to the cellRenderer, so params could be anything
23965 // + rowCtrl: event dataChanged {suppressFlash: !update, newData: !update}
23966 // + rowCtrl: api refreshCells() {animate: true/false}
23967 // + rowRenderer: api softRefreshView() {}
23968 CellCtrl.prototype.refreshCell = function (params) {
23969 // if we are in the middle of 'stopEditing', then we don't refresh here, as refresh gets called explicitly
23970 if (this.suppressRefreshCell || this.editing) {
23971 return;
23972 }
23973 // In React, due to async, it's possible a refresh was asked for before the CellComp
23974 // has been set. If this happens, we skip the refresh, as the cell is going to be
23975 // initialised anyway once the CellComp is set.
23976 if (!this.cellComp) {
23977 return;
23978 }
23979 var colDef = this.column.getColDef();
23980 var newData = params != null && !!params.newData;
23981 var suppressFlash = (params != null && !!params.suppressFlash) || !!colDef.suppressCellFlash;
23982 // we always refresh if cell has no value - this can happen when user provides Cell Renderer and the
23983 // cell renderer doesn't rely on a value, instead it could be looking directly at the data, or maybe
23984 // printing the current time (which would be silly)???. Generally speaking
23985 // non of {field, valueGetter, showRowGroup} is bad in the users application, however for this edge case, it's
23986 // best always refresh and take the performance hit rather than never refresh and users complaining in support
23987 // that cells are not updating.
23988 var noValueProvided = colDef.field == null && colDef.valueGetter == null && colDef.showRowGroup == null;
23989 var forceRefresh = (params && params.forceRefresh) || noValueProvided || newData;
23990 var valuesDifferent = this.updateAndFormatValue();
23991 var dataNeedsUpdating = forceRefresh || valuesDifferent;
23992 if (dataNeedsUpdating) {
23993 // if it's 'new data', then we don't refresh the cellRenderer, even if refresh method is available.
23994 // this is because if the whole data is new (ie we are showing stock price 'BBA' now and not 'SSD')
23995 // then we are not showing a movement in the stock price, rather we are showing different stock.
23996 this.showValue(newData);
23997 // we don't want to flash the cells when processing a filter change, as otherwise the UI would
23998 // be to busy. see comment in FilterManager with regards processingFilterChange
23999 var processingFilterChange = this.beans.filterManager.isSuppressFlashingCellsBecauseFiltering();
24000 var flashCell = !suppressFlash && !processingFilterChange &&
24001 (this.beans.gridOptionsWrapper.isEnableCellChangeFlash() || colDef.enableCellChangeFlash);
24002 if (flashCell) {
24003 this.flashCell();
24004 }
24005 this.cellCustomStyleFeature.applyUserStyles();
24006 this.cellCustomStyleFeature.applyClassesFromColDef();
24007 }
24008 this.refreshToolTip();
24009 // we do cellClassRules even if the value has not changed, so that users who have rules that
24010 // look at other parts of the row (where the other part of the row might of changed) will work.
24011 this.cellCustomStyleFeature.applyCellClassRules();
24012 };
24013 // cell editors call this, when they want to stop for reasons other
24014 // than what we pick up on. eg selecting from a dropdown ends editing.
24015 CellCtrl.prototype.stopEditingAndFocus = function (suppressNavigateAfterEdit) {
24016 if (suppressNavigateAfterEdit === void 0) { suppressNavigateAfterEdit = false; }
24017 this.stopRowOrCellEdit();
24018 this.focusCell(true);
24019 if (!suppressNavigateAfterEdit) {
24020 this.navigateAfterEdit();
24021 }
24022 };
24023 CellCtrl.prototype.navigateAfterEdit = function () {
24024 var fullRowEdit = this.beans.gridOptionsWrapper.isFullRowEdit();
24025 if (fullRowEdit) {
24026 return;
24027 }
24028 var enterMovesDownAfterEdit = this.beans.gridOptionsWrapper.isEnterMovesDownAfterEdit();
24029 if (enterMovesDownAfterEdit) {
24030 this.beans.navigationService.navigateToNextCell(null, KeyCode.DOWN, this.getCellPosition(), false);
24031 }
24032 };
24033 // user can also call this via API
24034 CellCtrl.prototype.flashCell = function (delays) {
24035 var flashDelay = delays && delays.flashDelay;
24036 var fadeDelay = delays && delays.fadeDelay;
24037 this.animateCell('data-changed', flashDelay, fadeDelay);
24038 };
24039 CellCtrl.prototype.animateCell = function (cssName, flashDelay, fadeDelay) {
24040 var _this = this;
24041 var fullName = "ag-cell-" + cssName;
24042 var animationFullName = "ag-cell-" + cssName + "-animation";
24043 var gridOptionsWrapper = this.beans.gridOptionsWrapper;
24044 if (!flashDelay) {
24045 flashDelay = gridOptionsWrapper.getCellFlashDelay();
24046 }
24047 if (!exists(fadeDelay)) {
24048 fadeDelay = gridOptionsWrapper.getCellFadeDelay();
24049 }
24050 // we want to highlight the cells, without any animation
24051 this.cellComp.addOrRemoveCssClass(fullName, true);
24052 this.cellComp.addOrRemoveCssClass(animationFullName, false);
24053 // then once that is applied, we remove the highlight with animation
24054 window.setTimeout(function () {
24055 _this.cellComp.addOrRemoveCssClass(fullName, false);
24056 _this.cellComp.addOrRemoveCssClass(animationFullName, true);
24057 _this.eGui.style.transition = "background-color " + fadeDelay + "ms";
24058 window.setTimeout(function () {
24059 // and then to leave things as we got them, we remove the animation
24060 _this.cellComp.addOrRemoveCssClass(animationFullName, false);
24061 _this.eGui.style.transition = '';
24062 }, fadeDelay);
24063 }, flashDelay);
24064 };
24065 CellCtrl.prototype.onFlashCells = function (event) {
24066 if (!this.cellComp) {
24067 return;
24068 }
24069 var cellId = this.beans.cellPositionUtils.createId(this.getCellPosition());
24070 var shouldFlash = event.cells[cellId];
24071 if (shouldFlash) {
24072 this.animateCell('highlight');
24073 }
24074 };
24075 CellCtrl.prototype.isCellEditable = function () {
24076 return this.column.isCellEditable(this.rowNode);
24077 };
24078 CellCtrl.prototype.isSuppressFillHandle = function () {
24079 return this.column.isSuppressFillHandle();
24080 };
24081 CellCtrl.prototype.formatValue = function (value) {
24082 var res = this.callValueFormatter(value);
24083 return res != null ? res : value;
24084 };
24085 CellCtrl.prototype.callValueFormatter = function (value) {
24086 return this.beans.valueFormatterService.formatValue(this.column, this.rowNode, value);
24087 };
24088 CellCtrl.prototype.updateAndFormatValue = function (force) {
24089 if (force === void 0) { force = false; }
24090 var oldValue = this.value;
24091 var oldValueFormatted = this.valueFormatted;
24092 this.value = this.getValueFromValueService();
24093 this.valueFormatted = this.callValueFormatter(this.value);
24094 var valuesDifferent = force ? true :
24095 !this.valuesAreEqual(oldValue, this.value) || this.valueFormatted != oldValueFormatted;
24096 return valuesDifferent;
24097 };
24098 CellCtrl.prototype.valuesAreEqual = function (val1, val2) {
24099 // if the user provided an equals method, use that, otherwise do simple comparison
24100 var colDef = this.column.getColDef();
24101 return colDef.equals ? colDef.equals(val1, val2) : val1 === val2;
24102 };
24103 CellCtrl.prototype.getComp = function () {
24104 return this.cellComp;
24105 };
24106 CellCtrl.prototype.getValueFromValueService = function () {
24107 // if we don't check this, then the grid will render leaf groups as open even if we are not
24108 // allowing the user to open leaf groups. confused? remember for pivot mode we don't allow
24109 // opening leaf groups, so we have to force leafGroups to be closed in case the user expanded
24110 // them via the API, or user user expanded them in the UI before turning on pivot mode
24111 var lockedClosedGroup = this.rowNode.leafGroup && this.beans.columnModel.isPivotMode();
24112 var isOpenGroup = this.rowNode.group && this.rowNode.expanded && !this.rowNode.footer && !lockedClosedGroup;
24113 // are we showing group footers
24114 var groupFootersEnabled = this.beans.gridOptionsWrapper.isGroupIncludeFooter();
24115 // if doing footers, we normally don't show agg data at group level when group is open
24116 var groupAlwaysShowAggData = this.beans.gridOptionsWrapper.isGroupSuppressBlankHeader();
24117 // if doing grouping and footers, we don't want to include the agg value
24118 // in the header when the group is open
24119 var ignoreAggData = (isOpenGroup && groupFootersEnabled) && !groupAlwaysShowAggData;
24120 var value = this.beans.valueService.getValue(this.column, this.rowNode, false, ignoreAggData);
24121 return value;
24122 };
24123 CellCtrl.prototype.getValue = function () {
24124 return this.value;
24125 };
24126 CellCtrl.prototype.getValueFormatted = function () {
24127 return this.valueFormatted;
24128 };
24129 CellCtrl.prototype.addDomData = function () {
24130 var _this = this;
24131 var element = this.getGui();
24132 this.beans.gridOptionsWrapper.setDomData(element, CellCtrl.DOM_DATA_KEY_CELL_CTRL, this);
24133 this.addDestroyFunc(function () { return _this.beans.gridOptionsWrapper.setDomData(element, CellCtrl.DOM_DATA_KEY_CELL_CTRL, null); });
24134 };
24135 CellCtrl.prototype.createEvent = function (domEvent, eventType) {
24136 var event = {
24137 type: eventType,
24138 node: this.rowNode,
24139 data: this.rowNode.data,
24140 value: this.value,
24141 column: this.column,
24142 colDef: this.column.getColDef(),
24143 context: this.beans.gridOptionsWrapper.getContext(),
24144 api: this.beans.gridApi,
24145 columnApi: this.beans.columnApi,
24146 rowPinned: this.rowNode.rowPinned,
24147 event: domEvent,
24148 rowIndex: this.rowNode.rowIndex
24149 };
24150 return event;
24151 };
24152 CellCtrl.prototype.onKeyPress = function (event) {
24153 this.cellKeyboardListenerFeature.onKeyPress(event);
24154 };
24155 CellCtrl.prototype.onKeyDown = function (event) {
24156 this.cellKeyboardListenerFeature.onKeyDown(event);
24157 };
24158 CellCtrl.prototype.onMouseEvent = function (eventName, mouseEvent) {
24159 this.cellMouseListenerFeature.onMouseEvent(eventName, mouseEvent);
24160 };
24161 CellCtrl.prototype.getGui = function () {
24162 return this.eGui;
24163 };
24164 CellCtrl.prototype.refreshToolTip = function () {
24165 this.tooltipFeature.refreshToolTip();
24166 };
24167 CellCtrl.prototype.getColSpanningList = function () {
24168 return this.cellPositionFeature.getColSpanningList();
24169 };
24170 CellCtrl.prototype.onLeftChanged = function () {
24171 if (!this.cellComp) {
24172 return;
24173 }
24174 this.cellPositionFeature.onLeftChanged();
24175 };
24176 CellCtrl.prototype.onDisplayedColumnsChanged = function () {
24177 if (!this.eGui) {
24178 return;
24179 }
24180 this.setAriaColIndex();
24181 };
24182 CellCtrl.prototype.setAriaColIndex = function () {
24183 var colIdx = this.beans.columnModel.getAriaColumnIndex(this.column);
24184 setAriaColIndex(this.getGui(), colIdx); // for react, we don't use JSX, as it slowed down column moving
24185 };
24186 CellCtrl.prototype.isSuppressNavigable = function () {
24187 return this.column.isSuppressNavigable(this.rowNode);
24188 };
24189 CellCtrl.prototype.onWidthChanged = function () {
24190 return this.cellPositionFeature.onWidthChanged();
24191 };
24192 CellCtrl.prototype.getColumn = function () {
24193 return this.column;
24194 };
24195 CellCtrl.prototype.getRowNode = function () {
24196 return this.rowNode;
24197 };
24198 CellCtrl.prototype.getBeans = function () {
24199 return this.beans;
24200 };
24201 CellCtrl.prototype.isPrintLayout = function () {
24202 return this.printLayout;
24203 };
24204 CellCtrl.prototype.appendChild = function (htmlElement) {
24205 this.eGui.appendChild(htmlElement);
24206 };
24207 CellCtrl.prototype.refreshHandle = function () {
24208 if (this.editing) {
24209 return;
24210 }
24211 if (this.cellRangeFeature) {
24212 this.cellRangeFeature.refreshHandle();
24213 }
24214 };
24215 CellCtrl.prototype.getCellPosition = function () {
24216 return this.cellPosition;
24217 };
24218 CellCtrl.prototype.isEditing = function () {
24219 return this.editing;
24220 };
24221 // called by rowRenderer when user navigates via tab key
24222 CellCtrl.prototype.startRowOrCellEdit = function (key, charPress, event) {
24223 if (event === void 0) { event = null; }
24224 if (this.beans.gridOptionsWrapper.isFullRowEdit()) {
24225 this.rowCtrl.startRowEditing(key, charPress, this);
24226 }
24227 else {
24228 this.startEditing(key, charPress, true, event);
24229 }
24230 };
24231 CellCtrl.prototype.getRowCtrl = function () {
24232 return this.rowCtrl;
24233 };
24234 CellCtrl.prototype.getRowPosition = function () {
24235 return {
24236 rowIndex: this.cellPosition.rowIndex,
24237 rowPinned: this.cellPosition.rowPinned
24238 };
24239 };
24240 CellCtrl.prototype.updateRangeBordersIfRangeCount = function () {
24241 if (!this.cellComp) {
24242 return;
24243 }
24244 if (this.cellRangeFeature) {
24245 this.cellRangeFeature.updateRangeBordersIfRangeCount();
24246 }
24247 };
24248 CellCtrl.prototype.onRangeSelectionChanged = function () {
24249 if (!this.cellComp) {
24250 return;
24251 }
24252 if (this.cellRangeFeature) {
24253 this.cellRangeFeature.onRangeSelectionChanged();
24254 }
24255 };
24256 CellCtrl.prototype.isRangeSelectionEnabled = function () {
24257 return this.cellRangeFeature != null;
24258 };
24259 CellCtrl.prototype.focusCell = function (forceBrowserFocus) {
24260 if (forceBrowserFocus === void 0) { forceBrowserFocus = false; }
24261 this.beans.focusService.setFocusedCell(this.getCellPosition().rowIndex, this.column, this.rowNode.rowPinned, forceBrowserFocus);
24262 };
24263 CellCtrl.prototype.onRowIndexChanged = function () {
24264 // when index changes, this influences items that need the index, so we update the
24265 // grid cell so they are working off the new index.
24266 this.createCellPosition();
24267 // when the index of the row changes, ie means the cell may have lost or gained focus
24268 this.onCellFocused();
24269 // check range selection
24270 if (this.cellRangeFeature) {
24271 this.cellRangeFeature.onRangeSelectionChanged();
24272 }
24273 };
24274 CellCtrl.prototype.onFirstRightPinnedChanged = function () {
24275 if (!this.cellComp) {
24276 return;
24277 }
24278 var firstRightPinned = this.column.isFirstRightPinned();
24279 this.cellComp.addOrRemoveCssClass(CSS_CELL_FIRST_RIGHT_PINNED, firstRightPinned);
24280 };
24281 CellCtrl.prototype.onLastLeftPinnedChanged = function () {
24282 if (!this.cellComp) {
24283 return;
24284 }
24285 var lastLeftPinned = this.column.isLastLeftPinned();
24286 this.cellComp.addOrRemoveCssClass(CSS_CELL_LAST_LEFT_PINNED, lastLeftPinned);
24287 };
24288 CellCtrl.prototype.onCellFocused = function (event) {
24289 if (!this.cellComp || this.gow.isSuppressCellFocus()) {
24290 return;
24291 }
24292 var cellFocused = this.beans.focusService.isCellFocused(this.cellPosition);
24293 this.cellComp.addOrRemoveCssClass(CSS_CELL_FOCUS, cellFocused);
24294 // see if we need to force browser focus - this can happen if focus is programmatically set
24295 if (cellFocused && event && event.forceBrowserFocus) {
24296 var focusEl = this.cellComp.getFocusableElement();
24297 focusEl.focus();
24298 }
24299 // if another cell was focused, and we are editing, then stop editing
24300 var fullRowEdit = this.beans.gridOptionsWrapper.isFullRowEdit();
24301 if (!cellFocused && !fullRowEdit && this.editing) {
24302 this.stopRowOrCellEdit();
24303 }
24304 };
24305 CellCtrl.prototype.createCellPosition = function () {
24306 this.cellPosition = {
24307 rowIndex: this.rowNode.rowIndex,
24308 rowPinned: makeNull(this.rowNode.rowPinned),
24309 column: this.column
24310 };
24311 };
24312 // CSS Classes that only get applied once, they never change
24313 CellCtrl.prototype.applyStaticCssClasses = function () {
24314 this.cellComp.addOrRemoveCssClass(CSS_CELL, true);
24315 this.cellComp.addOrRemoveCssClass(CSS_CELL_NOT_INLINE_EDITING, true);
24316 // normal cells fill the height of the row. autoHeight cells have no height to let them
24317 // fit the height of content.
24318 var autoHeight = this.column.isAutoHeight() == true;
24319 this.cellComp.addOrRemoveCssClass(CSS_AUTO_HEIGHT, autoHeight);
24320 this.cellComp.addOrRemoveCssClass(CSS_NORMAL_HEIGHT, !autoHeight);
24321 };
24322 CellCtrl.prototype.onColumnHover = function () {
24323 if (!this.cellComp) {
24324 return;
24325 }
24326 if (!this.beans.gridOptionsWrapper.isColumnHoverHighlight()) {
24327 return;
24328 }
24329 var isHovered = this.beans.columnHoverService.isHovered(this.column);
24330 this.cellComp.addOrRemoveCssClass(CSS_COLUMN_HOVER, isHovered);
24331 };
24332 CellCtrl.prototype.onNewColumnsLoaded = function () {
24333 if (!this.cellComp) {
24334 return;
24335 }
24336 this.setWrapText();
24337 if (!this.editing) {
24338 this.refreshCell({ forceRefresh: true, suppressFlash: true });
24339 }
24340 };
24341 CellCtrl.prototype.setWrapText = function () {
24342 var value = this.column.getColDef().wrapText == true;
24343 this.cellComp.addOrRemoveCssClass(CSS_CELL_WRAP_TEXT, value);
24344 };
24345 CellCtrl.prototype.dispatchCellContextMenuEvent = function (event) {
24346 var colDef = this.column.getColDef();
24347 var cellContextMenuEvent = this.createEvent(event, Events.EVENT_CELL_CONTEXT_MENU);
24348 this.beans.eventService.dispatchEvent(cellContextMenuEvent);
24349 if (colDef.onCellContextMenu) {
24350 // to make the callback async, do in a timeout
24351 window.setTimeout(function () { return colDef.onCellContextMenu(cellContextMenuEvent); }, 0);
24352 }
24353 };
24354 CellCtrl.prototype.getCellRenderer = function () {
24355 return this.cellComp ? this.cellComp.getCellRenderer() : null;
24356 };
24357 CellCtrl.prototype.getCellEditor = function () {
24358 return this.cellComp ? this.cellComp.getCellEditor() : null;
24359 };
24360 CellCtrl.prototype.destroy = function () {
24361 _super.prototype.destroy.call(this);
24362 };
24363 CellCtrl.prototype.createSelectionCheckbox = function () {
24364 var cbSelectionComponent = new CheckboxSelectionComponent();
24365 this.beans.context.createBean(cbSelectionComponent);
24366 cbSelectionComponent.init({ rowNode: this.rowNode, column: this.column });
24367 // put the checkbox in before the value
24368 return cbSelectionComponent;
24369 };
24370 CellCtrl.prototype.createDndSource = function () {
24371 var dndSourceComp = new DndSourceComp(this.rowNode, this.column, this.beans, this.eGui);
24372 this.beans.context.createBean(dndSourceComp);
24373 return dndSourceComp;
24374 };
24375 CellCtrl.prototype.registerRowDragger = function (customElement, dragStartPixels, suppressVisibilityChange) {
24376 var _this = this;
24377 // if previously existed, then we are only updating
24378 if (this.customRowDragComp) {
24379 this.customRowDragComp.setDragElement(customElement, dragStartPixels);
24380 return;
24381 }
24382 var newComp = this.createRowDragComp(customElement, dragStartPixels, suppressVisibilityChange);
24383 if (newComp) {
24384 this.customRowDragComp = newComp;
24385 this.addDestroyFunc(function () { return _this.beans.context.destroyBean(newComp); });
24386 }
24387 };
24388 CellCtrl.prototype.createRowDragComp = function (customElement, dragStartPixels, suppressVisibilityChange) {
24389 var _this = this;
24390 var pagination = this.beans.gridOptionsWrapper.isPagination();
24391 var rowDragManaged = this.beans.gridOptionsWrapper.isRowDragManaged();
24392 var clientSideRowModelActive = this.beans.gridOptionsWrapper.isRowModelDefault();
24393 if (rowDragManaged) {
24394 // row dragging only available in default row model
24395 if (!clientSideRowModelActive) {
24396 doOnce(function () { return console.warn('AG Grid: managed row dragging is only allowed in the Client Side Row Model'); }, 'CellComp.addRowDragging');
24397 return;
24398 }
24399 if (pagination) {
24400 doOnce(function () { return console.warn('AG Grid: managed row dragging is not possible when doing pagination'); }, 'CellComp.addRowDragging');
24401 return;
24402 }
24403 }
24404 // otherwise (normal case) we are creating a RowDraggingComp for the first time
24405 var rowDragComp = new RowDragComp(function () { return _this.value; }, this.rowNode, this.column, customElement, dragStartPixels, suppressVisibilityChange);
24406 this.beans.context.createBean(rowDragComp);
24407 return rowDragComp;
24408 };
24409 CellCtrl.DOM_DATA_KEY_CELL_CTRL = 'cellCtrl';
24410 return CellCtrl;
24411}(BeanStub));
24412
24413/**
24414 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
24415 * @version v27.3.0
24416 * @link https://www.ag-grid.com/
24417 * @license MIT
24418 */
24419var __extends$$ = (undefined && undefined.__extends) || (function () {
24420 var extendStatics = function (d, b) {
24421 extendStatics = Object.setPrototypeOf ||
24422 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
24423 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
24424 return extendStatics(d, b);
24425 };
24426 return function (d, b) {
24427 extendStatics(d, b);
24428 function __() { this.constructor = d; }
24429 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
24430 };
24431})();
24432var __read$8 = (undefined && undefined.__read) || function (o, n) {
24433 var m = typeof Symbol === "function" && o[Symbol.iterator];
24434 if (!m) return o;
24435 var i = m.call(o), r, ar = [], e;
24436 try {
24437 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
24438 }
24439 catch (error) { e = { error: error }; }
24440 finally {
24441 try {
24442 if (r && !r.done && (m = i["return"])) m.call(i);
24443 }
24444 finally { if (e) throw e.error; }
24445 }
24446 return ar;
24447};
24448var __spread$6 = (undefined && undefined.__spread) || function () {
24449 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$8(arguments[i]));
24450 return ar;
24451};
24452var RowType;
24453(function (RowType) {
24454 RowType["Normal"] = "Normal";
24455 RowType["FullWidth"] = "FullWidth";
24456 RowType["FullWidthLoading"] = "FullWidthLoading";
24457 RowType["FullWidthGroup"] = "FullWidthGroup";
24458 RowType["FullWidthDetail"] = "FullWidthDetail";
24459})(RowType || (RowType = {}));
24460var instanceIdSequence$2 = 0;
24461var RowCtrl = /** @class */ (function (_super) {
24462 __extends$$(RowCtrl, _super);
24463 function RowCtrl(rowNode, beans, animateIn, useAnimationFrameForCreate, printLayout) {
24464 var _this = _super.call(this) || this;
24465 _this.allRowGuis = [];
24466 _this.active = true;
24467 _this.centerCellCtrls = { list: [], map: {} };
24468 _this.leftCellCtrls = { list: [], map: {} };
24469 _this.rightCellCtrls = { list: [], map: {} };
24470 _this.lastMouseDownOnDragger = false;
24471 _this.updateColumnListsPending = false;
24472 _this.beans = beans;
24473 _this.rowNode = rowNode;
24474 _this.paginationPage = _this.beans.paginationProxy.getCurrentPage();
24475 _this.useAnimationFrameForCreate = useAnimationFrameForCreate;
24476 _this.printLayout = printLayout;
24477 _this.instanceId = rowNode.id + '-' + instanceIdSequence$2++;
24478 _this.setAnimateFlags(animateIn);
24479 _this.rowFocused = _this.beans.focusService.isRowFocused(_this.rowNode.rowIndex, _this.rowNode.rowPinned);
24480 _this.rowLevel = _this.beans.rowCssClassCalculator.calculateRowLevel(_this.rowNode);
24481 _this.setRowType();
24482 _this.addListeners();
24483 _this.setInitialRowTop();
24484 return _this;
24485 }
24486 RowCtrl.prototype.getBeans = function () {
24487 return this.beans;
24488 };
24489 RowCtrl.prototype.getInstanceId = function () {
24490 return this.instanceId;
24491 };
24492 RowCtrl.prototype.setComp = function (rowComp, element, containerType) {
24493 var gui = { rowComp: rowComp, element: element, containerType: containerType };
24494 this.allRowGuis.push(gui);
24495 if (containerType === exports.RowContainerType.LEFT) {
24496 this.leftGui = gui;
24497 }
24498 else if (containerType === exports.RowContainerType.RIGHT) {
24499 this.rightGui = gui;
24500 }
24501 else if (containerType === exports.RowContainerType.FULL_WIDTH) {
24502 this.fullWidthGui = gui;
24503 }
24504 else {
24505 this.centerGui = gui;
24506 }
24507 var allNormalPresent = this.leftGui != null && this.rightGui != null && this.centerGui != null;
24508 var fullWidthPresent = this.fullWidthGui != null;
24509 if (allNormalPresent || fullWidthPresent) {
24510 this.initialiseRowComps();
24511 }
24512 };
24513 RowCtrl.prototype.isCacheable = function () {
24514 return this.rowType === RowType.FullWidthDetail
24515 && this.beans.gridOptionsWrapper.isKeepDetailRows();
24516 };
24517 RowCtrl.prototype.setCached = function (cached) {
24518 var displayValue = cached ? 'none' : '';
24519 this.allRowGuis.forEach(function (rg) { return rg.element.style.display = displayValue; });
24520 };
24521 RowCtrl.prototype.initialiseRowComps = function () {
24522 var _this = this;
24523 var gow = this.beans.gridOptionsWrapper;
24524 this.onRowHeightChanged();
24525 this.updateRowIndexes();
24526 this.setFocusedClasses();
24527 this.setStylesFromGridOptions();
24528 if (gow.isRowSelection() && this.rowNode.selectable) {
24529 this.onRowSelected();
24530 }
24531 this.updateColumnLists(!this.useAnimationFrameForCreate);
24532 if (this.slideRowIn) {
24533 executeNextVMTurn(this.onTopChanged.bind(this));
24534 }
24535 if (this.fadeRowIn) {
24536 executeNextVMTurn(function () {
24537 _this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-opacity-zero', false); });
24538 });
24539 }
24540 var businessKey = this.getRowBusinessKey();
24541 var rowIdSanitised = escapeString(this.rowNode.id);
24542 var businessKeySanitised = escapeString(businessKey);
24543 this.allRowGuis.forEach(function (gui) {
24544 var comp = gui.rowComp;
24545 comp.setRole('row');
24546 var initialRowClasses = _this.getInitialRowClasses(gui.containerType);
24547 initialRowClasses.forEach(function (name) { return comp.addOrRemoveCssClass(name, true); });
24548 if (_this.rowNode.group) {
24549 setAriaExpanded(gui.element, _this.rowNode.expanded == true);
24550 }
24551 if (rowIdSanitised != null) {
24552 comp.setRowId(rowIdSanitised);
24553 }
24554 if (businessKeySanitised != null) {
24555 comp.setRowBusinessKey(businessKeySanitised);
24556 }
24557 if (_this.isFullWidth() && !_this.beans.gridOptionsWrapper.isSuppressCellFocus()) {
24558 comp.setTabIndex(-1);
24559 }
24560 // DOM DATA
24561 gow.setDomData(gui.element, RowCtrl.DOM_DATA_KEY_ROW_CTRL, _this);
24562 _this.addDestroyFunc(function () { return gow.setDomData(gui.element, RowCtrl.DOM_DATA_KEY_ROW_CTRL, null); });
24563 // adding hover functionality adds listener to this row, so we
24564 // do it lazily in an animation frame
24565 if (_this.useAnimationFrameForCreate) {
24566 _this.beans.animationFrameService.createTask(_this.addHoverFunctionality.bind(_this, gui.element), _this.rowNode.rowIndex, 'createTasksP2');
24567 }
24568 else {
24569 _this.addHoverFunctionality(gui.element);
24570 }
24571 if (_this.isFullWidth()) {
24572 _this.setupFullWidth(gui);
24573 }
24574 if (gow.isRowDragEntireRow()) {
24575 _this.addRowDraggerToRow(gui);
24576 }
24577 if (_this.useAnimationFrameForCreate) {
24578 // the height animation we only want active after the row is alive for 1 second.
24579 // this stops the row animation working when rows are initially crated. otherwise
24580 // auto-height rows get inserted into the dom and resized immediately, which gives
24581 // very bad UX (eg 10 rows get inserted, then all 10 expand, look particularly bad
24582 // when scrolling). so this makes sure when rows are shown for the first time, they
24583 // are resized immediately without animation.
24584 _this.beans.animationFrameService.addDestroyTask(function () {
24585 if (!_this.isAlive()) {
24586 return;
24587 }
24588 gui.rowComp.addOrRemoveCssClass('ag-after-created', true);
24589 });
24590 }
24591 });
24592 this.executeProcessRowPostCreateFunc();
24593 };
24594 RowCtrl.prototype.addRowDraggerToRow = function (gui) {
24595 var gow = this.beans.gridOptionsWrapper;
24596 if (gow.isEnableRangeSelection()) {
24597 doOnce(function () {
24598 console.warn('AG Grid: Setting `rowDragEntireRow: true` in the gridOptions doesn\'t work with `enableRangeSelection: true`');
24599 }, 'rowDragAndRangeSelectionEnabled');
24600 return;
24601 }
24602 var rowDragComp = new RowDragComp(function () { return '1 row'; }, this.rowNode, undefined, gui.element, undefined, true);
24603 this.createManagedBean(rowDragComp, this.beans.context);
24604 };
24605 RowCtrl.prototype.setupFullWidth = function (gui) {
24606 var pinned = this.getPinnedForContainer(gui.containerType);
24607 var params = this.createFullWidthParams(gui.element, pinned);
24608 var masterDetailModuleLoaded = ModuleRegistry.isRegistered(exports.ModuleNames.MasterDetailModule);
24609 if (this.rowType == RowType.FullWidthDetail && !masterDetailModuleLoaded) {
24610 if (ModuleRegistry.isPackageBased()) {
24611 console.warn("AG Grid: cell renderer 'agDetailCellRenderer' (for master detail) not found. Can only be used with ag-grid-enterprise package.");
24612 }
24613 else {
24614 console.warn("AG Grid: cell renderer 'agDetailCellRenderer' (for master detail) not found. Can only be used with AG Grid Enterprise Module " + exports.ModuleNames.MasterDetailModule);
24615 }
24616 return;
24617 }
24618 var compDetails;
24619 switch (this.rowType) {
24620 case RowType.FullWidthDetail:
24621 compDetails = this.beans.userComponentFactory.getFullWidthDetailCellRendererDetails(params);
24622 break;
24623 case RowType.FullWidthGroup:
24624 compDetails = this.beans.userComponentFactory.getFullWidthGroupCellRendererDetails(params);
24625 break;
24626 case RowType.FullWidthLoading:
24627 compDetails = this.beans.userComponentFactory.getFullWidthLoadingCellRendererDetails(params);
24628 break;
24629 default:
24630 compDetails = this.beans.userComponentFactory.getFullWidthCellRendererDetails(params);
24631 break;
24632 }
24633 gui.rowComp.showFullWidth(compDetails);
24634 };
24635 RowCtrl.prototype.isPrintLayout = function () {
24636 return this.printLayout;
24637 };
24638 // use by autoWidthCalculator, as it clones the elements
24639 RowCtrl.prototype.getCellElement = function (column) {
24640 var cellCtrl = this.getCellCtrl(column);
24641 return cellCtrl ? cellCtrl.getGui() : null;
24642 };
24643 RowCtrl.prototype.executeProcessRowPostCreateFunc = function () {
24644 var func = this.beans.gridOptionsWrapper.getProcessRowPostCreateFunc();
24645 if (!func) {
24646 return;
24647 }
24648 var params = {
24649 eRow: this.centerGui ? this.centerGui.element : undefined,
24650 ePinnedLeftRow: this.leftGui ? this.leftGui.element : undefined,
24651 ePinnedRightRow: this.rightGui ? this.rightGui.element : undefined,
24652 node: this.rowNode,
24653 rowIndex: this.rowNode.rowIndex,
24654 addRenderedRowListener: this.addEventListener.bind(this),
24655 };
24656 func(params);
24657 };
24658 RowCtrl.prototype.setRowType = function () {
24659 var isStub = this.rowNode.stub;
24660 var isFullWidthCell = this.rowNode.isFullWidthCell();
24661 var isDetailCell = this.beans.doingMasterDetail && this.rowNode.detail;
24662 var pivotMode = this.beans.columnModel.isPivotMode();
24663 // we only use full width for groups, not footers. it wouldn't make sense to include footers if not looking
24664 // for totals. if users complain about this, then we should introduce a new property 'footerUseEntireRow'
24665 // so each can be set independently (as a customer complained about footers getting full width, hence
24666 // introducing this logic)
24667 var isGroupRow = !!this.rowNode.group && !this.rowNode.footer;
24668 var isFullWidthGroup = isGroupRow && this.beans.gridOptionsWrapper.isGroupUseEntireRow(pivotMode);
24669 if (isStub) {
24670 this.rowType = RowType.FullWidthLoading;
24671 }
24672 else if (isDetailCell) {
24673 this.rowType = RowType.FullWidthDetail;
24674 }
24675 else if (isFullWidthCell) {
24676 this.rowType = RowType.FullWidth;
24677 }
24678 else if (isFullWidthGroup) {
24679 this.rowType = RowType.FullWidthGroup;
24680 }
24681 else {
24682 this.rowType = RowType.Normal;
24683 }
24684 };
24685 RowCtrl.prototype.updateColumnLists = function (suppressAnimationFrame) {
24686 var _this = this;
24687 if (suppressAnimationFrame === void 0) { suppressAnimationFrame = false; }
24688 if (this.isFullWidth()) {
24689 return;
24690 }
24691 var noAnimation = suppressAnimationFrame
24692 || this.beans.gridOptionsWrapper.isSuppressAnimationFrame()
24693 || this.printLayout;
24694 if (noAnimation) {
24695 this.updateColumnListsImpl();
24696 return;
24697 }
24698 if (this.updateColumnListsPending) {
24699 return;
24700 }
24701 this.beans.animationFrameService.createTask(function () {
24702 if (!_this.active) {
24703 return;
24704 }
24705 _this.updateColumnListsImpl();
24706 }, this.rowNode.rowIndex, 'createTasksP1');
24707 this.updateColumnListsPending = true;
24708 };
24709 RowCtrl.prototype.createCellCtrls = function (prev, cols, pinned) {
24710 var _this = this;
24711 if (pinned === void 0) { pinned = null; }
24712 var res = {
24713 list: [],
24714 map: {}
24715 };
24716 var addCell = function (colInstanceId, cellCtrl) {
24717 res.list.push(cellCtrl);
24718 res.map[colInstanceId] = cellCtrl;
24719 };
24720 cols.forEach(function (col) {
24721 // we use instanceId's rather than colId as it's possible there is a Column with same Id,
24722 // but it's referring to a different column instance. Happens a lot with pivot, as pivot col id's are
24723 // reused eg pivot_0, pivot_1 etc
24724 var colInstanceId = col.getInstanceId();
24725 var cellCtrl = prev.map[colInstanceId];
24726 if (!cellCtrl) {
24727 cellCtrl = new CellCtrl(col, _this.rowNode, _this.beans, _this);
24728 }
24729 addCell(colInstanceId, cellCtrl);
24730 });
24731 prev.list.forEach(function (prevCellCtrl) {
24732 var cellInResult = res.map[prevCellCtrl.getColumn().getInstanceId()] != null;
24733 if (cellInResult) {
24734 return;
24735 }
24736 var keepCell = !_this.isCellEligibleToBeRemoved(prevCellCtrl, pinned);
24737 if (keepCell) {
24738 addCell(prevCellCtrl.getColumn().getInstanceId(), prevCellCtrl);
24739 return;
24740 }
24741 prevCellCtrl.destroy();
24742 });
24743 return res;
24744 };
24745 RowCtrl.prototype.updateColumnListsImpl = function () {
24746 var _this = this;
24747 this.updateColumnListsPending = false;
24748 var columnModel = this.beans.columnModel;
24749 if (this.printLayout) {
24750 this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, columnModel.getAllDisplayedColumns());
24751 this.leftCellCtrls = { list: [], map: {} };
24752 this.rightCellCtrls = { list: [], map: {} };
24753 }
24754 else {
24755 var centerCols = columnModel.getViewportCenterColumnsForRow(this.rowNode);
24756 this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, centerCols);
24757 var leftCols = columnModel.getDisplayedLeftColumnsForRow(this.rowNode);
24758 this.leftCellCtrls = this.createCellCtrls(this.leftCellCtrls, leftCols, Constants.PINNED_LEFT);
24759 var rightCols = columnModel.getDisplayedRightColumnsForRow(this.rowNode);
24760 this.rightCellCtrls = this.createCellCtrls(this.rightCellCtrls, rightCols, Constants.PINNED_RIGHT);
24761 }
24762 this.allRowGuis.forEach(function (item) {
24763 var cellControls = item.containerType === exports.RowContainerType.LEFT ? _this.leftCellCtrls :
24764 item.containerType === exports.RowContainerType.RIGHT ? _this.rightCellCtrls : _this.centerCellCtrls;
24765 item.rowComp.setCellCtrls(cellControls.list);
24766 });
24767 };
24768 RowCtrl.prototype.isCellEligibleToBeRemoved = function (cellCtrl, nextContainerPinned) {
24769 var REMOVE_CELL = true;
24770 var KEEP_CELL = false;
24771 // always remove the cell if it's not rendered or if it's in the wrong pinned location
24772 var column = cellCtrl.getColumn();
24773 if (column.getPinned() != nextContainerPinned) {
24774 return REMOVE_CELL;
24775 }
24776 // we want to try and keep editing and focused cells
24777 var editing = cellCtrl.isEditing();
24778 var focused = this.beans.focusService.isCellFocused(cellCtrl.getCellPosition());
24779 var mightWantToKeepCell = editing || focused;
24780 if (mightWantToKeepCell) {
24781 var column_1 = cellCtrl.getColumn();
24782 var displayedColumns = this.beans.columnModel.getAllDisplayedColumns();
24783 var cellStillDisplayed = displayedColumns.indexOf(column_1) >= 0;
24784 return cellStillDisplayed ? KEEP_CELL : REMOVE_CELL;
24785 }
24786 return REMOVE_CELL;
24787 };
24788 RowCtrl.prototype.setAnimateFlags = function (animateIn) {
24789 if (animateIn) {
24790 var oldRowTopExists = exists(this.rowNode.oldRowTop);
24791 // if the row had a previous position, we slide it in (animate row top)
24792 this.slideRowIn = oldRowTopExists;
24793 // if the row had no previous position, we fade it in (animate
24794 this.fadeRowIn = !oldRowTopExists;
24795 }
24796 else {
24797 this.slideRowIn = false;
24798 this.fadeRowIn = false;
24799 }
24800 };
24801 RowCtrl.prototype.isEditing = function () {
24802 return this.editingRow;
24803 };
24804 RowCtrl.prototype.stopRowEditing = function (cancel) {
24805 this.stopEditing(cancel);
24806 };
24807 RowCtrl.prototype.isFullWidth = function () {
24808 return this.rowType !== RowType.Normal;
24809 };
24810 RowCtrl.prototype.getRowType = function () {
24811 return this.rowType;
24812 };
24813 RowCtrl.prototype.refreshFullWidth = function () {
24814 var _this = this;
24815 // returns 'true' if refresh succeeded
24816 var tryRefresh = function (gui, pinned) {
24817 if (!gui) {
24818 return true;
24819 } // no refresh needed
24820 var cellRenderer = gui.rowComp.getFullWidthCellRenderer();
24821 // no cell renderer, either means comp not yet ready, or comp ready but now reference
24822 // to it (happens in react when comp is stateless). if comp not ready, we don't need to
24823 // refresh, however we don't know which one, so we refresh to cover the case where it's
24824 // react comp without reference so need to force a refresh
24825 if (!cellRenderer) {
24826 return false;
24827 }
24828 // no refresh method present, so can't refresh, hard refresh needed
24829 if (!cellRenderer.refresh) {
24830 return false;
24831 }
24832 var params = _this.createFullWidthParams(gui.element, pinned);
24833 var refreshSucceeded = cellRenderer.refresh(params);
24834 return refreshSucceeded;
24835 };
24836 var fullWidthSuccess = tryRefresh(this.fullWidthGui, null);
24837 var centerSuccess = tryRefresh(this.centerGui, null);
24838 var leftSuccess = tryRefresh(this.leftGui, Constants.PINNED_LEFT);
24839 var rightSuccess = tryRefresh(this.rightGui, Constants.PINNED_RIGHT);
24840 var allFullWidthRowsRefreshed = fullWidthSuccess && centerSuccess && leftSuccess && rightSuccess;
24841 return allFullWidthRowsRefreshed;
24842 };
24843 RowCtrl.prototype.addListeners = function () {
24844 this.addManagedListener(this.rowNode, RowNode.EVENT_HEIGHT_CHANGED, this.onRowHeightChanged.bind(this));
24845 this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_SELECTED, this.onRowSelected.bind(this));
24846 this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_INDEX_CHANGED, this.onRowIndexChanged.bind(this));
24847 this.addManagedListener(this.rowNode, RowNode.EVENT_TOP_CHANGED, this.onTopChanged.bind(this));
24848 this.addManagedListener(this.rowNode, RowNode.EVENT_EXPANDED_CHANGED, this.updateExpandedCss.bind(this));
24849 this.addManagedListener(this.rowNode, RowNode.EVENT_HAS_CHILDREN_CHANGED, this.updateExpandedCss.bind(this));
24850 this.addManagedListener(this.rowNode, RowNode.EVENT_DATA_CHANGED, this.onRowNodeDataChanged.bind(this));
24851 this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, this.onRowNodeCellChanged.bind(this));
24852 this.addManagedListener(this.rowNode, RowNode.EVENT_HIGHLIGHT_CHANGED, this.onRowNodeHighlightChanged.bind(this));
24853 this.addManagedListener(this.rowNode, RowNode.EVENT_DRAGGING_CHANGED, this.onRowNodeDraggingChanged.bind(this));
24854 this.addManagedListener(this.rowNode, RowNode.EVENT_UI_LEVEL_CHANGED, this.onUiLevelChanged.bind(this));
24855 var eventService = this.beans.eventService;
24856 this.addManagedListener(eventService, Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED, this.onPaginationPixelOffsetChanged.bind(this));
24857 this.addManagedListener(eventService, Events.EVENT_HEIGHT_SCALE_CHANGED, this.onTopChanged.bind(this));
24858 this.addManagedListener(eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
24859 this.addManagedListener(eventService, Events.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this));
24860 this.addManagedListener(eventService, Events.EVENT_CELL_FOCUSED, this.onCellFocusChanged.bind(this));
24861 this.addManagedListener(eventService, Events.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this));
24862 this.addManagedListener(eventService, Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));
24863 this.addManagedListener(eventService, Events.EVENT_COLUMN_MOVED, this.onColumnMoved.bind(this));
24864 this.addListenersForCellComps();
24865 };
24866 RowCtrl.prototype.onColumnMoved = function () {
24867 this.updateColumnLists();
24868 };
24869 RowCtrl.prototype.addListenersForCellComps = function () {
24870 var _this = this;
24871 this.addManagedListener(this.rowNode, RowNode.EVENT_ROW_INDEX_CHANGED, function () {
24872 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onRowIndexChanged(); });
24873 });
24874 this.addManagedListener(this.rowNode, RowNode.EVENT_CELL_CHANGED, function (event) {
24875 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onCellChanged(event); });
24876 });
24877 };
24878 RowCtrl.prototype.onRowNodeDataChanged = function (event) {
24879 // if this is an update, we want to refresh, as this will allow the user to put in a transition
24880 // into the cellRenderer refresh method. otherwise this might be completely new data, in which case
24881 // we will want to completely replace the cells
24882 this.getAllCellCtrls().forEach(function (cellCtrl) {
24883 return cellCtrl.refreshCell({
24884 suppressFlash: !event.update,
24885 newData: !event.update
24886 });
24887 });
24888 // check for selected also, as this could be after lazy loading of the row data, in which case
24889 // the id might of just gotten set inside the row and the row selected state may of changed
24890 // as a result. this is what happens when selected rows are loaded in virtual pagination.
24891 // - niall note - since moving to the stub component, this may no longer be true, as replacing
24892 // the stub component now replaces the entire row
24893 this.onRowSelected();
24894 // as data has changed, then the style and class needs to be recomputed
24895 this.postProcessCss();
24896 };
24897 RowCtrl.prototype.onRowNodeCellChanged = function () {
24898 // as data has changed, then the style and class needs to be recomputed
24899 this.postProcessCss();
24900 };
24901 RowCtrl.prototype.postProcessCss = function () {
24902 this.setStylesFromGridOptions();
24903 this.postProcessClassesFromGridOptions();
24904 this.postProcessRowClassRules();
24905 this.postProcessRowDragging();
24906 };
24907 RowCtrl.prototype.onRowNodeHighlightChanged = function () {
24908 var highlighted = this.rowNode.highlighted;
24909 this.allRowGuis.forEach(function (gui) {
24910 var aboveOn = highlighted === exports.RowHighlightPosition.Above;
24911 var belowOn = highlighted === exports.RowHighlightPosition.Below;
24912 gui.rowComp.addOrRemoveCssClass('ag-row-highlight-above', aboveOn);
24913 gui.rowComp.addOrRemoveCssClass('ag-row-highlight-below', belowOn);
24914 });
24915 };
24916 RowCtrl.prototype.onRowNodeDraggingChanged = function () {
24917 this.postProcessRowDragging();
24918 };
24919 RowCtrl.prototype.postProcessRowDragging = function () {
24920 var dragging = this.rowNode.dragging;
24921 this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-dragging', dragging); });
24922 };
24923 RowCtrl.prototype.updateExpandedCss = function () {
24924 var expandable = this.rowNode.isExpandable();
24925 var expanded = this.rowNode.expanded == true;
24926 this.allRowGuis.forEach(function (gui) {
24927 gui.rowComp.addOrRemoveCssClass('ag-row-group', expandable);
24928 gui.rowComp.addOrRemoveCssClass('ag-row-group-expanded', expandable && expanded);
24929 gui.rowComp.addOrRemoveCssClass('ag-row-group-contracted', expandable && !expanded);
24930 setAriaExpanded(gui.element, expandable && expanded);
24931 });
24932 };
24933 RowCtrl.prototype.onDisplayedColumnsChanged = function () {
24934 // we skip animations for onDisplayedColumnChanged, as otherwise the client could remove columns and
24935 // then set data, and any old valueGetter's (ie from cols that were removed) would still get called.
24936 this.updateColumnLists(true);
24937 if (this.beans.columnModel.wasAutoRowHeightEverActive()) {
24938 this.rowNode.checkAutoHeights();
24939 }
24940 };
24941 RowCtrl.prototype.onVirtualColumnsChanged = function () {
24942 this.updateColumnLists();
24943 };
24944 RowCtrl.prototype.getRowPosition = function () {
24945 return {
24946 rowPinned: makeNull(this.rowNode.rowPinned),
24947 rowIndex: this.rowNode.rowIndex
24948 };
24949 };
24950 RowCtrl.prototype.onKeyboardNavigate = function (keyboardEvent) {
24951 var currentFullWidthComp = this.allRowGuis.find(function (c) { return c.element.contains(keyboardEvent.target); });
24952 var currentFullWidthContainer = currentFullWidthComp ? currentFullWidthComp.element : null;
24953 var isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target;
24954 if (!isFullWidthContainerFocused) {
24955 return;
24956 }
24957 var node = this.rowNode;
24958 var lastFocusedCell = this.beans.focusService.getFocusedCell();
24959 var cellPosition = {
24960 rowIndex: node.rowIndex,
24961 rowPinned: node.rowPinned,
24962 column: (lastFocusedCell && lastFocusedCell.column)
24963 };
24964 this.beans.navigationService.navigateToNextCell(keyboardEvent, keyboardEvent.key, cellPosition, true);
24965 keyboardEvent.preventDefault();
24966 };
24967 RowCtrl.prototype.onTabKeyDown = function (keyboardEvent) {
24968 if (keyboardEvent.defaultPrevented || isStopPropagationForAgGrid(keyboardEvent)) {
24969 return;
24970 }
24971 var currentFullWidthComp = this.allRowGuis.find(function (c) { return c.element.contains(keyboardEvent.target); });
24972 var currentFullWidthContainer = currentFullWidthComp ? currentFullWidthComp.element : null;
24973 var isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target;
24974 var nextEl = null;
24975 if (!isFullWidthContainerFocused) {
24976 nextEl = this.beans.focusService.findNextFocusableElement(currentFullWidthContainer, false, keyboardEvent.shiftKey);
24977 }
24978 if ((this.isFullWidth() && isFullWidthContainerFocused) || !nextEl) {
24979 this.beans.navigationService.onTabKeyDown(this, keyboardEvent);
24980 }
24981 };
24982 RowCtrl.prototype.onFullWidthRowFocused = function (event) {
24983 var _a;
24984 var node = this.rowNode;
24985 var isFocused = this.isFullWidth() && event.rowIndex === node.rowIndex && event.rowPinned == node.rowPinned;
24986 var element = this.fullWidthGui ? this.fullWidthGui.element : (_a = this.centerGui) === null || _a === void 0 ? void 0 : _a.element;
24987 if (!element) {
24988 return;
24989 } // can happen with react ui, comp not yet ready
24990 element.classList.toggle('ag-full-width-focus', isFocused);
24991 if (isFocused) {
24992 // we don't scroll normal rows into view when we focus them, so we don't want
24993 // to scroll Full Width rows either.
24994 element.focus({ preventScroll: true });
24995 }
24996 };
24997 RowCtrl.prototype.refreshCell = function (cellCtrl) {
24998 this.centerCellCtrls = this.removeCellCtrl(this.centerCellCtrls, cellCtrl);
24999 this.leftCellCtrls = this.removeCellCtrl(this.leftCellCtrls, cellCtrl);
25000 this.rightCellCtrls = this.removeCellCtrl(this.rightCellCtrls, cellCtrl);
25001 this.updateColumnLists();
25002 };
25003 RowCtrl.prototype.removeCellCtrl = function (prev, cellCtrlToRemove) {
25004 var res = {
25005 list: [],
25006 map: {}
25007 };
25008 prev.list.forEach(function (cellCtrl) {
25009 if (cellCtrl === cellCtrlToRemove) {
25010 return;
25011 }
25012 res.list.push(cellCtrl);
25013 res.map[cellCtrl.getInstanceId()] = cellCtrl;
25014 });
25015 return res;
25016 };
25017 RowCtrl.prototype.onMouseEvent = function (eventName, mouseEvent) {
25018 switch (eventName) {
25019 case 'dblclick':
25020 this.onRowDblClick(mouseEvent);
25021 break;
25022 case 'click':
25023 this.onRowClick(mouseEvent);
25024 break;
25025 case 'touchstart':
25026 case 'mousedown':
25027 this.onRowMouseDown(mouseEvent);
25028 break;
25029 }
25030 };
25031 RowCtrl.prototype.createRowEvent = function (type, domEvent) {
25032 return {
25033 type: type,
25034 node: this.rowNode,
25035 data: this.rowNode.data,
25036 rowIndex: this.rowNode.rowIndex,
25037 rowPinned: this.rowNode.rowPinned,
25038 context: this.beans.gridOptionsWrapper.getContext(),
25039 api: this.beans.gridOptionsWrapper.getApi(),
25040 columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
25041 event: domEvent
25042 };
25043 };
25044 RowCtrl.prototype.createRowEventWithSource = function (type, domEvent) {
25045 var event = this.createRowEvent(type, domEvent);
25046 // when first developing this, we included the rowComp in the event.
25047 // this seems very weird. so when introducing the event types, i left the 'source'
25048 // out of the type, and just include the source in the two places where this event
25049 // was fired (rowClicked and rowDoubleClicked). it doesn't make sense for any
25050 // users to be using this, as the rowComp isn't an object we expose, so would be
25051 // very surprising if a user was using it.
25052 event.source = this;
25053 return event;
25054 };
25055 RowCtrl.prototype.onRowDblClick = function (mouseEvent) {
25056 if (isStopPropagationForAgGrid(mouseEvent)) {
25057 return;
25058 }
25059 var agEvent = this.createRowEventWithSource(Events.EVENT_ROW_DOUBLE_CLICKED, mouseEvent);
25060 this.beans.eventService.dispatchEvent(agEvent);
25061 };
25062 RowCtrl.prototype.onRowMouseDown = function (mouseEvent) {
25063 this.lastMouseDownOnDragger = isElementChildOfClass(mouseEvent.target, 'ag-row-drag', 3);
25064 if (!this.isFullWidth()) {
25065 return;
25066 }
25067 var node = this.rowNode;
25068 var columnModel = this.beans.columnModel;
25069 this.beans.focusService.setFocusedCell(node.rowIndex, columnModel.getAllDisplayedColumns()[0], node.rowPinned, true);
25070 };
25071 RowCtrl.prototype.onRowClick = function (mouseEvent) {
25072 var stop = isStopPropagationForAgGrid(mouseEvent) || this.lastMouseDownOnDragger;
25073 if (stop) {
25074 return;
25075 }
25076 var agEvent = this.createRowEventWithSource(Events.EVENT_ROW_CLICKED, mouseEvent);
25077 this.beans.eventService.dispatchEvent(agEvent);
25078 // ctrlKey for windows, metaKey for Apple
25079 var multiSelectKeyPressed = mouseEvent.ctrlKey || mouseEvent.metaKey;
25080 var shiftKeyPressed = mouseEvent.shiftKey;
25081 // we do not allow selecting the group by clicking, when groupSelectChildren, as the logic to
25082 // handle this is broken. to observe, change the logic below and allow groups to be selected.
25083 // you will see the group gets selected, then all children get selected, then the grid unselects
25084 // the children (as the default behaviour when clicking is to unselect other rows) which results
25085 // in the group getting unselected (as all children are unselected). the correct thing would be
25086 // to change this, so that children of the selected group are not then subsequenly un-selected.
25087 var groupSelectsChildren = this.beans.gridOptionsWrapper.isGroupSelectsChildren();
25088 if (
25089 // we do not allow selecting groups by clicking (as the click here expands the group), or if it's a detail row,
25090 // so return if it's a group row
25091 (groupSelectsChildren && this.rowNode.group) ||
25092 // this is needed so we don't unselect other rows when we click this row, eg if this row is not selectable,
25093 // and we click it, the selection should not change (ie any currently selected row should stay selected)
25094 !this.rowNode.selectable ||
25095 // we also don't allow selection of pinned rows
25096 this.rowNode.rowPinned ||
25097 // if no selection method enabled, do nothing
25098 !this.beans.gridOptionsWrapper.isRowSelection() ||
25099 // if click selection suppressed, do nothing
25100 this.beans.gridOptionsWrapper.isSuppressRowClickSelection()) {
25101 return;
25102 }
25103 var multiSelectOnClick = this.beans.gridOptionsWrapper.isRowMultiSelectWithClick();
25104 var rowDeselectionWithCtrl = !this.beans.gridOptionsWrapper.isSuppressRowDeselection();
25105 if (this.rowNode.isSelected()) {
25106 if (multiSelectOnClick) {
25107 this.rowNode.setSelectedParams({ newValue: false });
25108 }
25109 else if (multiSelectKeyPressed) {
25110 if (rowDeselectionWithCtrl) {
25111 this.rowNode.setSelectedParams({ newValue: false });
25112 }
25113 }
25114 else {
25115 // selected with no multi key, must make sure anything else is unselected
25116 this.rowNode.setSelectedParams({ newValue: true, clearSelection: !shiftKeyPressed, rangeSelect: shiftKeyPressed });
25117 }
25118 }
25119 else {
25120 var clearSelection = multiSelectOnClick ? false : !multiSelectKeyPressed;
25121 this.rowNode.setSelectedParams({ newValue: true, clearSelection: clearSelection, rangeSelect: shiftKeyPressed });
25122 }
25123 };
25124 RowCtrl.prototype.setupDetailRowAutoHeight = function (eDetailGui) {
25125 var _this = this;
25126 if (this.rowType !== RowType.FullWidthDetail) {
25127 return;
25128 }
25129 if (!this.beans.gridOptionsWrapper.isDetailRowAutoHeight()) {
25130 return;
25131 }
25132 var checkRowSizeFunc = function () {
25133 var clientHeight = eDetailGui.clientHeight;
25134 // if the UI is not ready, the height can be 0, which we ignore, as otherwise a flicker will occur
25135 // as UI goes from the default height, to 0, then to the real height as UI becomes ready. this means
25136 // it's not possible for have 0 as auto-height, however this is an improbable use case, as even an
25137 // empty detail grid would still have some styling around it giving at least a few pixels.
25138 if (clientHeight != null && clientHeight > 0) {
25139 // we do the update in a timeout, to make sure we are not calling from inside the grid
25140 // doing another update
25141 var updateRowHeightFunc = function () {
25142 _this.rowNode.setRowHeight(clientHeight);
25143 if (_this.beans.clientSideRowModel) {
25144 _this.beans.clientSideRowModel.onRowHeightChanged();
25145 }
25146 else if (_this.beans.serverSideRowModel) {
25147 _this.beans.serverSideRowModel.onRowHeightChanged();
25148 }
25149 };
25150 _this.beans.frameworkOverrides.setTimeout(updateRowHeightFunc, 0);
25151 }
25152 };
25153 var resizeObserverDestroyFunc = this.beans.resizeObserverService.observeResize(eDetailGui, checkRowSizeFunc);
25154 this.addDestroyFunc(resizeObserverDestroyFunc);
25155 checkRowSizeFunc();
25156 };
25157 RowCtrl.prototype.createFullWidthParams = function (eRow, pinned) {
25158 var _this = this;
25159 var params = {
25160 fullWidth: true,
25161 data: this.rowNode.data,
25162 node: this.rowNode,
25163 value: this.rowNode.key,
25164 valueFormatted: this.rowNode.key,
25165 rowIndex: this.rowNode.rowIndex,
25166 api: this.beans.gridOptionsWrapper.getApi(),
25167 columnApi: this.beans.gridOptionsWrapper.getColumnApi(),
25168 context: this.beans.gridOptionsWrapper.getContext(),
25169 // these need to be taken out, as part of 'afterAttached' now
25170 eGridCell: eRow,
25171 eParentOfValue: eRow,
25172 pinned: pinned,
25173 addRenderedRowListener: this.addEventListener.bind(this),
25174 registerRowDragger: function (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) { return _this.addFullWidthRowDragging(rowDraggerElement, dragStartPixels, value, suppressVisibilityChange); }
25175 };
25176 return params;
25177 };
25178 RowCtrl.prototype.addFullWidthRowDragging = function (rowDraggerElement, dragStartPixels, value, suppressVisibilityChange) {
25179 if (value === void 0) { value = ''; }
25180 if (!this.isFullWidth()) {
25181 return;
25182 }
25183 var rowDragComp = new RowDragComp(function () { return value; }, this.rowNode, undefined, rowDraggerElement, dragStartPixels, suppressVisibilityChange);
25184 this.createManagedBean(rowDragComp, this.beans.context);
25185 };
25186 RowCtrl.prototype.onUiLevelChanged = function () {
25187 var newLevel = this.beans.rowCssClassCalculator.calculateRowLevel(this.rowNode);
25188 if (this.rowLevel != newLevel) {
25189 var classToAdd_1 = 'ag-row-level-' + newLevel;
25190 var classToRemove_1 = 'ag-row-level-' + this.rowLevel;
25191 this.allRowGuis.forEach(function (gui) {
25192 gui.rowComp.addOrRemoveCssClass(classToAdd_1, true);
25193 gui.rowComp.addOrRemoveCssClass(classToRemove_1, false);
25194 });
25195 }
25196 this.rowLevel = newLevel;
25197 };
25198 RowCtrl.prototype.isFirstRowOnPage = function () {
25199 return this.rowNode.rowIndex === this.beans.paginationProxy.getPageFirstRow();
25200 };
25201 RowCtrl.prototype.isLastRowOnPage = function () {
25202 return this.rowNode.rowIndex === this.beans.paginationProxy.getPageLastRow();
25203 };
25204 RowCtrl.prototype.onModelUpdated = function () {
25205 this.refreshFirstAndLastRowStyles();
25206 };
25207 RowCtrl.prototype.refreshFirstAndLastRowStyles = function () {
25208 var newFirst = this.isFirstRowOnPage();
25209 var newLast = this.isLastRowOnPage();
25210 if (this.firstRowOnPage !== newFirst) {
25211 this.firstRowOnPage = newFirst;
25212 this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-first', newFirst); });
25213 }
25214 if (this.lastRowOnPage !== newLast) {
25215 this.lastRowOnPage = newLast;
25216 this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-last', newLast); });
25217 }
25218 };
25219 RowCtrl.prototype.stopEditing = function (cancel) {
25220 if (cancel === void 0) { cancel = false; }
25221 var cellEdits = this.getAllCellCtrls().map(function (cellCtrl) { return cellCtrl.stopEditing(cancel); });
25222 if (!this.editingRow) {
25223 return;
25224 }
25225 if (!cancel && cellEdits.some(function (edit) { return edit; })) {
25226 var event_1 = this.createRowEvent(Events.EVENT_ROW_VALUE_CHANGED);
25227 this.beans.eventService.dispatchEvent(event_1);
25228 }
25229 this.setEditingRow(false);
25230 };
25231 RowCtrl.prototype.setInlineEditingCss = function (editing) {
25232 this.allRowGuis.forEach(function (gui) {
25233 gui.rowComp.addOrRemoveCssClass("ag-row-inline-editing", editing);
25234 gui.rowComp.addOrRemoveCssClass("ag-row-not-inline-editing", !editing);
25235 });
25236 };
25237 RowCtrl.prototype.setEditingRow = function (value) {
25238 this.editingRow = value;
25239 this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-row-editing', value); });
25240 var event = value ?
25241 this.createRowEvent(Events.EVENT_ROW_EDITING_STARTED)
25242 : this.createRowEvent(Events.EVENT_ROW_EDITING_STOPPED);
25243 this.beans.eventService.dispatchEvent(event);
25244 };
25245 RowCtrl.prototype.startRowEditing = function (key, charPress, sourceRenderedCell, event) {
25246 if (key === void 0) { key = null; }
25247 if (charPress === void 0) { charPress = null; }
25248 if (sourceRenderedCell === void 0) { sourceRenderedCell = null; }
25249 if (event === void 0) { event = null; }
25250 // don't do it if already editing
25251 if (this.editingRow) {
25252 return;
25253 }
25254 this.getAllCellCtrls().forEach(function (cellCtrl) {
25255 var cellStartedEdit = cellCtrl === sourceRenderedCell;
25256 if (cellStartedEdit) {
25257 cellCtrl.startEditing(key, charPress, cellStartedEdit, event);
25258 }
25259 else {
25260 cellCtrl.startEditing(null, null, cellStartedEdit, event);
25261 }
25262 });
25263 this.setEditingRow(true);
25264 };
25265 RowCtrl.prototype.getAllCellCtrls = function () {
25266 var res = __spread$6(this.centerCellCtrls.list, this.leftCellCtrls.list, this.rightCellCtrls.list);
25267 return res;
25268 };
25269 RowCtrl.prototype.postProcessClassesFromGridOptions = function () {
25270 var _this = this;
25271 var cssClasses = this.beans.rowCssClassCalculator.processClassesFromGridOptions(this.rowNode);
25272 if (!cssClasses || !cssClasses.length) {
25273 return;
25274 }
25275 cssClasses.forEach(function (classStr) {
25276 _this.allRowGuis.forEach(function (c) { return c.rowComp.addOrRemoveCssClass(classStr, true); });
25277 });
25278 };
25279 RowCtrl.prototype.postProcessRowClassRules = function () {
25280 var _this = this;
25281 this.beans.rowCssClassCalculator.processRowClassRules(this.rowNode, function (className) {
25282 _this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass(className, true); });
25283 }, function (className) {
25284 _this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass(className, false); });
25285 });
25286 };
25287 RowCtrl.prototype.setStylesFromGridOptions = function () {
25288 var rowStyles = this.processStylesFromGridOptions();
25289 this.allRowGuis.forEach(function (gui) { return gui.rowComp.setUserStyles(rowStyles); });
25290 };
25291 RowCtrl.prototype.getRowBusinessKey = function () {
25292 var businessKeyForNodeFunc = this.beans.gridOptionsWrapper.getBusinessKeyForNodeFunc();
25293 if (typeof businessKeyForNodeFunc !== 'function') {
25294 return;
25295 }
25296 return businessKeyForNodeFunc(this.rowNode);
25297 };
25298 RowCtrl.prototype.getPinnedForContainer = function (rowContainerType) {
25299 var pinned = rowContainerType === exports.RowContainerType.LEFT ? Constants.PINNED_LEFT :
25300 rowContainerType === exports.RowContainerType.RIGHT ? Constants.PINNED_RIGHT : null;
25301 return pinned;
25302 };
25303 RowCtrl.prototype.getInitialRowClasses = function (rowContainerType) {
25304 var pinned = this.getPinnedForContainer(rowContainerType);
25305 var params = {
25306 rowNode: this.rowNode,
25307 rowFocused: this.rowFocused,
25308 fadeRowIn: this.fadeRowIn,
25309 rowIsEven: this.rowNode.rowIndex % 2 === 0,
25310 rowLevel: this.rowLevel,
25311 fullWidthRow: this.isFullWidth(),
25312 firstRowOnPage: this.isFirstRowOnPage(),
25313 lastRowOnPage: this.isLastRowOnPage(),
25314 printLayout: this.printLayout,
25315 expandable: this.rowNode.isExpandable(),
25316 pinned: pinned
25317 };
25318 return this.beans.rowCssClassCalculator.getInitialRowClasses(params);
25319 };
25320 RowCtrl.prototype.processStylesFromGridOptions = function () {
25321 // part 1 - rowStyle
25322 var rowStyle = this.beans.gridOptionsWrapper.getRowStyle();
25323 if (rowStyle && typeof rowStyle === 'function') {
25324 console.warn('AG Grid: rowStyle should be an object of key/value styles, not be a function, use getRowStyle() instead');
25325 return;
25326 }
25327 // part 1 - rowStyleFunc
25328 var rowStyleFunc = this.beans.gridOptionsWrapper.getRowStyleFunc();
25329 var rowStyleFuncResult;
25330 if (rowStyleFunc) {
25331 var params = {
25332 data: this.rowNode.data,
25333 node: this.rowNode,
25334 rowIndex: this.rowNode.rowIndex
25335 };
25336 rowStyleFuncResult = rowStyleFunc(params);
25337 }
25338 return Object.assign({}, rowStyle, rowStyleFuncResult);
25339 };
25340 RowCtrl.prototype.onRowSelected = function () {
25341 var _this = this;
25342 // Treat undefined as false, if we pass undefined down it gets treated as toggle class, rather than explicitly
25343 // setting the required value
25344 var selected = !!this.rowNode.isSelected();
25345 this.allRowGuis.forEach(function (gui) {
25346 gui.rowComp.addOrRemoveCssClass('ag-row-selected', selected);
25347 setAriaSelected(gui.element, selected ? true : undefined);
25348 var ariaLabel = _this.createAriaLabel();
25349 setAriaLabel(gui.element, ariaLabel == null ? '' : ariaLabel);
25350 });
25351 };
25352 RowCtrl.prototype.createAriaLabel = function () {
25353 var selected = this.rowNode.isSelected();
25354 if (selected && this.beans.gridOptionsWrapper.isSuppressRowDeselection()) {
25355 return undefined;
25356 }
25357 var translate = this.beans.gridOptionsWrapper.getLocaleTextFunc();
25358 var label = translate(selected ? 'ariaRowDeselect' : 'ariaRowSelect', "Press SPACE to " + (selected ? 'deselect' : 'select') + " this row.");
25359 return label;
25360 };
25361 RowCtrl.prototype.isUseAnimationFrameForCreate = function () {
25362 return this.useAnimationFrameForCreate;
25363 };
25364 RowCtrl.prototype.addHoverFunctionality = function (eRow) {
25365 var _this = this;
25366 // because we use animation frames to do this, it's possible the row no longer exists
25367 // by the time we get to add it
25368 if (!this.active) {
25369 return;
25370 }
25371 // because mouseenter and mouseleave do not propagate, we cannot listen on the gridPanel
25372 // like we do for all the other mouse events.
25373 // because of the pinning, we cannot simply add / remove the class based on the eRow. we
25374 // have to check all eRow's (body & pinned). so the trick is if any of the rows gets a
25375 // mouse hover, it sets such in the rowNode, and then all three reflect the change as
25376 // all are listening for event on the row node.
25377 // step 1 - add listener, to set flag on row node
25378 this.addManagedListener(eRow, 'mouseenter', function () { return _this.rowNode.onMouseEnter(); });
25379 this.addManagedListener(eRow, 'mouseleave', function () { return _this.rowNode.onMouseLeave(); });
25380 // step 2 - listen for changes on row node (which any eRow can trigger)
25381 this.addManagedListener(this.rowNode, RowNode.EVENT_MOUSE_ENTER, function () {
25382 // if hover turned off, we don't add the class. we do this here so that if the application
25383 // toggles this property mid way, we remove the hover form the last row, but we stop
25384 // adding hovers from that point onwards.
25385 if (!_this.beans.gridOptionsWrapper.isSuppressRowHoverHighlight()) {
25386 eRow.classList.add('ag-row-hover');
25387 }
25388 });
25389 this.addManagedListener(this.rowNode, RowNode.EVENT_MOUSE_LEAVE, function () {
25390 eRow.classList.remove('ag-row-hover');
25391 });
25392 };
25393 // for animation, we don't want to animate entry or exit to a very far away pixel,
25394 // otherwise the row would move so fast, it would appear to disappear. so this method
25395 // moves the row closer to the viewport if it is far away, so the row slide in / out
25396 // at a speed the user can see.
25397 RowCtrl.prototype.roundRowTopToBounds = function (rowTop) {
25398 var gridBodyCon = this.beans.ctrlsService.getGridBodyCtrl();
25399 var range = gridBodyCon.getScrollFeature().getVScrollPosition();
25400 var minPixel = this.applyPaginationOffset(range.top, true) - 100;
25401 var maxPixel = this.applyPaginationOffset(range.bottom, true) + 100;
25402 return Math.min(Math.max(minPixel, rowTop), maxPixel);
25403 };
25404 RowCtrl.prototype.getFrameworkOverrides = function () {
25405 return this.beans.frameworkOverrides;
25406 };
25407 RowCtrl.prototype.onRowHeightChanged = function () {
25408 // check for exists first - if the user is resetting the row height, then
25409 // it will be null (or undefined) momentarily until the next time the flatten
25410 // stage is called where the row will then update again with a new height
25411 if (this.rowNode.rowHeight == null) {
25412 return;
25413 }
25414 var rowHeight = this.rowNode.rowHeight;
25415 var defaultRowHeight = this.beans.gridOptionsWrapper.getDefaultRowHeight();
25416 var isHeightFromFunc = this.beans.gridOptionsWrapper.isGetRowHeightFunction();
25417 var heightFromFunc = isHeightFromFunc ? this.beans.gridOptionsWrapper.getRowHeightForNode(this.rowNode).height : undefined;
25418 var lineHeight = heightFromFunc ? Math.min(defaultRowHeight, heightFromFunc) - 2 + "px" : undefined;
25419 this.allRowGuis.forEach(function (gui) {
25420 gui.element.style.height = rowHeight + "px";
25421 // If the row height is coming from a function, this means some rows can
25422 // be smaller than the theme had intended. so we set --ag-line-height on
25423 // the row, which is picked up by the theme CSS and is used in a calc
25424 // for the CSS line-height property, which makes sure the line-height is
25425 // not bigger than the row height, otherwise the row text would not fit.
25426 // We do not use rowNode.rowHeight here, as this could be the result of autoHeight,
25427 // and we found using the autoHeight result causes a loop, where changing the
25428 // line-height them impacts the cell height, resulting in a new autoHeight,
25429 // resulting in a new line-height and so on loop.
25430 // const heightFromFunc = this.beans.gridOptionsWrapper.getRowHeightForNode(this.rowNode).height;
25431 if (lineHeight) {
25432 gui.element.style.setProperty('--ag-line-height', lineHeight);
25433 }
25434 });
25435 };
25436 RowCtrl.prototype.addEventListener = function (eventType, listener) {
25437 if (eventType === 'renderedRowRemoved' || eventType === 'rowRemoved') {
25438 eventType = Events.EVENT_VIRTUAL_ROW_REMOVED;
25439 console.warn('AG Grid: Since version 11, event renderedRowRemoved is now called ' + Events.EVENT_VIRTUAL_ROW_REMOVED);
25440 }
25441 _super.prototype.addEventListener.call(this, eventType, listener);
25442 };
25443 RowCtrl.prototype.removeEventListener = function (eventType, listener) {
25444 if (eventType === 'renderedRowRemoved' || eventType === 'rowRemoved') {
25445 eventType = Events.EVENT_VIRTUAL_ROW_REMOVED;
25446 console.warn('AG Grid: Since version 11, event renderedRowRemoved and rowRemoved is now called ' + Events.EVENT_VIRTUAL_ROW_REMOVED);
25447 }
25448 _super.prototype.removeEventListener.call(this, eventType, listener);
25449 };
25450 // note - this is NOT called by context, as we don't wire / unwire the CellComp for performance reasons.
25451 RowCtrl.prototype.destroyFirstPass = function () {
25452 this.active = false;
25453 // why do we have this method? shouldn't everything below be added as a destroy func beside
25454 // the corresponding create logic?
25455 this.setupRemoveAnimation();
25456 var event = this.createRowEvent(Events.EVENT_VIRTUAL_ROW_REMOVED);
25457 this.dispatchEvent(event);
25458 this.beans.eventService.dispatchEvent(event);
25459 _super.prototype.destroy.call(this);
25460 };
25461 RowCtrl.prototype.setupRemoveAnimation = function () {
25462 var rowStillVisibleJustNotInViewport = this.rowNode.rowTop != null;
25463 if (rowStillVisibleJustNotInViewport) {
25464 // if the row is not rendered, but in viewport, it means it has moved,
25465 // so we animate the row out. if the new location is very far away,
25466 // the animation will be so fast the row will look like it's just disappeared,
25467 // so instead we animate to a position just outside the viewport.
25468 var rowTop = this.roundRowTopToBounds(this.rowNode.rowTop);
25469 this.setRowTop(rowTop);
25470 }
25471 else {
25472 this.allRowGuis.forEach(function (gui) { return gui.rowComp.addOrRemoveCssClass('ag-opacity-zero', true); });
25473 }
25474 };
25475 RowCtrl.prototype.destroySecondPass = function () {
25476 this.allRowGuis.length = 0;
25477 var destroyCellCtrls = function (ctrls) {
25478 ctrls.list.forEach(function (c) { return c.destroy(); });
25479 return { list: [], map: {} };
25480 };
25481 this.centerCellCtrls = destroyCellCtrls(this.centerCellCtrls);
25482 this.leftCellCtrls = destroyCellCtrls(this.leftCellCtrls);
25483 this.rightCellCtrls = destroyCellCtrls(this.rightCellCtrls);
25484 };
25485 RowCtrl.prototype.setFocusedClasses = function () {
25486 var _this = this;
25487 this.allRowGuis.forEach(function (gui) {
25488 gui.rowComp.addOrRemoveCssClass('ag-row-focus', _this.rowFocused);
25489 gui.rowComp.addOrRemoveCssClass('ag-row-no-focus', !_this.rowFocused);
25490 });
25491 };
25492 RowCtrl.prototype.onCellFocusChanged = function () {
25493 var rowFocused = this.beans.focusService.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned);
25494 if (rowFocused !== this.rowFocused) {
25495 this.rowFocused = rowFocused;
25496 this.setFocusedClasses();
25497 }
25498 // if we are editing, then moving the focus out of a row will stop editing
25499 if (!rowFocused && this.editingRow) {
25500 this.stopEditing(false);
25501 }
25502 };
25503 RowCtrl.prototype.onPaginationChanged = function () {
25504 var currentPage = this.beans.paginationProxy.getCurrentPage();
25505 // it is possible this row is in the new page, but the page number has changed, which means
25506 // it needs to reposition itself relative to the new page
25507 if (this.paginationPage !== currentPage) {
25508 this.paginationPage = currentPage;
25509 this.onTopChanged();
25510 }
25511 this.refreshFirstAndLastRowStyles();
25512 };
25513 RowCtrl.prototype.onTopChanged = function () {
25514 this.setRowTop(this.rowNode.rowTop);
25515 };
25516 RowCtrl.prototype.onPaginationPixelOffsetChanged = function () {
25517 // the pixel offset is used when calculating rowTop to set on the row DIV
25518 this.onTopChanged();
25519 };
25520 // applies pagination offset, eg if on second page, and page height is 500px, then removes
25521 // 500px from the top position, so a row with rowTop 600px is displayed at location 100px.
25522 // reverse will take the offset away rather than add.
25523 RowCtrl.prototype.applyPaginationOffset = function (topPx, reverse) {
25524 if (reverse === void 0) { reverse = false; }
25525 if (this.rowNode.isRowPinned()) {
25526 return topPx;
25527 }
25528 var pixelOffset = this.beans.paginationProxy.getPixelOffset();
25529 var multiplier = reverse ? 1 : -1;
25530 return topPx + (pixelOffset * multiplier);
25531 };
25532 RowCtrl.prototype.setRowTop = function (pixels) {
25533 // print layout uses normal flow layout for row positioning
25534 if (this.printLayout) {
25535 return;
25536 }
25537 // need to make sure rowTop is not null, as this can happen if the node was once
25538 // visible (ie parent group was expanded) but is now not visible
25539 if (exists(pixels)) {
25540 var afterPaginationPixels = this.applyPaginationOffset(pixels);
25541 var afterScalingPixels = this.rowNode.isRowPinned() ? afterPaginationPixels : this.beans.rowContainerHeightService.getRealPixelPosition(afterPaginationPixels);
25542 var topPx = afterScalingPixels + "px";
25543 this.setRowTopStyle(topPx);
25544 }
25545 };
25546 RowCtrl.prototype.getInitialRowTop = function () {
25547 return this.initialTop;
25548 };
25549 RowCtrl.prototype.getInitialTransform = function () {
25550 return this.initialTransform;
25551 };
25552 RowCtrl.prototype.setInitialRowTop = function () {
25553 // print layout uses normal flow layout for row positioning
25554 if (this.printLayout) {
25555 return '';
25556 }
25557 // if sliding in, we take the old row top. otherwise we just set the current row top.
25558 var pixels = this.slideRowIn ? this.roundRowTopToBounds(this.rowNode.oldRowTop) : this.rowNode.rowTop;
25559 var afterPaginationPixels = this.applyPaginationOffset(pixels);
25560 // we don't apply scaling if row is pinned
25561 var afterScalingPixels = this.rowNode.isRowPinned() ? afterPaginationPixels : this.beans.rowContainerHeightService.getRealPixelPosition(afterPaginationPixels);
25562 var res = afterScalingPixels + 'px';
25563 var suppressRowTransform = this.beans.gridOptionsWrapper.isSuppressRowTransform();
25564 if (suppressRowTransform) {
25565 this.initialTop = res;
25566 }
25567 else {
25568 this.initialTransform = "translateY(" + res + ")";
25569 }
25570 };
25571 RowCtrl.prototype.setRowTopStyle = function (topPx) {
25572 var suppressRowTransform = this.beans.gridOptionsWrapper.isSuppressRowTransform();
25573 this.allRowGuis.forEach(function (gui) { return suppressRowTransform ?
25574 gui.rowComp.setTop(topPx) :
25575 gui.rowComp.setTransform("translateY(" + topPx + ")"); });
25576 };
25577 RowCtrl.prototype.getRowNode = function () {
25578 return this.rowNode;
25579 };
25580 RowCtrl.prototype.getCellCtrl = function (column) {
25581 // first up, check for cell directly linked to this column
25582 var res = null;
25583 this.getAllCellCtrls().forEach(function (cellCtrl) {
25584 if (cellCtrl.getColumn() == column) {
25585 res = cellCtrl;
25586 }
25587 });
25588 if (res != null) {
25589 return res;
25590 }
25591 // second up, if not found, then check for spanned cols.
25592 // we do this second (and not at the same time) as this is
25593 // more expensive, as spanning cols is a
25594 // infrequently used feature so we don't need to do this most
25595 // of the time
25596 this.getAllCellCtrls().forEach(function (cellCtrl) {
25597 if (cellCtrl.getColSpanningList().indexOf(column) >= 0) {
25598 res = cellCtrl;
25599 }
25600 });
25601 return res;
25602 };
25603 RowCtrl.prototype.onRowIndexChanged = function () {
25604 // we only bother updating if the rowIndex is present. if it is not present, it means this row
25605 // is child of a group node, and the group node was closed, it's the only way to have no row index.
25606 // when this happens, row is about to be de-rendered, so we don't care, rowComp is about to die!
25607 if (this.rowNode.rowIndex != null) {
25608 this.onCellFocusChanged();
25609 this.updateRowIndexes();
25610 this.postProcessCss();
25611 }
25612 };
25613 RowCtrl.prototype.updateRowIndexes = function () {
25614 var rowIndexStr = this.rowNode.getRowIndexString();
25615 var headerRowCount = this.beans.headerNavigationService.getHeaderRowCount();
25616 var rowIsEven = this.rowNode.rowIndex % 2 === 0;
25617 var ariaRowIndex = headerRowCount + this.rowNode.rowIndex + 1;
25618 this.allRowGuis.forEach(function (c) {
25619 c.rowComp.setRowIndex(rowIndexStr);
25620 c.rowComp.addOrRemoveCssClass('ag-row-even', rowIsEven);
25621 c.rowComp.addOrRemoveCssClass('ag-row-odd', !rowIsEven);
25622 setAriaRowIndex(c.element, ariaRowIndex);
25623 });
25624 };
25625 // returns the pinned left container, either the normal one, or the embedded full with one if exists
25626 RowCtrl.prototype.getPinnedLeftRowElement = function () {
25627 return this.leftGui ? this.leftGui.element : undefined;
25628 };
25629 // returns the pinned right container, either the normal one, or the embedded full with one if exists
25630 RowCtrl.prototype.getPinnedRightRowElement = function () {
25631 return this.rightGui ? this.rightGui.element : undefined;
25632 };
25633 // returns the body container, either the normal one, or the embedded full with one if exists
25634 RowCtrl.prototype.getBodyRowElement = function () {
25635 return this.centerGui ? this.centerGui.element : undefined;
25636 };
25637 // returns the full width container
25638 RowCtrl.prototype.getFullWidthRowElement = function () {
25639 return this.fullWidthGui ? this.fullWidthGui.element : undefined;
25640 };
25641 RowCtrl.DOM_DATA_KEY_ROW_CTRL = 'renderedRow';
25642 return RowCtrl;
25643}(BeanStub));
25644
25645/**
25646 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
25647 * @version v27.3.0
25648 * @link https://www.ag-grid.com/
25649 * @license MIT
25650 */
25651var __extends$10 = (undefined && undefined.__extends) || (function () {
25652 var extendStatics = function (d, b) {
25653 extendStatics = Object.setPrototypeOf ||
25654 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25655 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
25656 return extendStatics(d, b);
25657 };
25658 return function (d, b) {
25659 extendStatics(d, b);
25660 function __() { this.constructor = d; }
25661 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
25662 };
25663})();
25664var __decorate$P = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
25665 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
25666 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
25667 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;
25668 return c > 3 && r && Object.defineProperty(target, key, r), r;
25669};
25670var __read$9 = (undefined && undefined.__read) || function (o, n) {
25671 var m = typeof Symbol === "function" && o[Symbol.iterator];
25672 if (!m) return o;
25673 var i = m.call(o), r, ar = [], e;
25674 try {
25675 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
25676 }
25677 catch (error) { e = { error: error }; }
25678 finally {
25679 try {
25680 if (r && !r.done && (m = i["return"])) m.call(i);
25681 }
25682 finally { if (e) throw e.error; }
25683 }
25684 return ar;
25685};
25686var RowContainerEventsFeature = /** @class */ (function (_super) {
25687 __extends$10(RowContainerEventsFeature, _super);
25688 function RowContainerEventsFeature(element) {
25689 var _this = _super.call(this) || this;
25690 _this.element = element;
25691 return _this;
25692 }
25693 RowContainerEventsFeature.prototype.postConstruct = function () {
25694 this.addMouseListeners();
25695 this.mockContextMenuForIPad();
25696 this.addKeyboardEvents();
25697 };
25698 RowContainerEventsFeature.prototype.addKeyboardEvents = function () {
25699 var _this = this;
25700 var eventNames = ['keydown', 'keypress'];
25701 eventNames.forEach(function (eventName) {
25702 var listener = _this.processKeyboardEvent.bind(_this, eventName);
25703 _this.addManagedListener(_this.element, eventName, listener);
25704 });
25705 };
25706 RowContainerEventsFeature.prototype.addMouseListeners = function () {
25707 var _this = this;
25708 var mouseDownEvent = isEventSupported('touchstart') ? 'touchstart' : 'mousedown';
25709 var eventNames = ['dblclick', 'contextmenu', 'mouseover', 'mouseout', 'click', mouseDownEvent];
25710 eventNames.forEach(function (eventName) {
25711 var listener = _this.processMouseEvent.bind(_this, eventName);
25712 _this.addManagedListener(_this.element, eventName, listener);
25713 });
25714 };
25715 RowContainerEventsFeature.prototype.processMouseEvent = function (eventName, mouseEvent) {
25716 if (!this.mouseEventService.isEventFromThisGrid(mouseEvent) ||
25717 isStopPropagationForAgGrid(mouseEvent)) {
25718 return;
25719 }
25720 var rowComp = this.getRowForEvent(mouseEvent);
25721 var cellCtrl = this.mouseEventService.getRenderedCellForEvent(mouseEvent);
25722 if (eventName === "contextmenu") {
25723 this.handleContextMenuMouseEvent(mouseEvent, null, rowComp, cellCtrl);
25724 }
25725 else {
25726 if (cellCtrl) {
25727 cellCtrl.onMouseEvent(eventName, mouseEvent);
25728 }
25729 if (rowComp) {
25730 rowComp.onMouseEvent(eventName, mouseEvent);
25731 }
25732 }
25733 };
25734 RowContainerEventsFeature.prototype.mockContextMenuForIPad = function () {
25735 var _this = this;
25736 // we do NOT want this when not in iPad, otherwise we will be doing
25737 if (!isIOSUserAgent()) {
25738 return;
25739 }
25740 var touchListener = new TouchListener(this.element);
25741 var longTapListener = function (event) {
25742 var rowComp = _this.getRowForEvent(event.touchEvent);
25743 var cellComp = _this.mouseEventService.getRenderedCellForEvent(event.touchEvent);
25744 _this.handleContextMenuMouseEvent(null, event.touchEvent, rowComp, cellComp);
25745 };
25746 this.addManagedListener(touchListener, TouchListener.EVENT_LONG_TAP, longTapListener);
25747 this.addDestroyFunc(function () { return touchListener.destroy(); });
25748 };
25749 RowContainerEventsFeature.prototype.getRowForEvent = function (event) {
25750 var sourceElement = event.target;
25751 while (sourceElement) {
25752 var rowCon = this.gridOptionsWrapper.getDomData(sourceElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL);
25753 if (rowCon) {
25754 return rowCon;
25755 }
25756 sourceElement = sourceElement.parentElement;
25757 }
25758 return null;
25759 };
25760 RowContainerEventsFeature.prototype.handleContextMenuMouseEvent = function (mouseEvent, touchEvent, rowComp, cellCtrl) {
25761 var rowNode = rowComp ? rowComp.getRowNode() : null;
25762 var column = cellCtrl ? cellCtrl.getColumn() : null;
25763 var value = null;
25764 if (column) {
25765 var event_1 = mouseEvent ? mouseEvent : touchEvent;
25766 cellCtrl.dispatchCellContextMenuEvent(event_1);
25767 value = this.valueService.getValue(column, rowNode);
25768 }
25769 // if user clicked on a cell, anchor to that cell, otherwise anchor to the grid panel
25770 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
25771 var anchorToElement = cellCtrl ? cellCtrl.getGui() : gridBodyCon.getGridBodyElement();
25772 if (this.contextMenuFactory) {
25773 this.contextMenuFactory.onContextMenu(mouseEvent, touchEvent, rowNode, column, value, anchorToElement);
25774 }
25775 };
25776 RowContainerEventsFeature.prototype.processKeyboardEvent = function (eventName, keyboardEvent) {
25777 var cellComp = getCtrlForEvent(this.gridOptionsWrapper, keyboardEvent, CellCtrl.DOM_DATA_KEY_CELL_CTRL);
25778 var rowComp = getCtrlForEvent(this.gridOptionsWrapper, keyboardEvent, RowCtrl.DOM_DATA_KEY_ROW_CTRL);
25779 if (keyboardEvent.defaultPrevented) {
25780 return;
25781 }
25782 if (cellComp) {
25783 this.processCellKeyboardEvent(cellComp, eventName, keyboardEvent);
25784 }
25785 else if (rowComp && rowComp.isFullWidth()) {
25786 this.processFullWidthRowKeyboardEvent(rowComp, eventName, keyboardEvent);
25787 }
25788 };
25789 RowContainerEventsFeature.prototype.processCellKeyboardEvent = function (cellCtrl, eventName, keyboardEvent) {
25790 var rowNode = cellCtrl.getRowNode();
25791 var column = cellCtrl.getColumn();
25792 var editing = cellCtrl.isEditing();
25793 var gridProcessingAllowed = !isUserSuppressingKeyboardEvent(this.gridOptionsWrapper, keyboardEvent, rowNode, column, editing);
25794 if (gridProcessingAllowed) {
25795 switch (eventName) {
25796 case 'keydown':
25797 // first see if it's a scroll key, page up / down, home / end etc
25798 var wasScrollKey = !editing && this.navigationService.handlePageScrollingKey(keyboardEvent);
25799 // if not a scroll key, then we pass onto cell
25800 if (!wasScrollKey) {
25801 cellCtrl.onKeyDown(keyboardEvent);
25802 }
25803 // perform clipboard and undo / redo operations
25804 this.doGridOperations(keyboardEvent, cellCtrl.isEditing());
25805 break;
25806 case 'keypress':
25807 cellCtrl.onKeyPress(keyboardEvent);
25808 break;
25809 }
25810 }
25811 if (eventName === 'keydown') {
25812 var cellKeyDownEvent = cellCtrl.createEvent(keyboardEvent, Events.EVENT_CELL_KEY_DOWN);
25813 this.eventService.dispatchEvent(cellKeyDownEvent);
25814 }
25815 if (eventName === 'keypress') {
25816 var cellKeyPressEvent = cellCtrl.createEvent(keyboardEvent, Events.EVENT_CELL_KEY_PRESS);
25817 this.eventService.dispatchEvent(cellKeyPressEvent);
25818 }
25819 };
25820 RowContainerEventsFeature.prototype.processFullWidthRowKeyboardEvent = function (rowComp, eventName, keyboardEvent) {
25821 var rowNode = rowComp.getRowNode();
25822 var focusedCell = this.focusService.getFocusedCell();
25823 var column = (focusedCell && focusedCell.column);
25824 var gridProcessingAllowed = !isUserSuppressingKeyboardEvent(this.gridOptionsWrapper, keyboardEvent, rowNode, column, false);
25825 if (gridProcessingAllowed) {
25826 var key = keyboardEvent.key;
25827 if (eventName === 'keydown') {
25828 switch (key) {
25829 case KeyCode.UP:
25830 case KeyCode.DOWN:
25831 rowComp.onKeyboardNavigate(keyboardEvent);
25832 break;
25833 case KeyCode.TAB:
25834 rowComp.onTabKeyDown(keyboardEvent);
25835 default:
25836 }
25837 }
25838 }
25839 if (eventName === 'keydown') {
25840 var cellKeyDownEvent = rowComp.createRowEvent(Events.EVENT_CELL_KEY_DOWN, keyboardEvent);
25841 this.eventService.dispatchEvent(cellKeyDownEvent);
25842 }
25843 if (eventName === 'keypress') {
25844 var cellKeyPressEvent = rowComp.createRowEvent(Events.EVENT_CELL_KEY_PRESS, keyboardEvent);
25845 this.eventService.dispatchEvent(cellKeyPressEvent);
25846 }
25847 };
25848 RowContainerEventsFeature.prototype.doGridOperations = function (keyboardEvent, editing) {
25849 // check if ctrl or meta key pressed
25850 if (!keyboardEvent.ctrlKey && !keyboardEvent.metaKey) {
25851 return;
25852 }
25853 // if the cell the event came from is editing, then we do not
25854 // want to do the default shortcut keys, otherwise the editor
25855 // (eg a text field) would not be able to do the normal cut/copy/paste
25856 if (editing) {
25857 return;
25858 }
25859 // for copy / paste, we don't want to execute when the event
25860 // was from a child grid (happens in master detail)
25861 if (!this.mouseEventService.isEventFromThisGrid(keyboardEvent)) {
25862 return;
25863 }
25864 switch (keyboardEvent.code) {
25865 case KeyCode.A:
25866 return this.onCtrlAndA(keyboardEvent);
25867 case KeyCode.C:
25868 return this.onCtrlAndC(keyboardEvent);
25869 case KeyCode.V:
25870 return this.onCtrlAndV();
25871 case KeyCode.D:
25872 return this.onCtrlAndD(keyboardEvent);
25873 case KeyCode.Z:
25874 return keyboardEvent.shiftKey ? this.undoRedoService.redo() : this.undoRedoService.undo();
25875 case KeyCode.Y:
25876 return this.undoRedoService.redo();
25877 }
25878 };
25879 RowContainerEventsFeature.prototype.onCtrlAndA = function (event) {
25880 var _a = this, pinnedRowModel = _a.pinnedRowModel, paginationProxy = _a.paginationProxy, rangeService = _a.rangeService;
25881 var PINNED_BOTTOM = Constants.PINNED_BOTTOM, PINNED_TOP = Constants.PINNED_TOP;
25882 if (rangeService && paginationProxy.isRowsToRender()) {
25883 var _b = __read$9([
25884 pinnedRowModel.isEmpty(PINNED_TOP),
25885 pinnedRowModel.isEmpty(PINNED_BOTTOM)
25886 ], 2), isEmptyPinnedTop = _b[0], isEmptyPinnedBottom = _b[1];
25887 var floatingStart = isEmptyPinnedTop ? null : PINNED_TOP;
25888 var floatingEnd = void 0;
25889 var rowEnd = void 0;
25890 if (isEmptyPinnedBottom) {
25891 floatingEnd = null;
25892 rowEnd = this.paginationProxy.getRowCount() - 1;
25893 }
25894 else {
25895 floatingEnd = PINNED_BOTTOM;
25896 rowEnd = pinnedRowModel.getPinnedBottomRowData().length - 1;
25897 }
25898 var allDisplayedColumns = this.columnModel.getAllDisplayedColumns();
25899 if (missingOrEmpty(allDisplayedColumns)) {
25900 return;
25901 }
25902 rangeService.setCellRange({
25903 rowStartIndex: 0,
25904 rowStartPinned: floatingStart,
25905 rowEndIndex: rowEnd,
25906 rowEndPinned: floatingEnd,
25907 columnStart: allDisplayedColumns[0],
25908 columnEnd: last(allDisplayedColumns)
25909 });
25910 }
25911 event.preventDefault();
25912 };
25913 RowContainerEventsFeature.prototype.onCtrlAndC = function (event) {
25914 if (!this.clipboardService || this.gridOptionsWrapper.isEnableCellTextSelection()) {
25915 return;
25916 }
25917 this.clipboardService.copyToClipboard();
25918 event.preventDefault();
25919 };
25920 RowContainerEventsFeature.prototype.onCtrlAndV = function () {
25921 if (ModuleRegistry.isRegistered(exports.ModuleNames.ClipboardModule) && !this.gridOptionsWrapper.isSuppressClipboardPaste()) {
25922 this.clipboardService.pasteFromClipboard();
25923 }
25924 };
25925 RowContainerEventsFeature.prototype.onCtrlAndD = function (event) {
25926 if (ModuleRegistry.isRegistered(exports.ModuleNames.ClipboardModule) && !this.gridOptionsWrapper.isSuppressClipboardPaste()) {
25927 this.clipboardService.copyRangeDown();
25928 }
25929 event.preventDefault();
25930 };
25931 __decorate$P([
25932 Autowired('mouseEventService')
25933 ], RowContainerEventsFeature.prototype, "mouseEventService", void 0);
25934 __decorate$P([
25935 Autowired('valueService')
25936 ], RowContainerEventsFeature.prototype, "valueService", void 0);
25937 __decorate$P([
25938 Optional('contextMenuFactory')
25939 ], RowContainerEventsFeature.prototype, "contextMenuFactory", void 0);
25940 __decorate$P([
25941 Autowired('ctrlsService')
25942 ], RowContainerEventsFeature.prototype, "ctrlsService", void 0);
25943 __decorate$P([
25944 Autowired('navigationService')
25945 ], RowContainerEventsFeature.prototype, "navigationService", void 0);
25946 __decorate$P([
25947 Autowired('focusService')
25948 ], RowContainerEventsFeature.prototype, "focusService", void 0);
25949 __decorate$P([
25950 Autowired('undoRedoService')
25951 ], RowContainerEventsFeature.prototype, "undoRedoService", void 0);
25952 __decorate$P([
25953 Autowired('columnModel')
25954 ], RowContainerEventsFeature.prototype, "columnModel", void 0);
25955 __decorate$P([
25956 Autowired('paginationProxy')
25957 ], RowContainerEventsFeature.prototype, "paginationProxy", void 0);
25958 __decorate$P([
25959 Autowired('pinnedRowModel')
25960 ], RowContainerEventsFeature.prototype, "pinnedRowModel", void 0);
25961 __decorate$P([
25962 Optional('rangeService')
25963 ], RowContainerEventsFeature.prototype, "rangeService", void 0);
25964 __decorate$P([
25965 Optional('clipboardService')
25966 ], RowContainerEventsFeature.prototype, "clipboardService", void 0);
25967 __decorate$P([
25968 PostConstruct
25969 ], RowContainerEventsFeature.prototype, "postConstruct", null);
25970 return RowContainerEventsFeature;
25971}(BeanStub));
25972
25973/**
25974 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
25975 * @version v27.3.0
25976 * @link https://www.ag-grid.com/
25977 * @license MIT
25978 */
25979var __extends$11 = (undefined && undefined.__extends) || (function () {
25980 var extendStatics = function (d, b) {
25981 extendStatics = Object.setPrototypeOf ||
25982 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25983 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
25984 return extendStatics(d, b);
25985 };
25986 return function (d, b) {
25987 extendStatics(d, b);
25988 function __() { this.constructor = d; }
25989 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
25990 };
25991})();
25992var __decorate$Q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
25993 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
25994 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
25995 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;
25996 return c > 3 && r && Object.defineProperty(target, key, r), r;
25997};
25998// listens to changes in the center viewport size, for column and row virtualisation,
25999// and adjusts grid as necessary. there are two viewports, one for horizontal and one for
26000// vertical scrolling.
26001var ViewportSizeFeature = /** @class */ (function (_super) {
26002 __extends$11(ViewportSizeFeature, _super);
26003 function ViewportSizeFeature(centerContainerCtrl) {
26004 var _this = _super.call(this) || this;
26005 _this.centerContainerCtrl = centerContainerCtrl;
26006 return _this;
26007 }
26008 ViewportSizeFeature.prototype.postConstruct = function () {
26009 var _this = this;
26010 this.ctrlsService.whenReady(function () {
26011 _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
26012 _this.listenForResize();
26013 });
26014 this.addManagedListener(this.eventService, Events.EVENT_SCROLLBAR_WIDTH_CHANGED, this.onScrollbarWidthChanged.bind(this));
26015 };
26016 ViewportSizeFeature.prototype.listenForResize = function () {
26017 var _this = this;
26018 var listener = function () { return _this.onCenterViewportResized(); };
26019 // centerContainer gets horizontal resizes
26020 this.centerContainerCtrl.registerViewportResizeListener(listener);
26021 // eBodyViewport gets vertical resizes
26022 this.gridBodyCtrl.registerBodyViewportResizeListener(listener);
26023 };
26024 ViewportSizeFeature.prototype.onScrollbarWidthChanged = function () {
26025 this.checkViewportAndScrolls();
26026 };
26027 ViewportSizeFeature.prototype.onCenterViewportResized = function () {
26028 if (this.centerContainerCtrl.isViewportVisible()) {
26029 this.checkViewportAndScrolls();
26030 var newWidth = this.centerContainerCtrl.getCenterWidth();
26031 if (newWidth !== this.centerWidth) {
26032 this.centerWidth = newWidth;
26033 this.columnModel.refreshFlexedColumns({ viewportWidth: this.centerWidth, updateBodyWidths: true, fireResizedEvent: true });
26034 }
26035 }
26036 else {
26037 this.bodyHeight = 0;
26038 }
26039 };
26040 // gets called every time the viewport size changes. we use this to check visibility of scrollbars
26041 // in the grid panel, and also to check size and position of viewport for row and column virtualisation.
26042 ViewportSizeFeature.prototype.checkViewportAndScrolls = function () {
26043 // results in updating anything that depends on scroll showing
26044 this.updateScrollVisibleService();
26045 // fires event if height changes, used by PaginationService, HeightScalerService, RowRenderer
26046 this.checkBodyHeight();
26047 // check for virtual columns for ColumnController
26048 this.onHorizontalViewportChanged();
26049 this.gridBodyCtrl.getScrollFeature().checkScrollLeft();
26050 };
26051 ViewportSizeFeature.prototype.getBodyHeight = function () {
26052 return this.bodyHeight;
26053 };
26054 ViewportSizeFeature.prototype.checkBodyHeight = function () {
26055 var eBodyViewport = this.gridBodyCtrl.getBodyViewportElement();
26056 var bodyHeight = getInnerHeight(eBodyViewport);
26057 if (this.bodyHeight !== bodyHeight) {
26058 this.bodyHeight = bodyHeight;
26059 var event_1 = {
26060 type: Events.EVENT_BODY_HEIGHT_CHANGED,
26061 api: this.gridApi,
26062 columnApi: this.columnApi
26063 };
26064 this.eventService.dispatchEvent(event_1);
26065 }
26066 };
26067 ViewportSizeFeature.prototype.updateScrollVisibleService = function () {
26068 // because of column animation (which takes 200ms), we have to do this twice.
26069 // eg if user removes cols anywhere except at the RHS, then the cols on the RHS
26070 // will animate to the left to fill the gap. this animation means just after
26071 // the cols are removed, the remaining cols are still in the original location
26072 // at the start of the animation, so pre animation the H scrollbar is still needed,
26073 // but post animation it is not.
26074 this.updateScrollVisibleServiceImpl();
26075 setTimeout(this.updateScrollVisibleServiceImpl.bind(this), 500);
26076 };
26077 ViewportSizeFeature.prototype.updateScrollVisibleServiceImpl = function () {
26078 var params = {
26079 horizontalScrollShowing: this.isHorizontalScrollShowing(),
26080 verticalScrollShowing: this.gridBodyCtrl.isVerticalScrollShowing()
26081 };
26082 this.scrollVisibleService.setScrollsVisible(params);
26083 // fix - gridComp should just listen to event from above
26084 this.gridBodyCtrl.setVerticalScrollPaddingVisible(params.verticalScrollShowing);
26085 };
26086 ViewportSizeFeature.prototype.isHorizontalScrollShowing = function () {
26087 var isAlwaysShowHorizontalScroll = this.gridOptionsWrapper.isAlwaysShowHorizontalScroll();
26088 return isAlwaysShowHorizontalScroll || this.centerContainerCtrl.isViewportHScrollShowing();
26089 };
26090 // this gets called whenever a change in the viewport, so we can inform column controller it has to work
26091 // out the virtual columns again. gets called from following locations:
26092 // + ensureColVisible, scroll, init, layoutChanged, displayedColumnsChanged, API (doLayout)
26093 ViewportSizeFeature.prototype.onHorizontalViewportChanged = function () {
26094 var scrollWidth = this.centerContainerCtrl.getCenterWidth();
26095 var scrollPosition = this.centerContainerCtrl.getViewportScrollLeft();
26096 this.columnModel.setViewportPosition(scrollWidth, scrollPosition);
26097 };
26098 __decorate$Q([
26099 Autowired('ctrlsService')
26100 ], ViewportSizeFeature.prototype, "ctrlsService", void 0);
26101 __decorate$Q([
26102 Autowired('columnModel')
26103 ], ViewportSizeFeature.prototype, "columnModel", void 0);
26104 __decorate$Q([
26105 Autowired('scrollVisibleService')
26106 ], ViewportSizeFeature.prototype, "scrollVisibleService", void 0);
26107 __decorate$Q([
26108 Autowired('columnApi')
26109 ], ViewportSizeFeature.prototype, "columnApi", void 0);
26110 __decorate$Q([
26111 Autowired('gridApi')
26112 ], ViewportSizeFeature.prototype, "gridApi", void 0);
26113 __decorate$Q([
26114 PostConstruct
26115 ], ViewportSizeFeature.prototype, "postConstruct", null);
26116 return ViewportSizeFeature;
26117}(BeanStub));
26118
26119/**
26120 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
26121 * @version v27.3.0
26122 * @link https://www.ag-grid.com/
26123 * @license MIT
26124 */
26125var __extends$12 = (undefined && undefined.__extends) || (function () {
26126 var extendStatics = function (d, b) {
26127 extendStatics = Object.setPrototypeOf ||
26128 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26129 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26130 return extendStatics(d, b);
26131 };
26132 return function (d, b) {
26133 extendStatics(d, b);
26134 function __() { this.constructor = d; }
26135 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26136 };
26137})();
26138var __decorate$R = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
26139 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26140 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26141 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;
26142 return c > 3 && r && Object.defineProperty(target, key, r), r;
26143};
26144var SetPinnedLeftWidthFeature = /** @class */ (function (_super) {
26145 __extends$12(SetPinnedLeftWidthFeature, _super);
26146 function SetPinnedLeftWidthFeature(element) {
26147 var _this = _super.call(this) || this;
26148 _this.element = element;
26149 return _this;
26150 }
26151 SetPinnedLeftWidthFeature.prototype.postConstruct = function () {
26152 this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, this.onPinnedLeftWidthChanged.bind(this));
26153 };
26154 SetPinnedLeftWidthFeature.prototype.onPinnedLeftWidthChanged = function () {
26155 var leftWidth = this.pinnedWidthService.getPinnedLeftWidth();
26156 var displayed = leftWidth > 0;
26157 setDisplayed(this.element, displayed);
26158 if (displayed) {
26159 setFixedWidth(this.element, leftWidth);
26160 }
26161 };
26162 __decorate$R([
26163 Autowired('pinnedWidthService')
26164 ], SetPinnedLeftWidthFeature.prototype, "pinnedWidthService", void 0);
26165 __decorate$R([
26166 PostConstruct
26167 ], SetPinnedLeftWidthFeature.prototype, "postConstruct", null);
26168 return SetPinnedLeftWidthFeature;
26169}(BeanStub));
26170
26171/**
26172 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
26173 * @version v27.3.0
26174 * @link https://www.ag-grid.com/
26175 * @license MIT
26176 */
26177var __extends$13 = (undefined && undefined.__extends) || (function () {
26178 var extendStatics = function (d, b) {
26179 extendStatics = Object.setPrototypeOf ||
26180 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26181 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26182 return extendStatics(d, b);
26183 };
26184 return function (d, b) {
26185 extendStatics(d, b);
26186 function __() { this.constructor = d; }
26187 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26188 };
26189})();
26190var __decorate$S = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
26191 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26192 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26193 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;
26194 return c > 3 && r && Object.defineProperty(target, key, r), r;
26195};
26196var SetPinnedRightWidthFeature = /** @class */ (function (_super) {
26197 __extends$13(SetPinnedRightWidthFeature, _super);
26198 function SetPinnedRightWidthFeature(element) {
26199 var _this = _super.call(this) || this;
26200 _this.element = element;
26201 return _this;
26202 }
26203 SetPinnedRightWidthFeature.prototype.postConstruct = function () {
26204 this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, this.onPinnedRightWidthChanged.bind(this));
26205 };
26206 SetPinnedRightWidthFeature.prototype.onPinnedRightWidthChanged = function () {
26207 var rightWidth = this.pinnedWidthService.getPinnedRightWidth();
26208 var displayed = rightWidth > 0;
26209 setDisplayed(this.element, displayed);
26210 if (displayed) {
26211 setFixedWidth(this.element, rightWidth);
26212 }
26213 };
26214 __decorate$S([
26215 Autowired('pinnedWidthService')
26216 ], SetPinnedRightWidthFeature.prototype, "pinnedWidthService", void 0);
26217 __decorate$S([
26218 PostConstruct
26219 ], SetPinnedRightWidthFeature.prototype, "postConstruct", null);
26220 return SetPinnedRightWidthFeature;
26221}(BeanStub));
26222
26223/**
26224 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
26225 * @version v27.3.0
26226 * @link https://www.ag-grid.com/
26227 * @license MIT
26228 */
26229var __extends$14 = (undefined && undefined.__extends) || (function () {
26230 var extendStatics = function (d, b) {
26231 extendStatics = Object.setPrototypeOf ||
26232 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26233 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26234 return extendStatics(d, b);
26235 };
26236 return function (d, b) {
26237 extendStatics(d, b);
26238 function __() { this.constructor = d; }
26239 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26240 };
26241})();
26242var __decorate$T = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
26243 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26244 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26245 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;
26246 return c > 3 && r && Object.defineProperty(target, key, r), r;
26247};
26248var SetHeightFeature = /** @class */ (function (_super) {
26249 __extends$14(SetHeightFeature, _super);
26250 function SetHeightFeature(eContainer, eWrapper) {
26251 var _this = _super.call(this) || this;
26252 _this.eContainer = eContainer;
26253 _this.eWrapper = eWrapper;
26254 return _this;
26255 }
26256 SetHeightFeature.prototype.postConstruct = function () {
26257 this.addManagedListener(this.eventService, Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED, this.onHeightChanged.bind(this));
26258 };
26259 SetHeightFeature.prototype.onHeightChanged = function () {
26260 var height = this.maxDivHeightScaler.getUiContainerHeight();
26261 var heightString = height != null ? height + "px" : "";
26262 this.eContainer.style.height = heightString;
26263 if (this.eWrapper) {
26264 this.eWrapper.style.height = heightString;
26265 }
26266 };
26267 __decorate$T([
26268 Autowired("rowContainerHeightService")
26269 ], SetHeightFeature.prototype, "maxDivHeightScaler", void 0);
26270 __decorate$T([
26271 PostConstruct
26272 ], SetHeightFeature.prototype, "postConstruct", null);
26273 return SetHeightFeature;
26274}(BeanStub));
26275
26276/**
26277 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
26278 * @version v27.3.0
26279 * @link https://www.ag-grid.com/
26280 * @license MIT
26281 */
26282var __extends$15 = (undefined && undefined.__extends) || (function () {
26283 var extendStatics = function (d, b) {
26284 extendStatics = Object.setPrototypeOf ||
26285 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26286 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26287 return extendStatics(d, b);
26288 };
26289 return function (d, b) {
26290 extendStatics(d, b);
26291 function __() { this.constructor = d; }
26292 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26293 };
26294})();
26295var __decorate$U = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
26296 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26297 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26298 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;
26299 return c > 3 && r && Object.defineProperty(target, key, r), r;
26300};
26301var DragListenerFeature = /** @class */ (function (_super) {
26302 __extends$15(DragListenerFeature, _super);
26303 function DragListenerFeature(eContainer) {
26304 var _this = _super.call(this) || this;
26305 _this.eContainer = eContainer;
26306 return _this;
26307 }
26308 DragListenerFeature.prototype.postConstruct = function () {
26309 var _this = this;
26310 if (!this.gridOptionsWrapper.isEnableRangeSelection() || // no range selection if no property
26311 missing(this.rangeService) // no range selection if not enterprise version
26312 ) {
26313 return;
26314 }
26315 var params = {
26316 dragStartPixels: 0,
26317 eElement: this.eContainer,
26318 onDragStart: this.rangeService.onDragStart.bind(this.rangeService),
26319 onDragStop: this.rangeService.onDragStop.bind(this.rangeService),
26320 onDragging: this.rangeService.onDragging.bind(this.rangeService)
26321 };
26322 this.dragService.addDragSource(params);
26323 this.addDestroyFunc(function () { return _this.dragService.removeDragSource(params); });
26324 };
26325 __decorate$U([
26326 Optional('rangeService')
26327 ], DragListenerFeature.prototype, "rangeService", void 0);
26328 __decorate$U([
26329 Autowired('dragService')
26330 ], DragListenerFeature.prototype, "dragService", void 0);
26331 __decorate$U([
26332 PostConstruct
26333 ], DragListenerFeature.prototype, "postConstruct", null);
26334 return DragListenerFeature;
26335}(BeanStub));
26336
26337/**
26338 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
26339 * @version v27.3.0
26340 * @link https://www.ag-grid.com/
26341 * @license MIT
26342 */
26343var __extends$16 = (undefined && undefined.__extends) || (function () {
26344 var extendStatics = function (d, b) {
26345 extendStatics = Object.setPrototypeOf ||
26346 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26347 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26348 return extendStatics(d, b);
26349 };
26350 return function (d, b) {
26351 extendStatics(d, b);
26352 function __() { this.constructor = d; }
26353 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26354 };
26355})();
26356var __decorate$V = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
26357 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26358 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26359 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;
26360 return c > 3 && r && Object.defineProperty(target, key, r), r;
26361};
26362var CenterWidthFeature = /** @class */ (function (_super) {
26363 __extends$16(CenterWidthFeature, _super);
26364 function CenterWidthFeature(callback) {
26365 var _this = _super.call(this) || this;
26366 _this.callback = callback;
26367 return _this;
26368 }
26369 CenterWidthFeature.prototype.postConstruct = function () {
26370 var listener = this.setWidth.bind(this);
26371 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, listener);
26372 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);
26373 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, listener);
26374 this.setWidth();
26375 };
26376 CenterWidthFeature.prototype.setWidth = function () {
26377 var columnModel = this.columnModel;
26378 var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
26379 var centerWidth = columnModel.getBodyContainerWidth();
26380 var leftWidth = columnModel.getDisplayedColumnsLeftWidth();
26381 var rightWidth = columnModel.getDisplayedColumnsRightWidth();
26382 var totalWidth = printLayout ? centerWidth + leftWidth + rightWidth : centerWidth;
26383 this.callback(totalWidth);
26384 };
26385 __decorate$V([
26386 Autowired('columnModel')
26387 ], CenterWidthFeature.prototype, "columnModel", void 0);
26388 __decorate$V([
26389 PostConstruct
26390 ], CenterWidthFeature.prototype, "postConstruct", null);
26391 return CenterWidthFeature;
26392}(BeanStub));
26393
26394/**
26395 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
26396 * @version v27.3.0
26397 * @link https://www.ag-grid.com/
26398 * @license MIT
26399 */
26400var __extends$17 = (undefined && undefined.__extends) || (function () {
26401 var extendStatics = function (d, b) {
26402 extendStatics = Object.setPrototypeOf ||
26403 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26404 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26405 return extendStatics(d, b);
26406 };
26407 return function (d, b) {
26408 extendStatics(d, b);
26409 function __() { this.constructor = d; }
26410 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26411 };
26412})();
26413var __decorate$W = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
26414 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26415 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26416 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;
26417 return c > 3 && r && Object.defineProperty(target, key, r), r;
26418};
26419var __read$a = (undefined && undefined.__read) || function (o, n) {
26420 var m = typeof Symbol === "function" && o[Symbol.iterator];
26421 if (!m) return o;
26422 var i = m.call(o), r, ar = [], e;
26423 try {
26424 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
26425 }
26426 catch (error) { e = { error: error }; }
26427 finally {
26428 try {
26429 if (r && !r.done && (m = i["return"])) m.call(i);
26430 }
26431 finally { if (e) throw e.error; }
26432 }
26433 return ar;
26434};
26435var __spread$7 = (undefined && undefined.__spread) || function () {
26436 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$a(arguments[i]));
26437 return ar;
26438};
26439(function (RowContainerName) {
26440 RowContainerName["LEFT"] = "left";
26441 RowContainerName["RIGHT"] = "right";
26442 RowContainerName["CENTER"] = "center";
26443 RowContainerName["FULL_WIDTH"] = "fullWidth";
26444 RowContainerName["TOP_LEFT"] = "topLeft";
26445 RowContainerName["TOP_RIGHT"] = "topRight";
26446 RowContainerName["TOP_CENTER"] = "topCenter";
26447 RowContainerName["TOP_FULL_WIDTH"] = "topFullWidth";
26448 RowContainerName["BOTTOM_LEFT"] = "bottomLeft";
26449 RowContainerName["BOTTOM_RIGHT"] = "bottomRight";
26450 RowContainerName["BOTTOM_CENTER"] = "bottomCenter";
26451 RowContainerName["BOTTOM_FULL_WIDTH"] = "bottomFullWidth";
26452})(exports.RowContainerName || (exports.RowContainerName = {}));
26453(function (RowContainerType) {
26454 RowContainerType["LEFT"] = "left";
26455 RowContainerType["RIGHT"] = "right";
26456 RowContainerType["CENTER"] = "center";
26457 RowContainerType["FULL_WIDTH"] = "fullWidth";
26458})(exports.RowContainerType || (exports.RowContainerType = {}));
26459function getRowContainerTypeForName(name) {
26460 switch (name) {
26461 case exports.RowContainerName.CENTER:
26462 case exports.RowContainerName.TOP_CENTER:
26463 case exports.RowContainerName.BOTTOM_CENTER:
26464 return exports.RowContainerType.CENTER;
26465 case exports.RowContainerName.LEFT:
26466 case exports.RowContainerName.TOP_LEFT:
26467 case exports.RowContainerName.BOTTOM_LEFT:
26468 return exports.RowContainerType.LEFT;
26469 case exports.RowContainerName.RIGHT:
26470 case exports.RowContainerName.TOP_RIGHT:
26471 case exports.RowContainerName.BOTTOM_RIGHT:
26472 return exports.RowContainerType.RIGHT;
26473 case exports.RowContainerName.FULL_WIDTH:
26474 case exports.RowContainerName.TOP_FULL_WIDTH:
26475 case exports.RowContainerName.BOTTOM_FULL_WIDTH:
26476 return exports.RowContainerType.FULL_WIDTH;
26477 default:
26478 throw Error('Invalid Row Container Type');
26479 }
26480}
26481var ContainerCssClasses = convertToMap([
26482 [exports.RowContainerName.CENTER, 'ag-center-cols-container'],
26483 [exports.RowContainerName.LEFT, 'ag-pinned-left-cols-container'],
26484 [exports.RowContainerName.RIGHT, 'ag-pinned-right-cols-container'],
26485 [exports.RowContainerName.FULL_WIDTH, 'ag-full-width-container'],
26486 [exports.RowContainerName.TOP_CENTER, 'ag-floating-top-container'],
26487 [exports.RowContainerName.TOP_LEFT, 'ag-pinned-left-floating-top'],
26488 [exports.RowContainerName.TOP_RIGHT, 'ag-pinned-right-floating-top'],
26489 [exports.RowContainerName.TOP_FULL_WIDTH, 'ag-floating-top-full-width-container'],
26490 [exports.RowContainerName.BOTTOM_CENTER, 'ag-floating-bottom-container'],
26491 [exports.RowContainerName.BOTTOM_LEFT, 'ag-pinned-left-floating-bottom'],
26492 [exports.RowContainerName.BOTTOM_RIGHT, 'ag-pinned-right-floating-bottom'],
26493 [exports.RowContainerName.BOTTOM_FULL_WIDTH, 'ag-floating-bottom-full-width-container'],
26494]);
26495var ViewportCssClasses = convertToMap([
26496 [exports.RowContainerName.CENTER, 'ag-center-cols-viewport'],
26497 [exports.RowContainerName.TOP_CENTER, 'ag-floating-top-viewport'],
26498 [exports.RowContainerName.BOTTOM_CENTER, 'ag-floating-bottom-viewport'],
26499]);
26500var WrapperCssClasses = convertToMap([
26501 [exports.RowContainerName.CENTER, 'ag-center-cols-clipper'],
26502]);
26503var RowContainerCtrl = /** @class */ (function (_super) {
26504 __extends$17(RowContainerCtrl, _super);
26505 function RowContainerCtrl(name) {
26506 var _this = _super.call(this) || this;
26507 _this.name = name;
26508 return _this;
26509 }
26510 RowContainerCtrl.getRowContainerCssClasses = function (name) {
26511 var containerClass = ContainerCssClasses.get(name);
26512 var viewportClass = ViewportCssClasses.get(name);
26513 var wrapperClass = WrapperCssClasses.get(name);
26514 return { container: containerClass, viewport: viewportClass, wrapper: wrapperClass };
26515 };
26516 RowContainerCtrl.getPinned = function (name) {
26517 switch (name) {
26518 case exports.RowContainerName.BOTTOM_LEFT:
26519 case exports.RowContainerName.TOP_LEFT:
26520 case exports.RowContainerName.LEFT:
26521 return Constants.PINNED_LEFT;
26522 case exports.RowContainerName.BOTTOM_RIGHT:
26523 case exports.RowContainerName.TOP_RIGHT:
26524 case exports.RowContainerName.RIGHT:
26525 return Constants.PINNED_RIGHT;
26526 default:
26527 return null;
26528 }
26529 };
26530 RowContainerCtrl.prototype.postConstruct = function () {
26531 var _this = this;
26532 this.enableRtl = this.gridOptionsWrapper.isEnableRtl();
26533 this.embedFullWidthRows = this.gridOptionsWrapper.isEmbedFullWidthRows();
26534 this.forContainers([exports.RowContainerName.CENTER], function () { return _this.viewportSizeFeature = _this.createManagedBean(new ViewportSizeFeature(_this)); });
26535 };
26536 RowContainerCtrl.prototype.registerWithCtrlsService = function () {
26537 switch (this.name) {
26538 case exports.RowContainerName.CENTER:
26539 this.ctrlsService.registerCenterRowContainerCtrl(this);
26540 break;
26541 case exports.RowContainerName.LEFT:
26542 this.ctrlsService.registerLeftRowContainerCtrl(this);
26543 break;
26544 case exports.RowContainerName.RIGHT:
26545 this.ctrlsService.registerRightRowContainerCtrl(this);
26546 break;
26547 case exports.RowContainerName.TOP_CENTER:
26548 this.ctrlsService.registerTopCenterRowContainerCtrl(this);
26549 break;
26550 case exports.RowContainerName.TOP_LEFT:
26551 this.ctrlsService.registerTopLeftRowContainerCon(this);
26552 break;
26553 case exports.RowContainerName.TOP_RIGHT:
26554 this.ctrlsService.registerTopRightRowContainerCtrl(this);
26555 break;
26556 case exports.RowContainerName.BOTTOM_CENTER:
26557 this.ctrlsService.registerBottomCenterRowContainerCtrl(this);
26558 break;
26559 case exports.RowContainerName.BOTTOM_LEFT:
26560 this.ctrlsService.registerBottomLeftRowContainerCtrl(this);
26561 break;
26562 case exports.RowContainerName.BOTTOM_RIGHT:
26563 this.ctrlsService.registerBottomRightRowContainerCtrl(this);
26564 break;
26565 }
26566 };
26567 RowContainerCtrl.prototype.forContainers = function (names, callback) {
26568 if (names.indexOf(this.name) >= 0) {
26569 callback();
26570 }
26571 };
26572 RowContainerCtrl.prototype.getContainerElement = function () {
26573 return this.eContainer;
26574 };
26575 RowContainerCtrl.prototype.getViewportSizeFeature = function () {
26576 return this.viewportSizeFeature;
26577 };
26578 RowContainerCtrl.prototype.setComp = function (view, eContainer, eViewport, eWrapper) {
26579 var _this = this;
26580 this.comp = view;
26581 this.eContainer = eContainer;
26582 this.eViewport = eViewport;
26583 this.eWrapper = eWrapper;
26584 this.createManagedBean(new RowContainerEventsFeature(this.eContainer));
26585 this.addPreventScrollWhileDragging();
26586 this.listenOnDomOrder();
26587 this.stopHScrollOnPinnedRows();
26588 var allTopNoFW = [exports.RowContainerName.TOP_CENTER, exports.RowContainerName.TOP_LEFT, exports.RowContainerName.TOP_RIGHT];
26589 var allBottomNoFW = [exports.RowContainerName.BOTTOM_CENTER, exports.RowContainerName.BOTTOM_LEFT, exports.RowContainerName.BOTTOM_RIGHT];
26590 var allMiddleNoFW = [exports.RowContainerName.CENTER, exports.RowContainerName.LEFT, exports.RowContainerName.RIGHT];
26591 var allNoFW = __spread$7(allTopNoFW, allBottomNoFW, allMiddleNoFW);
26592 var allMiddle = [exports.RowContainerName.CENTER, exports.RowContainerName.LEFT, exports.RowContainerName.RIGHT, exports.RowContainerName.FULL_WIDTH];
26593 var allCenter = [exports.RowContainerName.CENTER, exports.RowContainerName.TOP_CENTER, exports.RowContainerName.BOTTOM_CENTER];
26594 var allLeft = [exports.RowContainerName.LEFT, exports.RowContainerName.BOTTOM_LEFT, exports.RowContainerName.TOP_LEFT];
26595 var allRight = [exports.RowContainerName.RIGHT, exports.RowContainerName.BOTTOM_RIGHT, exports.RowContainerName.TOP_RIGHT];
26596 this.forContainers(allLeft, function () { return _this.createManagedBean(new SetPinnedLeftWidthFeature(_this.eContainer)); });
26597 this.forContainers(allRight, function () { return _this.createManagedBean(new SetPinnedRightWidthFeature(_this.eContainer)); });
26598 this.forContainers(allMiddle, function () { return _this.createManagedBean(new SetHeightFeature(_this.eContainer, _this.eWrapper)); });
26599 this.forContainers(allNoFW, function () { return _this.createManagedBean(new DragListenerFeature(_this.eContainer)); });
26600 this.forContainers(allCenter, function () { return _this.createManagedBean(new CenterWidthFeature(function (width) { return _this.comp.setContainerWidth(width + "px"); })); });
26601 this.addListeners();
26602 this.registerWithCtrlsService();
26603 };
26604 RowContainerCtrl.prototype.addListeners = function () {
26605 var _this = this;
26606 this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, function () { return _this.onScrollVisibilityChanged(); });
26607 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, function () { return _this.onDisplayedColumnsChanged(); });
26608 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, function () { return _this.onDisplayedColumnsWidthChanged(); });
26609 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_ROWS_CHANGED, function () { return _this.onDisplayedRowsChanged(); });
26610 this.onScrollVisibilityChanged();
26611 this.onDisplayedColumnsChanged();
26612 this.onDisplayedColumnsWidthChanged();
26613 this.onDisplayedRowsChanged();
26614 };
26615 RowContainerCtrl.prototype.listenOnDomOrder = function () {
26616 var _this = this;
26617 var listener = function () { return _this.comp.setDomOrder(_this.gridOptionsWrapper.isEnsureDomOrder()); };
26618 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, listener);
26619 listener();
26620 };
26621 // when editing a pinned row, if the cell is half outside the scrollable area, the browser can
26622 // scroll the column into view. we do not want this, the pinned sections should never scroll.
26623 // so we listen to scrolls on these containers and reset the scroll if we find one.
26624 RowContainerCtrl.prototype.stopHScrollOnPinnedRows = function () {
26625 var _this = this;
26626 this.forContainers([exports.RowContainerName.TOP_CENTER, exports.RowContainerName.BOTTOM_CENTER], function () {
26627 var resetScrollLeft = function () { return _this.eViewport.scrollLeft = 0; };
26628 _this.addManagedListener(_this.eViewport, 'scroll', resetScrollLeft);
26629 });
26630 };
26631 RowContainerCtrl.prototype.onDisplayedColumnsChanged = function () {
26632 var _this = this;
26633 this.forContainers([exports.RowContainerName.CENTER], function () { return _this.onHorizontalViewportChanged(); });
26634 };
26635 RowContainerCtrl.prototype.onDisplayedColumnsWidthChanged = function () {
26636 var _this = this;
26637 this.forContainers([exports.RowContainerName.CENTER], function () { return _this.onHorizontalViewportChanged(); });
26638 };
26639 RowContainerCtrl.prototype.onScrollVisibilityChanged = function () {
26640 if (this.name !== exports.RowContainerName.CENTER) {
26641 return;
26642 }
26643 var visible = this.scrollVisibleService.isHorizontalScrollShowing();
26644 var scrollbarWidth = visible ? (this.gridOptionsWrapper.getScrollbarWidth() || 0) : 0;
26645 var height = scrollbarWidth == 0 ? '100%' : "calc(100% + " + scrollbarWidth + "px)";
26646 this.comp.setViewportHeight(height);
26647 };
26648 // this methods prevents the grid views from being scrolled while the dragService is being used
26649 // eg. the view should not scroll up and down while dragging rows using the rowDragComp.
26650 RowContainerCtrl.prototype.addPreventScrollWhileDragging = function () {
26651 var _this = this;
26652 var preventScroll = function (e) {
26653 if (_this.dragService.isDragging()) {
26654 if (e.cancelable) {
26655 e.preventDefault();
26656 }
26657 }
26658 };
26659 this.eContainer.addEventListener('touchmove', preventScroll, { passive: false });
26660 this.addDestroyFunc(function () { return _this.eContainer.removeEventListener('touchmove', preventScroll); });
26661 };
26662 // this gets called whenever a change in the viewport, so we can inform column controller it has to work
26663 // out the virtual columns again. gets called from following locations:
26664 // + ensureColVisible, scroll, init, layoutChanged, displayedColumnsChanged, API (doLayout)
26665 RowContainerCtrl.prototype.onHorizontalViewportChanged = function () {
26666 var scrollWidth = this.getCenterWidth();
26667 var scrollPosition = this.getCenterViewportScrollLeft();
26668 this.columnModel.setViewportPosition(scrollWidth, scrollPosition);
26669 };
26670 RowContainerCtrl.prototype.getCenterWidth = function () {
26671 return getInnerWidth(this.eViewport);
26672 };
26673 RowContainerCtrl.prototype.getCenterViewportScrollLeft = function () {
26674 // we defer to a util, as how you calculated scrollLeft when doing RTL depends on the browser
26675 return getScrollLeft(this.eViewport, this.enableRtl);
26676 };
26677 RowContainerCtrl.prototype.registerViewportResizeListener = function (listener) {
26678 var unsubscribeFromResize = this.resizeObserverService.observeResize(this.eViewport, listener);
26679 this.addDestroyFunc(function () { return unsubscribeFromResize(); });
26680 };
26681 RowContainerCtrl.prototype.isViewportVisible = function () {
26682 return isVisible(this.eViewport);
26683 };
26684 RowContainerCtrl.prototype.isViewportHScrollShowing = function () {
26685 return isHorizontalScrollShowing(this.eViewport);
26686 };
26687 RowContainerCtrl.prototype.getViewportScrollLeft = function () {
26688 return getScrollLeft(this.eViewport, this.enableRtl);
26689 };
26690 RowContainerCtrl.prototype.isHorizontalScrollShowing = function () {
26691 var isAlwaysShowHorizontalScroll = this.gridOptionsWrapper.isAlwaysShowHorizontalScroll();
26692 return isAlwaysShowHorizontalScroll || isHorizontalScrollShowing(this.eViewport);
26693 };
26694 RowContainerCtrl.prototype.getViewportElement = function () {
26695 return this.eViewport;
26696 };
26697 RowContainerCtrl.prototype.setContainerTranslateX = function (amount) {
26698 this.eContainer.style.transform = "translateX(" + amount + "px)";
26699 };
26700 RowContainerCtrl.prototype.getHScrollPosition = function () {
26701 var res = {
26702 left: this.eViewport.scrollLeft,
26703 right: this.eViewport.scrollLeft + this.eViewport.offsetWidth
26704 };
26705 return res;
26706 };
26707 RowContainerCtrl.prototype.setCenterViewportScrollLeft = function (value) {
26708 // we defer to a util, as how you calculated scrollLeft when doing RTL depends on the browser
26709 setScrollLeft(this.eViewport, value, this.enableRtl);
26710 };
26711 RowContainerCtrl.prototype.onDisplayedRowsChanged = function () {
26712 var _this = this;
26713 var fullWithContainer = this.name === exports.RowContainerName.TOP_FULL_WIDTH
26714 || this.name === exports.RowContainerName.BOTTOM_FULL_WIDTH
26715 || this.name === exports.RowContainerName.FULL_WIDTH;
26716 var doesRowMatch = function (rowCtrl) {
26717 var fullWidthRow = rowCtrl.isFullWidth();
26718 var printLayout = _this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
26719 var embedFW = _this.embedFullWidthRows || printLayout;
26720 var match = fullWithContainer ?
26721 !embedFW && fullWidthRow
26722 : embedFW || !fullWidthRow;
26723 return match;
26724 };
26725 // this list contains either all pinned top, center or pinned bottom rows
26726 var allRowsRegardlessOfFullWidth = this.getRowCtrls();
26727 // this filters out rows not for this container, eg if it's a full with row, but we are not full with container
26728 var rowsThisContainer = allRowsRegardlessOfFullWidth.filter(doesRowMatch);
26729 this.comp.setRowCtrls(rowsThisContainer);
26730 };
26731 RowContainerCtrl.prototype.getRowCtrls = function () {
26732 switch (this.name) {
26733 case exports.RowContainerName.TOP_CENTER:
26734 case exports.RowContainerName.TOP_LEFT:
26735 case exports.RowContainerName.TOP_RIGHT:
26736 case exports.RowContainerName.TOP_FULL_WIDTH:
26737 return this.rowRenderer.getTopRowCtrls();
26738 case exports.RowContainerName.BOTTOM_CENTER:
26739 case exports.RowContainerName.BOTTOM_LEFT:
26740 case exports.RowContainerName.BOTTOM_RIGHT:
26741 case exports.RowContainerName.BOTTOM_FULL_WIDTH:
26742 return this.rowRenderer.getBottomRowCtrls();
26743 default:
26744 return this.rowRenderer.getRowCtrls();
26745 }
26746 };
26747 __decorate$W([
26748 Autowired('scrollVisibleService')
26749 ], RowContainerCtrl.prototype, "scrollVisibleService", void 0);
26750 __decorate$W([
26751 Autowired('dragService')
26752 ], RowContainerCtrl.prototype, "dragService", void 0);
26753 __decorate$W([
26754 Autowired('ctrlsService')
26755 ], RowContainerCtrl.prototype, "ctrlsService", void 0);
26756 __decorate$W([
26757 Autowired('columnModel')
26758 ], RowContainerCtrl.prototype, "columnModel", void 0);
26759 __decorate$W([
26760 Autowired('resizeObserverService')
26761 ], RowContainerCtrl.prototype, "resizeObserverService", void 0);
26762 __decorate$W([
26763 Autowired('rowRenderer')
26764 ], RowContainerCtrl.prototype, "rowRenderer", void 0);
26765 __decorate$W([
26766 PostConstruct
26767 ], RowContainerCtrl.prototype, "postConstruct", null);
26768 return RowContainerCtrl;
26769}(BeanStub));
26770
26771/**
26772 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
26773 * @version v27.3.0
26774 * @link https://www.ag-grid.com/
26775 * @license MIT
26776 */
26777var __extends$18 = (undefined && undefined.__extends) || (function () {
26778 var extendStatics = function (d, b) {
26779 extendStatics = Object.setPrototypeOf ||
26780 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26781 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26782 return extendStatics(d, b);
26783 };
26784 return function (d, b) {
26785 extendStatics(d, b);
26786 function __() { this.constructor = d; }
26787 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26788 };
26789})();
26790var __decorate$X = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
26791 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26792 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26793 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;
26794 return c > 3 && r && Object.defineProperty(target, key, r), r;
26795};
26796var GRID_BODY_TEMPLATE = /* html */ "<div class=\"ag-root ag-unselectable\" role=\"grid\">\n <ag-header-root ref=\"gridHeader\"></ag-header-root>\n <div class=\"ag-floating-top\" ref=\"eTop\" role=\"presentation\">\n <ag-row-container ref=\"topLeftContainer\" name=\"" + exports.RowContainerName.TOP_LEFT + "\"></ag-row-container>\n <ag-row-container ref=\"topCenterContainer\" name=\"" + exports.RowContainerName.TOP_CENTER + "\"></ag-row-container>\n <ag-row-container ref=\"topRightContainer\" name=\"" + exports.RowContainerName.TOP_RIGHT + "\"></ag-row-container>\n <ag-row-container ref=\"topFullWidthContainer\" name=\"" + exports.RowContainerName.TOP_FULL_WIDTH + "\"></ag-row-container>\n </div>\n <div class=\"ag-body-viewport\" ref=\"eBodyViewport\" role=\"presentation\">\n <ag-row-container ref=\"leftContainer\" name=\"" + exports.RowContainerName.LEFT + "\"></ag-row-container>\n <ag-row-container ref=\"centerContainer\" name=\"" + exports.RowContainerName.CENTER + "\"></ag-row-container>\n <ag-row-container ref=\"rightContainer\" name=\"" + exports.RowContainerName.RIGHT + "\"></ag-row-container>\n <ag-row-container ref=\"fullWidthContainer\" name=\"" + exports.RowContainerName.FULL_WIDTH + "\"></ag-row-container>\n </div>\n <div class=\"ag-floating-bottom\" ref=\"eBottom\" role=\"presentation\">\n <ag-row-container ref=\"bottomLeftContainer\" name=\"" + exports.RowContainerName.BOTTOM_LEFT + "\"></ag-row-container>\n <ag-row-container ref=\"bottomCenterContainer\" name=\"" + exports.RowContainerName.BOTTOM_CENTER + "\"></ag-row-container>\n <ag-row-container ref=\"bottomRightContainer\" name=\"" + exports.RowContainerName.BOTTOM_RIGHT + "\"></ag-row-container>\n <ag-row-container ref=\"bottomFullWidthContainer\" name=\"" + exports.RowContainerName.BOTTOM_FULL_WIDTH + "\"></ag-row-container>\n </div>\n <ag-fake-horizontal-scroll></ag-fake-horizontal-scroll>\n <ag-overlay-wrapper></ag-overlay-wrapper>\n </div>";
26797var GridBodyComp = /** @class */ (function (_super) {
26798 __extends$18(GridBodyComp, _super);
26799 function GridBodyComp() {
26800 return _super.call(this, GRID_BODY_TEMPLATE) || this;
26801 }
26802 GridBodyComp.prototype.init = function () {
26803 var _this = this;
26804 var setHeight = function (height, element) {
26805 var heightString = height + "px";
26806 element.style.minHeight = heightString;
26807 element.style.height = heightString;
26808 };
26809 var compProxy = {
26810 setRowAnimationCssOnBodyViewport: function (cssClass, animate) { return _this.setRowAnimationCssOnBodyViewport(cssClass, animate); },
26811 setColumnCount: function (count) { return setAriaColCount(_this.getGui(), count); },
26812 setRowCount: function (count) { return setAriaRowCount(_this.getGui(), count); },
26813 setTopHeight: function (height) { return setHeight(height, _this.eTop); },
26814 setBottomHeight: function (height) { return setHeight(height, _this.eBottom); },
26815 setTopDisplay: function (display) { return _this.eTop.style.display = display; },
26816 setBottomDisplay: function (display) { return _this.eBottom.style.display = display; },
26817 setColumnMovingCss: function (cssClass, flag) { return _this.addOrRemoveCssClass(CSS_CLASS_COLUMN_MOVING, flag); },
26818 updateLayoutClasses: function (cssClass, params) {
26819 var bodyViewportClassList = _this.eBodyViewport.classList;
26820 bodyViewportClassList.toggle(exports.LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
26821 bodyViewportClassList.toggle(exports.LayoutCssClasses.NORMAL, params.normal);
26822 bodyViewportClassList.toggle(exports.LayoutCssClasses.PRINT, params.print);
26823 _this.addOrRemoveCssClass(exports.LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
26824 _this.addOrRemoveCssClass(exports.LayoutCssClasses.NORMAL, params.normal);
26825 _this.addOrRemoveCssClass(exports.LayoutCssClasses.PRINT, params.print);
26826 },
26827 setAlwaysVerticalScrollClass: function (cssClass, on) {
26828 return _this.eBodyViewport.classList.toggle(CSS_CLASS_FORCE_VERTICAL_SCROLL, on);
26829 },
26830 registerBodyViewportResizeListener: function (listener) {
26831 var unsubscribeFromResize = _this.resizeObserverService.observeResize(_this.eBodyViewport, listener);
26832 _this.addDestroyFunc(function () { return unsubscribeFromResize(); });
26833 },
26834 setPinnedTopBottomOverflowY: function (overflow) { return _this.eTop.style.overflowY = _this.eBottom.style.overflowY = overflow; },
26835 setCellSelectableCss: function (cssClass, selectable) {
26836 [_this.eTop, _this.eBodyViewport, _this.eBottom]
26837 .forEach(function (ct) { return ct.classList.toggle(CSS_CLASS_CELL_SELECTABLE, selectable); });
26838 },
26839 };
26840 this.ctrl = this.createManagedBean(new GridBodyCtrl());
26841 this.ctrl.setComp(compProxy, this.getGui(), this.eBodyViewport, this.eTop, this.eBottom);
26842 if (this.rangeService || this.gridOptionsWrapper.isRowSelectionMulti()) {
26843 setAriaMultiSelectable(this.getGui(), true);
26844 }
26845 };
26846 GridBodyComp.prototype.setRowAnimationCssOnBodyViewport = function (cssClass, animateRows) {
26847 var bodyViewportClassList = this.eBodyViewport.classList;
26848 bodyViewportClassList.toggle(exports.RowAnimationCssClasses.ANIMATION_ON, animateRows);
26849 bodyViewportClassList.toggle(exports.RowAnimationCssClasses.ANIMATION_OFF, !animateRows);
26850 };
26851 GridBodyComp.prototype.getFloatingTopBottom = function () {
26852 return [this.eTop, this.eBottom];
26853 };
26854 __decorate$X([
26855 Autowired('resizeObserverService')
26856 ], GridBodyComp.prototype, "resizeObserverService", void 0);
26857 __decorate$X([
26858 Optional('rangeService')
26859 ], GridBodyComp.prototype, "rangeService", void 0);
26860 __decorate$X([
26861 RefSelector('eBodyViewport')
26862 ], GridBodyComp.prototype, "eBodyViewport", void 0);
26863 __decorate$X([
26864 RefSelector('eTop')
26865 ], GridBodyComp.prototype, "eTop", void 0);
26866 __decorate$X([
26867 RefSelector('eBottom')
26868 ], GridBodyComp.prototype, "eBottom", void 0);
26869 __decorate$X([
26870 RefSelector('gridHeader')
26871 ], GridBodyComp.prototype, "headerRootComp", void 0);
26872 __decorate$X([
26873 PostConstruct
26874 ], GridBodyComp.prototype, "init", null);
26875 return GridBodyComp;
26876}(Component));
26877
26878/**
26879 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
26880 * @version v27.3.0
26881 * @link https://www.ag-grid.com/
26882 * @license MIT
26883 */
26884var __extends$19 = (undefined && undefined.__extends) || (function () {
26885 var extendStatics = function (d, b) {
26886 extendStatics = Object.setPrototypeOf ||
26887 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26888 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26889 return extendStatics(d, b);
26890 };
26891 return function (d, b) {
26892 extendStatics(d, b);
26893 function __() { this.constructor = d; }
26894 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26895 };
26896})();
26897var __decorate$Y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
26898 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26899 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26900 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;
26901 return c > 3 && r && Object.defineProperty(target, key, r), r;
26902};
26903var ScrollVisibleService = /** @class */ (function (_super) {
26904 __extends$19(ScrollVisibleService, _super);
26905 function ScrollVisibleService() {
26906 return _super !== null && _super.apply(this, arguments) || this;
26907 }
26908 ScrollVisibleService.prototype.postConstruct = function () {
26909 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
26910 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this));
26911 };
26912 ScrollVisibleService.prototype.onDisplayedColumnsChanged = function () {
26913 this.update();
26914 };
26915 ScrollVisibleService.prototype.onDisplayedColumnsWidthChanged = function () {
26916 this.update();
26917 };
26918 ScrollVisibleService.prototype.update = function () {
26919 // because of column animation (which takes 200ms), we have to do this twice.
26920 // eg if user removes cols anywhere except at the RHS, then the cols on the RHS
26921 // will animate to the left to fill the gap. this animation means just after
26922 // the cols are removed, the remaining cols are still in the original location
26923 // at the start of the animation, so pre animation the H scrollbar is still needed,
26924 // but post animation it is not.
26925 this.updateImpl();
26926 setTimeout(this.updateImpl.bind(this), 500);
26927 };
26928 ScrollVisibleService.prototype.updateImpl = function () {
26929 var centerRowCtrl = this.ctrlsService.getCenterRowContainerCtrl();
26930 if (!centerRowCtrl) {
26931 return;
26932 }
26933 var params = {
26934 horizontalScrollShowing: centerRowCtrl.isHorizontalScrollShowing(),
26935 verticalScrollShowing: this.isVerticalScrollShowing()
26936 };
26937 this.setScrollsVisible(params);
26938 };
26939 ScrollVisibleService.prototype.setScrollsVisible = function (params) {
26940 var atLeastOneDifferent = this.horizontalScrollShowing !== params.horizontalScrollShowing ||
26941 this.verticalScrollShowing !== params.verticalScrollShowing;
26942 if (atLeastOneDifferent) {
26943 this.horizontalScrollShowing = params.horizontalScrollShowing;
26944 this.verticalScrollShowing = params.verticalScrollShowing;
26945 var event_1 = {
26946 type: Events.EVENT_SCROLL_VISIBILITY_CHANGED,
26947 api: this.gridApi,
26948 columnApi: this.columnApi
26949 };
26950 this.eventService.dispatchEvent(event_1);
26951 }
26952 };
26953 // used by pagination service - to know page height
26954 ScrollVisibleService.prototype.isHorizontalScrollShowing = function () {
26955 return this.horizontalScrollShowing;
26956 };
26957 // used by header container
26958 ScrollVisibleService.prototype.isVerticalScrollShowing = function () {
26959 return this.verticalScrollShowing;
26960 };
26961 __decorate$Y([
26962 Autowired('columnApi')
26963 ], ScrollVisibleService.prototype, "columnApi", void 0);
26964 __decorate$Y([
26965 Autowired('gridApi')
26966 ], ScrollVisibleService.prototype, "gridApi", void 0);
26967 __decorate$Y([
26968 Autowired('ctrlsService')
26969 ], ScrollVisibleService.prototype, "ctrlsService", void 0);
26970 __decorate$Y([
26971 PostConstruct
26972 ], ScrollVisibleService.prototype, "postConstruct", null);
26973 ScrollVisibleService = __decorate$Y([
26974 Bean('scrollVisibleService')
26975 ], ScrollVisibleService);
26976 return ScrollVisibleService;
26977}(BeanStub));
26978
26979/**
26980 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
26981 * @version v27.3.0
26982 * @link https://www.ag-grid.com/
26983 * @license MIT
26984 */
26985var __extends$1a = (undefined && undefined.__extends) || (function () {
26986 var extendStatics = function (d, b) {
26987 extendStatics = Object.setPrototypeOf ||
26988 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26989 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26990 return extendStatics(d, b);
26991 };
26992 return function (d, b) {
26993 extendStatics(d, b);
26994 function __() { this.constructor = d; }
26995 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26996 };
26997})();
26998var __decorate$Z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
26999 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
27000 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
27001 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;
27002 return c > 3 && r && Object.defineProperty(target, key, r), r;
27003};
27004var MouseEventService = /** @class */ (function (_super) {
27005 __extends$1a(MouseEventService, _super);
27006 function MouseEventService() {
27007 var _this = _super !== null && _super.apply(this, arguments) || this;
27008 _this.gridInstanceId = MouseEventService_1.gridInstanceSequence.next();
27009 return _this;
27010 }
27011 MouseEventService_1 = MouseEventService;
27012 // we put the instance id onto the main DOM element. this is used for events, when grids are inside grids,
27013 // so the grid can work out if the even came from this grid or a grid inside this one. see the ctrl+v logic
27014 // for where this is used.
27015 MouseEventService.prototype.stampTopLevelGridCompWithGridInstance = function (eGridDiv) {
27016 eGridDiv[MouseEventService_1.GRID_DOM_KEY] = this.gridInstanceId;
27017 };
27018 MouseEventService.prototype.getRenderedCellForEvent = function (event) {
27019 return getCtrlForEvent(this.gridOptionsWrapper, event, CellCtrl.DOM_DATA_KEY_CELL_CTRL);
27020 };
27021 // walks the path of the event, and returns true if this grid is the first one that it finds. if doing
27022 // master / detail grids, and a child grid is found, then it returns false. this stops things like copy/paste
27023 // getting executed on many grids at the same time.
27024 MouseEventService.prototype.isEventFromThisGrid = function (event) {
27025 var res = this.isElementInThisGrid(event.target);
27026 return res;
27027 };
27028 MouseEventService.prototype.isElementInThisGrid = function (element) {
27029 var pointer = element;
27030 while (pointer) {
27031 var instanceId = pointer[MouseEventService_1.GRID_DOM_KEY];
27032 if (exists(instanceId)) {
27033 var eventFromThisGrid = instanceId === this.gridInstanceId;
27034 return eventFromThisGrid;
27035 }
27036 pointer = pointer.parentElement;
27037 }
27038 return false;
27039 };
27040 MouseEventService.prototype.getCellPositionForEvent = function (event) {
27041 var cellComp = this.getRenderedCellForEvent(event);
27042 return cellComp ? cellComp.getCellPosition() : null;
27043 };
27044 MouseEventService.prototype.getNormalisedPosition = function (event) {
27045 var gridPanelHasScrolls = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_NORMAL;
27046 var e = event;
27047 var x;
27048 var y;
27049 if (e.clientX != null || e.clientY != null) {
27050 x = e.clientX;
27051 y = e.clientY;
27052 }
27053 else {
27054 x = e.x;
27055 y = e.y;
27056 }
27057 if (gridPanelHasScrolls) {
27058 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
27059 var vRange = gridBodyCon.getScrollFeature().getVScrollPosition();
27060 var hRange = gridBodyCon.getScrollFeature().getHScrollPosition();
27061 x += hRange.left;
27062 y += vRange.top;
27063 }
27064 return { x: x, y: y };
27065 };
27066 var MouseEventService_1;
27067 MouseEventService.gridInstanceSequence = new NumberSequence();
27068 MouseEventService.GRID_DOM_KEY = '__ag_grid_instance';
27069 __decorate$Z([
27070 Autowired('ctrlsService')
27071 ], MouseEventService.prototype, "ctrlsService", void 0);
27072 MouseEventService = MouseEventService_1 = __decorate$Z([
27073 Bean('mouseEventService')
27074 ], MouseEventService);
27075 return MouseEventService;
27076}(BeanStub));
27077
27078/**
27079 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
27080 * @version v27.3.0
27081 * @link https://www.ag-grid.com/
27082 * @license MIT
27083 */
27084var __extends$1b = (undefined && undefined.__extends) || (function () {
27085 var extendStatics = function (d, b) {
27086 extendStatics = Object.setPrototypeOf ||
27087 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27088 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27089 return extendStatics(d, b);
27090 };
27091 return function (d, b) {
27092 extendStatics(d, b);
27093 function __() { this.constructor = d; }
27094 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27095 };
27096})();
27097var __assign$c = (undefined && undefined.__assign) || function () {
27098 __assign$c = Object.assign || function(t) {
27099 for (var s, i = 1, n = arguments.length; i < n; i++) {
27100 s = arguments[i];
27101 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
27102 t[p] = s[p];
27103 }
27104 return t;
27105 };
27106 return __assign$c.apply(this, arguments);
27107};
27108var __decorate$_ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
27109 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
27110 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
27111 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;
27112 return c > 3 && r && Object.defineProperty(target, key, r), r;
27113};
27114var NavigationService = /** @class */ (function (_super) {
27115 __extends$1b(NavigationService, _super);
27116 function NavigationService() {
27117 var _this = _super.call(this) || this;
27118 _this.onPageDown = throttle(_this.onPageDown, 100);
27119 _this.onPageUp = throttle(_this.onPageUp, 100);
27120 return _this;
27121 }
27122 NavigationService.prototype.postConstruct = function () {
27123 var _this = this;
27124 this.ctrlsService.whenReady(function (p) {
27125 _this.gridBodyCon = p.gridBodyCtrl;
27126 });
27127 };
27128 NavigationService.prototype.handlePageScrollingKey = function (event) {
27129 var key = event.key;
27130 var alt = event.altKey;
27131 var ctrl = event.ctrlKey || event.metaKey;
27132 var rangeServiceShouldHandleShift = !!this.rangeService && event.shiftKey;
27133 var currentCell = this.mouseEventService.getCellPositionForEvent(event);
27134 if (!currentCell) {
27135 return false;
27136 }
27137 var processed = false;
27138 switch (key) {
27139 case KeyCode.PAGE_HOME:
27140 case KeyCode.PAGE_END:
27141 // handle home and end when ctrl & alt are NOT pressed
27142 if (!ctrl && !alt) {
27143 this.onHomeOrEndKey(key);
27144 processed = true;
27145 }
27146 break;
27147 case KeyCode.LEFT:
27148 case KeyCode.RIGHT:
27149 case KeyCode.UP:
27150 case KeyCode.DOWN:
27151 // handle when ctrl is pressed only, if shift is pressed
27152 // it will be handled by the rangeService
27153 if (ctrl && !alt && !rangeServiceShouldHandleShift) {
27154 this.onCtrlUpDownLeftRight(key, currentCell);
27155 processed = true;
27156 }
27157 break;
27158 case KeyCode.PAGE_DOWN:
27159 // handle page up and page down when ctrl & alt are NOT pressed
27160 if (!ctrl && !alt) {
27161 this.onPageDown(currentCell);
27162 processed = true;
27163 }
27164 break;
27165 case KeyCode.PAGE_UP:
27166 // handle page up and page down when ctrl & alt are NOT pressed
27167 if (!ctrl && !alt) {
27168 this.onPageUp(currentCell);
27169 processed = true;
27170 }
27171 break;
27172 }
27173 if (processed) {
27174 event.preventDefault();
27175 }
27176 return processed;
27177 };
27178 NavigationService.prototype.navigateTo = function (navigateParams) {
27179 var scrollIndex = navigateParams.scrollIndex, scrollType = navigateParams.scrollType, scrollColumn = navigateParams.scrollColumn, focusIndex = navigateParams.focusIndex, focusColumn = navigateParams.focusColumn;
27180 if (exists(scrollColumn) && !scrollColumn.isPinned()) {
27181 this.gridBodyCon.getScrollFeature().ensureColumnVisible(scrollColumn);
27182 }
27183 if (exists(scrollIndex)) {
27184 this.gridBodyCon.getScrollFeature().ensureIndexVisible(scrollIndex, scrollType);
27185 }
27186 // make sure the cell is rendered, needed if we are to focus
27187 this.animationFrameService.flushAllFrames();
27188 // if we don't do this, the range will be left on the last cell, which will leave the last focused cell
27189 // highlighted.
27190 this.focusService.setFocusedCell(focusIndex, focusColumn, null, true);
27191 if (this.rangeService) {
27192 var cellPosition = { rowIndex: focusIndex, rowPinned: null, column: focusColumn };
27193 this.rangeService.setRangeToCell(cellPosition);
27194 }
27195 };
27196 NavigationService.prototype.onPageDown = function (gridCell) {
27197 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
27198 var scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();
27199 var pixelsInOnePage = this.getViewportHeight();
27200 var pagingPixelOffset = this.paginationProxy.getPixelOffset();
27201 var currentPageBottomPixel = scrollPosition.top + pixelsInOnePage;
27202 var currentPageBottomRow = this.paginationProxy.getRowIndexAtPixel(currentPageBottomPixel + pagingPixelOffset);
27203 if (this.columnModel.isAutoRowHeightActive()) {
27204 this.navigateToNextPageWithAutoHeight(gridCell, currentPageBottomRow);
27205 }
27206 else {
27207 this.navigateToNextPage(gridCell, currentPageBottomRow);
27208 }
27209 };
27210 NavigationService.prototype.onPageUp = function (gridCell) {
27211 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
27212 var scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();
27213 var pagingPixelOffset = this.paginationProxy.getPixelOffset();
27214 var currentPageTopPixel = scrollPosition.top;
27215 var currentPageTopRow = this.paginationProxy.getRowIndexAtPixel(currentPageTopPixel + pagingPixelOffset);
27216 if (this.columnModel.isAutoRowHeightActive()) {
27217 this.navigateToNextPageWithAutoHeight(gridCell, currentPageTopRow, true);
27218 }
27219 else {
27220 this.navigateToNextPage(gridCell, currentPageTopRow, true);
27221 }
27222 };
27223 NavigationService.prototype.navigateToNextPage = function (gridCell, scrollIndex, up) {
27224 if (up === void 0) { up = false; }
27225 var _a, _b;
27226 var pixelsInOnePage = this.getViewportHeight();
27227 var firstRow = this.paginationProxy.getPageFirstRow();
27228 var lastRow = this.paginationProxy.getPageLastRow();
27229 var pagingPixelOffset = this.paginationProxy.getPixelOffset();
27230 var currentRowNode = this.paginationProxy.getRow(gridCell.rowIndex);
27231 var rowPixelDiff = up
27232 ? (((_a = currentRowNode) === null || _a === void 0 ? void 0 : _a.rowHeight) - pixelsInOnePage - pagingPixelOffset)
27233 : (pixelsInOnePage - pagingPixelOffset);
27234 var nextCellPixel = ((_b = currentRowNode) === null || _b === void 0 ? void 0 : _b.rowTop) + rowPixelDiff;
27235 var focusIndex = this.paginationProxy.getRowIndexAtPixel(nextCellPixel + pagingPixelOffset);
27236 if (focusIndex === gridCell.rowIndex) {
27237 var diff = up ? -1 : 1;
27238 scrollIndex = focusIndex = gridCell.rowIndex + diff;
27239 }
27240 var scrollType;
27241 if (up) {
27242 scrollType = 'bottom';
27243 if (focusIndex < firstRow) {
27244 focusIndex = firstRow;
27245 }
27246 if (scrollIndex < firstRow) {
27247 scrollIndex = firstRow;
27248 }
27249 }
27250 else {
27251 scrollType = 'top';
27252 if (focusIndex > lastRow) {
27253 focusIndex = lastRow;
27254 }
27255 if (scrollIndex > lastRow) {
27256 scrollIndex = lastRow;
27257 }
27258 }
27259 if (this.isRowTallerThanView(focusIndex)) {
27260 scrollIndex = focusIndex;
27261 scrollType = 'top';
27262 }
27263 this.navigateTo({
27264 scrollIndex: scrollIndex,
27265 scrollType: scrollType,
27266 scrollColumn: null,
27267 focusIndex: focusIndex,
27268 focusColumn: gridCell.column
27269 });
27270 };
27271 NavigationService.prototype.navigateToNextPageWithAutoHeight = function (gridCell, scrollIndex, up) {
27272 var _this = this;
27273 if (up === void 0) { up = false; }
27274 // because autoHeight will calculate the height of rows after scroll
27275 // first we scroll towards the required point, then we add a small
27276 // delay to allow the height to be recalculated, check which index
27277 // should be focused and then finally navigate to that index.
27278 // TODO: we should probably have an event fired once to scrollbar has
27279 // settled and all rowHeights have been calculated instead of relying
27280 // on a setTimeout of 50ms.
27281 this.navigateTo({
27282 scrollIndex: scrollIndex,
27283 scrollType: up ? 'bottom' : 'top',
27284 scrollColumn: null,
27285 focusIndex: scrollIndex,
27286 focusColumn: gridCell.column
27287 });
27288 setTimeout(function () {
27289 var focusIndex = _this.getNextFocusIndexForAutoHeight(gridCell, up);
27290 _this.navigateTo({
27291 scrollIndex: scrollIndex,
27292 scrollType: up ? 'bottom' : 'top',
27293 scrollColumn: null,
27294 focusIndex: focusIndex,
27295 focusColumn: gridCell.column
27296 });
27297 }, 50);
27298 };
27299 NavigationService.prototype.getNextFocusIndexForAutoHeight = function (gridCell, up) {
27300 if (up === void 0) { up = false; }
27301 var _a;
27302 var step = up ? -1 : 1;
27303 var pixelsInOnePage = this.getViewportHeight();
27304 var lastRowIndex = this.paginationProxy.getPageLastRow();
27305 var pixelSum = 0;
27306 var currentIndex = gridCell.rowIndex;
27307 while (currentIndex >= 0 && currentIndex <= lastRowIndex) {
27308 var currentCell = this.paginationProxy.getRow(currentIndex);
27309 if (currentCell) {
27310 var currentCellHeight = (_a = currentCell.rowHeight, (_a !== null && _a !== void 0 ? _a : 0));
27311 if (pixelSum + currentCellHeight > pixelsInOnePage) {
27312 break;
27313 }
27314 pixelSum += currentCellHeight;
27315 }
27316 currentIndex += step;
27317 }
27318 return Math.max(0, Math.min(currentIndex, lastRowIndex));
27319 };
27320 NavigationService.prototype.getViewportHeight = function () {
27321 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
27322 var scrollPosition = gridBodyCon.getScrollFeature().getVScrollPosition();
27323 var scrollbarWidth = this.gridOptionsWrapper.getScrollbarWidth();
27324 var pixelsInOnePage = scrollPosition.bottom - scrollPosition.top;
27325 if (this.ctrlsService.getCenterRowContainerCtrl().isHorizontalScrollShowing()) {
27326 pixelsInOnePage -= scrollbarWidth;
27327 }
27328 return pixelsInOnePage;
27329 };
27330 NavigationService.prototype.isRowTallerThanView = function (rowIndex) {
27331 var rowNode = this.paginationProxy.getRow(rowIndex);
27332 if (!rowNode) {
27333 return false;
27334 }
27335 var rowHeight = rowNode.rowHeight;
27336 if (typeof rowHeight !== 'number') {
27337 return false;
27338 }
27339 return rowHeight > this.getViewportHeight();
27340 };
27341 NavigationService.prototype.onCtrlUpDownLeftRight = function (key, gridCell) {
27342 var cellToFocus = this.cellNavigationService.getNextCellToFocus(key, gridCell, true);
27343 var rowIndex = cellToFocus.rowIndex, column = cellToFocus.column;
27344 this.navigateTo({
27345 scrollIndex: rowIndex,
27346 scrollType: null,
27347 scrollColumn: column,
27348 focusIndex: rowIndex,
27349 focusColumn: column
27350 });
27351 };
27352 // home brings focus to top left cell, end brings focus to bottom right, grid scrolled to bring
27353 // same cell into view (which means either scroll all the way up, or all the way down).
27354 NavigationService.prototype.onHomeOrEndKey = function (key) {
27355 var homeKey = key === KeyCode.PAGE_HOME;
27356 var allColumns = this.columnModel.getAllDisplayedColumns();
27357 var columnToSelect = homeKey ? allColumns[0] : last(allColumns);
27358 var scrollIndex = homeKey ? this.paginationProxy.getPageFirstRow() : this.paginationProxy.getPageLastRow();
27359 this.navigateTo({
27360 scrollIndex: scrollIndex,
27361 scrollType: null,
27362 scrollColumn: columnToSelect,
27363 focusIndex: scrollIndex,
27364 focusColumn: columnToSelect
27365 });
27366 };
27367 // result of keyboard event
27368 NavigationService.prototype.onTabKeyDown = function (previous, keyboardEvent) {
27369 var backwards = keyboardEvent.shiftKey;
27370 var movedToNextCell = this.tabToNextCellCommon(previous, backwards, keyboardEvent);
27371 if (movedToNextCell) {
27372 // only prevent default if we found a cell. so if user is on last cell and hits tab, then we default
27373 // to the normal tabbing so user can exit the grid.
27374 keyboardEvent.preventDefault();
27375 return;
27376 }
27377 // if we didn't move to next cell, then need to tab out of the cells, ie to the header (if going
27378 // backwards)
27379 if (backwards) {
27380 var _a = previous.getRowPosition(), rowIndex = _a.rowIndex, rowPinned = _a.rowPinned;
27381 var firstRow = rowPinned ? rowIndex === 0 : rowIndex === this.paginationProxy.getPageFirstRow();
27382 if (firstRow) {
27383 keyboardEvent.preventDefault();
27384 this.focusService.focusLastHeader(keyboardEvent);
27385 }
27386 }
27387 else {
27388 // if the case it's a popup editor, the focus is on the editor and not the previous cell.
27389 // in order for the tab navigation to work, we need to focus the browser back onto the
27390 // previous cell.
27391 if (previous instanceof CellCtrl) {
27392 previous.focusCell(true);
27393 }
27394 if (this.focusService.focusNextGridCoreContainer(backwards)) {
27395 keyboardEvent.preventDefault();
27396 }
27397 }
27398 };
27399 // comes from API
27400 NavigationService.prototype.tabToNextCell = function (backwards, event) {
27401 var focusedCell = this.focusService.getFocusedCell();
27402 // if no focus, then cannot navigate
27403 if (!focusedCell) {
27404 return false;
27405 }
27406 var cellOrRow = this.getCellByPosition(focusedCell);
27407 // if cell is not rendered, means user has scrolled away from the cell
27408 // or that the focusedCell is a Full Width Row
27409 if (!cellOrRow) {
27410 cellOrRow = this.rowRenderer.getRowByPosition(focusedCell);
27411 if (!cellOrRow || !cellOrRow.isFullWidth()) {
27412 return false;
27413 }
27414 }
27415 return this.tabToNextCellCommon(cellOrRow, backwards, event);
27416 };
27417 NavigationService.prototype.tabToNextCellCommon = function (previous, backwards, event) {
27418 var editing = previous.isEditing();
27419 // if cell is not editing, there is still chance row is editing if it's Full Row Editing
27420 if (!editing && previous instanceof CellCtrl) {
27421 var cell = previous;
27422 var row = cell.getRowCtrl();
27423 if (row) {
27424 editing = row.isEditing();
27425 }
27426 }
27427 var res;
27428 if (editing) {
27429 // if we are editing, we know it's not a Full Width Row (RowComp)
27430 if (this.gridOptionsWrapper.isFullRowEdit()) {
27431 res = this.moveToNextEditingRow(previous, backwards, event);
27432 }
27433 else {
27434 res = this.moveToNextEditingCell(previous, backwards, event);
27435 }
27436 }
27437 else {
27438 res = this.moveToNextCellNotEditing(previous, backwards);
27439 }
27440 // if a cell wasn't found, it's possible that focus was moved to the header
27441 return res || !!this.focusService.getFocusedHeader();
27442 };
27443 NavigationService.prototype.moveToNextEditingCell = function (previousCell, backwards, event) {
27444 if (event === void 0) { event = null; }
27445 var previousPos = previousCell.getCellPosition();
27446 // need to do this before getting next cell to edit, in case the next cell
27447 // has editable function (eg colDef.editable=func() ) and it depends on the
27448 // result of this cell, so need to save updates from the first edit, in case
27449 // the value is referenced in the function.
27450 previousCell.stopEditing();
27451 // find the next cell to start editing
27452 var nextCell = this.findNextCellToFocusOn(previousPos, backwards, true);
27453 if (nextCell == null) {
27454 return false;
27455 }
27456 // only prevent default if we found a cell. so if user is on last cell and hits tab, then we default
27457 // to the normal tabbing so user can exit the grid.
27458 nextCell.startEditing(null, null, true, event);
27459 nextCell.focusCell(false);
27460 return true;
27461 };
27462 NavigationService.prototype.moveToNextEditingRow = function (previousCell, backwards, event) {
27463 if (event === void 0) { event = null; }
27464 var previousPos = previousCell.getCellPosition();
27465 // find the next cell to start editing
27466 var nextCell = this.findNextCellToFocusOn(previousPos, backwards, true);
27467 if (nextCell == null) {
27468 return false;
27469 }
27470 var nextPos = nextCell.getCellPosition();
27471 var previousEditable = this.isCellEditable(previousPos);
27472 var nextEditable = this.isCellEditable(nextPos);
27473 var rowsMatch = nextPos && previousPos.rowIndex === nextPos.rowIndex && previousPos.rowPinned === nextPos.rowPinned;
27474 if (previousEditable) {
27475 previousCell.setFocusOutOnEditor();
27476 }
27477 if (!rowsMatch) {
27478 var pRow = previousCell.getRowCtrl();
27479 pRow.stopEditing();
27480 var nRow = nextCell.getRowCtrl();
27481 nRow.startRowEditing(undefined, undefined, undefined, event);
27482 }
27483 if (nextEditable) {
27484 nextCell.setFocusInOnEditor();
27485 nextCell.focusCell();
27486 }
27487 else {
27488 nextCell.focusCell(true);
27489 }
27490 return true;
27491 };
27492 NavigationService.prototype.moveToNextCellNotEditing = function (previousCell, backwards) {
27493 var displayedColumns = this.columnModel.getAllDisplayedColumns();
27494 var cellPos;
27495 if (previousCell instanceof RowCtrl) {
27496 cellPos = __assign$c(__assign$c({}, previousCell.getRowPosition()), { column: backwards ? displayedColumns[0] : last(displayedColumns) });
27497 }
27498 else {
27499 cellPos = previousCell.getCellPosition();
27500 }
27501 // find the next cell to start editing
27502 var nextCell = this.findNextCellToFocusOn(cellPos, backwards, false);
27503 // only prevent default if we found a cell. so if user is on last cell and hits tab, then we default
27504 // to the normal tabbing so user can exit the grid.
27505 if (nextCell instanceof CellCtrl) {
27506 nextCell.focusCell(true);
27507 }
27508 else if (nextCell) {
27509 return this.tryToFocusFullWidthRow(nextCell.getRowPosition(), backwards);
27510 }
27511 return exists(nextCell);
27512 };
27513 // called by the cell, when tab is pressed while editing.
27514 // @return: RenderedCell when navigation successful, otherwise null
27515 NavigationService.prototype.findNextCellToFocusOn = function (previousPosition, backwards, startEditing) {
27516 var nextPosition = previousPosition;
27517 while (true) {
27518 if (previousPosition !== nextPosition) {
27519 previousPosition = nextPosition;
27520 }
27521 if (!backwards) {
27522 nextPosition = this.getLastCellOfColSpan(nextPosition);
27523 }
27524 nextPosition = this.cellNavigationService.getNextTabbedCell(nextPosition, backwards);
27525 // allow user to override what cell to go to next
27526 var userFunc = this.gridOptionsWrapper.getTabToNextCellFunc();
27527 if (exists(userFunc)) {
27528 var params = {
27529 backwards: backwards,
27530 editing: startEditing,
27531 previousCellPosition: previousPosition,
27532 nextCellPosition: nextPosition ? nextPosition : null
27533 };
27534 var userCell = userFunc(params);
27535 if (exists(userCell)) {
27536 if (userCell.floating) {
27537 doOnce(function () { console.warn("AG Grid: tabToNextCellFunc return type should have attributes: rowIndex, rowPinned, column. However you had 'floating', maybe you meant 'rowPinned'?"); }, 'no floating in userCell');
27538 userCell.rowPinned = userCell.floating;
27539 }
27540 nextPosition = {
27541 rowIndex: userCell.rowIndex,
27542 column: userCell.column,
27543 rowPinned: userCell.rowPinned
27544 };
27545 }
27546 else {
27547 nextPosition = null;
27548 }
27549 }
27550 // if no 'next cell', means we have got to last cell of grid, so nothing to move to,
27551 // so bottom right cell going forwards, or top left going backwards
27552 if (!nextPosition) {
27553 return null;
27554 }
27555 if (nextPosition.rowIndex < 0) {
27556 var headerLen = this.headerNavigationService.getHeaderRowCount();
27557 this.focusService.focusHeaderPosition({
27558 headerPosition: {
27559 headerRowIndex: headerLen + (nextPosition.rowIndex),
27560 column: nextPosition.column
27561 }
27562 });
27563 return null;
27564 }
27565 // if editing, but cell not editable, skip cell. we do this before we do all of
27566 // the 'ensure index visible' and 'flush all frames', otherwise if we are skipping
27567 // a bunch of cells (eg 10 rows) then all the work on ensuring cell visible is useless
27568 // (except for the last one) which causes grid to stall for a while.
27569 // note - for full row edit, we do focus non-editable cells, as the row stays in edit mode.
27570 var fullRowEdit = this.gridOptionsWrapper.isFullRowEdit();
27571 if (startEditing && !fullRowEdit) {
27572 var cellIsEditable = this.isCellEditable(nextPosition);
27573 if (!cellIsEditable) {
27574 continue;
27575 }
27576 }
27577 this.ensureCellVisible(nextPosition);
27578 // we have to call this after ensureColumnVisible - otherwise it could be a virtual column
27579 // or row that is not currently in view, hence the renderedCell would not exist
27580 var nextCell = this.getCellByPosition(nextPosition);
27581 // if next cell is fullWidth row, then no rendered cell,
27582 // as fullWidth rows have no cells, so we skip it
27583 if (!nextCell) {
27584 var row = this.rowRenderer.getRowByPosition(nextPosition);
27585 if (!row || !row.isFullWidth()) {
27586 continue;
27587 }
27588 else {
27589 return row;
27590 }
27591 }
27592 if (nextCell.isSuppressNavigable()) {
27593 continue;
27594 }
27595 // by default, when we click a cell, it gets selected into a range, so to keep keyboard navigation
27596 // consistent, we set into range here also.
27597 if (this.rangeService) {
27598 this.rangeService.setRangeToCell(nextPosition);
27599 }
27600 // we successfully tabbed onto a grid cell, so return true
27601 return nextCell;
27602 }
27603 };
27604 NavigationService.prototype.isCellEditable = function (cell) {
27605 var rowNode = this.lookupRowNodeForCell(cell);
27606 if (rowNode) {
27607 return cell.column.isCellEditable(rowNode);
27608 }
27609 return false;
27610 };
27611 NavigationService.prototype.getCellByPosition = function (cellPosition) {
27612 var rowCtrl = this.rowRenderer.getRowByPosition(cellPosition);
27613 if (!rowCtrl) {
27614 return null;
27615 }
27616 return rowCtrl.getCellCtrl(cellPosition.column);
27617 };
27618 NavigationService.prototype.lookupRowNodeForCell = function (cell) {
27619 if (cell.rowPinned === Constants.PINNED_TOP) {
27620 return this.pinnedRowModel.getPinnedTopRow(cell.rowIndex);
27621 }
27622 if (cell.rowPinned === Constants.PINNED_BOTTOM) {
27623 return this.pinnedRowModel.getPinnedBottomRow(cell.rowIndex);
27624 }
27625 return this.paginationProxy.getRow(cell.rowIndex);
27626 };
27627 // we use index for rows, but column object for columns, as the next column (by index) might not
27628 // be visible (header grouping) so it's not reliable, so using the column object instead.
27629 NavigationService.prototype.navigateToNextCell = function (event, key, currentCell, allowUserOverride) {
27630 // we keep searching for a next cell until we find one. this is how the group rows get skipped
27631 var nextCell = currentCell;
27632 var hitEdgeOfGrid = false;
27633 while (nextCell && (nextCell === currentCell || !this.isValidNavigateCell(nextCell))) {
27634 // if the current cell is spanning across multiple columns, we need to move
27635 // our current position to be the last cell on the right before finding the
27636 // the next target.
27637 if (this.gridOptionsWrapper.isEnableRtl()) {
27638 if (key === KeyCode.LEFT) {
27639 nextCell = this.getLastCellOfColSpan(nextCell);
27640 }
27641 }
27642 else if (key === KeyCode.RIGHT) {
27643 nextCell = this.getLastCellOfColSpan(nextCell);
27644 }
27645 nextCell = this.cellNavigationService.getNextCellToFocus(key, nextCell);
27646 // eg if going down, and nextCell=undefined, means we are gone past the last row
27647 hitEdgeOfGrid = missing(nextCell);
27648 }
27649 if (hitEdgeOfGrid && event && event.key === KeyCode.UP) {
27650 nextCell = {
27651 rowIndex: -1,
27652 rowPinned: null,
27653 column: currentCell.column
27654 };
27655 }
27656 // allow user to override what cell to go to next. when doing normal cell navigation (with keys)
27657 // we allow this, however if processing 'enter after edit' we don't allow override
27658 if (allowUserOverride) {
27659 var userFunc = this.gridOptionsWrapper.getNavigateToNextCellFunc();
27660 if (exists(userFunc)) {
27661 var params = {
27662 key: key,
27663 previousCellPosition: currentCell,
27664 nextCellPosition: nextCell ? nextCell : null,
27665 event: event
27666 };
27667 var userCell = userFunc(params);
27668 if (exists(userCell)) {
27669 if (userCell.floating) {
27670 doOnce(function () { console.warn("AG Grid: tabToNextCellFunc return type should have attributes: rowIndex, rowPinned, column. However you had 'floating', maybe you meant 'rowPinned'?"); }, 'no floating in userCell');
27671 userCell.rowPinned = userCell.floating;
27672 }
27673 nextCell = {
27674 rowPinned: userCell.rowPinned,
27675 rowIndex: userCell.rowIndex,
27676 column: userCell.column
27677 };
27678 }
27679 else {
27680 nextCell = null;
27681 }
27682 }
27683 }
27684 // no next cell means we have reached a grid boundary, eg left, right, top or bottom of grid
27685 if (!nextCell) {
27686 return;
27687 }
27688 if (nextCell.rowIndex < 0) {
27689 var headerLen = this.headerNavigationService.getHeaderRowCount();
27690 this.focusService.focusHeaderPosition({
27691 headerPosition: { headerRowIndex: headerLen + (nextCell.rowIndex), column: currentCell.column },
27692 event: event || undefined
27693 });
27694 return;
27695 }
27696 // in case we have col spanning we get the cellComp and use it to get the
27697 // position. This was we always focus the first cell inside the spanning.
27698 var normalisedPosition = this.getNormalisedPosition(nextCell);
27699 if (normalisedPosition) {
27700 this.focusPosition(normalisedPosition);
27701 }
27702 else {
27703 this.tryToFocusFullWidthRow(nextCell);
27704 }
27705 };
27706 NavigationService.prototype.getNormalisedPosition = function (cellPosition) {
27707 // ensureCellVisible first, to make sure cell at position is rendered.
27708 this.ensureCellVisible(cellPosition);
27709 var cellComp = this.getCellByPosition(cellPosition);
27710 // not guaranteed to have a cellComp when using the SSRM as blocks are loading.
27711 if (!cellComp) {
27712 return null;
27713 }
27714 cellPosition = cellComp.getCellPosition();
27715 // we call this again, as nextCell can be different to it's previous value due to Column Spanning
27716 // (ie if cursor moving from right to left, and cell is spanning columns, then nextCell was the
27717 // last column in the group, however now it's the first column in the group). if we didn't do
27718 // ensureCellVisible again, then we could only be showing the last portion (last column) of the
27719 // merged cells.
27720 this.ensureCellVisible(cellPosition);
27721 return cellPosition;
27722 };
27723 NavigationService.prototype.tryToFocusFullWidthRow = function (position, backwards) {
27724 if (backwards === void 0) { backwards = false; }
27725 var displayedColumns = this.columnModel.getAllDisplayedColumns();
27726 var rowComp = this.rowRenderer.getRowByPosition(position);
27727 if (!rowComp || !rowComp.isFullWidth()) {
27728 return false;
27729 }
27730 var currentCellFocused = this.focusService.getFocusedCell();
27731 var cellPosition = {
27732 rowIndex: position.rowIndex,
27733 rowPinned: position.rowPinned,
27734 column: position.column || (backwards ? last(displayedColumns) : displayedColumns[0])
27735 };
27736 this.focusPosition(cellPosition);
27737 var fromBelow = currentCellFocused != null ? this.rowPositionUtils.before(cellPosition, currentCellFocused) : false;
27738 var focusEvent = {
27739 type: Events.EVENT_FULL_WIDTH_ROW_FOCUSED,
27740 api: this.gridApi,
27741 columnApi: this.columnApi,
27742 rowIndex: cellPosition.rowIndex,
27743 rowPinned: cellPosition.rowPinned,
27744 column: cellPosition.column,
27745 isFullWidthCell: true,
27746 floating: cellPosition.rowPinned,
27747 fromBelow: fromBelow
27748 };
27749 this.eventService.dispatchEvent(focusEvent);
27750 return true;
27751 };
27752 NavigationService.prototype.focusPosition = function (cellPosition) {
27753 this.focusService.setFocusedCell(cellPosition.rowIndex, cellPosition.column, cellPosition.rowPinned, true);
27754 if (this.rangeService) {
27755 this.rangeService.setRangeToCell(cellPosition);
27756 }
27757 };
27758 NavigationService.prototype.isValidNavigateCell = function (cell) {
27759 var rowNode = this.rowPositionUtils.getRowNode(cell);
27760 // we do not allow focusing on detail rows and full width rows
27761 return !!rowNode;
27762 };
27763 NavigationService.prototype.getLastCellOfColSpan = function (cell) {
27764 var cellCtrl = this.getCellByPosition(cell);
27765 if (!cellCtrl) {
27766 return cell;
27767 }
27768 var colSpanningList = cellCtrl.getColSpanningList();
27769 if (colSpanningList.length === 1) {
27770 return cell;
27771 }
27772 return {
27773 rowIndex: cell.rowIndex,
27774 column: last(colSpanningList),
27775 rowPinned: cell.rowPinned
27776 };
27777 };
27778 NavigationService.prototype.ensureCellVisible = function (gridCell) {
27779 // this scrolls the row into view
27780 if (missing(gridCell.rowPinned)) {
27781 this.gridBodyCon.getScrollFeature().ensureIndexVisible(gridCell.rowIndex);
27782 }
27783 if (!gridCell.column.isPinned()) {
27784 this.gridBodyCon.getScrollFeature().ensureColumnVisible(gridCell.column);
27785 }
27786 // need to nudge the scrolls for the floating items. otherwise when we set focus on a non-visible
27787 // floating cell, the scrolls get out of sync
27788 this.gridBodyCon.getScrollFeature().horizontallyScrollHeaderCenterAndFloatingCenter();
27789 // need to flush frames, to make sure the correct cells are rendered
27790 this.animationFrameService.flushAllFrames();
27791 };
27792 __decorate$_([
27793 Autowired('columnApi')
27794 ], NavigationService.prototype, "columnApi", void 0);
27795 __decorate$_([
27796 Autowired('gridApi')
27797 ], NavigationService.prototype, "gridApi", void 0);
27798 __decorate$_([
27799 Autowired('mouseEventService')
27800 ], NavigationService.prototype, "mouseEventService", void 0);
27801 __decorate$_([
27802 Autowired('paginationProxy')
27803 ], NavigationService.prototype, "paginationProxy", void 0);
27804 __decorate$_([
27805 Autowired('focusService')
27806 ], NavigationService.prototype, "focusService", void 0);
27807 __decorate$_([
27808 Autowired('animationFrameService')
27809 ], NavigationService.prototype, "animationFrameService", void 0);
27810 __decorate$_([
27811 Optional('rangeService')
27812 ], NavigationService.prototype, "rangeService", void 0);
27813 __decorate$_([
27814 Autowired('columnModel')
27815 ], NavigationService.prototype, "columnModel", void 0);
27816 __decorate$_([
27817 Autowired('ctrlsService')
27818 ], NavigationService.prototype, "ctrlsService", void 0);
27819 __decorate$_([
27820 Autowired('rowRenderer')
27821 ], NavigationService.prototype, "rowRenderer", void 0);
27822 __decorate$_([
27823 Autowired('headerNavigationService')
27824 ], NavigationService.prototype, "headerNavigationService", void 0);
27825 __decorate$_([
27826 Autowired("rowPositionUtils")
27827 ], NavigationService.prototype, "rowPositionUtils", void 0);
27828 __decorate$_([
27829 Autowired("cellNavigationService")
27830 ], NavigationService.prototype, "cellNavigationService", void 0);
27831 __decorate$_([
27832 Autowired("pinnedRowModel")
27833 ], NavigationService.prototype, "pinnedRowModel", void 0);
27834 __decorate$_([
27835 PostConstruct
27836 ], NavigationService.prototype, "postConstruct", null);
27837 NavigationService = __decorate$_([
27838 Bean('navigationService')
27839 ], NavigationService);
27840 return NavigationService;
27841}(BeanStub));
27842
27843/**
27844 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
27845 * @version v27.3.0
27846 * @link https://www.ag-grid.com/
27847 * @license MIT
27848 */
27849var __extends$1c = (undefined && undefined.__extends) || (function () {
27850 var extendStatics = function (d, b) {
27851 extendStatics = Object.setPrototypeOf ||
27852 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27853 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27854 return extendStatics(d, b);
27855 };
27856 return function (d, b) {
27857 extendStatics(d, b);
27858 function __() { this.constructor = d; }
27859 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27860 };
27861})();
27862var __decorate$$ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
27863 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
27864 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
27865 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;
27866 return c > 3 && r && Object.defineProperty(target, key, r), r;
27867};
27868var PopupEditorWrapper = /** @class */ (function (_super) {
27869 __extends$1c(PopupEditorWrapper, _super);
27870 function PopupEditorWrapper(params) {
27871 var _this = _super.call(this, /* html */ "<div class=\"ag-popup-editor\" tabindex=\"-1\"/>") || this;
27872 _this.params = params;
27873 return _this;
27874 }
27875 PopupEditorWrapper.prototype.postConstruct = function () {
27876 this.gridOptionsWrapper.setDomData(this.getGui(), PopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER, true);
27877 this.addKeyDownListener();
27878 };
27879 PopupEditorWrapper.prototype.addKeyDownListener = function () {
27880 var _this = this;
27881 var eGui = this.getGui();
27882 var params = this.params;
27883 var listener = function (event) {
27884 if (!isUserSuppressingKeyboardEvent(_this.gridOptionsWrapper, event, params.node, params.column, true)) {
27885 params.onKeyDown(event);
27886 }
27887 };
27888 this.addManagedListener(eGui, 'keydown', listener);
27889 };
27890 PopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER = 'popupEditorWrapper';
27891 __decorate$$([
27892 PostConstruct
27893 ], PopupEditorWrapper.prototype, "postConstruct", null);
27894 return PopupEditorWrapper;
27895}(PopupComponent));
27896
27897/**
27898 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
27899 * @version v27.3.0
27900 * @link https://www.ag-grid.com/
27901 * @license MIT
27902 */
27903var __extends$1d = (undefined && undefined.__extends) || (function () {
27904 var extendStatics = function (d, b) {
27905 extendStatics = Object.setPrototypeOf ||
27906 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27907 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27908 return extendStatics(d, b);
27909 };
27910 return function (d, b) {
27911 extendStatics(d, b);
27912 function __() { this.constructor = d; }
27913 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27914 };
27915})();
27916var CellComp = /** @class */ (function (_super) {
27917 __extends$1d(CellComp, _super);
27918 function CellComp(beans, cellCtrl, printLayout, eRow, editingRow) {
27919 var _this = _super.call(this) || this;
27920 // every time we go into edit mode, or back again, this gets incremented.
27921 // it's the components way of dealing with the async nature of framework components,
27922 // so if a framework component takes a while to be created, we know if the object
27923 // is still relevant when creating is finished. eg we could click edit / un-edit 20
27924 // times before the first React edit component comes back - we should discard
27925 // the first 19.
27926 _this.rendererVersion = 0;
27927 _this.editorVersion = 0;
27928 _this.beans = beans;
27929 _this.column = cellCtrl.getColumn();
27930 _this.rowNode = cellCtrl.getRowNode();
27931 _this.rowCtrl = cellCtrl.getRowCtrl();
27932 _this.eRow = eRow;
27933 _this.setTemplate(/* html */ "<div comp-id=\"" + _this.getCompId() + "\"/>");
27934 var eGui = _this.getGui();
27935 _this.forceWrapper = cellCtrl.isForceWrapper();
27936 _this.refreshWrapper(false);
27937 var setAttribute = function (name, value, element) {
27938 var actualElement = element ? element : eGui;
27939 if (value != null && value != '') {
27940 actualElement.setAttribute(name, value);
27941 }
27942 else {
27943 actualElement.removeAttribute(name);
27944 }
27945 };
27946 var compProxy = {
27947 addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
27948 setUserStyles: function (styles) { return addStylesToElement(eGui, styles); },
27949 getFocusableElement: function () { return _this.getFocusableElement(); },
27950 setTabIndex: function (tabIndex) { return setAttribute('tabindex', tabIndex.toString()); },
27951 setRole: function (role) { return setAriaRole(eGui, role); },
27952 setColId: function (colId) { return setAttribute('col-id', colId); },
27953 setTitle: function (title) { return setAttribute('title', title); },
27954 setIncludeSelection: function (include) { return _this.includeSelection = include; },
27955 setIncludeRowDrag: function (include) { return _this.includeRowDrag = include; },
27956 setIncludeDndSource: function (include) { return _this.includeDndSource = include; },
27957 setRenderDetails: function (compDetails, valueToDisplay, force) {
27958 return _this.setRenderDetails(compDetails, valueToDisplay, force);
27959 },
27960 setEditDetails: function (compDetails, popup, position) {
27961 return _this.setEditDetails(compDetails, popup, position);
27962 },
27963 getCellEditor: function () { return _this.cellEditor || null; },
27964 getCellRenderer: function () { return _this.cellRenderer || null; },
27965 getParentOfValue: function () { return _this.getParentOfValue(); }
27966 };
27967 _this.cellCtrl = cellCtrl;
27968 cellCtrl.setComp(compProxy, _this.getGui(), _this.eCellWrapper, printLayout, editingRow);
27969 return _this;
27970 }
27971 CellComp.prototype.getParentOfValue = function () {
27972 if (this.eCellValue) {
27973 // if not editing, and using wrapper, then value goes in eCellValue
27974 return this.eCellValue;
27975 }
27976 if (this.eCellWrapper) {
27977 // if editing, and using wrapper, value (cell editor) goes in eCellWrapper
27978 return this.eCellWrapper;
27979 }
27980 // if editing or rendering, and not using wrapper, value (or comp) is directly inside cell
27981 return this.getGui();
27982 };
27983 CellComp.prototype.setRenderDetails = function (compDetails, valueToDisplay, forceNewCellRendererInstance) {
27984 // this can happen if the users asks for the cell to refresh, but we are not showing the vale as we are editing
27985 var isInlineEditing = this.cellEditor && !this.cellEditorPopupWrapper;
27986 if (isInlineEditing) {
27987 return;
27988 }
27989 // this means firstRender will be true for one pass only, as it's initialised to undefined
27990 this.firstRender = this.firstRender == null;
27991 // if display template has changed, means any previous Cell Renderer is in the wrong location
27992 var controlWrapperChanged = this.refreshWrapper(false);
27993 // all of these have dependencies on the eGui, so only do them after eGui is set
27994 if (compDetails) {
27995 var neverRefresh = forceNewCellRendererInstance || controlWrapperChanged;
27996 var cellRendererRefreshSuccessful = neverRefresh ? false : this.refreshCellRenderer(compDetails);
27997 if (!cellRendererRefreshSuccessful) {
27998 this.destroyRenderer();
27999 this.createCellRendererInstance(compDetails);
28000 }
28001 }
28002 else {
28003 this.destroyRenderer();
28004 this.insertValueWithoutCellRenderer(valueToDisplay);
28005 }
28006 };
28007 CellComp.prototype.setEditDetails = function (compDetails, popup, position) {
28008 if (compDetails) {
28009 this.createCellEditorInstance(compDetails, popup, position);
28010 }
28011 else {
28012 this.destroyEditor();
28013 }
28014 };
28015 CellComp.prototype.removeControls = function () {
28016 this.checkboxSelectionComp = this.beans.context.destroyBean(this.checkboxSelectionComp);
28017 this.dndSourceComp = this.beans.context.destroyBean(this.dndSourceComp);
28018 this.rowDraggingComp = this.beans.context.destroyBean(this.rowDraggingComp);
28019 };
28020 // returns true if wrapper was changed
28021 CellComp.prototype.refreshWrapper = function (editing) {
28022 var providingControls = this.includeRowDrag || this.includeDndSource || this.includeSelection;
28023 var usingWrapper = providingControls || this.forceWrapper;
28024 var putWrapperIn = usingWrapper && this.eCellWrapper == null;
28025 if (putWrapperIn) {
28026 this.eCellWrapper = loadTemplate("<div class=\"ag-cell-wrapper\" role=\"presentation\"></div>");
28027 this.getGui().appendChild(this.eCellWrapper);
28028 }
28029 var takeWrapperOut = !usingWrapper && this.eCellWrapper != null;
28030 if (takeWrapperOut) {
28031 removeFromParent(this.eCellWrapper);
28032 this.eCellWrapper = undefined;
28033 }
28034 this.addOrRemoveCssClass('ag-cell-value', !usingWrapper);
28035 var usingCellValue = !editing && usingWrapper;
28036 var putCellValueIn = usingCellValue && this.eCellValue == null;
28037 if (putCellValueIn) {
28038 this.eCellValue = loadTemplate("<span class=\"ag-cell-value\" role=\"presentation\"></span>");
28039 this.eCellWrapper.appendChild(this.eCellValue);
28040 }
28041 var takeCellValueOut = !usingCellValue && this.eCellValue != null;
28042 if (takeCellValueOut) {
28043 removeFromParent(this.eCellValue);
28044 this.eCellValue = undefined;
28045 }
28046 var templateChanged = putWrapperIn || takeWrapperOut || putCellValueIn || takeCellValueOut;
28047 if (templateChanged) {
28048 this.removeControls();
28049 }
28050 if (!editing && providingControls) {
28051 this.addControls();
28052 }
28053 return templateChanged;
28054 };
28055 CellComp.prototype.addControls = function () {
28056 var id = this.eCellValue.id = "cell-" + this.getCompId();
28057 var describedByIds = [];
28058 if (this.includeRowDrag) {
28059 if (this.rowDraggingComp == null) {
28060 this.rowDraggingComp = this.cellCtrl.createRowDragComp();
28061 if (this.rowDraggingComp) {
28062 // put the checkbox in before the value
28063 this.eCellWrapper.insertBefore(this.rowDraggingComp.getGui(), this.eCellValue);
28064 }
28065 }
28066 }
28067 if (this.includeDndSource) {
28068 if (this.dndSourceComp == null) {
28069 this.dndSourceComp = this.cellCtrl.createDndSource();
28070 // put the checkbox in before the value
28071 this.eCellWrapper.insertBefore(this.dndSourceComp.getGui(), this.eCellValue);
28072 }
28073 }
28074 if (this.includeSelection) {
28075 if (this.checkboxSelectionComp == null) {
28076 this.checkboxSelectionComp = this.cellCtrl.createSelectionCheckbox();
28077 this.eCellWrapper.insertBefore(this.checkboxSelectionComp.getGui(), this.eCellValue);
28078 }
28079 describedByIds.push(this.checkboxSelectionComp.getCheckboxId());
28080 }
28081 describedByIds.push(id);
28082 setAriaDescribedBy(this.getGui(), describedByIds.join(' '));
28083 };
28084 CellComp.prototype.createCellEditorInstance = function (compDetails, popup, position) {
28085 var _this = this;
28086 var versionCopy = this.editorVersion;
28087 var cellEditorPromise = compDetails.newAgStackInstance();
28088 if (!cellEditorPromise) {
28089 return;
28090 } // if empty, userComponentFactory already did a console message
28091 var params = compDetails.params;
28092 cellEditorPromise.then(function (c) { return _this.afterCellEditorCreated(versionCopy, c, params, popup, position); });
28093 // if we don't do this, and editor component is async, then there will be a period
28094 // when the component isn't present and keyboard navigation won't work - so example
28095 // of user hitting tab quickly (more quickly than renderers getting created) won't work
28096 var cellEditorAsync = missing(this.cellEditor);
28097 if (cellEditorAsync && params.cellStartedEdit) {
28098 this.cellCtrl.focusCell(true);
28099 }
28100 };
28101 CellComp.prototype.insertValueWithoutCellRenderer = function (valueToDisplay) {
28102 var eParent = this.getParentOfValue();
28103 clearElement(eParent);
28104 var escapedValue = valueToDisplay != null ? escapeString(valueToDisplay) : null;
28105 if (escapedValue != null) {
28106 eParent.innerHTML = escapedValue;
28107 }
28108 };
28109 CellComp.prototype.destroyEditorAndRenderer = function () {
28110 this.destroyRenderer();
28111 this.destroyEditor();
28112 };
28113 CellComp.prototype.destroyRenderer = function () {
28114 var context = this.beans.context;
28115 this.cellRenderer = context.destroyBean(this.cellRenderer);
28116 removeFromParent(this.cellRendererGui);
28117 this.cellRendererGui = null;
28118 this.rendererVersion++;
28119 };
28120 CellComp.prototype.destroyEditor = function () {
28121 var context = this.beans.context;
28122 if (this.hideEditorPopup) {
28123 this.hideEditorPopup();
28124 }
28125 this.hideEditorPopup = undefined;
28126 this.cellEditor = context.destroyBean(this.cellEditor);
28127 this.cellEditorPopupWrapper = context.destroyBean(this.cellEditorPopupWrapper);
28128 removeFromParent(this.cellEditorGui);
28129 this.cellEditorGui = null;
28130 this.editorVersion++;
28131 };
28132 CellComp.prototype.refreshCellRenderer = function (compClassAndParams) {
28133 if (this.cellRenderer == null || this.cellRenderer.refresh == null) {
28134 return false;
28135 }
28136 // if different Cell Renderer configured this time (eg user is using selector, and
28137 // returns different component) then don't refresh, force recreate of Cell Renderer
28138 if (this.cellRendererClass !== compClassAndParams.componentClass) {
28139 return false;
28140 }
28141 // take any custom params off of the user
28142 var result = this.cellRenderer.refresh(compClassAndParams.params);
28143 // NOTE on undefined: previous version of the cellRenderer.refresh() interface
28144 // returned nothing, if the method existed, we assumed it refreshed. so for
28145 // backwards compatibility, we assume if method exists and returns nothing,
28146 // that it was successful.
28147 return result === true || result === undefined;
28148 };
28149 CellComp.prototype.createCellRendererInstance = function (compDetails) {
28150 var _this = this;
28151 // never use task service if angularCompileRows=true, as that assume the cell renderers
28152 // are finished when the row is created. also we never use it if animation frame service
28153 // is turned off.
28154 // and lastly we never use it if doing auto-height, as the auto-height service checks the
28155 // row height directly after the cell is created, it doesn't wait around for the tasks to complete
28156 var angularCompileRows = this.beans.gridOptionsWrapper.isAngularCompileRows();
28157 var suppressAnimationFrame = this.beans.gridOptionsWrapper.isSuppressAnimationFrame();
28158 var useTaskService = !angularCompileRows && !suppressAnimationFrame;
28159 var displayComponentVersionCopy = this.rendererVersion;
28160 var componentClass = compDetails.componentClass;
28161 var createCellRendererFunc = function () {
28162 var staleTask = _this.rendererVersion !== displayComponentVersionCopy || !_this.isAlive();
28163 if (staleTask) {
28164 return;
28165 }
28166 // this can return null in the event that the user has switched from a renderer component to nothing, for example
28167 // when using a cellRendererSelect to return a component or null depending on row data etc
28168 var componentPromise = compDetails.newAgStackInstance();
28169 var callback = _this.afterCellRendererCreated.bind(_this, displayComponentVersionCopy, componentClass);
28170 if (componentPromise) {
28171 componentPromise.then(callback);
28172 }
28173 };
28174 // we only use task service when rendering for first time, which means it is not used when doing edits.
28175 // if we changed this (always use task service) would make sense, however it would break tests, possibly
28176 // test of users.
28177 if (useTaskService && this.firstRender) {
28178 this.beans.animationFrameService.createTask(createCellRendererFunc, this.rowNode.rowIndex, 'createTasksP2');
28179 }
28180 else {
28181 createCellRendererFunc();
28182 }
28183 };
28184 CellComp.prototype.getCtrl = function () {
28185 return this.cellCtrl;
28186 };
28187 CellComp.prototype.getRowCtrl = function () {
28188 return this.rowCtrl;
28189 };
28190 CellComp.prototype.getCellRenderer = function () {
28191 return this.cellRenderer;
28192 };
28193 CellComp.prototype.getCellEditor = function () {
28194 return this.cellEditor;
28195 };
28196 CellComp.prototype.afterCellRendererCreated = function (cellRendererVersion, cellRendererClass, cellRenderer) {
28197 var staleTask = !this.isAlive() || cellRendererVersion !== this.rendererVersion;
28198 if (staleTask) {
28199 this.beans.context.destroyBean(cellRenderer);
28200 return;
28201 }
28202 this.cellRenderer = cellRenderer;
28203 this.cellRendererClass = cellRendererClass;
28204 this.cellRendererGui = this.cellRenderer.getGui();
28205 if (this.cellRendererGui != null) {
28206 var eParent = this.getParentOfValue();
28207 clearElement(eParent);
28208 eParent.appendChild(this.cellRendererGui);
28209 }
28210 };
28211 CellComp.prototype.afterCellEditorCreated = function (requestVersion, cellEditor, params, popup, position) {
28212 // if editingCell=false, means user cancelled the editor before component was ready.
28213 // if versionMismatch, then user cancelled the edit, then started the edit again, and this
28214 // is the first editor which is now stale.
28215 var staleComp = requestVersion !== this.editorVersion;
28216 if (staleComp) {
28217 this.beans.context.destroyBean(cellEditor);
28218 return;
28219 }
28220 var editingCancelledByUserComp = cellEditor.isCancelBeforeStart && cellEditor.isCancelBeforeStart();
28221 if (editingCancelledByUserComp) {
28222 this.beans.context.destroyBean(cellEditor);
28223 this.cellCtrl.stopEditing();
28224 return;
28225 }
28226 if (!cellEditor.getGui) {
28227 console.warn("AG Grid: cellEditor for column " + this.column.getId() + " is missing getGui() method");
28228 this.beans.context.destroyBean(cellEditor);
28229 return;
28230 }
28231 this.cellEditor = cellEditor;
28232 this.cellEditorGui = cellEditor.getGui();
28233 var cellEditorInPopup = popup || (cellEditor.isPopup !== undefined && cellEditor.isPopup());
28234 if (cellEditorInPopup) {
28235 if (!popup) {
28236 this.cellCtrl.hackSayEditingInPopup();
28237 }
28238 this.addPopupCellEditor(params, position);
28239 }
28240 else {
28241 this.addInCellEditor();
28242 }
28243 if (cellEditor.afterGuiAttached) {
28244 cellEditor.afterGuiAttached();
28245 }
28246 };
28247 CellComp.prototype.addInCellEditor = function () {
28248 var eGui = this.getGui();
28249 // if focus is inside the cell, we move focus to the cell itself
28250 // before removing it's contents, otherwise errors could be thrown.
28251 var eDocument = this.beans.gridOptionsWrapper.getDocument();
28252 if (eGui.contains(eDocument.activeElement)) {
28253 eGui.focus();
28254 }
28255 this.destroyRenderer();
28256 this.refreshWrapper(true);
28257 this.clearParentOfValue();
28258 if (this.cellEditorGui) {
28259 var eParent = this.getParentOfValue();
28260 eParent.appendChild(this.cellEditorGui);
28261 }
28262 };
28263 CellComp.prototype.addPopupCellEditor = function (params, position) {
28264 var _this = this;
28265 if (this.beans.gridOptionsWrapper.isFullRowEdit()) {
28266 console.warn('AG Grid: popup cellEditor does not work with fullRowEdit - you cannot use them both ' +
28267 '- either turn off fullRowEdit, or stop using popup editors.');
28268 }
28269 var cellEditor = this.cellEditor;
28270 // if a popup, then we wrap in a popup editor and return the popup
28271 this.cellEditorPopupWrapper = this.beans.context.createBean(new PopupEditorWrapper(params));
28272 var ePopupGui = this.cellEditorPopupWrapper.getGui();
28273 if (this.cellEditorGui) {
28274 ePopupGui.appendChild(this.cellEditorGui);
28275 }
28276 var popupService = this.beans.popupService;
28277 var useModelPopup = this.beans.gridOptionsWrapper.isStopEditingWhenCellsLoseFocus();
28278 // see if position provided by colDef, if not then check old way of method on cellComp
28279 var positionToUse = position != null ? position : cellEditor.getPopupPosition ? cellEditor.getPopupPosition() : 'over';
28280 var positionParams = {
28281 column: this.column,
28282 rowNode: this.rowNode,
28283 type: 'popupCellEditor',
28284 eventSource: this.getGui(),
28285 ePopup: ePopupGui,
28286 keepWithinBounds: true
28287 };
28288 var positionCallback = positionToUse === 'under' ?
28289 popupService.positionPopupUnderComponent.bind(popupService, positionParams)
28290 : popupService.positionPopupOverComponent.bind(popupService, positionParams);
28291 var translate = this.beans.gridOptionsWrapper.getLocaleTextFunc();
28292 var addPopupRes = popupService.addPopup({
28293 modal: useModelPopup,
28294 eChild: ePopupGui,
28295 closeOnEsc: true,
28296 closedCallback: function () { _this.cellCtrl.onPopupEditorClosed(); },
28297 anchorToElement: this.getGui(),
28298 positionCallback: positionCallback,
28299 ariaLabel: translate('ariaLabelCellEditor', 'Cell Editor')
28300 });
28301 if (addPopupRes) {
28302 this.hideEditorPopup = addPopupRes.hideFunc;
28303 }
28304 };
28305 CellComp.prototype.detach = function () {
28306 this.eRow.removeChild(this.getGui());
28307 };
28308 // if the row is also getting destroyed, then we don't need to remove from dom,
28309 // as the row will also get removed, so no need to take out the cells from the row
28310 // if the row is going (removing is an expensive operation, so only need to remove
28311 // the top part)
28312 //
28313 // note - this is NOT called by context, as we don't wire / unwire the CellComp for performance reasons.
28314 CellComp.prototype.destroy = function () {
28315 this.cellCtrl.stopEditing();
28316 this.destroyEditorAndRenderer();
28317 this.removeControls();
28318 _super.prototype.destroy.call(this);
28319 };
28320 CellComp.prototype.clearParentOfValue = function () {
28321 var eGui = this.getGui();
28322 // if focus is inside the cell, we move focus to the cell itself
28323 // before removing it's contents, otherwise errors could be thrown.
28324 var eDocument = this.beans.gridOptionsWrapper.getDocument();
28325 if (eGui.contains(eDocument.activeElement)) {
28326 eGui.focus({
28327 preventScroll: true
28328 });
28329 }
28330 clearElement(this.getParentOfValue());
28331 };
28332 return CellComp;
28333}(Component));
28334
28335/**
28336 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
28337 * @version v27.3.0
28338 * @link https://www.ag-grid.com/
28339 * @license MIT
28340 */
28341var __extends$1e = (undefined && undefined.__extends) || (function () {
28342 var extendStatics = function (d, b) {
28343 extendStatics = Object.setPrototypeOf ||
28344 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28345 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
28346 return extendStatics(d, b);
28347 };
28348 return function (d, b) {
28349 extendStatics(d, b);
28350 function __() { this.constructor = d; }
28351 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28352 };
28353})();
28354var RowComp = /** @class */ (function (_super) {
28355 __extends$1e(RowComp, _super);
28356 function RowComp(ctrl, beans, containerType) {
28357 var _this = _super.call(this) || this;
28358 _this.cellComps = {};
28359 _this.beans = beans;
28360 _this.rowCtrl = ctrl;
28361 _this.setTemplate(/* html */ "<div comp-id=\"" + _this.getCompId() + "\" style=\"" + _this.getInitialStyle() + "\"/>");
28362 var eGui = _this.getGui();
28363 var style = eGui.style;
28364 var compProxy = {
28365 setDomOrder: function (domOrder) { return _this.domOrder = domOrder; },
28366 setCellCtrls: function (cellCtrls) { return _this.setCellCtrls(cellCtrls); },
28367 showFullWidth: function (compDetails) { return _this.showFullWidth(compDetails); },
28368 getFullWidthCellRenderer: function () { return _this.getFullWidthCellRenderer(); },
28369 addOrRemoveCssClass: function (name, on) { return _this.addOrRemoveCssClass(name, on); },
28370 setUserStyles: function (styles) { return addStylesToElement(eGui, styles); },
28371 setTop: function (top) { return style.top = top; },
28372 setTransform: function (transform) { return style.transform = transform; },
28373 setRowIndex: function (rowIndex) { return eGui.setAttribute('row-index', rowIndex); },
28374 setRole: function (role) { return setAriaRole(eGui, role); },
28375 setRowId: function (rowId) { return eGui.setAttribute('row-id', rowId); },
28376 setRowBusinessKey: function (businessKey) { return eGui.setAttribute('row-business-key', businessKey); },
28377 setTabIndex: function (tabIndex) { return eGui.setAttribute('tabindex', tabIndex.toString()); }
28378 };
28379 ctrl.setComp(compProxy, _this.getGui(), containerType);
28380 return _this;
28381 }
28382 RowComp.prototype.getInitialStyle = function () {
28383 var transform = this.rowCtrl.getInitialTransform();
28384 var top = this.rowCtrl.getInitialRowTop();
28385 return transform ? "transform: " + transform : "top: " + top;
28386 };
28387 RowComp.prototype.showFullWidth = function (compDetails) {
28388 var _this = this;
28389 var callback = function (cellRenderer) {
28390 if (_this.isAlive()) {
28391 var eGui = cellRenderer.getGui();
28392 _this.getGui().appendChild(eGui);
28393 _this.rowCtrl.setupDetailRowAutoHeight(eGui);
28394 _this.setFullWidthRowComp(cellRenderer);
28395 }
28396 else {
28397 _this.beans.context.destroyBean(cellRenderer);
28398 }
28399 };
28400 // if not in cache, create new one
28401 var res = compDetails.newAgStackInstance();
28402 if (!res) {
28403 return;
28404 }
28405 res.then(callback);
28406 };
28407 RowComp.prototype.setCellCtrls = function (cellCtrls) {
28408 var _this = this;
28409 var cellsToRemove = Object.assign({}, this.cellComps);
28410 cellCtrls.forEach(function (cellCtrl) {
28411 var key = cellCtrl.getInstanceId();
28412 var existingCellComp = _this.cellComps[key];
28413 if (existingCellComp == null) {
28414 _this.newCellComp(cellCtrl);
28415 }
28416 else {
28417 cellsToRemove[key] = null;
28418 }
28419 });
28420 var cellCompsToRemove = getAllValuesInObject(cellsToRemove)
28421 .filter(function (cellComp) { return cellComp != null; });
28422 this.destroyCells(cellCompsToRemove);
28423 this.ensureDomOrder(cellCtrls);
28424 };
28425 RowComp.prototype.ensureDomOrder = function (cellCtrls) {
28426 var _this = this;
28427 if (!this.domOrder) {
28428 return;
28429 }
28430 var elementsInOrder = [];
28431 cellCtrls.forEach(function (cellCtrl) {
28432 var cellComp = _this.cellComps[cellCtrl.getInstanceId()];
28433 if (cellComp) {
28434 elementsInOrder.push(cellComp.getGui());
28435 }
28436 });
28437 setDomChildOrder(this.getGui(), elementsInOrder);
28438 };
28439 RowComp.prototype.newCellComp = function (cellCtrl) {
28440 var cellComp = new CellComp(this.beans, cellCtrl, this.rowCtrl.isPrintLayout(), this.getGui(), this.rowCtrl.isEditing());
28441 this.cellComps[cellCtrl.getInstanceId()] = cellComp;
28442 this.getGui().appendChild(cellComp.getGui());
28443 };
28444 RowComp.prototype.destroy = function () {
28445 _super.prototype.destroy.call(this);
28446 this.destroyAllCells();
28447 };
28448 RowComp.prototype.destroyAllCells = function () {
28449 var cellsToDestroy = getAllValuesInObject(this.cellComps).filter(function (cp) { return cp != null; });
28450 this.destroyCells(cellsToDestroy);
28451 };
28452 RowComp.prototype.setFullWidthRowComp = function (fullWidthRowComponent) {
28453 var _this = this;
28454 if (this.fullWidthCellRenderer) {
28455 console.error('AG Grid - should not be setting fullWidthRowComponent twice');
28456 }
28457 this.fullWidthCellRenderer = fullWidthRowComponent;
28458 this.addDestroyFunc(function () {
28459 _this.fullWidthCellRenderer = _this.beans.context.destroyBean(_this.fullWidthCellRenderer);
28460 });
28461 };
28462 RowComp.prototype.getFullWidthCellRenderer = function () {
28463 return this.fullWidthCellRenderer;
28464 };
28465 RowComp.prototype.destroyCells = function (cellComps) {
28466 var _this = this;
28467 cellComps.forEach(function (cellComp) {
28468 // could be old reference, ie removed cell
28469 if (!cellComp) {
28470 return;
28471 }
28472 // check cellComp belongs in this container
28473 var instanceId = cellComp.getCtrl().getInstanceId();
28474 if (_this.cellComps[instanceId] !== cellComp) {
28475 return;
28476 }
28477 cellComp.detach();
28478 cellComp.destroy();
28479 _this.cellComps[instanceId] = null;
28480 });
28481 };
28482 return RowComp;
28483}(Component));
28484
28485/**
28486 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
28487 * @version v27.3.0
28488 * @link https://www.ag-grid.com/
28489 * @license MIT
28490 */
28491var __extends$1f = (undefined && undefined.__extends) || (function () {
28492 var extendStatics = function (d, b) {
28493 extendStatics = Object.setPrototypeOf ||
28494 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28495 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
28496 return extendStatics(d, b);
28497 };
28498 return function (d, b) {
28499 extendStatics(d, b);
28500 function __() { this.constructor = d; }
28501 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28502 };
28503})();
28504var __assign$d = (undefined && undefined.__assign) || function () {
28505 __assign$d = Object.assign || function(t) {
28506 for (var s, i = 1, n = arguments.length; i < n; i++) {
28507 s = arguments[i];
28508 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
28509 t[p] = s[p];
28510 }
28511 return t;
28512 };
28513 return __assign$d.apply(this, arguments);
28514};
28515var __decorate$10 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
28516 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28517 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
28518 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;
28519 return c > 3 && r && Object.defineProperty(target, key, r), r;
28520};
28521function templateFactory() {
28522 var name = Component.elementGettingCreated.getAttribute('name');
28523 var cssClasses = RowContainerCtrl.getRowContainerCssClasses(name);
28524 var res;
28525 var template1 = name === exports.RowContainerName.CENTER;
28526 var template2 = name === exports.RowContainerName.TOP_CENTER || name === exports.RowContainerName.BOTTOM_CENTER;
28527 if (template1) {
28528 res = /* html */
28529 "<div class=\"" + cssClasses.wrapper + "\" ref=\"eWrapper\" role=\"presentation\">\n <div class=\"" + cssClasses.viewport + "\" ref=\"eViewport\" role=\"presentation\">\n <div class=\"" + cssClasses.container + "\" ref=\"eContainer\"></div>\n </div>\n </div>";
28530 }
28531 else if (template2) {
28532 res = /* html */
28533 "<div class=\"" + cssClasses.viewport + "\" ref=\"eViewport\" role=\"presentation\">\n <div class=\"" + cssClasses.container + "\" ref=\"eContainer\"></div>\n </div>";
28534 }
28535 else {
28536 res = /* html */
28537 "<div class=\"" + cssClasses.container + "\" ref=\"eContainer\"></div>";
28538 }
28539 return res;
28540}
28541var RowContainerComp = /** @class */ (function (_super) {
28542 __extends$1f(RowContainerComp, _super);
28543 function RowContainerComp() {
28544 var _this = _super.call(this, templateFactory()) || this;
28545 _this.rowComps = {};
28546 _this.name = Component.elementGettingCreated.getAttribute('name');
28547 _this.type = getRowContainerTypeForName(_this.name);
28548 return _this;
28549 }
28550 RowContainerComp.prototype.postConstruct = function () {
28551 var _this = this;
28552 var compProxy = {
28553 setViewportHeight: function (height) { return _this.eViewport.style.height = height; },
28554 setRowCtrls: function (rowCtrls) { return _this.setRowCtrls(rowCtrls); },
28555 setDomOrder: function (domOrder) {
28556 _this.domOrder = domOrder;
28557 },
28558 setContainerWidth: function (width) { return _this.eContainer.style.width = width; }
28559 };
28560 var ctrl = this.createManagedBean(new RowContainerCtrl(this.name));
28561 ctrl.setComp(compProxy, this.eContainer, this.eViewport, this.eWrapper);
28562 };
28563 RowContainerComp.prototype.preDestroy = function () {
28564 // destroys all row comps
28565 this.setRowCtrls([]);
28566 };
28567 RowContainerComp.prototype.setRowCtrls = function (rowCtrls) {
28568 var _this = this;
28569 var oldRows = __assign$d({}, this.rowComps);
28570 this.rowComps = {};
28571 this.lastPlacedElement = null;
28572 var processRow = function (rowCon) {
28573 var instanceId = rowCon.getInstanceId();
28574 var existingRowComp = oldRows[instanceId];
28575 if (existingRowComp) {
28576 _this.rowComps[instanceId] = existingRowComp;
28577 delete oldRows[instanceId];
28578 _this.ensureDomOrder(existingRowComp.getGui());
28579 }
28580 else {
28581 var rowComp = _this.newRowComp(rowCon);
28582 _this.rowComps[instanceId] = rowComp;
28583 _this.appendRow(rowComp.getGui());
28584 }
28585 };
28586 rowCtrls.forEach(processRow);
28587 getAllValuesInObject(oldRows).forEach(function (oldRowComp) {
28588 _this.eContainer.removeChild(oldRowComp.getGui());
28589 oldRowComp.destroy();
28590 });
28591 setAriaRole(this.eContainer, rowCtrls.length ? "rowgroup" : "presentation");
28592 };
28593 RowContainerComp.prototype.appendRow = function (element) {
28594 if (this.domOrder) {
28595 insertWithDomOrder(this.eContainer, element, this.lastPlacedElement);
28596 }
28597 else {
28598 this.eContainer.appendChild(element);
28599 }
28600 this.lastPlacedElement = element;
28601 };
28602 RowContainerComp.prototype.ensureDomOrder = function (eRow) {
28603 if (this.domOrder) {
28604 ensureDomOrder(this.eContainer, eRow, this.lastPlacedElement);
28605 this.lastPlacedElement = eRow;
28606 }
28607 };
28608 RowContainerComp.prototype.newRowComp = function (rowCtrl) {
28609 var pinned = RowContainerCtrl.getPinned(this.name);
28610 var res = new RowComp(rowCtrl, this.beans, this.type);
28611 return res;
28612 };
28613 __decorate$10([
28614 Autowired('beans')
28615 ], RowContainerComp.prototype, "beans", void 0);
28616 __decorate$10([
28617 RefSelector('eViewport')
28618 ], RowContainerComp.prototype, "eViewport", void 0);
28619 __decorate$10([
28620 RefSelector('eContainer')
28621 ], RowContainerComp.prototype, "eContainer", void 0);
28622 __decorate$10([
28623 RefSelector('eWrapper')
28624 ], RowContainerComp.prototype, "eWrapper", void 0);
28625 __decorate$10([
28626 PostConstruct
28627 ], RowContainerComp.prototype, "postConstruct", null);
28628 __decorate$10([
28629 PreDestroy
28630 ], RowContainerComp.prototype, "preDestroy", null);
28631 return RowContainerComp;
28632}(Component));
28633
28634/**
28635 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
28636 * @version v27.3.0
28637 * @link https://www.ag-grid.com/
28638 * @license MIT
28639 */
28640var __decorate$11 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
28641 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28642 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
28643 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;
28644 return c > 3 && r && Object.defineProperty(target, key, r), r;
28645};
28646var BodyDropPivotTarget = /** @class */ (function () {
28647 function BodyDropPivotTarget(pinned) {
28648 this.columnsToAggregate = [];
28649 this.columnsToGroup = [];
28650 this.columnsToPivot = [];
28651 this.pinned = pinned;
28652 }
28653 /** Callback for when drag enters */
28654 BodyDropPivotTarget.prototype.onDragEnter = function (draggingEvent) {
28655 var _this = this;
28656 this.clearColumnsList();
28657 // in pivot mode, we don't accept any drops if functions are read only
28658 if (this.gridOptionsWrapper.isFunctionsReadOnly()) {
28659 return;
28660 }
28661 var dragColumns = draggingEvent.dragItem.columns;
28662 if (!dragColumns) {
28663 return;
28664 }
28665 dragColumns.forEach(function (column) {
28666 // we don't allow adding secondary columns
28667 if (!column.isPrimary()) {
28668 return;
28669 }
28670 if (column.isAnyFunctionActive()) {
28671 return;
28672 }
28673 if (column.isAllowValue()) {
28674 _this.columnsToAggregate.push(column);
28675 }
28676 else if (column.isAllowRowGroup()) {
28677 _this.columnsToGroup.push(column);
28678 }
28679 else if (column.isAllowPivot()) {
28680 _this.columnsToPivot.push(column);
28681 }
28682 });
28683 };
28684 BodyDropPivotTarget.prototype.getIconName = function () {
28685 var totalColumns = this.columnsToAggregate.length + this.columnsToGroup.length + this.columnsToPivot.length;
28686 if (totalColumns > 0) {
28687 return this.pinned ? DragAndDropService.ICON_PINNED : DragAndDropService.ICON_MOVE;
28688 }
28689 return null;
28690 };
28691 /** Callback for when drag leaves */
28692 BodyDropPivotTarget.prototype.onDragLeave = function (draggingEvent) {
28693 // if we are taking columns out of the center, then we remove them from the report
28694 this.clearColumnsList();
28695 };
28696 BodyDropPivotTarget.prototype.clearColumnsList = function () {
28697 this.columnsToAggregate.length = 0;
28698 this.columnsToGroup.length = 0;
28699 this.columnsToPivot.length = 0;
28700 };
28701 /** Callback for when dragging */
28702 BodyDropPivotTarget.prototype.onDragging = function (draggingEvent) {
28703 };
28704 /** Callback for when drag stops */
28705 BodyDropPivotTarget.prototype.onDragStop = function (draggingEvent) {
28706 if (this.columnsToAggregate.length > 0) {
28707 this.columnModel.addValueColumns(this.columnsToAggregate, "toolPanelDragAndDrop");
28708 }
28709 if (this.columnsToGroup.length > 0) {
28710 this.columnModel.addRowGroupColumns(this.columnsToGroup, "toolPanelDragAndDrop");
28711 }
28712 if (this.columnsToPivot.length > 0) {
28713 this.columnModel.addPivotColumns(this.columnsToPivot, "toolPanelDragAndDrop");
28714 }
28715 };
28716 __decorate$11([
28717 Autowired('columnModel')
28718 ], BodyDropPivotTarget.prototype, "columnModel", void 0);
28719 __decorate$11([
28720 Autowired('gridOptionsWrapper')
28721 ], BodyDropPivotTarget.prototype, "gridOptionsWrapper", void 0);
28722 return BodyDropPivotTarget;
28723}());
28724
28725/**
28726 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
28727 * @version v27.3.0
28728 * @link https://www.ag-grid.com/
28729 * @license MIT
28730 */
28731var __decorate$12 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
28732 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28733 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
28734 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;
28735 return c > 3 && r && Object.defineProperty(target, key, r), r;
28736};
28737var MoveColumnFeature = /** @class */ (function () {
28738 function MoveColumnFeature(pinned, eContainer) {
28739 this.needToMoveLeft = false;
28740 this.needToMoveRight = false;
28741 this.pinned = pinned;
28742 this.eContainer = eContainer;
28743 this.centerContainer = !exists(pinned);
28744 }
28745 MoveColumnFeature.prototype.init = function () {
28746 var _this = this;
28747 this.ctrlsService.whenReady(function () {
28748 _this.gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
28749 });
28750 };
28751 MoveColumnFeature.prototype.getIconName = function () {
28752 return this.pinned ? DragAndDropService.ICON_PINNED : DragAndDropService.ICON_MOVE;
28753 };
28754 MoveColumnFeature.prototype.onDragEnter = function (draggingEvent) {
28755 // we do dummy drag, so make sure column appears in the right location when first placed
28756 var columns = draggingEvent.dragItem.columns;
28757 var dragCameFromToolPanel = draggingEvent.dragSource.type === exports.DragSourceType.ToolPanel;
28758 if (dragCameFromToolPanel) {
28759 // the if statement doesn't work if drag leaves grid, then enters again
28760 this.setColumnsVisible(columns, true, "uiColumnDragged");
28761 }
28762 else {
28763 // restore previous state of visible columns upon re-entering. this means if the user drags
28764 // a group out, and then drags the group back in, only columns that were originally visible
28765 // will be visible again. otherwise a group with three columns (but only two visible) could
28766 // be dragged out, then when it's dragged in again, all three are visible. this stops that.
28767 var visibleState_1 = draggingEvent.dragItem.visibleState;
28768 var visibleColumns = (columns || []).filter(function (column) { return visibleState_1[column.getId()]; });
28769 this.setColumnsVisible(visibleColumns, true, "uiColumnDragged");
28770 }
28771 this.setColumnsPinned(columns, this.pinned, "uiColumnDragged");
28772 this.onDragging(draggingEvent, true);
28773 };
28774 MoveColumnFeature.prototype.onDragLeave = function (draggingEvent) {
28775 var hideColumnOnExit = !this.gridOptionsWrapper.isSuppressDragLeaveHidesColumns() && !draggingEvent.fromNudge;
28776 if (hideColumnOnExit) {
28777 var dragItem = draggingEvent.dragSource.getDragItem();
28778 var columns = dragItem.columns;
28779 this.setColumnsVisible(columns, false, "uiColumnDragged");
28780 }
28781 this.ensureIntervalCleared();
28782 };
28783 MoveColumnFeature.prototype.setColumnsVisible = function (columns, visible, source) {
28784 if (source === void 0) { source = "api"; }
28785 if (columns) {
28786 var allowedCols = columns.filter(function (c) { return !c.getColDef().lockVisible; });
28787 this.columnModel.setColumnsVisible(allowedCols, visible, source);
28788 }
28789 };
28790 MoveColumnFeature.prototype.setColumnsPinned = function (columns, pinned, source) {
28791 if (source === void 0) { source = "api"; }
28792 if (columns) {
28793 var allowedCols = columns.filter(function (c) { return !c.getColDef().lockPinned; });
28794 this.columnModel.setColumnsPinned(allowedCols, pinned, source);
28795 }
28796 };
28797 MoveColumnFeature.prototype.onDragStop = function () {
28798 this.ensureIntervalCleared();
28799 };
28800 MoveColumnFeature.prototype.normaliseX = function (x) {
28801 // flip the coordinate if doing RTL
28802 if (this.gridOptionsWrapper.isEnableRtl()) {
28803 var clientWidth = this.eContainer.clientWidth;
28804 x = clientWidth - x;
28805 }
28806 // adjust for scroll only if centre container (the pinned containers don't scroll)
28807 if (this.centerContainer) {
28808 x += this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft();
28809 }
28810 return x;
28811 };
28812 MoveColumnFeature.prototype.checkCenterForScrolling = function (xAdjustedForScroll) {
28813 if (this.centerContainer) {
28814 // scroll if the mouse has gone outside the grid (or just outside the scrollable part if pinning)
28815 // putting in 50 buffer, so even if user gets to edge of grid, a scroll will happen
28816 var firstVisiblePixel = this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft();
28817 var lastVisiblePixel = firstVisiblePixel + this.ctrlsService.getCenterRowContainerCtrl().getCenterWidth();
28818 if (this.gridOptionsWrapper.isEnableRtl()) {
28819 this.needToMoveRight = xAdjustedForScroll < (firstVisiblePixel + 50);
28820 this.needToMoveLeft = xAdjustedForScroll > (lastVisiblePixel - 50);
28821 }
28822 else {
28823 this.needToMoveLeft = xAdjustedForScroll < (firstVisiblePixel + 50);
28824 this.needToMoveRight = xAdjustedForScroll > (lastVisiblePixel - 50);
28825 }
28826 if (this.needToMoveLeft || this.needToMoveRight) {
28827 this.ensureIntervalStarted();
28828 }
28829 else {
28830 this.ensureIntervalCleared();
28831 }
28832 }
28833 };
28834 MoveColumnFeature.prototype.onDragging = function (draggingEvent, fromEnter) {
28835 var _this = this;
28836 if (fromEnter === void 0) { fromEnter = false; }
28837 this.lastDraggingEvent = draggingEvent;
28838 // if moving up or down (ie not left or right) then do nothing
28839 if (missing(draggingEvent.hDirection)) {
28840 return;
28841 }
28842 var mouseXNormalised = this.normaliseX(draggingEvent.x);
28843 // if the user is dragging into the panel, ie coming from the side panel into the main grid,
28844 // we don't want to scroll the grid this time, it would appear like the table is jumping
28845 // each time a column is dragged in.
28846 if (!fromEnter) {
28847 this.checkCenterForScrolling(mouseXNormalised);
28848 }
28849 var hDirectionNormalised = this.normaliseDirection(draggingEvent.hDirection);
28850 var dragSourceType = draggingEvent.dragSource.type;
28851 var columnsToMove = draggingEvent.dragSource.getDragItem().columns;
28852 columnsToMove = columnsToMove.filter(function (col) {
28853 if (col.getColDef().lockPinned) {
28854 // if locked return true only if both col and container are same pin type.
28855 // double equals (==) here on purpose so that null==undefined is true (for not pinned options)
28856 return col.getPinned() == _this.pinned;
28857 }
28858 // if not pin locked, then always allowed to be in this container
28859 return true;
28860 });
28861 this.attemptMoveColumns(dragSourceType, columnsToMove, hDirectionNormalised, mouseXNormalised, fromEnter);
28862 };
28863 MoveColumnFeature.prototype.normaliseDirection = function (hDirection) {
28864 if (this.gridOptionsWrapper.isEnableRtl()) {
28865 switch (hDirection) {
28866 case exports.HorizontalDirection.Left: return exports.HorizontalDirection.Right;
28867 case exports.HorizontalDirection.Right: return exports.HorizontalDirection.Left;
28868 default: console.error("AG Grid: Unknown direction " + hDirection);
28869 }
28870 }
28871 else {
28872 return hDirection;
28873 }
28874 };
28875 // returns the index of the first column in the list ONLY if the cols are all beside
28876 // each other. if the cols are not beside each other, then returns null
28877 MoveColumnFeature.prototype.calculateOldIndex = function (movingCols) {
28878 var gridCols = this.columnModel.getAllGridColumns();
28879 var indexes = sortNumerically(movingCols.map(function (col) { return gridCols.indexOf(col); }));
28880 var firstIndex = indexes[0];
28881 var lastIndex = last(indexes);
28882 var spread = lastIndex - firstIndex;
28883 var gapsExist = spread !== indexes.length - 1;
28884 return gapsExist ? null : firstIndex;
28885 };
28886 MoveColumnFeature.prototype.attemptMoveColumns = function (dragSourceType, allMovingColumns, hDirection, mouseX, fromEnter) {
28887 var draggingLeft = hDirection === exports.HorizontalDirection.Left;
28888 var draggingRight = hDirection === exports.HorizontalDirection.Right;
28889 // it is important to sort the moving columns as they are in grid columns, as the list of moving columns
28890 // could themselves be part of 'married children' groups, which means we need to maintain the order within
28891 // the moving list.
28892 var allMovingColumnsOrdered = allMovingColumns.slice();
28893 this.columnModel.sortColumnsLikeGridColumns(allMovingColumnsOrdered);
28894 var validMoves = this.calculateValidMoves(allMovingColumnsOrdered, draggingRight, mouseX);
28895 // if cols are not adjacent, then this returns null. when moving, we constrain the direction of the move
28896 // (ie left or right) to the mouse direction. however
28897 var oldIndex = this.calculateOldIndex(allMovingColumnsOrdered);
28898 if (validMoves.length === 0) {
28899 return;
28900 }
28901 var firstValidMove = validMoves[0];
28902 // the two check below stop an error when the user grabs a group my a middle column, then
28903 // it is possible the mouse pointer is to the right of a column while been dragged left.
28904 // so we need to make sure that the mouse pointer is actually left of the left most column
28905 // if moving left, and right of the right most column if moving right
28906 // we check 'fromEnter' below so we move the column to the new spot if the mouse is coming from
28907 // outside the grid, eg if the column is moving from side panel, mouse is moving left, then we should
28908 // place the column to the RHS even if the mouse is moving left and the column is already on
28909 // the LHS. otherwise we stick to the rule described above.
28910 var constrainDirection = oldIndex !== null && !fromEnter;
28911 // don't consider 'fromEnter' when dragging header cells, otherwise group can jump to opposite direction of drag
28912 if (dragSourceType == exports.DragSourceType.HeaderCell) {
28913 constrainDirection = oldIndex !== null;
28914 }
28915 if (constrainDirection) {
28916 // only allow left drag if this column is moving left
28917 if (draggingLeft && firstValidMove >= oldIndex) {
28918 return;
28919 }
28920 // only allow right drag if this column is moving right
28921 if (draggingRight && firstValidMove <= oldIndex) {
28922 return;
28923 }
28924 }
28925 for (var i = 0; i < validMoves.length; i++) {
28926 var move = validMoves[i];
28927 if (!this.columnModel.doesMovePassRules(allMovingColumnsOrdered, move)) {
28928 continue;
28929 }
28930 this.columnModel.moveColumns(allMovingColumnsOrdered, move, "uiColumnDragged");
28931 // important to return here, so once we do the first valid move, we don't try do any more
28932 return;
28933 }
28934 };
28935 MoveColumnFeature.prototype.calculateValidMoves = function (movingCols, draggingRight, mouseX) {
28936 var isMoveBlocked = this.gridOptionsWrapper.isSuppressMovableColumns() || movingCols.some(function (col) { return col.getColDef().suppressMovable; });
28937 if (isMoveBlocked) {
28938 return [];
28939 }
28940 // this is the list of cols on the screen, so it's these we use when comparing the x mouse position
28941 var allDisplayedCols = this.columnModel.getDisplayedColumns(this.pinned);
28942 // but this list is the list of all cols, when we move a col it's the index within this list that gets used,
28943 // so the result we return has to be and index location for this list
28944 var allGridCols = this.columnModel.getAllGridColumns();
28945 var movingDisplayedCols = allDisplayedCols.filter(function (col) { return includes(movingCols, col); });
28946 var otherDisplayedCols = allDisplayedCols.filter(function (col) { return !includes(movingCols, col); });
28947 var otherGridCols = allGridCols.filter(function (col) { return !includes(movingCols, col); });
28948 // work out how many DISPLAYED columns fit before the 'x' position. this gives us the displayIndex.
28949 // for example, if cols are a,b,c,d and we find a,b fit before 'x', then we want to place the moving
28950 // col between b and c (so that it is under the mouse position).
28951 var displayIndex = 0;
28952 var availableWidth = mouseX;
28953 // if we are dragging right, then the columns will be to the left of the mouse, so we also want to
28954 // include the width of the moving columns
28955 if (draggingRight) {
28956 var widthOfMovingDisplayedCols_1 = 0;
28957 movingDisplayedCols.forEach(function (col) { return widthOfMovingDisplayedCols_1 += col.getActualWidth(); });
28958 availableWidth -= widthOfMovingDisplayedCols_1;
28959 }
28960 if (availableWidth > 0) {
28961 // now count how many of the displayed columns will fit to the left
28962 for (var i = 0; i < otherDisplayedCols.length; i++) {
28963 var col = otherDisplayedCols[i];
28964 availableWidth -= col.getActualWidth();
28965 if (availableWidth < 0) {
28966 break;
28967 }
28968 displayIndex++;
28969 }
28970 // trial and error, if going right, we adjust by one, i didn't manage to quantify why, but it works
28971 if (draggingRight) {
28972 displayIndex++;
28973 }
28974 }
28975 // the display index is with respect to all the showing columns, however when we move, it's with
28976 // respect to all grid columns, so we need to translate from display index to grid index
28977 var firstValidMove;
28978 if (displayIndex > 0) {
28979 var leftColumn = otherDisplayedCols[displayIndex - 1];
28980 firstValidMove = otherGridCols.indexOf(leftColumn) + 1;
28981 }
28982 else {
28983 firstValidMove = otherGridCols.indexOf(otherDisplayedCols[0]);
28984 if (firstValidMove === -1) {
28985 firstValidMove = 0;
28986 }
28987 }
28988 var validMoves = [firstValidMove];
28989 var numberComparator = function (a, b) { return a - b; };
28990 // add in other valid moves due to hidden columns and married children. for example, a particular
28991 // move might break a group that has married children (so move isn't valid), however there could
28992 // be hidden columns (not displayed) that we could jump over to make the move valid. because
28993 // they are hidden, user doesn't see any different, however it allows moves that would otherwise
28994 // not work. for example imagine a group with 9 columns and all columns are hidden except the
28995 // middle one (so 4 hidden to left, 4 hidden to right), then when moving 'firstValidMove' will
28996 // be relative to the not-shown column, however we need to consider the move jumping over all the
28997 // hidden children. if we didn't do this, then if the group just described was at the end (RHS) of the
28998 // grid, there would be no way to put a column after it (as the grid would only consider beside the
28999 // visible column, which would fail valid move rules).
29000 if (draggingRight) {
29001 // if dragging right, then we add all the additional moves to the right. so in other words
29002 // if the next move is not valid, find the next move to the right that is valid.
29003 var pointer = firstValidMove + 1;
29004 var lastIndex = allGridCols.length - 1;
29005 while (pointer <= lastIndex) {
29006 validMoves.push(pointer);
29007 pointer++;
29008 }
29009 // adding columns here means the order is now messed up
29010 validMoves.sort(numberComparator);
29011 }
29012 else {
29013 // if dragging left we do the reverse of dragging right, we add in all the valid moves to the
29014 // left. however we also have to consider moves to the right for all hidden columns first.
29015 // (this logic is hard to reason with, it was worked out with trial and error,
29016 // more observation rather than science).
29017 // add moves to the right
29018 var pointer = firstValidMove;
29019 var lastIndex = allGridCols.length - 1;
29020 var displacedCol = allGridCols[pointer];
29021 while (pointer <= lastIndex && this.isColumnHidden(allDisplayedCols, displacedCol)) {
29022 pointer++;
29023 validMoves.push(pointer);
29024 displacedCol = allGridCols[pointer];
29025 }
29026 // add moves to the left
29027 pointer = firstValidMove - 1;
29028 var firstDisplayIndex = 0;
29029 while (pointer >= firstDisplayIndex) {
29030 validMoves.push(pointer);
29031 pointer--;
29032 }
29033 // adding columns here means the order is now messed up
29034 validMoves.sort(numberComparator).reverse();
29035 }
29036 return validMoves;
29037 };
29038 // isHidden takes into account visible=false and group=closed, ie it is not displayed
29039 MoveColumnFeature.prototype.isColumnHidden = function (displayedColumns, col) {
29040 return displayedColumns.indexOf(col) < 0;
29041 };
29042 MoveColumnFeature.prototype.ensureIntervalStarted = function () {
29043 if (!this.movingIntervalId) {
29044 this.intervalCount = 0;
29045 this.failedMoveAttempts = 0;
29046 this.movingIntervalId = window.setInterval(this.moveInterval.bind(this), 100);
29047 if (this.needToMoveLeft) {
29048 this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_LEFT, true);
29049 }
29050 else {
29051 this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_RIGHT, true);
29052 }
29053 }
29054 };
29055 MoveColumnFeature.prototype.ensureIntervalCleared = function () {
29056 if (this.movingIntervalId) {
29057 window.clearInterval(this.movingIntervalId);
29058 this.movingIntervalId = null;
29059 this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_MOVE);
29060 }
29061 };
29062 MoveColumnFeature.prototype.moveInterval = function () {
29063 // the amounts we move get bigger at each interval, so the speed accelerates, starting a bit slow
29064 // and getting faster. this is to give smoother user experience. we max at 100px to limit the speed.
29065 var pixelsToMove;
29066 this.intervalCount++;
29067 pixelsToMove = 10 + (this.intervalCount * 5);
29068 if (pixelsToMove > 100) {
29069 pixelsToMove = 100;
29070 }
29071 var pixelsMoved = null;
29072 var scrollFeature = this.gridBodyCon.getScrollFeature();
29073 if (this.needToMoveLeft) {
29074 pixelsMoved = scrollFeature.scrollHorizontally(-pixelsToMove);
29075 }
29076 else if (this.needToMoveRight) {
29077 pixelsMoved = scrollFeature.scrollHorizontally(pixelsToMove);
29078 }
29079 if (pixelsMoved !== 0) {
29080 this.onDragging(this.lastDraggingEvent);
29081 this.failedMoveAttempts = 0;
29082 }
29083 else {
29084 // we count the failed move attempts. if we fail to move 7 times, then we pin the column.
29085 // this is how we achieve pining by dragging the column to the edge of the grid.
29086 this.failedMoveAttempts++;
29087 var columns = this.lastDraggingEvent.dragItem.columns;
29088 var columnsThatCanPin = columns.filter(function (c) { return !c.getColDef().lockPinned; });
29089 if (columnsThatCanPin.length > 0) {
29090 this.dragAndDropService.setGhostIcon(DragAndDropService.ICON_PINNED);
29091 if (this.failedMoveAttempts > 7) {
29092 var pinType = this.needToMoveLeft ? Constants.PINNED_LEFT : Constants.PINNED_RIGHT;
29093 this.setColumnsPinned(columnsThatCanPin, pinType, "uiColumnDragged");
29094 this.dragAndDropService.nudge();
29095 }
29096 }
29097 }
29098 };
29099 __decorate$12([
29100 Autowired('columnModel')
29101 ], MoveColumnFeature.prototype, "columnModel", void 0);
29102 __decorate$12([
29103 Autowired('dragAndDropService')
29104 ], MoveColumnFeature.prototype, "dragAndDropService", void 0);
29105 __decorate$12([
29106 Autowired('gridOptionsWrapper')
29107 ], MoveColumnFeature.prototype, "gridOptionsWrapper", void 0);
29108 __decorate$12([
29109 Autowired('ctrlsService')
29110 ], MoveColumnFeature.prototype, "ctrlsService", void 0);
29111 __decorate$12([
29112 PostConstruct
29113 ], MoveColumnFeature.prototype, "init", null);
29114 return MoveColumnFeature;
29115}());
29116
29117/**
29118 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
29119 * @version v27.3.0
29120 * @link https://www.ag-grid.com/
29121 * @license MIT
29122 */
29123var __extends$1g = (undefined && undefined.__extends) || (function () {
29124 var extendStatics = function (d, b) {
29125 extendStatics = Object.setPrototypeOf ||
29126 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29127 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
29128 return extendStatics(d, b);
29129 };
29130 return function (d, b) {
29131 extendStatics(d, b);
29132 function __() { this.constructor = d; }
29133 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29134 };
29135})();
29136var __decorate$13 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
29137 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29138 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29139 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;
29140 return c > 3 && r && Object.defineProperty(target, key, r), r;
29141};
29142var BodyDropTarget = /** @class */ (function (_super) {
29143 __extends$1g(BodyDropTarget, _super);
29144 function BodyDropTarget(pinned, eContainer) {
29145 var _this = _super.call(this) || this;
29146 _this.pinned = pinned;
29147 _this.eContainer = eContainer;
29148 return _this;
29149 }
29150 BodyDropTarget.prototype.postConstruct = function () {
29151 var _this = this;
29152 this.ctrlsService.whenReady(function (p) {
29153 switch (_this.pinned) {
29154 case Constants.PINNED_LEFT:
29155 _this.eSecondaryContainers = [
29156 [p.gridBodyCtrl.getBodyViewportElement(), p.leftRowContainerCtrl.getContainerElement()],
29157 [p.bottomLeftRowContainerCtrl.getContainerElement()],
29158 [p.topLeftRowContainerCtrl.getContainerElement()]
29159 ];
29160 break;
29161 case Constants.PINNED_RIGHT:
29162 _this.eSecondaryContainers = [
29163 [p.gridBodyCtrl.getBodyViewportElement(), p.rightRowContainerCtrl.getContainerElement()],
29164 [p.bottomRightRowContainerCtrl.getContainerElement()],
29165 [p.topRightRowContainerCtrl.getContainerElement()]
29166 ];
29167 break;
29168 default:
29169 _this.eSecondaryContainers = [
29170 [p.gridBodyCtrl.getBodyViewportElement(), p.centerRowContainerCtrl.getViewportElement()],
29171 [p.bottomCenterRowContainerCtrl.getViewportElement()],
29172 [p.topCenterRowContainerCtrl.getViewportElement()]
29173 ];
29174 break;
29175 }
29176 });
29177 };
29178 BodyDropTarget.prototype.isInterestedIn = function (type) {
29179 return type === exports.DragSourceType.HeaderCell ||
29180 (type === exports.DragSourceType.ToolPanel && this.gridOptionsWrapper.isAllowDragFromColumnsToolPanel());
29181 };
29182 BodyDropTarget.prototype.getSecondaryContainers = function () {
29183 return this.eSecondaryContainers;
29184 };
29185 BodyDropTarget.prototype.getContainer = function () {
29186 return this.eContainer;
29187 };
29188 BodyDropTarget.prototype.init = function () {
29189 this.moveColumnFeature = this.createManagedBean(new MoveColumnFeature(this.pinned, this.eContainer));
29190 this.bodyDropPivotTarget = this.createManagedBean(new BodyDropPivotTarget(this.pinned));
29191 this.dragAndDropService.addDropTarget(this);
29192 };
29193 BodyDropTarget.prototype.getIconName = function () {
29194 return this.currentDropListener.getIconName();
29195 };
29196 // we want to use the bodyPivotTarget if the user is dragging columns in from the toolPanel
29197 // and we are in pivot mode, as it has to logic to set pivot/value/group on the columns when
29198 // dropped into the grid's body.
29199 BodyDropTarget.prototype.isDropColumnInPivotMode = function (draggingEvent) {
29200 // in pivot mode, then if moving a column (ie didn't come from toolpanel) then it's
29201 // a standard column move, however if it came from the toolpanel, then we are introducing
29202 // dimensions or values to the grid
29203 return this.columnModel.isPivotMode() && draggingEvent.dragSource.type === exports.DragSourceType.ToolPanel;
29204 };
29205 BodyDropTarget.prototype.onDragEnter = function (draggingEvent) {
29206 // we pick the drop listener depending on whether we are in pivot mode are not. if we are
29207 // in pivot mode, then dropping cols changes the row group, pivot, value stats. otherwise
29208 // we change visibility state and position.
29209 this.currentDropListener = this.isDropColumnInPivotMode(draggingEvent) ? this.bodyDropPivotTarget : this.moveColumnFeature;
29210 this.currentDropListener.onDragEnter(draggingEvent);
29211 };
29212 BodyDropTarget.prototype.onDragLeave = function (params) {
29213 this.currentDropListener.onDragLeave(params);
29214 };
29215 BodyDropTarget.prototype.onDragging = function (params) {
29216 this.currentDropListener.onDragging(params);
29217 };
29218 BodyDropTarget.prototype.onDragStop = function (params) {
29219 this.currentDropListener.onDragStop(params);
29220 };
29221 __decorate$13([
29222 Autowired('dragAndDropService')
29223 ], BodyDropTarget.prototype, "dragAndDropService", void 0);
29224 __decorate$13([
29225 Autowired('columnModel')
29226 ], BodyDropTarget.prototype, "columnModel", void 0);
29227 __decorate$13([
29228 Autowired('ctrlsService')
29229 ], BodyDropTarget.prototype, "ctrlsService", void 0);
29230 __decorate$13([
29231 PostConstruct
29232 ], BodyDropTarget.prototype, "postConstruct", null);
29233 __decorate$13([
29234 PostConstruct
29235 ], BodyDropTarget.prototype, "init", null);
29236 return BodyDropTarget;
29237}(BeanStub));
29238
29239/**
29240 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
29241 * @version v27.3.0
29242 * @link https://www.ag-grid.com/
29243 * @license MIT
29244 */
29245var __read$b = (undefined && undefined.__read) || function (o, n) {
29246 var m = typeof Symbol === "function" && o[Symbol.iterator];
29247 if (!m) return o;
29248 var i = m.call(o), r, ar = [], e;
29249 try {
29250 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
29251 }
29252 catch (error) { e = { error: error }; }
29253 finally {
29254 try {
29255 if (r && !r.done && (m = i["return"])) m.call(i);
29256 }
29257 finally { if (e) throw e.error; }
29258 }
29259 return ar;
29260};
29261var __spread$8 = (undefined && undefined.__spread) || function () {
29262 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$b(arguments[i]));
29263 return ar;
29264};
29265var CssClassApplier = /** @class */ (function () {
29266 function CssClassApplier() {
29267 }
29268 CssClassApplier.getHeaderClassesFromColDef = function (abstractColDef, gridOptionsWrapper, column, columnGroup) {
29269 if (missing(abstractColDef)) {
29270 return [];
29271 }
29272 return this.getColumnClassesFromCollDef(abstractColDef.headerClass, abstractColDef, gridOptionsWrapper, column, columnGroup);
29273 };
29274 CssClassApplier.getToolPanelClassesFromColDef = function (abstractColDef, gridOptionsWrapper, column, columnGroup) {
29275 if (missing(abstractColDef)) {
29276 return [];
29277 }
29278 return this.getColumnClassesFromCollDef(abstractColDef.toolPanelClass, abstractColDef, gridOptionsWrapper, column, columnGroup);
29279 };
29280 CssClassApplier.getClassParams = function (abstractColDef, gridOptionsWrapper, column, columnGroup) {
29281 return {
29282 // bad naming, as colDef here can be a group or a column,
29283 // however most people won't appreciate the difference,
29284 // so keeping it as colDef to avoid confusion.
29285 colDef: abstractColDef,
29286 column: column,
29287 columnGroup: columnGroup,
29288 api: gridOptionsWrapper.getApi(),
29289 columnApi: gridOptionsWrapper.getColumnApi(),
29290 context: gridOptionsWrapper.getContext()
29291 };
29292 };
29293 CssClassApplier.getColumnClassesFromCollDef = function (classesOrFunc, abstractColDef, gridOptionsWrapper, column, columnGroup) {
29294 if (missing(classesOrFunc)) {
29295 return [];
29296 }
29297 var classToUse;
29298 if (typeof classesOrFunc === 'function') {
29299 var params = this.getClassParams(abstractColDef, gridOptionsWrapper, column, columnGroup);
29300 classToUse = classesOrFunc(params);
29301 }
29302 else {
29303 classToUse = classesOrFunc;
29304 }
29305 if (typeof classToUse === 'string') {
29306 return [classToUse];
29307 }
29308 if (Array.isArray(classToUse)) {
29309 return __spread$8(classToUse);
29310 }
29311 return [];
29312 };
29313 return CssClassApplier;
29314}());
29315
29316/**
29317 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
29318 * @version v27.3.0
29319 * @link https://www.ag-grid.com/
29320 * @license MIT
29321 */
29322var __extends$1h = (undefined && undefined.__extends) || (function () {
29323 var extendStatics = function (d, b) {
29324 extendStatics = Object.setPrototypeOf ||
29325 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29326 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
29327 return extendStatics(d, b);
29328 };
29329 return function (d, b) {
29330 extendStatics(d, b);
29331 function __() { this.constructor = d; }
29332 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29333 };
29334})();
29335var __decorate$14 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
29336 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29337 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29338 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;
29339 return c > 3 && r && Object.defineProperty(target, key, r), r;
29340};
29341var HeaderCellComp = /** @class */ (function (_super) {
29342 __extends$1h(HeaderCellComp, _super);
29343 function HeaderCellComp(ctrl) {
29344 var _this = _super.call(this, HeaderCellComp.TEMPLATE, ctrl) || this;
29345 _this.headerCompVersion = 0;
29346 _this.column = ctrl.getColumnGroupChild();
29347 _this.pinned = ctrl.getPinned();
29348 return _this;
29349 }
29350 HeaderCellComp.prototype.postConstruct = function () {
29351 var _this = this;
29352 var eGui = this.getGui();
29353 var setAttribute = function (name, value, element) {
29354 var actualElement = element ? element : eGui;
29355 if (value != null && value != '') {
29356 actualElement.setAttribute(name, value);
29357 }
29358 else {
29359 actualElement.removeAttribute(name);
29360 }
29361 };
29362 var compProxy = {
29363 setWidth: function (width) { return eGui.style.width = width; },
29364 addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
29365 setColId: function (id) { return setAttribute('col-id', id); },
29366 setTitle: function (title) { return setAttribute('title', title); },
29367 setAriaDescription: function (label) { return setAriaDescription(eGui, label); },
29368 setAriaSort: function (sort) { return sort ? setAriaSort(eGui, sort) : removeAriaSort(eGui); },
29369 setUserCompDetails: function (compDetails) { return _this.setUserCompDetails(compDetails); },
29370 getUserCompInstance: function () { return _this.headerComp; }
29371 };
29372 this.ctrl.setComp(compProxy, this.getGui(), this.eResize);
29373 var selectAllGui = this.ctrl.getSelectAllGui();
29374 this.eResize.insertAdjacentElement('afterend', selectAllGui);
29375 };
29376 HeaderCellComp.prototype.destroyHeaderComp = function () {
29377 if (this.headerComp) {
29378 this.getGui().removeChild(this.headerCompGui);
29379 this.headerComp = this.destroyBean(this.headerComp);
29380 this.headerCompGui = undefined;
29381 }
29382 };
29383 HeaderCellComp.prototype.setUserCompDetails = function (compDetails) {
29384 var _this = this;
29385 this.headerCompVersion++;
29386 var versionCopy = this.headerCompVersion;
29387 compDetails.newAgStackInstance().then(function (comp) { return _this.afterCompCreated(versionCopy, comp); });
29388 };
29389 HeaderCellComp.prototype.afterCompCreated = function (version, headerComp) {
29390 if (version != this.headerCompVersion || !this.isAlive()) {
29391 this.destroyBean(headerComp);
29392 return;
29393 }
29394 this.destroyHeaderComp();
29395 this.headerComp = headerComp;
29396 this.headerCompGui = headerComp.getGui();
29397 this.getGui().appendChild(this.headerCompGui);
29398 this.ctrl.setDragSource(this.headerCompGui);
29399 };
29400 HeaderCellComp.TEMPLATE = "<div class=\"ag-header-cell\" role=\"columnheader\" tabindex=\"-1\">\n <div ref=\"eResize\" class=\"ag-header-cell-resize\" role=\"presentation\"></div>\n </div>";
29401 __decorate$14([
29402 RefSelector('eResize')
29403 ], HeaderCellComp.prototype, "eResize", void 0);
29404 __decorate$14([
29405 PostConstruct
29406 ], HeaderCellComp.prototype, "postConstruct", null);
29407 __decorate$14([
29408 PreDestroy
29409 ], HeaderCellComp.prototype, "destroyHeaderComp", null);
29410 return HeaderCellComp;
29411}(AbstractHeaderCellComp));
29412
29413/**
29414 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
29415 * @version v27.3.0
29416 * @link https://www.ag-grid.com/
29417 * @license MIT
29418 */
29419var __extends$1i = (undefined && undefined.__extends) || (function () {
29420 var extendStatics = function (d, b) {
29421 extendStatics = Object.setPrototypeOf ||
29422 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29423 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
29424 return extendStatics(d, b);
29425 };
29426 return function (d, b) {
29427 extendStatics(d, b);
29428 function __() { this.constructor = d; }
29429 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29430 };
29431})();
29432var __decorate$15 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
29433 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29434 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29435 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;
29436 return c > 3 && r && Object.defineProperty(target, key, r), r;
29437};
29438var HeaderGroupCellComp = /** @class */ (function (_super) {
29439 __extends$1i(HeaderGroupCellComp, _super);
29440 function HeaderGroupCellComp(ctrl) {
29441 return _super.call(this, HeaderGroupCellComp.TEMPLATE, ctrl) || this;
29442 }
29443 HeaderGroupCellComp.prototype.postConstruct = function () {
29444 var _this = this;
29445 var eGui = this.getGui();
29446 var setAttribute = function (key, value) {
29447 return value != undefined ? eGui.setAttribute(key, value) : eGui.removeAttribute(key);
29448 };
29449 var compProxy = {
29450 addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
29451 addOrRemoveResizableCssClass: function (cssClassName, on) { return _this.eResize.classList.toggle(cssClassName, on); },
29452 setWidth: function (width) { return eGui.style.width = width; },
29453 setColId: function (id) { return eGui.setAttribute("col-id", id); },
29454 setAriaExpanded: function (expanded) { return setAttribute('aria-expanded', expanded); },
29455 setTitle: function (title) { return setAttribute("title", title); },
29456 setUserCompDetails: function (details) { return _this.setUserCompDetails(details); }
29457 };
29458 this.ctrl.setComp(compProxy, eGui, this.eResize);
29459 };
29460 HeaderGroupCellComp.prototype.setUserCompDetails = function (details) {
29461 var _this = this;
29462 details.newAgStackInstance().then(function (comp) { return _this.afterHeaderCompCreated(comp); });
29463 };
29464 HeaderGroupCellComp.prototype.afterHeaderCompCreated = function (headerGroupComp) {
29465 var _this = this;
29466 var destroyFunc = function () { return _this.destroyBean(headerGroupComp); };
29467 if (!this.isAlive()) {
29468 destroyFunc();
29469 return;
29470 }
29471 this.getGui().appendChild(headerGroupComp.getGui());
29472 this.addDestroyFunc(destroyFunc);
29473 this.ctrl.setDragSource(headerGroupComp.getGui());
29474 };
29475 HeaderGroupCellComp.TEMPLATE = "<div class=\"ag-header-group-cell\" role=\"columnheader\" tabindex=\"-1\">\n <div ref=\"eResize\" class=\"ag-header-cell-resize\" role=\"presentation\"></div>\n </div>";
29476 __decorate$15([
29477 Autowired('userComponentFactory')
29478 ], HeaderGroupCellComp.prototype, "userComponentFactory", void 0);
29479 __decorate$15([
29480 RefSelector('eResize')
29481 ], HeaderGroupCellComp.prototype, "eResize", void 0);
29482 __decorate$15([
29483 PostConstruct
29484 ], HeaderGroupCellComp.prototype, "postConstruct", null);
29485 return HeaderGroupCellComp;
29486}(AbstractHeaderCellComp));
29487
29488/**
29489 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
29490 * @version v27.3.0
29491 * @link https://www.ag-grid.com/
29492 * @license MIT
29493 */
29494var __extends$1j = (undefined && undefined.__extends) || (function () {
29495 var extendStatics = function (d, b) {
29496 extendStatics = Object.setPrototypeOf ||
29497 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29498 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
29499 return extendStatics(d, b);
29500 };
29501 return function (d, b) {
29502 extendStatics(d, b);
29503 function __() { this.constructor = d; }
29504 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29505 };
29506})();
29507var __decorate$16 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
29508 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29509 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29510 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;
29511 return c > 3 && r && Object.defineProperty(target, key, r), r;
29512};
29513(function (HeaderRowType) {
29514 HeaderRowType["COLUMN_GROUP"] = "group";
29515 HeaderRowType["COLUMN"] = "column";
29516 HeaderRowType["FLOATING_FILTER"] = "filter";
29517})(exports.HeaderRowType || (exports.HeaderRowType = {}));
29518var HeaderRowComp = /** @class */ (function (_super) {
29519 __extends$1j(HeaderRowComp, _super);
29520 function HeaderRowComp(ctrl) {
29521 var _this = _super.call(this) || this;
29522 _this.headerComps = {};
29523 var extraClass = ctrl.getType() == exports.HeaderRowType.COLUMN_GROUP ? "ag-header-row-column-group" :
29524 ctrl.getType() == exports.HeaderRowType.FLOATING_FILTER ? "ag-header-row-column-filter" : "ag-header-row-column";
29525 _this.setTemplate(/* html */ "<div class=\"ag-header-row " + extraClass + "\" role=\"row\"></div>");
29526 _this.ctrl = ctrl;
29527 return _this;
29528 }
29529 //noinspection JSUnusedLocalSymbols
29530 HeaderRowComp.prototype.init = function () {
29531 var _this = this;
29532 var compProxy = {
29533 setTransform: function (transform) { return _this.getGui().style.transform = transform; },
29534 setHeight: function (height) { return _this.getGui().style.height = height; },
29535 setTop: function (top) { return _this.getGui().style.top = top; },
29536 setHeaderCtrls: function (ctrls) { return _this.setHeaderCtrls(ctrls); },
29537 setWidth: function (width) { return _this.getGui().style.width = width; },
29538 setAriaRowIndex: function (rowIndex) { return setAriaRowIndex(_this.getGui(), rowIndex); }
29539 };
29540 this.ctrl.setComp(compProxy);
29541 };
29542 HeaderRowComp.prototype.destroyHeaderCtrls = function () {
29543 this.setHeaderCtrls([]);
29544 };
29545 HeaderRowComp.prototype.setHeaderCtrls = function (ctrls) {
29546 var _this = this;
29547 if (!this.isAlive()) {
29548 return;
29549 }
29550 var oldComps = this.headerComps;
29551 this.headerComps = {};
29552 ctrls.forEach(function (ctrl) {
29553 var id = ctrl.getInstanceId();
29554 var comp = oldComps[id];
29555 delete oldComps[id];
29556 if (comp == null) {
29557 comp = _this.createHeaderComp(ctrl);
29558 _this.getGui().appendChild(comp.getGui());
29559 }
29560 _this.headerComps[id] = comp;
29561 });
29562 iterateObject(oldComps, function (id, comp) {
29563 _this.getGui().removeChild(comp.getGui());
29564 _this.destroyBean(comp);
29565 });
29566 var ensureDomOrder = this.gridOptionsWrapper.isEnsureDomOrder();
29567 if (ensureDomOrder) {
29568 var comps = getAllValuesInObject(this.headerComps);
29569 // ordering the columns by left position orders them in the order they appear on the screen
29570 comps.sort(function (a, b) {
29571 var leftA = a.getCtrl().getColumnGroupChild().getLeft();
29572 var leftB = b.getCtrl().getColumnGroupChild().getLeft();
29573 return leftA - leftB;
29574 });
29575 var elementsInOrder = comps.map(function (c) { return c.getGui(); });
29576 setDomChildOrder(this.getGui(), elementsInOrder);
29577 }
29578 };
29579 HeaderRowComp.prototype.createHeaderComp = function (headerCtrl) {
29580 var result;
29581 switch (this.ctrl.getType()) {
29582 case exports.HeaderRowType.COLUMN_GROUP:
29583 result = new HeaderGroupCellComp(headerCtrl);
29584 break;
29585 case exports.HeaderRowType.FLOATING_FILTER:
29586 result = new HeaderFilterCellComp(headerCtrl);
29587 break;
29588 default:
29589 result = new HeaderCellComp(headerCtrl);
29590 break;
29591 }
29592 this.createBean(result);
29593 result.setParentComponent(this);
29594 return result;
29595 };
29596 __decorate$16([
29597 PostConstruct
29598 ], HeaderRowComp.prototype, "init", null);
29599 __decorate$16([
29600 PreDestroy
29601 ], HeaderRowComp.prototype, "destroyHeaderCtrls", null);
29602 return HeaderRowComp;
29603}(Component));
29604
29605/**
29606 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
29607 * @version v27.3.0
29608 * @link https://www.ag-grid.com/
29609 * @license MIT
29610 */
29611var __extends$1k = (undefined && undefined.__extends) || (function () {
29612 var extendStatics = function (d, b) {
29613 extendStatics = Object.setPrototypeOf ||
29614 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29615 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
29616 return extendStatics(d, b);
29617 };
29618 return function (d, b) {
29619 extendStatics(d, b);
29620 function __() { this.constructor = d; }
29621 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29622 };
29623})();
29624var __decorate$17 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
29625 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29626 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29627 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;
29628 return c > 3 && r && Object.defineProperty(target, key, r), r;
29629};
29630var instanceIdSequence$3 = 0;
29631var AbstractHeaderCellCtrl = /** @class */ (function (_super) {
29632 __extends$1k(AbstractHeaderCellCtrl, _super);
29633 function AbstractHeaderCellCtrl(columnGroupChild, parentRowCtrl) {
29634 var _this = _super.call(this) || this;
29635 _this.lastFocusEvent = null;
29636 _this.columnGroupChild = columnGroupChild;
29637 _this.parentRowCtrl = parentRowCtrl;
29638 // unique id to this instance, including the column ID to help with debugging in React as it's used in 'key'
29639 _this.instanceId = columnGroupChild.getUniqueId() + '-' + instanceIdSequence$3++;
29640 return _this;
29641 }
29642 AbstractHeaderCellCtrl.prototype.shouldStopEventPropagation = function (e) {
29643 var _a = this.focusService.getFocusedHeader(), headerRowIndex = _a.headerRowIndex, column = _a.column;
29644 return isUserSuppressingHeaderKeyboardEvent(this.gridOptionsWrapper, e, headerRowIndex, column);
29645 };
29646 AbstractHeaderCellCtrl.prototype.setGui = function (eGui) {
29647 this.eGui = eGui;
29648 this.addDomData();
29649 };
29650 AbstractHeaderCellCtrl.prototype.addDomData = function () {
29651 var _this = this;
29652 var key = AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL;
29653 this.gridOptionsWrapper.setDomData(this.eGui, key, this);
29654 this.addDestroyFunc(function () { return _this.gridOptionsWrapper.setDomData(_this.eGui, key, null); });
29655 };
29656 AbstractHeaderCellCtrl.prototype.getGui = function () {
29657 return this.eGui;
29658 };
29659 AbstractHeaderCellCtrl.prototype.focus = function (event) {
29660 if (!this.eGui) {
29661 return false;
29662 }
29663 this.lastFocusEvent = event || null;
29664 this.eGui.focus();
29665 return true;
29666 };
29667 AbstractHeaderCellCtrl.prototype.getRowIndex = function () {
29668 return this.parentRowCtrl.getRowIndex();
29669 };
29670 AbstractHeaderCellCtrl.prototype.getParentRowCtrl = function () {
29671 return this.parentRowCtrl;
29672 };
29673 AbstractHeaderCellCtrl.prototype.getPinned = function () {
29674 return this.parentRowCtrl.getPinned();
29675 };
29676 AbstractHeaderCellCtrl.prototype.getInstanceId = function () {
29677 return this.instanceId;
29678 };
29679 AbstractHeaderCellCtrl.prototype.getColumnGroupChild = function () {
29680 return this.columnGroupChild;
29681 };
29682 AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL = 'headerCtrl';
29683 __decorate$17([
29684 Autowired('focusService')
29685 ], AbstractHeaderCellCtrl.prototype, "focusService", void 0);
29686 return AbstractHeaderCellCtrl;
29687}(BeanStub));
29688
29689/**
29690 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
29691 * @version v27.3.0
29692 * @link https://www.ag-grid.com/
29693 * @license MIT
29694 */
29695(function (ClientSideRowModelSteps) {
29696 ClientSideRowModelSteps["EVERYTHING"] = "group";
29697 ClientSideRowModelSteps["FILTER"] = "filter";
29698 ClientSideRowModelSteps["SORT"] = "sort";
29699 ClientSideRowModelSteps["MAP"] = "map";
29700 ClientSideRowModelSteps["AGGREGATE"] = "aggregate";
29701 ClientSideRowModelSteps["FILTER_AGGREGATES"] = "filter_aggregates";
29702 ClientSideRowModelSteps["PIVOT"] = "pivot";
29703 ClientSideRowModelSteps["NOTHING"] = "nothing";
29704})(exports.ClientSideRowModelSteps || (exports.ClientSideRowModelSteps = {}));
29705
29706/**
29707 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
29708 * @version v27.3.0
29709 * @link https://www.ag-grid.com/
29710 * @license MIT
29711 */
29712var __decorate$18 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
29713 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29714 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29715 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;
29716 return c > 3 && r && Object.defineProperty(target, key, r), r;
29717};
29718function unwrapUserComp(comp) {
29719 var compAsAny = comp;
29720 var isProxy = compAsAny != null && compAsAny.getFrameworkComponentInstance != null;
29721 return isProxy ? compAsAny.getFrameworkComponentInstance() : comp;
29722}
29723var GridApi = /** @class */ (function () {
29724 function GridApi() {
29725 this.detailGridInfoMap = {};
29726 this.destroyCalled = false;
29727 }
29728 GridApi.prototype.registerOverlayWrapperComp = function (overlayWrapperComp) {
29729 this.overlayWrapperComp = overlayWrapperComp;
29730 };
29731 GridApi.prototype.registerSideBarComp = function (sideBarComp) {
29732 this.sideBarComp = sideBarComp;
29733 };
29734 GridApi.prototype.init = function () {
29735 var _this = this;
29736 switch (this.rowModel.getType()) {
29737 case Constants.ROW_MODEL_TYPE_CLIENT_SIDE:
29738 this.clientSideRowModel = this.rowModel;
29739 break;
29740 case Constants.ROW_MODEL_TYPE_INFINITE:
29741 this.infiniteRowModel = this.rowModel;
29742 break;
29743 case Constants.ROW_MODEL_TYPE_SERVER_SIDE:
29744 this.serverSideRowModel = this.rowModel;
29745 break;
29746 }
29747 this.ctrlsService.whenReady(function () {
29748 _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
29749 });
29750 };
29751 /** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */
29752 GridApi.prototype.__getAlignedGridService = function () {
29753 return this.alignedGridsService;
29754 };
29755 /** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */
29756 GridApi.prototype.__getContext = function () {
29757 return this.context;
29758 };
29759 /** Register a detail grid with the master grid when it is created. */
29760 GridApi.prototype.addDetailGridInfo = function (id, gridInfo) {
29761 this.detailGridInfoMap[id] = gridInfo;
29762 };
29763 /** Unregister a detail grid from the master grid when it is destroyed. */
29764 GridApi.prototype.removeDetailGridInfo = function (id) {
29765 this.detailGridInfoMap[id] = undefined;
29766 };
29767 /** Returns the `DetailGridInfo` corresponding to the supplied `detailGridId`. */
29768 GridApi.prototype.getDetailGridInfo = function (id) {
29769 return this.detailGridInfoMap[id];
29770 };
29771 /** Iterates through each `DetailGridInfo` in the grid and calls the supplied callback on each. */
29772 GridApi.prototype.forEachDetailGridInfo = function (callback) {
29773 var index = 0;
29774 iterateObject(this.detailGridInfoMap, function (id, gridInfo) {
29775 // check for undefined, as old references will still be lying around
29776 if (exists(gridInfo)) {
29777 callback(gridInfo, index);
29778 index++;
29779 }
29780 });
29781 };
29782 /** Similar to `exportDataAsCsv`, except returns the result as a string rather than download it. */
29783 GridApi.prototype.getDataAsCsv = function (params) {
29784 if (ModuleRegistry.assertRegistered(exports.ModuleNames.CsvExportModule, 'api.getDataAsCsv')) {
29785 return this.csvCreator.getDataAsCsv(params);
29786 }
29787 };
29788 /** Downloads a CSV export of the grid's data. */
29789 GridApi.prototype.exportDataAsCsv = function (params) {
29790 if (ModuleRegistry.assertRegistered(exports.ModuleNames.CsvExportModule, 'api.exportDataAsCSv')) {
29791 this.csvCreator.exportDataAsCsv(params);
29792 }
29793 };
29794 GridApi.prototype.getExcelExportMode = function (params) {
29795 var baseParams = this.gridOptionsWrapper.getDefaultExportParams('excel');
29796 var mergedParams = Object.assign({ exportMode: 'xlsx' }, baseParams, params);
29797 return mergedParams.exportMode;
29798 };
29799 /** Similar to `exportDataAsExcel`, except instead of downloading a file, it will return a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) to be processed by the user. */
29800 GridApi.prototype.getDataAsExcel = function (params) {
29801 if (!ModuleRegistry.assertRegistered(exports.ModuleNames.ExcelExportModule, 'api.getDataAsExcel')) {
29802 return;
29803 }
29804 var exportMode = this.getExcelExportMode(params);
29805 if (this.excelCreator.getFactoryMode(exportMode) === exports.ExcelFactoryMode.MULTI_SHEET) {
29806 console.warn('AG Grid: The Excel Exporter is currently on Multi Sheet mode. End that operation by calling `api.getMultipleSheetAsExcel()` or `api.exportMultipleSheetsAsExcel()`');
29807 return;
29808 }
29809 return this.excelCreator.getDataAsExcel(params);
29810 };
29811 /** Downloads an Excel export of the grid's data. */
29812 GridApi.prototype.exportDataAsExcel = function (params) {
29813 if (!ModuleRegistry.assertRegistered(exports.ModuleNames.ExcelExportModule, 'api.exportDataAsExcel')) {
29814 return;
29815 }
29816 var exportMode = this.getExcelExportMode(params);
29817 if (this.excelCreator.getFactoryMode(exportMode) === exports.ExcelFactoryMode.MULTI_SHEET) {
29818 console.warn('AG Grid: The Excel Exporter is currently on Multi Sheet mode. End that operation by calling `api.getMultipleSheetAsExcel()` or `api.exportMultipleSheetsAsExcel()`');
29819 return;
29820 }
29821 this.excelCreator.exportDataAsExcel(params);
29822 };
29823 /** This is method to be used to get the grid's data as a sheet, that will later be exported either by `getMultipleSheetsAsExcel()` or `exportMultipleSheetsAsExcel()`. */
29824 GridApi.prototype.getSheetDataForExcel = function (params) {
29825 if (!ModuleRegistry.assertRegistered(exports.ModuleNames.ExcelExportModule, 'api.getSheetDataForExcel')) {
29826 return;
29827 }
29828 var exportMode = this.getExcelExportMode(params);
29829 this.excelCreator.setFactoryMode(exports.ExcelFactoryMode.MULTI_SHEET, exportMode);
29830 return this.excelCreator.getSheetDataForExcel(params);
29831 };
29832 /** Similar to `exportMultipleSheetsAsExcel`, except instead of downloading a file, it will return a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) to be processed by the user. */
29833 GridApi.prototype.getMultipleSheetsAsExcel = function (params) {
29834 if (ModuleRegistry.assertRegistered(exports.ModuleNames.ExcelExportModule, 'api.getMultipleSheetsAsExcel')) {
29835 return this.excelCreator.getMultipleSheetsAsExcel(params);
29836 }
29837 };
29838 /** Downloads an Excel export of multiple sheets in one file. */
29839 GridApi.prototype.exportMultipleSheetsAsExcel = function (params) {
29840 if (ModuleRegistry.assertRegistered(exports.ModuleNames.ExcelExportModule, 'api.exportMultipleSheetsAsExcel')) {
29841 return this.excelCreator.exportMultipleSheetsAsExcel(params);
29842 }
29843 };
29844 /** @deprecated */
29845 GridApi.prototype.setEnterpriseDatasource = function (datasource) {
29846 console.warn("AG Grid: since version 18.x, api.setEnterpriseDatasource() should be replaced with api.setServerSideDatasource()");
29847 this.setServerSideDatasource(datasource);
29848 };
29849 /**
29850 * Sets an ARIA property in the grid panel (element with `role=\"grid\"`), and removes an ARIA property when the value is null.
29851 *
29852 * Example: `api.setGridAriaProperty('label', 'my grid')` will set `aria-label=\"my grid\"`.
29853 *
29854 * `api.setGridAriaProperty('label', null)` will remove the `aria-label` attribute from the grid element.
29855 */
29856 GridApi.prototype.setGridAriaProperty = function (property, value) {
29857 if (!property) {
29858 return;
29859 }
29860 var eGrid = this.ctrlsService.getGridBodyCtrl().getGui();
29861 var ariaProperty = "aria-" + property;
29862 if (value === null) {
29863 eGrid.removeAttribute(ariaProperty);
29864 }
29865 else {
29866 eGrid.setAttribute(ariaProperty, value);
29867 }
29868 };
29869 /** Set new datasource for Server-Side Row Model. */
29870 GridApi.prototype.setServerSideDatasource = function (datasource) {
29871 if (this.serverSideRowModel) {
29872 // should really have an IEnterpriseRowModel interface, so we are not casting to any
29873 this.serverSideRowModel.setDatasource(datasource);
29874 }
29875 else {
29876 console.warn("AG Grid: you can only use an enterprise datasource when gridOptions.rowModelType is '" + Constants.ROW_MODEL_TYPE_SERVER_SIDE + "'");
29877 }
29878 };
29879 /** Set new datasource for Infinite Row Model. */
29880 GridApi.prototype.setDatasource = function (datasource) {
29881 if (this.gridOptionsWrapper.isRowModelInfinite()) {
29882 this.rowModel.setDatasource(datasource);
29883 }
29884 else {
29885 console.warn("AG Grid: you can only use a datasource when gridOptions.rowModelType is '" + Constants.ROW_MODEL_TYPE_INFINITE + "'");
29886 }
29887 };
29888 /** Set new datasource for Viewport Row Model. */
29889 GridApi.prototype.setViewportDatasource = function (viewportDatasource) {
29890 if (this.gridOptionsWrapper.isRowModelViewport()) {
29891 // this is bad coding, because it's using an interface that's exposed in the enterprise.
29892 // really we should create an interface in the core for viewportDatasource and let
29893 // the enterprise implement it, rather than casting to 'any' here
29894 this.rowModel.setViewportDatasource(viewportDatasource);
29895 }
29896 else {
29897 console.warn("AG Grid: you can only use a viewport datasource when gridOptions.rowModelType is '" + Constants.ROW_MODEL_TYPE_VIEWPORT + "'");
29898 }
29899 };
29900 /** Set the row data. */
29901 GridApi.prototype.setRowData = function (rowData) {
29902 // immutable service is part of the CSRM module, if missing, no CSRM
29903 var missingImmutableService = this.immutableService == null;
29904 if (missingImmutableService) {
29905 console.warn('AG Grid: you can only set rowData when using the Client Side Row Model');
29906 return;
29907 }
29908 // if no keys provided provided for rows, then we can tread the operation as Immutable
29909 if (this.immutableService.isActive()) {
29910 this.immutableService.setRowData(rowData);
29911 }
29912 else {
29913 this.selectionService.reset();
29914 this.clientSideRowModel.setRowData(rowData);
29915 }
29916 };
29917 /** @deprecated */
29918 GridApi.prototype.setFloatingTopRowData = function (rows) {
29919 console.warn('AG Grid: since v12, api.setFloatingTopRowData() is now api.setPinnedTopRowData()');
29920 this.setPinnedTopRowData(rows);
29921 };
29922 /** @deprecated */
29923 GridApi.prototype.setFloatingBottomRowData = function (rows) {
29924 console.warn('AG Grid: since v12, api.setFloatingBottomRowData() is now api.setPinnedBottomRowData()');
29925 this.setPinnedBottomRowData(rows);
29926 };
29927 /** @deprecated */
29928 GridApi.prototype.getFloatingTopRowCount = function () {
29929 console.warn('AG Grid: since v12, api.getFloatingTopRowCount() is now api.getPinnedTopRowCount()');
29930 return this.getPinnedTopRowCount();
29931 };
29932 /** @deprecated */
29933 GridApi.prototype.getFloatingBottomRowCount = function () {
29934 console.warn('AG Grid: since v12, api.getFloatingBottomRowCount() is now api.getPinnedBottomRowCount()');
29935 return this.getPinnedBottomRowCount();
29936 };
29937 /** @deprecated */
29938 GridApi.prototype.getFloatingTopRow = function (index) {
29939 console.warn('AG Grid: since v12, api.getFloatingTopRow() is now api.getPinnedTopRow()');
29940 return this.getPinnedTopRow(index);
29941 };
29942 /** @deprecated */
29943 GridApi.prototype.getFloatingBottomRow = function (index) {
29944 console.warn('AG Grid: since v12, api.getFloatingBottomRow() is now api.getPinnedBottomRow()');
29945 return this.getPinnedBottomRow(index);
29946 };
29947 /** Set the top pinned rows. Call with no rows / undefined to clear top pinned rows. */
29948 GridApi.prototype.setPinnedTopRowData = function (rows) {
29949 this.pinnedRowModel.setPinnedTopRowData(rows);
29950 };
29951 /** Set the bottom pinned rows. Call with no rows / undefined to clear bottom pinned rows. */
29952 GridApi.prototype.setPinnedBottomRowData = function (rows) {
29953 this.pinnedRowModel.setPinnedBottomRowData(rows);
29954 };
29955 /** Gets the number of top pinned rows. */
29956 GridApi.prototype.getPinnedTopRowCount = function () {
29957 return this.pinnedRowModel.getPinnedTopRowCount();
29958 };
29959 /** Gets the number of bottom pinned rows. */
29960 GridApi.prototype.getPinnedBottomRowCount = function () {
29961 return this.pinnedRowModel.getPinnedBottomRowCount();
29962 };
29963 /** Gets the top pinned row with the specified index. */
29964 GridApi.prototype.getPinnedTopRow = function (index) {
29965 return this.pinnedRowModel.getPinnedTopRow(index);
29966 };
29967 /** Gets the top pinned row with the specified index. */
29968 GridApi.prototype.getPinnedBottomRow = function (index) {
29969 return this.pinnedRowModel.getPinnedBottomRow(index);
29970 };
29971 /**
29972 * Call to set new column definitions. The grid will redraw all the column headers, and then redraw all of the rows.
29973 */
29974 GridApi.prototype.setColumnDefs = function (colDefs, source) {
29975 if (source === void 0) { source = "api"; }
29976 this.columnModel.setColumnDefs(colDefs, source);
29977 };
29978 /** Call to set new auto group column definition. The grid will recreate any auto-group columns if present. */
29979 GridApi.prototype.setAutoGroupColumnDef = function (colDef, source) {
29980 this.gridOptionsWrapper.setProperty('autoGroupColumnDef', colDef, true);
29981 };
29982 /** Call to set new Default Column Definition. */
29983 GridApi.prototype.setDefaultColDef = function (colDef, source) {
29984 this.gridOptionsWrapper.setProperty('defaultColDef', colDef, true);
29985 };
29986 GridApi.prototype.expireValueCache = function () {
29987 this.valueCache.expire();
29988 };
29989 /**
29990 * Returns an object with two properties:
29991 * - `top`: The top pixel position of the current scroll in the grid
29992 * - `bottom`: The bottom pixel position of the current scroll in the grid
29993 */
29994 GridApi.prototype.getVerticalPixelRange = function () {
29995 return this.gridBodyCtrl.getScrollFeature().getVScrollPosition();
29996 };
29997 /**
29998 * Returns an object with two properties:
29999 * - `left`: The left pixel position of the current scroll in the grid
30000 * - `right`: The right pixel position of the current scroll in the grid
30001 */
30002 GridApi.prototype.getHorizontalPixelRange = function () {
30003 return this.gridBodyCtrl.getScrollFeature().getHScrollPosition();
30004 };
30005 /** If `true`, the horizontal scrollbar will always be present, even if not required. Otherwise, it will only be displayed when necessary. */
30006 GridApi.prototype.setAlwaysShowHorizontalScroll = function (show) {
30007 this.gridOptionsWrapper.setProperty('alwaysShowHorizontalScroll', show);
30008 };
30009 /** If `true`, the vertical scrollbar will always be present, even if not required. Otherwise it will only be displayed when necessary. */
30010 GridApi.prototype.setAlwaysShowVerticalScroll = function (show) {
30011 this.gridOptionsWrapper.setProperty('alwaysShowVerticalScroll', show);
30012 };
30013 /** Force refresh all tool panels by calling their `refresh` method. */
30014 GridApi.prototype.refreshToolPanel = function () {
30015 if (!this.sideBarComp) {
30016 return;
30017 }
30018 this.sideBarComp.refresh();
30019 };
30020 /** Performs change detection on all cells, refreshing cells where required. */
30021 GridApi.prototype.refreshCells = function (params) {
30022 if (params === void 0) { params = {}; }
30023 if (Array.isArray(params)) {
30024 // the old version of refreshCells() took an array of rowNodes for the first argument
30025 console.warn('since AG Grid v11.1, refreshCells() now takes parameters, please see the documentation.');
30026 return;
30027 }
30028 this.rowRenderer.refreshCells(params);
30029 };
30030 /** Flash rows, columns or individual cells. */
30031 GridApi.prototype.flashCells = function (params) {
30032 if (params === void 0) { params = {}; }
30033 this.rowRenderer.flashCells(params);
30034 };
30035 /** Remove row(s) from the DOM and recreate them again from scratch. */
30036 GridApi.prototype.redrawRows = function (params) {
30037 if (params === void 0) { params = {}; }
30038 var rowNodes = params ? params.rowNodes : undefined;
30039 this.rowRenderer.redrawRows(rowNodes);
30040 };
30041 GridApi.prototype.setFunctionsReadOnly = function (readOnly) {
30042 this.gridOptionsWrapper.setProperty('functionsReadOnly', readOnly);
30043 };
30044 /** Redraws the header. Useful if a column name changes, or something else that changes how the column header is displayed. */
30045 GridApi.prototype.refreshHeader = function () {
30046 this.ctrlsService.getHeaderRowContainerCtrls().forEach(function (c) { return c.refresh(); });
30047 };
30048 /** Returns `true` if any filter is set. This includes quick filter, advanced filter or external filter. */
30049 GridApi.prototype.isAnyFilterPresent = function () {
30050 return this.filterManager.isAnyFilterPresent();
30051 };
30052 /** Returns `true` if any column filter is set, otherwise `false`. */
30053 GridApi.prototype.isColumnFilterPresent = function () {
30054 return this.filterManager.isColumnFilterPresent() || this.filterManager.isAggregateFilterPresent();
30055 };
30056 /** Returns `true` if the quick filter is set, otherwise `false`. */
30057 GridApi.prototype.isQuickFilterPresent = function () {
30058 return this.filterManager.isQuickFilterPresent();
30059 };
30060 /**
30061 * Returns the row model inside the table.
30062 * From here you can see the original rows, rows after filter has been applied,
30063 * rows after aggregation has been applied, and the final set of 'to be displayed' rows.
30064 */
30065 GridApi.prototype.getModel = function () {
30066 return this.rowModel;
30067 };
30068 /** Expand or collapse a specific row node. */
30069 GridApi.prototype.setRowNodeExpanded = function (rowNode, expanded) {
30070 if (rowNode) {
30071 rowNode.setExpanded(expanded);
30072 }
30073 };
30074 /**
30075 * If after getting the model, you expand or collapse a group, call this method to inform the grid.
30076 * It will work out the final set of 'to be displayed' rows again (i.e. expand or collapse the group visually).
30077 */
30078 GridApi.prototype.onGroupExpandedOrCollapsed = function (deprecated_refreshFromIndex) {
30079 if (missing(this.clientSideRowModel)) {
30080 console.warn('AG Grid: cannot call onGroupExpandedOrCollapsed unless using normal row model');
30081 }
30082 if (exists(deprecated_refreshFromIndex)) {
30083 console.warn('AG Grid: api.onGroupExpandedOrCollapsed - refreshFromIndex parameter is no longer used, the grid will refresh all rows');
30084 }
30085 // we don't really want the user calling this if only one rowNode was expanded, instead they should be
30086 // calling rowNode.setExpanded(boolean) - this way we do a 'keepRenderedRows=false' so that the whole
30087 // grid gets refreshed again - otherwise the row with the rowNodes that were changed won't get updated,
30088 // and thus the expand icon in the group cell won't get 'opened' or 'closed'.
30089 this.clientSideRowModel.refreshModel({ step: exports.ClientSideRowModelSteps.MAP });
30090 };
30091 GridApi.prototype.refreshInMemoryRowModel = function (step) {
30092 console.warn("ag-grid: since version 18.x, api.refreshInMemoryRowModel() should be replaced with api.refreshClientSideRowModel()");
30093 this.refreshClientSideRowModel(step);
30094 };
30095 /** Gets the Client-Side Row Model to refresh, executing the grouping, filtering and sorting again. */
30096 GridApi.prototype.refreshClientSideRowModel = function (step) {
30097 if (missing(this.clientSideRowModel)) {
30098 console.warn('cannot call refreshClientSideRowModel unless using normal row model');
30099 }
30100 var paramsStep = exports.ClientSideRowModelSteps.EVERYTHING;
30101 var stepsMapped = {
30102 group: exports.ClientSideRowModelSteps.EVERYTHING,
30103 filter: exports.ClientSideRowModelSteps.FILTER,
30104 map: exports.ClientSideRowModelSteps.MAP,
30105 aggregate: exports.ClientSideRowModelSteps.AGGREGATE,
30106 sort: exports.ClientSideRowModelSteps.SORT,
30107 pivot: exports.ClientSideRowModelSteps.PIVOT
30108 };
30109 if (exists(step)) {
30110 paramsStep = stepsMapped[step];
30111 }
30112 if (missing(paramsStep)) {
30113 console.error("AG Grid: invalid step " + step + ", available steps are " + Object.keys(stepsMapped).join(', '));
30114 return;
30115 }
30116 var animate = !this.gridOptionsWrapper.isSuppressAnimationFrame();
30117 var modelParams = {
30118 step: paramsStep,
30119 keepRenderedRows: true,
30120 keepEditingRows: true,
30121 animate: animate
30122 };
30123 this.clientSideRowModel.refreshModel(modelParams);
30124 };
30125 /** Returns `true` when there are no more animation frames left to process. */
30126 GridApi.prototype.isAnimationFrameQueueEmpty = function () {
30127 return this.animationFrameService.isQueueEmpty();
30128 };
30129 GridApi.prototype.flushAllAnimationFrames = function () {
30130 this.animationFrameService.flushAllFrames();
30131 };
30132 /**
30133 * Returns the row node with the given ID.
30134 * The row node ID is the one you provide from the callback `getRowId(params)`,
30135 * otherwise the ID is a number (cast as string) auto-generated by the grid when
30136 * the row data is set.
30137 */
30138 GridApi.prototype.getRowNode = function (id) {
30139 return this.rowModel.getRowNode(id);
30140 };
30141 /**
30142 * Gets the sizes that various UI elements will be rendered at with the current theme.
30143 * If you override the row or header height using `gridOptions`, the override value you provided will be returned.
30144 */
30145 GridApi.prototype.getSizesForCurrentTheme = function () {
30146 return {
30147 rowHeight: this.gridOptionsWrapper.getRowHeightAsNumber(),
30148 headerHeight: this.gridOptionsWrapper.getHeaderHeight()
30149 };
30150 };
30151 /** Expand all groups. */
30152 GridApi.prototype.expandAll = function () {
30153 if (this.clientSideRowModel) {
30154 this.clientSideRowModel.expandOrCollapseAll(true);
30155 }
30156 else if (this.serverSideRowModel) {
30157 this.serverSideRowModel.expandAll(true);
30158 }
30159 else {
30160 console.warn('AG Grid: expandAll only works with Client Side Row Model and Server Side Row Model');
30161 }
30162 };
30163 /** Collapse all groups. */
30164 GridApi.prototype.collapseAll = function () {
30165 if (this.clientSideRowModel) {
30166 this.clientSideRowModel.expandOrCollapseAll(false);
30167 }
30168 else if (this.serverSideRowModel) {
30169 this.serverSideRowModel.expandAll(false);
30170 }
30171 else {
30172 console.warn('AG Grid: collapseAll only works with Client Side Row Model and Server Side Row Model');
30173 }
30174 };
30175 /** Gets the tool panel instance corresponding to the supplied `id`. */
30176 GridApi.prototype.getToolPanelInstance = function (id) {
30177 if (!this.sideBarComp) {
30178 console.warn('AG Grid: toolPanel is only available in AG Grid Enterprise');
30179 return;
30180 }
30181 var comp = this.sideBarComp.getToolPanelInstance(id);
30182 return unwrapUserComp(comp);
30183 };
30184 GridApi.prototype.addVirtualRowListener = function (eventName, rowIndex, callback) {
30185 if (typeof eventName !== 'string') {
30186 console.warn('AG Grid: addVirtualRowListener is deprecated, please use addRenderedRowListener.');
30187 }
30188 this.addRenderedRowListener(eventName, rowIndex, callback);
30189 };
30190 /**
30191 * Registers a callback to a virtual row.
30192 * A virtual row is a row that is visually rendered on the screen (rows that are not visible because of the scroll position are not rendered).
30193 * Unlike normal events, you do not need to unregister rendered row listeners.
30194 * When the rendered row is removed from the grid, all associated rendered row listeners will also be removed.
30195 * Currently supports only one event, `virtualRowRemoved`;
30196 * listen for this event if your `cellRenderer` needs to do cleanup when the row no longer exists.
30197 */
30198 GridApi.prototype.addRenderedRowListener = function (eventName, rowIndex, callback) {
30199 if (eventName === 'virtualRowSelected') {
30200 console.warn("AG Grid: event virtualRowSelected is deprecated, to register for individual row\n selection events, add a listener directly to the row node.");
30201 }
30202 this.rowRenderer.addRenderedRowListener(eventName, rowIndex, callback);
30203 };
30204 /** Pass a quick filter text into the grid for filtering. */
30205 GridApi.prototype.setQuickFilter = function (newFilter) {
30206 this.filterManager.setQuickFilter(newFilter);
30207 };
30208 GridApi.prototype.selectIndex = function (index, tryMulti, suppressEvents) {
30209 console.warn('AG Grid: do not use api for selection, call node.setSelected(value) instead');
30210 if (suppressEvents) {
30211 console.warn('AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
30212 }
30213 this.selectionService.selectIndex(index, tryMulti);
30214 };
30215 GridApi.prototype.deselectIndex = function (index, suppressEvents) {
30216 if (suppressEvents === void 0) { suppressEvents = false; }
30217 console.warn('AG Grid: do not use api for selection, call node.setSelected(value) instead');
30218 if (suppressEvents) {
30219 console.warn('AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
30220 }
30221 this.selectionService.deselectIndex(index);
30222 };
30223 GridApi.prototype.selectNode = function (node, tryMulti, suppressEvents) {
30224 if (tryMulti === void 0) { tryMulti = false; }
30225 if (suppressEvents === void 0) { suppressEvents = false; }
30226 console.warn('AG Grid: API for selection is deprecated, call node.setSelected(value) instead');
30227 if (suppressEvents) {
30228 console.warn('AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
30229 }
30230 node.setSelectedParams({ newValue: true, clearSelection: !tryMulti });
30231 };
30232 GridApi.prototype.deselectNode = function (node, suppressEvents) {
30233 if (suppressEvents === void 0) { suppressEvents = false; }
30234 console.warn('AG Grid: API for selection is deprecated, call node.setSelected(value) instead');
30235 if (suppressEvents) {
30236 console.warn('AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it');
30237 }
30238 node.setSelectedParams({ newValue: false });
30239 };
30240 /** Select all rows, regardless of filtering and rows that are not visible due to grouping being enabled and their groups not expanded. */
30241 GridApi.prototype.selectAll = function () {
30242 this.selectionService.selectAllRowNodes();
30243 };
30244 /** Clear all row selections, regardless of filtering. */
30245 GridApi.prototype.deselectAll = function () {
30246 this.selectionService.deselectAllRowNodes();
30247 };
30248 /** Select all filtered rows. */
30249 GridApi.prototype.selectAllFiltered = function () {
30250 this.selectionService.selectAllRowNodes(true);
30251 };
30252 /** Clear all filtered selections. */
30253 GridApi.prototype.deselectAllFiltered = function () {
30254 this.selectionService.deselectAllRowNodes(true);
30255 };
30256 GridApi.prototype.recomputeAggregates = function () {
30257 if (missing(this.clientSideRowModel)) {
30258 console.warn('cannot call recomputeAggregates unless using normal row model');
30259 }
30260 console.warn("recomputeAggregates is deprecated, please call api.refreshClientSideRowModel('aggregate') instead");
30261 this.clientSideRowModel.refreshModel({ step: exports.ClientSideRowModelSteps.AGGREGATE });
30262 };
30263 /** Sets columns to adjust in size to fit the grid horizontally. */
30264 GridApi.prototype.sizeColumnsToFit = function () {
30265 this.gridBodyCtrl.sizeColumnsToFit();
30266 };
30267 /** Show the 'loading' overlay. */
30268 GridApi.prototype.showLoadingOverlay = function () {
30269 this.overlayWrapperComp.showLoadingOverlay();
30270 };
30271 /** Show the 'no rows' overlay. */
30272 GridApi.prototype.showNoRowsOverlay = function () {
30273 this.overlayWrapperComp.showNoRowsOverlay();
30274 };
30275 /** Hides the overlay if showing. */
30276 GridApi.prototype.hideOverlay = function () {
30277 this.overlayWrapperComp.hideOverlay();
30278 };
30279 GridApi.prototype.isNodeSelected = function (node) {
30280 console.warn('AG Grid: no need to call api.isNodeSelected(), just call node.isSelected() instead');
30281 return node.isSelected();
30282 };
30283 GridApi.prototype.getSelectedNodesById = function () {
30284 console.error('AG Grid: since version 3.4, getSelectedNodesById no longer exists, use getSelectedNodes() instead');
30285 return null;
30286 };
30287 /**
30288 * Returns a list of selected nodes.
30289 * Getting the underlying node (rather than the data) is useful when working with tree / aggregated data,
30290 * as the node can be traversed.
30291 */
30292 GridApi.prototype.getSelectedNodes = function () {
30293 return this.selectionService.getSelectedNodes();
30294 };
30295 /** Returns a list of selected rows (i.e. row data that you provided). */
30296 GridApi.prototype.getSelectedRows = function () {
30297 return this.selectionService.getSelectedRows();
30298 };
30299 /**
30300 * Returns a list of all selected nodes at 'best cost', a feature to be used with groups / trees.
30301 * If a group has all its children selected, then the group appears in the result, but not the children.
30302 * Designed for use with `'children'` as the group selection type, where groups don't actually appear in the selection normally.
30303 */
30304 GridApi.prototype.getBestCostNodeSelection = function () {
30305 return this.selectionService.getBestCostNodeSelection();
30306 };
30307 /** Retrieve rendered nodes. Due to virtualisation this will contain only the current visible rows and those in the buffer. */
30308 GridApi.prototype.getRenderedNodes = function () {
30309 return this.rowRenderer.getRenderedNodes();
30310 };
30311 GridApi.prototype.ensureColIndexVisible = function (index) {
30312 console.warn('AG Grid: ensureColIndexVisible(index) no longer supported, use ensureColumnVisible(colKey) instead.');
30313 };
30314 /**
30315 * Ensures the column is visible by scrolling the table if needed.
30316 * @param key - The column to ensure visible
30317 * @param position - Where the column will be positioned.
30318 * - `auto` - Scrolls the minimum amount to make sure the column is visible.
30319 * - `start` - Scrolls the column to the start of the viewport.
30320 * - `middle` - Scrolls the column to the middle of the viewport.
30321 * - `end` - Scrolls the column to the end of the viewport.
30322 */
30323 GridApi.prototype.ensureColumnVisible = function (key, position) {
30324 if (position === void 0) { position = 'auto'; }
30325 this.gridBodyCtrl.getScrollFeature().ensureColumnVisible(key, position);
30326 };
30327 /**
30328 * Ensures the row index is visible by vertically scrolling the grid.
30329 * If a position of `'top'`, `'middle'` or `'bottom'` is supplied, the grid will scroll the grid to place the row at the top, middle or bottom respectively.
30330 * Otherwise, the grid will do the minimum scrolling possible to show the row.
30331 * i.e.
30332 * - if the grid needs to scroll up then it will scroll so that the row is at the top,
30333 * - if the grid needs to scroll down then it will scroll so that the row is at the bottom,
30334 * - if the row is already in view then the grid will do nothing.
30335 */
30336 GridApi.prototype.ensureIndexVisible = function (index, position) {
30337 this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(index, position);
30338 };
30339 /**
30340 * Ensures a row node is visible, scrolling the grid if needed.
30341 * Provide either:
30342 * - the node,
30343 * - the data object
30344 * - a comparator function (that takes the node as a parameter, and returns `true` for match or `false` for no match).
30345 */
30346 GridApi.prototype.ensureNodeVisible = function (comparator, position) {
30347 if (position === void 0) { position = null; }
30348 this.gridBodyCtrl.getScrollFeature().ensureNodeVisible(comparator, position);
30349 };
30350 /**
30351 * Similar to `forEachNode`, except lists all the leaf nodes.
30352 * This effectively goes through all the data that you provided to the grid before the grid performed any grouping.
30353 * If using tree data, goes through all the nodes for the data you provided, including nodes that have children,
30354 * but excluding groups the grid created where gaps were missing in the hierarchy.
30355 */
30356 GridApi.prototype.forEachLeafNode = function (callback) {
30357 if (missing(this.clientSideRowModel)) {
30358 console.warn('cannot call forEachNode unless using normal row model');
30359 }
30360 this.clientSideRowModel.forEachLeafNode(callback);
30361 };
30362 /**
30363 * Iterates through each node (row) in the grid and calls the callback for each node.
30364 * This works similar to the `forEach` method on a JavaScript array.
30365 * This is called for every node, ignoring any filtering or sorting applied within the grid.
30366 * If using the Infinite Row Model, then this gets called for each page loaded in the page cache.
30367 */
30368 GridApi.prototype.forEachNode = function (callback) {
30369 this.rowModel.forEachNode(callback);
30370 };
30371 /** Similar to `forEachNode`, except skips any filtered out data. */
30372 GridApi.prototype.forEachNodeAfterFilter = function (callback) {
30373 if (missing(this.clientSideRowModel)) {
30374 console.warn('cannot call forEachNodeAfterFilter unless using normal row model');
30375 }
30376 this.clientSideRowModel.forEachNodeAfterFilter(callback);
30377 };
30378 /** Similar to `forEachNodeAfterFilter`, except the callbacks are called in the order the rows are displayed in the grid. */
30379 GridApi.prototype.forEachNodeAfterFilterAndSort = function (callback) {
30380 if (missing(this.clientSideRowModel)) {
30381 console.warn('cannot call forEachNodeAfterFilterAndSort unless using normal row model');
30382 }
30383 this.clientSideRowModel.forEachNodeAfterFilterAndSort(callback);
30384 };
30385 /**
30386 * Returns the filter component instance for a column.
30387 * `key` can be a string field name or a ColDef object (matches on object reference, useful if field names are not unique).
30388 * If your filter is created asynchronously, `getFilterInstance` will return `null` so you will need to use the `callback` to access the filter instance instead.
30389 */
30390 GridApi.prototype.getFilterInstance = function (key, callback) {
30391 var res = this.getFilterInstanceImpl(key, function (instance) {
30392 if (!callback) {
30393 return;
30394 }
30395 var unwrapped = unwrapUserComp(instance);
30396 callback(unwrapped);
30397 });
30398 var unwrapped = unwrapUserComp(res);
30399 return unwrapped;
30400 };
30401 GridApi.prototype.getFilterInstanceImpl = function (key, callback) {
30402 var column = this.columnModel.getPrimaryColumn(key);
30403 if (!column) {
30404 return undefined;
30405 }
30406 var filterPromise = this.filterManager.getFilterComponent(column, 'NO_UI');
30407 var currentValue = filterPromise && filterPromise.resolveNow(null, function (filterComp) { return filterComp; });
30408 if (currentValue) {
30409 setTimeout(callback, 0, currentValue);
30410 }
30411 else if (filterPromise) {
30412 filterPromise.then(function (comp) {
30413 callback(comp);
30414 });
30415 }
30416 return currentValue;
30417 };
30418 /** Destroys a filter. Useful to force a particular filter to be created from scratch again. */
30419 GridApi.prototype.destroyFilter = function (key) {
30420 var column = this.columnModel.getPrimaryColumn(key);
30421 if (column) {
30422 return this.filterManager.destroyFilter(column, "filterDestroyed");
30423 }
30424 };
30425 /** Gets the status panel instance corresponding to the supplied `id`. */
30426 GridApi.prototype.getStatusPanel = function (key) {
30427 if (!this.statusBarService) {
30428 return;
30429 }
30430 var comp = this.statusBarService.getStatusPanel(key);
30431 return unwrapUserComp(comp);
30432 };
30433 GridApi.prototype.getColumnDef = function (key) {
30434 var column = this.columnModel.getPrimaryColumn(key);
30435 if (column) {
30436 return column.getColDef();
30437 }
30438 return null;
30439 };
30440 /**
30441 * Returns the current column definitions.
30442 */
30443 GridApi.prototype.getColumnDefs = function () { return this.columnModel.getColumnDefs(); };
30444 /** Informs the grid that a filter has changed. This is typically called after a filter change through one of the filter APIs. */
30445 GridApi.prototype.onFilterChanged = function () {
30446 this.filterManager.onFilterChanged();
30447 };
30448 /**
30449 * Gets the grid to act as if the sort was changed.
30450 * Useful if you update some values and want to get the grid to reorder them according to the new values.
30451 */
30452 GridApi.prototype.onSortChanged = function () {
30453 this.sortController.onSortChanged('api');
30454 };
30455 /** Sets the state of all the advanced filters. Provide it with what you get from `getFilterModel()` to restore filter state. */
30456 GridApi.prototype.setFilterModel = function (model) {
30457 this.filterManager.setFilterModel(model);
30458 };
30459 /** Gets the current state of all the advanced filters. Used for saving filter state. */
30460 GridApi.prototype.getFilterModel = function () {
30461 return this.filterManager.getFilterModel();
30462 };
30463 /** Returns the focused cell (or the last focused cell if the grid lost focus). */
30464 GridApi.prototype.getFocusedCell = function () {
30465 return this.focusService.getFocusedCell();
30466 };
30467 /** Clears the focused cell. */
30468 GridApi.prototype.clearFocusedCell = function () {
30469 return this.focusService.clearFocusedCell();
30470 };
30471 /** Sets the focus to the specified cell. `rowPinned` can be either 'top', 'bottom' or null (for not pinned). */
30472 GridApi.prototype.setFocusedCell = function (rowIndex, colKey, rowPinned) {
30473 this.focusService.setFocusedCell(rowIndex, colKey, rowPinned, true);
30474 };
30475 /** Sets the `suppressRowDrag` property. */
30476 GridApi.prototype.setSuppressRowDrag = function (value) {
30477 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_ROW_DRAG, value);
30478 };
30479 /** Sets the `suppressMoveWhenRowDragging` property. */
30480 GridApi.prototype.setSuppressMoveWhenRowDragging = function (value) {
30481 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_MOVE_WHEN_ROW_DRAG, value);
30482 };
30483 /** Sets the `suppressRowClickSelection` property. */
30484 GridApi.prototype.setSuppressRowClickSelection = function (value) {
30485 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_ROW_CLICK_SELECTION, value);
30486 };
30487 /** Adds a drop zone outside of the grid where rows can be dropped. */
30488 GridApi.prototype.addRowDropZone = function (params) {
30489 this.gridBodyCtrl.getRowDragFeature().addRowDropZone(params);
30490 };
30491 /** Removes an external drop zone added by `addRowDropZone`. */
30492 GridApi.prototype.removeRowDropZone = function (params) {
30493 var activeDropTarget = this.dragAndDropService.findExternalZone(params);
30494 if (activeDropTarget) {
30495 this.dragAndDropService.removeDropTarget(activeDropTarget);
30496 }
30497 };
30498 /** Returns the `RowDropZoneParams` to be used by another grid's `addRowDropZone` method. */
30499 GridApi.prototype.getRowDropZoneParams = function (events) {
30500 return this.gridBodyCtrl.getRowDragFeature().getRowDropZone(events);
30501 };
30502 /** Sets the height in pixels for the row containing the column label header. */
30503 GridApi.prototype.setHeaderHeight = function (headerHeight) {
30504 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_HEADER_HEIGHT, headerHeight);
30505 };
30506 /**
30507 * Switch between layout options: `normal`, `autoHeight`, `print`.
30508 * Defaults to `normal` if no domLayout provided.
30509 */
30510 GridApi.prototype.setDomLayout = function (domLayout) {
30511 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_DOM_LAYOUT, domLayout);
30512 };
30513 /** Sets the `enableCellTextSelection` property. */
30514 GridApi.prototype.setEnableCellTextSelection = function (selectable) {
30515 this.gridBodyCtrl.setCellTextSelection(selectable);
30516 };
30517 /** Sets the preferred direction for the selection fill handle. */
30518 GridApi.prototype.setFillHandleDirection = function (direction) {
30519 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_FILL_HANDLE_DIRECTION, direction);
30520 };
30521 /** Sets the height in pixels for the rows containing header column groups. */
30522 GridApi.prototype.setGroupHeaderHeight = function (headerHeight) {
30523 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT, headerHeight);
30524 };
30525 /** Sets the height in pixels for the row containing the floating filters. */
30526 GridApi.prototype.setFloatingFiltersHeight = function (headerHeight) {
30527 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT, headerHeight);
30528 };
30529 /** Sets the height in pixels for the row containing the columns when in pivot mode. */
30530 GridApi.prototype.setPivotHeaderHeight = function (headerHeight) {
30531 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT, headerHeight);
30532 };
30533 /** Sets the height in pixels for the row containing header column groups when in pivot mode. */
30534 GridApi.prototype.setPivotGroupHeaderHeight = function (headerHeight) {
30535 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT, headerHeight);
30536 };
30537 GridApi.prototype.setIsExternalFilterPresent = function (isExternalFilterPresentFunc) {
30538 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_EXTERNAL_FILTER_PRESENT, isExternalFilterPresentFunc);
30539 };
30540 GridApi.prototype.setDoesExternalFilterPass = function (doesExternalFilterPassFunc) {
30541 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_DOES_EXTERNAL_FILTER_PASS, doesExternalFilterPassFunc);
30542 };
30543 GridApi.prototype.setNavigateToNextCell = function (navigateToNextCellFunc) {
30544 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_NAVIGATE_TO_NEXT_CELL, navigateToNextCellFunc);
30545 };
30546 GridApi.prototype.setTabToNextCell = function (tabToNextCellFunc) {
30547 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_TAB_TO_NEXT_CELL, tabToNextCellFunc);
30548 };
30549 GridApi.prototype.setTabToNextHeader = function (tabToNextHeaderFunc) {
30550 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_TAB_TO_NEXT_HEADER, tabToNextHeaderFunc);
30551 };
30552 GridApi.prototype.setNavigateToNextHeader = function (navigateToNextHeaderFunc) {
30553 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_NAVIGATE_TO_NEXT_HEADER, navigateToNextHeaderFunc);
30554 };
30555 GridApi.prototype.setGroupRowAggNodes = function (groupRowAggNodesFunc) {
30556 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GROUP_ROW_AGG_NODES, groupRowAggNodesFunc);
30557 };
30558 GridApi.prototype.setGetGroupRowAgg = function (getGroupRowAggFunc) {
30559 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_GROUP_ROW_AGG, getGroupRowAggFunc);
30560 };
30561 GridApi.prototype.setGetBusinessKeyForNode = function (getBusinessKeyForNodeFunc) {
30562 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_BUSINESS_KEY_FOR_NODE, getBusinessKeyForNodeFunc);
30563 };
30564 GridApi.prototype.setGetChildCount = function (getChildCountFunc) {
30565 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_CHILD_COUNT, getChildCountFunc);
30566 };
30567 GridApi.prototype.setProcessRowPostCreate = function (processRowPostCreateFunc) {
30568 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_ROW_POST_CREATE, processRowPostCreateFunc);
30569 };
30570 GridApi.prototype.setGetRowNodeId = function (getRowNodeIdFunc) {
30571 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_NODE_ID, getRowNodeIdFunc);
30572 };
30573 GridApi.prototype.setGetRowId = function (getRowIdFunc) {
30574 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_ID, getRowIdFunc);
30575 };
30576 GridApi.prototype.setGetRowClass = function (rowClassFunc) {
30577 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_CLASS, rowClassFunc);
30578 };
30579 GridApi.prototype.setIsFullWidthCell = function (isFullWidthCellFunc) {
30580 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_FULL_WIDTH_CELL, isFullWidthCellFunc);
30581 };
30582 GridApi.prototype.setIsFullWidthRow = function (isFullWidthRowFunc) {
30583 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_FULL_WIDTH_ROW, isFullWidthRowFunc);
30584 };
30585 GridApi.prototype.setIsRowSelectable = function (isRowSelectableFunc) {
30586 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_ROW_SELECTABLE, isRowSelectableFunc);
30587 };
30588 GridApi.prototype.setIsRowMaster = function (isRowMasterFunc) {
30589 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_ROW_MASTER, isRowMasterFunc);
30590 };
30591 GridApi.prototype.setPostSort = function (postSortFunc) {
30592 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_POST_SORT, postSortFunc);
30593 };
30594 GridApi.prototype.setPostSortRows = function (postSortRowsFunc) {
30595 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_POST_SORT_ROWS, postSortRowsFunc);
30596 };
30597 GridApi.prototype.setGetDocument = function (getDocumentFunc) {
30598 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_DOCUMENT, getDocumentFunc);
30599 };
30600 GridApi.prototype.setGetContextMenuItems = function (getContextMenuItemsFunc) {
30601 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_CONTEXT_MENU_ITEMS, getContextMenuItemsFunc);
30602 };
30603 GridApi.prototype.setGetMainMenuItems = function (getMainMenuItemsFunc) {
30604 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_MAIN_MENU_ITEMS, getMainMenuItemsFunc);
30605 };
30606 GridApi.prototype.setProcessCellForClipboard = function (processCellForClipboardFunc) {
30607 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_CELL_FOR_CLIPBOARD, processCellForClipboardFunc);
30608 };
30609 GridApi.prototype.setSendToClipboard = function (sendToClipboardFunc) {
30610 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SEND_TO_CLIPBOARD, sendToClipboardFunc);
30611 };
30612 GridApi.prototype.setProcessCellFromClipboard = function (processCellFromClipboardFunc) {
30613 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_CELL_FROM_CLIPBOARD, processCellFromClipboardFunc);
30614 };
30615 GridApi.prototype.setProcessSecondaryColDef = function (processSecondaryColDefFunc) {
30616 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_TO_SECONDARY_COLDEF, processSecondaryColDefFunc);
30617 };
30618 GridApi.prototype.setProcessSecondaryColGroupDef = function (processSecondaryColGroupDefFunc) {
30619 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PROCESS_SECONDARY_COL_GROUP_DEF, processSecondaryColGroupDefFunc);
30620 };
30621 GridApi.prototype.setPostProcessPopup = function (postProcessPopupFunc) {
30622 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_POST_PROCESS_POPUP, postProcessPopupFunc);
30623 };
30624 GridApi.prototype.setDefaultGroupOrderComparator = function (defaultGroupOrderComparatorFunc) {
30625 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_DEFAULT_GROUP_ORDER_COMPARATOR, defaultGroupOrderComparatorFunc);
30626 };
30627 GridApi.prototype.setInitialGroupOrderComparator = function (initialGroupOrderComparatorFunc) {
30628 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_INITIAL_GROUP_ORDER_COMPARATOR, initialGroupOrderComparatorFunc);
30629 };
30630 GridApi.prototype.setGetChartToolbarItems = function (getChartToolbarItemsFunc) {
30631 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_CHART_TOOLBAR_ITEMS, getChartToolbarItemsFunc);
30632 };
30633 GridApi.prototype.setPaginationNumberFormatter = function (paginationNumberFormatterFunc) {
30634 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_PAGINATION_NUMBER_FORMATTER, paginationNumberFormatterFunc);
30635 };
30636 GridApi.prototype.setGetServerSideStoreParams = function (getServerSideStoreParamsFunc) {
30637 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_SERVER_SIDE_STORE_PARAMS, getServerSideStoreParamsFunc);
30638 };
30639 GridApi.prototype.setIsServerSideGroupOpenByDefault = function (isServerSideGroupOpenByDefaultFunc) {
30640 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_SERVER_SIDE_GROUPS_OPEN_BY_DEFAULT, isServerSideGroupOpenByDefaultFunc);
30641 };
30642 GridApi.prototype.setIsApplyServerSideTransaction = function (isApplyServerSideTransactionFunc) {
30643 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_APPLY_SERVER_SIDE_TRANSACTION, isApplyServerSideTransactionFunc);
30644 };
30645 GridApi.prototype.setIsServerSideGroup = function (isServerSideGroupFunc) {
30646 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_IS_SERVER_SIDE_GROUP, isServerSideGroupFunc);
30647 };
30648 GridApi.prototype.setGetServerSideGroupKey = function (getServerSideGroupKeyFunc) {
30649 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_SERVER_SIDE_GROUP_KEY, getServerSideGroupKeyFunc);
30650 };
30651 GridApi.prototype.setGetRowStyle = function (rowStyleFunc) {
30652 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_STYLE, rowStyleFunc);
30653 };
30654 GridApi.prototype.setGetRowHeight = function (rowHeightFunc) {
30655 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GET_ROW_HEIGHT, rowHeightFunc);
30656 };
30657 /** Returns `true` if the side bar is visible. */
30658 GridApi.prototype.isSideBarVisible = function () {
30659 return this.sideBarComp ? this.sideBarComp.isDisplayed() : false;
30660 };
30661 /** Show/hide the entire side bar, including any visible panel and the tab buttons. */
30662 GridApi.prototype.setSideBarVisible = function (show) {
30663 if (!this.sideBarComp) {
30664 if (show) {
30665 console.warn('AG Grid: sideBar is not loaded');
30666 }
30667 return;
30668 }
30669 this.sideBarComp.setDisplayed(show);
30670 };
30671 /** Sets the side bar position relative to the grid. Possible values are `'left'` or `'right'`. */
30672 GridApi.prototype.setSideBarPosition = function (position) {
30673 if (!this.sideBarComp) {
30674 console.warn('AG Grid: sideBar is not loaded');
30675 return;
30676 }
30677 this.sideBarComp.setSideBarPosition(position);
30678 };
30679 /** Opens a particular tool panel. Provide the ID of the tool panel to open. */
30680 GridApi.prototype.openToolPanel = function (key) {
30681 if (!this.sideBarComp) {
30682 console.warn('AG Grid: toolPanel is only available in AG Grid Enterprise');
30683 return;
30684 }
30685 this.sideBarComp.openToolPanel(key);
30686 };
30687 /** Closes the currently open tool panel (if any). */
30688 GridApi.prototype.closeToolPanel = function () {
30689 if (!this.sideBarComp) {
30690 console.warn('AG Grid: toolPanel is only available in AG Grid Enterprise');
30691 return;
30692 }
30693 this.sideBarComp.close();
30694 };
30695 /** Returns the ID of the currently shown tool panel if any, otherwise `null`. */
30696 GridApi.prototype.getOpenedToolPanel = function () {
30697 return this.sideBarComp ? this.sideBarComp.openedItem() : null;
30698 };
30699 /** Returns the current side bar configuration. If a shortcut was used, returns the detailed long form. */
30700 GridApi.prototype.getSideBar = function () {
30701 return this.gridOptionsWrapper.getSideBar();
30702 };
30703 /** Resets the side bar to the provided configuration. The parameter is the same as the sideBar grid property. The side bar is re-created from scratch with the new config. */
30704 GridApi.prototype.setSideBar = function (def) {
30705 this.gridOptionsWrapper.setProperty('sideBar', SideBarDefParser.parse(def));
30706 };
30707 GridApi.prototype.setSuppressClipboardPaste = function (value) {
30708 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_SUPPRESS_CLIPBOARD_PASTE, value);
30709 };
30710 /** Returns `true` if the tool panel is showing, otherwise `false`. */
30711 GridApi.prototype.isToolPanelShowing = function () {
30712 return this.sideBarComp.isToolPanelShowing();
30713 };
30714 GridApi.prototype.doLayout = function () {
30715 var message = "AG Grid - since version 25.1, doLayout was taken out, as it's not needed. The grid responds to grid size changes automatically";
30716 doOnce(function () { return console.warn(message); }, 'doLayoutDeprecated');
30717 };
30718 /** Tells the grid to recalculate the row heights. */
30719 GridApi.prototype.resetRowHeights = function () {
30720 if (exists(this.clientSideRowModel)) {
30721 if (this.columnModel.isAutoRowHeightActive()) {
30722 console.warn('AG Grid: calling gridApi.resetRowHeights() makes no sense when using Auto Row Height.');
30723 return;
30724 }
30725 this.clientSideRowModel.resetRowHeights();
30726 }
30727 };
30728 GridApi.prototype.setGroupRemoveSingleChildren = function (value) {
30729 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, value);
30730 };
30731 GridApi.prototype.setGroupRemoveLowestSingleChildren = function (value) {
30732 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, value);
30733 };
30734 /** Tells the grid a row height has changed. To be used after calling `rowNode.setRowHeight(newHeight)`. */
30735 GridApi.prototype.onRowHeightChanged = function () {
30736 if (this.clientSideRowModel) {
30737 this.clientSideRowModel.onRowHeightChanged();
30738 }
30739 else if (this.serverSideRowModel) {
30740 this.serverSideRowModel.onRowHeightChanged();
30741 }
30742 };
30743 /**
30744 * Gets the value for a column for a particular `rowNode` (row).
30745 * This is useful if you want the raw value of a cell e.g. if implementing your own CSV export.
30746 */
30747 GridApi.prototype.getValue = function (colKey, rowNode) {
30748 var column = this.columnModel.getPrimaryColumn(colKey);
30749 if (missing(column)) {
30750 column = this.columnModel.getGridColumn(colKey);
30751 }
30752 if (missing(column)) {
30753 return null;
30754 }
30755 return this.valueService.getValue(column, rowNode);
30756 };
30757 /** Add an event listener for the specified `eventType`. Works similar to `addEventListener` for a browser DOM element. */
30758 GridApi.prototype.addEventListener = function (eventType, listener) {
30759 var async = this.gridOptionsWrapper.useAsyncEvents();
30760 this.eventService.addEventListener(eventType, listener, async);
30761 };
30762 /** Add an event listener for all event types coming from the grid. */
30763 GridApi.prototype.addGlobalListener = function (listener) {
30764 var async = this.gridOptionsWrapper.useAsyncEvents();
30765 this.eventService.addGlobalListener(listener, async);
30766 };
30767 /** Remove an event listener. */
30768 GridApi.prototype.removeEventListener = function (eventType, listener) {
30769 var async = this.gridOptionsWrapper.useAsyncEvents();
30770 this.eventService.removeEventListener(eventType, listener, async);
30771 };
30772 /** Remove a global event listener. */
30773 GridApi.prototype.removeGlobalListener = function (listener) {
30774 var async = this.gridOptionsWrapper.useAsyncEvents();
30775 this.eventService.removeGlobalListener(listener, async);
30776 };
30777 GridApi.prototype.dispatchEvent = function (event) {
30778 this.eventService.dispatchEvent(event);
30779 };
30780 /** Will destroy the grid and release resources. If you are using a framework you do not need to call this, as the grid links in with the framework lifecycle. However if you are using Web Components or native JavaScript, you do need to call this, to avoid a memory leak in your application. */
30781 GridApi.prototype.destroy = function () {
30782 // this is needed as GridAPI is a bean, and GridAPI.destroy() is called as part
30783 // of context.destroy(). so we need to stop the infinite loop.
30784 if (this.destroyCalled) {
30785 return;
30786 }
30787 this.destroyCalled = true;
30788 // destroy the UI first (as they use the services)
30789 var gridCtrl = this.ctrlsService.getGridCtrl();
30790 if (gridCtrl) {
30791 gridCtrl.destroyGridUi();
30792 }
30793 // destroy the services
30794 this.context.destroy();
30795 };
30796 GridApi.prototype.cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid = function () {
30797 // some users were raising support issues with regards memory leaks. the problem was the customers applications
30798 // were keeping references to the API. trying to educate them all would be difficult, easier to just remove
30799 // all references in the API so at least the core grid can be garbage collected.
30800 //
30801 // wait about 100ms before clearing down the references, in case user has some cleanup to do,
30802 // and needs to deference the API first
30803 setTimeout(removeAllReferences.bind(window, this, 'Grid API'), 100);
30804 };
30805 GridApi.prototype.warnIfDestroyed = function (methodName) {
30806 if (this.destroyCalled) {
30807 console.warn("AG Grid: Grid API method " + methodName + " was called on a grid that was destroyed.");
30808 }
30809 return this.destroyCalled;
30810 };
30811 /** Reset the quick filter cache text on every rowNode. */
30812 GridApi.prototype.resetQuickFilter = function () {
30813 if (this.warnIfDestroyed('resetQuickFilter')) {
30814 return;
30815 }
30816 this.rowModel.forEachNode(function (node) { return node.quickFilterAggregateText = null; });
30817 };
30818 GridApi.prototype.getRangeSelections = function () {
30819 console.warn("AG Grid: in v20.1.x, api.getRangeSelections() is gone, please use getCellRanges() instead.\n We had to change how cell selections works a small bit to allow charting to integrate. The return type of\n getCellRanges() is a bit different, please check the AG Grid documentation.");
30820 return null;
30821 };
30822 /** Returns the list of selected cell ranges. */
30823 GridApi.prototype.getCellRanges = function () {
30824 if (this.rangeService) {
30825 return this.rangeService.getCellRanges();
30826 }
30827 console.warn('AG Grid: cell range selection is only available in AG Grid Enterprise');
30828 return null;
30829 };
30830 GridApi.prototype.camelCaseToHumanReadable = function (camelCase) {
30831 return camelCaseToHumanText(camelCase);
30832 };
30833 GridApi.prototype.addRangeSelection = function (deprecatedNoLongerUsed) {
30834 console.warn('AG Grid: As of version 21.x, range selection changed slightly to allow charting integration. Please call api.addCellRange() instead of api.addRangeSelection()');
30835 };
30836 /** Adds the provided cell range to the selected ranges. */
30837 GridApi.prototype.addCellRange = function (params) {
30838 if (!this.rangeService) {
30839 console.warn('AG Grid: cell range selection is only available in AG Grid Enterprise');
30840 }
30841 this.rangeService.addCellRange(params);
30842 };
30843 /** Clears the selected ranges. */
30844 GridApi.prototype.clearRangeSelection = function () {
30845 if (!this.rangeService) {
30846 console.warn('AG Grid: cell range selection is only available in AG Grid Enterprise');
30847 }
30848 this.rangeService.removeAllCellRanges();
30849 };
30850 /** Reverts the last cell edit. */
30851 GridApi.prototype.undoCellEditing = function () {
30852 this.undoRedoService.undo();
30853 };
30854 /** Re-applies the most recently undone cell edit. */
30855 GridApi.prototype.redoCellEditing = function () {
30856 this.undoRedoService.redo();
30857 };
30858 /** Returns current number of available cell edit undo operations. */
30859 GridApi.prototype.getCurrentUndoSize = function () {
30860 return this.undoRedoService.getCurrentUndoStackSize();
30861 };
30862 /** Returns current number of available cell edit redo operations. */
30863 GridApi.prototype.getCurrentRedoSize = function () {
30864 return this.undoRedoService.getCurrentRedoStackSize();
30865 };
30866 /** Returns a list of models with information about the charts that are currently rendered from the grid. */
30867 GridApi.prototype.getChartModels = function () {
30868 if (ModuleRegistry.assertRegistered(exports.ModuleNames.RangeSelectionModule, 'api.getChartModels') &&
30869 ModuleRegistry.assertRegistered(exports.ModuleNames.GridChartsModule, 'api.getChartModels')) {
30870 return this.chartService.getChartModels();
30871 }
30872 };
30873 /** Returns the `ChartRef` using the supplied `chartId`. */
30874 GridApi.prototype.getChartRef = function (chartId) {
30875 if (ModuleRegistry.assertRegistered(exports.ModuleNames.RangeSelectionModule, 'api.getChartRef') &&
30876 ModuleRegistry.assertRegistered(exports.ModuleNames.GridChartsModule, 'api.getChartRef')) {
30877 return this.chartService.getChartRef(chartId);
30878 }
30879 };
30880 /** Returns a string containing the requested data URL which contains a representation of the chart image. */
30881 GridApi.prototype.getChartImageDataURL = function (params) {
30882 if (ModuleRegistry.assertRegistered(exports.ModuleNames.RangeSelectionModule, 'api.getChartImageDataURL') &&
30883 ModuleRegistry.assertRegistered(exports.ModuleNames.GridChartsModule, 'api.getChartImageDataURL')) {
30884 return this.chartService.getChartImageDataURL(params);
30885 }
30886 };
30887 /** Used to programmatically create charts from a range. */
30888 GridApi.prototype.createRangeChart = function (params) {
30889 if (ModuleRegistry.assertRegistered(exports.ModuleNames.RangeSelectionModule, 'api.createRangeChart') &&
30890 ModuleRegistry.assertRegistered(exports.ModuleNames.GridChartsModule, 'api.createRangeChart')) {
30891 return this.chartService.createRangeChart(params);
30892 }
30893 };
30894 /** Used to programmatically create cross filter charts from a range. */
30895 GridApi.prototype.createCrossFilterChart = function (params) {
30896 if (ModuleRegistry.assertRegistered(exports.ModuleNames.RangeSelectionModule, 'api.createCrossFilterChart') &&
30897 ModuleRegistry.assertRegistered(exports.ModuleNames.GridChartsModule, 'api.createCrossFilterChart')) {
30898 return this.chartService.createCrossFilterChart(params);
30899 }
30900 };
30901 /** Restores a chart using the `ChartModel` that was previously obtained from `getChartModels()`. */
30902 GridApi.prototype.restoreChart = function (chartModel, chartContainer) {
30903 if (ModuleRegistry.assertRegistered(exports.ModuleNames.RangeSelectionModule, 'api.restoreChart') &&
30904 ModuleRegistry.assertRegistered(exports.ModuleNames.GridChartsModule, 'api.restoreChart')) {
30905 return this.chartService.restoreChart(chartModel, chartContainer);
30906 }
30907 };
30908 /** Used to programmatically create pivot charts from a grid. */
30909 GridApi.prototype.createPivotChart = function (params) {
30910 if (ModuleRegistry.assertRegistered(exports.ModuleNames.RangeSelectionModule, 'api.createPivotChart') &&
30911 ModuleRegistry.assertRegistered(exports.ModuleNames.GridChartsModule, 'api.createPivotChart')) {
30912 return this.chartService.createPivotChart(params);
30913 }
30914 };
30915 /** Copies the selected rows to the clipboard. */
30916 GridApi.prototype.copySelectedRowsToClipboard = function (params) {
30917 if (!this.clipboardService) {
30918 console.warn('AG Grid: clipboard is only available in AG Grid Enterprise');
30919 }
30920 this.clipboardService.copySelectedRowsToClipboard(params);
30921 };
30922 /** Copies the selected ranges to the clipboard. */
30923 GridApi.prototype.copySelectedRangeToClipboard = function (params) {
30924 if (!this.clipboardService) {
30925 console.warn('AG Grid: clipboard is only available in AG Grid Enterprise');
30926 }
30927 this.clipboardService.copySelectedRangeToClipboard(params);
30928 };
30929 /** Copies the selected range down, similar to `Ctrl + D` in Excel. */
30930 GridApi.prototype.copySelectedRangeDown = function () {
30931 if (!this.clipboardService) {
30932 console.warn('AG Grid: clipboard is only available in AG Grid Enterprise');
30933 }
30934 this.clipboardService.copyRangeDown();
30935 };
30936 /** Shows the column menu after and positions it relative to the provided button element. Use in conjunction with your own header template. */
30937 GridApi.prototype.showColumnMenuAfterButtonClick = function (colKey, buttonElement) {
30938 // use grid column so works with pivot mode
30939 var column = this.columnModel.getGridColumn(colKey);
30940 this.menuFactory.showMenuAfterButtonClick(column, buttonElement, 'columnMenu');
30941 };
30942 /** Shows the column menu after and positions it relative to the mouse event. Use in conjunction with your own header template. */
30943 GridApi.prototype.showColumnMenuAfterMouseClick = function (colKey, mouseEvent) {
30944 // use grid column so works with pivot mode
30945 var column = this.columnModel.getGridColumn(colKey);
30946 if (!column) {
30947 column = this.columnModel.getPrimaryColumn(colKey);
30948 }
30949 if (!column) {
30950 console.error("AG Grid: column '" + colKey + "' not found");
30951 return;
30952 }
30953 this.menuFactory.showMenuAfterMouseEvent(column, mouseEvent);
30954 };
30955 /** Hides any visible context menu or column menu. */
30956 GridApi.prototype.hidePopupMenu = function () {
30957 // hide the context menu if in enterprise
30958 if (this.contextMenuFactory) {
30959 this.contextMenuFactory.hideActiveMenu();
30960 }
30961 // and hide the column menu always
30962 this.menuFactory.hideActiveMenu();
30963 };
30964 /** DOM element to use as the popup parent for grid popups (context menu, column menu etc). */
30965 GridApi.prototype.setPopupParent = function (ePopupParent) {
30966 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_POPUP_PARENT, ePopupParent);
30967 };
30968 /** Navigates the grid focus to the next cell, as if tabbing. */
30969 GridApi.prototype.tabToNextCell = function (event) {
30970 return this.navigationService.tabToNextCell(false, event);
30971 };
30972 /** Navigates the grid focus to the previous cell, as if shift-tabbing. */
30973 GridApi.prototype.tabToPreviousCell = function (event) {
30974 return this.navigationService.tabToNextCell(true, event);
30975 };
30976 /** Returns the list of active cell renderer instances. */
30977 GridApi.prototype.getCellRendererInstances = function (params) {
30978 if (params === void 0) { params = {}; }
30979 var res = this.rowRenderer.getCellRendererInstances(params);
30980 var unwrapped = res.map(unwrapUserComp);
30981 return unwrapped;
30982 };
30983 /** Returns the list of active cell editor instances. Optionally provide parameters to restrict to certain columns / row nodes. */
30984 GridApi.prototype.getCellEditorInstances = function (params) {
30985 if (params === void 0) { params = {}; }
30986 var res = this.rowRenderer.getCellEditorInstances(params);
30987 var unwrapped = res.map(unwrapUserComp);
30988 return unwrapped;
30989 };
30990 /** If the grid is editing, returns back details of the editing cell(s). */
30991 GridApi.prototype.getEditingCells = function () {
30992 return this.rowRenderer.getEditingCells();
30993 };
30994 /** If a cell is editing, it stops the editing. Pass `true` if you want to cancel the editing (i.e. don't accept changes). */
30995 GridApi.prototype.stopEditing = function (cancel) {
30996 if (cancel === void 0) { cancel = false; }
30997 this.rowRenderer.stopEditing(cancel);
30998 };
30999 /** Start editing the provided cell. If another cell is editing, the editing will be stopped in that other cell. */
31000 GridApi.prototype.startEditingCell = function (params) {
31001 var column = this.columnModel.getGridColumn(params.colKey);
31002 if (!column) {
31003 console.warn("AG Grid: no column found for " + params.colKey);
31004 return;
31005 }
31006 var cellPosition = {
31007 rowIndex: params.rowIndex,
31008 rowPinned: params.rowPinned || null,
31009 column: column
31010 };
31011 var notPinned = params.rowPinned == null;
31012 if (notPinned) {
31013 this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(params.rowIndex);
31014 }
31015 var cell = this.navigationService.getCellByPosition(cellPosition);
31016 if (!cell) {
31017 return;
31018 }
31019 cell.startRowOrCellEdit(params.key, params.charPress);
31020 };
31021 /** Add an aggregation function with the specified key. */
31022 GridApi.prototype.addAggFunc = function (key, aggFunc) {
31023 if (this.aggFuncService) {
31024 this.aggFuncService.addAggFunc(key, aggFunc);
31025 }
31026 };
31027 /** Add aggregations function with the specified keys. */
31028 GridApi.prototype.addAggFuncs = function (aggFuncs) {
31029 if (this.aggFuncService) {
31030 this.aggFuncService.addAggFuncs(aggFuncs);
31031 }
31032 };
31033 /** Clears all aggregation functions (including those provided by the grid). */
31034 GridApi.prototype.clearAggFuncs = function () {
31035 if (this.aggFuncService) {
31036 this.aggFuncService.clear();
31037 }
31038 };
31039 /** Apply transactions to the server side row model. */
31040 GridApi.prototype.applyServerSideTransaction = function (transaction) {
31041 if (!this.serverSideTransactionManager) {
31042 console.warn('AG Grid: Cannot apply Server Side Transaction if not using the Server Side Row Model.');
31043 return;
31044 }
31045 return this.serverSideTransactionManager.applyTransaction(transaction);
31046 };
31047 GridApi.prototype.applyServerSideTransactionAsync = function (transaction, callback) {
31048 if (!this.serverSideTransactionManager) {
31049 console.warn('AG Grid: Cannot apply Server Side Transaction if not using the Server Side Row Model.');
31050 return;
31051 }
31052 return this.serverSideTransactionManager.applyTransactionAsync(transaction, callback);
31053 };
31054 /** Gets all failed server side loads to retry. */
31055 GridApi.prototype.retryServerSideLoads = function () {
31056 if (!this.serverSideRowModel) {
31057 console.warn('AG Grid: API retryServerSideLoads() can only be used when using Server-Side Row Model.');
31058 return;
31059 }
31060 this.serverSideRowModel.retryLoads();
31061 };
31062 GridApi.prototype.flushServerSideAsyncTransactions = function () {
31063 if (!this.serverSideTransactionManager) {
31064 console.warn('AG Grid: Cannot flush Server Side Transaction if not using the Server Side Row Model.');
31065 return;
31066 }
31067 return this.serverSideTransactionManager.flushAsyncTransactions();
31068 };
31069 /** Update row data. Pass a transaction object with lists for `add`, `remove` and `update`. */
31070 GridApi.prototype.applyTransaction = function (rowDataTransaction) {
31071 if (!this.clientSideRowModel) {
31072 console.error('AG Grid: updateRowData() only works with ClientSideRowModel. Working with InfiniteRowModel was deprecated in v23.1 and removed in v24.1');
31073 return;
31074 }
31075 var res = this.clientSideRowModel.updateRowData(rowDataTransaction);
31076 // refresh all the full width rows
31077 this.rowRenderer.refreshFullWidthRows(res.update);
31078 // do change detection for all present cells
31079 if (!this.gridOptionsWrapper.isSuppressChangeDetection()) {
31080 this.rowRenderer.refreshCells();
31081 }
31082 return res;
31083 };
31084 /** Sets the `deltaSort` property */
31085 GridApi.prototype.setDeltaSort = function (enable) {
31086 this.gridOptionsWrapper.setProperty('deltaSort', enable);
31087 };
31088 /** @deprecated */
31089 GridApi.prototype.updateRowData = function (rowDataTransaction) {
31090 var message = 'AG Grid: as of v23.1, grid API updateRowData(transaction) is now called applyTransaction(transaction). updateRowData is deprecated and will be removed in a future major release.';
31091 doOnce(function () { return console.warn(message); }, 'updateRowData deprecated');
31092 return this.applyTransaction(rowDataTransaction);
31093 };
31094 /** Same as `applyTransaction` except executes asynchronously for efficiency. */
31095 GridApi.prototype.applyTransactionAsync = function (rowDataTransaction, callback) {
31096 if (!this.clientSideRowModel) {
31097 console.error('AG Grid: api.applyTransactionAsync() only works with ClientSideRowModel.');
31098 return;
31099 }
31100 this.clientSideRowModel.batchUpdateRowData(rowDataTransaction, callback);
31101 };
31102 /** Executes any remaining asynchronous grid transactions, if any are waiting to be executed. */
31103 GridApi.prototype.flushAsyncTransactions = function () {
31104 if (!this.clientSideRowModel) {
31105 console.error('AG Grid: api.applyTransactionAsync() only works with ClientSideRowModel.');
31106 return;
31107 }
31108 this.clientSideRowModel.flushAsyncTransactions();
31109 };
31110 /** @deprecated */
31111 GridApi.prototype.batchUpdateRowData = function (rowDataTransaction, callback) {
31112 var message = 'AG Grid: as of v23.1, grid API batchUpdateRowData(transaction, callback) is now called applyTransactionAsync(transaction, callback). batchUpdateRowData is deprecated and will be removed in a future major release.';
31113 doOnce(function () { return console.warn(message); }, 'batchUpdateRowData deprecated');
31114 this.applyTransactionAsync(rowDataTransaction, callback);
31115 };
31116 GridApi.prototype.insertItemsAtIndex = function (index, items, skipRefresh) {
31117 console.warn('AG Grid: insertItemsAtIndex() is deprecated, use updateRowData(transaction) instead.');
31118 this.updateRowData({ add: items, addIndex: index, update: null, remove: null });
31119 };
31120 GridApi.prototype.removeItems = function (rowNodes, skipRefresh) {
31121 console.warn('AG Grid: removeItems() is deprecated, use updateRowData(transaction) instead.');
31122 var dataToRemove = rowNodes.map(function (rowNode) { return rowNode.data; });
31123 this.updateRowData({ add: null, addIndex: null, update: null, remove: dataToRemove });
31124 };
31125 GridApi.prototype.addItems = function (items, skipRefresh) {
31126 console.warn('AG Grid: addItems() is deprecated, use updateRowData(transaction) instead.');
31127 this.updateRowData({ add: items, addIndex: null, update: null, remove: null });
31128 };
31129 GridApi.prototype.refreshVirtualPageCache = function () {
31130 console.warn('AG Grid: refreshVirtualPageCache() is now called refreshInfiniteCache(), please call refreshInfiniteCache() instead');
31131 this.refreshInfiniteCache();
31132 };
31133 GridApi.prototype.refreshInfinitePageCache = function () {
31134 console.warn('AG Grid: refreshInfinitePageCache() is now called refreshInfiniteCache(), please call refreshInfiniteCache() instead');
31135 this.refreshInfiniteCache();
31136 };
31137 /**
31138 * Marks all the currently loaded blocks in the cache for reload.
31139 * If you have 10 blocks in the cache, all 10 will be marked for reload.
31140 * The old data will continue to be displayed until the new data is loaded.
31141 */
31142 GridApi.prototype.refreshInfiniteCache = function () {
31143 if (this.infiniteRowModel) {
31144 this.infiniteRowModel.refreshCache();
31145 }
31146 else {
31147 console.warn("AG Grid: api.refreshInfiniteCache is only available when rowModelType='infinite'.");
31148 }
31149 };
31150 GridApi.prototype.purgeVirtualPageCache = function () {
31151 console.warn('AG Grid: purgeVirtualPageCache() is now called purgeInfiniteCache(), please call purgeInfiniteCache() instead');
31152 this.purgeInfinitePageCache();
31153 };
31154 GridApi.prototype.purgeInfinitePageCache = function () {
31155 console.warn('AG Grid: purgeInfinitePageCache() is now called purgeInfiniteCache(), please call purgeInfiniteCache() instead');
31156 this.purgeInfiniteCache();
31157 };
31158 /**
31159 * Purges the cache.
31160 * The grid is then told to refresh. Only the blocks required to display the current data on screen are fetched (typically no more than 2).
31161 * The grid will display nothing while the new blocks are loaded.
31162 * Use this to immediately remove the old data from the user.
31163 */
31164 GridApi.prototype.purgeInfiniteCache = function () {
31165 if (this.infiniteRowModel) {
31166 this.infiniteRowModel.purgeCache();
31167 }
31168 else {
31169 console.warn("AG Grid: api.purgeInfiniteCache is only available when rowModelType='infinite'.");
31170 }
31171 };
31172 /** @deprecated */
31173 GridApi.prototype.purgeEnterpriseCache = function (route) {
31174 console.warn("ag-grid: since version 18.x, api.purgeEnterpriseCache() should be replaced with api.purgeServerSideCache()");
31175 this.purgeServerSideCache(route);
31176 };
31177 /** @deprecated */
31178 GridApi.prototype.purgeServerSideCache = function (route) {
31179 if (route === void 0) { route = []; }
31180 if (this.serverSideRowModel) {
31181 console.warn("AG Grid: since v25.0, api.purgeServerSideCache is deprecated. Please use api.refreshServerSideStore({purge: true}) instead.");
31182 this.refreshServerSideStore({
31183 route: route,
31184 purge: true
31185 });
31186 }
31187 else {
31188 console.warn("AG Grid: api.purgeServerSideCache is only available when rowModelType='serverSide'.");
31189 }
31190 };
31191 /**
31192 * Refresh a server-side store.
31193 * If you pass no parameters, then the top level cache is purged.
31194 * To purge a child cache, pass in the string of keys to get to the child cache.
31195 */
31196 GridApi.prototype.refreshServerSideStore = function (params) {
31197 if (this.serverSideRowModel) {
31198 this.serverSideRowModel.refreshStore(params);
31199 }
31200 else {
31201 console.warn("AG Grid: api.refreshServerSideStore is only available when rowModelType='serverSide'.");
31202 }
31203 };
31204 /** Returns info on all server side stores. */
31205 GridApi.prototype.getServerSideStoreState = function () {
31206 if (this.serverSideRowModel) {
31207 return this.serverSideRowModel.getStoreState();
31208 }
31209 else {
31210 console.warn("AG Grid: api.getServerSideStoreState is only available when rowModelType='serverSide'.");
31211 return [];
31212 }
31213 };
31214 GridApi.prototype.getVirtualRowCount = function () {
31215 console.warn('AG Grid: getVirtualRowCount() is now called getInfiniteRowCount(), please call getInfiniteRowCount() instead');
31216 return this.getInfiniteRowCount();
31217 };
31218 /** The row count defines how many rows the grid allows scrolling to. */
31219 GridApi.prototype.getInfiniteRowCount = function () {
31220 if (this.infiniteRowModel) {
31221 return this.infiniteRowModel.getRowCount();
31222 }
31223 else {
31224 console.warn("AG Grid: api.getVirtualRowCount is only available when rowModelType='virtual'.");
31225 }
31226 };
31227 GridApi.prototype.isMaxRowFound = function () {
31228 console.warn("AG Grid: api.isLastRowIndexKnown is deprecated, please use api.isLastRowIndexKnown()");
31229 return this.isLastRowIndexKnown();
31230 };
31231 /** Returns `true` if grid allows for scrolling past the last row to load more rows, thus providing infinite scroll. */
31232 GridApi.prototype.isLastRowIndexKnown = function () {
31233 if (this.infiniteRowModel) {
31234 return this.infiniteRowModel.isLastRowIndexKnown();
31235 }
31236 else {
31237 console.warn("AG Grid: api.isMaxRowFound is only available when rowModelType='virtual'.");
31238 }
31239 };
31240 GridApi.prototype.setVirtualRowCount = function (rowCount, maxRowFound) {
31241 console.warn('AG Grid: setVirtualRowCount() is now called setInfiniteRowCount(), please call setInfiniteRowCount() instead');
31242 this.setRowCount(rowCount, maxRowFound);
31243 };
31244 GridApi.prototype.setInfiniteRowCount = function (rowCount, maxRowFound) {
31245 console.warn('AG Grid: setInfiniteRowCount() is now called setRowCount(), please call setRowCount() instead');
31246 this.setRowCount(rowCount, maxRowFound);
31247 };
31248 /**
31249 * Sets the `rowCount` and `lastRowIndexKnown` properties.
31250 * The second parameter, `lastRowIndexKnown`, is optional and if left out, only `rowCount` is set.
31251 * Set `rowCount` to adjust the height of the vertical scroll.
31252 * Set `lastRowIndexKnown` to enable / disable searching for more rows.
31253 * Use this method if you add or remove rows into the dataset and need to reset the number of rows or put the data back into 'look for data' mode.
31254 */
31255 GridApi.prototype.setRowCount = function (rowCount, maxRowFound) {
31256 if (this.infiniteRowModel) {
31257 this.infiniteRowModel.setRowCount(rowCount, maxRowFound);
31258 }
31259 else {
31260 console.warn("AG Grid: api.setRowCount is only available for Infinite Row Model.");
31261 }
31262 };
31263 GridApi.prototype.getVirtualPageState = function () {
31264 console.warn('AG Grid: getVirtualPageState() is now called getCacheBlockState(), please call getCacheBlockState() instead');
31265 return this.getCacheBlockState();
31266 };
31267 GridApi.prototype.getInfinitePageState = function () {
31268 console.warn('AG Grid: getInfinitePageState() is now called getCacheBlockState(), please call getCacheBlockState() instead');
31269 return this.getCacheBlockState();
31270 };
31271 /**
31272 * Returns an object representing the state of the cache. This is useful for debugging and understanding how the cache is working.
31273 */
31274 GridApi.prototype.getCacheBlockState = function () {
31275 return this.rowNodeBlockLoader.getBlockState();
31276 };
31277 GridApi.prototype.checkGridSize = function () {
31278 console.warn("in AG Grid v25.2.0, checkGridSize() was removed, as it was legacy and didn't do anything uesful.");
31279 };
31280 GridApi.prototype.getFirstRenderedRow = function () {
31281 console.warn('in AG Grid v12, getFirstRenderedRow() was renamed to getFirstDisplayedRow()');
31282 return this.getFirstDisplayedRow();
31283 };
31284 /** Get the index of the first displayed row due to scrolling (includes invisible rendered rows in the buffer). */
31285 GridApi.prototype.getFirstDisplayedRow = function () {
31286 return this.rowRenderer.getFirstVirtualRenderedRow();
31287 };
31288 GridApi.prototype.getLastRenderedRow = function () {
31289 console.warn('in AG Grid v12, getLastRenderedRow() was renamed to getLastDisplayedRow()');
31290 return this.getLastDisplayedRow();
31291 };
31292 /** Get the index of the last displayed row due to scrolling (includes invisible rendered rows in the buffer). */
31293 GridApi.prototype.getLastDisplayedRow = function () {
31294 return this.rowRenderer.getLastVirtualRenderedRow();
31295 };
31296 /** Returns the displayed `RowNode` at the given `index`. */
31297 GridApi.prototype.getDisplayedRowAtIndex = function (index) {
31298 return this.rowModel.getRow(index);
31299 };
31300 /** Returns the total number of displayed rows. */
31301 GridApi.prototype.getDisplayedRowCount = function () {
31302 return this.rowModel.getRowCount();
31303 };
31304 /**
31305 * Returns `true` when the last page is known.
31306 * This will always be `true` if you are using the Client-Side Row Model for pagination.
31307 * Returns `false` when the last page is not known; this only happens when using Infinite Row Model.
31308 */
31309 GridApi.prototype.paginationIsLastPageFound = function () {
31310 return this.paginationProxy.isLastPageFound();
31311 };
31312 /** Returns how many rows are being shown per page. */
31313 GridApi.prototype.paginationGetPageSize = function () {
31314 return this.paginationProxy.getPageSize();
31315 };
31316 /** Sets the `paginationPageSize`, then re-paginates the grid so the changes are applied immediately. */
31317 GridApi.prototype.paginationSetPageSize = function (size) {
31318 this.gridOptionsWrapper.setProperty('paginationPageSize', size);
31319 };
31320 /** Returns the 0-based index of the page which is showing. */
31321 GridApi.prototype.paginationGetCurrentPage = function () {
31322 return this.paginationProxy.getCurrentPage();
31323 };
31324 /** Returns the total number of pages. Returns `null` if `paginationIsLastPageFound() === false`. */
31325 GridApi.prototype.paginationGetTotalPages = function () {
31326 return this.paginationProxy.getTotalPages();
31327 };
31328 /** The total number of rows. Returns `null` if `paginationIsLastPageFound() === false`. */
31329 GridApi.prototype.paginationGetRowCount = function () {
31330 return this.paginationProxy.getMasterRowCount();
31331 };
31332 /** Navigates to the next page. */
31333 GridApi.prototype.paginationGoToNextPage = function () {
31334 this.paginationProxy.goToNextPage();
31335 };
31336 /** Navigates to the previous page. */
31337 GridApi.prototype.paginationGoToPreviousPage = function () {
31338 this.paginationProxy.goToPreviousPage();
31339 };
31340 /** Navigates to the first page. */
31341 GridApi.prototype.paginationGoToFirstPage = function () {
31342 this.paginationProxy.goToFirstPage();
31343 };
31344 /** Navigates to the last page. */
31345 GridApi.prototype.paginationGoToLastPage = function () {
31346 this.paginationProxy.goToLastPage();
31347 };
31348 /** Goes to the specified page. If the page requested doesn't exist, it will go to the last page. */
31349 GridApi.prototype.paginationGoToPage = function (page) {
31350 this.paginationProxy.goToPage(page);
31351 };
31352 GridApi.prototype.setRowClass = function (className) {
31353 this.gridOptionsWrapper.setProperty(GridOptionsWrapper.PROP_ROW_CLASS, className);
31354 };
31355 __decorate$18([
31356 Optional('immutableService')
31357 ], GridApi.prototype, "immutableService", void 0);
31358 __decorate$18([
31359 Optional('csvCreator')
31360 ], GridApi.prototype, "csvCreator", void 0);
31361 __decorate$18([
31362 Optional('excelCreator')
31363 ], GridApi.prototype, "excelCreator", void 0);
31364 __decorate$18([
31365 Autowired('rowRenderer')
31366 ], GridApi.prototype, "rowRenderer", void 0);
31367 __decorate$18([
31368 Autowired('navigationService')
31369 ], GridApi.prototype, "navigationService", void 0);
31370 __decorate$18([
31371 Autowired('filterManager')
31372 ], GridApi.prototype, "filterManager", void 0);
31373 __decorate$18([
31374 Autowired('columnModel')
31375 ], GridApi.prototype, "columnModel", void 0);
31376 __decorate$18([
31377 Autowired('selectionService')
31378 ], GridApi.prototype, "selectionService", void 0);
31379 __decorate$18([
31380 Autowired('gridOptionsWrapper')
31381 ], GridApi.prototype, "gridOptionsWrapper", void 0);
31382 __decorate$18([
31383 Autowired('valueService')
31384 ], GridApi.prototype, "valueService", void 0);
31385 __decorate$18([
31386 Autowired('alignedGridsService')
31387 ], GridApi.prototype, "alignedGridsService", void 0);
31388 __decorate$18([
31389 Autowired('eventService')
31390 ], GridApi.prototype, "eventService", void 0);
31391 __decorate$18([
31392 Autowired('pinnedRowModel')
31393 ], GridApi.prototype, "pinnedRowModel", void 0);
31394 __decorate$18([
31395 Autowired('context')
31396 ], GridApi.prototype, "context", void 0);
31397 __decorate$18([
31398 Autowired('rowModel')
31399 ], GridApi.prototype, "rowModel", void 0);
31400 __decorate$18([
31401 Autowired('sortController')
31402 ], GridApi.prototype, "sortController", void 0);
31403 __decorate$18([
31404 Autowired('paginationProxy')
31405 ], GridApi.prototype, "paginationProxy", void 0);
31406 __decorate$18([
31407 Autowired('focusService')
31408 ], GridApi.prototype, "focusService", void 0);
31409 __decorate$18([
31410 Autowired('dragAndDropService')
31411 ], GridApi.prototype, "dragAndDropService", void 0);
31412 __decorate$18([
31413 Optional('rangeService')
31414 ], GridApi.prototype, "rangeService", void 0);
31415 __decorate$18([
31416 Optional('clipboardService')
31417 ], GridApi.prototype, "clipboardService", void 0);
31418 __decorate$18([
31419 Optional('aggFuncService')
31420 ], GridApi.prototype, "aggFuncService", void 0);
31421 __decorate$18([
31422 Autowired('menuFactory')
31423 ], GridApi.prototype, "menuFactory", void 0);
31424 __decorate$18([
31425 Optional('contextMenuFactory')
31426 ], GridApi.prototype, "contextMenuFactory", void 0);
31427 __decorate$18([
31428 Autowired('valueCache')
31429 ], GridApi.prototype, "valueCache", void 0);
31430 __decorate$18([
31431 Autowired('animationFrameService')
31432 ], GridApi.prototype, "animationFrameService", void 0);
31433 __decorate$18([
31434 Optional('statusBarService')
31435 ], GridApi.prototype, "statusBarService", void 0);
31436 __decorate$18([
31437 Optional('chartService')
31438 ], GridApi.prototype, "chartService", void 0);
31439 __decorate$18([
31440 Optional('undoRedoService')
31441 ], GridApi.prototype, "undoRedoService", void 0);
31442 __decorate$18([
31443 Optional('rowNodeBlockLoader')
31444 ], GridApi.prototype, "rowNodeBlockLoader", void 0);
31445 __decorate$18([
31446 Optional('ssrmTransactionManager')
31447 ], GridApi.prototype, "serverSideTransactionManager", void 0);
31448 __decorate$18([
31449 Autowired('ctrlsService')
31450 ], GridApi.prototype, "ctrlsService", void 0);
31451 __decorate$18([
31452 Optional('frameworkComponentWrapper')
31453 ], GridApi.prototype, "frameworkComponentWrapper", void 0);
31454 __decorate$18([
31455 PostConstruct
31456 ], GridApi.prototype, "init", null);
31457 __decorate$18([
31458 PreDestroy
31459 ], GridApi.prototype, "cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid", null);
31460 GridApi = __decorate$18([
31461 Bean('gridApi')
31462 ], GridApi);
31463 return GridApi;
31464}());
31465
31466/**
31467 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
31468 * @version v27.3.0
31469 * @link https://www.ag-grid.com/
31470 * @license MIT
31471 */
31472var __extends$1l = (undefined && undefined.__extends) || (function () {
31473 var extendStatics = function (d, b) {
31474 extendStatics = Object.setPrototypeOf ||
31475 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31476 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
31477 return extendStatics(d, b);
31478 };
31479 return function (d, b) {
31480 extendStatics(d, b);
31481 function __() { this.constructor = d; }
31482 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
31483 };
31484})();
31485var __decorate$19 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
31486 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31487 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
31488 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;
31489 return c > 3 && r && Object.defineProperty(target, key, r), r;
31490};
31491var SetLeftFeature = /** @class */ (function (_super) {
31492 __extends$1l(SetLeftFeature, _super);
31493 function SetLeftFeature(columnOrGroup, eCell, beans, colsSpanning) {
31494 var _this = _super.call(this) || this;
31495 _this.columnOrGroup = columnOrGroup;
31496 _this.eCell = eCell;
31497 _this.ariaEl = _this.eCell.querySelector('[role=columnheader]') || _this.eCell;
31498 _this.colsSpanning = colsSpanning;
31499 _this.beans = beans;
31500 return _this;
31501 }
31502 SetLeftFeature.prototype.setColsSpanning = function (colsSpanning) {
31503 this.colsSpanning = colsSpanning;
31504 this.onLeftChanged();
31505 };
31506 SetLeftFeature.prototype.getColumnOrGroup = function () {
31507 if (this.beans.gridOptionsWrapper.isEnableRtl() && this.colsSpanning) {
31508 return last(this.colsSpanning);
31509 }
31510 return this.columnOrGroup;
31511 };
31512 SetLeftFeature.prototype.postConstruct = function () {
31513 this.addManagedListener(this.columnOrGroup, Column.EVENT_LEFT_CHANGED, this.onLeftChanged.bind(this));
31514 this.setLeftFirstTime();
31515 // when in print layout, the left position is also dependent on the width of the pinned sections.
31516 // so additionally update left if any column width changes.
31517 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onLeftChanged.bind(this));
31518 // setting left has a dependency on print layout
31519 this.addManagedListener(this.beans.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, this.onLeftChanged.bind(this));
31520 };
31521 SetLeftFeature.prototype.setLeftFirstTime = function () {
31522 var suppressMoveAnimation = this.beans.gridOptionsWrapper.isSuppressColumnMoveAnimation();
31523 var oldLeftExists = exists(this.columnOrGroup.getOldLeft());
31524 var animateColumnMove = this.beans.columnAnimationService.isActive() && oldLeftExists && !suppressMoveAnimation;
31525 if (animateColumnMove) {
31526 this.animateInLeft();
31527 }
31528 else {
31529 this.onLeftChanged();
31530 }
31531 };
31532 SetLeftFeature.prototype.animateInLeft = function () {
31533 var _this = this;
31534 var colOrGroup = this.getColumnOrGroup();
31535 var left = colOrGroup.getLeft();
31536 var oldLeft = colOrGroup.getOldLeft();
31537 var oldActualLeft = this.modifyLeftForPrintLayout(colOrGroup, oldLeft);
31538 var actualLeft = this.modifyLeftForPrintLayout(colOrGroup, left);
31539 this.setLeft(oldActualLeft);
31540 // we must keep track of the left we want to set to, as this would otherwise lead to a race
31541 // condition, if the user changed the left value many times in one VM turn, then we want to make
31542 // make sure the actualLeft we set in the timeout below (in the next VM turn) is the correct left
31543 // position. eg if user changes column position twice, then setLeft() below executes twice in next
31544 // VM turn, but only one (the correct one) should get applied.
31545 this.actualLeft = actualLeft;
31546 this.beans.columnAnimationService.executeNextVMTurn(function () {
31547 // test this left value is the latest one to be applied, and if not, do nothing
31548 if (_this.actualLeft === actualLeft) {
31549 _this.setLeft(actualLeft);
31550 }
31551 });
31552 };
31553 SetLeftFeature.prototype.onLeftChanged = function () {
31554 var colOrGroup = this.getColumnOrGroup();
31555 var left = colOrGroup.getLeft();
31556 this.actualLeft = this.modifyLeftForPrintLayout(colOrGroup, left);
31557 this.setLeft(this.actualLeft);
31558 };
31559 SetLeftFeature.prototype.modifyLeftForPrintLayout = function (colOrGroup, leftPosition) {
31560 var printLayout = this.beans.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
31561 if (!printLayout) {
31562 return leftPosition;
31563 }
31564 if (colOrGroup.getPinned() === Constants.PINNED_LEFT) {
31565 return leftPosition;
31566 }
31567 var leftWidth = this.beans.columnModel.getDisplayedColumnsLeftWidth();
31568 if (colOrGroup.getPinned() === Constants.PINNED_RIGHT) {
31569 var bodyWidth = this.beans.columnModel.getBodyContainerWidth();
31570 return leftWidth + bodyWidth + leftPosition;
31571 }
31572 // is in body
31573 return leftWidth + leftPosition;
31574 };
31575 SetLeftFeature.prototype.setLeft = function (value) {
31576 // if the value is null, then that means the column is no longer
31577 // displayed. there is logic in the rendering to fade these columns
31578 // out, so we don't try and change their left positions.
31579 if (exists(value)) {
31580 this.eCell.style.left = value + "px";
31581 }
31582 var indexColumn;
31583 if (this.columnOrGroup instanceof Column) {
31584 indexColumn = this.columnOrGroup;
31585 }
31586 else {
31587 var columnGroup = this.columnOrGroup;
31588 var children = columnGroup.getLeafColumns();
31589 if (!children.length) {
31590 return;
31591 }
31592 if (children.length > 1) {
31593 setAriaColSpan(this.ariaEl, children.length);
31594 }
31595 indexColumn = children[0];
31596 }
31597 var index = this.beans.columnModel.getAriaColumnIndex(indexColumn);
31598 setAriaColIndex(this.ariaEl, index);
31599 };
31600 __decorate$19([
31601 PostConstruct
31602 ], SetLeftFeature.prototype, "postConstruct", null);
31603 return SetLeftFeature;
31604}(BeanStub));
31605
31606/**
31607 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
31608 * @version v27.3.0
31609 * @link https://www.ag-grid.com/
31610 * @license MIT
31611 */
31612var __extends$1m = (undefined && undefined.__extends) || (function () {
31613 var extendStatics = function (d, b) {
31614 extendStatics = Object.setPrototypeOf ||
31615 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31616 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
31617 return extendStatics(d, b);
31618 };
31619 return function (d, b) {
31620 extendStatics(d, b);
31621 function __() { this.constructor = d; }
31622 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
31623 };
31624})();
31625var __decorate$1a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
31626 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31627 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
31628 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;
31629 return c > 3 && r && Object.defineProperty(target, key, r), r;
31630};
31631var HoverFeature = /** @class */ (function (_super) {
31632 __extends$1m(HoverFeature, _super);
31633 function HoverFeature(columns, element) {
31634 var _this = _super.call(this) || this;
31635 _this.columns = columns;
31636 _this.element = element;
31637 return _this;
31638 }
31639 HoverFeature.prototype.postConstruct = function () {
31640 if (this.gridOptionsWrapper.isColumnHoverHighlight()) {
31641 this.addMouseHoverListeners();
31642 }
31643 };
31644 HoverFeature.prototype.addMouseHoverListeners = function () {
31645 this.addManagedListener(this.element, 'mouseout', this.onMouseOut.bind(this));
31646 this.addManagedListener(this.element, 'mouseover', this.onMouseOver.bind(this));
31647 };
31648 HoverFeature.prototype.onMouseOut = function () {
31649 this.columnHoverService.clearMouseOver();
31650 };
31651 HoverFeature.prototype.onMouseOver = function () {
31652 this.columnHoverService.setMouseOver(this.columns);
31653 };
31654 __decorate$1a([
31655 Autowired('columnHoverService')
31656 ], HoverFeature.prototype, "columnHoverService", void 0);
31657 __decorate$1a([
31658 PostConstruct
31659 ], HoverFeature.prototype, "postConstruct", null);
31660 return HoverFeature;
31661}(BeanStub));
31662
31663/**
31664 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
31665 * @version v27.3.0
31666 * @link https://www.ag-grid.com/
31667 * @license MIT
31668 */
31669var __extends$1n = (undefined && undefined.__extends) || (function () {
31670 var extendStatics = function (d, b) {
31671 extendStatics = Object.setPrototypeOf ||
31672 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31673 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
31674 return extendStatics(d, b);
31675 };
31676 return function (d, b) {
31677 extendStatics(d, b);
31678 function __() { this.constructor = d; }
31679 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
31680 };
31681})();
31682var __decorate$1b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
31683 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31684 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
31685 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;
31686 return c > 3 && r && Object.defineProperty(target, key, r), r;
31687};
31688var HeaderFilterCellCtrl = /** @class */ (function (_super) {
31689 __extends$1n(HeaderFilterCellCtrl, _super);
31690 function HeaderFilterCellCtrl(column, parentRowCtrl) {
31691 var _this = _super.call(this, column, parentRowCtrl) || this;
31692 _this.column = column;
31693 return _this;
31694 }
31695 HeaderFilterCellCtrl.prototype.setComp = function (comp, eGui, eButtonShowMainFilter, eFloatingFilterBody) {
31696 _super.prototype.setGui.call(this, eGui);
31697 this.comp = comp;
31698 this.eButtonShowMainFilter = eButtonShowMainFilter;
31699 this.eFloatingFilterBody = eFloatingFilterBody;
31700 var colDef = this.column.getColDef();
31701 var filterExists = !!colDef.filter || !!colDef.filterFramework;
31702 var floatingFilterExists = !!colDef.floatingFilter;
31703 this.active = filterExists && floatingFilterExists;
31704 this.setupWidth();
31705 this.setupLeft();
31706 this.setupHover();
31707 this.setupFocus();
31708 this.setupUserComp();
31709 this.setupSyncWithFilter();
31710 this.setupUi();
31711 this.addManagedListener(this.eButtonShowMainFilter, 'click', this.showParentFilter.bind(this));
31712 };
31713 HeaderFilterCellCtrl.prototype.setupUi = function () {
31714 this.comp.addOrRemoveButtonWrapperCssClass('ag-hidden', !this.active || this.suppressFilterButton);
31715 if (!this.active) {
31716 return;
31717 }
31718 this.comp.addOrRemoveBodyCssClass('ag-floating-filter-full-body', this.suppressFilterButton);
31719 this.comp.addOrRemoveBodyCssClass('ag-floating-filter-body', !this.suppressFilterButton);
31720 var eMenuIcon = createIconNoSpan('filter', this.gridOptionsWrapper, this.column);
31721 if (eMenuIcon) {
31722 this.eButtonShowMainFilter.appendChild(eMenuIcon);
31723 }
31724 };
31725 HeaderFilterCellCtrl.prototype.setupFocus = function () {
31726 this.createManagedBean(new ManagedFocusFeature(this.eGui, {
31727 shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),
31728 onTabKeyDown: this.onTabKeyDown.bind(this),
31729 handleKeyDown: this.handleKeyDown.bind(this),
31730 onFocusIn: this.onFocusIn.bind(this)
31731 }));
31732 };
31733 HeaderFilterCellCtrl.prototype.onTabKeyDown = function (e) {
31734 var eDocument = this.gridOptionsWrapper.getDocument();
31735 var activeEl = eDocument.activeElement;
31736 var wrapperHasFocus = activeEl === this.eGui;
31737 if (wrapperHasFocus) {
31738 return;
31739 }
31740 var nextFocusableEl = this.focusService.findNextFocusableElement(this.eGui, null, e.shiftKey);
31741 if (nextFocusableEl) {
31742 this.beans.headerNavigationService.scrollToColumn(this.column);
31743 e.preventDefault();
31744 nextFocusableEl.focus();
31745 return;
31746 }
31747 var nextFocusableColumn = this.findNextColumnWithFloatingFilter(e.shiftKey);
31748 if (!nextFocusableColumn) {
31749 return;
31750 }
31751 if (this.focusService.focusHeaderPosition({
31752 headerPosition: {
31753 headerRowIndex: this.getParentRowCtrl().getRowIndex(),
31754 column: nextFocusableColumn
31755 },
31756 event: e
31757 })) {
31758 e.preventDefault();
31759 }
31760 };
31761 HeaderFilterCellCtrl.prototype.findNextColumnWithFloatingFilter = function (backwards) {
31762 var columModel = this.beans.columnModel;
31763 var nextCol = this.column;
31764 do {
31765 nextCol = backwards
31766 ? columModel.getDisplayedColBefore(nextCol)
31767 : columModel.getDisplayedColAfter(nextCol);
31768 if (!nextCol) {
31769 break;
31770 }
31771 } while (!nextCol.getColDef().filter || !nextCol.getColDef().floatingFilter);
31772 return nextCol;
31773 };
31774 HeaderFilterCellCtrl.prototype.handleKeyDown = function (e) {
31775 var eDocument = this.gridOptionsWrapper.getDocument();
31776 var activeEl = eDocument.activeElement;
31777 var wrapperHasFocus = activeEl === this.eGui;
31778 switch (e.key) {
31779 case KeyCode.UP:
31780 case KeyCode.DOWN:
31781 if (!wrapperHasFocus) {
31782 e.preventDefault();
31783 }
31784 case KeyCode.LEFT:
31785 case KeyCode.RIGHT:
31786 if (wrapperHasFocus) {
31787 return;
31788 }
31789 e.stopPropagation();
31790 case KeyCode.ENTER:
31791 if (wrapperHasFocus) {
31792 if (this.focusService.focusInto(this.eGui)) {
31793 e.preventDefault();
31794 }
31795 }
31796 break;
31797 case KeyCode.ESCAPE:
31798 if (!wrapperHasFocus) {
31799 this.eGui.focus();
31800 }
31801 }
31802 };
31803 HeaderFilterCellCtrl.prototype.onFocusIn = function (e) {
31804 var isRelatedWithin = this.eGui.contains(e.relatedTarget);
31805 // when the focus is already within the component,
31806 // we default to the browser's behavior
31807 if (isRelatedWithin) {
31808 return;
31809 }
31810 var notFromHeaderWrapper = !!e.relatedTarget && !e.relatedTarget.classList.contains('ag-floating-filter');
31811 var fromWithinHeader = !!e.relatedTarget && isElementChildOfClass(e.relatedTarget, 'ag-floating-filter');
31812 if (notFromHeaderWrapper && fromWithinHeader && e.target === this.eGui) {
31813 var lastFocusEvent = this.lastFocusEvent;
31814 var fromTab = !!(lastFocusEvent && lastFocusEvent.key === KeyCode.TAB);
31815 if (lastFocusEvent && fromTab) {
31816 var shouldFocusLast = lastFocusEvent.shiftKey;
31817 this.focusService.focusInto(this.eGui, shouldFocusLast);
31818 }
31819 }
31820 var rowIndex = this.getRowIndex();
31821 this.beans.focusService.setFocusedHeader(rowIndex, this.column);
31822 };
31823 HeaderFilterCellCtrl.prototype.setupHover = function () {
31824 var _this = this;
31825 this.createManagedBean(new HoverFeature([this.column], this.eGui));
31826 var listener = function () {
31827 if (!_this.gridOptionsWrapper.isColumnHoverHighlight()) {
31828 return;
31829 }
31830 var hovered = _this.columnHoverService.isHovered(_this.column);
31831 _this.comp.addOrRemoveCssClass('ag-column-hover', hovered);
31832 };
31833 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, listener);
31834 listener();
31835 };
31836 HeaderFilterCellCtrl.prototype.setupLeft = function () {
31837 var setLeftFeature = new SetLeftFeature(this.column, this.eGui, this.beans);
31838 this.createManagedBean(setLeftFeature);
31839 };
31840 HeaderFilterCellCtrl.prototype.setupUserComp = function () {
31841 var _this = this;
31842 if (!this.active) {
31843 return;
31844 }
31845 var colDef = this.column.getColDef();
31846 var filterParams = this.filterManager.createFilterParams(this.column, colDef);
31847 var finalFilterParams = this.userComponentFactory.mergeParamsWithApplicationProvidedParams(colDef, FilterComponent, filterParams);
31848 var defaultFloatingFilterType = this.userComponentFactory.getDefaultFloatingFilterType(colDef);
31849 if (defaultFloatingFilterType == null) {
31850 defaultFloatingFilterType = 'agReadOnlyFloatingFilter';
31851 }
31852 var params = {
31853 column: this.column,
31854 filterParams: finalFilterParams,
31855 currentParentModel: function () { return _this.currentParentModel(); },
31856 parentFilterInstance: function (cb) { return _this.parentFilterInstance(cb); },
31857 showParentFilter: function () { return _this.showParentFilter(); },
31858 suppressFilterButton: false // This one might be overridden from the colDef
31859 };
31860 // this is unusual - we need a params value OUTSIDE the component the params are for.
31861 // the params are for the floating filter component, but this property is actually for the wrapper.
31862 this.suppressFilterButton = colDef.floatingFilterComponentParams ? !!colDef.floatingFilterComponentParams.suppressFilterButton : false;
31863 var compDetails = this.userComponentFactory.getFloatingFilterCompDetails(colDef, params, defaultFloatingFilterType);
31864 if (compDetails) {
31865 this.comp.setCompDetails(compDetails);
31866 }
31867 };
31868 HeaderFilterCellCtrl.prototype.currentParentModel = function () {
31869 var filterComponent = this.getFilterComponent(false);
31870 return filterComponent ? filterComponent.resolveNow(null, function (filter) { return filter && filter.getModel(); }) : null;
31871 };
31872 HeaderFilterCellCtrl.prototype.getFilterComponent = function (createIfDoesNotExist) {
31873 if (createIfDoesNotExist === void 0) { createIfDoesNotExist = true; }
31874 return this.filterManager.getFilterComponent(this.column, 'NO_UI', createIfDoesNotExist);
31875 };
31876 HeaderFilterCellCtrl.prototype.parentFilterInstance = function (callback) {
31877 var filterComponent = this.getFilterComponent();
31878 if (filterComponent == null) {
31879 return;
31880 }
31881 filterComponent.then(function (instance) {
31882 callback(unwrapUserComp(instance));
31883 });
31884 };
31885 HeaderFilterCellCtrl.prototype.showParentFilter = function () {
31886 var eventSource = this.suppressFilterButton ? this.eFloatingFilterBody : this.eButtonShowMainFilter;
31887 this.menuFactory.showMenuAfterButtonClick(this.column, eventSource, 'floatingFilter', 'filterMenuTab', ['filterMenuTab']);
31888 };
31889 HeaderFilterCellCtrl.prototype.setupSyncWithFilter = function () {
31890 var _this = this;
31891 if (!this.active) {
31892 return;
31893 }
31894 var syncWithFilter = function (filterChangedEvent) {
31895 var compPromise = _this.comp.getFloatingFilterComp();
31896 if (!compPromise) {
31897 return;
31898 }
31899 var parentModel = _this.currentParentModel();
31900 compPromise.then(function (comp) {
31901 if (comp) {
31902 comp.onParentModelChanged(parentModel, filterChangedEvent);
31903 }
31904 });
31905 };
31906 this.addManagedListener(this.column, Column.EVENT_FILTER_CHANGED, syncWithFilter);
31907 if (this.filterManager.isFilterActive(this.column)) {
31908 syncWithFilter(null);
31909 }
31910 };
31911 HeaderFilterCellCtrl.prototype.setupWidth = function () {
31912 var _this = this;
31913 var listener = function () {
31914 var width = _this.column.getActualWidth() + "px";
31915 _this.comp.setWidth(width);
31916 };
31917 this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, listener);
31918 listener();
31919 };
31920 __decorate$1b([
31921 Autowired('userComponentFactory')
31922 ], HeaderFilterCellCtrl.prototype, "userComponentFactory", void 0);
31923 __decorate$1b([
31924 Autowired('filterManager')
31925 ], HeaderFilterCellCtrl.prototype, "filterManager", void 0);
31926 __decorate$1b([
31927 Autowired('columnHoverService')
31928 ], HeaderFilterCellCtrl.prototype, "columnHoverService", void 0);
31929 __decorate$1b([
31930 Autowired('gridApi')
31931 ], HeaderFilterCellCtrl.prototype, "gridApi", void 0);
31932 __decorate$1b([
31933 Autowired('menuFactory')
31934 ], HeaderFilterCellCtrl.prototype, "menuFactory", void 0);
31935 __decorate$1b([
31936 Autowired('beans')
31937 ], HeaderFilterCellCtrl.prototype, "beans", void 0);
31938 return HeaderFilterCellCtrl;
31939}(AbstractHeaderCellCtrl));
31940
31941/**
31942 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
31943 * @version v27.3.0
31944 * @link https://www.ag-grid.com/
31945 * @license MIT
31946 */
31947var __extends$1o = (undefined && undefined.__extends) || (function () {
31948 var extendStatics = function (d, b) {
31949 extendStatics = Object.setPrototypeOf ||
31950 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31951 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
31952 return extendStatics(d, b);
31953 };
31954 return function (d, b) {
31955 extendStatics(d, b);
31956 function __() { this.constructor = d; }
31957 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
31958 };
31959})();
31960var __decorate$1c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
31961 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31962 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
31963 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;
31964 return c > 3 && r && Object.defineProperty(target, key, r), r;
31965};
31966var ResizeFeature = /** @class */ (function (_super) {
31967 __extends$1o(ResizeFeature, _super);
31968 function ResizeFeature(pinned, column, eResize, comp, ctrl) {
31969 var _this = _super.call(this) || this;
31970 _this.pinned = pinned;
31971 _this.column = column;
31972 _this.eResize = eResize;
31973 _this.comp = comp;
31974 _this.ctrl = ctrl;
31975 return _this;
31976 }
31977 ResizeFeature.prototype.postConstruct = function () {
31978 var _this = this;
31979 var colDef = this.column.getColDef();
31980 var destroyResizeFuncs = [];
31981 var canResize;
31982 var canAutosize;
31983 var addResize = function () {
31984 setDisplayed(_this.eResize, canResize);
31985 if (!canResize) {
31986 return;
31987 }
31988 var finishedWithResizeFunc = _this.horizontalResizeService.addResizeBar({
31989 eResizeBar: _this.eResize,
31990 onResizeStart: _this.onResizeStart.bind(_this),
31991 onResizing: _this.onResizing.bind(_this, false),
31992 onResizeEnd: _this.onResizing.bind(_this, true)
31993 });
31994 destroyResizeFuncs.push(finishedWithResizeFunc);
31995 if (canAutosize) {
31996 var skipHeaderOnAutoSize_1 = _this.gridOptionsWrapper.isSkipHeaderOnAutoSize();
31997 var autoSizeColListener_1 = function () {
31998 _this.columnModel.autoSizeColumn(_this.column, skipHeaderOnAutoSize_1, "uiColumnResized");
31999 };
32000 _this.eResize.addEventListener('dblclick', autoSizeColListener_1);
32001 var touchListener_1 = new TouchListener(_this.eResize);
32002 touchListener_1.addEventListener(TouchListener.EVENT_DOUBLE_TAP, autoSizeColListener_1);
32003 _this.addDestroyFunc(function () {
32004 _this.eResize.removeEventListener('dblclick', autoSizeColListener_1);
32005 touchListener_1.removeEventListener(TouchListener.EVENT_DOUBLE_TAP, autoSizeColListener_1);
32006 touchListener_1.destroy();
32007 });
32008 }
32009 };
32010 var removeResize = function () {
32011 destroyResizeFuncs.forEach(function (f) { return f(); });
32012 destroyResizeFuncs.length = 0;
32013 };
32014 var refresh = function () {
32015 var resize = _this.column.isResizable();
32016 var autoSize = !_this.gridOptionsWrapper.isSuppressAutoSize() && !colDef.suppressAutoSize;
32017 var propertyChange = resize !== canResize || autoSize !== canAutosize;
32018 if (propertyChange) {
32019 canResize = resize;
32020 canAutosize = autoSize;
32021 removeResize();
32022 addResize();
32023 }
32024 };
32025 refresh();
32026 this.addDestroyFunc(removeResize);
32027 this.ctrl.addRefreshFunction(refresh);
32028 };
32029 ResizeFeature.prototype.onResizing = function (finished, resizeAmount) {
32030 var resizeAmountNormalised = this.normaliseResizeAmount(resizeAmount);
32031 var columnWidths = [{ key: this.column, newWidth: this.resizeStartWidth + resizeAmountNormalised }];
32032 this.columnModel.setColumnWidths(columnWidths, this.resizeWithShiftKey, finished, "uiColumnDragged");
32033 if (finished) {
32034 this.comp.addOrRemoveCssClass('ag-column-resizing', false);
32035 }
32036 };
32037 ResizeFeature.prototype.onResizeStart = function (shiftKey) {
32038 this.resizeStartWidth = this.column.getActualWidth();
32039 this.resizeWithShiftKey = shiftKey;
32040 this.comp.addOrRemoveCssClass('ag-column-resizing', true);
32041 };
32042 // optionally inverts the drag, depending on pinned and RTL
32043 // note - this method is duplicated in RenderedHeaderGroupCell - should refactor out?
32044 ResizeFeature.prototype.normaliseResizeAmount = function (dragChange) {
32045 var result = dragChange;
32046 var notPinningLeft = this.pinned !== Constants.PINNED_LEFT;
32047 var pinningRight = this.pinned === Constants.PINNED_RIGHT;
32048 if (this.gridOptionsWrapper.isEnableRtl()) {
32049 // for RTL, dragging left makes the col bigger, except when pinning left
32050 if (notPinningLeft) {
32051 result *= -1;
32052 }
32053 }
32054 else {
32055 // for LTR (ie normal), dragging left makes the col smaller, except when pinning right
32056 if (pinningRight) {
32057 result *= -1;
32058 }
32059 }
32060 return result;
32061 };
32062 __decorate$1c([
32063 Autowired('horizontalResizeService')
32064 ], ResizeFeature.prototype, "horizontalResizeService", void 0);
32065 __decorate$1c([
32066 Autowired('columnModel')
32067 ], ResizeFeature.prototype, "columnModel", void 0);
32068 __decorate$1c([
32069 PostConstruct
32070 ], ResizeFeature.prototype, "postConstruct", null);
32071 return ResizeFeature;
32072}(BeanStub));
32073
32074/**
32075 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
32076 * @version v27.3.0
32077 * @link https://www.ag-grid.com/
32078 * @license MIT
32079 */
32080var __extends$1p = (undefined && undefined.__extends) || (function () {
32081 var extendStatics = function (d, b) {
32082 extendStatics = Object.setPrototypeOf ||
32083 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32084 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
32085 return extendStatics(d, b);
32086 };
32087 return function (d, b) {
32088 extendStatics(d, b);
32089 function __() { this.constructor = d; }
32090 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32091 };
32092})();
32093var AgCheckbox = /** @class */ (function (_super) {
32094 __extends$1p(AgCheckbox, _super);
32095 function AgCheckbox(config, className, inputType) {
32096 if (className === void 0) { className = 'ag-checkbox'; }
32097 if (inputType === void 0) { inputType = 'checkbox'; }
32098 var _this = _super.call(this, config, className, inputType) || this;
32099 _this.labelAlignment = 'right';
32100 _this.selected = false;
32101 _this.readOnly = false;
32102 _this.passive = false;
32103 return _this;
32104 }
32105 AgCheckbox.prototype.addInputListeners = function () {
32106 this.addManagedListener(this.eInput, 'click', this.onCheckboxClick.bind(this));
32107 this.addManagedListener(this.eLabel, 'click', this.toggle.bind(this));
32108 };
32109 AgCheckbox.prototype.getNextValue = function () {
32110 return this.selected === undefined ? true : !this.selected;
32111 };
32112 AgCheckbox.prototype.setPassive = function (passive) {
32113 this.passive = passive;
32114 };
32115 AgCheckbox.prototype.isReadOnly = function () {
32116 return this.readOnly;
32117 };
32118 AgCheckbox.prototype.setReadOnly = function (readOnly) {
32119 this.eWrapper.classList.toggle('ag-disabled', readOnly);
32120 this.eInput.disabled = readOnly;
32121 this.readOnly = readOnly;
32122 };
32123 AgCheckbox.prototype.setDisabled = function (disabled) {
32124 this.eWrapper.classList.toggle('ag-disabled', disabled);
32125 return _super.prototype.setDisabled.call(this, disabled);
32126 };
32127 AgCheckbox.prototype.toggle = function () {
32128 if (this.eInput.disabled) {
32129 return;
32130 }
32131 var previousValue = this.isSelected();
32132 var nextValue = this.getNextValue();
32133 if (this.passive) {
32134 this.dispatchChange(nextValue, previousValue);
32135 }
32136 else {
32137 this.setValue(nextValue);
32138 }
32139 };
32140 AgCheckbox.prototype.getValue = function () {
32141 return this.isSelected();
32142 };
32143 AgCheckbox.prototype.setValue = function (value, silent) {
32144 this.refreshSelectedClass(value);
32145 this.setSelected(value, silent);
32146 return this;
32147 };
32148 AgCheckbox.prototype.setName = function (name) {
32149 var input = this.getInputElement();
32150 input.name = name;
32151 return this;
32152 };
32153 AgCheckbox.prototype.isSelected = function () {
32154 return this.selected;
32155 };
32156 AgCheckbox.prototype.setSelected = function (selected, silent) {
32157 if (this.isSelected() === selected) {
32158 return;
32159 }
32160 this.previousValue = this.isSelected();
32161 selected = this.selected = typeof selected === 'boolean' ? selected : undefined;
32162 this.eInput.checked = selected;
32163 this.eInput.indeterminate = selected === undefined;
32164 if (!silent) {
32165 this.dispatchChange(this.selected, this.previousValue);
32166 }
32167 };
32168 AgCheckbox.prototype.dispatchChange = function (selected, previousValue, event) {
32169 this.dispatchEvent({ type: AgCheckbox.EVENT_CHANGED, selected: selected, previousValue: previousValue, event: event });
32170 var input = this.getInputElement();
32171 var checkboxChangedEvent = {
32172 type: Events.EVENT_CHECKBOX_CHANGED,
32173 id: input.id,
32174 name: input.name,
32175 selected: selected,
32176 previousValue: previousValue
32177 };
32178 this.eventService.dispatchEvent(checkboxChangedEvent);
32179 };
32180 AgCheckbox.prototype.onCheckboxClick = function (e) {
32181 if (this.passive || this.eInput.disabled) {
32182 return;
32183 }
32184 var previousValue = this.isSelected();
32185 var selected = this.selected = e.target.checked;
32186 this.refreshSelectedClass(selected);
32187 this.dispatchChange(selected, previousValue, e);
32188 };
32189 AgCheckbox.prototype.refreshSelectedClass = function (value) {
32190 this.eWrapper.classList.toggle('ag-checked', value === true);
32191 this.eWrapper.classList.toggle('ag-indeterminate', value == null);
32192 };
32193 return AgCheckbox;
32194}(AgAbstractInputField));
32195
32196/**
32197 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
32198 * @version v27.3.0
32199 * @link https://www.ag-grid.com/
32200 * @license MIT
32201 */
32202var __extends$1q = (undefined && undefined.__extends) || (function () {
32203 var extendStatics = function (d, b) {
32204 extendStatics = Object.setPrototypeOf ||
32205 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32206 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
32207 return extendStatics(d, b);
32208 };
32209 return function (d, b) {
32210 extendStatics(d, b);
32211 function __() { this.constructor = d; }
32212 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32213 };
32214})();
32215var __decorate$1d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
32216 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
32217 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
32218 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;
32219 return c > 3 && r && Object.defineProperty(target, key, r), r;
32220};
32221var SelectAllFeature = /** @class */ (function (_super) {
32222 __extends$1q(SelectAllFeature, _super);
32223 function SelectAllFeature(column) {
32224 var _this = _super.call(this) || this;
32225 _this.cbSelectAllVisible = false;
32226 _this.processingEventFromCheckbox = false;
32227 _this.column = column;
32228 var colDef = column.getColDef();
32229 _this.filteredOnly = colDef ? !!colDef.headerCheckboxSelectionFilteredOnly : false;
32230 return _this;
32231 }
32232 SelectAllFeature.prototype.onSpaceKeyPressed = function (e) {
32233 var checkbox = this.cbSelectAll;
32234 var eDocument = this.gridOptionsWrapper.getDocument();
32235 if (checkbox.isDisplayed() && !checkbox.getGui().contains(eDocument.activeElement)) {
32236 e.preventDefault();
32237 checkbox.setValue(!checkbox.getValue());
32238 }
32239 };
32240 SelectAllFeature.prototype.getCheckboxGui = function () {
32241 return this.cbSelectAll.getGui();
32242 };
32243 SelectAllFeature.prototype.setComp = function (ctrl) {
32244 this.headerCellCtrl = ctrl;
32245 this.cbSelectAll = this.createManagedBean(new AgCheckbox());
32246 this.cbSelectAll.addCssClass('ag-header-select-all');
32247 setAriaRole(this.cbSelectAll.getGui(), 'presentation');
32248 this.showOrHideSelectAll();
32249 this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.showOrHideSelectAll.bind(this));
32250 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.showOrHideSelectAll.bind(this));
32251 this.addManagedListener(this.eventService, Events.EVENT_SELECTION_CHANGED, this.onSelectionChanged.bind(this));
32252 this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.onModelChanged.bind(this));
32253 this.addManagedListener(this.cbSelectAll, AgCheckbox.EVENT_CHANGED, this.onCbSelectAll.bind(this));
32254 this.cbSelectAll.getInputElement().setAttribute('tabindex', '-1');
32255 this.refreshSelectAllLabel();
32256 };
32257 SelectAllFeature.prototype.showOrHideSelectAll = function () {
32258 this.cbSelectAllVisible = this.isCheckboxSelection();
32259 this.cbSelectAll.setDisplayed(this.cbSelectAllVisible);
32260 if (this.cbSelectAllVisible) {
32261 // in case user is trying this feature with the wrong model type
32262 this.checkRightRowModelType();
32263 // make sure checkbox is showing the right state
32264 this.updateStateOfCheckbox();
32265 }
32266 this.refreshSelectAllLabel();
32267 };
32268 SelectAllFeature.prototype.onModelChanged = function () {
32269 if (!this.cbSelectAllVisible) {
32270 return;
32271 }
32272 this.updateStateOfCheckbox();
32273 };
32274 SelectAllFeature.prototype.onSelectionChanged = function () {
32275 if (!this.cbSelectAllVisible) {
32276 return;
32277 }
32278 this.updateStateOfCheckbox();
32279 };
32280 SelectAllFeature.prototype.getNextCheckboxState = function (selectionCount) {
32281 // if no rows, always have it unselected
32282 if (selectionCount.selected === 0 && selectionCount.notSelected === 0) {
32283 return false;
32284 }
32285 // if mix of selected and unselected, this is the tri-state
32286 if (selectionCount.selected > 0 && selectionCount.notSelected > 0) {
32287 return null;
32288 }
32289 // only selected
32290 if (selectionCount.selected > 0) {
32291 return true;
32292 }
32293 // nothing selected
32294 return false;
32295 };
32296 SelectAllFeature.prototype.updateStateOfCheckbox = function () {
32297 if (this.processingEventFromCheckbox) {
32298 return;
32299 }
32300 this.processingEventFromCheckbox = true;
32301 var selectionCount = this.getSelectionCount();
32302 var allSelected = this.getNextCheckboxState(selectionCount);
32303 this.cbSelectAll.setValue(allSelected);
32304 this.refreshSelectAllLabel();
32305 this.processingEventFromCheckbox = false;
32306 };
32307 SelectAllFeature.prototype.refreshSelectAllLabel = function () {
32308 if (!this.cbSelectAllVisible) {
32309 this.headerCellCtrl.setAriaDescriptionProperty('selectAll', null);
32310 }
32311 else {
32312 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
32313 var checked = this.cbSelectAll.getValue();
32314 var ariaStatus = checked ? translate('ariaChecked', 'checked') : translate('ariaUnchecked', 'unchecked');
32315 var ariaLabel = translate('ariaRowSelectAll', 'Press Space to toggle all rows selection');
32316 this.headerCellCtrl.setAriaDescriptionProperty('selectAll', ariaLabel + " (" + ariaStatus + ")");
32317 }
32318 this.headerCellCtrl.refreshAriaDescription();
32319 };
32320 SelectAllFeature.prototype.getSelectionCount = function () {
32321 var _this = this;
32322 var selectedCount = 0;
32323 var notSelectedCount = 0;
32324 var callback = function (node) {
32325 if (_this.gridOptionsWrapper.isGroupSelectsChildren() && node.group) {
32326 return;
32327 }
32328 if (node.isSelected()) {
32329 selectedCount++;
32330 }
32331 else if (!node.selectable) ;
32332 else {
32333 notSelectedCount++;
32334 }
32335 };
32336 if (this.filteredOnly) {
32337 this.gridApi.forEachNodeAfterFilter(callback);
32338 }
32339 else {
32340 this.gridApi.forEachNode(callback);
32341 }
32342 return {
32343 notSelected: notSelectedCount,
32344 selected: selectedCount
32345 };
32346 };
32347 SelectAllFeature.prototype.checkRightRowModelType = function () {
32348 var rowModelType = this.rowModel.getType();
32349 var rowModelMatches = rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
32350 if (!rowModelMatches) {
32351 console.warn("AG Grid: selectAllCheckbox is only available if using normal row model, you are using " + rowModelType);
32352 }
32353 };
32354 SelectAllFeature.prototype.onCbSelectAll = function () {
32355 if (this.processingEventFromCheckbox) {
32356 return;
32357 }
32358 if (!this.cbSelectAllVisible) {
32359 return;
32360 }
32361 var value = this.cbSelectAll.getValue();
32362 if (value) {
32363 this.selectionService.selectAllRowNodes(this.filteredOnly);
32364 }
32365 else {
32366 this.selectionService.deselectAllRowNodes(this.filteredOnly);
32367 }
32368 };
32369 SelectAllFeature.prototype.isCheckboxSelection = function () {
32370 var result = this.column.getColDef().headerCheckboxSelection;
32371 if (typeof result === 'function') {
32372 var func = result;
32373 var params = {
32374 column: this.column,
32375 colDef: this.column.getColDef(),
32376 columnApi: this.columnApi,
32377 api: this.gridApi,
32378 context: this.gridOptionsWrapper.getContext()
32379 };
32380 result = func(params);
32381 }
32382 if (result) {
32383 if (this.gridOptionsWrapper.isRowModelServerSide()) {
32384 console.warn('AG Grid: headerCheckboxSelection is not supported for Server Side Row Model');
32385 return false;
32386 }
32387 if (this.gridOptionsWrapper.isRowModelInfinite()) {
32388 console.warn('AG Grid: headerCheckboxSelection is not supported for Infinite Row Model');
32389 return false;
32390 }
32391 if (this.gridOptionsWrapper.isRowModelViewport()) {
32392 console.warn('AG Grid: headerCheckboxSelection is not supported for Viewport Row Model');
32393 return false;
32394 }
32395 // otherwise the row model is compatible, so return true
32396 return true;
32397 }
32398 return false;
32399 };
32400 __decorate$1d([
32401 Autowired('gridApi')
32402 ], SelectAllFeature.prototype, "gridApi", void 0);
32403 __decorate$1d([
32404 Autowired('columnApi')
32405 ], SelectAllFeature.prototype, "columnApi", void 0);
32406 __decorate$1d([
32407 Autowired('rowModel')
32408 ], SelectAllFeature.prototype, "rowModel", void 0);
32409 __decorate$1d([
32410 Autowired('selectionService')
32411 ], SelectAllFeature.prototype, "selectionService", void 0);
32412 return SelectAllFeature;
32413}(BeanStub));
32414
32415/**
32416 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
32417 * @version v27.3.0
32418 * @link https://www.ag-grid.com/
32419 * @license MIT
32420 */
32421var __extends$1r = (undefined && undefined.__extends) || (function () {
32422 var extendStatics = function (d, b) {
32423 extendStatics = Object.setPrototypeOf ||
32424 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32425 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
32426 return extendStatics(d, b);
32427 };
32428 return function (d, b) {
32429 extendStatics(d, b);
32430 function __() { this.constructor = d; }
32431 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32432 };
32433})();
32434var __decorate$1e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
32435 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
32436 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
32437 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;
32438 return c > 3 && r && Object.defineProperty(target, key, r), r;
32439};
32440var HeaderCellCtrl = /** @class */ (function (_super) {
32441 __extends$1r(HeaderCellCtrl, _super);
32442 function HeaderCellCtrl(column, parentRowCtrl) {
32443 var _this = _super.call(this, column, parentRowCtrl) || this;
32444 _this.refreshFunctions = [];
32445 _this.userHeaderClasses = new Set();
32446 _this.ariaDescriptionProperties = new Map();
32447 _this.column = column;
32448 return _this;
32449 }
32450 HeaderCellCtrl.prototype.setComp = function (comp, eGui, eResize) {
32451 var _this = this;
32452 _super.prototype.setGui.call(this, eGui);
32453 this.comp = comp;
32454 this.colDefVersion = this.columnModel.getColDefVersion();
32455 this.updateState();
32456 this.setupWidth();
32457 this.setupMovingCss();
32458 this.setupMenuClass();
32459 this.setupSortableClass();
32460 this.addColumnHoverListener();
32461 this.setupFilterCss();
32462 this.setupColId();
32463 this.setupClassesFromColDef();
32464 this.setupTooltip();
32465 this.addActiveHeaderMouseListeners();
32466 this.setupSelectAll();
32467 this.setupUserComp();
32468 this.refreshAria();
32469 this.createManagedBean(new ResizeFeature(this.getPinned(), this.column, eResize, comp, this));
32470 this.createManagedBean(new HoverFeature([this.column], eGui));
32471 this.createManagedBean(new SetLeftFeature(this.column, eGui, this.beans));
32472 this.createManagedBean(new ManagedFocusFeature(eGui, {
32473 shouldStopEventPropagation: function (e) { return _this.shouldStopEventPropagation(e); },
32474 onTabKeyDown: function () { return null; },
32475 handleKeyDown: this.handleKeyDown.bind(this),
32476 onFocusIn: this.onFocusIn.bind(this),
32477 onFocusOut: this.onFocusOut.bind(this)
32478 }));
32479 this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onNewColumnsLoaded.bind(this));
32480 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, this.onColumnValueChanged.bind(this));
32481 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onColumnRowGroupChanged.bind(this));
32482 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, this.onColumnPivotChanged.bind(this));
32483 };
32484 HeaderCellCtrl.prototype.setupUserComp = function () {
32485 var compDetails = this.lookupUserCompDetails();
32486 this.setCompDetails(compDetails);
32487 };
32488 HeaderCellCtrl.prototype.setCompDetails = function (compDetails) {
32489 this.userCompDetails = compDetails;
32490 this.comp.setUserCompDetails(compDetails);
32491 };
32492 HeaderCellCtrl.prototype.lookupUserCompDetails = function () {
32493 var params = this.createParams();
32494 var colDef = this.column.getColDef();
32495 return this.userComponentFactory.getHeaderCompDetails(colDef, params);
32496 };
32497 HeaderCellCtrl.prototype.createParams = function () {
32498 var _this = this;
32499 var colDef = this.column.getColDef();
32500 var params = {
32501 column: this.column,
32502 displayName: this.displayName,
32503 enableSorting: colDef.sortable,
32504 enableMenu: this.menuEnabled,
32505 showColumnMenu: function (source) {
32506 _this.gridApi.showColumnMenuAfterButtonClick(_this.column, source);
32507 },
32508 progressSort: function (multiSort) {
32509 _this.sortController.progressSort(_this.column, !!multiSort, "uiColumnSorted");
32510 },
32511 setSort: function (sort, multiSort) {
32512 _this.sortController.setSortForColumn(_this.column, sort, !!multiSort, "uiColumnSorted");
32513 },
32514 api: this.gridApi,
32515 columnApi: this.columnApi,
32516 context: this.gridOptionsWrapper.getContext(),
32517 eGridHeader: this.getGui()
32518 };
32519 return params;
32520 };
32521 HeaderCellCtrl.prototype.setupSelectAll = function () {
32522 this.selectAllFeature = this.createManagedBean(new SelectAllFeature(this.column));
32523 this.selectAllFeature.setComp(this);
32524 };
32525 HeaderCellCtrl.prototype.getSelectAllGui = function () {
32526 return this.selectAllFeature.getCheckboxGui();
32527 };
32528 HeaderCellCtrl.prototype.handleKeyDown = function (e) {
32529 if (e.key === KeyCode.SPACE) {
32530 this.selectAllFeature.onSpaceKeyPressed(e);
32531 }
32532 if (e.key === KeyCode.ENTER) {
32533 this.onEnterKeyPressed(e);
32534 }
32535 };
32536 HeaderCellCtrl.prototype.onEnterKeyPressed = function (e) {
32537 /// THIS IS BAD - we are assuming the header is not a user provided comp
32538 var headerComp = this.comp.getUserCompInstance();
32539 if (!headerComp) {
32540 return;
32541 }
32542 if (e.ctrlKey || e.metaKey) {
32543 if (this.menuEnabled && headerComp.showMenu) {
32544 e.preventDefault();
32545 headerComp.showMenu();
32546 }
32547 }
32548 else if (this.sortable) {
32549 var multiSort = e.shiftKey;
32550 this.sortController.progressSort(this.column, multiSort, "uiColumnSorted");
32551 }
32552 };
32553 HeaderCellCtrl.prototype.isMenuEnabled = function () {
32554 return this.menuEnabled;
32555 };
32556 HeaderCellCtrl.prototype.onFocusIn = function (e) {
32557 if (!this.getGui().contains(e.relatedTarget)) {
32558 var rowIndex = this.getRowIndex();
32559 this.focusService.setFocusedHeader(rowIndex, this.column);
32560 }
32561 this.setActiveHeader(true);
32562 };
32563 HeaderCellCtrl.prototype.onFocusOut = function (e) {
32564 if (this.getGui().contains(e.relatedTarget)) {
32565 return;
32566 }
32567 this.setActiveHeader(false);
32568 };
32569 HeaderCellCtrl.prototype.setupTooltip = function () {
32570 var _this = this;
32571 var tooltipCtrl = {
32572 getColumn: function () { return _this.column; },
32573 getColDef: function () { return _this.column.getColDef(); },
32574 getGui: function () { return _this.eGui; },
32575 getLocation: function () { return 'header'; },
32576 getTooltipValue: function () {
32577 var res = _this.column.getColDef().headerTooltip;
32578 return res;
32579 },
32580 };
32581 var tooltipFeature = this.createManagedBean(new TooltipFeature(tooltipCtrl, this.beans));
32582 tooltipFeature.setComp(this.comp);
32583 this.refreshFunctions.push(function () { return tooltipFeature.refreshToolTip(); });
32584 };
32585 HeaderCellCtrl.prototype.setupClassesFromColDef = function () {
32586 var _this = this;
32587 var refreshHeaderClasses = function () {
32588 var colDef = _this.column.getColDef();
32589 var goa = _this.gridOptionsWrapper;
32590 var classes = CssClassApplier.getHeaderClassesFromColDef(colDef, goa, _this.column, null);
32591 var oldClasses = _this.userHeaderClasses;
32592 _this.userHeaderClasses = new Set(classes);
32593 classes.forEach(function (c) {
32594 if (oldClasses.has(c)) {
32595 // class already added, no need to apply it, but remove from old set
32596 oldClasses.delete(c);
32597 }
32598 else {
32599 // class new since last time, so apply it
32600 _this.comp.addOrRemoveCssClass(c, true);
32601 }
32602 });
32603 // now old set only has classes that were applied last time, but not this time, so remove them
32604 oldClasses.forEach(function (c) { return _this.comp.addOrRemoveCssClass(c, false); });
32605 };
32606 this.refreshFunctions.push(refreshHeaderClasses);
32607 refreshHeaderClasses();
32608 };
32609 HeaderCellCtrl.prototype.setDragSource = function (eSource) {
32610 var _this = this;
32611 this.dragSourceElement = eSource;
32612 this.removeDragSource();
32613 if (!eSource) {
32614 return;
32615 }
32616 if (!this.draggable) {
32617 return;
32618 }
32619 this.moveDragSource = {
32620 type: exports.DragSourceType.HeaderCell,
32621 eElement: eSource,
32622 defaultIconName: DragAndDropService.ICON_HIDE,
32623 getDragItem: function () { return _this.createDragItem(); },
32624 dragItemName: this.displayName,
32625 onDragStarted: function () { return _this.column.setMoving(true, "uiColumnMoved"); },
32626 onDragStopped: function () { return _this.column.setMoving(false, "uiColumnMoved"); }
32627 };
32628 this.dragAndDropService.addDragSource(this.moveDragSource, true);
32629 };
32630 HeaderCellCtrl.prototype.createDragItem = function () {
32631 var visibleState = {};
32632 visibleState[this.column.getId()] = this.column.isVisible();
32633 return {
32634 columns: [this.column],
32635 visibleState: visibleState
32636 };
32637 };
32638 HeaderCellCtrl.prototype.removeDragSource = function () {
32639 if (this.moveDragSource) {
32640 this.dragAndDropService.removeDragSource(this.moveDragSource);
32641 this.moveDragSource = undefined;
32642 }
32643 };
32644 HeaderCellCtrl.prototype.onNewColumnsLoaded = function () {
32645 var colDefVersionNow = this.columnModel.getColDefVersion();
32646 if (colDefVersionNow != this.colDefVersion) {
32647 this.colDefVersion = colDefVersionNow;
32648 this.refresh();
32649 }
32650 };
32651 HeaderCellCtrl.prototype.updateState = function () {
32652 var colDef = this.column.getColDef();
32653 this.menuEnabled = this.menuFactory.isMenuEnabled(this.column) && !colDef.suppressMenu;
32654 this.sortable = colDef.sortable;
32655 this.displayName = this.calculateDisplayName();
32656 this.draggable = this.workOutDraggable();
32657 };
32658 HeaderCellCtrl.prototype.addRefreshFunction = function (func) {
32659 this.refreshFunctions.push(func);
32660 };
32661 HeaderCellCtrl.prototype.refresh = function () {
32662 this.updateState();
32663 this.refreshHeaderComp();
32664 this.refreshAria();
32665 this.refreshFunctions.forEach(function (f) { return f(); });
32666 };
32667 HeaderCellCtrl.prototype.refreshHeaderComp = function () {
32668 var newCompDetails = this.lookupUserCompDetails();
32669 var compInstance = this.comp.getUserCompInstance();
32670 // only try refresh if old comp exists adn it is the correct type
32671 var attemptRefresh = compInstance != null && this.userCompDetails.componentClass == newCompDetails.componentClass;
32672 var headerCompRefreshed = attemptRefresh ? this.attemptHeaderCompRefresh(newCompDetails.params) : false;
32673 if (headerCompRefreshed) {
32674 // we do this as a refresh happens after colDefs change, and it's possible the column has had it's
32675 // draggable property toggled. no need to call this if not refreshing, as setDragSource is done
32676 // as part of appendHeaderComp
32677 this.setDragSource(this.dragSourceElement);
32678 }
32679 else {
32680 this.setCompDetails(newCompDetails);
32681 }
32682 };
32683 HeaderCellCtrl.prototype.attemptHeaderCompRefresh = function (params) {
32684 var headerComp = this.comp.getUserCompInstance();
32685 if (!headerComp) {
32686 return false;
32687 }
32688 // if no refresh method, then we want to replace the headerComp
32689 if (!headerComp.refresh) {
32690 return false;
32691 }
32692 var res = headerComp.refresh(params);
32693 return res;
32694 };
32695 HeaderCellCtrl.prototype.calculateDisplayName = function () {
32696 return this.columnModel.getDisplayNameForColumn(this.column, 'header', true);
32697 };
32698 HeaderCellCtrl.prototype.checkDisplayName = function () {
32699 // display name can change if aggFunc different, eg sum(Gold) is now max(Gold)
32700 if (this.displayName !== this.calculateDisplayName()) {
32701 this.refresh();
32702 }
32703 };
32704 HeaderCellCtrl.prototype.workOutDraggable = function () {
32705 var colDef = this.column.getColDef();
32706 var isSuppressMovableColumns = this.gridOptionsWrapper.isSuppressMovableColumns();
32707 var colCanMove = !isSuppressMovableColumns && !colDef.suppressMovable && !colDef.lockPosition;
32708 // we should still be allowed drag the column, even if it can't be moved, if the column
32709 // can be dragged to a rowGroup or pivot drop zone
32710 return !!colCanMove || !!colDef.enableRowGroup || !!colDef.enablePivot;
32711 };
32712 HeaderCellCtrl.prototype.onColumnRowGroupChanged = function () {
32713 this.checkDisplayName();
32714 };
32715 HeaderCellCtrl.prototype.onColumnPivotChanged = function () {
32716 this.checkDisplayName();
32717 };
32718 HeaderCellCtrl.prototype.onColumnValueChanged = function () {
32719 this.checkDisplayName();
32720 };
32721 HeaderCellCtrl.prototype.setupWidth = function () {
32722 var _this = this;
32723 var listener = function () {
32724 _this.comp.setWidth(_this.column.getActualWidth() + 'px');
32725 };
32726 this.addManagedListener(this.column, Column.EVENT_WIDTH_CHANGED, listener);
32727 listener();
32728 };
32729 HeaderCellCtrl.prototype.setupMovingCss = function () {
32730 var _this = this;
32731 var listener = function () {
32732 // this is what makes the header go dark when it is been moved (gives impression to
32733 // user that the column was picked up).
32734 _this.comp.addOrRemoveCssClass('ag-header-cell-moving', _this.column.isMoving());
32735 };
32736 this.addManagedListener(this.column, Column.EVENT_MOVING_CHANGED, listener);
32737 listener();
32738 };
32739 HeaderCellCtrl.prototype.setupMenuClass = function () {
32740 var _this = this;
32741 var listener = function () {
32742 _this.comp.addOrRemoveCssClass('ag-column-menu-visible', _this.column.isMenuVisible());
32743 };
32744 this.addManagedListener(this.column, Column.EVENT_MENU_VISIBLE_CHANGED, listener);
32745 listener();
32746 };
32747 HeaderCellCtrl.prototype.setupSortableClass = function () {
32748 var _this = this;
32749 var updateSortableCssClass = function () {
32750 _this.comp.addOrRemoveCssClass('ag-header-cell-sortable', !!_this.sortable);
32751 };
32752 updateSortableCssClass();
32753 this.addRefreshFunction(updateSortableCssClass);
32754 this.addManagedListener(this.column, Column.EVENT_SORT_CHANGED, this.refreshAriaSort.bind(this));
32755 };
32756 HeaderCellCtrl.prototype.refreshAriaSort = function () {
32757 if (this.sortable) {
32758 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
32759 this.comp.setAriaSort(getAriaSortState(this.column));
32760 this.setAriaDescriptionProperty('sort', translate('ariaSortableColumn', 'Press ENTER to sort.'));
32761 }
32762 else {
32763 this.comp.setAriaSort();
32764 this.setAriaDescriptionProperty('sort', null);
32765 }
32766 };
32767 HeaderCellCtrl.prototype.refreshAriaMenu = function () {
32768 if (this.menuEnabled) {
32769 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
32770 this.setAriaDescriptionProperty('menu', translate('ariaMenuColumn', 'Press CTRL ENTER to open column menu.'));
32771 }
32772 else {
32773 this.setAriaDescriptionProperty('menu', null);
32774 }
32775 };
32776 HeaderCellCtrl.prototype.setAriaDescriptionProperty = function (property, value) {
32777 if (value != null) {
32778 this.ariaDescriptionProperties.set(property, value);
32779 }
32780 else {
32781 this.ariaDescriptionProperties.delete(property);
32782 }
32783 };
32784 HeaderCellCtrl.prototype.refreshAriaDescription = function () {
32785 var descriptionArray = Array.from(this.ariaDescriptionProperties.values());
32786 this.comp.setAriaDescription(descriptionArray.length ? descriptionArray.join(' ') : undefined);
32787 };
32788 HeaderCellCtrl.prototype.refreshAria = function () {
32789 this.refreshAriaSort();
32790 this.refreshAriaMenu();
32791 this.refreshAriaDescription();
32792 };
32793 HeaderCellCtrl.prototype.addColumnHoverListener = function () {
32794 var _this = this;
32795 var listener = function () {
32796 if (!_this.gridOptionsWrapper.isColumnHoverHighlight()) {
32797 return;
32798 }
32799 var isHovered = _this.columnHoverService.isHovered(_this.column);
32800 _this.comp.addOrRemoveCssClass('ag-column-hover', isHovered);
32801 };
32802 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, listener);
32803 listener();
32804 };
32805 HeaderCellCtrl.prototype.setupFilterCss = function () {
32806 var _this = this;
32807 var listener = function () {
32808 _this.comp.addOrRemoveCssClass('ag-header-cell-filtered', _this.column.isFilterActive());
32809 };
32810 this.addManagedListener(this.column, Column.EVENT_FILTER_ACTIVE_CHANGED, listener);
32811 listener();
32812 };
32813 HeaderCellCtrl.prototype.setupColId = function () {
32814 this.comp.setColId(this.column.getColId());
32815 };
32816 HeaderCellCtrl.prototype.addActiveHeaderMouseListeners = function () {
32817 var _this = this;
32818 var listener = function (e) { return _this.setActiveHeader(e.type === 'mouseenter'); };
32819 this.addManagedListener(this.getGui(), 'mouseenter', listener);
32820 this.addManagedListener(this.getGui(), 'mouseleave', listener);
32821 };
32822 HeaderCellCtrl.prototype.setActiveHeader = function (active) {
32823 this.comp.addOrRemoveCssClass('ag-header-active', active);
32824 };
32825 __decorate$1e([
32826 Autowired('columnModel')
32827 ], HeaderCellCtrl.prototype, "columnModel", void 0);
32828 __decorate$1e([
32829 Autowired('columnHoverService')
32830 ], HeaderCellCtrl.prototype, "columnHoverService", void 0);
32831 __decorate$1e([
32832 Autowired('beans')
32833 ], HeaderCellCtrl.prototype, "beans", void 0);
32834 __decorate$1e([
32835 Autowired('sortController')
32836 ], HeaderCellCtrl.prototype, "sortController", void 0);
32837 __decorate$1e([
32838 Autowired('menuFactory')
32839 ], HeaderCellCtrl.prototype, "menuFactory", void 0);
32840 __decorate$1e([
32841 Autowired('dragAndDropService')
32842 ], HeaderCellCtrl.prototype, "dragAndDropService", void 0);
32843 __decorate$1e([
32844 Autowired('gridApi')
32845 ], HeaderCellCtrl.prototype, "gridApi", void 0);
32846 __decorate$1e([
32847 Autowired('columnApi')
32848 ], HeaderCellCtrl.prototype, "columnApi", void 0);
32849 __decorate$1e([
32850 Autowired('userComponentFactory')
32851 ], HeaderCellCtrl.prototype, "userComponentFactory", void 0);
32852 __decorate$1e([
32853 PreDestroy
32854 ], HeaderCellCtrl.prototype, "removeDragSource", null);
32855 return HeaderCellCtrl;
32856}(AbstractHeaderCellCtrl));
32857
32858/**
32859 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
32860 * @version v27.3.0
32861 * @link https://www.ag-grid.com/
32862 * @license MIT
32863 */
32864var __extends$1s = (undefined && undefined.__extends) || (function () {
32865 var extendStatics = function (d, b) {
32866 extendStatics = Object.setPrototypeOf ||
32867 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32868 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
32869 return extendStatics(d, b);
32870 };
32871 return function (d, b) {
32872 extendStatics(d, b);
32873 function __() { this.constructor = d; }
32874 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32875 };
32876})();
32877var __decorate$1f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
32878 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
32879 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
32880 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;
32881 return c > 3 && r && Object.defineProperty(target, key, r), r;
32882};
32883var GroupResizeFeature = /** @class */ (function (_super) {
32884 __extends$1s(GroupResizeFeature, _super);
32885 function GroupResizeFeature(comp, eResize, pinned, columnGroup) {
32886 var _this = _super.call(this) || this;
32887 _this.eResize = eResize;
32888 _this.comp = comp;
32889 _this.pinned = pinned;
32890 _this.columnGroup = columnGroup;
32891 return _this;
32892 }
32893 GroupResizeFeature.prototype.postConstruct = function () {
32894 var _this = this;
32895 if (!this.columnGroup.isResizable()) {
32896 this.comp.addOrRemoveResizableCssClass('ag-hidden', true);
32897 return;
32898 }
32899 var finishedWithResizeFunc = this.horizontalResizeService.addResizeBar({
32900 eResizeBar: this.eResize,
32901 onResizeStart: this.onResizeStart.bind(this),
32902 onResizing: this.onResizing.bind(this, false),
32903 onResizeEnd: this.onResizing.bind(this, true)
32904 });
32905 this.addDestroyFunc(finishedWithResizeFunc);
32906 if (!this.gridOptionsWrapper.isSuppressAutoSize()) {
32907 var skipHeaderOnAutoSize_1 = this.gridOptionsWrapper.isSkipHeaderOnAutoSize();
32908 this.eResize.addEventListener('dblclick', function () {
32909 // get list of all the column keys we are responsible for
32910 var keys = [];
32911 var leafCols = _this.columnGroup.getDisplayedLeafColumns();
32912 leafCols.forEach(function (column) {
32913 // not all cols in the group may be participating with auto-resize
32914 if (!column.getColDef().suppressAutoSize) {
32915 keys.push(column.getColId());
32916 }
32917 });
32918 if (keys.length > 0) {
32919 _this.columnModel.autoSizeColumns({
32920 columns: keys,
32921 skipHeader: skipHeaderOnAutoSize_1,
32922 stopAtGroup: _this.columnGroup,
32923 source: 'uiColumnResized'
32924 });
32925 }
32926 _this.resizeLeafColumnsToFit();
32927 });
32928 }
32929 };
32930 GroupResizeFeature.prototype.onResizeStart = function (shiftKey) {
32931 var _this = this;
32932 this.calculateInitialValues();
32933 var takeFromGroup = null;
32934 if (shiftKey) {
32935 takeFromGroup = this.columnModel.getDisplayedGroupAfter(this.columnGroup);
32936 }
32937 if (takeFromGroup) {
32938 var takeFromLeafCols = takeFromGroup.getDisplayedLeafColumns();
32939 this.resizeTakeFromCols = takeFromLeafCols.filter(function (col) { return col.isResizable(); });
32940 this.resizeTakeFromStartWidth = 0;
32941 this.resizeTakeFromCols.forEach(function (col) { return _this.resizeTakeFromStartWidth += col.getActualWidth(); });
32942 this.resizeTakeFromRatios = [];
32943 this.resizeTakeFromCols.forEach(function (col) { return _this.resizeTakeFromRatios.push(col.getActualWidth() / _this.resizeTakeFromStartWidth); });
32944 }
32945 else {
32946 this.resizeTakeFromCols = null;
32947 this.resizeTakeFromStartWidth = null;
32948 this.resizeTakeFromRatios = null;
32949 }
32950 this.comp.addOrRemoveCssClass('ag-column-resizing', true);
32951 };
32952 GroupResizeFeature.prototype.onResizing = function (finished, resizeAmount) {
32953 var resizeAmountNormalised = this.normaliseDragChange(resizeAmount);
32954 var width = this.resizeStartWidth + resizeAmountNormalised;
32955 this.resizeColumns(width, finished);
32956 };
32957 GroupResizeFeature.prototype.resizeLeafColumnsToFit = function () {
32958 var preferredSize = this.autoWidthCalculator.getPreferredWidthForColumnGroup(this.columnGroup);
32959 this.calculateInitialValues();
32960 if (preferredSize > this.resizeStartWidth) {
32961 this.resizeColumns(preferredSize, true);
32962 }
32963 };
32964 GroupResizeFeature.prototype.resizeColumns = function (totalWidth, finished) {
32965 if (finished === void 0) { finished = true; }
32966 var resizeSets = [];
32967 resizeSets.push({
32968 columns: this.resizeCols,
32969 ratios: this.resizeRatios,
32970 width: totalWidth
32971 });
32972 if (this.resizeTakeFromCols) {
32973 var diff = totalWidth - this.resizeStartWidth;
32974 resizeSets.push({
32975 columns: this.resizeTakeFromCols,
32976 ratios: this.resizeTakeFromRatios,
32977 width: this.resizeTakeFromStartWidth - diff
32978 });
32979 }
32980 this.columnModel.resizeColumnSets({
32981 resizeSets: resizeSets,
32982 finished: finished,
32983 source: 'uiColumnDragged'
32984 });
32985 if (finished) {
32986 this.comp.addOrRemoveCssClass('ag-column-resizing', false);
32987 }
32988 };
32989 GroupResizeFeature.prototype.calculateInitialValues = function () {
32990 var _this = this;
32991 var leafCols = this.columnGroup.getDisplayedLeafColumns();
32992 this.resizeCols = leafCols.filter(function (col) { return col.isResizable(); });
32993 this.resizeStartWidth = 0;
32994 this.resizeCols.forEach(function (col) { return _this.resizeStartWidth += col.getActualWidth(); });
32995 this.resizeRatios = [];
32996 this.resizeCols.forEach(function (col) { return _this.resizeRatios.push(col.getActualWidth() / _this.resizeStartWidth); });
32997 };
32998 // optionally inverts the drag, depending on pinned and RTL
32999 // note - this method is duplicated in RenderedHeaderCell - should refactor out?
33000 GroupResizeFeature.prototype.normaliseDragChange = function (dragChange) {
33001 var result = dragChange;
33002 if (this.gridOptionsWrapper.isEnableRtl()) {
33003 // for RTL, dragging left makes the col bigger, except when pinning left
33004 if (this.pinned !== Constants.PINNED_LEFT) {
33005 result *= -1;
33006 }
33007 }
33008 else if (this.pinned === Constants.PINNED_RIGHT) {
33009 // for LTR (ie normal), dragging left makes the col smaller, except when pinning right
33010 result *= -1;
33011 }
33012 return result;
33013 };
33014 __decorate$1f([
33015 Autowired('horizontalResizeService')
33016 ], GroupResizeFeature.prototype, "horizontalResizeService", void 0);
33017 __decorate$1f([
33018 Autowired('autoWidthCalculator')
33019 ], GroupResizeFeature.prototype, "autoWidthCalculator", void 0);
33020 __decorate$1f([
33021 Autowired('columnModel')
33022 ], GroupResizeFeature.prototype, "columnModel", void 0);
33023 __decorate$1f([
33024 PostConstruct
33025 ], GroupResizeFeature.prototype, "postConstruct", null);
33026 return GroupResizeFeature;
33027}(BeanStub));
33028
33029/**
33030 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
33031 * @version v27.3.0
33032 * @link https://www.ag-grid.com/
33033 * @license MIT
33034 */
33035var __extends$1t = (undefined && undefined.__extends) || (function () {
33036 var extendStatics = function (d, b) {
33037 extendStatics = Object.setPrototypeOf ||
33038 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
33039 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
33040 return extendStatics(d, b);
33041 };
33042 return function (d, b) {
33043 extendStatics(d, b);
33044 function __() { this.constructor = d; }
33045 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33046 };
33047})();
33048var __decorate$1g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
33049 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
33050 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33051 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;
33052 return c > 3 && r && Object.defineProperty(target, key, r), r;
33053};
33054var GroupWidthFeature = /** @class */ (function (_super) {
33055 __extends$1t(GroupWidthFeature, _super);
33056 function GroupWidthFeature(comp, columnGroup) {
33057 var _this = _super.call(this) || this;
33058 // the children can change, we keep destroy functions related to listening to the children here
33059 _this.removeChildListenersFuncs = [];
33060 _this.columnGroup = columnGroup;
33061 _this.comp = comp;
33062 return _this;
33063 }
33064 GroupWidthFeature.prototype.postConstruct = function () {
33065 // we need to listen to changes in child columns, as they impact our width
33066 this.addListenersToChildrenColumns();
33067 // the children belonging to this group can change, so we need to add and remove listeners as they change
33068 this.addManagedListener(this.columnGroup, ColumnGroup.EVENT_DISPLAYED_CHILDREN_CHANGED, this.onDisplayedChildrenChanged.bind(this));
33069 this.onWidthChanged();
33070 // the child listeners are not tied to this components life-cycle, as children can get added and removed
33071 // to the group - hence they are on a different life-cycle. so we must make sure the existing children
33072 // listeners are removed when we finally get destroyed
33073 this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this));
33074 };
33075 GroupWidthFeature.prototype.addListenersToChildrenColumns = function () {
33076 var _this = this;
33077 // first destroy any old listeners
33078 this.removeListenersOnChildrenColumns();
33079 // now add new listeners to the new set of children
33080 var widthChangedListener = this.onWidthChanged.bind(this);
33081 this.columnGroup.getLeafColumns().forEach(function (column) {
33082 column.addEventListener(Column.EVENT_WIDTH_CHANGED, widthChangedListener);
33083 column.addEventListener(Column.EVENT_VISIBLE_CHANGED, widthChangedListener);
33084 _this.removeChildListenersFuncs.push(function () {
33085 column.removeEventListener(Column.EVENT_WIDTH_CHANGED, widthChangedListener);
33086 column.removeEventListener(Column.EVENT_VISIBLE_CHANGED, widthChangedListener);
33087 });
33088 });
33089 };
33090 GroupWidthFeature.prototype.removeListenersOnChildrenColumns = function () {
33091 this.removeChildListenersFuncs.forEach(function (func) { return func(); });
33092 this.removeChildListenersFuncs = [];
33093 };
33094 GroupWidthFeature.prototype.onDisplayedChildrenChanged = function () {
33095 this.addListenersToChildrenColumns();
33096 this.onWidthChanged();
33097 };
33098 GroupWidthFeature.prototype.onWidthChanged = function () {
33099 this.comp.setWidth(this.columnGroup.getActualWidth() + 'px');
33100 };
33101 __decorate$1g([
33102 PostConstruct
33103 ], GroupWidthFeature.prototype, "postConstruct", null);
33104 return GroupWidthFeature;
33105}(BeanStub));
33106
33107/**
33108 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
33109 * @version v27.3.0
33110 * @link https://www.ag-grid.com/
33111 * @license MIT
33112 */
33113var __extends$1u = (undefined && undefined.__extends) || (function () {
33114 var extendStatics = function (d, b) {
33115 extendStatics = Object.setPrototypeOf ||
33116 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
33117 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
33118 return extendStatics(d, b);
33119 };
33120 return function (d, b) {
33121 extendStatics(d, b);
33122 function __() { this.constructor = d; }
33123 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33124 };
33125})();
33126var __decorate$1h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
33127 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
33128 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33129 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;
33130 return c > 3 && r && Object.defineProperty(target, key, r), r;
33131};
33132var HeaderGroupCellCtrl = /** @class */ (function (_super) {
33133 __extends$1u(HeaderGroupCellCtrl, _super);
33134 function HeaderGroupCellCtrl(columnGroup, parentRowCtrl) {
33135 var _this = _super.call(this, columnGroup, parentRowCtrl) || this;
33136 _this.columnGroup = columnGroup;
33137 return _this;
33138 }
33139 HeaderGroupCellCtrl.prototype.setComp = function (comp, eGui, eResize) {
33140 _super.prototype.setGui.call(this, eGui);
33141 this.comp = comp;
33142 this.displayName = this.columnModel.getDisplayNameForColumnGroup(this.columnGroup, 'header');
33143 this.addClasses();
33144 this.addAttributes();
33145 this.setupMovingCss();
33146 this.setupExpandable();
33147 this.setupTooltip();
33148 this.setupUserComp();
33149 var pinned = this.getParentRowCtrl().getPinned();
33150 var leafCols = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
33151 this.createManagedBean(new HoverFeature(leafCols, eGui));
33152 this.createManagedBean(new SetLeftFeature(this.columnGroup, eGui, this.beans));
33153 this.createManagedBean(new GroupWidthFeature(comp, this.columnGroup));
33154 this.groupResizeFeature = this.createManagedBean(new GroupResizeFeature(comp, eResize, pinned, this.columnGroup));
33155 this.createManagedBean(new ManagedFocusFeature(eGui, {
33156 shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),
33157 onTabKeyDown: function () { return undefined; },
33158 handleKeyDown: this.handleKeyDown.bind(this),
33159 onFocusIn: this.onFocusIn.bind(this)
33160 }));
33161 };
33162 HeaderGroupCellCtrl.prototype.resizeLeafColumnsToFit = function () {
33163 this.groupResizeFeature.onResizeStart(false);
33164 this.groupResizeFeature.resizeLeafColumnsToFit();
33165 };
33166 HeaderGroupCellCtrl.prototype.setupUserComp = function () {
33167 var _this = this;
33168 var displayName = this.displayName;
33169 var params = {
33170 displayName: this.displayName,
33171 columnGroup: this.columnGroup,
33172 setExpanded: function (expanded) {
33173 _this.columnModel.setColumnGroupOpened(_this.columnGroup.getProvidedColumnGroup(), expanded, "gridInitializing");
33174 },
33175 api: this.gridApi,
33176 columnApi: this.columnApi,
33177 context: this.gridOptionsWrapper.getContext()
33178 };
33179 if (!displayName) {
33180 var columnGroup = this.columnGroup;
33181 var leafCols = columnGroup.getLeafColumns();
33182 // find the top most column group that represents the same columns. so if we are dragging a group, we also
33183 // want to visually show the parent groups dragging for the same column set. for example imaging 5 levels
33184 // of grouping, with each group only containing the next group, and the last group containing three columns,
33185 // then when you move any group (even the lowest level group) you are in-fact moving all the groups, as all
33186 // the groups represent the same column set.
33187 while (columnGroup.getParent() && columnGroup.getParent().getLeafColumns().length === leafCols.length) {
33188 columnGroup = columnGroup.getParent();
33189 }
33190 var colGroupDef = columnGroup.getColGroupDef();
33191 if (colGroupDef) {
33192 displayName = colGroupDef.headerName;
33193 }
33194 if (!displayName) {
33195 displayName = leafCols ? this.columnModel.getDisplayNameForColumn(leafCols[0], 'header', true) : '';
33196 }
33197 }
33198 var compDetails = this.userComponentFactory.getHeaderGroupCompDetails(params);
33199 this.comp.setUserCompDetails(compDetails);
33200 };
33201 HeaderGroupCellCtrl.prototype.setupTooltip = function () {
33202 var _this = this;
33203 var colGroupDef = this.columnGroup.getColGroupDef();
33204 var tooltipCtrl = {
33205 getColumn: function () { return _this.columnGroup; },
33206 getGui: function () { return _this.eGui; },
33207 getLocation: function () { return 'headerGroup'; },
33208 getTooltipValue: function () { return colGroupDef && colGroupDef.headerTooltip; }
33209 };
33210 if (colGroupDef) {
33211 tooltipCtrl.getColDef = function () { return colGroupDef; };
33212 }
33213 var tooltipFeature = this.createManagedBean(new TooltipFeature(tooltipCtrl, this.beans));
33214 tooltipFeature.setComp(this.comp);
33215 };
33216 HeaderGroupCellCtrl.prototype.setupExpandable = function () {
33217 var providedColGroup = this.columnGroup.getProvidedColumnGroup();
33218 this.refreshExpanded();
33219 this.addManagedListener(providedColGroup, ProvidedColumnGroup.EVENT_EXPANDABLE_CHANGED, this.refreshExpanded.bind(this));
33220 this.addManagedListener(providedColGroup, ProvidedColumnGroup.EVENT_EXPANDED_CHANGED, this.refreshExpanded.bind(this));
33221 };
33222 HeaderGroupCellCtrl.prototype.refreshExpanded = function () {
33223 var column = this.columnGroup;
33224 this.expandable = column.isExpandable();
33225 var expanded = column.isExpanded();
33226 if (this.expandable) {
33227 this.comp.setAriaExpanded(expanded ? 'true' : 'false');
33228 }
33229 else {
33230 this.comp.setAriaExpanded(undefined);
33231 }
33232 };
33233 HeaderGroupCellCtrl.prototype.addAttributes = function () {
33234 this.comp.setColId(this.columnGroup.getUniqueId());
33235 };
33236 HeaderGroupCellCtrl.prototype.addClasses = function () {
33237 var _this = this;
33238 var colGroupDef = this.columnGroup.getColGroupDef();
33239 var classes = CssClassApplier.getHeaderClassesFromColDef(colGroupDef, this.gridOptionsWrapper, null, this.columnGroup);
33240 // having different classes below allows the style to not have a bottom border
33241 // on the group header, if no group is specified
33242 classes.push(this.columnGroup.isPadding() ? "ag-header-group-cell-no-group" : "ag-header-group-cell-with-group");
33243 classes.forEach(function (c) { return _this.comp.addOrRemoveCssClass(c, true); });
33244 };
33245 HeaderGroupCellCtrl.prototype.setupMovingCss = function () {
33246 var _this = this;
33247 var providedColumnGroup = this.columnGroup.getProvidedColumnGroup();
33248 var leafColumns = providedColumnGroup.getLeafColumns();
33249 // this function adds or removes the moving css, based on if the col is moving.
33250 // this is what makes the header go dark when it is been moved (gives impression to
33251 // user that the column was picked up).
33252 var listener = function () { return _this.comp.addOrRemoveCssClass('ag-header-cell-moving', _this.columnGroup.isMoving()); };
33253 leafColumns.forEach(function (col) {
33254 _this.addManagedListener(col, Column.EVENT_MOVING_CHANGED, listener);
33255 });
33256 listener();
33257 };
33258 HeaderGroupCellCtrl.prototype.onFocusIn = function (e) {
33259 if (!this.eGui.contains(e.relatedTarget)) {
33260 var rowIndex = this.getRowIndex();
33261 this.beans.focusService.setFocusedHeader(rowIndex, this.columnGroup);
33262 }
33263 };
33264 HeaderGroupCellCtrl.prototype.handleKeyDown = function (e) {
33265 var eDocument = this.gridOptionsWrapper.getDocument();
33266 var activeEl = eDocument.activeElement;
33267 var wrapperHasFocus = activeEl === this.eGui;
33268 if (!this.expandable || !wrapperHasFocus) {
33269 return;
33270 }
33271 if (e.key === KeyCode.ENTER) {
33272 var column = this.columnGroup;
33273 var newExpandedValue = !column.isExpanded();
33274 this.columnModel.setColumnGroupOpened(column.getProvidedColumnGroup(), newExpandedValue, "uiColumnExpanded");
33275 }
33276 };
33277 // unlike columns, this will only get called once, as we don't react on props on column groups
33278 // (we will always destroy and recreate this comp if something changes)
33279 HeaderGroupCellCtrl.prototype.setDragSource = function (eHeaderGroup) {
33280 var _this = this;
33281 if (this.isSuppressMoving()) {
33282 return;
33283 }
33284 var allLeafColumns = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
33285 var dragSource = {
33286 type: exports.DragSourceType.HeaderCell,
33287 eElement: eHeaderGroup,
33288 defaultIconName: DragAndDropService.ICON_HIDE,
33289 dragItemName: this.displayName,
33290 // we add in the original group leaf columns, so we move both visible and non-visible items
33291 getDragItem: this.getDragItemForGroup.bind(this),
33292 onDragStarted: function () { return allLeafColumns.forEach(function (col) { return col.setMoving(true, "uiColumnDragged"); }); },
33293 onDragStopped: function () { return allLeafColumns.forEach(function (col) { return col.setMoving(false, "uiColumnDragged"); }); }
33294 };
33295 this.dragAndDropService.addDragSource(dragSource, true);
33296 this.addDestroyFunc(function () { return _this.dragAndDropService.removeDragSource(dragSource); });
33297 };
33298 // when moving the columns, we want to move all the columns (contained within the DragItem) in this group in one go,
33299 // and in the order they are currently in the screen.
33300 HeaderGroupCellCtrl.prototype.getDragItemForGroup = function () {
33301 var allColumnsOriginalOrder = this.columnGroup.getProvidedColumnGroup().getLeafColumns();
33302 // capture visible state, used when re-entering grid to dictate which columns should be visible
33303 var visibleState = {};
33304 allColumnsOriginalOrder.forEach(function (column) { return visibleState[column.getId()] = column.isVisible(); });
33305 var allColumnsCurrentOrder = [];
33306 this.columnModel.getAllDisplayedColumns().forEach(function (column) {
33307 if (allColumnsOriginalOrder.indexOf(column) >= 0) {
33308 allColumnsCurrentOrder.push(column);
33309 removeFromArray(allColumnsOriginalOrder, column);
33310 }
33311 });
33312 // we are left with non-visible columns, stick these in at the end
33313 allColumnsOriginalOrder.forEach(function (column) { return allColumnsCurrentOrder.push(column); });
33314 // create and return dragItem
33315 return {
33316 columns: allColumnsCurrentOrder,
33317 visibleState: visibleState
33318 };
33319 };
33320 HeaderGroupCellCtrl.prototype.isSuppressMoving = function () {
33321 // if any child is fixed, then don't allow moving
33322 var childSuppressesMoving = false;
33323 this.columnGroup.getLeafColumns().forEach(function (column) {
33324 if (column.getColDef().suppressMovable || column.getColDef().lockPosition) {
33325 childSuppressesMoving = true;
33326 }
33327 });
33328 var result = childSuppressesMoving || this.gridOptionsWrapper.isSuppressMovableColumns();
33329 return result;
33330 };
33331 __decorate$1h([
33332 Autowired('beans')
33333 ], HeaderGroupCellCtrl.prototype, "beans", void 0);
33334 __decorate$1h([
33335 Autowired('columnModel')
33336 ], HeaderGroupCellCtrl.prototype, "columnModel", void 0);
33337 __decorate$1h([
33338 Autowired('dragAndDropService')
33339 ], HeaderGroupCellCtrl.prototype, "dragAndDropService", void 0);
33340 __decorate$1h([
33341 Autowired('userComponentFactory')
33342 ], HeaderGroupCellCtrl.prototype, "userComponentFactory", void 0);
33343 __decorate$1h([
33344 Autowired('gridApi')
33345 ], HeaderGroupCellCtrl.prototype, "gridApi", void 0);
33346 __decorate$1h([
33347 Autowired('columnApi')
33348 ], HeaderGroupCellCtrl.prototype, "columnApi", void 0);
33349 return HeaderGroupCellCtrl;
33350}(AbstractHeaderCellCtrl));
33351
33352/**
33353 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
33354 * @version v27.3.0
33355 * @link https://www.ag-grid.com/
33356 * @license MIT
33357 */
33358var __extends$1v = (undefined && undefined.__extends) || (function () {
33359 var extendStatics = function (d, b) {
33360 extendStatics = Object.setPrototypeOf ||
33361 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
33362 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
33363 return extendStatics(d, b);
33364 };
33365 return function (d, b) {
33366 extendStatics(d, b);
33367 function __() { this.constructor = d; }
33368 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33369 };
33370})();
33371var __decorate$1i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
33372 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
33373 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33374 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;
33375 return c > 3 && r && Object.defineProperty(target, key, r), r;
33376};
33377var instanceIdSequence$4 = 0;
33378var HeaderRowCtrl = /** @class */ (function (_super) {
33379 __extends$1v(HeaderRowCtrl, _super);
33380 function HeaderRowCtrl(rowIndex, pinned, type) {
33381 var _this = _super.call(this) || this;
33382 _this.instanceId = instanceIdSequence$4++;
33383 _this.headerCellCtrls = {};
33384 _this.rowIndex = rowIndex;
33385 _this.pinned = pinned;
33386 _this.type = type;
33387 return _this;
33388 }
33389 HeaderRowCtrl.prototype.getInstanceId = function () {
33390 return this.instanceId;
33391 };
33392 HeaderRowCtrl.prototype.setComp = function (comp) {
33393 this.comp = comp;
33394 this.onRowHeightChanged();
33395 this.onVirtualColumnsChanged();
33396 this.setWidth();
33397 this.addEventListeners();
33398 if (isBrowserSafari()) {
33399 // fix for a Safari rendering bug that caused the header to flicker above chart panels
33400 // as you move the mouse over the header
33401 this.comp.setTransform('translateZ(0)');
33402 }
33403 comp.setAriaRowIndex(this.rowIndex + 1);
33404 };
33405 HeaderRowCtrl.prototype.addEventListeners = function () {
33406 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_RESIZED, this.onColumnResized.bind(this));
33407 // when print layout changes, it changes what columns are in what section
33408 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, this.onDisplayedColumnsChanged.bind(this));
33409 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
33410 this.addManagedListener(this.eventService, Events.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this));
33411 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_HEADER_HEIGHT, this.onRowHeightChanged.bind(this));
33412 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT, this.onRowHeightChanged.bind(this));
33413 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT, this.onRowHeightChanged.bind(this));
33414 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT, this.onRowHeightChanged.bind(this));
33415 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT, this.onRowHeightChanged.bind(this));
33416 };
33417 HeaderRowCtrl.prototype.getHeaderCellCtrl = function (column) {
33418 return values(this.headerCellCtrls).find(function (cellCtrl) { return cellCtrl.getColumnGroupChild() === column; });
33419 };
33420 HeaderRowCtrl.prototype.onDisplayedColumnsChanged = function () {
33421 this.onVirtualColumnsChanged();
33422 this.setWidth();
33423 };
33424 HeaderRowCtrl.prototype.getType = function () {
33425 return this.type;
33426 };
33427 HeaderRowCtrl.prototype.onColumnResized = function () {
33428 this.setWidth();
33429 };
33430 HeaderRowCtrl.prototype.setWidth = function () {
33431 var width = this.getWidthForRow();
33432 this.comp.setWidth(width + "px");
33433 };
33434 HeaderRowCtrl.prototype.getWidthForRow = function () {
33435 var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
33436 if (printLayout) {
33437 var pinned = this.pinned != null;
33438 if (pinned) {
33439 return 0;
33440 }
33441 return this.columnModel.getContainerWidth(Constants.PINNED_RIGHT)
33442 + this.columnModel.getContainerWidth(Constants.PINNED_LEFT)
33443 + this.columnModel.getContainerWidth(null);
33444 }
33445 // if not printing, just return the width as normal
33446 return this.columnModel.getContainerWidth(this.pinned);
33447 };
33448 HeaderRowCtrl.prototype.onRowHeightChanged = function () {
33449 var headerRowCount = this.columnModel.getHeaderRowCount();
33450 var sizes = [];
33451 var numberOfFloating = 0;
33452 var groupHeight;
33453 var headerHeight;
33454 if (this.columnModel.hasFloatingFilters()) {
33455 headerRowCount++;
33456 numberOfFloating = 1;
33457 }
33458 if (this.columnModel.isPivotMode()) {
33459 groupHeight = this.gridOptionsWrapper.getPivotGroupHeaderHeight();
33460 headerHeight = this.gridOptionsWrapper.getPivotHeaderHeight();
33461 }
33462 else {
33463 groupHeight = this.gridOptionsWrapper.getGroupHeaderHeight();
33464 headerHeight = this.gridOptionsWrapper.getHeaderHeight();
33465 }
33466 var numberOfNonGroups = 1 + numberOfFloating;
33467 var numberOfGroups = headerRowCount - numberOfNonGroups;
33468 for (var i = 0; i < numberOfGroups; i++) {
33469 sizes.push(groupHeight);
33470 }
33471 sizes.push(headerHeight);
33472 for (var i = 0; i < numberOfFloating; i++) {
33473 sizes.push(this.gridOptionsWrapper.getFloatingFiltersHeight());
33474 }
33475 var rowHeight = 0;
33476 for (var i = 0; i < this.rowIndex; i++) {
33477 rowHeight += sizes[i];
33478 }
33479 this.comp.setTop(rowHeight + 'px');
33480 this.comp.setHeight(sizes[this.rowIndex] + 'px');
33481 };
33482 HeaderRowCtrl.prototype.getPinned = function () {
33483 return this.pinned;
33484 };
33485 HeaderRowCtrl.prototype.getRowIndex = function () {
33486 return this.rowIndex;
33487 };
33488 HeaderRowCtrl.prototype.onVirtualColumnsChanged = function () {
33489 var _this = this;
33490 var oldCtrls = this.headerCellCtrls;
33491 this.headerCellCtrls = {};
33492 var columns = this.getColumnsInViewport();
33493 columns.forEach(function (child) {
33494 // skip groups that have no displayed children. this can happen when the group is broken,
33495 // and this section happens to have nothing to display for the open / closed state.
33496 // (a broken group is one that is split, ie columns in the group have a non-group column
33497 // in between them)
33498 if (child.isEmptyGroup()) {
33499 return;
33500 }
33501 var idOfChild = child.getUniqueId();
33502 // if we already have this cell rendered, do nothing
33503 var headerCtrl = oldCtrls[idOfChild];
33504 delete oldCtrls[idOfChild];
33505 // it's possible there is a new Column with the same ID, but it's for a different Column.
33506 // this is common with pivoting, where the pivot cols change, but the id's are still pivot_0,
33507 // pivot_1 etc. so if new col but same ID, need to remove the old col here first as we are
33508 // about to replace it in the this.headerComps map.
33509 var forOldColumn = headerCtrl && headerCtrl.getColumnGroupChild() != child;
33510 if (forOldColumn) {
33511 _this.destroyBean(headerCtrl);
33512 headerCtrl = undefined;
33513 }
33514 if (headerCtrl == null) {
33515 switch (_this.type) {
33516 case exports.HeaderRowType.FLOATING_FILTER:
33517 headerCtrl = _this.createBean(new HeaderFilterCellCtrl(child, _this));
33518 break;
33519 case exports.HeaderRowType.COLUMN_GROUP:
33520 headerCtrl = _this.createBean(new HeaderGroupCellCtrl(child, _this));
33521 break;
33522 default:
33523 headerCtrl = _this.createBean(new HeaderCellCtrl(child, _this));
33524 break;
33525 }
33526 }
33527 _this.headerCellCtrls[idOfChild] = headerCtrl;
33528 });
33529 // we want to keep columns that are focused, otherwise keyboard navigation breaks
33530 var isFocusedAndDisplayed = function (ctrl) {
33531 var isFocused = _this.focusService.isHeaderWrapperFocused(ctrl);
33532 if (!isFocused) {
33533 return false;
33534 }
33535 var isDisplayed = _this.columnModel.isDisplayed(ctrl.getColumnGroupChild());
33536 return isDisplayed;
33537 };
33538 iterateObject(oldCtrls, function (id, oldCtrl) {
33539 var keepCtrl = isFocusedAndDisplayed(oldCtrl);
33540 if (keepCtrl) {
33541 _this.headerCellCtrls[id] = oldCtrl;
33542 }
33543 else {
33544 _this.destroyBean(oldCtrl);
33545 }
33546 });
33547 var ctrlsToDisplay = getAllValuesInObject(this.headerCellCtrls);
33548 this.comp.setHeaderCtrls(ctrlsToDisplay);
33549 };
33550 HeaderRowCtrl.prototype.destroyCtrls = function () {
33551 var _this = this;
33552 iterateObject(this.headerCellCtrls, function (key, ctrl) {
33553 _this.destroyBean(ctrl);
33554 });
33555 this.headerCellCtrls = {};
33556 };
33557 HeaderRowCtrl.prototype.getColumnsInViewport = function () {
33558 var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
33559 return printLayout ? this.getColumnsInViewportPrintLayout() : this.getColumnsInViewportNormalLayout();
33560 };
33561 HeaderRowCtrl.prototype.getColumnsInViewportPrintLayout = function () {
33562 var _this = this;
33563 // for print layout, we add all columns into the center
33564 if (this.pinned != null) {
33565 return [];
33566 }
33567 var viewportColumns = [];
33568 var actualDepth = this.getActualDepth();
33569 [Constants.PINNED_LEFT, null, Constants.PINNED_RIGHT].forEach(function (pinned) {
33570 var items = _this.columnModel.getVirtualHeaderGroupRow(pinned, actualDepth);
33571 viewportColumns = viewportColumns.concat(items);
33572 });
33573 return viewportColumns;
33574 };
33575 HeaderRowCtrl.prototype.getActualDepth = function () {
33576 return this.type == exports.HeaderRowType.FLOATING_FILTER ? this.rowIndex - 1 : this.rowIndex;
33577 };
33578 HeaderRowCtrl.prototype.getColumnsInViewportNormalLayout = function () {
33579 // when in normal layout, we add the columns for that container only
33580 return this.columnModel.getVirtualHeaderGroupRow(this.pinned, this.getActualDepth());
33581 };
33582 HeaderRowCtrl.prototype.focusHeader = function (column, event) {
33583 var allCtrls = getAllValuesInObject(this.headerCellCtrls);
33584 var ctrl = allCtrls.find(function (ctrl) { return ctrl.getColumnGroupChild() == column; });
33585 if (!ctrl) {
33586 return false;
33587 }
33588 ctrl.focus(event);
33589 return true;
33590 };
33591 __decorate$1i([
33592 Autowired('columnModel')
33593 ], HeaderRowCtrl.prototype, "columnModel", void 0);
33594 __decorate$1i([
33595 Autowired('focusService')
33596 ], HeaderRowCtrl.prototype, "focusService", void 0);
33597 __decorate$1i([
33598 PreDestroy
33599 ], HeaderRowCtrl.prototype, "destroyCtrls", null);
33600 return HeaderRowCtrl;
33601}(BeanStub));
33602
33603/**
33604 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
33605 * @version v27.3.0
33606 * @link https://www.ag-grid.com/
33607 * @license MIT
33608 */
33609var __extends$1w = (undefined && undefined.__extends) || (function () {
33610 var extendStatics = function (d, b) {
33611 extendStatics = Object.setPrototypeOf ||
33612 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
33613 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
33614 return extendStatics(d, b);
33615 };
33616 return function (d, b) {
33617 extendStatics(d, b);
33618 function __() { this.constructor = d; }
33619 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33620 };
33621})();
33622var __decorate$1j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
33623 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
33624 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33625 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;
33626 return c > 3 && r && Object.defineProperty(target, key, r), r;
33627};
33628var __read$c = (undefined && undefined.__read) || function (o, n) {
33629 var m = typeof Symbol === "function" && o[Symbol.iterator];
33630 if (!m) return o;
33631 var i = m.call(o), r, ar = [], e;
33632 try {
33633 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
33634 }
33635 catch (error) { e = { error: error }; }
33636 finally {
33637 try {
33638 if (r && !r.done && (m = i["return"])) m.call(i);
33639 }
33640 finally { if (e) throw e.error; }
33641 }
33642 return ar;
33643};
33644var __spread$9 = (undefined && undefined.__spread) || function () {
33645 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$c(arguments[i]));
33646 return ar;
33647};
33648var HeaderRowContainerCtrl = /** @class */ (function (_super) {
33649 __extends$1w(HeaderRowContainerCtrl, _super);
33650 function HeaderRowContainerCtrl(pinned) {
33651 var _this = _super.call(this) || this;
33652 _this.groupsRowCtrls = [];
33653 _this.pinned = pinned;
33654 return _this;
33655 }
33656 HeaderRowContainerCtrl.prototype.setComp = function (comp, eGui) {
33657 this.comp = comp;
33658 this.setupCenterWidth();
33659 this.setupPinnedWidth();
33660 this.setupDragAndDrop(eGui);
33661 this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this));
33662 this.ctrlsService.registerHeaderContainer(this, this.pinned);
33663 if (this.columnModel.isReady()) {
33664 this.refresh();
33665 }
33666 };
33667 HeaderRowContainerCtrl.prototype.setupDragAndDrop = function (dropContainer) {
33668 var bodyDropTarget = new BodyDropTarget(this.pinned, dropContainer);
33669 this.createManagedBean(bodyDropTarget);
33670 };
33671 HeaderRowContainerCtrl.prototype.refresh = function (keepColumns) {
33672 var _this = this;
33673 if (keepColumns === void 0) { keepColumns = false; }
33674 var sequence = new NumberSequence();
33675 var focusedHeaderPosition = this.focusService.getFocusHeaderToUseAfterRefresh();
33676 var refreshColumnGroups = function () {
33677 var groupRowCount = _this.columnModel.getHeaderRowCount() - 1;
33678 _this.groupsRowCtrls = _this.destroyBeans(_this.groupsRowCtrls);
33679 for (var i = 0; i < groupRowCount; i++) {
33680 var ctrl = _this.createBean(new HeaderRowCtrl(sequence.next(), _this.pinned, exports.HeaderRowType.COLUMN_GROUP));
33681 _this.groupsRowCtrls.push(ctrl);
33682 }
33683 };
33684 var refreshColumns = function () {
33685 var rowIndex = sequence.next();
33686 var needNewInstance = _this.columnsRowCtrl == null || !keepColumns || _this.columnsRowCtrl.getRowIndex() !== rowIndex;
33687 if (needNewInstance) {
33688 _this.destroyBean(_this.columnsRowCtrl);
33689 _this.columnsRowCtrl = _this.createBean(new HeaderRowCtrl(rowIndex, _this.pinned, exports.HeaderRowType.COLUMN));
33690 }
33691 };
33692 var refreshFilters = function () {
33693 var includeFloatingFilter = _this.columnModel.hasFloatingFilters();
33694 var destroyPreviousComp = function () {
33695 _this.filtersRowCtrl = _this.destroyBean(_this.filtersRowCtrl);
33696 };
33697 if (!includeFloatingFilter) {
33698 destroyPreviousComp();
33699 return;
33700 }
33701 var rowIndex = sequence.next();
33702 if (_this.filtersRowCtrl) {
33703 var rowIndexMismatch = _this.filtersRowCtrl.getRowIndex() !== rowIndex;
33704 if (!keepColumns || rowIndexMismatch) {
33705 destroyPreviousComp();
33706 }
33707 }
33708 if (!_this.filtersRowCtrl) {
33709 _this.filtersRowCtrl = _this.createBean(new HeaderRowCtrl(rowIndex, _this.pinned, exports.HeaderRowType.FLOATING_FILTER));
33710 }
33711 };
33712 refreshColumnGroups();
33713 refreshColumns();
33714 refreshFilters();
33715 var allCtrls = this.getAllCtrls();
33716 this.comp.setCtrls(allCtrls);
33717 this.restoreFocusOnHeader(focusedHeaderPosition);
33718 };
33719 HeaderRowContainerCtrl.prototype.restoreFocusOnHeader = function (position) {
33720 if (position == null || position.column.getPinned() != this.pinned) {
33721 return;
33722 }
33723 this.focusService.focusHeaderPosition({ headerPosition: position });
33724 };
33725 HeaderRowContainerCtrl.prototype.getAllCtrls = function () {
33726 var res = __spread$9(this.groupsRowCtrls, [this.columnsRowCtrl]);
33727 if (this.filtersRowCtrl) {
33728 res.push(this.filtersRowCtrl);
33729 }
33730 return res;
33731 };
33732 // grid cols have changed - this also means the number of rows in the header can have
33733 // changed. so we remove all the old rows and insert new ones for a complete refresh
33734 HeaderRowContainerCtrl.prototype.onGridColumnsChanged = function () {
33735 this.refresh(true);
33736 };
33737 HeaderRowContainerCtrl.prototype.setupCenterWidth = function () {
33738 var _this = this;
33739 if (this.pinned != null) {
33740 return;
33741 }
33742 this.createManagedBean(new CenterWidthFeature(function (width) { return _this.comp.setCenterWidth(width + "px"); }));
33743 };
33744 HeaderRowContainerCtrl.prototype.setHorizontalScroll = function (offset) {
33745 this.comp.setContainerTransform("translateX(" + offset + "px)");
33746 };
33747 HeaderRowContainerCtrl.prototype.setupPinnedWidth = function () {
33748 var _this = this;
33749 if (this.pinned == null) {
33750 return;
33751 }
33752 var pinningLeft = this.pinned === Constants.PINNED_LEFT;
33753 var pinningRight = this.pinned === Constants.PINNED_RIGHT;
33754 var listener = function () {
33755 var width = pinningLeft ? _this.pinnedWidthService.getPinnedLeftWidth() : _this.pinnedWidthService.getPinnedRightWidth();
33756 if (width == null) {
33757 return;
33758 } // can happen at initialisation, width not yet set
33759 var hidden = width == 0;
33760 var isRtl = _this.gridOptionsWrapper.isEnableRtl();
33761 var scrollbarWidth = _this.gridOptionsWrapper.getScrollbarWidth();
33762 // if there is a scroll showing (and taking up space, so Windows, and not iOS)
33763 // in the body, then we add extra space to keep header aligned with the body,
33764 // as body width fits the cols and the scrollbar
33765 var addPaddingForScrollbar = _this.scrollVisibleService.isVerticalScrollShowing() && ((isRtl && pinningLeft) || (!isRtl && pinningRight));
33766 var widthWithPadding = addPaddingForScrollbar ? width + scrollbarWidth : width;
33767 _this.comp.setPinnedContainerWidth(widthWithPadding + 'px');
33768 _this.comp.addOrRemoveCssClass('ag-hidden', hidden);
33769 };
33770 this.addManagedListener(this.eventService, Events.EVENT_LEFT_PINNED_WIDTH_CHANGED, listener);
33771 this.addManagedListener(this.eventService, Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED, listener);
33772 this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, listener);
33773 this.addManagedListener(this.eventService, Events.EVENT_SCROLLBAR_WIDTH_CHANGED, listener);
33774 };
33775 HeaderRowContainerCtrl.prototype.getHeaderCtrlForColumn = function (column) {
33776 if (column instanceof Column) {
33777 if (!this.columnsRowCtrl) {
33778 return;
33779 }
33780 return this.columnsRowCtrl.getHeaderCellCtrl(column);
33781 }
33782 if (this.groupsRowCtrls.length === 0) {
33783 return;
33784 }
33785 for (var i = 0; i < this.groupsRowCtrls.length; i++) {
33786 var ctrl = this.groupsRowCtrls[i].getHeaderCellCtrl(column);
33787 if (ctrl) {
33788 return ctrl;
33789 }
33790 }
33791 };
33792 HeaderRowContainerCtrl.prototype.getHtmlElementForColumnHeader = function (column) {
33793 /* tslint:enable */
33794 var cellCtrl = this.getHeaderCtrlForColumn(column);
33795 if (!cellCtrl) {
33796 return null;
33797 }
33798 return cellCtrl.getGui();
33799 };
33800 HeaderRowContainerCtrl.prototype.getRowType = function (rowIndex) {
33801 var allCtrls = this.getAllCtrls();
33802 var ctrl = allCtrls[rowIndex];
33803 return ctrl ? ctrl.getType() : undefined;
33804 };
33805 HeaderRowContainerCtrl.prototype.focusHeader = function (rowIndex, column, event) {
33806 var allCtrls = this.getAllCtrls();
33807 var ctrl = allCtrls[rowIndex];
33808 if (!ctrl) {
33809 return false;
33810 }
33811 return ctrl.focusHeader(column, event);
33812 };
33813 HeaderRowContainerCtrl.prototype.getRowCount = function () {
33814 return this.getAllCtrls().length;
33815 };
33816 __decorate$1j([
33817 Autowired('ctrlsService')
33818 ], HeaderRowContainerCtrl.prototype, "ctrlsService", void 0);
33819 __decorate$1j([
33820 Autowired('scrollVisibleService')
33821 ], HeaderRowContainerCtrl.prototype, "scrollVisibleService", void 0);
33822 __decorate$1j([
33823 Autowired('pinnedWidthService')
33824 ], HeaderRowContainerCtrl.prototype, "pinnedWidthService", void 0);
33825 __decorate$1j([
33826 Autowired('columnModel')
33827 ], HeaderRowContainerCtrl.prototype, "columnModel", void 0);
33828 __decorate$1j([
33829 Autowired('focusService')
33830 ], HeaderRowContainerCtrl.prototype, "focusService", void 0);
33831 return HeaderRowContainerCtrl;
33832}(BeanStub));
33833
33834/**
33835 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
33836 * @version v27.3.0
33837 * @link https://www.ag-grid.com/
33838 * @license MIT
33839 */
33840var __extends$1x = (undefined && undefined.__extends) || (function () {
33841 var extendStatics = function (d, b) {
33842 extendStatics = Object.setPrototypeOf ||
33843 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
33844 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
33845 return extendStatics(d, b);
33846 };
33847 return function (d, b) {
33848 extendStatics(d, b);
33849 function __() { this.constructor = d; }
33850 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33851 };
33852})();
33853var __decorate$1k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
33854 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
33855 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33856 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;
33857 return c > 3 && r && Object.defineProperty(target, key, r), r;
33858};
33859var HeaderRowContainerComp = /** @class */ (function (_super) {
33860 __extends$1x(HeaderRowContainerComp, _super);
33861 function HeaderRowContainerComp(pinned) {
33862 var _this = _super.call(this) || this;
33863 _this.headerRowComps = {};
33864 _this.rowCompsList = [];
33865 _this.pinned = pinned;
33866 return _this;
33867 }
33868 HeaderRowContainerComp.prototype.init = function () {
33869 var _this = this;
33870 this.selectAndSetTemplate();
33871 var compProxy = {
33872 addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
33873 setCtrls: function (ctrls) { return _this.setCtrls(ctrls); },
33874 // only gets called for center section
33875 setCenterWidth: function (width) { return _this.eCenterContainer.style.width = width; },
33876 setContainerTransform: function (transform) { return _this.eCenterContainer.style.transform = transform; },
33877 // only gets called for pinned sections
33878 setPinnedContainerWidth: function (width) {
33879 var eGui = _this.getGui();
33880 eGui.style.width = width;
33881 eGui.style.maxWidth = width;
33882 eGui.style.minWidth = width;
33883 }
33884 };
33885 var ctrl = this.createManagedBean(new HeaderRowContainerCtrl(this.pinned));
33886 ctrl.setComp(compProxy, this.getGui());
33887 };
33888 HeaderRowContainerComp.prototype.selectAndSetTemplate = function () {
33889 var pinnedLeft = this.pinned == Constants.PINNED_LEFT;
33890 var pinnedRight = this.pinned == Constants.PINNED_RIGHT;
33891 var template = pinnedLeft ? HeaderRowContainerComp.PINNED_LEFT_TEMPLATE :
33892 pinnedRight ? HeaderRowContainerComp.PINNED_RIGHT_TEMPLATE : HeaderRowContainerComp.CENTER_TEMPLATE;
33893 this.setTemplate(template);
33894 // for left and right, we add rows directly to the root element,
33895 // but for center container we add elements to the child container.
33896 this.eRowContainer = this.eCenterContainer ? this.eCenterContainer : this.getGui();
33897 };
33898 HeaderRowContainerComp.prototype.destroyRowComps = function () {
33899 this.setCtrls([]);
33900 };
33901 HeaderRowContainerComp.prototype.destroyRowComp = function (rowComp) {
33902 this.destroyBean(rowComp);
33903 this.eRowContainer.removeChild(rowComp.getGui());
33904 };
33905 HeaderRowContainerComp.prototype.setCtrls = function (ctrls) {
33906 var _this = this;
33907 var oldRowComps = this.headerRowComps;
33908 this.headerRowComps = {};
33909 this.rowCompsList = [];
33910 var prevGui;
33911 var appendEnsuringDomOrder = function (rowComp) {
33912 var eGui = rowComp.getGui();
33913 var notAlreadyIn = eGui.parentElement != _this.eRowContainer;
33914 if (notAlreadyIn) {
33915 _this.eRowContainer.appendChild(eGui);
33916 }
33917 if (prevGui) {
33918 ensureDomOrder(_this.eRowContainer, eGui, prevGui);
33919 }
33920 prevGui = eGui;
33921 };
33922 ctrls.forEach(function (ctrl) {
33923 var ctrlId = ctrl.getInstanceId();
33924 var existingComp = oldRowComps[ctrlId];
33925 delete oldRowComps[ctrlId];
33926 var rowComp = existingComp ? existingComp : _this.createBean(new HeaderRowComp(ctrl));
33927 _this.headerRowComps[ctrlId] = rowComp;
33928 _this.rowCompsList.push(rowComp);
33929 appendEnsuringDomOrder(rowComp);
33930 });
33931 getAllValuesInObject(oldRowComps).forEach(function (c) { return _this.destroyRowComp(c); });
33932 };
33933 HeaderRowContainerComp.PINNED_LEFT_TEMPLATE = "<div class=\"ag-pinned-left-header\" role=\"presentation\"/>";
33934 HeaderRowContainerComp.PINNED_RIGHT_TEMPLATE = "<div class=\"ag-pinned-right-header\" role=\"presentation\"/>";
33935 HeaderRowContainerComp.CENTER_TEMPLATE = "<div class=\"ag-header-viewport\" role=\"presentation\">\n <div class=\"ag-header-container\" ref=\"eCenterContainer\" role=\"rowgroup\"></div>\n </div>";
33936 __decorate$1k([
33937 RefSelector('eCenterContainer')
33938 ], HeaderRowContainerComp.prototype, "eCenterContainer", void 0);
33939 __decorate$1k([
33940 PostConstruct
33941 ], HeaderRowContainerComp.prototype, "init", null);
33942 __decorate$1k([
33943 PreDestroy
33944 ], HeaderRowContainerComp.prototype, "destroyRowComps", null);
33945 return HeaderRowContainerComp;
33946}(Component));
33947
33948/**
33949 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
33950 * @version v27.3.0
33951 * @link https://www.ag-grid.com/
33952 * @license MIT
33953 */
33954var __extends$1y = (undefined && undefined.__extends) || (function () {
33955 var extendStatics = function (d, b) {
33956 extendStatics = Object.setPrototypeOf ||
33957 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
33958 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
33959 return extendStatics(d, b);
33960 };
33961 return function (d, b) {
33962 extendStatics(d, b);
33963 function __() { this.constructor = d; }
33964 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33965 };
33966})();
33967var __decorate$1l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
33968 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
33969 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33970 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;
33971 return c > 3 && r && Object.defineProperty(target, key, r), r;
33972};
33973(function (HeaderNavigationDirection) {
33974 HeaderNavigationDirection[HeaderNavigationDirection["UP"] = 0] = "UP";
33975 HeaderNavigationDirection[HeaderNavigationDirection["DOWN"] = 1] = "DOWN";
33976 HeaderNavigationDirection[HeaderNavigationDirection["LEFT"] = 2] = "LEFT";
33977 HeaderNavigationDirection[HeaderNavigationDirection["RIGHT"] = 3] = "RIGHT";
33978})(exports.HeaderNavigationDirection || (exports.HeaderNavigationDirection = {}));
33979var HeaderNavigationService = /** @class */ (function (_super) {
33980 __extends$1y(HeaderNavigationService, _super);
33981 function HeaderNavigationService() {
33982 return _super !== null && _super.apply(this, arguments) || this;
33983 }
33984 HeaderNavigationService.prototype.postConstruct = function () {
33985 var _this = this;
33986 this.ctrlsService.whenReady(function (p) {
33987 _this.gridBodyCon = p.gridBodyCtrl;
33988 });
33989 };
33990 HeaderNavigationService.prototype.getHeaderRowCount = function () {
33991 var centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();
33992 return centerHeaderContainer ? centerHeaderContainer.getRowCount() : 0;
33993 };
33994 HeaderNavigationService.prototype.getHeaderRowType = function (rowIndex) {
33995 var centerHeaderContainer = this.ctrlsService.getHeaderRowContainerCtrl();
33996 if (centerHeaderContainer) {
33997 return centerHeaderContainer.getRowType(rowIndex);
33998 }
33999 };
34000 /*
34001 * This method navigates grid header vertically
34002 * @return {boolean} true to preventDefault on the event that caused this navigation.
34003 */
34004 HeaderNavigationService.prototype.navigateVertically = function (direction, fromHeader, event) {
34005 if (!fromHeader) {
34006 fromHeader = this.focusService.getFocusedHeader();
34007 }
34008 if (!fromHeader) {
34009 return false;
34010 }
34011 var headerRowIndex = fromHeader.headerRowIndex, column = fromHeader.column;
34012 var rowLen = this.getHeaderRowCount();
34013 var isUp = direction === exports.HeaderNavigationDirection.UP;
34014 var nextRow = isUp ? headerRowIndex - 1 : headerRowIndex + 1;
34015 var nextFocusColumn = null;
34016 var skipColumn = false;
34017 if (nextRow < 0) {
34018 nextRow = 0;
34019 nextFocusColumn = column;
34020 skipColumn = true;
34021 }
34022 if (nextRow >= rowLen) {
34023 nextRow = -1; // -1 indicates the focus should move to grid rows.
34024 }
34025 var currentRowType = this.getHeaderRowType(headerRowIndex);
34026 if (!skipColumn) {
34027 if (currentRowType === exports.HeaderRowType.COLUMN_GROUP) {
34028 var currentColumn = column;
34029 nextFocusColumn = isUp ? column.getParent() : currentColumn.getDisplayedChildren()[0];
34030 }
34031 else if (currentRowType === exports.HeaderRowType.FLOATING_FILTER) {
34032 nextFocusColumn = column;
34033 }
34034 else {
34035 var currentColumn = column;
34036 nextFocusColumn = isUp ? currentColumn.getParent() : currentColumn;
34037 }
34038 if (!nextFocusColumn) {
34039 return false;
34040 }
34041 }
34042 return this.focusService.focusHeaderPosition({
34043 headerPosition: { headerRowIndex: nextRow, column: nextFocusColumn },
34044 allowUserOverride: true,
34045 event: event
34046 });
34047 };
34048 /*
34049 * This method navigates grid header horizontally
34050 * @return {boolean} true to preventDefault on the event that caused this navigation.
34051 */
34052 HeaderNavigationService.prototype.navigateHorizontally = function (direction, fromTab, event) {
34053 if (fromTab === void 0) { fromTab = false; }
34054 var focusedHeader = this.focusService.getFocusedHeader();
34055 var isLeft = direction === exports.HeaderNavigationDirection.LEFT;
34056 var isRtl = this.gridOptionsWrapper.isEnableRtl();
34057 var nextHeader;
34058 var normalisedDirection;
34059 // either navigating to the left or isRtl (cannot be both)
34060 if (isLeft !== isRtl) {
34061 normalisedDirection = 'Before';
34062 nextHeader = this.headerPositionUtils.findHeader(focusedHeader, normalisedDirection);
34063 }
34064 else {
34065 normalisedDirection = 'After';
34066 nextHeader = this.headerPositionUtils.findHeader(focusedHeader, normalisedDirection);
34067 }
34068 if (nextHeader) {
34069 return this.focusService.focusHeaderPosition({
34070 headerPosition: nextHeader,
34071 direction: normalisedDirection,
34072 fromTab: fromTab,
34073 allowUserOverride: true,
34074 event: event
34075 });
34076 }
34077 if (!fromTab) {
34078 return true;
34079 }
34080 return this.focusNextHeaderRow(focusedHeader, normalisedDirection, event);
34081 };
34082 HeaderNavigationService.prototype.focusNextHeaderRow = function (focusedHeader, direction, event) {
34083 var currentIndex = focusedHeader.headerRowIndex;
34084 var nextPosition = null;
34085 var nextRowIndex;
34086 if (direction === 'Before') {
34087 if (currentIndex > 0) {
34088 nextRowIndex = currentIndex - 1;
34089 nextPosition = this.headerPositionUtils.findColAtEdgeForHeaderRow(nextRowIndex, 'end');
34090 }
34091 }
34092 else {
34093 nextRowIndex = currentIndex + 1;
34094 nextPosition = this.headerPositionUtils.findColAtEdgeForHeaderRow(nextRowIndex, 'start');
34095 }
34096 return this.focusService.focusHeaderPosition({
34097 headerPosition: nextPosition,
34098 direction: direction,
34099 fromTab: true,
34100 allowUserOverride: true,
34101 event: event
34102 });
34103 };
34104 HeaderNavigationService.prototype.scrollToColumn = function (column, direction) {
34105 if (direction === void 0) { direction = 'After'; }
34106 if (column.getPinned()) {
34107 return;
34108 }
34109 var columnToScrollTo;
34110 if (column instanceof ColumnGroup) {
34111 var columns = column.getDisplayedLeafColumns();
34112 columnToScrollTo = direction === 'Before' ? last(columns) : columns[0];
34113 }
34114 else {
34115 columnToScrollTo = column;
34116 }
34117 this.gridBodyCon.getScrollFeature().ensureColumnVisible(columnToScrollTo);
34118 // need to nudge the scrolls for the floating items. otherwise when we set focus on a non-visible
34119 // floating cell, the scrolls get out of sync
34120 this.gridBodyCon.getScrollFeature().horizontallyScrollHeaderCenterAndFloatingCenter();
34121 // need to flush frames, to make sure the correct cells are rendered
34122 this.animationFrameService.flushAllFrames();
34123 };
34124 __decorate$1l([
34125 Autowired('focusService')
34126 ], HeaderNavigationService.prototype, "focusService", void 0);
34127 __decorate$1l([
34128 Autowired('headerPositionUtils')
34129 ], HeaderNavigationService.prototype, "headerPositionUtils", void 0);
34130 __decorate$1l([
34131 Autowired('animationFrameService')
34132 ], HeaderNavigationService.prototype, "animationFrameService", void 0);
34133 __decorate$1l([
34134 Autowired('ctrlsService')
34135 ], HeaderNavigationService.prototype, "ctrlsService", void 0);
34136 __decorate$1l([
34137 PostConstruct
34138 ], HeaderNavigationService.prototype, "postConstruct", null);
34139 HeaderNavigationService = __decorate$1l([
34140 Bean('headerNavigationService')
34141 ], HeaderNavigationService);
34142 return HeaderNavigationService;
34143}(BeanStub));
34144
34145/**
34146 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
34147 * @version v27.3.0
34148 * @link https://www.ag-grid.com/
34149 * @license MIT
34150 */
34151var __extends$1z = (undefined && undefined.__extends) || (function () {
34152 var extendStatics = function (d, b) {
34153 extendStatics = Object.setPrototypeOf ||
34154 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
34155 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
34156 return extendStatics(d, b);
34157 };
34158 return function (d, b) {
34159 extendStatics(d, b);
34160 function __() { this.constructor = d; }
34161 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34162 };
34163})();
34164var __decorate$1m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
34165 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34166 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34167 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;
34168 return c > 3 && r && Object.defineProperty(target, key, r), r;
34169};
34170var GridHeaderCtrl = /** @class */ (function (_super) {
34171 __extends$1z(GridHeaderCtrl, _super);
34172 function GridHeaderCtrl() {
34173 return _super !== null && _super.apply(this, arguments) || this;
34174 }
34175 GridHeaderCtrl.prototype.setComp = function (comp, eGui, eFocusableElement) {
34176 this.comp = comp;
34177 this.eGui = eGui;
34178 this.createManagedBean(new ManagedFocusFeature(eFocusableElement, {
34179 onTabKeyDown: this.onTabKeyDown.bind(this),
34180 handleKeyDown: this.handleKeyDown.bind(this),
34181 onFocusOut: this.onFocusOut.bind(this)
34182 }));
34183 // for setting ag-pivot-on / ag-pivot-off CSS classes
34184 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.onPivotModeChanged.bind(this));
34185 this.onPivotModeChanged();
34186 this.setupHeaderHeight();
34187 this.ctrlsService.registerGridHeaderCtrl(this);
34188 };
34189 GridHeaderCtrl.prototype.setupHeaderHeight = function () {
34190 var listener = this.setHeaderHeight.bind(this);
34191 listener();
34192 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_HEADER_HEIGHT, listener);
34193 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_PIVOT_HEADER_HEIGHT, listener);
34194 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_GROUP_HEADER_HEIGHT, listener);
34195 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_PIVOT_GROUP_HEADER_HEIGHT, listener);
34196 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_FLOATING_FILTERS_HEIGHT, listener);
34197 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);
34198 };
34199 GridHeaderCtrl.prototype.setHeaderHeight = function () {
34200 var _a = this, columnModel = _a.columnModel, gridOptionsWrapper = _a.gridOptionsWrapper;
34201 var numberOfFloating = 0;
34202 var headerRowCount = columnModel.getHeaderRowCount();
34203 var totalHeaderHeight;
34204 var groupHeight;
34205 var headerHeight;
34206 var hasFloatingFilters = columnModel.hasFloatingFilters();
34207 if (hasFloatingFilters) {
34208 headerRowCount++;
34209 numberOfFloating = 1;
34210 }
34211 if (columnModel.isPivotMode()) {
34212 groupHeight = gridOptionsWrapper.getPivotGroupHeaderHeight();
34213 headerHeight = gridOptionsWrapper.getPivotHeaderHeight();
34214 }
34215 else {
34216 groupHeight = gridOptionsWrapper.getGroupHeaderHeight();
34217 headerHeight = gridOptionsWrapper.getHeaderHeight();
34218 }
34219 var numberOfNonGroups = 1 + numberOfFloating;
34220 var numberOfGroups = headerRowCount - numberOfNonGroups;
34221 totalHeaderHeight = numberOfFloating * gridOptionsWrapper.getFloatingFiltersHeight();
34222 totalHeaderHeight += numberOfGroups * groupHeight;
34223 totalHeaderHeight += headerHeight;
34224 // one extra pixel is needed here to account for the
34225 // height of the border
34226 var px = totalHeaderHeight + 1 + "px";
34227 this.comp.setHeightAndMinHeight(px);
34228 };
34229 GridHeaderCtrl.prototype.onPivotModeChanged = function () {
34230 var pivotMode = this.columnModel.isPivotMode();
34231 this.comp.addOrRemoveCssClass('ag-pivot-on', pivotMode);
34232 this.comp.addOrRemoveCssClass('ag-pivot-off', !pivotMode);
34233 };
34234 GridHeaderCtrl.prototype.onTabKeyDown = function (e) {
34235 var isRtl = this.gridOptionsWrapper.isEnableRtl();
34236 var direction = e.shiftKey !== isRtl
34237 ? exports.HeaderNavigationDirection.LEFT
34238 : exports.HeaderNavigationDirection.RIGHT;
34239 if (this.headerNavigationService.navigateHorizontally(direction, true, e) ||
34240 this.focusService.focusNextGridCoreContainer(e.shiftKey)) {
34241 e.preventDefault();
34242 }
34243 };
34244 GridHeaderCtrl.prototype.handleKeyDown = function (e) {
34245 var direction = null;
34246 switch (e.key) {
34247 case KeyCode.LEFT:
34248 direction = exports.HeaderNavigationDirection.LEFT;
34249 case KeyCode.RIGHT:
34250 if (!exists(direction)) {
34251 direction = exports.HeaderNavigationDirection.RIGHT;
34252 }
34253 this.headerNavigationService.navigateHorizontally(direction, false, e);
34254 break;
34255 case KeyCode.UP:
34256 direction = exports.HeaderNavigationDirection.UP;
34257 case KeyCode.DOWN:
34258 if (!exists(direction)) {
34259 direction = exports.HeaderNavigationDirection.DOWN;
34260 }
34261 if (this.headerNavigationService.navigateVertically(direction, null, e)) {
34262 e.preventDefault();
34263 }
34264 break;
34265 default:
34266 return;
34267 }
34268 };
34269 GridHeaderCtrl.prototype.onFocusOut = function (e) {
34270 var eDocument = this.gridOptionsWrapper.getDocument();
34271 var relatedTarget = e.relatedTarget;
34272 if (!relatedTarget && this.eGui.contains(eDocument.activeElement)) {
34273 return;
34274 }
34275 if (!this.eGui.contains(relatedTarget)) {
34276 this.focusService.clearFocusedHeader();
34277 }
34278 };
34279 __decorate$1m([
34280 Autowired('headerNavigationService')
34281 ], GridHeaderCtrl.prototype, "headerNavigationService", void 0);
34282 __decorate$1m([
34283 Autowired('focusService')
34284 ], GridHeaderCtrl.prototype, "focusService", void 0);
34285 __decorate$1m([
34286 Autowired('columnModel')
34287 ], GridHeaderCtrl.prototype, "columnModel", void 0);
34288 __decorate$1m([
34289 Autowired('ctrlsService')
34290 ], GridHeaderCtrl.prototype, "ctrlsService", void 0);
34291 return GridHeaderCtrl;
34292}(BeanStub));
34293
34294/**
34295 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
34296 * @version v27.3.0
34297 * @link https://www.ag-grid.com/
34298 * @license MIT
34299 */
34300var __extends$1A = (undefined && undefined.__extends) || (function () {
34301 var extendStatics = function (d, b) {
34302 extendStatics = Object.setPrototypeOf ||
34303 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
34304 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
34305 return extendStatics(d, b);
34306 };
34307 return function (d, b) {
34308 extendStatics(d, b);
34309 function __() { this.constructor = d; }
34310 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34311 };
34312})();
34313var __decorate$1n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
34314 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34315 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34316 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;
34317 return c > 3 && r && Object.defineProperty(target, key, r), r;
34318};
34319var GridHeaderComp = /** @class */ (function (_super) {
34320 __extends$1A(GridHeaderComp, _super);
34321 function GridHeaderComp() {
34322 return _super.call(this, GridHeaderComp.TEMPLATE) || this;
34323 }
34324 GridHeaderComp.prototype.postConstruct = function () {
34325 var _this = this;
34326 var compProxy = {
34327 addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
34328 setHeightAndMinHeight: function (height) {
34329 _this.getGui().style.height = height;
34330 _this.getGui().style.minHeight = height;
34331 }
34332 };
34333 var ctrl = this.createManagedBean(new GridHeaderCtrl());
34334 ctrl.setComp(compProxy, this.getGui(), this.getFocusableElement());
34335 var addContainer = function (container) {
34336 _this.createManagedBean(container);
34337 _this.appendChild(container);
34338 };
34339 addContainer(new HeaderRowContainerComp(Constants.PINNED_LEFT));
34340 addContainer(new HeaderRowContainerComp(null));
34341 addContainer(new HeaderRowContainerComp(Constants.PINNED_RIGHT));
34342 };
34343 GridHeaderComp.TEMPLATE = "<div class=\"ag-header\" role=\"presentation\"/>";
34344 __decorate$1n([
34345 PostConstruct
34346 ], GridHeaderComp.prototype, "postConstruct", null);
34347 return GridHeaderComp;
34348}(Component));
34349
34350/**
34351 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
34352 * @version v27.3.0
34353 * @link https://www.ag-grid.com/
34354 * @license MIT
34355 */
34356var __extends$1B = (undefined && undefined.__extends) || (function () {
34357 var extendStatics = function (d, b) {
34358 extendStatics = Object.setPrototypeOf ||
34359 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
34360 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
34361 return extendStatics(d, b);
34362 };
34363 return function (d, b) {
34364 extendStatics(d, b);
34365 function __() { this.constructor = d; }
34366 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34367 };
34368})();
34369var __decorate$1o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
34370 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34371 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34372 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;
34373 return c > 3 && r && Object.defineProperty(target, key, r), r;
34374};
34375var HorizontalResizeService = /** @class */ (function (_super) {
34376 __extends$1B(HorizontalResizeService, _super);
34377 function HorizontalResizeService() {
34378 return _super !== null && _super.apply(this, arguments) || this;
34379 }
34380 HorizontalResizeService.prototype.addResizeBar = function (params) {
34381 var _this = this;
34382 var dragSource = {
34383 dragStartPixels: params.dragStartPixels || 0,
34384 eElement: params.eResizeBar,
34385 onDragStart: this.onDragStart.bind(this, params),
34386 onDragStop: this.onDragStop.bind(this, params),
34387 onDragging: this.onDragging.bind(this, params)
34388 };
34389 this.dragService.addDragSource(dragSource, true);
34390 // we pass remove func back to the caller, so call can tell us when they
34391 // are finished, and then we remove the listener from the drag source
34392 var finishedWithResizeFunc = function () { return _this.dragService.removeDragSource(dragSource); };
34393 return finishedWithResizeFunc;
34394 };
34395 HorizontalResizeService.prototype.onDragStart = function (params, mouseEvent) {
34396 this.dragStartX = mouseEvent.clientX;
34397 this.setResizeIcons();
34398 var shiftKey = mouseEvent instanceof MouseEvent && mouseEvent.shiftKey === true;
34399 params.onResizeStart(shiftKey);
34400 };
34401 HorizontalResizeService.prototype.setResizeIcons = function () {
34402 var ctrl = this.ctrlsService.getGridCtrl();
34403 // change the body cursor, so when drag moves out of the drag bar, the cursor is still 'resize' (or 'move'
34404 ctrl.setResizeCursor(true);
34405 // we don't want text selection outside the grid (otherwise it looks weird as text highlights when we move)
34406 ctrl.disableUserSelect(true);
34407 };
34408 HorizontalResizeService.prototype.onDragStop = function (params, mouseEvent) {
34409 params.onResizeEnd(this.resizeAmount);
34410 this.resetIcons();
34411 };
34412 HorizontalResizeService.prototype.resetIcons = function () {
34413 var ctrl = this.ctrlsService.getGridCtrl();
34414 ctrl.setResizeCursor(false);
34415 ctrl.disableUserSelect(false);
34416 };
34417 HorizontalResizeService.prototype.onDragging = function (params, mouseEvent) {
34418 this.resizeAmount = mouseEvent.clientX - this.dragStartX;
34419 params.onResizing(this.resizeAmount);
34420 };
34421 __decorate$1o([
34422 Autowired('dragService')
34423 ], HorizontalResizeService.prototype, "dragService", void 0);
34424 __decorate$1o([
34425 Autowired('ctrlsService')
34426 ], HorizontalResizeService.prototype, "ctrlsService", void 0);
34427 HorizontalResizeService = __decorate$1o([
34428 Bean('horizontalResizeService')
34429 ], HorizontalResizeService);
34430 return HorizontalResizeService;
34431}(BeanStub));
34432
34433/**
34434 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
34435 * @version v27.3.0
34436 * @link https://www.ag-grid.com/
34437 * @license MIT
34438 */
34439var __extends$1C = (undefined && undefined.__extends) || (function () {
34440 var extendStatics = function (d, b) {
34441 extendStatics = Object.setPrototypeOf ||
34442 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
34443 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
34444 return extendStatics(d, b);
34445 };
34446 return function (d, b) {
34447 extendStatics(d, b);
34448 function __() { this.constructor = d; }
34449 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34450 };
34451})();
34452var __decorate$1p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
34453 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34454 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34455 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;
34456 return c > 3 && r && Object.defineProperty(target, key, r), r;
34457};
34458var StandardMenuFactory = /** @class */ (function (_super) {
34459 __extends$1C(StandardMenuFactory, _super);
34460 function StandardMenuFactory() {
34461 return _super !== null && _super.apply(this, arguments) || this;
34462 }
34463 StandardMenuFactory.prototype.hideActiveMenu = function () {
34464 if (this.hidePopup) {
34465 this.hidePopup();
34466 }
34467 };
34468 StandardMenuFactory.prototype.showMenuAfterMouseEvent = function (column, mouseEvent) {
34469 var _this = this;
34470 this.showPopup(column, function (eMenu) {
34471 _this.popupService.positionPopupUnderMouseEvent({
34472 column: column,
34473 type: 'columnMenu',
34474 mouseEvent: mouseEvent,
34475 ePopup: eMenu
34476 });
34477 }, mouseEvent.target);
34478 };
34479 StandardMenuFactory.prototype.showMenuAfterButtonClick = function (column, eventSource, containerType) {
34480 var _this = this;
34481 this.showPopup(column, function (eMenu) {
34482 _this.popupService.positionPopupUnderComponent({
34483 type: containerType,
34484 eventSource: eventSource,
34485 ePopup: eMenu,
34486 keepWithinBounds: true,
34487 column: column
34488 });
34489 }, eventSource);
34490 };
34491 StandardMenuFactory.prototype.showPopup = function (column, positionCallback, eventSource) {
34492 var _this = this;
34493 var filterWrapper = this.filterManager.getOrCreateFilterWrapper(column, 'COLUMN_MENU');
34494 if (!filterWrapper) {
34495 throw new Error('AG Grid - unable to show popup filter, filter instantiation failed');
34496 }
34497 var eMenu = document.createElement('div');
34498 setAriaRole(eMenu, 'presentation');
34499 eMenu.classList.add('ag-menu');
34500 this.tabListener = this.addManagedListener(eMenu, 'keydown', function (e) { return _this.trapFocusWithin(e, eMenu); });
34501 filterWrapper.guiPromise.then(function (gui) { return eMenu.appendChild(gui); });
34502 var hidePopup;
34503 var anchorToElement = eventSource || this.ctrlsService.getGridBodyCtrl().getGui();
34504 var closedCallback = function (e) {
34505 column.setMenuVisible(false, 'contextMenu');
34506 var isKeyboardEvent = e instanceof KeyboardEvent;
34507 if (_this.tabListener) {
34508 _this.tabListener = _this.tabListener();
34509 }
34510 if (isKeyboardEvent && eventSource && isVisible(eventSource)) {
34511 var focusableEl = _this.focusService.findTabbableParent(eventSource);
34512 if (focusableEl) {
34513 focusableEl.focus();
34514 }
34515 }
34516 };
34517 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
34518 var addPopupRes = this.popupService.addPopup({
34519 modal: true,
34520 eChild: eMenu,
34521 closeOnEsc: true,
34522 closedCallback: closedCallback,
34523 positionCallback: function () { return positionCallback(eMenu); },
34524 anchorToElement: anchorToElement,
34525 ariaLabel: translate('ariaLabelColumnMenu', 'Column Menu')
34526 });
34527 if (addPopupRes) {
34528 this.hidePopup = hidePopup = addPopupRes.hideFunc;
34529 }
34530 filterWrapper.filterPromise.then(function (filter) {
34531 // need to make sure the filter is present before positioning, as only
34532 // after filter it is visible can we find out what the width of it is
34533 positionCallback(eMenu);
34534 if (filter.afterGuiAttached) {
34535 filter.afterGuiAttached({ container: 'columnMenu', hidePopup: hidePopup });
34536 }
34537 });
34538 column.setMenuVisible(true, 'contextMenu');
34539 };
34540 StandardMenuFactory.prototype.trapFocusWithin = function (e, menu) {
34541 if (e.key !== KeyCode.TAB ||
34542 e.defaultPrevented ||
34543 this.focusService.findNextFocusableElement(menu, false, e.shiftKey)) {
34544 return;
34545 }
34546 e.preventDefault();
34547 this.focusService.focusInto(menu, e.shiftKey);
34548 };
34549 StandardMenuFactory.prototype.isMenuEnabled = function (column) {
34550 // for standard, we show menu if filter is enabled, and the menu is not suppressed
34551 return column.isFilterAllowed();
34552 };
34553 __decorate$1p([
34554 Autowired('filterManager')
34555 ], StandardMenuFactory.prototype, "filterManager", void 0);
34556 __decorate$1p([
34557 Autowired('popupService')
34558 ], StandardMenuFactory.prototype, "popupService", void 0);
34559 __decorate$1p([
34560 Autowired('focusService')
34561 ], StandardMenuFactory.prototype, "focusService", void 0);
34562 __decorate$1p([
34563 Autowired('ctrlsService')
34564 ], StandardMenuFactory.prototype, "ctrlsService", void 0);
34565 StandardMenuFactory = __decorate$1p([
34566 Bean('menuFactory')
34567 ], StandardMenuFactory);
34568 return StandardMenuFactory;
34569}(BeanStub));
34570
34571/**
34572 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
34573 * @version v27.3.0
34574 * @link https://www.ag-grid.com/
34575 * @license MIT
34576 */
34577var __extends$1D = (undefined && undefined.__extends) || (function () {
34578 var extendStatics = function (d, b) {
34579 extendStatics = Object.setPrototypeOf ||
34580 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
34581 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
34582 return extendStatics(d, b);
34583 };
34584 return function (d, b) {
34585 extendStatics(d, b);
34586 function __() { this.constructor = d; }
34587 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34588 };
34589})();
34590var __decorate$1q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
34591 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34592 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34593 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;
34594 return c > 3 && r && Object.defineProperty(target, key, r), r;
34595};
34596var TabbedLayout = /** @class */ (function (_super) {
34597 __extends$1D(TabbedLayout, _super);
34598 function TabbedLayout(params) {
34599 var _this = _super.call(this, TabbedLayout.getTemplate(params.cssClass)) || this;
34600 _this.items = [];
34601 _this.tabbedItemScrollMap = new Map();
34602 _this.params = params;
34603 if (params.items) {
34604 params.items.forEach(function (item) { return _this.addItem(item); });
34605 }
34606 return _this;
34607 }
34608 TabbedLayout.prototype.postConstruct = function () {
34609 this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {
34610 onTabKeyDown: this.onTabKeyDown.bind(this),
34611 handleKeyDown: this.handleKeyDown.bind(this)
34612 }));
34613 };
34614 TabbedLayout.getTemplate = function (cssClass) {
34615 return /* html */ "<div class=\"ag-tabs " + cssClass + "\">\n <div ref=\"eHeader\" role=\"tablist\" class=\"ag-tabs-header " + (cssClass ? cssClass + "-header" : '') + "\"></div>\n <div ref=\"eBody\" role=\"presentation\" class=\"ag-tabs-body " + (cssClass ? cssClass + "-body" : '') + "\"></div>\n </div>";
34616 };
34617 TabbedLayout.prototype.handleKeyDown = function (e) {
34618 var eDocument = this.gridOptionsWrapper.getDocument();
34619 switch (e.key) {
34620 case KeyCode.RIGHT:
34621 case KeyCode.LEFT:
34622 if (!this.eHeader.contains(eDocument.activeElement)) {
34623 return;
34624 }
34625 var currentPosition = this.items.indexOf(this.activeItem);
34626 var nextPosition = e.key === KeyCode.RIGHT ? Math.min(currentPosition + 1, this.items.length - 1) : Math.max(currentPosition - 1, 0);
34627 if (currentPosition === nextPosition) {
34628 return;
34629 }
34630 e.preventDefault();
34631 var nextItem = this.items[nextPosition];
34632 this.showItemWrapper(nextItem);
34633 nextItem.eHeaderButton.focus();
34634 break;
34635 case KeyCode.UP:
34636 case KeyCode.DOWN:
34637 e.stopPropagation();
34638 break;
34639 }
34640 };
34641 TabbedLayout.prototype.onTabKeyDown = function (e) {
34642 if (e.defaultPrevented) {
34643 return;
34644 }
34645 var _a = this, focusService = _a.focusService, eHeader = _a.eHeader, eBody = _a.eBody, activeItem = _a.activeItem;
34646 var eDocument = this.gridOptionsWrapper.getDocument();
34647 var activeElement = eDocument.activeElement;
34648 e.preventDefault();
34649 if (eHeader.contains(activeElement)) {
34650 // focus is in header, move into body of popup
34651 focusService.focusInto(eBody, e.shiftKey);
34652 }
34653 else {
34654 // focus is in body, establish if it should return to header
34655 if (focusService.isFocusUnderManagedComponent(eBody)) {
34656 // focus was in a managed focus component and has now left, so we can return to the header
34657 activeItem.eHeaderButton.focus();
34658 }
34659 else {
34660 var nextEl = focusService.findNextFocusableElement(eBody, false, e.shiftKey);
34661 if (nextEl) {
34662 // if another element exists in the body that can be focussed, go to that
34663 nextEl.focus();
34664 }
34665 else {
34666 // otherwise return to the header
34667 activeItem.eHeaderButton.focus();
34668 }
34669 }
34670 }
34671 };
34672 TabbedLayout.prototype.setAfterAttachedParams = function (params) {
34673 this.afterAttachedParams = params;
34674 };
34675 TabbedLayout.prototype.showFirstItem = function () {
34676 if (this.items.length > 0) {
34677 this.showItemWrapper(this.items[0]);
34678 }
34679 };
34680 TabbedLayout.prototype.addItem = function (item) {
34681 var eHeaderButton = document.createElement('span');
34682 setAriaRole(eHeaderButton, 'tab');
34683 eHeaderButton.setAttribute('tabIndex', '-1');
34684 eHeaderButton.appendChild(item.title);
34685 eHeaderButton.classList.add('ag-tab');
34686 this.eHeader.appendChild(eHeaderButton);
34687 setAriaLabel(eHeaderButton, item.titleLabel);
34688 var wrapper = {
34689 tabbedItem: item,
34690 eHeaderButton: eHeaderButton
34691 };
34692 this.items.push(wrapper);
34693 eHeaderButton.addEventListener('click', this.showItemWrapper.bind(this, wrapper));
34694 };
34695 TabbedLayout.prototype.showItem = function (tabbedItem) {
34696 var itemWrapper = this.items.find(function (wrapper) { return wrapper.tabbedItem === tabbedItem; });
34697 if (itemWrapper) {
34698 this.showItemWrapper(itemWrapper);
34699 }
34700 };
34701 TabbedLayout.prototype.showItemWrapper = function (wrapper) {
34702 var _this = this;
34703 var tabbedItem = wrapper.tabbedItem, eHeaderButton = wrapper.eHeaderButton;
34704 if (this.params.onItemClicked) {
34705 this.params.onItemClicked({ item: tabbedItem });
34706 }
34707 if (this.activeItem === wrapper) {
34708 callIfPresent(this.params.onActiveItemClicked);
34709 return;
34710 }
34711 if (this.lastScrollListener) {
34712 this.lastScrollListener = this.lastScrollListener();
34713 }
34714 clearElement(this.eBody);
34715 tabbedItem.bodyPromise.then(function (body) {
34716 _this.eBody.appendChild(body);
34717 var onlyUnmanaged = !_this.focusService.isKeyboardMode();
34718 _this.focusService.focusInto(_this.eBody, false, onlyUnmanaged);
34719 if (tabbedItem.afterAttachedCallback) {
34720 tabbedItem.afterAttachedCallback(_this.afterAttachedParams);
34721 }
34722 if (_this.params.keepScrollPosition) {
34723 var scrollableContainer_1 = (tabbedItem.getScrollableContainer && tabbedItem.getScrollableContainer()) || body;
34724 _this.lastScrollListener = _this.addManagedListener(scrollableContainer_1, 'scroll', function () {
34725 _this.tabbedItemScrollMap.set(tabbedItem.name, scrollableContainer_1.scrollTop);
34726 });
34727 var scrollPosition_1 = _this.tabbedItemScrollMap.get(tabbedItem.name);
34728 if (scrollPosition_1 !== undefined) {
34729 // Safari needs a small timeout or it will fire a scroll event to position 0
34730 setTimeout(function () {
34731 scrollableContainer_1.scrollTop = scrollPosition_1;
34732 }, 0);
34733 }
34734 }
34735 });
34736 if (this.activeItem) {
34737 this.activeItem.eHeaderButton.classList.remove('ag-tab-selected');
34738 }
34739 eHeaderButton.classList.add('ag-tab-selected');
34740 this.activeItem = wrapper;
34741 };
34742 __decorate$1q([
34743 Autowired('focusService')
34744 ], TabbedLayout.prototype, "focusService", void 0);
34745 __decorate$1q([
34746 RefSelector('eHeader')
34747 ], TabbedLayout.prototype, "eHeader", void 0);
34748 __decorate$1q([
34749 RefSelector('eBody')
34750 ], TabbedLayout.prototype, "eBody", void 0);
34751 __decorate$1q([
34752 PostConstruct
34753 ], TabbedLayout.prototype, "postConstruct", null);
34754 return TabbedLayout;
34755}(Component));
34756
34757/**
34758 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
34759 * @version v27.3.0
34760 * @link https://www.ag-grid.com/
34761 * @license MIT
34762 */
34763/**
34764 * @deprecated
34765 */
34766function simpleHttpRequest(params) {
34767 return new AgPromise(function (resolve) {
34768 var httpRequest = new XMLHttpRequest();
34769 httpRequest.open('GET', params.url);
34770 httpRequest.send();
34771 httpRequest.onreadystatechange = function () {
34772 if (httpRequest.readyState === 4 && httpRequest.status === 200) {
34773 resolve(JSON.parse(httpRequest.responseText));
34774 }
34775 };
34776 });
34777}
34778
34779/**
34780 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
34781 * @version v27.3.0
34782 * @link https://www.ag-grid.com/
34783 * @license MIT
34784 */
34785var __extends$1E = (undefined && undefined.__extends) || (function () {
34786 var extendStatics = function (d, b) {
34787 extendStatics = Object.setPrototypeOf ||
34788 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
34789 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
34790 return extendStatics(d, b);
34791 };
34792 return function (d, b) {
34793 extendStatics(d, b);
34794 function __() { this.constructor = d; }
34795 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34796 };
34797})();
34798var __decorate$1r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
34799 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34800 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34801 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;
34802 return c > 3 && r && Object.defineProperty(target, key, r), r;
34803};
34804var DEBOUNCE_DELAY = 50;
34805var ResizeObserverService = /** @class */ (function (_super) {
34806 __extends$1E(ResizeObserverService, _super);
34807 function ResizeObserverService() {
34808 var _this = _super !== null && _super.apply(this, arguments) || this;
34809 _this.polyfillFunctions = [];
34810 return _this;
34811 }
34812 ResizeObserverService.prototype.observeResize = function (element, callback) {
34813 var _this = this;
34814 var eDocument = this.gridOptionsWrapper.getDocument();
34815 var win = (eDocument.defaultView || window);
34816 // this gets fired too often and might cause some relayout issues
34817 // so we add a debounce to the callback here to avoid the flashing effect.
34818 var debouncedCallback = debounce(callback, DEBOUNCE_DELAY);
34819 var useBrowserResizeObserver = function () {
34820 var resizeObserver = new win.ResizeObserver(debouncedCallback);
34821 resizeObserver.observe(element);
34822 return function () { return resizeObserver.disconnect(); };
34823 };
34824 var usePolyfill = function () {
34825 // initialise to the current width and height, so first call will have no changes
34826 var widthLastTime = offsetWidth(element);
34827 var heightLastTime = offsetHeight(element);
34828 // when finished, this gets turned to false.
34829 var running = true;
34830 var periodicallyCheckWidthAndHeight = function () {
34831 if (running) {
34832 var newWidth = offsetWidth(element);
34833 var newHeight = offsetHeight(element);
34834 var changed = newWidth !== widthLastTime || newHeight !== heightLastTime;
34835 if (changed) {
34836 widthLastTime = newWidth;
34837 heightLastTime = newHeight;
34838 callback();
34839 }
34840 _this.doNextPolyfillTurn(periodicallyCheckWidthAndHeight);
34841 }
34842 };
34843 periodicallyCheckWidthAndHeight();
34844 // the callback function we return sets running to false
34845 return function () { return running = false; };
34846 };
34847 var suppressResize = this.gridOptionsWrapper.isSuppressBrowserResizeObserver();
34848 var resizeObserverExists = !!win.ResizeObserver;
34849 if (resizeObserverExists && !suppressResize) {
34850 return useBrowserResizeObserver();
34851 }
34852 return usePolyfill();
34853 };
34854 ResizeObserverService.prototype.doNextPolyfillTurn = function (func) {
34855 this.polyfillFunctions.push(func);
34856 this.schedulePolyfill();
34857 };
34858 ResizeObserverService.prototype.schedulePolyfill = function () {
34859 var _this = this;
34860 if (this.polyfillScheduled) {
34861 return;
34862 }
34863 var executeAllFuncs = function () {
34864 var funcs = _this.polyfillFunctions;
34865 // make sure set scheduled to false and clear clear array
34866 // before executing the funcs, as the funcs could add more funcs
34867 _this.polyfillScheduled = false;
34868 _this.polyfillFunctions = [];
34869 funcs.forEach(function (f) { return f(); });
34870 };
34871 this.polyfillScheduled = true;
34872 this.getFrameworkOverrides().setTimeout(executeAllFuncs, DEBOUNCE_DELAY);
34873 };
34874 ResizeObserverService = __decorate$1r([
34875 Bean('resizeObserverService')
34876 ], ResizeObserverService);
34877 return ResizeObserverService;
34878}(BeanStub));
34879
34880/**
34881 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
34882 * @version v27.3.0
34883 * @link https://www.ag-grid.com/
34884 * @license MIT
34885 */
34886var __extends$1F = (undefined && undefined.__extends) || (function () {
34887 var extendStatics = function (d, b) {
34888 extendStatics = Object.setPrototypeOf ||
34889 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
34890 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
34891 return extendStatics(d, b);
34892 };
34893 return function (d, b) {
34894 extendStatics(d, b);
34895 function __() { this.constructor = d; }
34896 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34897 };
34898})();
34899var __decorate$1s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
34900 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34901 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34902 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;
34903 return c > 3 && r && Object.defineProperty(target, key, r), r;
34904};
34905var AnimationFrameService = /** @class */ (function (_super) {
34906 __extends$1F(AnimationFrameService, _super);
34907 function AnimationFrameService() {
34908 var _this = _super !== null && _super.apply(this, arguments) || this;
34909 // p1 and p2 are create tasks are to do with row and cell creation.
34910 // for them we want to execute according to row order, so we use
34911 // TaskItem so we know what index the item is for.
34912 _this.createTasksP1 = { list: [], sorted: false }; // eg drawing back-ground of rows
34913 _this.createTasksP2 = { list: [], sorted: false }; // eg cell renderers, adding hover functionality
34914 // destroy tasks are to do with row removal. they are done after row creation as the user will need to see new
34915 // rows first (as blank is scrolled into view), when we remove the old rows (no longer in view) is not as
34916 // important.
34917 _this.destroyTasks = [];
34918 _this.ticking = false;
34919 // we need to know direction of scroll, to build up rows in the direction of
34920 // the scroll. eg if user scrolls down, we extend the rows by building down.
34921 _this.scrollGoingDown = true;
34922 _this.lastScrollTop = 0;
34923 _this.taskCount = 0;
34924 _this.cancelledTasks = new Set();
34925 return _this;
34926 }
34927 AnimationFrameService.prototype.setScrollTop = function (scrollTop) {
34928 this.scrollGoingDown = scrollTop > this.lastScrollTop;
34929 this.lastScrollTop = scrollTop;
34930 };
34931 AnimationFrameService.prototype.init = function () {
34932 this.useAnimationFrame = !this.gridOptionsWrapper.isSuppressAnimationFrame();
34933 };
34934 AnimationFrameService.prototype.isOn = function () {
34935 return this.useAnimationFrame;
34936 };
34937 // this method is for our AG Grid sanity only - if animation frames are turned off,
34938 // then no place in the code should be looking to add any work to be done in animation
34939 // frames. this stops bugs - where some code is asking for a frame to be executed
34940 // when it should not.
34941 AnimationFrameService.prototype.verifyAnimationFrameOn = function (methodName) {
34942 if (this.useAnimationFrame === false) {
34943 console.warn("AG Grid: AnimationFrameService." + methodName + " called but animation frames are off");
34944 }
34945 };
34946 AnimationFrameService.prototype.createTask = function (task, index, list) {
34947 this.verifyAnimationFrameOn(list);
34948 var taskItem = { task: task, index: index, createOrder: ++this.taskCount };
34949 this.addTaskToList(this[list], taskItem);
34950 this.schedule();
34951 };
34952 AnimationFrameService.prototype.cancelTask = function (task) {
34953 this.cancelledTasks.add(task);
34954 };
34955 AnimationFrameService.prototype.addTaskToList = function (taskList, task) {
34956 taskList.list.push(task);
34957 taskList.sorted = false;
34958 };
34959 AnimationFrameService.prototype.sortTaskList = function (taskList) {
34960 if (taskList.sorted) {
34961 return;
34962 }
34963 var sortDirection = this.scrollGoingDown ? 1 : -1;
34964 // sort first by row index (taking into account scroll direction), then by
34965 // order of task creation (always ascending, so cells will render left-to-right)
34966 taskList.list.sort(function (a, b) { return a.index !== b.index ? sortDirection * (b.index - a.index) : b.createOrder - a.createOrder; });
34967 taskList.sorted = true;
34968 };
34969 AnimationFrameService.prototype.addDestroyTask = function (task) {
34970 this.verifyAnimationFrameOn('createTasksP3');
34971 this.destroyTasks.push(task);
34972 this.schedule();
34973 };
34974 AnimationFrameService.prototype.executeFrame = function (millis) {
34975 this.verifyAnimationFrameOn('executeFrame');
34976 var p1TaskList = this.createTasksP1;
34977 var p1Tasks = p1TaskList.list;
34978 var p2TaskList = this.createTasksP2;
34979 var p2Tasks = p2TaskList.list;
34980 var destroyTasks = this.destroyTasks;
34981 var frameStart = new Date().getTime();
34982 var duration = (new Date().getTime()) - frameStart;
34983 // 16ms is 60 fps
34984 var noMaxMillis = millis <= 0;
34985 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
34986 while (noMaxMillis || duration < millis) {
34987 var gridBodyDidSomething = gridBodyCon.getScrollFeature().executeAnimationFrameScroll();
34988 if (!gridBodyDidSomething) {
34989 var task = void 0;
34990 if (p1Tasks.length) {
34991 this.sortTaskList(p1TaskList);
34992 task = p1Tasks.pop().task;
34993 }
34994 else if (p2Tasks.length) {
34995 this.sortTaskList(p2TaskList);
34996 task = p2Tasks.pop().task;
34997 }
34998 else if (destroyTasks.length) {
34999 task = destroyTasks.pop();
35000 }
35001 else {
35002 this.cancelledTasks.clear();
35003 break;
35004 }
35005 if (!this.cancelledTasks.has(task)) {
35006 task();
35007 }
35008 }
35009 duration = (new Date().getTime()) - frameStart;
35010 }
35011 if (p1Tasks.length || p2Tasks.length || destroyTasks.length) {
35012 this.requestFrame();
35013 }
35014 else {
35015 this.stopTicking();
35016 }
35017 };
35018 AnimationFrameService.prototype.stopTicking = function () {
35019 this.ticking = false;
35020 };
35021 AnimationFrameService.prototype.flushAllFrames = function () {
35022 if (!this.useAnimationFrame) {
35023 return;
35024 }
35025 this.executeFrame(-1);
35026 };
35027 AnimationFrameService.prototype.schedule = function () {
35028 if (!this.useAnimationFrame) {
35029 return;
35030 }
35031 if (!this.ticking) {
35032 this.ticking = true;
35033 this.requestFrame();
35034 }
35035 };
35036 AnimationFrameService.prototype.requestFrame = function () {
35037 // check for the existence of requestAnimationFrame, and if
35038 // it's missing, then we polyfill it with setTimeout()
35039 var callback = this.executeFrame.bind(this, 60);
35040 var eDocument = this.gridOptionsWrapper.getDocument();
35041 var win = (eDocument.defaultView || window);
35042 if (win.requestAnimationFrame) {
35043 win.requestAnimationFrame(callback);
35044 }
35045 else if (win.webkitRequestAnimationFrame) {
35046 win.webkitRequestAnimationFrame(callback);
35047 }
35048 else {
35049 win.setTimeout(callback, 0);
35050 }
35051 };
35052 AnimationFrameService.prototype.isQueueEmpty = function () {
35053 return !this.ticking;
35054 };
35055 // a debounce utility used for parts of the app involved with rendering.
35056 // the advantage over normal debounce is the client can call flushAllFrames()
35057 // to make sure all rendering is complete. we don't wait any milliseconds,
35058 // as this is intended to batch calls in one VM turn.
35059 AnimationFrameService.prototype.debounce = function (func) {
35060 var _this = this;
35061 var pending = false;
35062 return function () {
35063 if (!_this.isOn()) {
35064 _this.getFrameworkOverrides().setTimeout(func, 0);
35065 return;
35066 }
35067 if (pending) {
35068 return;
35069 }
35070 pending = true;
35071 _this.addDestroyTask(function () {
35072 pending = false;
35073 func();
35074 });
35075 };
35076 };
35077 __decorate$1s([
35078 Autowired('ctrlsService')
35079 ], AnimationFrameService.prototype, "ctrlsService", void 0);
35080 __decorate$1s([
35081 PostConstruct
35082 ], AnimationFrameService.prototype, "init", null);
35083 AnimationFrameService = __decorate$1s([
35084 Bean('animationFrameService')
35085 ], AnimationFrameService);
35086 return AnimationFrameService;
35087}(BeanStub));
35088
35089/**
35090 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
35091 * @version v27.3.0
35092 * @link https://www.ag-grid.com/
35093 * @license MIT
35094 */
35095var __extends$1G = (undefined && undefined.__extends) || (function () {
35096 var extendStatics = function (d, b) {
35097 extendStatics = Object.setPrototypeOf ||
35098 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
35099 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
35100 return extendStatics(d, b);
35101 };
35102 return function (d, b) {
35103 extendStatics(d, b);
35104 function __() { this.constructor = d; }
35105 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35106 };
35107})();
35108var __decorate$1t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
35109 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35110 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35111 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;
35112 return c > 3 && r && Object.defineProperty(target, key, r), r;
35113};
35114var RESIZE_CONTAINER_STYLE = 'ag-resizer-wrapper';
35115var RESIZE_TEMPLATE = /* html */ "<div class=\"" + RESIZE_CONTAINER_STYLE + "\">\n <div ref=\"eTopLeftResizer\" class=\"ag-resizer ag-resizer-topLeft\"></div>\n <div ref=\"eTopResizer\" class=\"ag-resizer ag-resizer-top\"></div>\n <div ref=\"eTopRightResizer\" class=\"ag-resizer ag-resizer-topRight\"></div>\n <div ref=\"eRightResizer\" class=\"ag-resizer ag-resizer-right\"></div>\n <div ref=\"eBottomRightResizer\" class=\"ag-resizer ag-resizer-bottomRight\"></div>\n <div ref=\"eBottomResizer\" class=\"ag-resizer ag-resizer-bottom\"></div>\n <div ref=\"eBottomLeftResizer\" class=\"ag-resizer ag-resizer-bottomLeft\"></div>\n <div ref=\"eLeftResizer\" class=\"ag-resizer ag-resizer-left\"></div>\n </div>";
35116var PositionableFeature = /** @class */ (function (_super) {
35117 __extends$1G(PositionableFeature, _super);
35118 function PositionableFeature(element, config) {
35119 var _this = _super.call(this) || this;
35120 _this.element = element;
35121 _this.dragStartPosition = {
35122 x: 0,
35123 y: 0
35124 };
35125 _this.position = {
35126 x: 0,
35127 y: 0
35128 };
35129 _this.lastSize = {
35130 width: -1,
35131 height: -1
35132 };
35133 _this.positioned = false;
35134 _this.resizersAdded = false;
35135 _this.resizeListeners = [];
35136 _this.boundaryEl = null;
35137 _this.isResizing = false;
35138 _this.isMoving = false;
35139 _this.resizable = {};
35140 _this.movable = false;
35141 _this.currentResizer = null;
35142 _this.config = Object.assign({}, { popup: false }, config);
35143 return _this;
35144 }
35145 PositionableFeature.prototype.center = function () {
35146 var _a = this.offsetParent, clientHeight = _a.clientHeight, clientWidth = _a.clientWidth;
35147 var x = (clientWidth / 2) - (this.getWidth() / 2);
35148 var y = (clientHeight / 2) - (this.getHeight() / 2);
35149 this.offsetElement(x, y);
35150 };
35151 PositionableFeature.prototype.initialisePosition = function () {
35152 var _a = this.config, centered = _a.centered, forcePopupParentAsOffsetParent = _a.forcePopupParentAsOffsetParent, minWidth = _a.minWidth, width = _a.width, minHeight = _a.minHeight, height = _a.height, x = _a.x, y = _a.y;
35153 if (!this.offsetParent) {
35154 this.setOffsetParent();
35155 }
35156 var computedMinHeight = 0;
35157 var computedMinWidth = 0;
35158 // here we don't use the main offset parent but the element's offsetParent
35159 // in order to calculated the minWidth and minHeight correctly
35160 var isVisible = !!this.element.offsetParent;
35161 if (isVisible) {
35162 var boundaryEl = this.findBoundaryElement();
35163 var offsetParentComputedStyles = window.getComputedStyle(boundaryEl);
35164 if (offsetParentComputedStyles.minWidth != null) {
35165 var paddingWidth = boundaryEl.offsetWidth - this.element.offsetWidth;
35166 computedMinWidth = parseInt(offsetParentComputedStyles.minWidth, 10) - paddingWidth;
35167 }
35168 if (offsetParentComputedStyles.minHeight != null) {
35169 var paddingHeight = boundaryEl.offsetHeight - this.element.offsetHeight;
35170 computedMinHeight = parseInt(offsetParentComputedStyles.minHeight, 10) - paddingHeight;
35171 }
35172 }
35173 this.minHeight = minHeight || computedMinHeight;
35174 this.minWidth = minWidth || computedMinWidth;
35175 if (width) {
35176 this.setWidth(width);
35177 }
35178 if (height) {
35179 this.setHeight(height);
35180 }
35181 if (!width || !height) {
35182 this.refreshSize();
35183 }
35184 if (centered) {
35185 this.center();
35186 }
35187 else if (x || y) {
35188 this.offsetElement(x, y);
35189 }
35190 else if (isVisible && forcePopupParentAsOffsetParent && this.boundaryEl) {
35191 var top_1 = parseFloat(this.boundaryEl.style.top);
35192 var left = parseFloat(this.boundaryEl.style.left);
35193 this.offsetElement(isNaN(left) ? 0 : left, isNaN(top_1) ? 0 : top_1);
35194 }
35195 this.positioned = !!this.offsetParent;
35196 };
35197 PositionableFeature.prototype.isPositioned = function () {
35198 return this.positioned;
35199 };
35200 PositionableFeature.prototype.getPosition = function () {
35201 return this.position;
35202 };
35203 PositionableFeature.prototype.setMovable = function (movable, moveElement) {
35204 if (!this.config.popup || movable === this.movable) {
35205 return;
35206 }
35207 this.movable = movable;
35208 var params = this.moveElementDragListener || {
35209 eElement: moveElement,
35210 onDragStart: this.onMoveStart.bind(this),
35211 onDragging: this.onMove.bind(this),
35212 onDragStop: this.onMoveEnd.bind(this)
35213 };
35214 if (movable) {
35215 this.dragService.addDragSource(params);
35216 this.moveElementDragListener = params;
35217 }
35218 else {
35219 this.dragService.removeDragSource(params);
35220 this.moveElementDragListener = undefined;
35221 }
35222 };
35223 PositionableFeature.prototype.setResizable = function (resizable) {
35224 var _this = this;
35225 this.clearResizeListeners();
35226 if (resizable) {
35227 this.addResizers();
35228 }
35229 else {
35230 this.removeResizers();
35231 }
35232 if (typeof resizable === 'boolean') {
35233 if (resizable === false) {
35234 return;
35235 }
35236 resizable = {
35237 topLeft: resizable,
35238 top: resizable,
35239 topRight: resizable,
35240 right: resizable,
35241 bottomRight: resizable,
35242 bottom: resizable,
35243 bottomLeft: resizable,
35244 left: resizable
35245 };
35246 }
35247 Object.keys(resizable).forEach(function (side) {
35248 var resizableStructure = resizable;
35249 var val = !!resizableStructure[side];
35250 var resizerEl = _this.getResizerElement(side);
35251 var params = {
35252 dragStartPixels: 0,
35253 eElement: resizerEl,
35254 onDragStart: function (e) { return _this.onResizeStart(e, side); },
35255 onDragging: _this.onResize.bind(_this),
35256 onDragStop: function (e) { return _this.onResizeEnd(e, side); },
35257 };
35258 if (!!_this.resizable[side] !== val || (!_this.isAlive() && !val)) {
35259 if (val) {
35260 _this.dragService.addDragSource(params);
35261 _this.resizeListeners.push(params);
35262 resizerEl.style.pointerEvents = 'all';
35263 }
35264 else {
35265 resizerEl.style.pointerEvents = 'none';
35266 }
35267 }
35268 });
35269 };
35270 PositionableFeature.prototype.removeSizeFromEl = function () {
35271 this.element.style.removeProperty('height');
35272 this.element.style.removeProperty('width');
35273 this.element.style.removeProperty('flex');
35274 };
35275 PositionableFeature.prototype.restoreLastSize = function () {
35276 this.element.style.flex = '0 0 auto';
35277 var _a = this.lastSize, height = _a.height, width = _a.width;
35278 if (width !== -1) {
35279 this.element.style.width = width + "px";
35280 }
35281 if (height !== -1) {
35282 this.element.style.height = height + "px";
35283 }
35284 };
35285 PositionableFeature.prototype.getHeight = function () {
35286 return this.element.offsetHeight;
35287 };
35288 PositionableFeature.prototype.setHeight = function (height) {
35289 var popup = this.config.popup;
35290 var eGui = this.element;
35291 var isPercent = false;
35292 if (typeof height === 'string' && height.indexOf('%') !== -1) {
35293 setFixedHeight(eGui, height);
35294 height = getAbsoluteHeight(eGui);
35295 isPercent = true;
35296 }
35297 else if (this.positioned) {
35298 var elRect = this.element.getBoundingClientRect();
35299 var parentRect = this.offsetParent.getBoundingClientRect();
35300 height = Math.max(this.minHeight, height);
35301 var clientHeight = this.offsetParent.clientHeight;
35302 var yPosition = popup ? this.position.y : elRect.top;
35303 var parentTop = popup ? 0 : parentRect.top;
35304 if (clientHeight && (height + yPosition > clientHeight + parentTop)) {
35305 height = clientHeight - yPosition;
35306 }
35307 }
35308 if (this.getHeight() === height) {
35309 return;
35310 }
35311 if (!isPercent) {
35312 if (popup) {
35313 setFixedHeight(eGui, height);
35314 }
35315 else {
35316 eGui.style.height = height + "px";
35317 eGui.style.flex = '0 0 auto';
35318 this.lastSize.height = typeof height === 'number' ? height : parseFloat(height);
35319 }
35320 }
35321 else {
35322 eGui.style.maxHeight = 'unset';
35323 eGui.style.minHeight = 'unset';
35324 }
35325 };
35326 PositionableFeature.prototype.getWidth = function () {
35327 return this.element.offsetWidth;
35328 };
35329 PositionableFeature.prototype.setWidth = function (width) {
35330 var eGui = this.element;
35331 var popup = this.config.popup;
35332 var isPercent = false;
35333 if (typeof width === 'string' && width.indexOf('%') !== -1) {
35334 setFixedWidth(eGui, width);
35335 width = getAbsoluteWidth(eGui);
35336 isPercent = true;
35337 }
35338 else if (this.positioned) {
35339 width = Math.max(this.minWidth, width);
35340 var clientWidth = this.offsetParent.clientWidth;
35341 var xPosition = popup ? this.position.x : this.element.getBoundingClientRect().left;
35342 if (clientWidth && (width + xPosition > clientWidth)) {
35343 width = clientWidth - xPosition;
35344 }
35345 }
35346 if (this.getWidth() === width) {
35347 return;
35348 }
35349 if (!isPercent) {
35350 if (this.config.popup) {
35351 setFixedWidth(eGui, width);
35352 }
35353 else {
35354 eGui.style.width = width + "px";
35355 eGui.style.flex = ' unset';
35356 this.lastSize.width = typeof width === 'number' ? width : parseFloat(width);
35357 }
35358 }
35359 else {
35360 eGui.style.maxWidth = 'unset';
35361 eGui.style.minWidth = 'unset';
35362 }
35363 };
35364 PositionableFeature.prototype.offsetElement = function (x, y) {
35365 if (x === void 0) { x = 0; }
35366 if (y === void 0) { y = 0; }
35367 var ePopup = this.config.forcePopupParentAsOffsetParent ? this.boundaryEl : this.element;
35368 this.popupService.positionPopup({
35369 ePopup: ePopup,
35370 x: x,
35371 y: y,
35372 keepWithinBounds: true
35373 });
35374 this.setPosition(parseFloat(ePopup.style.left), parseFloat(ePopup.style.top));
35375 };
35376 PositionableFeature.prototype.setPosition = function (x, y) {
35377 this.position.x = x;
35378 this.position.y = y;
35379 };
35380 PositionableFeature.prototype.updateDragStartPosition = function (x, y) {
35381 this.dragStartPosition = { x: x, y: y };
35382 };
35383 PositionableFeature.prototype.calculateMouseMovement = function (params) {
35384 var e = params.e, isLeft = params.isLeft, isTop = params.isTop, anywhereWithin = params.anywhereWithin, topBuffer = params.topBuffer;
35385 var xDiff = e.clientX - this.dragStartPosition.x;
35386 var yDiff = e.clientY - this.dragStartPosition.y;
35387 var movementX = this.shouldSkipX(e, !!isLeft, !!anywhereWithin, xDiff) ? 0 : xDiff;
35388 var movementY = this.shouldSkipY(e, !!isTop, topBuffer, yDiff) ? 0 : yDiff;
35389 return { movementX: movementX, movementY: movementY };
35390 };
35391 PositionableFeature.prototype.shouldSkipX = function (e, isLeft, anywhereWithin, diff) {
35392 var elRect = this.element.getBoundingClientRect();
35393 var parentRect = this.offsetParent.getBoundingClientRect();
35394 var boundaryElRect = this.boundaryEl.getBoundingClientRect();
35395 var xPosition = this.config.popup ? this.position.x : elRect.left;
35396 // skip if cursor is outside of popupParent horizontally
35397 var skipX = ((xPosition <= 0 && parentRect.left >= e.clientX) ||
35398 (parentRect.right <= e.clientX && parentRect.right <= boundaryElRect.right));
35399 if (skipX) {
35400 return true;
35401 }
35402 if (isLeft) {
35403 skipX = (
35404 // skip if we are moving to the left and the cursor
35405 // is positioned to the right of the left side anchor
35406 (diff < 0 && e.clientX > xPosition + parentRect.left) ||
35407 // skip if we are moving to the right and the cursor
35408 // is positioned to the left of the dialog
35409 (diff > 0 && e.clientX < xPosition + parentRect.left));
35410 }
35411 else {
35412 if (anywhereWithin) {
35413 // if anywhereWithin is true, we allow to move
35414 // as long as the cursor is within the dialog
35415 skipX = ((diff < 0 && e.clientX > boundaryElRect.right) ||
35416 (diff > 0 && e.clientX < xPosition + parentRect.left));
35417 }
35418 else {
35419 skipX = (
35420 // if the movement is bound to the right side of the dialog
35421 // we skip if we are moving to the left and the cursor
35422 // is to the right of the dialog
35423 (diff < 0 && e.clientX > boundaryElRect.right) ||
35424 // or skip if we are moving to the right and the cursor
35425 // is to the left of the right side anchor
35426 (diff > 0 && e.clientX < boundaryElRect.right));
35427 }
35428 }
35429 return skipX;
35430 };
35431 PositionableFeature.prototype.shouldSkipY = function (e, isTop, topBuffer, diff) {
35432 if (topBuffer === void 0) { topBuffer = 0; }
35433 var elRect = this.element.getBoundingClientRect();
35434 var parentRect = this.offsetParent.getBoundingClientRect();
35435 var boundaryElRect = this.boundaryEl.getBoundingClientRect();
35436 var yPosition = this.config.popup ? this.position.y : elRect.top;
35437 // skip if cursor is outside of popupParent vertically
35438 var skipY = ((yPosition <= 0 && parentRect.top >= e.clientY) ||
35439 (parentRect.bottom <= e.clientY && parentRect.bottom <= boundaryElRect.bottom));
35440 if (skipY) {
35441 return true;
35442 }
35443 if (isTop) {
35444 skipY = (
35445 // skip if we are moving to towards top and the cursor is
35446 // below the top anchor + topBuffer
35447 // note: topBuffer is used when moving the dialog using the title bar
35448 (diff < 0 && e.clientY > yPosition + parentRect.top + topBuffer) ||
35449 // skip if we are moving to the bottom and the cursor is
35450 // above the top anchor
35451 (diff > 0 && e.clientY < yPosition + parentRect.top));
35452 }
35453 else {
35454 skipY = (
35455 // skip if we are moving towards the top and the cursor
35456 // is below the bottom anchor
35457 (diff < 0 && e.clientY > boundaryElRect.bottom) ||
35458 // skip if we are moving towards the bottom and the cursor
35459 // is above the bottom anchor
35460 (diff > 0 && e.clientY < boundaryElRect.bottom));
35461 }
35462 return skipY;
35463 };
35464 PositionableFeature.prototype.createResizeMap = function () {
35465 var eGui = this.element;
35466 this.resizerMap = {
35467 topLeft: { element: eGui.querySelector('[ref=eTopLeftResizer]') },
35468 top: { element: eGui.querySelector('[ref=eTopResizer]') },
35469 topRight: { element: eGui.querySelector('[ref=eTopRightResizer]') },
35470 right: { element: eGui.querySelector('[ref=eRightResizer]') },
35471 bottomRight: { element: eGui.querySelector('[ref=eBottomRightResizer]') },
35472 bottom: { element: eGui.querySelector('[ref=eBottomResizer]') },
35473 bottomLeft: { element: eGui.querySelector('[ref=eBottomLeftResizer]') },
35474 left: { element: eGui.querySelector('[ref=eLeftResizer]') }
35475 };
35476 };
35477 PositionableFeature.prototype.addResizers = function () {
35478 if (this.resizersAdded) {
35479 return;
35480 }
35481 var eGui = this.element;
35482 if (!eGui) {
35483 return;
35484 }
35485 var parser = new DOMParser();
35486 var resizers = parser.parseFromString(RESIZE_TEMPLATE, 'text/html').body;
35487 eGui.appendChild(resizers.firstChild);
35488 this.createResizeMap();
35489 this.resizersAdded = true;
35490 };
35491 PositionableFeature.prototype.removeResizers = function () {
35492 this.resizerMap = undefined;
35493 var resizerEl = this.element.querySelector("." + RESIZE_CONTAINER_STYLE);
35494 if (resizerEl) {
35495 this.element.removeChild(resizerEl);
35496 }
35497 this.resizersAdded = false;
35498 };
35499 PositionableFeature.prototype.getResizerElement = function (side) {
35500 return this.resizerMap[side].element;
35501 };
35502 PositionableFeature.prototype.onResizeStart = function (e, side) {
35503 this.boundaryEl = this.findBoundaryElement();
35504 if (!this.positioned) {
35505 this.initialisePosition();
35506 }
35507 this.currentResizer = {
35508 isTop: !!side.match(/top/i),
35509 isRight: !!side.match(/right/i),
35510 isBottom: !!side.match(/bottom/i),
35511 isLeft: !!side.match(/left/i),
35512 };
35513 this.element.classList.add('ag-resizing');
35514 this.resizerMap[side].element.classList.add('ag-active');
35515 var _a = this.config, popup = _a.popup, forcePopupParentAsOffsetParent = _a.forcePopupParentAsOffsetParent;
35516 if (!popup && !forcePopupParentAsOffsetParent) {
35517 this.applySizeToSiblings(this.currentResizer.isBottom || this.currentResizer.isTop);
35518 }
35519 this.isResizing = true;
35520 this.updateDragStartPosition(e.clientX, e.clientY);
35521 };
35522 PositionableFeature.prototype.getSiblings = function () {
35523 var element = this.element;
35524 var parent = element.parentElement;
35525 if (!parent) {
35526 return null;
35527 }
35528 return Array.prototype.slice.call(parent.children).filter(function (el) { return !el.classList.contains('ag-hidden'); });
35529 };
35530 PositionableFeature.prototype.getMinSizeOfSiblings = function () {
35531 var siblings = this.getSiblings() || [];
35532 var height = 0;
35533 var width = 0;
35534 for (var i = 0; i < siblings.length; i++) {
35535 var currentEl = siblings[i];
35536 var isFlex = !!currentEl.style.flex && currentEl.style.flex !== '0 0 auto';
35537 if (currentEl === this.element) {
35538 continue;
35539 }
35540 var nextHeight = this.minHeight || 0;
35541 var nextWidth = this.minWidth || 0;
35542 if (isFlex) {
35543 var computedStyle = window.getComputedStyle(currentEl);
35544 if (computedStyle.minHeight) {
35545 nextHeight = parseInt(computedStyle.minHeight, 10);
35546 }
35547 if (computedStyle.minWidth) {
35548 nextWidth = parseInt(computedStyle.minWidth, 10);
35549 }
35550 }
35551 else {
35552 nextHeight = currentEl.offsetHeight;
35553 nextWidth = currentEl.offsetWidth;
35554 }
35555 height += nextHeight;
35556 width += nextWidth;
35557 }
35558 return { height: height, width: width };
35559 };
35560 PositionableFeature.prototype.applySizeToSiblings = function (vertical) {
35561 var containerToFlex = null;
35562 var siblings = this.getSiblings();
35563 if (!siblings) {
35564 return;
35565 }
35566 for (var i = 0; i < siblings.length; i++) {
35567 var el = siblings[i];
35568 if (el === containerToFlex) {
35569 continue;
35570 }
35571 if (vertical) {
35572 el.style.height = el.offsetHeight + "px";
35573 }
35574 else {
35575 el.style.width = el.offsetWidth + "px";
35576 }
35577 el.style.flex = '0 0 auto';
35578 if (el === this.element) {
35579 containerToFlex = siblings[i + 1];
35580 }
35581 }
35582 if (containerToFlex) {
35583 containerToFlex.style.removeProperty('height');
35584 containerToFlex.style.removeProperty('min-height');
35585 containerToFlex.style.removeProperty('max-height');
35586 containerToFlex.style.flex = '1 1 auto';
35587 }
35588 };
35589 PositionableFeature.prototype.onResize = function (e) {
35590 if (!this.isResizing || !this.currentResizer) {
35591 return;
35592 }
35593 var _a = this.config, popup = _a.popup, forcePopupParentAsOffsetParent = _a.forcePopupParentAsOffsetParent;
35594 var _b = this.currentResizer, isTop = _b.isTop, isRight = _b.isRight, isBottom = _b.isBottom, isLeft = _b.isLeft;
35595 var isHorizontal = isRight || isLeft;
35596 var isVertical = isBottom || isTop;
35597 var _c = this.calculateMouseMovement({ e: e, isLeft: isLeft, isTop: isTop }), movementX = _c.movementX, movementY = _c.movementY;
35598 var xPosition = this.position.x;
35599 var yPosition = this.position.y;
35600 var offsetLeft = 0;
35601 var offsetTop = 0;
35602 if (isHorizontal && movementX) {
35603 var direction = isLeft ? -1 : 1;
35604 var oldWidth = this.getWidth();
35605 var newWidth = oldWidth + (movementX * direction);
35606 var skipWidth = false;
35607 if (isLeft) {
35608 offsetLeft = oldWidth - newWidth;
35609 if (xPosition + offsetLeft <= 0 || newWidth <= this.minWidth) {
35610 skipWidth = true;
35611 offsetLeft = 0;
35612 }
35613 }
35614 if (!skipWidth) {
35615 this.setWidth(newWidth);
35616 }
35617 }
35618 if (isVertical && movementY) {
35619 var direction = isTop ? -1 : 1;
35620 var oldHeight = this.getHeight();
35621 var newHeight = oldHeight + (movementY * direction);
35622 var skipHeight = false;
35623 if (isTop) {
35624 offsetTop = oldHeight - newHeight;
35625 if (yPosition + offsetTop <= 0 || newHeight <= this.minHeight) {
35626 skipHeight = true;
35627 offsetTop = 0;
35628 }
35629 }
35630 else {
35631 // do not let the size of all siblings be higher than the parent container
35632 if (!this.config.popup &&
35633 !this.config.forcePopupParentAsOffsetParent &&
35634 oldHeight < newHeight &&
35635 (this.getMinSizeOfSiblings().height + newHeight) > this.element.parentElement.offsetHeight) {
35636 skipHeight = true;
35637 }
35638 }
35639 if (!skipHeight) {
35640 this.setHeight(newHeight);
35641 }
35642 }
35643 this.updateDragStartPosition(e.clientX, e.clientY);
35644 if ((popup || forcePopupParentAsOffsetParent) && offsetLeft || offsetTop) {
35645 this.offsetElement(xPosition + offsetLeft, yPosition + offsetTop);
35646 }
35647 };
35648 PositionableFeature.prototype.onResizeEnd = function (e, side) {
35649 this.isResizing = false;
35650 this.currentResizer = null;
35651 this.boundaryEl = null;
35652 var params = {
35653 type: 'resize',
35654 api: this.gridOptionsWrapper.getApi(),
35655 columnApi: this.gridOptionsWrapper.getColumnApi()
35656 };
35657 this.element.classList.remove('ag-resizing');
35658 this.resizerMap[side].element.classList.remove('ag-active');
35659 this.dispatchEvent(params);
35660 };
35661 PositionableFeature.prototype.refreshSize = function () {
35662 var eGui = this.element;
35663 if (this.config.popup) {
35664 if (!this.config.width) {
35665 this.setWidth(eGui.offsetWidth);
35666 }
35667 if (!this.config.height) {
35668 this.setHeight(eGui.offsetHeight);
35669 }
35670 }
35671 };
35672 PositionableFeature.prototype.onMoveStart = function (e) {
35673 this.boundaryEl = this.findBoundaryElement();
35674 if (!this.positioned) {
35675 this.initialisePosition();
35676 }
35677 this.isMoving = true;
35678 this.element.classList.add('ag-moving');
35679 this.updateDragStartPosition(e.clientX, e.clientY);
35680 };
35681 PositionableFeature.prototype.onMove = function (e) {
35682 if (!this.isMoving) {
35683 return;
35684 }
35685 var _a = this.position, x = _a.x, y = _a.y;
35686 var topBuffer;
35687 if (this.config.calculateTopBuffer) {
35688 topBuffer = this.config.calculateTopBuffer();
35689 }
35690 var _b = this.calculateMouseMovement({
35691 e: e,
35692 isTop: true,
35693 anywhereWithin: true,
35694 topBuffer: topBuffer
35695 }), movementX = _b.movementX, movementY = _b.movementY;
35696 this.offsetElement(x + movementX, y + movementY);
35697 this.updateDragStartPosition(e.clientX, e.clientY);
35698 };
35699 PositionableFeature.prototype.onMoveEnd = function () {
35700 this.isMoving = false;
35701 this.boundaryEl = null;
35702 this.element.classList.remove('ag-moving');
35703 };
35704 PositionableFeature.prototype.setOffsetParent = function () {
35705 if (this.config.forcePopupParentAsOffsetParent) {
35706 this.offsetParent = this.popupService.getPopupParent();
35707 }
35708 else {
35709 this.offsetParent = this.element.offsetParent;
35710 }
35711 };
35712 PositionableFeature.prototype.findBoundaryElement = function () {
35713 var el = this.element;
35714 while (el) {
35715 if (window.getComputedStyle(el).position !== 'static') {
35716 return el;
35717 }
35718 el = el.parentElement;
35719 }
35720 return this.element;
35721 };
35722 PositionableFeature.prototype.clearResizeListeners = function () {
35723 while (this.resizeListeners.length) {
35724 var params = this.resizeListeners.pop();
35725 this.dragService.removeDragSource(params);
35726 }
35727 };
35728 PositionableFeature.prototype.destroy = function () {
35729 _super.prototype.destroy.call(this);
35730 if (this.moveElementDragListener) {
35731 this.dragService.removeDragSource(this.moveElementDragListener);
35732 }
35733 this.clearResizeListeners();
35734 this.removeResizers();
35735 };
35736 __decorate$1t([
35737 Autowired('popupService')
35738 ], PositionableFeature.prototype, "popupService", void 0);
35739 __decorate$1t([
35740 Autowired('dragService')
35741 ], PositionableFeature.prototype, "dragService", void 0);
35742 return PositionableFeature;
35743}(BeanStub));
35744
35745/**
35746 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
35747 * @version v27.3.0
35748 * @link https://www.ag-grid.com/
35749 * @license MIT
35750 */
35751var __extends$1H = (undefined && undefined.__extends) || (function () {
35752 var extendStatics = function (d, b) {
35753 extendStatics = Object.setPrototypeOf ||
35754 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
35755 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
35756 return extendStatics(d, b);
35757 };
35758 return function (d, b) {
35759 extendStatics(d, b);
35760 function __() { this.constructor = d; }
35761 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35762 };
35763})();
35764var __decorate$1u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
35765 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35766 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35767 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;
35768 return c > 3 && r && Object.defineProperty(target, key, r), r;
35769};
35770var AutoWidthCalculator = /** @class */ (function (_super) {
35771 __extends$1H(AutoWidthCalculator, _super);
35772 function AutoWidthCalculator() {
35773 return _super !== null && _super.apply(this, arguments) || this;
35774 }
35775 AutoWidthCalculator.prototype.postConstruct = function () {
35776 var _this = this;
35777 this.ctrlsService.whenReady(function (p) {
35778 _this.centerRowContainerCtrl = p.centerRowContainerCtrl;
35779 });
35780 };
35781 // this is the trick: we create a dummy container and clone all the cells
35782 // into the dummy, then check the dummy's width. then destroy the dummy
35783 // as we don't need it any more.
35784 // drawback: only the cells visible on the screen are considered
35785 AutoWidthCalculator.prototype.getPreferredWidthForColumn = function (column, skipHeader) {
35786 var eHeaderCell = this.getHeaderCellForColumn(column);
35787 // cell isn't visible
35788 if (!eHeaderCell) {
35789 return -1;
35790 }
35791 var elements = this.rowRenderer.getAllCellsForColumn(column);
35792 if (!skipHeader) {
35793 // we only consider the lowest level cell, not the group cell. in 99% of the time, this
35794 // will be enough. if we consider groups, then it gets too complicated for what it's worth,
35795 // as the groups can span columns and this class only considers one column at a time.
35796 elements.push(eHeaderCell);
35797 }
35798 return this.addElementsToContainerAndGetWidth(elements);
35799 };
35800 AutoWidthCalculator.prototype.getPreferredWidthForColumnGroup = function (columnGroup) {
35801 var eHeaderCell = this.getHeaderCellForColumn(columnGroup);
35802 if (!eHeaderCell) {
35803 return -1;
35804 }
35805 return this.addElementsToContainerAndGetWidth([eHeaderCell]);
35806 };
35807 AutoWidthCalculator.prototype.addElementsToContainerAndGetWidth = function (elements) {
35808 var _this = this;
35809 var eDummyContainer = document.createElement('span');
35810 // position fixed, so it isn't restricted to the boundaries of the parent
35811 eDummyContainer.style.position = 'fixed';
35812 // we put the dummy into the body container, so it will inherit all the
35813 // css styles that the real cells are inheriting
35814 var eBodyContainer = this.centerRowContainerCtrl.getContainerElement();
35815 eBodyContainer.appendChild(eDummyContainer);
35816 elements.forEach(function (el) { return _this.cloneItemIntoDummy(el, eDummyContainer); });
35817 // at this point, all the clones are lined up vertically with natural widths. the dummy
35818 // container will have a width wide enough just to fit the largest.
35819 var dummyContainerWidth = eDummyContainer.offsetWidth;
35820 // we are finished with the dummy container, so get rid of it
35821 eBodyContainer.removeChild(eDummyContainer);
35822 // we add padding as I found sometimes the gui still put '...' after some of the texts. so the
35823 // user can configure the grid to add a few more pixels after the calculated width
35824 var autoSizePadding = this.gridOptionsWrapper.getAutoSizePadding();
35825 return dummyContainerWidth + autoSizePadding;
35826 };
35827 AutoWidthCalculator.prototype.getHeaderCellForColumn = function (column) {
35828 /* tslint:enable */
35829 var element = null;
35830 this.ctrlsService.getHeaderRowContainerCtrls().forEach(function (container) {
35831 var res = container.getHtmlElementForColumnHeader(column);
35832 if (res != null) {
35833 element = res;
35834 }
35835 });
35836 return element;
35837 };
35838 AutoWidthCalculator.prototype.cloneItemIntoDummy = function (eCell, eDummyContainer) {
35839 // make a deep clone of the cell
35840 var eCellClone = eCell.cloneNode(true);
35841 // the original has a fixed width, we remove this to allow the natural width based on content
35842 eCellClone.style.width = '';
35843 // the original has position = absolute, we need to remove this so it's positioned normally
35844 eCellClone.style.position = 'static';
35845 eCellClone.style.left = '';
35846 // we put the cell into a containing div, as otherwise the cells would just line up
35847 // on the same line, standard flow layout, by putting them into divs, they are laid
35848 // out one per line
35849 var eCloneParent = document.createElement('div');
35850 var eCloneParentClassList = eCloneParent.classList;
35851 var isHeader = ['ag-header-cell', 'ag-header-group-cell'].some(function (cls) { return eCellClone.classList.contains(cls); });
35852 if (isHeader) {
35853 eCloneParentClassList.add('ag-header', 'ag-header-row');
35854 eCloneParent.style.position = 'static';
35855 }
35856 else {
35857 eCloneParentClassList.add('ag-row');
35858 }
35859 // find parent using classes (headers have ag-header-cell, rows have ag-row), and copy classes from it.
35860 // if we didn't do this, things like ag-row-level-2 would be missing if present, which sets indents
35861 // onto group items.
35862 var pointer = eCell.parentElement;
35863 while (pointer) {
35864 var isRow = ['ag-header-row', 'ag-row'].some(function (cls) { return pointer.classList.contains(cls); });
35865 if (isRow) {
35866 for (var i = 0; i < pointer.classList.length; i++) {
35867 var item = pointer.classList[i];
35868 // we skip ag-row-position-absolute, as this has structural CSS applied that stops the
35869 // element from fitting into it's parent, and we need the element to stretch the parent
35870 // as we are measuring the parents width
35871 if (item != 'ag-row-position-absolute') {
35872 eCloneParentClassList.add(item);
35873 }
35874 }
35875 break;
35876 }
35877 pointer = pointer.parentElement;
35878 }
35879 // the twig on the branch, the branch on the tree, the tree in the hole,
35880 // the hole in the bog, the bog in the clone, the clone in the parent,
35881 // the parent in the dummy, and the dummy down in the vall-e-ooo, OOOOOOOOO! Oh row the rattling bog....
35882 eCloneParent.appendChild(eCellClone);
35883 eDummyContainer.appendChild(eCloneParent);
35884 };
35885 __decorate$1u([
35886 Autowired('rowRenderer')
35887 ], AutoWidthCalculator.prototype, "rowRenderer", void 0);
35888 __decorate$1u([
35889 Autowired('ctrlsService')
35890 ], AutoWidthCalculator.prototype, "ctrlsService", void 0);
35891 __decorate$1u([
35892 Autowired('rowCssClassCalculator')
35893 ], AutoWidthCalculator.prototype, "rowCssClassCalculator", void 0);
35894 __decorate$1u([
35895 PostConstruct
35896 ], AutoWidthCalculator.prototype, "postConstruct", null);
35897 AutoWidthCalculator = __decorate$1u([
35898 Bean('autoWidthCalculator')
35899 ], AutoWidthCalculator);
35900 return AutoWidthCalculator;
35901}(BeanStub));
35902
35903/**
35904 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
35905 * @version v27.3.0
35906 * @link https://www.ag-grid.com/
35907 * @license MIT
35908 */
35909var __extends$1I = (undefined && undefined.__extends) || (function () {
35910 var extendStatics = function (d, b) {
35911 extendStatics = Object.setPrototypeOf ||
35912 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
35913 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
35914 return extendStatics(d, b);
35915 };
35916 return function (d, b) {
35917 extendStatics(d, b);
35918 function __() { this.constructor = d; }
35919 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35920 };
35921})();
35922var __decorate$1v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
35923 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35924 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35925 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;
35926 return c > 3 && r && Object.defineProperty(target, key, r), r;
35927};
35928var __read$d = (undefined && undefined.__read) || function (o, n) {
35929 var m = typeof Symbol === "function" && o[Symbol.iterator];
35930 if (!m) return o;
35931 var i = m.call(o), r, ar = [], e;
35932 try {
35933 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
35934 }
35935 catch (error) { e = { error: error }; }
35936 finally {
35937 try {
35938 if (r && !r.done && (m = i["return"])) m.call(i);
35939 }
35940 finally { if (e) throw e.error; }
35941 }
35942 return ar;
35943};
35944var __spread$a = (undefined && undefined.__spread) || function () {
35945 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$d(arguments[i]));
35946 return ar;
35947};
35948var RowRenderer = /** @class */ (function (_super) {
35949 __extends$1I(RowRenderer, _super);
35950 function RowRenderer() {
35951 var _this = _super !== null && _super.apply(this, arguments) || this;
35952 _this.destroyFuncsForColumnListeners = [];
35953 // map of row ids to row objects. keeps track of which elements
35954 // are rendered for which rows in the dom.
35955 _this.rowCtrlsByRowIndex = {};
35956 _this.zombieRowCtrls = {};
35957 _this.allRowCtrls = [];
35958 _this.topRowCtrls = [];
35959 _this.bottomRowCtrls = [];
35960 // we only allow one refresh at a time, otherwise the internal memory structure here
35961 // will get messed up. this can happen if the user has a cellRenderer, and inside the
35962 // renderer they call an API method that results in another pass of the refresh,
35963 // then it will be trying to draw rows in the middle of a refresh.
35964 _this.refreshInProgress = false;
35965 return _this;
35966 }
35967 RowRenderer.prototype.postConstruct = function () {
35968 var _this = this;
35969 this.ctrlsService.whenReady(function () {
35970 _this.gridBodyCtrl = _this.ctrlsService.getGridBodyCtrl();
35971 _this.initialise();
35972 });
35973 };
35974 RowRenderer.prototype.initialise = function () {
35975 this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onPageLoaded.bind(this));
35976 this.addManagedListener(this.eventService, Events.EVENT_PINNED_ROW_DATA_CHANGED, this.onPinnedRowDataChanged.bind(this));
35977 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this));
35978 this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, this.redrawAfterScroll.bind(this));
35979 this.addManagedListener(this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, this.redrawAfterScroll.bind(this));
35980 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, this.onDomLayoutChanged.bind(this));
35981 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_ROW_CLASS, this.redrawRows.bind(this));
35982 this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onNewColumnsLoaded.bind(this));
35983 this.registerCellEventListeners();
35984 this.initialiseCache();
35985 this.printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
35986 this.embedFullWidthRows = this.printLayout || this.gridOptionsWrapper.isEmbedFullWidthRows();
35987 this.redrawAfterModelUpdate();
35988 };
35989 RowRenderer.prototype.initialiseCache = function () {
35990 if (this.gridOptionsWrapper.isKeepDetailRows()) {
35991 var countProp = this.gridOptionsWrapper.getKeepDetailRowsCount();
35992 var count = countProp != null ? countProp : 3;
35993 this.cachedRowCtrls = new RowCtrlCache(count);
35994 }
35995 };
35996 RowRenderer.prototype.getRowCtrls = function () {
35997 return this.allRowCtrls;
35998 };
35999 RowRenderer.prototype.updateAllRowCtrls = function () {
36000 var liveList = getAllValuesInObject(this.rowCtrlsByRowIndex);
36001 if (this.gridOptionsWrapper.isEnsureDomOrder()) {
36002 liveList.sort(function (a, b) { return a.getRowNode().rowIndex - b.getRowNode.rowIndex; });
36003 }
36004 var zombieList = getAllValuesInObject(this.zombieRowCtrls);
36005 var cachedList = this.cachedRowCtrls ? this.cachedRowCtrls.getEntries() : [];
36006 this.allRowCtrls = __spread$a(liveList, zombieList, cachedList);
36007 };
36008 // in a clean design, each cell would register for each of these events. however when scrolling, all the cells
36009 // registering and de-registering for events is a performance bottleneck. so we register here once and inform
36010 // all active cells.
36011 RowRenderer.prototype.registerCellEventListeners = function () {
36012 var _this = this;
36013 this.addManagedListener(this.eventService, Events.EVENT_CELL_FOCUSED, function (event) {
36014 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onCellFocused(event); });
36015 _this.getFullWidthRowCtrls().forEach(function (rowCtrl) {
36016 rowCtrl.onFullWidthRowFocused(event);
36017 });
36018 });
36019 this.addManagedListener(this.eventService, Events.EVENT_FLASH_CELLS, function (event) {
36020 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onFlashCells(event); });
36021 });
36022 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_HOVER_CHANGED, function () {
36023 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onColumnHover(); });
36024 });
36025 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, function () {
36026 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onDisplayedColumnsChanged(); });
36027 });
36028 // only for printLayout - because we are rendering all the cells in the same row, regardless of pinned state,
36029 // then changing the width of the containers will impact left position. eg the center cols all have their
36030 // left position adjusted by the width of the left pinned column, so if the pinned left column width changes,
36031 // all the center cols need to be shifted to accommodate this. when in normal layout, the pinned cols are
36032 // in different containers so doesn't impact.
36033 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, function () {
36034 if (_this.printLayout) {
36035 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onLeftChanged(); });
36036 }
36037 });
36038 var rangeSelectionEnabled = this.gridOptionsWrapper.isEnableRangeSelection();
36039 if (rangeSelectionEnabled) {
36040 this.addManagedListener(this.eventService, Events.EVENT_RANGE_SELECTION_CHANGED, function () {
36041 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onRangeSelectionChanged(); });
36042 });
36043 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, function () {
36044 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.updateRangeBordersIfRangeCount(); });
36045 });
36046 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, function () {
36047 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.updateRangeBordersIfRangeCount(); });
36048 });
36049 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, function () {
36050 _this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.updateRangeBordersIfRangeCount(); });
36051 });
36052 }
36053 // add listeners to the grid columns
36054 this.refreshListenersToColumnsForCellComps();
36055 // if the grid columns change, then refresh the listeners again
36056 this.addManagedListener(this.eventService, Events.EVENT_GRID_COLUMNS_CHANGED, this.refreshListenersToColumnsForCellComps.bind(this));
36057 this.addDestroyFunc(this.removeGridColumnListeners.bind(this));
36058 };
36059 // executes all functions in destroyFuncsForColumnListeners and then clears the list
36060 RowRenderer.prototype.removeGridColumnListeners = function () {
36061 this.destroyFuncsForColumnListeners.forEach(function (func) { return func(); });
36062 this.destroyFuncsForColumnListeners.length = 0;
36063 };
36064 // this function adds listeners onto all the grid columns, which are the column that we could have cellComps for.
36065 // when the grid columns change, we add listeners again. in an ideal design, each CellComp would just register to
36066 // the column it belongs to on creation, however this was a bottleneck with the number of cells, so do it here
36067 // once instead.
36068 RowRenderer.prototype.refreshListenersToColumnsForCellComps = function () {
36069 var _this = this;
36070 this.removeGridColumnListeners();
36071 var cols = this.columnModel.getAllGridColumns();
36072 if (!cols) {
36073 return;
36074 }
36075 cols.forEach(function (col) {
36076 var forEachCellWithThisCol = function (callback) {
36077 _this.getAllCellCtrls().forEach(function (cellCtrl) {
36078 if (cellCtrl.getColumn() === col) {
36079 callback(cellCtrl);
36080 }
36081 });
36082 };
36083 var leftChangedListener = function () {
36084 forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onLeftChanged(); });
36085 };
36086 var widthChangedListener = function () {
36087 forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onWidthChanged(); });
36088 };
36089 var firstRightPinnedChangedListener = function () {
36090 forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onFirstRightPinnedChanged(); });
36091 };
36092 var lastLeftPinnedChangedListener = function () {
36093 forEachCellWithThisCol(function (cellCtrl) { return cellCtrl.onLastLeftPinnedChanged(); });
36094 };
36095 col.addEventListener(Column.EVENT_LEFT_CHANGED, leftChangedListener);
36096 col.addEventListener(Column.EVENT_WIDTH_CHANGED, widthChangedListener);
36097 col.addEventListener(Column.EVENT_FIRST_RIGHT_PINNED_CHANGED, firstRightPinnedChangedListener);
36098 col.addEventListener(Column.EVENT_LAST_LEFT_PINNED_CHANGED, lastLeftPinnedChangedListener);
36099 _this.destroyFuncsForColumnListeners.push(function () {
36100 col.removeEventListener(Column.EVENT_LEFT_CHANGED, leftChangedListener);
36101 col.removeEventListener(Column.EVENT_WIDTH_CHANGED, widthChangedListener);
36102 col.removeEventListener(Column.EVENT_FIRST_RIGHT_PINNED_CHANGED, firstRightPinnedChangedListener);
36103 col.removeEventListener(Column.EVENT_LAST_LEFT_PINNED_CHANGED, lastLeftPinnedChangedListener);
36104 });
36105 });
36106 };
36107 RowRenderer.prototype.onDomLayoutChanged = function () {
36108 var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
36109 var embedFullWidthRows = printLayout || this.gridOptionsWrapper.isEmbedFullWidthRows();
36110 // if moving towards or away from print layout, means we need to destroy all rows, as rows are not laid
36111 // out using absolute positioning when doing print layout
36112 var destroyRows = embedFullWidthRows !== this.embedFullWidthRows || this.printLayout !== printLayout;
36113 this.printLayout = printLayout;
36114 this.embedFullWidthRows = embedFullWidthRows;
36115 if (destroyRows) {
36116 this.redrawAfterModelUpdate();
36117 }
36118 };
36119 // for row models that have datasources, when we update the datasource, we need to force the rowRenderer
36120 // to redraw all rows. otherwise the old rows from the old datasource will stay displayed.
36121 RowRenderer.prototype.datasourceChanged = function () {
36122 this.firstRenderedRow = 0;
36123 this.lastRenderedRow = -1;
36124 var rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex);
36125 this.removeRowCtrls(rowIndexesToRemove);
36126 };
36127 RowRenderer.prototype.onPageLoaded = function (event) {
36128 var params = {
36129 recycleRows: event.keepRenderedRows,
36130 animate: event.animate,
36131 newData: event.newData,
36132 newPage: event.newPage,
36133 // because this is a model updated event (not pinned rows), we
36134 // can skip updating the pinned rows. this is needed so that if user
36135 // is doing transaction updates, the pinned rows are not getting constantly
36136 // trashed - or editing cells in pinned rows are not refreshed and put into read mode
36137 onlyBody: true
36138 };
36139 this.redrawAfterModelUpdate(params);
36140 };
36141 RowRenderer.prototype.getAllCellsForColumn = function (column) {
36142 var res = [];
36143 this.getAllRowCtrls().forEach(function (rowCtrl) {
36144 var eCell = rowCtrl.getCellElement(column);
36145 if (eCell) {
36146 res.push(eCell);
36147 }
36148 });
36149 return res;
36150 };
36151 RowRenderer.prototype.refreshFloatingRowComps = function () {
36152 this.refreshFloatingRows(this.topRowCtrls, this.pinnedRowModel.getPinnedTopRowData());
36153 this.refreshFloatingRows(this.bottomRowCtrls, this.pinnedRowModel.getPinnedBottomRowData());
36154 };
36155 RowRenderer.prototype.getTopRowCtrls = function () {
36156 return this.topRowCtrls;
36157 };
36158 RowRenderer.prototype.getBottomRowCtrls = function () {
36159 return this.bottomRowCtrls;
36160 };
36161 RowRenderer.prototype.refreshFloatingRows = function (rowComps, rowNodes) {
36162 var _this = this;
36163 rowComps.forEach(function (row) {
36164 row.destroyFirstPass();
36165 row.destroySecondPass();
36166 });
36167 rowComps.length = 0;
36168 if (!rowNodes) {
36169 return;
36170 }
36171 rowNodes.forEach(function (rowNode) {
36172 var rowCtrl = new RowCtrl(rowNode, _this.beans, false, false, _this.printLayout);
36173 rowComps.push(rowCtrl);
36174 });
36175 };
36176 RowRenderer.prototype.onPinnedRowDataChanged = function () {
36177 // recycling rows in order to ensure cell editing is not cancelled
36178 var params = {
36179 recycleRows: true
36180 };
36181 this.redrawAfterModelUpdate(params);
36182 };
36183 // if the row nodes are not rendered, no index is returned
36184 RowRenderer.prototype.getRenderedIndexesForRowNodes = function (rowNodes) {
36185 var result = [];
36186 if (missing(rowNodes)) {
36187 return result;
36188 }
36189 iterateObject(this.rowCtrlsByRowIndex, function (index, renderedRow) {
36190 var rowNode = renderedRow.getRowNode();
36191 if (rowNodes.indexOf(rowNode) >= 0) {
36192 result.push(index);
36193 }
36194 });
36195 return result;
36196 };
36197 RowRenderer.prototype.redrawRows = function (rowNodes) {
36198 // if no row nodes provided, then refresh everything
36199 var partialRefresh = rowNodes != null && rowNodes.length > 0;
36200 if (partialRefresh) {
36201 var indexesToRemove = this.getRenderedIndexesForRowNodes(rowNodes);
36202 // remove the rows
36203 this.removeRowCtrls(indexesToRemove);
36204 }
36205 // add draw them again
36206 this.redrawAfterModelUpdate({
36207 recycleRows: partialRefresh
36208 });
36209 };
36210 RowRenderer.prototype.getCellToRestoreFocusToAfterRefresh = function (params) {
36211 var focusedCell = params.suppressKeepFocus ? null : this.focusService.getFocusCellToUseAfterRefresh();
36212 if (focusedCell == null) {
36213 return null;
36214 }
36215 // if the dom is not actually focused on a cell, then we don't try to refocus. the problem this
36216 // solves is with editing - if the user is editing, eg focus is on a text field, and not on the
36217 // cell itself, then the cell can be registered as having focus, however it's the text field that
36218 // has the focus and not the cell div. therefore, when the refresh is finished, the grid will focus
36219 // the cell, and not the textfield. that means if the user is in a text field, and the grid refreshes,
36220 // the focus is lost from the text field. we do not want this.
36221 var eDocument = this.gridOptionsWrapper.getDocument();
36222 var activeElement = eDocument.activeElement;
36223 var cellDomData = this.gridOptionsWrapper.getDomData(activeElement, CellCtrl.DOM_DATA_KEY_CELL_CTRL);
36224 var rowDomData = this.gridOptionsWrapper.getDomData(activeElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL);
36225 var gridElementFocused = cellDomData || rowDomData;
36226 return gridElementFocused ? focusedCell : null;
36227 };
36228 // gets called from:
36229 // +) initialisation (in registerGridComp) params = null
36230 // +) onDomLayoutChanged, params = null
36231 // +) onPageLoaded, recycleRows, animate, newData, newPage from event, onlyBody=true
36232 // +) onPinnedRowDataChanged, recycleRows = true
36233 // +) redrawRows (from Grid API), recycleRows = true/false
36234 RowRenderer.prototype.redrawAfterModelUpdate = function (params) {
36235 if (params === void 0) { params = {}; }
36236 this.getLockOnRefresh();
36237 var focusedCell = this.getCellToRestoreFocusToAfterRefresh(params);
36238 this.updateContainerHeights();
36239 this.scrollToTopIfNewData(params);
36240 // never recycle rows when print layout, we draw each row again from scratch. this is because print layout
36241 // uses normal dom layout to put cells into dom - it doesn't allow reordering rows.
36242 var recycleRows = !this.printLayout && !!params.recycleRows;
36243 var animate = params.animate && this.gridOptionsWrapper.isAnimateRows();
36244 // after modelUpdate, row indexes can change, so we clear out the rowsByIndex map,
36245 // however we can reuse the rows, so we keep them but index by rowNode.id
36246 var rowsToRecycle = recycleRows ? this.recycleRows() : null;
36247 if (!recycleRows) {
36248 this.removeAllRowComps();
36249 }
36250 var isFocusedCellGettingRecycled = function () {
36251 if (focusedCell == null || rowsToRecycle == null) {
36252 return false;
36253 }
36254 var res = false;
36255 iterateObject(rowsToRecycle, function (key, rowComp) {
36256 var rowNode = rowComp.getRowNode();
36257 var rowIndexEqual = rowNode.rowIndex == focusedCell.rowIndex;
36258 var pinnedEqual = rowNode.rowPinned == focusedCell.rowPinned;
36259 if (rowIndexEqual && pinnedEqual) {
36260 res = true;
36261 }
36262 });
36263 return res;
36264 };
36265 var focusedCellRecycled = isFocusedCellGettingRecycled();
36266 this.redraw(rowsToRecycle, animate);
36267 if (!params.onlyBody) {
36268 this.refreshFloatingRowComps();
36269 }
36270 this.dispatchDisplayedRowsChanged();
36271 // if we focus a cell that's already focused, then we get an unnecessary 'cellFocused' event fired.
36272 // this was happening when user clicked 'expand' on a rowGroup, then cellFocused was getting fired twice.
36273 if (!focusedCellRecycled) {
36274 this.restoreFocusedCell(focusedCell);
36275 }
36276 this.releaseLockOnRefresh();
36277 };
36278 RowRenderer.prototype.scrollToTopIfNewData = function (params) {
36279 var scrollToTop = params.newData || params.newPage;
36280 var suppressScrollToTop = this.gridOptionsWrapper.isSuppressScrollOnNewData();
36281 if (scrollToTop && !suppressScrollToTop) {
36282 this.gridBodyCtrl.getScrollFeature().scrollToTop();
36283 }
36284 };
36285 RowRenderer.prototype.updateContainerHeights = function () {
36286 // when doing print layout, we don't explicitly set height on the containers
36287 if (this.printLayout) {
36288 this.rowContainerHeightService.setModelHeight(null);
36289 return;
36290 }
36291 var containerHeight = this.paginationProxy.getCurrentPageHeight();
36292 // we need at least 1 pixel for the horizontal scroll to work. so if there are now rows,
36293 // we still want the scroll to be present, otherwise there would be no way to scroll the header
36294 // which might be needed us user wants to access columns
36295 // on the RHS - and if that was where the filter was that cause no rows to be presented, there
36296 // is no way to remove the filter.
36297 if (containerHeight === 0) {
36298 containerHeight = 1;
36299 }
36300 this.rowContainerHeightService.setModelHeight(containerHeight);
36301 };
36302 RowRenderer.prototype.getLockOnRefresh = function () {
36303 if (this.refreshInProgress) {
36304 throw new Error("AG Grid: cannot get grid to draw rows when it is in the middle of drawing rows. " +
36305 "Your code probably called a grid API method while the grid was in the render stage. To overcome " +
36306 "this, put the API call into a timeout, e.g. instead of api.redrawRows(), " +
36307 "call setTimeout(function() { api.redrawRows(); }, 0). To see what part of your code " +
36308 "that caused the refresh check this stacktrace.");
36309 }
36310 this.refreshInProgress = true;
36311 };
36312 RowRenderer.prototype.releaseLockOnRefresh = function () {
36313 this.refreshInProgress = false;
36314 };
36315 RowRenderer.prototype.isRefreshInProgress = function () {
36316 return this.refreshInProgress;
36317 };
36318 // sets the focus to the provided cell, if the cell is provided. this way, the user can call refresh without
36319 // worry about the focus been lost. this is important when the user is using keyboard navigation to do edits
36320 // and the cellEditor is calling 'refresh' to get other cells to update (as other cells might depend on the
36321 // edited cell).
36322 RowRenderer.prototype.restoreFocusedCell = function (cellPosition) {
36323 if (cellPosition) {
36324 this.focusService.setFocusedCell(cellPosition.rowIndex, cellPosition.column, cellPosition.rowPinned, true);
36325 }
36326 };
36327 RowRenderer.prototype.stopEditing = function (cancel) {
36328 if (cancel === void 0) { cancel = false; }
36329 this.getAllRowCtrls().forEach(function (rowCtrl) {
36330 rowCtrl.stopEditing(cancel);
36331 });
36332 };
36333 RowRenderer.prototype.onNewColumnsLoaded = function () {
36334 // we don't want each cellComp to register for events, as would increase rendering time.
36335 // so for newColumnsLoaded, we register once here (in rowRenderer) and then inform
36336 // each cell if / when event was fired.
36337 this.getAllCellCtrls().forEach(function (cellCtrl) { return cellCtrl.onNewColumnsLoaded(); });
36338 };
36339 RowRenderer.prototype.getAllCellCtrls = function () {
36340 var res = [];
36341 this.getAllRowCtrls().forEach(function (rowCtrl) { return res = res.concat(rowCtrl.getAllCellCtrls()); });
36342 return res;
36343 };
36344 RowRenderer.prototype.getAllRowCtrls = function () {
36345 var _this = this;
36346 var res = __spread$a(this.topRowCtrls, this.bottomRowCtrls);
36347 Object.keys(this.rowCtrlsByRowIndex).forEach(function (key) { return res.push(_this.rowCtrlsByRowIndex[key]); });
36348 return res;
36349 };
36350 RowRenderer.prototype.addRenderedRowListener = function (eventName, rowIndex, callback) {
36351 var rowComp = this.rowCtrlsByRowIndex[rowIndex];
36352 if (rowComp) {
36353 rowComp.addEventListener(eventName, callback);
36354 }
36355 };
36356 RowRenderer.prototype.flashCells = function (params) {
36357 if (params === void 0) { params = {}; }
36358 var flashDelay = params.flashDelay, fadeDelay = params.fadeDelay;
36359 this.getCellCtrls(params.rowNodes, params.columns)
36360 .forEach(function (cellCtrl) { return cellCtrl.flashCell({ flashDelay: flashDelay, fadeDelay: fadeDelay }); });
36361 };
36362 RowRenderer.prototype.refreshCells = function (params) {
36363 if (params === void 0) { params = {}; }
36364 var refreshCellParams = {
36365 forceRefresh: params.force,
36366 newData: false,
36367 suppressFlash: params.suppressFlash
36368 };
36369 this.getCellCtrls(params.rowNodes, params.columns)
36370 .forEach(function (cellCtrl) {
36371 if (cellCtrl.refreshShouldDestroy()) {
36372 var rowCtrl = cellCtrl.getRowCtrl();
36373 if (rowCtrl) {
36374 rowCtrl.refreshCell(cellCtrl);
36375 }
36376 }
36377 else {
36378 cellCtrl.refreshCell(refreshCellParams);
36379 }
36380 });
36381 this.getFullWidthRowCtrls(params.rowNodes).forEach(function (fullWidthRowCtrl) {
36382 fullWidthRowCtrl.refreshFullWidth();
36383 });
36384 };
36385 RowRenderer.prototype.getCellRendererInstances = function (params) {
36386 var res = this.getCellCtrls(params.rowNodes, params.columns)
36387 .map(function (cellCtrl) { return cellCtrl.getCellRenderer(); })
36388 .filter(function (renderer) { return renderer != null; });
36389 return res;
36390 };
36391 RowRenderer.prototype.getCellEditorInstances = function (params) {
36392 var res = [];
36393 this.getCellCtrls(params.rowNodes, params.columns).forEach(function (cellCtrl) {
36394 var cellEditor = cellCtrl.getCellEditor();
36395 if (cellEditor) {
36396 res.push(cellEditor);
36397 }
36398 });
36399 return res;
36400 };
36401 RowRenderer.prototype.getEditingCells = function () {
36402 var res = [];
36403 this.getAllCellCtrls().forEach(function (cellCtrl) {
36404 if (cellCtrl.isEditing()) {
36405 var cellPosition = cellCtrl.getCellPosition();
36406 res.push(cellPosition);
36407 }
36408 });
36409 return res;
36410 };
36411 RowRenderer.prototype.mapRowNodes = function (rowNodes) {
36412 if (!rowNodes) {
36413 return;
36414 }
36415 var res = {
36416 top: {},
36417 bottom: {},
36418 normal: {}
36419 };
36420 rowNodes.forEach(function (rowNode) {
36421 var id = rowNode.id;
36422 if (rowNode.rowPinned === Constants.PINNED_TOP) {
36423 res.top[id] = rowNode;
36424 }
36425 else if (rowNode.rowPinned === Constants.PINNED_BOTTOM) {
36426 res.bottom[id] = rowNode;
36427 }
36428 else {
36429 res.normal[id] = rowNode;
36430 }
36431 });
36432 return res;
36433 };
36434 RowRenderer.prototype.isRowInMap = function (rowNode, rowIdsMap) {
36435 // skip this row if it is missing from the provided list
36436 var id = rowNode.id;
36437 var floating = rowNode.rowPinned;
36438 if (floating === Constants.PINNED_BOTTOM) {
36439 return rowIdsMap.bottom[id] != null;
36440 }
36441 else if (floating === Constants.PINNED_TOP) {
36442 return rowIdsMap.top[id] != null;
36443 }
36444 else {
36445 return rowIdsMap.normal[id] != null;
36446 }
36447 };
36448 // returns CellCtrl's that match the provided rowNodes and columns. eg if one row node
36449 // and two columns provided, that identifies 4 cells, so 4 CellCtrl's returned.
36450 RowRenderer.prototype.getCellCtrls = function (rowNodes, columns) {
36451 var _this = this;
36452 var rowIdsMap = this.mapRowNodes(rowNodes);
36453 var res = [];
36454 var colIdsMap;
36455 if (exists(columns)) {
36456 colIdsMap = {};
36457 columns.forEach(function (colKey) {
36458 var column = _this.columnModel.getGridColumn(colKey);
36459 if (exists(column)) {
36460 colIdsMap[column.getId()] = true;
36461 }
36462 });
36463 }
36464 var processRow = function (rowComp) {
36465 var rowNode = rowComp.getRowNode();
36466 // skip this row if it is missing from the provided list
36467 if (rowIdsMap != null && !_this.isRowInMap(rowNode, rowIdsMap)) {
36468 return;
36469 }
36470 rowComp.getAllCellCtrls().forEach(function (cellCtrl) {
36471 var colId = cellCtrl.getColumn().getId();
36472 var excludeColFromRefresh = colIdsMap && !colIdsMap[colId];
36473 if (excludeColFromRefresh) {
36474 return;
36475 }
36476 res.push(cellCtrl);
36477 });
36478 };
36479 iterateObject(this.rowCtrlsByRowIndex, function (index, rowComp) {
36480 processRow(rowComp);
36481 });
36482 if (this.topRowCtrls) {
36483 this.topRowCtrls.forEach(processRow);
36484 }
36485 if (this.bottomRowCtrls) {
36486 this.bottomRowCtrls.forEach(processRow);
36487 }
36488 return res;
36489 };
36490 RowRenderer.prototype.destroy = function () {
36491 this.removeAllRowComps();
36492 _super.prototype.destroy.call(this);
36493 };
36494 RowRenderer.prototype.removeAllRowComps = function () {
36495 var rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex);
36496 this.removeRowCtrls(rowIndexesToRemove);
36497 };
36498 RowRenderer.prototype.recycleRows = function () {
36499 // remove all stub nodes, they can't be reused, as no rowNode id
36500 var stubNodeIndexes = [];
36501 iterateObject(this.rowCtrlsByRowIndex, function (index, rowComp) {
36502 var stubNode = rowComp.getRowNode().id == null;
36503 if (stubNode) {
36504 stubNodeIndexes.push(index);
36505 }
36506 });
36507 this.removeRowCtrls(stubNodeIndexes);
36508 // then clear out rowCompsByIndex, but before that take a copy, but index by id, not rowIndex
36509 var nodesByIdMap = {};
36510 iterateObject(this.rowCtrlsByRowIndex, function (index, rowComp) {
36511 var rowNode = rowComp.getRowNode();
36512 nodesByIdMap[rowNode.id] = rowComp;
36513 });
36514 this.rowCtrlsByRowIndex = {};
36515 return nodesByIdMap;
36516 };
36517 // takes array of row indexes
36518 RowRenderer.prototype.removeRowCtrls = function (rowsToRemove) {
36519 var _this = this;
36520 // if no fromIndex then set to -1, which will refresh everything
36521 // let realFromIndex = -1;
36522 rowsToRemove.forEach(function (indexToRemove) {
36523 var rowCtrl = _this.rowCtrlsByRowIndex[indexToRemove];
36524 if (rowCtrl) {
36525 rowCtrl.destroyFirstPass();
36526 rowCtrl.destroySecondPass();
36527 }
36528 delete _this.rowCtrlsByRowIndex[indexToRemove];
36529 });
36530 };
36531 // gets called when rows don't change, but viewport does, so after:
36532 // 1) height of grid body changes, ie number of displayed rows has changed
36533 // 2) grid scrolled to new position
36534 // 3) ensure index visible (which is a scroll)
36535 RowRenderer.prototype.redrawAfterScroll = function () {
36536 this.getLockOnRefresh();
36537 this.redraw(null, false, true);
36538 this.releaseLockOnRefresh();
36539 this.dispatchDisplayedRowsChanged();
36540 };
36541 RowRenderer.prototype.removeRowCompsNotToDraw = function (indexesToDraw) {
36542 // for speedy lookup, dump into map
36543 var indexesToDrawMap = {};
36544 indexesToDraw.forEach(function (index) { return (indexesToDrawMap[index] = true); });
36545 var existingIndexes = Object.keys(this.rowCtrlsByRowIndex);
36546 var indexesNotToDraw = existingIndexes.filter(function (index) { return !indexesToDrawMap[index]; });
36547 this.removeRowCtrls(indexesNotToDraw);
36548 };
36549 RowRenderer.prototype.calculateIndexesToDraw = function (rowsToRecycle) {
36550 var _this = this;
36551 // all in all indexes in the viewport
36552 var indexesToDraw = createArrayOfNumbers(this.firstRenderedRow, this.lastRenderedRow);
36553 var checkRowToDraw = function (indexStr, rowComp) {
36554 var index = rowComp.getRowNode().rowIndex;
36555 if (index == null) {
36556 return;
36557 }
36558 if (index < _this.firstRenderedRow || index > _this.lastRenderedRow) {
36559 if (_this.doNotUnVirtualiseRow(rowComp)) {
36560 indexesToDraw.push(index);
36561 }
36562 }
36563 };
36564 // if we are redrawing due to scrolling change, then old rows are in this.rowCompsByIndex
36565 iterateObject(this.rowCtrlsByRowIndex, checkRowToDraw);
36566 // if we are redrawing due to model update, then old rows are in rowsToRecycle
36567 iterateObject(rowsToRecycle, checkRowToDraw);
36568 indexesToDraw.sort(function (a, b) { return a - b; });
36569 return indexesToDraw;
36570 };
36571 RowRenderer.prototype.redraw = function (rowsToRecycle, animate, afterScroll) {
36572 var _this = this;
36573 if (animate === void 0) { animate = false; }
36574 if (afterScroll === void 0) { afterScroll = false; }
36575 this.rowContainerHeightService.updateOffset();
36576 this.workOutFirstAndLastRowsToRender();
36577 // the row can already exist and be in the following:
36578 // rowsToRecycle -> if model change, then the index may be different, however row may
36579 // exist here from previous time (mapped by id).
36580 // this.rowCompsByIndex -> if just a scroll, then this will contain what is currently in the viewport
36581 // this is all the indexes we want, including those that already exist, so this method
36582 // will end up going through each index and drawing only if the row doesn't already exist
36583 var indexesToDraw = this.calculateIndexesToDraw(rowsToRecycle);
36584 this.removeRowCompsNotToDraw(indexesToDraw);
36585 // never animate when doing print layout - as we want to get things ready to print as quickly as possible,
36586 // otherwise we risk the printer printing a row that's half faded (half way through fading in)
36587 if (this.printLayout) {
36588 animate = false;
36589 }
36590 indexesToDraw.forEach(function (rowIndex) {
36591 var rowCtrl = _this.createOrUpdateRowCtrl(rowIndex, rowsToRecycle, animate, afterScroll);
36592 if (exists(rowCtrl)) ;
36593 });
36594 if (rowsToRecycle) {
36595 var useAnimationFrame = afterScroll && !this.gridOptionsWrapper.isSuppressAnimationFrame() && !this.printLayout;
36596 if (useAnimationFrame) {
36597 this.beans.animationFrameService.addDestroyTask(function () {
36598 _this.destroyRowCtrls(rowsToRecycle, animate);
36599 _this.updateAllRowCtrls();
36600 _this.dispatchDisplayedRowsChanged();
36601 });
36602 }
36603 else {
36604 this.destroyRowCtrls(rowsToRecycle, animate);
36605 }
36606 }
36607 this.updateAllRowCtrls();
36608 this.gridBodyCtrl.updateRowCount();
36609 };
36610 RowRenderer.prototype.dispatchDisplayedRowsChanged = function () {
36611 var event = { type: Events.EVENT_DISPLAYED_ROWS_CHANGED };
36612 this.eventService.dispatchEvent(event);
36613 };
36614 RowRenderer.prototype.onDisplayedColumnsChanged = function () {
36615 var pinningLeft = this.columnModel.isPinningLeft();
36616 var pinningRight = this.columnModel.isPinningRight();
36617 var atLeastOneChanged = this.pinningLeft !== pinningLeft || pinningRight !== this.pinningRight;
36618 if (atLeastOneChanged) {
36619 this.pinningLeft = pinningLeft;
36620 this.pinningRight = pinningRight;
36621 if (this.embedFullWidthRows) {
36622 this.redrawFullWidthEmbeddedRows();
36623 }
36624 }
36625 };
36626 // when embedding, what gets showed in each section depends on what is pinned. eg if embedding group expand / collapse,
36627 // then it should go into the pinned left area if pinning left, or the center area if not pinning.
36628 RowRenderer.prototype.redrawFullWidthEmbeddedRows = function () {
36629 // if either of the pinned panels has shown / hidden, then need to redraw the fullWidth bits when
36630 // embedded, as what appears in each section depends on whether we are pinned or not
36631 var rowsToRemove = [];
36632 this.getFullWidthRowCtrls().forEach(function (fullWidthCtrl) {
36633 var rowIndex = fullWidthCtrl.getRowNode().rowIndex;
36634 rowsToRemove.push(rowIndex.toString());
36635 });
36636 this.refreshFloatingRowComps();
36637 this.removeRowCtrls(rowsToRemove);
36638 this.redrawAfterScroll();
36639 };
36640 RowRenderer.prototype.getFullWidthRowCtrls = function (rowNodes) {
36641 var _this = this;
36642 var rowNodesMap = this.mapRowNodes(rowNodes);
36643 return getAllValuesInObject(this.rowCtrlsByRowIndex).filter(function (rowCtrl) {
36644 // include just full width
36645 if (!rowCtrl.isFullWidth()) {
36646 return false;
36647 }
36648 // if Row Nodes provided, we exclude where Row Node is missing
36649 var rowNode = rowCtrl.getRowNode();
36650 if (rowNodesMap != null && !_this.isRowInMap(rowNode, rowNodesMap)) {
36651 return false;
36652 }
36653 return true;
36654 });
36655 };
36656 RowRenderer.prototype.refreshFullWidthRows = function (rowNodesToRefresh) {
36657 var rowsToRemove = [];
36658 var selectivelyRefreshing = !!rowNodesToRefresh;
36659 var idsToRefresh = selectivelyRefreshing ? {} : undefined;
36660 if (selectivelyRefreshing && idsToRefresh) {
36661 rowNodesToRefresh.forEach(function (r) { return idsToRefresh[r.id] = true; });
36662 }
36663 this.getFullWidthRowCtrls().forEach(function (fullWidthRowCtrl) {
36664 var rowNode = fullWidthRowCtrl.getRowNode();
36665 if (selectivelyRefreshing && idsToRefresh) {
36666 // we refresh if a) this node is present or b) this parents nodes is present. checking parent
36667 // node is important for master/detail, as we want detail to refresh on changes to parent node.
36668 // it's also possible, if user is provider their own fullWidth, that details panels contain
36669 // some info on the parent, eg if in tree data and child row shows some data from parent row also.
36670 var parentId = (rowNode.level > 0 && rowNode.parent) ? rowNode.parent.id : undefined;
36671 var skipThisNode = !idsToRefresh[rowNode.id] && !idsToRefresh[parentId];
36672 if (skipThisNode) {
36673 return;
36674 }
36675 }
36676 var fullWidthRowsRefreshed = fullWidthRowCtrl.refreshFullWidth();
36677 if (!fullWidthRowsRefreshed) {
36678 var rowIndex = fullWidthRowCtrl.getRowNode().rowIndex;
36679 rowsToRemove.push(rowIndex.toString());
36680 }
36681 });
36682 this.removeRowCtrls(rowsToRemove);
36683 this.redrawAfterScroll();
36684 };
36685 RowRenderer.prototype.createOrUpdateRowCtrl = function (rowIndex, rowsToRecycle, animate, afterScroll) {
36686 var rowNode;
36687 var rowCtrl = this.rowCtrlsByRowIndex[rowIndex];
36688 // if no row comp, see if we can get it from the previous rowComps
36689 if (!rowCtrl) {
36690 rowNode = this.paginationProxy.getRow(rowIndex);
36691 if (exists(rowNode) && exists(rowsToRecycle) && rowsToRecycle[rowNode.id] && rowNode.alreadyRendered) {
36692 rowCtrl = rowsToRecycle[rowNode.id];
36693 rowsToRecycle[rowNode.id] = null;
36694 }
36695 }
36696 var creatingNewRowCtrl = !rowCtrl;
36697 if (creatingNewRowCtrl) {
36698 // create a new one
36699 if (!rowNode) {
36700 rowNode = this.paginationProxy.getRow(rowIndex);
36701 }
36702 if (exists(rowNode)) {
36703 rowCtrl = this.createRowCon(rowNode, animate, afterScroll);
36704 }
36705 else {
36706 // this should never happen - if somehow we are trying to create
36707 // a row for a rowNode that does not exist.
36708 return;
36709 }
36710 }
36711 if (rowNode) {
36712 // set node as 'alreadyRendered' to ensure we only recycle rowComps that have been rendered, this ensures
36713 // we don't reuse rowComps that have been removed and then re-added in the same batch transaction.
36714 rowNode.alreadyRendered = true;
36715 }
36716 this.rowCtrlsByRowIndex[rowIndex] = rowCtrl;
36717 return rowCtrl;
36718 };
36719 RowRenderer.prototype.destroyRowCtrls = function (rowCtrlsMap, animate) {
36720 var _this = this;
36721 var executeInAWhileFuncs = [];
36722 iterateObject(rowCtrlsMap, function (nodeId, rowCtrl) {
36723 // if row was used, then it's null
36724 if (!rowCtrl) {
36725 return;
36726 }
36727 if (_this.cachedRowCtrls && rowCtrl.isCacheable()) {
36728 _this.cachedRowCtrls.addRow(rowCtrl);
36729 return;
36730 }
36731 rowCtrl.destroyFirstPass();
36732 if (animate) {
36733 _this.zombieRowCtrls[rowCtrl.getInstanceId()] = rowCtrl;
36734 executeInAWhileFuncs.push(function () {
36735 rowCtrl.destroySecondPass();
36736 delete _this.zombieRowCtrls[rowCtrl.getInstanceId()];
36737 });
36738 }
36739 else {
36740 rowCtrl.destroySecondPass();
36741 }
36742 });
36743 if (animate) {
36744 // this ensures we fire displayedRowsChanged AFTER all the 'executeInAWhileFuncs' get
36745 // executed, as we added it to the end of the list.
36746 executeInAWhileFuncs.push(function () {
36747 _this.updateAllRowCtrls();
36748 _this.dispatchDisplayedRowsChanged();
36749 });
36750 executeInAWhile(executeInAWhileFuncs);
36751 }
36752 };
36753 RowRenderer.prototype.workOutFirstAndLastRowsToRender = function () {
36754 var _this = this;
36755 var newFirst;
36756 var newLast;
36757 if (!this.paginationProxy.isRowsToRender()) {
36758 newFirst = 0;
36759 newLast = -1; // setting to -1 means nothing in range
36760 }
36761 else if (this.printLayout) {
36762 newFirst = this.paginationProxy.getPageFirstRow();
36763 newLast = this.paginationProxy.getPageLastRow();
36764 }
36765 else {
36766 var bufferPixels = this.gridOptionsWrapper.getRowBufferInPixels();
36767 var gridBodyCtrl = this.ctrlsService.getGridBodyCtrl();
36768 var suppressRowVirtualisation = this.gridOptionsWrapper.isSuppressRowVirtualisation();
36769 var rowHeightsChanged = false;
36770 var firstPixel = void 0;
36771 var lastPixel = void 0;
36772 do {
36773 var paginationOffset = this.paginationProxy.getPixelOffset();
36774 var _a = this.paginationProxy.getCurrentPagePixelRange(), pageFirstPixel = _a.pageFirstPixel, pageLastPixel = _a.pageLastPixel;
36775 var divStretchOffset = this.rowContainerHeightService.getDivStretchOffset();
36776 if (suppressRowVirtualisation) {
36777 firstPixel = pageFirstPixel + divStretchOffset;
36778 lastPixel = pageLastPixel + divStretchOffset;
36779 }
36780 else {
36781 var bodyVRange = gridBodyCtrl.getScrollFeature().getVScrollPosition();
36782 var bodyTopPixel = bodyVRange.top;
36783 var bodyBottomPixel = bodyVRange.bottom;
36784 firstPixel = Math.max(bodyTopPixel + paginationOffset - bufferPixels, pageFirstPixel) + divStretchOffset;
36785 lastPixel = Math.min(bodyBottomPixel + paginationOffset + bufferPixels, pageLastPixel) + divStretchOffset;
36786 }
36787 // if the rows we are about to display get their heights changed, then that upsets the calcs from above.
36788 rowHeightsChanged = this.ensureAllRowsInRangeHaveHeightsCalculated(firstPixel, lastPixel);
36789 } while (rowHeightsChanged);
36790 var firstRowIndex = this.paginationProxy.getRowIndexAtPixel(firstPixel);
36791 var lastRowIndex = this.paginationProxy.getRowIndexAtPixel(lastPixel);
36792 var pageFirstRow = this.paginationProxy.getPageFirstRow();
36793 var pageLastRow = this.paginationProxy.getPageLastRow();
36794 // adjust, in case buffer extended actual size
36795 if (firstRowIndex < pageFirstRow) {
36796 firstRowIndex = pageFirstRow;
36797 }
36798 if (lastRowIndex > pageLastRow) {
36799 lastRowIndex = pageLastRow;
36800 }
36801 newFirst = firstRowIndex;
36802 newLast = lastRowIndex;
36803 }
36804 // sometimes user doesn't set CSS right and ends up with grid with no height and grid ends up
36805 // trying to render all the rows, eg 10,000+ rows. this will kill the browser. so instead of
36806 // killing the browser, we limit the number of rows. just in case some use case we didn't think
36807 // of, we also have a property to not do this operation.
36808 var rowLayoutNormal = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_NORMAL;
36809 var suppressRowCountRestriction = this.gridOptionsWrapper.isSuppressMaxRenderedRowRestriction();
36810 var rowBufferMaxSize = Math.max(this.gridOptionsWrapper.getRowBuffer(), 500);
36811 if (rowLayoutNormal && !suppressRowCountRestriction) {
36812 if (newLast - newFirst > rowBufferMaxSize) {
36813 newLast = newFirst + rowBufferMaxSize;
36814 }
36815 }
36816 var firstDiffers = newFirst !== this.firstRenderedRow;
36817 var lastDiffers = newLast !== this.lastRenderedRow;
36818 if (firstDiffers || lastDiffers) {
36819 this.firstRenderedRow = newFirst;
36820 this.lastRenderedRow = newLast;
36821 var event_1 = {
36822 type: Events.EVENT_VIEWPORT_CHANGED,
36823 firstRow: newFirst,
36824 lastRow: newLast,
36825 api: this.gridApi,
36826 columnApi: this.columnApi
36827 };
36828 this.eventService.dispatchEvent(event_1);
36829 }
36830 // only dispatch firstDataRendered if we have actually rendered some data
36831 if (this.paginationProxy.isRowsToRender()) {
36832 var event_2 = {
36833 type: Events.EVENT_FIRST_DATA_RENDERED,
36834 firstRow: newFirst,
36835 lastRow: newLast,
36836 api: this.gridApi,
36837 columnApi: this.columnApi
36838 };
36839 // added a small delay here because in some scenarios this can be fired
36840 // before the grid is actually rendered, causing component creation
36841 // on EVENT_FIRST_DATA_RENDERED to fail.
36842 window.setTimeout(function () { return _this.eventService.dispatchEventOnce(event_2); }, 50);
36843 }
36844 };
36845 RowRenderer.prototype.ensureAllRowsInRangeHaveHeightsCalculated = function (topPixel, bottomPixel) {
36846 // ensureRowHeightsVisible only works with CSRM, as it's the only row model that allows lazy row height calcs.
36847 // all the other row models just hard code so the method just returns back false
36848 var res = this.paginationProxy.ensureRowHeightsValid(topPixel, bottomPixel, -1, -1);
36849 if (res) {
36850 this.updateContainerHeights();
36851 }
36852 return res;
36853 };
36854 RowRenderer.prototype.getFirstVirtualRenderedRow = function () {
36855 return this.firstRenderedRow;
36856 };
36857 RowRenderer.prototype.getLastVirtualRenderedRow = function () {
36858 return this.lastRenderedRow;
36859 };
36860 // check that none of the rows to remove are editing or focused as:
36861 // a) if editing, we want to keep them, otherwise the user will loose the context of the edit,
36862 // eg user starts editing, enters some text, then scrolls down and then up, next time row rendered
36863 // the edit is reset - so we want to keep it rendered.
36864 // b) if focused, we want ot keep keyboard focus, so if user ctrl+c, it goes to clipboard,
36865 // otherwise the user can range select and drag (with focus cell going out of the viewport)
36866 // and then ctrl+c, nothing will happen if cell is removed from dom.
36867 // c) if detail record of master detail, as users complained that the context of detail rows
36868 // was getting lost when detail row out of view. eg user expands to show detail row,
36869 // then manipulates the detail panel (eg sorts the detail grid), then context is lost
36870 // after detail panel is scrolled out of / into view.
36871 RowRenderer.prototype.doNotUnVirtualiseRow = function (rowComp) {
36872 var REMOVE_ROW = false;
36873 var KEEP_ROW = true;
36874 var rowNode = rowComp.getRowNode();
36875 var rowHasFocus = this.focusService.isRowNodeFocused(rowNode);
36876 var rowIsEditing = rowComp.isEditing();
36877 var rowIsDetail = rowNode.detail;
36878 var mightWantToKeepRow = rowHasFocus || rowIsEditing || rowIsDetail;
36879 // if we deffo don't want to keep it,
36880 if (!mightWantToKeepRow) {
36881 return REMOVE_ROW;
36882 }
36883 // editing row, only remove if it is no longer rendered, eg filtered out or new data set.
36884 // the reason we want to keep is if user is scrolling up and down, we don't want to loose
36885 // the context of the editing in process.
36886 var rowNodePresent = this.paginationProxy.isRowPresent(rowNode);
36887 return rowNodePresent ? KEEP_ROW : REMOVE_ROW;
36888 };
36889 RowRenderer.prototype.createRowCon = function (rowNode, animate, afterScroll) {
36890 var rowCtrlFromCache = this.cachedRowCtrls ? this.cachedRowCtrls.getRow(rowNode) : null;
36891 if (rowCtrlFromCache) {
36892 return rowCtrlFromCache;
36893 }
36894 // we don't use animations frames for printing, so the user can put the grid into print mode
36895 // and immediately print - otherwise the user would have to wait for the rows to draw in the background
36896 // (via the animation frames) which is awkward to do from code.
36897 // we only do the animation frames after scrolling, as this is where we want the smooth user experience.
36898 // having animation frames for other times makes the grid look 'jumpy'.
36899 var suppressAnimationFrame = this.gridOptionsWrapper.isSuppressAnimationFrame();
36900 var useAnimationFrameForCreate = afterScroll && !suppressAnimationFrame && !this.printLayout;
36901 var res = new RowCtrl(rowNode, this.beans, animate, useAnimationFrameForCreate, this.printLayout);
36902 return res;
36903 };
36904 RowRenderer.prototype.getRenderedNodes = function () {
36905 var renderedRows = this.rowCtrlsByRowIndex;
36906 return Object.keys(renderedRows).map(function (key) { return renderedRows[key].getRowNode(); });
36907 };
36908 RowRenderer.prototype.getRowByPosition = function (rowPosition) {
36909 var rowComponent;
36910 switch (rowPosition.rowPinned) {
36911 case Constants.PINNED_TOP:
36912 rowComponent = this.topRowCtrls[rowPosition.rowIndex];
36913 break;
36914 case Constants.PINNED_BOTTOM:
36915 rowComponent = this.bottomRowCtrls[rowPosition.rowIndex];
36916 break;
36917 default:
36918 rowComponent = this.rowCtrlsByRowIndex[rowPosition.rowIndex];
36919 break;
36920 }
36921 return rowComponent;
36922 };
36923 RowRenderer.prototype.getRowNode = function (gridRow) {
36924 switch (gridRow.rowPinned) {
36925 case Constants.PINNED_TOP:
36926 return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
36927 case Constants.PINNED_BOTTOM:
36928 return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
36929 default:
36930 return this.rowModel.getRow(gridRow.rowIndex);
36931 }
36932 };
36933 // returns true if any row between startIndex and endIndex is rendered. used by
36934 // SSRM or IRM, as they don't want to purge visible blocks from cache.
36935 RowRenderer.prototype.isRangeInRenderedViewport = function (startIndex, endIndex) {
36936 // parent closed means the parent node is not expanded, thus these blocks are not visible
36937 var parentClosed = startIndex == null || endIndex == null;
36938 if (parentClosed) {
36939 return false;
36940 }
36941 var blockAfterViewport = startIndex > this.lastRenderedRow;
36942 var blockBeforeViewport = endIndex < this.firstRenderedRow;
36943 var blockInsideViewport = !blockBeforeViewport && !blockAfterViewport;
36944 return blockInsideViewport;
36945 };
36946 __decorate$1v([
36947 Autowired("paginationProxy")
36948 ], RowRenderer.prototype, "paginationProxy", void 0);
36949 __decorate$1v([
36950 Autowired("columnModel")
36951 ], RowRenderer.prototype, "columnModel", void 0);
36952 __decorate$1v([
36953 Autowired("pinnedRowModel")
36954 ], RowRenderer.prototype, "pinnedRowModel", void 0);
36955 __decorate$1v([
36956 Autowired("rowModel")
36957 ], RowRenderer.prototype, "rowModel", void 0);
36958 __decorate$1v([
36959 Autowired("focusService")
36960 ], RowRenderer.prototype, "focusService", void 0);
36961 __decorate$1v([
36962 Autowired("columnApi")
36963 ], RowRenderer.prototype, "columnApi", void 0);
36964 __decorate$1v([
36965 Autowired("gridApi")
36966 ], RowRenderer.prototype, "gridApi", void 0);
36967 __decorate$1v([
36968 Autowired("beans")
36969 ], RowRenderer.prototype, "beans", void 0);
36970 __decorate$1v([
36971 Autowired("rowContainerHeightService")
36972 ], RowRenderer.prototype, "rowContainerHeightService", void 0);
36973 __decorate$1v([
36974 Optional("ctrlsService")
36975 ], RowRenderer.prototype, "ctrlsService", void 0);
36976 __decorate$1v([
36977 PostConstruct
36978 ], RowRenderer.prototype, "postConstruct", null);
36979 RowRenderer = __decorate$1v([
36980 Bean("rowRenderer")
36981 ], RowRenderer);
36982 return RowRenderer;
36983}(BeanStub));
36984var RowCtrlCache = /** @class */ (function () {
36985 function RowCtrlCache(maxCount) {
36986 // map for fast access
36987 this.entriesMap = {};
36988 // list for keeping order
36989 this.entriesList = [];
36990 this.maxCount = maxCount;
36991 }
36992 RowCtrlCache.prototype.addRow = function (rowCtrl) {
36993 this.entriesMap[rowCtrl.getRowNode().id] = rowCtrl;
36994 this.entriesList.push(rowCtrl);
36995 rowCtrl.setCached(true);
36996 if (this.entriesList.length > this.maxCount) {
36997 var rowCtrlToDestroy = this.entriesList[0];
36998 rowCtrlToDestroy.destroyFirstPass();
36999 rowCtrlToDestroy.destroySecondPass();
37000 this.removeFromCache(rowCtrlToDestroy);
37001 }
37002 };
37003 RowCtrlCache.prototype.getRow = function (rowNode) {
37004 if (rowNode == null || rowNode.id == null) {
37005 return null;
37006 }
37007 var res = this.entriesMap[rowNode.id];
37008 if (!res) {
37009 return null;
37010 }
37011 this.removeFromCache(res);
37012 res.setCached(false);
37013 // this can happen if user reloads data, and a new RowNode is reusing
37014 // the same ID as the old one
37015 var rowNodeMismatch = res.getRowNode() != rowNode;
37016 return rowNodeMismatch ? null : res;
37017 };
37018 RowCtrlCache.prototype.removeFromCache = function (rowCtrl) {
37019 var rowNodeId = rowCtrl.getRowNode().id;
37020 delete this.entriesMap[rowNodeId];
37021 removeFromArray(this.entriesList, rowCtrl);
37022 };
37023 RowCtrlCache.prototype.getEntries = function () {
37024 return this.entriesList;
37025 };
37026 return RowCtrlCache;
37027}());
37028
37029/**
37030 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
37031 * @version v27.3.0
37032 * @link https://www.ag-grid.com/
37033 * @license MIT
37034 */
37035var __extends$1J = (undefined && undefined.__extends) || (function () {
37036 var extendStatics = function (d, b) {
37037 extendStatics = Object.setPrototypeOf ||
37038 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
37039 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
37040 return extendStatics(d, b);
37041 };
37042 return function (d, b) {
37043 extendStatics(d, b);
37044 function __() { this.constructor = d; }
37045 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37046 };
37047})();
37048var __decorate$1w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
37049 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
37050 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37051 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;
37052 return c > 3 && r && Object.defineProperty(target, key, r), r;
37053};
37054var ValueFormatterService = /** @class */ (function (_super) {
37055 __extends$1J(ValueFormatterService, _super);
37056 function ValueFormatterService() {
37057 return _super !== null && _super.apply(this, arguments) || this;
37058 }
37059 ValueFormatterService.prototype.formatValue = function (column, node, value, suppliedFormatter, useFormatterFromColumn) {
37060 if (useFormatterFromColumn === void 0) { useFormatterFromColumn = true; }
37061 var result = null;
37062 var formatter;
37063 var colDef = column.getColDef();
37064 if (suppliedFormatter) {
37065 // use supplied formatter if provided, e.g. set filter items can have their own value formatters
37066 formatter = suppliedFormatter;
37067 }
37068 else if (useFormatterFromColumn) {
37069 // if row is pinned, give preference to the pinned formatter
37070 formatter = node && node.rowPinned && colDef.pinnedRowValueFormatter ?
37071 colDef.pinnedRowValueFormatter : colDef.valueFormatter;
37072 }
37073 if (formatter) {
37074 var params = {
37075 value: value,
37076 node: node,
37077 data: node ? node.data : null,
37078 colDef: colDef,
37079 column: column,
37080 api: this.gridOptionsWrapper.getApi(),
37081 columnApi: this.gridOptionsWrapper.getColumnApi(),
37082 context: this.gridOptionsWrapper.getContext()
37083 };
37084 result = this.expressionService.evaluate(formatter, params);
37085 }
37086 else if (colDef.refData) {
37087 return colDef.refData[value] || '';
37088 }
37089 // if we don't do this, then arrays get displayed as 1,2,3, but we want 1, 2, 3 (i.e. with spaces)
37090 if (result == null && Array.isArray(value)) {
37091 result = value.join(', ');
37092 }
37093 return result;
37094 };
37095 __decorate$1w([
37096 Autowired('expressionService')
37097 ], ValueFormatterService.prototype, "expressionService", void 0);
37098 ValueFormatterService = __decorate$1w([
37099 Bean('valueFormatterService')
37100 ], ValueFormatterService);
37101 return ValueFormatterService;
37102}(BeanStub));
37103
37104/**
37105 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
37106 * @version v27.3.0
37107 * @link https://www.ag-grid.com/
37108 * @license MIT
37109 */
37110var __extends$1K = (undefined && undefined.__extends) || (function () {
37111 var extendStatics = function (d, b) {
37112 extendStatics = Object.setPrototypeOf ||
37113 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
37114 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
37115 return extendStatics(d, b);
37116 };
37117 return function (d, b) {
37118 extendStatics(d, b);
37119 function __() { this.constructor = d; }
37120 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37121 };
37122})();
37123var __decorate$1x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
37124 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
37125 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37126 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;
37127 return c > 3 && r && Object.defineProperty(target, key, r), r;
37128};
37129var PinnedRowModel = /** @class */ (function (_super) {
37130 __extends$1K(PinnedRowModel, _super);
37131 function PinnedRowModel() {
37132 return _super !== null && _super.apply(this, arguments) || this;
37133 }
37134 PinnedRowModel.prototype.init = function () {
37135 this.setPinnedTopRowData(this.gridOptionsWrapper.getPinnedTopRowData());
37136 this.setPinnedBottomRowData(this.gridOptionsWrapper.getPinnedBottomRowData());
37137 };
37138 PinnedRowModel.prototype.isEmpty = function (floating) {
37139 var rows = floating === Constants.PINNED_TOP ? this.pinnedTopRows : this.pinnedBottomRows;
37140 return missingOrEmpty(rows);
37141 };
37142 PinnedRowModel.prototype.isRowsToRender = function (floating) {
37143 return !this.isEmpty(floating);
37144 };
37145 PinnedRowModel.prototype.getRowAtPixel = function (pixel, floating) {
37146 var rows = floating === Constants.PINNED_TOP ? this.pinnedTopRows : this.pinnedBottomRows;
37147 if (missingOrEmpty(rows)) {
37148 return 0; // this should never happen, just in case, 0 is graceful failure
37149 }
37150 for (var i = 0; i < rows.length; i++) {
37151 var rowNode = rows[i];
37152 var rowTopPixel = rowNode.rowTop + rowNode.rowHeight - 1;
37153 // only need to range check against the top pixel, as we are going through the list
37154 // in order, first row to hit the pixel wins
37155 if (rowTopPixel >= pixel) {
37156 return i;
37157 }
37158 }
37159 return rows.length - 1;
37160 };
37161 PinnedRowModel.prototype.setPinnedTopRowData = function (rowData) {
37162 this.pinnedTopRows = this.createNodesFromData(rowData, true);
37163 var event = {
37164 type: Events.EVENT_PINNED_ROW_DATA_CHANGED,
37165 api: this.gridApi,
37166 columnApi: this.columnApi
37167 };
37168 this.eventService.dispatchEvent(event);
37169 };
37170 PinnedRowModel.prototype.setPinnedBottomRowData = function (rowData) {
37171 this.pinnedBottomRows = this.createNodesFromData(rowData, false);
37172 var event = {
37173 type: Events.EVENT_PINNED_ROW_DATA_CHANGED,
37174 api: this.gridApi,
37175 columnApi: this.columnApi
37176 };
37177 this.eventService.dispatchEvent(event);
37178 };
37179 PinnedRowModel.prototype.createNodesFromData = function (allData, isTop) {
37180 var _this = this;
37181 var rowNodes = [];
37182 if (allData) {
37183 var nextRowTop_1 = 0;
37184 allData.forEach(function (dataItem, index) {
37185 var rowNode = new RowNode(_this.beans);
37186 rowNode.data = dataItem;
37187 var idPrefix = isTop ? RowNode.ID_PREFIX_TOP_PINNED : RowNode.ID_PREFIX_BOTTOM_PINNED;
37188 rowNode.id = idPrefix + index;
37189 rowNode.rowPinned = isTop ? Constants.PINNED_TOP : Constants.PINNED_BOTTOM;
37190 rowNode.setRowTop(nextRowTop_1);
37191 rowNode.setRowHeight(_this.gridOptionsWrapper.getRowHeightForNode(rowNode).height);
37192 rowNode.setRowIndex(index);
37193 nextRowTop_1 += rowNode.rowHeight;
37194 rowNodes.push(rowNode);
37195 });
37196 }
37197 return rowNodes;
37198 };
37199 PinnedRowModel.prototype.getPinnedTopRowData = function () {
37200 return this.pinnedTopRows;
37201 };
37202 PinnedRowModel.prototype.getPinnedBottomRowData = function () {
37203 return this.pinnedBottomRows;
37204 };
37205 PinnedRowModel.prototype.getPinnedTopTotalHeight = function () {
37206 return this.getTotalHeight(this.pinnedTopRows);
37207 };
37208 PinnedRowModel.prototype.getPinnedTopRowCount = function () {
37209 return this.pinnedTopRows ? this.pinnedTopRows.length : 0;
37210 };
37211 PinnedRowModel.prototype.getPinnedBottomRowCount = function () {
37212 return this.pinnedBottomRows ? this.pinnedBottomRows.length : 0;
37213 };
37214 PinnedRowModel.prototype.getPinnedTopRow = function (index) {
37215 return this.pinnedTopRows[index];
37216 };
37217 PinnedRowModel.prototype.getPinnedBottomRow = function (index) {
37218 return this.pinnedBottomRows[index];
37219 };
37220 PinnedRowModel.prototype.forEachPinnedTopRow = function (callback) {
37221 if (missingOrEmpty(this.pinnedTopRows)) {
37222 return;
37223 }
37224 this.pinnedTopRows.forEach(callback);
37225 };
37226 PinnedRowModel.prototype.forEachPinnedBottomRow = function (callback) {
37227 if (missingOrEmpty(this.pinnedBottomRows)) {
37228 return;
37229 }
37230 this.pinnedBottomRows.forEach(callback);
37231 };
37232 PinnedRowModel.prototype.getPinnedBottomTotalHeight = function () {
37233 return this.getTotalHeight(this.pinnedBottomRows);
37234 };
37235 PinnedRowModel.prototype.getTotalHeight = function (rowNodes) {
37236 if (!rowNodes || rowNodes.length === 0) {
37237 return 0;
37238 }
37239 var lastNode = last(rowNodes);
37240 return lastNode.rowTop + lastNode.rowHeight;
37241 };
37242 __decorate$1x([
37243 Autowired('columnApi')
37244 ], PinnedRowModel.prototype, "columnApi", void 0);
37245 __decorate$1x([
37246 Autowired('gridApi')
37247 ], PinnedRowModel.prototype, "gridApi", void 0);
37248 __decorate$1x([
37249 Autowired('beans')
37250 ], PinnedRowModel.prototype, "beans", void 0);
37251 __decorate$1x([
37252 PostConstruct
37253 ], PinnedRowModel.prototype, "init", null);
37254 PinnedRowModel = __decorate$1x([
37255 Bean('pinnedRowModel')
37256 ], PinnedRowModel);
37257 return PinnedRowModel;
37258}(BeanStub));
37259
37260/**
37261 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
37262 * @version v27.3.0
37263 * @link https://www.ag-grid.com/
37264 * @license MIT
37265 */
37266(function (ServerSideTransactionResultStatus) {
37267 /** Transaction was successfully applied */
37268 ServerSideTransactionResultStatus["Applied"] = "Applied";
37269 /**
37270 * Store was not found, transaction not applied.
37271 * Either invalid route, or the parent row has not yet been expanded.
37272 */
37273 ServerSideTransactionResultStatus["StoreNotFound"] = "StoreNotFound";
37274 /**
37275 * Store is loading, transaction not applied.
37276 */
37277 ServerSideTransactionResultStatus["StoreLoading"] = "StoreLoading";
37278 /**
37279 * Store is loading (as max loads exceeded), transaction not applied.
37280 */
37281 ServerSideTransactionResultStatus["StoreWaitingToLoad"] = "StoreWaitingToLoad";
37282 /**
37283 * Store load attempt failed, transaction not applied.
37284 */
37285 ServerSideTransactionResultStatus["StoreLoadingFailed"] = "StoreLoadingFailed";
37286 /**
37287 * Store is type Partial, which doesn't accept transactions
37288 */
37289 ServerSideTransactionResultStatus["StoreWrongType"] = "StoreWrongType";
37290 /**
37291 * Transaction was cancelled, due to grid.
37292 * Callback isApplyServerSideTransaction() returning false
37293 */
37294 ServerSideTransactionResultStatus["Cancelled"] = "Cancelled";
37295})(exports.ServerSideTransactionResultStatus || (exports.ServerSideTransactionResultStatus = {}));
37296
37297/**
37298 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
37299 * @version v27.3.0
37300 * @link https://www.ag-grid.com/
37301 * @license MIT
37302 */
37303// when doing transactions, or change detection, and grouping is present
37304// in the data, there is no need for the ClientSideRowModel to update each
37305// group after an update, ony parts that were impacted by the change.
37306// this class keeps track of all groups that were impacted by a transaction.
37307// the the different CSRM operations (filter, sort etc) use the forEach method
37308// to visit each group that was changed.
37309var ChangedPath = /** @class */ (function () {
37310 function ChangedPath(keepingColumns, rootNode) {
37311 // whether changed path is active of not. it is active when a) doing
37312 // a transaction update or b) doing change detection. if we are doing
37313 // a CSRM refresh for other reasons (after sort or filter, or user calling
37314 // setRowData() without delta mode) then we are not active. we are also
37315 // marked as not active if secondary columns change in pivot (as this impacts
37316 // aggregations)
37317 this.active = true;
37318 // for each node in the change path, we also store which columns need
37319 // to be re-aggregated.
37320 this.nodeIdsToColumns = {};
37321 // for quick lookup, all items in the change path are mapped by nodeId
37322 this.mapToItems = {};
37323 this.keepingColumns = keepingColumns;
37324 this.pathRoot = {
37325 rowNode: rootNode,
37326 children: null
37327 };
37328 this.mapToItems[rootNode.id] = this.pathRoot;
37329 }
37330 // can be set inactive by:
37331 // a) ClientSideRowModel, if no transactions or
37332 // b) PivotService, if secondary columns changed
37333 ChangedPath.prototype.setInactive = function () {
37334 this.active = false;
37335 };
37336 ChangedPath.prototype.isActive = function () {
37337 return this.active;
37338 };
37339 ChangedPath.prototype.depthFirstSearchChangedPath = function (pathItem, callback) {
37340 if (pathItem.children) {
37341 for (var i = 0; i < pathItem.children.length; i++) {
37342 this.depthFirstSearchChangedPath(pathItem.children[i], callback);
37343 }
37344 }
37345 callback(pathItem.rowNode);
37346 };
37347 ChangedPath.prototype.depthFirstSearchEverything = function (rowNode, callback, traverseEverything) {
37348 if (rowNode.childrenAfterGroup) {
37349 for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) {
37350 var childNode = rowNode.childrenAfterGroup[i];
37351 if (childNode.childrenAfterGroup) {
37352 this.depthFirstSearchEverything(rowNode.childrenAfterGroup[i], callback, traverseEverything);
37353 }
37354 else if (traverseEverything) {
37355 callback(childNode);
37356 }
37357 }
37358 }
37359 callback(rowNode);
37360 };
37361 // traverseLeafNodes -> used when NOT doing changed path, ie traversing everything. the callback
37362 // will be called for child nodes in addition to parent nodes.
37363 ChangedPath.prototype.forEachChangedNodeDepthFirst = function (callback, traverseLeafNodes) {
37364 if (traverseLeafNodes === void 0) { traverseLeafNodes = false; }
37365 if (this.active) {
37366 // if we are active, then use the change path to callback
37367 // only for updated groups
37368 this.depthFirstSearchChangedPath(this.pathRoot, callback);
37369 }
37370 else {
37371 // we are not active, so callback for everything, walk the entire path
37372 this.depthFirstSearchEverything(this.pathRoot.rowNode, callback, traverseLeafNodes);
37373 }
37374 };
37375 ChangedPath.prototype.executeFromRootNode = function (callback) {
37376 callback(this.pathRoot.rowNode);
37377 };
37378 ChangedPath.prototype.createPathItems = function (rowNode) {
37379 var pointer = rowNode;
37380 var newEntryCount = 0;
37381 while (!this.mapToItems[pointer.id]) {
37382 var newEntry = {
37383 rowNode: pointer,
37384 children: null
37385 };
37386 this.mapToItems[pointer.id] = newEntry;
37387 newEntryCount++;
37388 pointer = pointer.parent;
37389 }
37390 return newEntryCount;
37391 };
37392 ChangedPath.prototype.populateColumnsMap = function (rowNode, columns) {
37393 var _this = this;
37394 if (!this.keepingColumns || !columns) {
37395 return;
37396 }
37397 var pointer = rowNode;
37398 while (pointer) {
37399 // if columns, add the columns in all the way to parent, merging
37400 // in any other columns that might be there already
37401 if (!this.nodeIdsToColumns[pointer.id]) {
37402 this.nodeIdsToColumns[pointer.id] = {};
37403 }
37404 columns.forEach(function (col) { return _this.nodeIdsToColumns[pointer.id][col.getId()] = true; });
37405 pointer = pointer.parent;
37406 }
37407 };
37408 ChangedPath.prototype.linkPathItems = function (rowNode, newEntryCount) {
37409 var pointer = rowNode;
37410 for (var i = 0; i < newEntryCount; i++) {
37411 var thisItem = this.mapToItems[pointer.id];
37412 var parentItem = this.mapToItems[pointer.parent.id];
37413 if (!parentItem.children) {
37414 parentItem.children = [];
37415 }
37416 parentItem.children.push(thisItem);
37417 pointer = pointer.parent;
37418 }
37419 };
37420 // called by
37421 // 1) change detection (provides cols) and
37422 // 2) groupStage if doing transaction update (doesn't provide cols)
37423 ChangedPath.prototype.addParentNode = function (rowNode, columns) {
37424 if (!rowNode || rowNode.isRowPinned()) {
37425 return;
37426 }
37427 // we cannot do both steps below in the same loop as
37428 // the second loop has a dependency on the first loop.
37429 // ie the hierarchy cannot be stitched up yet because
37430 // we don't have it built yet
37431 // create the new PathItem objects.
37432 var newEntryCount = this.createPathItems(rowNode);
37433 // link in the node items
37434 this.linkPathItems(rowNode, newEntryCount);
37435 // update columns
37436 this.populateColumnsMap(rowNode, columns);
37437 };
37438 ChangedPath.prototype.canSkip = function (rowNode) {
37439 return this.active && !this.mapToItems[rowNode.id];
37440 };
37441 ChangedPath.prototype.getValueColumnsForNode = function (rowNode, valueColumns) {
37442 if (!this.keepingColumns) {
37443 return valueColumns;
37444 }
37445 var colsForThisNode = this.nodeIdsToColumns[rowNode.id];
37446 var result = valueColumns.filter(function (col) { return colsForThisNode[col.getId()]; });
37447 return result;
37448 };
37449 ChangedPath.prototype.getNotValueColumnsForNode = function (rowNode, valueColumns) {
37450 if (!this.keepingColumns) {
37451 return null;
37452 }
37453 var colsForThisNode = this.nodeIdsToColumns[rowNode.id];
37454 var result = valueColumns.filter(function (col) { return !colsForThisNode[col.getId()]; });
37455 return result;
37456 };
37457 return ChangedPath;
37458}());
37459
37460/**
37461 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
37462 * @version v27.3.0
37463 * @link https://www.ag-grid.com/
37464 * @license MIT
37465 */
37466var __extends$1L = (undefined && undefined.__extends) || (function () {
37467 var extendStatics = function (d, b) {
37468 extendStatics = Object.setPrototypeOf ||
37469 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
37470 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
37471 return extendStatics(d, b);
37472 };
37473 return function (d, b) {
37474 extendStatics(d, b);
37475 function __() { this.constructor = d; }
37476 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37477 };
37478})();
37479var RowNodeBlock = /** @class */ (function (_super) {
37480 __extends$1L(RowNodeBlock, _super);
37481 function RowNodeBlock(id) {
37482 var _this = _super.call(this) || this;
37483 _this.state = RowNodeBlock.STATE_WAITING_TO_LOAD;
37484 _this.version = 0;
37485 _this.id = id;
37486 return _this;
37487 }
37488 RowNodeBlock.prototype.getId = function () {
37489 return this.id;
37490 };
37491 RowNodeBlock.prototype.load = function () {
37492 this.state = RowNodeBlock.STATE_LOADING;
37493 this.loadFromDatasource();
37494 };
37495 RowNodeBlock.prototype.getVersion = function () {
37496 return this.version;
37497 };
37498 RowNodeBlock.prototype.setStateWaitingToLoad = function () {
37499 // in case any current loads in progress, this will have their results ignored
37500 this.version++;
37501 this.state = RowNodeBlock.STATE_WAITING_TO_LOAD;
37502 };
37503 RowNodeBlock.prototype.getState = function () {
37504 return this.state;
37505 };
37506 RowNodeBlock.prototype.pageLoadFailed = function (version) {
37507 var requestMostRecentAndLive = this.isRequestMostRecentAndLive(version);
37508 if (requestMostRecentAndLive) {
37509 this.state = RowNodeBlock.STATE_FAILED;
37510 this.processServerFail();
37511 }
37512 this.dispatchLoadCompleted(false);
37513 };
37514 RowNodeBlock.prototype.success = function (version, params) {
37515 this.successCommon(version, params);
37516 };
37517 RowNodeBlock.prototype.pageLoaded = function (version, rows, lastRow) {
37518 this.successCommon(version, { rowData: rows, rowCount: lastRow });
37519 };
37520 RowNodeBlock.prototype.isRequestMostRecentAndLive = function (version) {
37521 // thisIsMostRecentRequest - if block was refreshed, then another request
37522 // could of been sent after this one.
37523 var thisIsMostRecentRequest = version === this.version;
37524 // weAreNotDestroyed - if InfiniteStore is purged, then blocks are destroyed
37525 // and new blocks created. so data loads of old blocks are discarded.
37526 var weAreNotDestroyed = this.isAlive();
37527 return thisIsMostRecentRequest && weAreNotDestroyed;
37528 };
37529 RowNodeBlock.prototype.successCommon = function (version, params) {
37530 // need to dispatch load complete before processing the data, as PaginationComp checks
37531 // RowNodeBlockLoader to see if it is still loading, so the RowNodeBlockLoader needs to
37532 // be updated first (via LoadComplete event) before PaginationComp updates (via processServerResult method)
37533 this.dispatchLoadCompleted();
37534 var requestMostRecentAndLive = this.isRequestMostRecentAndLive(version);
37535 if (requestMostRecentAndLive) {
37536 this.state = RowNodeBlock.STATE_LOADED;
37537 this.processServerResult(params);
37538 }
37539 };
37540 RowNodeBlock.prototype.dispatchLoadCompleted = function (success) {
37541 if (success === void 0) { success = true; }
37542 // we fire event regardless of processing data or now, as we want
37543 // the concurrentLoadRequests count to be reduced in BlockLoader
37544 var event = {
37545 type: RowNodeBlock.EVENT_LOAD_COMPLETE,
37546 success: success,
37547 block: this
37548 };
37549 this.dispatchEvent(event);
37550 };
37551 RowNodeBlock.EVENT_LOAD_COMPLETE = 'loadComplete';
37552 RowNodeBlock.STATE_WAITING_TO_LOAD = 'needsLoading';
37553 RowNodeBlock.STATE_LOADING = 'loading';
37554 RowNodeBlock.STATE_LOADED = 'loaded';
37555 RowNodeBlock.STATE_FAILED = 'failed';
37556 return RowNodeBlock;
37557}(BeanStub));
37558
37559/**
37560 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
37561 * @version v27.3.0
37562 * @link https://www.ag-grid.com/
37563 * @license MIT
37564 */
37565var __extends$1M = (undefined && undefined.__extends) || (function () {
37566 var extendStatics = function (d, b) {
37567 extendStatics = Object.setPrototypeOf ||
37568 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
37569 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
37570 return extendStatics(d, b);
37571 };
37572 return function (d, b) {
37573 extendStatics(d, b);
37574 function __() { this.constructor = d; }
37575 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37576 };
37577})();
37578var __decorate$1y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
37579 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
37580 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37581 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;
37582 return c > 3 && r && Object.defineProperty(target, key, r), r;
37583};
37584var __param$4 = (undefined && undefined.__param) || function (paramIndex, decorator) {
37585 return function (target, key) { decorator(target, key, paramIndex); }
37586};
37587var RowNodeBlockLoader = /** @class */ (function (_super) {
37588 __extends$1M(RowNodeBlockLoader, _super);
37589 function RowNodeBlockLoader() {
37590 var _this = _super !== null && _super.apply(this, arguments) || this;
37591 _this.activeBlockLoadsCount = 0;
37592 _this.blocks = [];
37593 _this.active = true;
37594 return _this;
37595 }
37596 RowNodeBlockLoader_1 = RowNodeBlockLoader;
37597 RowNodeBlockLoader.prototype.postConstruct = function () {
37598 this.maxConcurrentRequests = this.gridOptionsWrapper.getMaxConcurrentDatasourceRequests();
37599 var blockLoadDebounceMillis = this.gridOptionsWrapper.getBlockLoadDebounceMillis();
37600 if (blockLoadDebounceMillis && blockLoadDebounceMillis > 0) {
37601 this.checkBlockToLoadDebounce = _.debounce(this.performCheckBlocksToLoad.bind(this), blockLoadDebounceMillis);
37602 }
37603 };
37604 RowNodeBlockLoader.prototype.setBeans = function (loggerFactory) {
37605 this.logger = loggerFactory.create('RowNodeBlockLoader');
37606 };
37607 RowNodeBlockLoader.prototype.addBlock = function (block) {
37608 this.blocks.push(block);
37609 // note that we do not remove this listener when removing the block. this is because the
37610 // cache can get destroyed (and containing blocks) when a block is loading. however the loading block
37611 // is still counted as an active loading block and we must decrement activeBlockLoadsCount when it finishes.
37612 block.addEventListener(RowNodeBlock.EVENT_LOAD_COMPLETE, this.loadComplete.bind(this));
37613 this.checkBlockToLoad();
37614 };
37615 RowNodeBlockLoader.prototype.removeBlock = function (block) {
37616 _.removeFromArray(this.blocks, block);
37617 };
37618 RowNodeBlockLoader.prototype.destroy = function () {
37619 _super.prototype.destroy.call(this);
37620 this.active = false;
37621 };
37622 RowNodeBlockLoader.prototype.loadComplete = function () {
37623 this.activeBlockLoadsCount--;
37624 this.checkBlockToLoad();
37625 if (this.activeBlockLoadsCount == 0) {
37626 this.dispatchEvent({ type: RowNodeBlockLoader_1.BLOCK_LOADER_FINISHED_EVENT });
37627 }
37628 };
37629 RowNodeBlockLoader.prototype.checkBlockToLoad = function () {
37630 if (this.checkBlockToLoadDebounce) {
37631 this.checkBlockToLoadDebounce();
37632 }
37633 else {
37634 this.performCheckBlocksToLoad();
37635 }
37636 };
37637 RowNodeBlockLoader.prototype.performCheckBlocksToLoad = function () {
37638 if (!this.active) {
37639 return;
37640 }
37641 this.printCacheStatus();
37642 if (this.maxConcurrentRequests != null && this.activeBlockLoadsCount >= this.maxConcurrentRequests) {
37643 this.logger.log("checkBlockToLoad: max loads exceeded");
37644 return;
37645 }
37646 var blockToLoad = null;
37647 this.blocks.forEach(function (block) {
37648 if (block.getState() === RowNodeBlock.STATE_WAITING_TO_LOAD) {
37649 blockToLoad = block;
37650 }
37651 });
37652 if (blockToLoad) {
37653 blockToLoad.load();
37654 this.activeBlockLoadsCount++;
37655 this.printCacheStatus();
37656 }
37657 };
37658 RowNodeBlockLoader.prototype.getBlockState = function () {
37659 var result = {};
37660 this.blocks.forEach(function (block) {
37661 var _a = block.getBlockStateJson(), id = _a.id, state = _a.state;
37662 result[id] = state;
37663 });
37664 return result;
37665 };
37666 RowNodeBlockLoader.prototype.printCacheStatus = function () {
37667 if (this.logger.isLogging()) {
37668 this.logger.log("printCacheStatus: activePageLoadsCount = " + this.activeBlockLoadsCount + ","
37669 + (" blocks = " + JSON.stringify(this.getBlockState())));
37670 }
37671 };
37672 RowNodeBlockLoader.prototype.isLoading = function () {
37673 return this.activeBlockLoadsCount > 0;
37674 };
37675 var RowNodeBlockLoader_1;
37676 RowNodeBlockLoader.BLOCK_LOADER_FINISHED_EVENT = 'blockLoaderFinished';
37677 __decorate$1y([
37678 PostConstruct
37679 ], RowNodeBlockLoader.prototype, "postConstruct", null);
37680 __decorate$1y([
37681 __param$4(0, Qualifier('loggerFactory'))
37682 ], RowNodeBlockLoader.prototype, "setBeans", null);
37683 RowNodeBlockLoader = RowNodeBlockLoader_1 = __decorate$1y([
37684 Bean('rowNodeBlockLoader')
37685 ], RowNodeBlockLoader);
37686 return RowNodeBlockLoader;
37687}(BeanStub));
37688
37689/**
37690 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
37691 * @version v27.3.0
37692 * @link https://www.ag-grid.com/
37693 * @license MIT
37694 */
37695var __extends$1N = (undefined && undefined.__extends) || (function () {
37696 var extendStatics = function (d, b) {
37697 extendStatics = Object.setPrototypeOf ||
37698 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
37699 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
37700 return extendStatics(d, b);
37701 };
37702 return function (d, b) {
37703 extendStatics(d, b);
37704 function __() { this.constructor = d; }
37705 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37706 };
37707})();
37708var __decorate$1z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
37709 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
37710 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37711 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;
37712 return c > 3 && r && Object.defineProperty(target, key, r), r;
37713};
37714var PaginationProxy = /** @class */ (function (_super) {
37715 __extends$1N(PaginationProxy, _super);
37716 function PaginationProxy() {
37717 var _this = _super !== null && _super.apply(this, arguments) || this;
37718 _this.currentPage = 0;
37719 _this.topDisplayedRowIndex = 0;
37720 _this.bottomDisplayedRowIndex = 0;
37721 _this.pixelOffset = 0;
37722 _this.masterRowCount = 0;
37723 return _this;
37724 }
37725 PaginationProxy.prototype.postConstruct = function () {
37726 this.active = this.gridOptionsWrapper.isPagination();
37727 this.paginateChildRows = this.gridOptionsWrapper.isPaginateChildRows();
37728 this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));
37729 this.addManagedListener(this.gridOptionsWrapper, 'paginationPageSize', this.onPaginationPageSizeChanged.bind(this));
37730 this.onModelUpdated();
37731 };
37732 PaginationProxy.prototype.ensureRowHeightsValid = function (startPixel, endPixel, startLimitIndex, endLimitIndex) {
37733 var res = this.rowModel.ensureRowHeightsValid(startPixel, endPixel, this.getPageFirstRow(), this.getPageLastRow());
37734 if (res) {
37735 this.calculatePages();
37736 }
37737 return res;
37738 };
37739 PaginationProxy.prototype.onModelUpdated = function (modelUpdatedEvent) {
37740 this.calculatePages();
37741 var paginationChangedEvent = {
37742 type: Events.EVENT_PAGINATION_CHANGED,
37743 animate: modelUpdatedEvent ? modelUpdatedEvent.animate : false,
37744 newData: modelUpdatedEvent ? modelUpdatedEvent.newData : false,
37745 newPage: modelUpdatedEvent ? modelUpdatedEvent.newPage : false,
37746 keepRenderedRows: modelUpdatedEvent ? modelUpdatedEvent.keepRenderedRows : false,
37747 api: this.gridApi,
37748 columnApi: this.columnApi
37749 };
37750 this.eventService.dispatchEvent(paginationChangedEvent);
37751 };
37752 PaginationProxy.prototype.onPaginationPageSizeChanged = function () {
37753 this.calculatePages();
37754 var paginationChangedEvent = {
37755 type: Events.EVENT_PAGINATION_CHANGED,
37756 animate: false,
37757 newData: false,
37758 newPage: false,
37759 // important to keep rendered rows, otherwise every time grid is resized,
37760 // we would destroy all the rows.
37761 keepRenderedRows: true,
37762 api: this.gridApi,
37763 columnApi: this.columnApi
37764 };
37765 this.eventService.dispatchEvent(paginationChangedEvent);
37766 };
37767 PaginationProxy.prototype.goToPage = function (page) {
37768 if (!this.active || this.currentPage === page) {
37769 return;
37770 }
37771 this.currentPage = page;
37772 var event = {
37773 type: Events.EVENT_MODEL_UPDATED,
37774 animate: false,
37775 keepRenderedRows: false,
37776 newData: false,
37777 newPage: true,
37778 api: this.gridApi,
37779 columnApi: this.columnApi
37780 };
37781 this.onModelUpdated(event);
37782 };
37783 PaginationProxy.prototype.getPixelOffset = function () {
37784 return this.pixelOffset;
37785 };
37786 PaginationProxy.prototype.getRow = function (index) {
37787 return this.rowModel.getRow(index);
37788 };
37789 PaginationProxy.prototype.getRowNode = function (id) {
37790 return this.rowModel.getRowNode(id);
37791 };
37792 PaginationProxy.prototype.getRowIndexAtPixel = function (pixel) {
37793 return this.rowModel.getRowIndexAtPixel(pixel);
37794 };
37795 PaginationProxy.prototype.getCurrentPageHeight = function () {
37796 if (missing(this.topRowBounds) || missing(this.bottomRowBounds)) {
37797 return 0;
37798 }
37799 return Math.max(this.bottomRowBounds.rowTop + this.bottomRowBounds.rowHeight - this.topRowBounds.rowTop, 0);
37800 };
37801 PaginationProxy.prototype.getCurrentPagePixelRange = function () {
37802 var pageFirstPixel = this.topRowBounds ? this.topRowBounds.rowTop : 0;
37803 var pageLastPixel = this.bottomRowBounds ? this.bottomRowBounds.rowTop + this.bottomRowBounds.rowHeight : 0;
37804 return { pageFirstPixel: pageFirstPixel, pageLastPixel: pageLastPixel };
37805 };
37806 PaginationProxy.prototype.isRowPresent = function (rowNode) {
37807 if (!this.rowModel.isRowPresent(rowNode)) {
37808 return false;
37809 }
37810 var nodeIsInPage = rowNode.rowIndex >= this.topDisplayedRowIndex && rowNode.rowIndex <= this.bottomDisplayedRowIndex;
37811 return nodeIsInPage;
37812 };
37813 PaginationProxy.prototype.isEmpty = function () {
37814 return this.rowModel.isEmpty();
37815 };
37816 PaginationProxy.prototype.isRowsToRender = function () {
37817 return this.rowModel.isRowsToRender();
37818 };
37819 PaginationProxy.prototype.getNodesInRangeForSelection = function (firstInRange, lastInRange) {
37820 return this.rowModel.getNodesInRangeForSelection(firstInRange, lastInRange);
37821 };
37822 PaginationProxy.prototype.forEachNode = function (callback) {
37823 return this.rowModel.forEachNode(callback);
37824 };
37825 PaginationProxy.prototype.getType = function () {
37826 return this.rowModel.getType();
37827 };
37828 PaginationProxy.prototype.getRowBounds = function (index) {
37829 var res = this.rowModel.getRowBounds(index);
37830 res.rowIndex = index;
37831 return res;
37832 };
37833 PaginationProxy.prototype.getPageFirstRow = function () {
37834 return this.topRowBounds ? this.topRowBounds.rowIndex : -1;
37835 };
37836 PaginationProxy.prototype.getPageLastRow = function () {
37837 return this.bottomRowBounds ? this.bottomRowBounds.rowIndex : -1;
37838 };
37839 PaginationProxy.prototype.getRowCount = function () {
37840 return this.rowModel.getRowCount();
37841 };
37842 PaginationProxy.prototype.getPageForIndex = function (index) {
37843 return Math.floor(index / this.pageSize);
37844 };
37845 PaginationProxy.prototype.goToPageWithIndex = function (index) {
37846 if (!this.active) {
37847 return;
37848 }
37849 var pageNumber = this.getPageForIndex(index);
37850 this.goToPage(pageNumber);
37851 };
37852 PaginationProxy.prototype.isRowInPage = function (row) {
37853 if (!this.active) {
37854 return true;
37855 }
37856 var rowPage = this.getPageForIndex(row.rowIndex);
37857 return rowPage === this.currentPage;
37858 };
37859 PaginationProxy.prototype.isLastPageFound = function () {
37860 return this.rowModel.isLastRowIndexKnown();
37861 };
37862 PaginationProxy.prototype.getCurrentPage = function () {
37863 return this.currentPage;
37864 };
37865 PaginationProxy.prototype.goToNextPage = function () {
37866 this.goToPage(this.currentPage + 1);
37867 };
37868 PaginationProxy.prototype.goToPreviousPage = function () {
37869 this.goToPage(this.currentPage - 1);
37870 };
37871 PaginationProxy.prototype.goToFirstPage = function () {
37872 this.goToPage(0);
37873 };
37874 PaginationProxy.prototype.goToLastPage = function () {
37875 var rowCount = this.rowModel.getRowCount();
37876 var lastPage = Math.floor(rowCount / this.pageSize);
37877 this.goToPage(lastPage);
37878 };
37879 PaginationProxy.prototype.getPageSize = function () {
37880 return this.pageSize;
37881 };
37882 PaginationProxy.prototype.getTotalPages = function () {
37883 return this.totalPages;
37884 };
37885 PaginationProxy.prototype.setPageSize = function () {
37886 // show put this into super class
37887 this.pageSize = this.gridOptionsWrapper.getPaginationPageSize();
37888 if (this.pageSize == null || this.pageSize < 1) {
37889 this.pageSize = 100;
37890 }
37891 };
37892 PaginationProxy.prototype.calculatePages = function () {
37893 if (this.active) {
37894 this.setPageSize();
37895 if (this.paginateChildRows) {
37896 this.calculatePagesAllRows();
37897 }
37898 else {
37899 this.calculatePagesMasterRowsOnly();
37900 }
37901 }
37902 else {
37903 this.calculatedPagesNotActive();
37904 }
37905 this.topRowBounds = this.rowModel.getRowBounds(this.topDisplayedRowIndex);
37906 if (this.topRowBounds) {
37907 this.topRowBounds.rowIndex = this.topDisplayedRowIndex;
37908 }
37909 this.bottomRowBounds = this.rowModel.getRowBounds(this.bottomDisplayedRowIndex);
37910 if (this.bottomRowBounds) {
37911 this.bottomRowBounds.rowIndex = this.bottomDisplayedRowIndex;
37912 }
37913 this.setPixelOffset(exists(this.topRowBounds) ? this.topRowBounds.rowTop : 0);
37914 };
37915 PaginationProxy.prototype.setPixelOffset = function (value) {
37916 if (this.pixelOffset === value) {
37917 return;
37918 }
37919 this.pixelOffset = value;
37920 this.eventService.dispatchEvent({ type: Events.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED });
37921 };
37922 PaginationProxy.prototype.setZeroRows = function () {
37923 this.masterRowCount = 0;
37924 this.topDisplayedRowIndex = 0;
37925 this.bottomDisplayedRowIndex = -1;
37926 this.currentPage = 0;
37927 this.totalPages = 0;
37928 };
37929 PaginationProxy.prototype.calculatePagesMasterRowsOnly = function () {
37930 // const csrm = <ClientSideRowModel> this.rowModel;
37931 // const rootNode = csrm.getRootNode();
37932 // const masterRows = rootNode.childrenAfterSort;
37933 this.masterRowCount = this.rowModel.getTopLevelRowCount();
37934 // we say <=0 (rather than =0) as viewport returns -1 when no rows
37935 if (this.masterRowCount <= 0) {
37936 this.setZeroRows();
37937 return;
37938 }
37939 var masterLastRowIndex = this.masterRowCount - 1;
37940 this.totalPages = Math.floor((masterLastRowIndex) / this.pageSize) + 1;
37941 if (this.currentPage >= this.totalPages) {
37942 this.currentPage = this.totalPages - 1;
37943 }
37944 if (!isNumeric(this.currentPage) || this.currentPage < 0) {
37945 this.currentPage = 0;
37946 }
37947 var masterPageStartIndex = this.pageSize * this.currentPage;
37948 var masterPageEndIndex = (this.pageSize * (this.currentPage + 1)) - 1;
37949 if (masterPageEndIndex > masterLastRowIndex) {
37950 masterPageEndIndex = masterLastRowIndex;
37951 }
37952 this.topDisplayedRowIndex = this.rowModel.getTopLevelRowDisplayedIndex(masterPageStartIndex);
37953 // masterRows[masterPageStartIndex].rowIndex;
37954 if (masterPageEndIndex === masterLastRowIndex) {
37955 // if showing the last master row, then we want to show the very last row of the model
37956 this.bottomDisplayedRowIndex = this.rowModel.getRowCount() - 1;
37957 }
37958 else {
37959 var firstIndexNotToShow = this.rowModel.getTopLevelRowDisplayedIndex(masterPageEndIndex + 1);
37960 //masterRows[masterPageEndIndex + 1].rowIndex;
37961 // this gets the index of the last child - eg current row is open, we want to display all children,
37962 // the index of the last child is one less than the index of the next parent row.
37963 this.bottomDisplayedRowIndex = firstIndexNotToShow - 1;
37964 }
37965 };
37966 PaginationProxy.prototype.getMasterRowCount = function () {
37967 return this.masterRowCount;
37968 };
37969 PaginationProxy.prototype.calculatePagesAllRows = function () {
37970 this.masterRowCount = this.rowModel.getRowCount();
37971 if (this.masterRowCount === 0) {
37972 this.setZeroRows();
37973 return;
37974 }
37975 var maxRowIndex = this.masterRowCount - 1;
37976 this.totalPages = Math.floor((maxRowIndex) / this.pageSize) + 1;
37977 if (this.currentPage >= this.totalPages) {
37978 this.currentPage = this.totalPages - 1;
37979 }
37980 if (!isNumeric(this.currentPage) || this.currentPage < 0) {
37981 this.currentPage = 0;
37982 }
37983 this.topDisplayedRowIndex = this.pageSize * this.currentPage;
37984 this.bottomDisplayedRowIndex = (this.pageSize * (this.currentPage + 1)) - 1;
37985 if (this.bottomDisplayedRowIndex > maxRowIndex) {
37986 this.bottomDisplayedRowIndex = maxRowIndex;
37987 }
37988 };
37989 PaginationProxy.prototype.calculatedPagesNotActive = function () {
37990 this.pageSize = this.rowModel.getRowCount();
37991 this.totalPages = 1;
37992 this.currentPage = 0;
37993 this.topDisplayedRowIndex = 0;
37994 this.bottomDisplayedRowIndex = this.rowModel.getRowCount() - 1;
37995 };
37996 __decorate$1z([
37997 Autowired('rowModel')
37998 ], PaginationProxy.prototype, "rowModel", void 0);
37999 __decorate$1z([
38000 Autowired('columnApi')
38001 ], PaginationProxy.prototype, "columnApi", void 0);
38002 __decorate$1z([
38003 Autowired('gridApi')
38004 ], PaginationProxy.prototype, "gridApi", void 0);
38005 __decorate$1z([
38006 PostConstruct
38007 ], PaginationProxy.prototype, "postConstruct", null);
38008 PaginationProxy = __decorate$1z([
38009 Bean('paginationProxy')
38010 ], PaginationProxy);
38011 return PaginationProxy;
38012}(BeanStub));
38013
38014/**
38015 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38016 * @version v27.3.0
38017 * @link https://www.ag-grid.com/
38018 * @license MIT
38019 */
38020var __extends$1O = (undefined && undefined.__extends) || (function () {
38021 var extendStatics = function (d, b) {
38022 extendStatics = Object.setPrototypeOf ||
38023 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38024 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38025 return extendStatics(d, b);
38026 };
38027 return function (d, b) {
38028 extendStatics(d, b);
38029 function __() { this.constructor = d; }
38030 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38031 };
38032})();
38033var __decorate$1A = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
38034 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
38035 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
38036 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;
38037 return c > 3 && r && Object.defineProperty(target, key, r), r;
38038};
38039var StylingService = /** @class */ (function (_super) {
38040 __extends$1O(StylingService, _super);
38041 function StylingService() {
38042 return _super !== null && _super.apply(this, arguments) || this;
38043 }
38044 StylingService.prototype.processAllCellClasses = function (colDef, params, onApplicableClass, onNotApplicableClass) {
38045 this.processClassRules(colDef.cellClassRules, params, onApplicableClass, onNotApplicableClass);
38046 this.processStaticCellClasses(colDef, params, onApplicableClass);
38047 };
38048 StylingService.prototype.processClassRules = function (classRules, params, onApplicableClass, onNotApplicableClass) {
38049 if (classRules == null) {
38050 return;
38051 }
38052 var classNames = Object.keys(classRules);
38053 var classesToApply = {};
38054 var classesToRemove = {};
38055 var _loop_1 = function (i) {
38056 var className = classNames[i];
38057 var rule = classRules[className];
38058 var resultOfRule;
38059 if (typeof rule === 'string') {
38060 resultOfRule = this_1.expressionService.evaluate(rule, params);
38061 }
38062 else if (typeof rule === 'function') {
38063 resultOfRule = rule(params);
38064 }
38065 // in case className = 'my-class1 my-class2', we need to split into individual class names
38066 className.split(' ').forEach(function (singleClass) {
38067 if (singleClass == null || singleClass.trim() == '') {
38068 return;
38069 }
38070 resultOfRule ? classesToApply[singleClass] = true : classesToRemove[singleClass] = true;
38071 });
38072 };
38073 var this_1 = this;
38074 for (var i = 0; i < classNames.length; i++) {
38075 _loop_1(i);
38076 }
38077 // we remove all classes first, then add all classes second,
38078 // in case a class appears in more than one rule, this means it will be added
38079 // if appears in at least one truthy rule
38080 if (onNotApplicableClass) {
38081 Object.keys(classesToRemove).forEach(onNotApplicableClass);
38082 }
38083 Object.keys(classesToApply).forEach(onApplicableClass);
38084 };
38085 StylingService.prototype.getStaticCellClasses = function (colDef, params) {
38086 var cellClass = colDef.cellClass;
38087 if (!cellClass) {
38088 return [];
38089 }
38090 var classOrClasses;
38091 if (typeof cellClass === 'function') {
38092 var cellClassFunc = cellClass;
38093 classOrClasses = cellClassFunc(params);
38094 }
38095 else {
38096 classOrClasses = cellClass;
38097 }
38098 if (typeof classOrClasses === 'string') {
38099 classOrClasses = [classOrClasses];
38100 }
38101 return classOrClasses || [];
38102 };
38103 StylingService.prototype.processStaticCellClasses = function (colDef, params, onApplicableClass) {
38104 var classOrClasses = this.getStaticCellClasses(colDef, params);
38105 classOrClasses.forEach(function (cssClassItem) {
38106 onApplicableClass(cssClassItem);
38107 });
38108 };
38109 __decorate$1A([
38110 Autowired('expressionService')
38111 ], StylingService.prototype, "expressionService", void 0);
38112 StylingService = __decorate$1A([
38113 Bean('stylingService')
38114 ], StylingService);
38115 return StylingService;
38116}(BeanStub));
38117
38118/**
38119 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38120 * @version v27.3.0
38121 * @link https://www.ag-grid.com/
38122 * @license MIT
38123 */
38124var __extends$1P = (undefined && undefined.__extends) || (function () {
38125 var extendStatics = function (d, b) {
38126 extendStatics = Object.setPrototypeOf ||
38127 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38128 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38129 return extendStatics(d, b);
38130 };
38131 return function (d, b) {
38132 extendStatics(d, b);
38133 function __() { this.constructor = d; }
38134 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38135 };
38136})();
38137var AgRadioButton = /** @class */ (function (_super) {
38138 __extends$1P(AgRadioButton, _super);
38139 function AgRadioButton(config) {
38140 return _super.call(this, config, 'ag-radio-button', 'radio') || this;
38141 }
38142 AgRadioButton.prototype.isSelected = function () {
38143 return this.eInput.checked;
38144 };
38145 AgRadioButton.prototype.toggle = function () {
38146 if (this.eInput.disabled) {
38147 return;
38148 }
38149 // do not allow an active radio button to be deselected
38150 if (!this.isSelected()) {
38151 this.setValue(true);
38152 }
38153 };
38154 AgRadioButton.prototype.addInputListeners = function () {
38155 _super.prototype.addInputListeners.call(this);
38156 this.addManagedListener(this.eventService, Events.EVENT_CHECKBOX_CHANGED, this.onChange.bind(this));
38157 };
38158 /**
38159 * This ensures that if another radio button in the same named group is selected, we deselect this radio button.
38160 * By default the browser does this for you, but we are managing classes ourselves in order to ensure input
38161 * elements are styled correctly in IE11, and the DOM 'changed' event is only fired when a button is selected,
38162 * not deselected, so we need to use our own event.
38163 */
38164 AgRadioButton.prototype.onChange = function (event) {
38165 if (event.selected &&
38166 event.name &&
38167 this.eInput.name &&
38168 this.eInput.name === event.name &&
38169 event.id &&
38170 this.eInput.id !== event.id) {
38171 this.setValue(false, true);
38172 }
38173 };
38174 return AgRadioButton;
38175}(AgCheckbox));
38176
38177/**
38178 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38179 * @version v27.3.0
38180 * @link https://www.ag-grid.com/
38181 * @license MIT
38182 */
38183var __extends$1Q = (undefined && undefined.__extends) || (function () {
38184 var extendStatics = function (d, b) {
38185 extendStatics = Object.setPrototypeOf ||
38186 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38187 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38188 return extendStatics(d, b);
38189 };
38190 return function (d, b) {
38191 extendStatics(d, b);
38192 function __() { this.constructor = d; }
38193 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38194 };
38195})();
38196var AgToggleButton = /** @class */ (function (_super) {
38197 __extends$1Q(AgToggleButton, _super);
38198 function AgToggleButton(config) {
38199 return _super.call(this, config, 'ag-toggle-button') || this;
38200 }
38201 AgToggleButton.prototype.setValue = function (value, silent) {
38202 _super.prototype.setValue.call(this, value, silent);
38203 this.addOrRemoveCssClass('ag-selected', this.getValue());
38204 return this;
38205 };
38206 return AgToggleButton;
38207}(AgCheckbox));
38208
38209/**
38210 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38211 * @version v27.3.0
38212 * @link https://www.ag-grid.com/
38213 * @license MIT
38214 */
38215var __extends$1R = (undefined && undefined.__extends) || (function () {
38216 var extendStatics = function (d, b) {
38217 extendStatics = Object.setPrototypeOf ||
38218 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38219 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38220 return extendStatics(d, b);
38221 };
38222 return function (d, b) {
38223 extendStatics(d, b);
38224 function __() { this.constructor = d; }
38225 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38226 };
38227})();
38228var AgInputTextField = /** @class */ (function (_super) {
38229 __extends$1R(AgInputTextField, _super);
38230 function AgInputTextField(config, className, inputType) {
38231 if (className === void 0) { className = 'ag-text-field'; }
38232 if (inputType === void 0) { inputType = 'text'; }
38233 return _super.call(this, config, className, inputType) || this;
38234 }
38235 AgInputTextField.prototype.postConstruct = function () {
38236 _super.prototype.postConstruct.call(this);
38237 if (this.config.allowedCharPattern) {
38238 this.preventDisallowedCharacters();
38239 }
38240 };
38241 AgInputTextField.prototype.setValue = function (value, silent) {
38242 var ret = _super.prototype.setValue.call(this, value, silent);
38243 if (this.eInput.value !== value) {
38244 this.eInput.value = exists(value) ? value : '';
38245 }
38246 return ret;
38247 };
38248 AgInputTextField.prototype.preventDisallowedCharacters = function () {
38249 var pattern = new RegExp("[" + this.config.allowedCharPattern + "]");
38250 var preventDisallowedCharacters = function (event) {
38251 if (event.key && !pattern.test(event.key)) {
38252 event.preventDefault();
38253 }
38254 };
38255 this.addManagedListener(this.eInput, 'keypress', preventDisallowedCharacters);
38256 this.addManagedListener(this.eInput, 'paste', function (e) {
38257 var _a;
38258 var text = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text');
38259 if (text && text.split('').some(function (c) { return !pattern.test(c); })) {
38260 e.preventDefault();
38261 }
38262 });
38263 };
38264 return AgInputTextField;
38265}(AgAbstractInputField));
38266
38267/**
38268 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38269 * @version v27.3.0
38270 * @link https://www.ag-grid.com/
38271 * @license MIT
38272 */
38273var __extends$1S = (undefined && undefined.__extends) || (function () {
38274 var extendStatics = function (d, b) {
38275 extendStatics = Object.setPrototypeOf ||
38276 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38277 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38278 return extendStatics(d, b);
38279 };
38280 return function (d, b) {
38281 extendStatics(d, b);
38282 function __() { this.constructor = d; }
38283 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38284 };
38285})();
38286var AgInputTextArea = /** @class */ (function (_super) {
38287 __extends$1S(AgInputTextArea, _super);
38288 function AgInputTextArea(config) {
38289 return _super.call(this, config, 'ag-text-area', null, 'textarea') || this;
38290 }
38291 AgInputTextArea.prototype.setValue = function (value, silent) {
38292 var ret = _super.prototype.setValue.call(this, value, silent);
38293 this.eInput.value = value;
38294 return ret;
38295 };
38296 AgInputTextArea.prototype.setCols = function (cols) {
38297 this.eInput.cols = cols;
38298 return this;
38299 };
38300 AgInputTextArea.prototype.setRows = function (rows) {
38301 this.eInput.rows = rows;
38302 return this;
38303 };
38304 return AgInputTextArea;
38305}(AgAbstractInputField));
38306
38307/**
38308 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38309 * @version v27.3.0
38310 * @link https://www.ag-grid.com/
38311 * @license MIT
38312 */
38313var __extends$1T = (undefined && undefined.__extends) || (function () {
38314 var extendStatics = function (d, b) {
38315 extendStatics = Object.setPrototypeOf ||
38316 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38317 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38318 return extendStatics(d, b);
38319 };
38320 return function (d, b) {
38321 extendStatics(d, b);
38322 function __() { this.constructor = d; }
38323 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38324 };
38325})();
38326var AgInputNumberField = /** @class */ (function (_super) {
38327 __extends$1T(AgInputNumberField, _super);
38328 function AgInputNumberField(config) {
38329 return _super.call(this, config, 'ag-number-field', 'number') || this;
38330 }
38331 AgInputNumberField.prototype.postConstruct = function () {
38332 var _this = this;
38333 _super.prototype.postConstruct.call(this);
38334 this.addManagedListener(this.eInput, 'blur', function () {
38335 var floatedValue = parseFloat(_this.eInput.value);
38336 var value = isNaN(floatedValue) ? '' : _this.normalizeValue(floatedValue.toString());
38337 if (_this.value !== value) {
38338 _this.setValue(value);
38339 }
38340 });
38341 this.eInput.step = 'any';
38342 };
38343 AgInputNumberField.prototype.normalizeValue = function (value) {
38344 if (value === '') {
38345 return '';
38346 }
38347 if (this.precision) {
38348 value = this.adjustPrecision(value);
38349 }
38350 var val = parseFloat(value);
38351 if (this.min != null && val < this.min) {
38352 value = this.min.toString();
38353 }
38354 else if (this.max != null && val > this.max) {
38355 value = this.max.toString();
38356 }
38357 return value;
38358 };
38359 AgInputNumberField.prototype.adjustPrecision = function (value) {
38360 if (this.precision) {
38361 var floatString = parseFloat(value).toFixed(this.precision);
38362 value = parseFloat(floatString).toString();
38363 }
38364 return value;
38365 };
38366 AgInputNumberField.prototype.setMin = function (min) {
38367 if (this.min === min) {
38368 return this;
38369 }
38370 this.min = min;
38371 addOrRemoveAttribute(this.eInput, 'min', min);
38372 return this;
38373 };
38374 AgInputNumberField.prototype.setMax = function (max) {
38375 if (this.max === max) {
38376 return this;
38377 }
38378 this.max = max;
38379 addOrRemoveAttribute(this.eInput, 'max', max);
38380 return this;
38381 };
38382 AgInputNumberField.prototype.setPrecision = function (precision) {
38383 this.precision = precision;
38384 return this;
38385 };
38386 AgInputNumberField.prototype.setStep = function (step) {
38387 if (this.step === step) {
38388 return this;
38389 }
38390 this.step = step;
38391 addOrRemoveAttribute(this.eInput, 'step', step);
38392 return this;
38393 };
38394 AgInputNumberField.prototype.setValue = function (value, silent) {
38395 value = this.adjustPrecision(value);
38396 var normalizedValue = this.normalizeValue(value);
38397 if (value != normalizedValue) {
38398 return this;
38399 }
38400 return _super.prototype.setValue.call(this, value, silent);
38401 };
38402 return AgInputNumberField;
38403}(AgInputTextField));
38404
38405/**
38406 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38407 * @version v27.3.0
38408 * @link https://www.ag-grid.com/
38409 * @license MIT
38410 */
38411var __extends$1U = (undefined && undefined.__extends) || (function () {
38412 var extendStatics = function (d, b) {
38413 extendStatics = Object.setPrototypeOf ||
38414 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38415 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38416 return extendStatics(d, b);
38417 };
38418 return function (d, b) {
38419 extendStatics(d, b);
38420 function __() { this.constructor = d; }
38421 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38422 };
38423})();
38424var AgInputRange = /** @class */ (function (_super) {
38425 __extends$1U(AgInputRange, _super);
38426 function AgInputRange(config) {
38427 return _super.call(this, config, 'ag-range-field', 'range') || this;
38428 }
38429 AgInputRange.prototype.postConstruct = function () {
38430 _super.prototype.postConstruct.call(this);
38431 var _a = this.config, min = _a.min, max = _a.max, step = _a.step;
38432 if (min != null) {
38433 this.setMinValue(min);
38434 }
38435 if (max != null) {
38436 this.setMaxValue(max);
38437 }
38438 this.setStep(step || 1);
38439 };
38440 AgInputRange.prototype.addInputListeners = function () {
38441 var _this = this;
38442 this.addManagedListener(this.eInput, 'input', function (e) {
38443 var value = e.target.value;
38444 _this.setValue(value);
38445 });
38446 };
38447 AgInputRange.prototype.setMinValue = function (value) {
38448 this.min = value;
38449 this.eInput.setAttribute('min', value.toString());
38450 return this;
38451 };
38452 AgInputRange.prototype.setMaxValue = function (value) {
38453 this.max = value;
38454 this.eInput.setAttribute('max', value.toString());
38455 return this;
38456 };
38457 AgInputRange.prototype.setStep = function (value) {
38458 this.eInput.setAttribute('step', value.toString());
38459 return this;
38460 };
38461 AgInputRange.prototype.setValue = function (value, silent) {
38462 if (this.min != null) {
38463 value = Math.max(parseFloat(value), this.min).toString();
38464 }
38465 if (this.max != null) {
38466 value = Math.min(parseFloat(value), this.max).toString();
38467 }
38468 var ret = _super.prototype.setValue.call(this, value, silent);
38469 this.eInput.value = value;
38470 return ret;
38471 };
38472 return AgInputRange;
38473}(AgAbstractInputField));
38474
38475/**
38476 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38477 * @version v27.3.0
38478 * @link https://www.ag-grid.com/
38479 * @license MIT
38480 */
38481var __extends$1V = (undefined && undefined.__extends) || (function () {
38482 var extendStatics = function (d, b) {
38483 extendStatics = Object.setPrototypeOf ||
38484 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38485 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38486 return extendStatics(d, b);
38487 };
38488 return function (d, b) {
38489 extendStatics(d, b);
38490 function __() { this.constructor = d; }
38491 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38492 };
38493})();
38494var __decorate$1B = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
38495 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
38496 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
38497 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;
38498 return c > 3 && r && Object.defineProperty(target, key, r), r;
38499};
38500var AgSlider = /** @class */ (function (_super) {
38501 __extends$1V(AgSlider, _super);
38502 function AgSlider(config) {
38503 var _this = _super.call(this, config, AgSlider.TEMPLATE) || this;
38504 _this.labelAlignment = 'top';
38505 return _this;
38506 }
38507 AgSlider.prototype.init = function () {
38508 this.eSlider.addCssClass('ag-slider-field');
38509 };
38510 AgSlider.prototype.onValueChange = function (callbackFn) {
38511 var _this = this;
38512 var eventChanged = AgAbstractField.EVENT_CHANGED;
38513 this.addManagedListener(this.eText, eventChanged, function () {
38514 var textValue = parseFloat(_this.eText.getValue());
38515 _this.eSlider.setValue(textValue.toString(), true);
38516 callbackFn(textValue || 0);
38517 });
38518 this.addManagedListener(this.eSlider, eventChanged, function () {
38519 var sliderValue = _this.eSlider.getValue();
38520 _this.eText.setValue(sliderValue, true);
38521 callbackFn(parseFloat(sliderValue));
38522 });
38523 return this;
38524 };
38525 AgSlider.prototype.setSliderWidth = function (width) {
38526 this.eSlider.setWidth(width);
38527 return this;
38528 };
38529 AgSlider.prototype.setTextFieldWidth = function (width) {
38530 this.eText.setWidth(width);
38531 return this;
38532 };
38533 AgSlider.prototype.setMinValue = function (minValue) {
38534 this.eSlider.setMinValue(minValue);
38535 this.eText.setMin(minValue);
38536 return this;
38537 };
38538 AgSlider.prototype.setMaxValue = function (maxValue) {
38539 this.eSlider.setMaxValue(maxValue);
38540 this.eText.setMax(maxValue);
38541 return this;
38542 };
38543 AgSlider.prototype.getValue = function () {
38544 return this.eText.getValue();
38545 };
38546 AgSlider.prototype.setValue = function (value) {
38547 if (this.getValue() === value) {
38548 return this;
38549 }
38550 this.eText.setValue(value, true);
38551 this.eSlider.setValue(value, true);
38552 this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
38553 return this;
38554 };
38555 AgSlider.prototype.setStep = function (step) {
38556 this.eSlider.setStep(step);
38557 this.eText.setStep(step);
38558 return this;
38559 };
38560 AgSlider.TEMPLATE = "<div class=\"ag-slider\">\n <label ref=\"eLabel\"></label>\n <div class=\"ag-wrapper ag-slider-wrapper\">\n <ag-input-range ref=\"eSlider\"></ag-input-range>\n <ag-input-number-field ref=\"eText\"></ag-input-number-field>\n </div>\n </div>";
38561 __decorate$1B([
38562 RefSelector('eLabel')
38563 ], AgSlider.prototype, "eLabel", void 0);
38564 __decorate$1B([
38565 RefSelector('eSlider')
38566 ], AgSlider.prototype, "eSlider", void 0);
38567 __decorate$1B([
38568 RefSelector('eText')
38569 ], AgSlider.prototype, "eText", void 0);
38570 __decorate$1B([
38571 PostConstruct
38572 ], AgSlider.prototype, "init", null);
38573 return AgSlider;
38574}(AgAbstractLabel));
38575
38576/**
38577 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38578 * @version v27.3.0
38579 * @link https://www.ag-grid.com/
38580 * @license MIT
38581 */
38582var __extends$1W = (undefined && undefined.__extends) || (function () {
38583 var extendStatics = function (d, b) {
38584 extendStatics = Object.setPrototypeOf ||
38585 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38586 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38587 return extendStatics(d, b);
38588 };
38589 return function (d, b) {
38590 extendStatics(d, b);
38591 function __() { this.constructor = d; }
38592 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38593 };
38594})();
38595var __decorate$1C = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
38596 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
38597 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
38598 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;
38599 return c > 3 && r && Object.defineProperty(target, key, r), r;
38600};
38601var AgAngleSelect = /** @class */ (function (_super) {
38602 __extends$1W(AgAngleSelect, _super);
38603 function AgAngleSelect(config) {
38604 var _this = _super.call(this, config, AgAngleSelect.TEMPLATE) || this;
38605 _this.radius = 0;
38606 _this.offsetX = 0;
38607 _this.offsetY = 0;
38608 return _this;
38609 }
38610 AgAngleSelect.prototype.postConstruct = function () {
38611 var _this = this;
38612 _super.prototype.postConstruct.call(this);
38613 this.dragListener = {
38614 eElement: this.eParentCircle,
38615 dragStartPixels: 0,
38616 onDragStart: function (e) {
38617 _this.parentCircleRect = _this.eParentCircle.getBoundingClientRect();
38618 },
38619 onDragging: function (e) { return _this.calculateAngleDrag(e); },
38620 onDragStop: function () { }
38621 };
38622 this.dragService.addDragSource(this.dragListener);
38623 this.eAngleValue
38624 .setLabel('')
38625 .setLabelWidth(5)
38626 .setInputWidth(45)
38627 .setMin(0)
38628 .setMax(360)
38629 .setValue("" + this.degrees)
38630 .onValueChange(function (value) {
38631 if (value == null || value === '') {
38632 value = '0';
38633 }
38634 value = _this.eAngleValue.normalizeValue(value);
38635 var floatValue = parseFloat(value);
38636 if (floatValue > 180) {
38637 floatValue = floatValue - 360;
38638 }
38639 _this.setValue(floatValue);
38640 });
38641 this.updateNumberInput();
38642 if (exists(this.getValue())) {
38643 this.eAngleValue.setValue(this.normalizeNegativeValue(this.getValue()).toString());
38644 }
38645 this.addManagedListener(this, AgAbstractField.EVENT_CHANGED, function () {
38646 var eDocument = _this.gridOptionsWrapper.getDocument();
38647 if (_this.eAngleValue.getInputElement().contains(eDocument.activeElement)) {
38648 return;
38649 }
38650 _this.updateNumberInput();
38651 });
38652 };
38653 AgAngleSelect.prototype.updateNumberInput = function () {
38654 var normalizedValue = this.normalizeNegativeValue(this.getValue());
38655 this.eAngleValue.setValue(normalizedValue.toString());
38656 };
38657 AgAngleSelect.prototype.positionChildCircle = function (radians) {
38658 var rect = this.parentCircleRect || { width: 24, height: 24 };
38659 var eChildCircle = this.eChildCircle;
38660 var centerX = rect.width / 2;
38661 var centerY = rect.height / 2;
38662 eChildCircle.style.left = centerX + Math.cos(radians) * 8 + "px";
38663 eChildCircle.style.top = centerY + Math.sin(radians) * 8 + "px";
38664 };
38665 AgAngleSelect.prototype.calculatePolar = function () {
38666 var x = this.offsetX;
38667 var y = this.offsetY;
38668 var radians = Math.atan2(y, x);
38669 this.degrees = this.toDegrees(radians);
38670 this.radius = Math.sqrt((x * x) + (y * y));
38671 this.positionChildCircle(radians);
38672 };
38673 AgAngleSelect.prototype.calculateCartesian = function () {
38674 var radians = this.toRadians(this.getValue());
38675 var radius = this.getRadius();
38676 this
38677 .setOffsetX(Math.cos(radians) * radius)
38678 .setOffsetY(Math.sin(radians) * radius);
38679 };
38680 AgAngleSelect.prototype.setOffsetX = function (offset) {
38681 if (this.offsetX !== offset) {
38682 this.offsetX = offset;
38683 this.calculatePolar();
38684 }
38685 return this;
38686 };
38687 AgAngleSelect.prototype.setOffsetY = function (offset) {
38688 if (this.offsetY !== offset) {
38689 this.offsetY = offset;
38690 this.calculatePolar();
38691 }
38692 return this;
38693 };
38694 AgAngleSelect.prototype.calculateAngleDrag = function (e) {
38695 var rect = this.parentCircleRect;
38696 var centerX = rect.width / 2;
38697 var centerY = rect.height / 2;
38698 var x = e.clientX - rect.left;
38699 var y = e.clientY - rect.top;
38700 var dx = x - centerX;
38701 var dy = y - centerY;
38702 var radians = Math.atan2(dy, dx);
38703 this.setValue(radians, true);
38704 };
38705 AgAngleSelect.prototype.toDegrees = function (radians) {
38706 return radians / Math.PI * 180;
38707 };
38708 AgAngleSelect.prototype.toRadians = function (degrees) {
38709 return degrees / 180 * Math.PI;
38710 };
38711 AgAngleSelect.prototype.normalizeNegativeValue = function (degrees) {
38712 return degrees < 0 ? 360 + degrees : degrees;
38713 };
38714 AgAngleSelect.prototype.normalizeAngle180 = function (radians) {
38715 radians %= Math.PI * 2;
38716 if (radians < -Math.PI) {
38717 radians += Math.PI * 2;
38718 }
38719 else if (radians >= Math.PI) {
38720 radians -= Math.PI * 2;
38721 }
38722 return radians;
38723 };
38724 AgAngleSelect.prototype.getRadius = function () {
38725 return this.radius;
38726 };
38727 AgAngleSelect.prototype.setRadius = function (r) {
38728 if (this.radius === r) {
38729 return this;
38730 }
38731 this.radius = r;
38732 this.calculateCartesian();
38733 return this;
38734 };
38735 AgAngleSelect.prototype.onValueChange = function (callbackFn) {
38736 var _this = this;
38737 this.addManagedListener(this, AgAbstractField.EVENT_CHANGED, function () {
38738 callbackFn(_this.degrees);
38739 });
38740 return this;
38741 };
38742 AgAngleSelect.prototype.getValue = function (radians) {
38743 return radians ? this.toRadians(this.degrees) : this.degrees;
38744 };
38745 AgAngleSelect.prototype.setValue = function (degrees, radians) {
38746 var radiansValue;
38747 if (!radians) {
38748 radiansValue = this.normalizeAngle180(this.toRadians(degrees));
38749 }
38750 else {
38751 radiansValue = degrees;
38752 }
38753 degrees = this.toDegrees(radiansValue);
38754 if (this.degrees !== degrees) {
38755 this.degrees = Math.floor(degrees);
38756 this.calculateCartesian();
38757 this.positionChildCircle(radiansValue);
38758 this.dispatchEvent({ type: AgAbstractField.EVENT_CHANGED });
38759 }
38760 return this;
38761 };
38762 AgAngleSelect.prototype.setWidth = function (width) {
38763 setFixedWidth(this.getGui(), width);
38764 return this;
38765 };
38766 AgAngleSelect.prototype.destroy = function () {
38767 this.dragService.removeDragSource(this.dragListener);
38768 _super.prototype.destroy.call(this);
38769 };
38770 AgAngleSelect.TEMPLATE = "<div class=\"ag-angle-select\">\n <div ref=\"eLabel\"></div>\n <div class=\"ag-wrapper ag-angle-select-wrapper\">\n <div ref=\"eAngleSelectField\" class=\"ag-angle-select-field\">\n <div ref=\"eParentCircle\" class=\"ag-angle-select-parent-circle\">\n <div ref=\"eChildCircle\" class=\"ag-angle-select-child-circle\"></div>\n </div>\n </div>\n <ag-input-number-field ref=\"eAngleValue\"></ag-input-number-field>\n </div>\n </div>";
38771 __decorate$1C([
38772 RefSelector('eLabel')
38773 ], AgAngleSelect.prototype, "eLabel", void 0);
38774 __decorate$1C([
38775 RefSelector('eParentCircle')
38776 ], AgAngleSelect.prototype, "eParentCircle", void 0);
38777 __decorate$1C([
38778 RefSelector('eChildCircle')
38779 ], AgAngleSelect.prototype, "eChildCircle", void 0);
38780 __decorate$1C([
38781 RefSelector('eAngleValue')
38782 ], AgAngleSelect.prototype, "eAngleValue", void 0);
38783 __decorate$1C([
38784 Autowired('dragService')
38785 ], AgAngleSelect.prototype, "dragService", void 0);
38786 return AgAngleSelect;
38787}(AgAbstractLabel));
38788
38789/**
38790 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
38791 * @version v27.3.0
38792 * @link https://www.ag-grid.com/
38793 * @license MIT
38794 */
38795var __extends$1X = (undefined && undefined.__extends) || (function () {
38796 var extendStatics = function (d, b) {
38797 extendStatics = Object.setPrototypeOf ||
38798 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
38799 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38800 return extendStatics(d, b);
38801 };
38802 return function (d, b) {
38803 extendStatics(d, b);
38804 function __() { this.constructor = d; }
38805 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38806 };
38807})();
38808var __decorate$1D = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
38809 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
38810 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
38811 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;
38812 return c > 3 && r && Object.defineProperty(target, key, r), r;
38813};
38814var __read$e = (undefined && undefined.__read) || function (o, n) {
38815 var m = typeof Symbol === "function" && o[Symbol.iterator];
38816 if (!m) return o;
38817 var i = m.call(o), r, ar = [], e;
38818 try {
38819 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
38820 }
38821 catch (error) { e = { error: error }; }
38822 finally {
38823 try {
38824 if (r && !r.done && (m = i["return"])) m.call(i);
38825 }
38826 finally { if (e) throw e.error; }
38827 }
38828 return ar;
38829};
38830var AgColorPanel = /** @class */ (function (_super) {
38831 __extends$1X(AgColorPanel, _super);
38832 function AgColorPanel(config) {
38833 var _this = _super.call(this, AgColorPanel.TEMPLATE) || this;
38834 _this.H = 1; // in the [0, 1] range
38835 _this.S = 1; // in the [0, 1] range
38836 _this.B = 1; // in the [0, 1] range
38837 _this.A = 1; // in the [0, 1] range
38838 _this.isSpectrumDragging = false;
38839 _this.isSpectrumHueDragging = false;
38840 _this.isSpectrumAlphaDragging = false;
38841 _this.colorChanged = false;
38842 _this.picker = config.picker;
38843 return _this;
38844 }
38845 AgColorPanel.prototype.postConstruct = function () {
38846 var eGui = this.getGui();
38847 this.initRecentColors();
38848 this.addManagedListener(this.spectrumVal, 'mousedown', this.onSpectrumDraggerDown.bind(this));
38849 this.addManagedListener(eGui, 'mousemove', this.onSpectrumDraggerMove.bind(this));
38850 this.addManagedListener(this.spectrumHue, 'mousedown', this.onSpectrumHueDown.bind(this));
38851 this.addManagedListener(eGui, 'mousemove', this.onSpectrumHueMove.bind(this));
38852 this.addManagedListener(this.spectrumAlpha, 'mousedown', this.onSpectrumAlphaDown.bind(this));
38853 this.addManagedListener(eGui, 'mousemove', this.onSpectrumAlphaMove.bind(this));
38854 // Listening to `mouseup` on the document on purpose. The user might release the mouse button
38855 // outside the UI control. When the mouse returns back to the control's area, the dragging
38856 // of the thumb is not expected and seen as a bug.
38857 this.addManagedListener(document, 'mouseup', this.onMouseUp.bind(this));
38858 this.addManagedListener(this.recentColors, 'click', this.onRecentColorClick.bind(this));
38859 };
38860 AgColorPanel.prototype.refreshSpectrumRect = function () {
38861 return this.spectrumValRect = this.spectrumVal.getBoundingClientRect();
38862 };
38863 AgColorPanel.prototype.refreshHueRect = function () {
38864 return this.spectrumHueRect = this.spectrumHue.getBoundingClientRect();
38865 };
38866 AgColorPanel.prototype.refreshAlphaRect = function () {
38867 return this.spectrumAlphaRect = this.spectrumAlpha.getBoundingClientRect();
38868 };
38869 AgColorPanel.prototype.onSpectrumDraggerDown = function (e) {
38870 this.refreshSpectrumRect();
38871 this.isSpectrumDragging = true;
38872 this.moveDragger(e);
38873 };
38874 AgColorPanel.prototype.onSpectrumDraggerMove = function (e) {
38875 if (this.isSpectrumDragging) {
38876 this.moveDragger(e);
38877 }
38878 };
38879 AgColorPanel.prototype.onSpectrumHueDown = function (e) {
38880 this.refreshHueRect();
38881 this.isSpectrumHueDragging = true;
38882 this.moveHueSlider(e);
38883 };
38884 AgColorPanel.prototype.onSpectrumHueMove = function (e) {
38885 if (this.isSpectrumHueDragging) {
38886 this.moveHueSlider(e);
38887 }
38888 };
38889 AgColorPanel.prototype.onSpectrumAlphaDown = function (e) {
38890 this.refreshAlphaRect();
38891 this.isSpectrumAlphaDragging = true;
38892 this.moveAlphaSlider(e);
38893 };
38894 AgColorPanel.prototype.onSpectrumAlphaMove = function (e) {
38895 if (this.isSpectrumAlphaDragging) {
38896 this.moveAlphaSlider(e);
38897 }
38898 };
38899 AgColorPanel.prototype.onMouseUp = function () {
38900 this.isSpectrumDragging = false;
38901 this.isSpectrumHueDragging = false;
38902 this.isSpectrumAlphaDragging = false;
38903 };
38904 AgColorPanel.prototype.moveDragger = function (e) {
38905 var valRect = this.spectrumValRect;
38906 if (valRect) {
38907 var x = e.clientX - valRect.left;
38908 var y = e.clientY - valRect.top;
38909 x = Math.max(x, 0);
38910 x = Math.min(x, valRect.width);
38911 y = Math.max(y, 0);
38912 y = Math.min(y, valRect.height);
38913 this.setSpectrumValue(x / valRect.width, 1 - y / valRect.height);
38914 }
38915 };
38916 AgColorPanel.prototype.moveHueSlider = function (e) {
38917 var hueRect = this.spectrumHueRect;
38918 if (hueRect) {
38919 var slider = this.spectrumHueSlider;
38920 var sliderRect = slider.getBoundingClientRect();
38921 var x = e.clientX - hueRect.left;
38922 x = Math.max(x, 0);
38923 x = Math.min(x, hueRect.width);
38924 this.H = 1 - x / hueRect.width;
38925 slider.style.left = (x + sliderRect.width / 2) + 'px';
38926 this.update();
38927 }
38928 };
38929 AgColorPanel.prototype.moveAlphaSlider = function (e) {
38930 var alphaRect = this.spectrumAlphaRect;
38931 if (alphaRect) {
38932 var slider = this.spectrumAlphaSlider;
38933 var sliderRect = slider.getBoundingClientRect();
38934 var x = e.clientX - alphaRect.left;
38935 x = Math.max(x, 0);
38936 x = Math.min(x, alphaRect.width);
38937 this.A = x / alphaRect.width;
38938 slider.style.left = (x + sliderRect.width / 2) + 'px';
38939 this.update();
38940 }
38941 };
38942 AgColorPanel.prototype.update = function () {
38943 var color = Color.fromHSB(this.H * 360, this.S, this.B, this.A);
38944 var spectrumColor = Color.fromHSB(this.H * 360, 1, 1);
38945 var rgbaColor = color.toRgbaString();
38946 // the recent color list needs to know color has actually changed
38947 var colorPicker = this.picker;
38948 var existingColor = Color.fromString(colorPicker.getValue());
38949 if (existingColor.toRgbaString() !== rgbaColor) {
38950 this.colorChanged = true;
38951 }
38952 colorPicker.setValue(rgbaColor);
38953 this.spectrumColor.style.backgroundColor = spectrumColor.toRgbaString();
38954 this.spectrumDragger.style.backgroundColor = rgbaColor;
38955 };
38956 /**
38957 * @param saturation In the [0, 1] interval.
38958 * @param brightness In the [0, 1] interval.
38959 */
38960 AgColorPanel.prototype.setSpectrumValue = function (saturation, brightness) {
38961 var valRect = this.spectrumValRect || this.refreshSpectrumRect();
38962 if (valRect) {
38963 var dragger = this.spectrumDragger;
38964 var draggerRect = dragger.getBoundingClientRect();
38965 saturation = Math.max(0, saturation);
38966 saturation = Math.min(1, saturation);
38967 brightness = Math.max(0, brightness);
38968 brightness = Math.min(1, brightness);
38969 this.S = saturation;
38970 this.B = brightness;
38971 dragger.style.left = (saturation * valRect.width - draggerRect.width / 2) + 'px';
38972 dragger.style.top = ((1 - brightness) * valRect.height - draggerRect.height / 2) + 'px';
38973 this.update();
38974 }
38975 };
38976 AgColorPanel.prototype.initRecentColors = function () {
38977 var recentColors = AgColorPanel.recentColors;
38978 var innerHtml = recentColors.map(function (color, index) {
38979 return "<div class=\"ag-recent-color\" id=" + index + " style=\"background-color: " + color + "; width: 15px; height: 15px;\" recent-color=\"" + color + "\"></div>";
38980 });
38981 this.recentColors.innerHTML = innerHtml.join('');
38982 };
38983 AgColorPanel.prototype.setValue = function (val) {
38984 var color = Color.fromString(val);
38985 var _a = __read$e(color.toHSB(), 3), h = _a[0], s = _a[1], b = _a[2];
38986 this.H = (isNaN(h) ? 0 : h) / 360;
38987 this.A = color.a;
38988 var spectrumHueRect = this.spectrumHueRect || this.refreshHueRect();
38989 var spectrumAlphaRect = this.spectrumAlphaRect || this.refreshAlphaRect();
38990 this.spectrumHueSlider.style.left = ((this.H - 1) * -spectrumHueRect.width) + "px";
38991 this.spectrumAlphaSlider.style.left = (this.A * spectrumAlphaRect.width) + "px";
38992 this.setSpectrumValue(s, b);
38993 };
38994 AgColorPanel.prototype.onRecentColorClick = function (e) {
38995 var target = e.target;
38996 if (!exists(target.id)) {
38997 return;
38998 }
38999 var id = parseInt(target.id, 10);
39000 this.setValue(AgColorPanel.recentColors[id]);
39001 this.destroy();
39002 };
39003 AgColorPanel.prototype.addRecentColor = function () {
39004 var color = Color.fromHSB(this.H * 360, this.S, this.B, this.A);
39005 var rgbaColor = color.toRgbaString();
39006 var recentColors = AgColorPanel.recentColors;
39007 if (!this.colorChanged || recentColors[0] === rgbaColor) {
39008 return;
39009 }
39010 // remove duplicate color
39011 recentColors = recentColors.filter(function (currentColor) { return currentColor != rgbaColor; });
39012 // add color to head
39013 recentColors = [rgbaColor].concat(recentColors);
39014 // ensure we don't exceed max number of recent colors
39015 if (recentColors.length > AgColorPanel.maxRecentColors) {
39016 recentColors = recentColors.slice(0, AgColorPanel.maxRecentColors);
39017 }
39018 AgColorPanel.recentColors = recentColors;
39019 };
39020 AgColorPanel.prototype.destroy = function () {
39021 this.addRecentColor();
39022 _super.prototype.destroy.call(this);
39023 };
39024 AgColorPanel.maxRecentColors = 8;
39025 AgColorPanel.recentColors = [];
39026 AgColorPanel.TEMPLATE = "<div class=\"ag-color-panel\">\n <div ref=\"spectrumColor\" class=\"ag-spectrum-color\">\n <div class=\"ag-spectrum-sat ag-spectrum-fill\">\n <div ref=\"spectrumVal\" class=\"ag-spectrum-val ag-spectrum-fill\">\n <div ref=\"spectrumDragger\" class=\"ag-spectrum-dragger\"></div>\n </div>\n </div>\n </div>\n <div class=\"ag-spectrum-tools\">\n <div ref=\"spectrumHue\" class=\"ag-spectrum-hue ag-spectrum-tool\">\n <div class=\"ag-spectrum-hue-background\"></div>\n <div ref=\"spectrumHueSlider\" class=\"ag-spectrum-slider\"></div>\n </div>\n <div ref=\"spectrumAlpha\" class=\"ag-spectrum-alpha ag-spectrum-tool\">\n <div class=\"ag-spectrum-alpha-background\"></div>\n <div ref=\"spectrumAlphaSlider\" class=\"ag-spectrum-slider\"></div>\n </div>\n <div ref=\"recentColors\" class=\"ag-recent-colors\"></div>\n </div>\n </div>";
39027 __decorate$1D([
39028 RefSelector('spectrumColor')
39029 ], AgColorPanel.prototype, "spectrumColor", void 0);
39030 __decorate$1D([
39031 RefSelector('spectrumVal')
39032 ], AgColorPanel.prototype, "spectrumVal", void 0);
39033 __decorate$1D([
39034 RefSelector('spectrumDragger')
39035 ], AgColorPanel.prototype, "spectrumDragger", void 0);
39036 __decorate$1D([
39037 RefSelector('spectrumHue')
39038 ], AgColorPanel.prototype, "spectrumHue", void 0);
39039 __decorate$1D([
39040 RefSelector('spectrumHueSlider')
39041 ], AgColorPanel.prototype, "spectrumHueSlider", void 0);
39042 __decorate$1D([
39043 RefSelector('spectrumAlpha')
39044 ], AgColorPanel.prototype, "spectrumAlpha", void 0);
39045 __decorate$1D([
39046 RefSelector('spectrumAlphaSlider')
39047 ], AgColorPanel.prototype, "spectrumAlphaSlider", void 0);
39048 __decorate$1D([
39049 RefSelector('recentColors')
39050 ], AgColorPanel.prototype, "recentColors", void 0);
39051 __decorate$1D([
39052 PostConstruct
39053 ], AgColorPanel.prototype, "postConstruct", null);
39054 return AgColorPanel;
39055}(Component));
39056
39057/**
39058 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
39059 * @version v27.3.0
39060 * @link https://www.ag-grid.com/
39061 * @license MIT
39062 */
39063var __extends$1Y = (undefined && undefined.__extends) || (function () {
39064 var extendStatics = function (d, b) {
39065 extendStatics = Object.setPrototypeOf ||
39066 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
39067 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
39068 return extendStatics(d, b);
39069 };
39070 return function (d, b) {
39071 extendStatics(d, b);
39072 function __() { this.constructor = d; }
39073 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
39074 };
39075})();
39076var __decorate$1E = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
39077 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
39078 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
39079 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;
39080 return c > 3 && r && Object.defineProperty(target, key, r), r;
39081};
39082var AgPanel = /** @class */ (function (_super) {
39083 __extends$1Y(AgPanel, _super);
39084 function AgPanel(config) {
39085 var _this = _super.call(this, AgPanel.getTemplate(config)) || this;
39086 _this.closable = true;
39087 _this.config = config;
39088 return _this;
39089 }
39090 AgPanel.getTemplate = function (config) {
39091 var cssIdentifier = (config && config.cssIdentifier) || 'default';
39092 return /* html */ "<div class=\"ag-panel ag-" + cssIdentifier + "-panel\" tabindex=\"-1\">\n <div ref=\"eTitleBar\" class=\"ag-panel-title-bar ag-" + cssIdentifier + "-panel-title-bar ag-unselectable\">\n <span ref=\"eTitle\" class=\"ag-panel-title-bar-title ag-" + cssIdentifier + "-panel-title-bar-title\"></span>\n <div ref=\"eTitleBarButtons\" class=\"ag-panel-title-bar-buttons ag-" + cssIdentifier + "-panel-title-bar-buttons\"></div>\n </div>\n <div ref=\"eContentWrapper\" class=\"ag-panel-content-wrapper ag-" + cssIdentifier + "-panel-content-wrapper\"></div>\n </div>";
39093 };
39094 AgPanel.prototype.postConstruct = function () {
39095 var _this = this;
39096 var _a = this.config, component = _a.component, closable = _a.closable, hideTitleBar = _a.hideTitleBar, title = _a.title, _b = _a.minWidth, minWidth = _b === void 0 ? 250 : _b, width = _a.width, _c = _a.minHeight, minHeight = _c === void 0 ? 250 : _c, height = _a.height, centered = _a.centered, popup = _a.popup, x = _a.x, y = _a.y;
39097 this.positionableFeature = new PositionableFeature(this.getGui(), {
39098 minWidth: minWidth, width: width, minHeight: minHeight, height: height, centered: centered, x: x, y: y, popup: popup,
39099 calculateTopBuffer: function () { return _this.positionableFeature.getHeight() - _this.getBodyHeight(); }
39100 });
39101 this.createManagedBean(this.positionableFeature);
39102 var eGui = this.getGui();
39103 if (component) {
39104 this.setBodyComponent(component);
39105 }
39106 if (!hideTitleBar) {
39107 if (title) {
39108 this.setTitle(title);
39109 }
39110 this.setClosable(closable != null ? closable : this.closable);
39111 }
39112 else {
39113 this.eTitleBar.classList.add('ag-hidden');
39114 }
39115 this.addManagedListener(this.eTitleBar, 'mousedown', function (e) {
39116 var eDocument = _this.gridOptionsWrapper.getDocument();
39117 if (eGui.contains(e.relatedTarget) ||
39118 eGui.contains(eDocument.activeElement) ||
39119 _this.eTitleBarButtons.contains(e.target)) {
39120 e.preventDefault();
39121 return;
39122 }
39123 var focusEl = _this.eContentWrapper.querySelector('button, [href], input, select, textarea, [tabindex]');
39124 if (focusEl) {
39125 focusEl.focus();
39126 }
39127 });
39128 if (popup && this.positionableFeature.isPositioned()) {
39129 return;
39130 }
39131 if (this.renderComponent) {
39132 this.renderComponent();
39133 }
39134 this.positionableFeature.initialisePosition();
39135 this.eContentWrapper.style.height = '0';
39136 };
39137 AgPanel.prototype.renderComponent = function () {
39138 var _this = this;
39139 var eGui = this.getGui();
39140 eGui.focus();
39141 this.close = function () {
39142 eGui.parentElement.removeChild(eGui);
39143 _this.destroy();
39144 };
39145 };
39146 AgPanel.prototype.getHeight = function () {
39147 return this.positionableFeature.getHeight();
39148 };
39149 AgPanel.prototype.setHeight = function (height) {
39150 this.positionableFeature.setHeight(height);
39151 };
39152 AgPanel.prototype.getWidth = function () {
39153 return this.positionableFeature.getWidth();
39154 };
39155 AgPanel.prototype.setWidth = function (width) {
39156 this.positionableFeature.setWidth(width);
39157 };
39158 AgPanel.prototype.setClosable = function (closable) {
39159 if (closable !== this.closable) {
39160 this.closable = closable;
39161 }
39162 if (closable) {
39163 var closeButtonComp = this.closeButtonComp = new Component(AgPanel.CLOSE_BTN_TEMPLATE);
39164 this.getContext().createBean(closeButtonComp);
39165 var eGui = closeButtonComp.getGui();
39166 var child = createIconNoSpan('close', this.gridOptionsWrapper);
39167 child.classList.add('ag-panel-title-bar-button-icon');
39168 eGui.appendChild(child);
39169 this.addTitleBarButton(closeButtonComp);
39170 closeButtonComp.addManagedListener(eGui, 'click', this.onBtClose.bind(this));
39171 }
39172 else if (this.closeButtonComp) {
39173 var eGui = this.closeButtonComp.getGui();
39174 eGui.parentElement.removeChild(eGui);
39175 this.closeButtonComp = this.destroyBean(this.closeButtonComp);
39176 }
39177 };
39178 AgPanel.prototype.setBodyComponent = function (bodyComponent) {
39179 bodyComponent.setParentComponent(this);
39180 this.eContentWrapper.appendChild(bodyComponent.getGui());
39181 };
39182 AgPanel.prototype.addTitleBarButton = function (button, position) {
39183 var eTitleBarButtons = this.eTitleBarButtons;
39184 var buttons = eTitleBarButtons.children;
39185 var len = buttons.length;
39186 if (position == null) {
39187 position = len;
39188 }
39189 position = Math.max(0, Math.min(position, len));
39190 button.addCssClass('ag-panel-title-bar-button');
39191 var eGui = button.getGui();
39192 if (position === 0) {
39193 eTitleBarButtons.insertAdjacentElement('afterbegin', eGui);
39194 }
39195 else if (position === len) {
39196 eTitleBarButtons.insertAdjacentElement('beforeend', eGui);
39197 }
39198 else {
39199 buttons[position - 1].insertAdjacentElement('afterend', eGui);
39200 }
39201 button.setParentComponent(this);
39202 };
39203 AgPanel.prototype.getBodyHeight = function () {
39204 return getInnerHeight(this.eContentWrapper);
39205 };
39206 AgPanel.prototype.getBodyWidth = function () {
39207 return getInnerWidth(this.eContentWrapper);
39208 };
39209 AgPanel.prototype.setTitle = function (title) {
39210 this.eTitle.innerText = title;
39211 };
39212 // called when user hits the 'x' in the top right
39213 AgPanel.prototype.onBtClose = function () {
39214 this.close();
39215 };
39216 AgPanel.prototype.destroy = function () {
39217 if (this.closeButtonComp) {
39218 this.closeButtonComp = this.destroyBean(this.closeButtonComp);
39219 }
39220 var eGui = this.getGui();
39221 if (eGui && eGui.offsetParent) {
39222 this.close();
39223 }
39224 _super.prototype.destroy.call(this);
39225 };
39226 AgPanel.CLOSE_BTN_TEMPLATE = "<div class=\"ag-button\"></div>";
39227 __decorate$1E([
39228 RefSelector('eContentWrapper')
39229 ], AgPanel.prototype, "eContentWrapper", void 0);
39230 __decorate$1E([
39231 RefSelector('eTitleBar')
39232 ], AgPanel.prototype, "eTitleBar", void 0);
39233 __decorate$1E([
39234 RefSelector('eTitleBarButtons')
39235 ], AgPanel.prototype, "eTitleBarButtons", void 0);
39236 __decorate$1E([
39237 RefSelector('eTitle')
39238 ], AgPanel.prototype, "eTitle", void 0);
39239 __decorate$1E([
39240 PostConstruct
39241 ], AgPanel.prototype, "postConstruct", null);
39242 return AgPanel;
39243}(Component));
39244
39245/**
39246 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
39247 * @version v27.3.0
39248 * @link https://www.ag-grid.com/
39249 * @license MIT
39250 */
39251var __extends$1Z = (undefined && undefined.__extends) || (function () {
39252 var extendStatics = function (d, b) {
39253 extendStatics = Object.setPrototypeOf ||
39254 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
39255 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
39256 return extendStatics(d, b);
39257 };
39258 return function (d, b) {
39259 extendStatics(d, b);
39260 function __() { this.constructor = d; }
39261 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
39262 };
39263})();
39264var __assign$e = (undefined && undefined.__assign) || function () {
39265 __assign$e = Object.assign || function(t) {
39266 for (var s, i = 1, n = arguments.length; i < n; i++) {
39267 s = arguments[i];
39268 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
39269 t[p] = s[p];
39270 }
39271 return t;
39272 };
39273 return __assign$e.apply(this, arguments);
39274};
39275var __decorate$1F = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
39276 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
39277 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
39278 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;
39279 return c > 3 && r && Object.defineProperty(target, key, r), r;
39280};
39281var AgDialog = /** @class */ (function (_super) {
39282 __extends$1Z(AgDialog, _super);
39283 function AgDialog(config) {
39284 var _this = _super.call(this, __assign$e(__assign$e({}, config), { popup: true })) || this;
39285 _this.isMaximizable = false;
39286 _this.isMaximized = false;
39287 _this.maximizeListeners = [];
39288 _this.resizeListenerDestroy = null;
39289 _this.lastPosition = {
39290 x: 0,
39291 y: 0,
39292 width: 0,
39293 height: 0
39294 };
39295 return _this;
39296 }
39297 AgDialog.prototype.postConstruct = function () {
39298 var _this = this;
39299 var eGui = this.getGui();
39300 var _a = this.config, movable = _a.movable, resizable = _a.resizable, maximizable = _a.maximizable;
39301 this.addCssClass('ag-dialog');
39302 _super.prototype.postConstruct.call(this);
39303 this.addManagedListener(eGui, 'focusin', function (e) {
39304 if (eGui.contains(e.relatedTarget)) {
39305 return;
39306 }
39307 _this.popupService.bringPopupToFront(eGui);
39308 });
39309 if (movable) {
39310 this.setMovable(movable);
39311 }
39312 if (maximizable) {
39313 this.setMaximizable(maximizable);
39314 }
39315 if (resizable) {
39316 this.setResizable(resizable);
39317 }
39318 };
39319 AgDialog.prototype.renderComponent = function () {
39320 var eGui = this.getGui();
39321 var _a = this.config, alwaysOnTop = _a.alwaysOnTop, modal = _a.modal, title = _a.title;
39322 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
39323 var addPopupRes = this.popupService.addPopup({
39324 modal: modal,
39325 eChild: eGui,
39326 closeOnEsc: true,
39327 closedCallback: this.destroy.bind(this),
39328 alwaysOnTop: alwaysOnTop,
39329 ariaLabel: title || translate('ariaLabelDialog', 'Dialog')
39330 });
39331 if (addPopupRes) {
39332 this.close = addPopupRes.hideFunc;
39333 }
39334 };
39335 AgDialog.prototype.toggleMaximize = function () {
39336 var position = this.positionableFeature.getPosition();
39337 if (this.isMaximized) {
39338 var _a = this.lastPosition, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
39339 this.setWidth(width);
39340 this.setHeight(height);
39341 this.positionableFeature.offsetElement(x, y);
39342 }
39343 else {
39344 this.lastPosition.width = this.getWidth();
39345 this.lastPosition.height = this.getHeight();
39346 this.lastPosition.x = position.x;
39347 this.lastPosition.y = position.y;
39348 this.positionableFeature.offsetElement(0, 0);
39349 this.setHeight('100%');
39350 this.setWidth('100%');
39351 }
39352 this.isMaximized = !this.isMaximized;
39353 this.refreshMaximizeIcon();
39354 };
39355 AgDialog.prototype.refreshMaximizeIcon = function () {
39356 setDisplayed(this.maximizeIcon, !this.isMaximized);
39357 setDisplayed(this.minimizeIcon, this.isMaximized);
39358 };
39359 AgDialog.prototype.clearMaximizebleListeners = function () {
39360 if (this.maximizeListeners.length) {
39361 this.maximizeListeners.forEach(function (destroyListener) { return destroyListener(); });
39362 this.maximizeListeners.length = 0;
39363 }
39364 if (this.resizeListenerDestroy) {
39365 this.resizeListenerDestroy();
39366 this.resizeListenerDestroy = null;
39367 }
39368 };
39369 AgDialog.prototype.destroy = function () {
39370 this.maximizeButtonComp = this.destroyBean(this.maximizeButtonComp);
39371 this.clearMaximizebleListeners();
39372 _super.prototype.destroy.call(this);
39373 };
39374 AgDialog.prototype.setResizable = function (resizable) {
39375 this.positionableFeature.setResizable(resizable);
39376 };
39377 AgDialog.prototype.setMovable = function (movable) {
39378 this.positionableFeature.setMovable(movable, this.eTitleBar);
39379 };
39380 AgDialog.prototype.setMaximizable = function (maximizable) {
39381 var _this = this;
39382 if (!maximizable) {
39383 this.clearMaximizebleListeners();
39384 if (this.maximizeButtonComp) {
39385 this.destroyBean(this.maximizeButtonComp);
39386 this.maximizeButtonComp = this.maximizeIcon = this.minimizeIcon = undefined;
39387 }
39388 return;
39389 }
39390 var eTitleBar = this.eTitleBar;
39391 if (!eTitleBar || maximizable === this.isMaximizable) {
39392 return;
39393 }
39394 var maximizeButtonComp = this.maximizeButtonComp =
39395 this.createBean(new Component(/* html */ "<div class=\"ag-dialog-button\"></span>"));
39396 var eGui = maximizeButtonComp.getGui();
39397 eGui.appendChild(this.maximizeIcon = createIconNoSpan('maximize', this.gridOptionsWrapper));
39398 this.maximizeIcon.classList.add('ag-panel-title-bar-button-icon');
39399 eGui.appendChild(this.minimizeIcon = createIconNoSpan('minimize', this.gridOptionsWrapper));
39400 this.minimizeIcon.classList.add('ag-panel-title-bar-button-icon', 'ag-hidden');
39401 maximizeButtonComp.addManagedListener(eGui, 'click', this.toggleMaximize.bind(this));
39402 this.addTitleBarButton(maximizeButtonComp, 0);
39403 this.maximizeListeners.push(this.addManagedListener(eTitleBar, 'dblclick', this.toggleMaximize.bind(this)));
39404 this.resizeListenerDestroy = this.addManagedListener(this, 'resize', function () {
39405 _this.isMaximized = false;
39406 _this.refreshMaximizeIcon();
39407 });
39408 };
39409 __decorate$1F([
39410 Autowired('popupService')
39411 ], AgDialog.prototype, "popupService", void 0);
39412 return AgDialog;
39413}(AgPanel));
39414
39415/**
39416 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
39417 * @version v27.3.0
39418 * @link https://www.ag-grid.com/
39419 * @license MIT
39420 */
39421var __extends$1_ = (undefined && undefined.__extends) || (function () {
39422 var extendStatics = function (d, b) {
39423 extendStatics = Object.setPrototypeOf ||
39424 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
39425 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
39426 return extendStatics(d, b);
39427 };
39428 return function (d, b) {
39429 extendStatics(d, b);
39430 function __() { this.constructor = d; }
39431 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
39432 };
39433})();
39434var AgColorPicker = /** @class */ (function (_super) {
39435 __extends$1_(AgColorPicker, _super);
39436 function AgColorPicker(config) {
39437 var _this = _super.call(this, config, 'ag-color-picker', 'colorPicker') || this;
39438 if (config && config.color) {
39439 _this.value = config.color;
39440 }
39441 return _this;
39442 }
39443 AgColorPicker.prototype.postConstruct = function () {
39444 _super.prototype.postConstruct.call(this);
39445 if (this.value) {
39446 this.setValue(this.value);
39447 }
39448 };
39449 AgColorPicker.prototype.showPicker = function () {
39450 var _this = this;
39451 var eGuiRect = this.getGui().getBoundingClientRect();
39452 var colorDialog = this.createBean(new AgDialog({
39453 closable: false,
39454 modal: true,
39455 hideTitleBar: true,
39456 minWidth: 190,
39457 width: 190,
39458 height: 250,
39459 x: eGuiRect.right - 190,
39460 y: eGuiRect.top - 250
39461 }));
39462 this.isPickerDisplayed = true;
39463 colorDialog.addCssClass('ag-color-dialog');
39464 setAriaExpanded(this.eWrapper, true);
39465 var colorPanel = this.createBean(new AgColorPanel({ picker: this }));
39466 colorPanel.addDestroyFunc(function () {
39467 if (colorDialog.isAlive()) {
39468 _this.destroyBean(colorDialog);
39469 }
39470 });
39471 colorDialog.setParentComponent(this);
39472 colorDialog.setBodyComponent(colorPanel);
39473 colorPanel.setValue(this.getValue());
39474 colorDialog.addDestroyFunc(function () {
39475 // here we check if the picker was already being
39476 // destroyed to avoid a stack overflow
39477 if (!_this.isDestroyingPicker) {
39478 _this.isDestroyingPicker = true;
39479 if (colorPanel.isAlive()) {
39480 _this.destroyBean(colorPanel);
39481 }
39482 }
39483 else {
39484 _this.isDestroyingPicker = false;
39485 }
39486 if (_this.isAlive()) {
39487 setAriaExpanded(_this.eWrapper, false);
39488 _this.getFocusableElement().focus();
39489 }
39490 _this.isPickerDisplayed = false;
39491 });
39492 return colorDialog;
39493 };
39494 AgColorPicker.prototype.setValue = function (color) {
39495 if (this.value === color) {
39496 return this;
39497 }
39498 this.eDisplayField.style.backgroundColor = color;
39499 return _super.prototype.setValue.call(this, color);
39500 };
39501 AgColorPicker.prototype.getValue = function () {
39502 return this.value;
39503 };
39504 return AgColorPicker;
39505}(AgPickerField));
39506
39507/**
39508 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
39509 * @version v27.3.0
39510 * @link https://www.ag-grid.com/
39511 * @license MIT
39512 */
39513var __extends$1$ = (undefined && undefined.__extends) || (function () {
39514 var extendStatics = function (d, b) {
39515 extendStatics = Object.setPrototypeOf ||
39516 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
39517 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
39518 return extendStatics(d, b);
39519 };
39520 return function (d, b) {
39521 extendStatics(d, b);
39522 function __() { this.constructor = d; }
39523 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
39524 };
39525})();
39526var __decorate$1G = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
39527 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
39528 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
39529 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;
39530 return c > 3 && r && Object.defineProperty(target, key, r), r;
39531};
39532var AgGroupComponent = /** @class */ (function (_super) {
39533 __extends$1$(AgGroupComponent, _super);
39534 function AgGroupComponent(params) {
39535 if (params === void 0) { params = {}; }
39536 var _this = _super.call(this, AgGroupComponent.getTemplate(params)) || this;
39537 _this.suppressEnabledCheckbox = true;
39538 _this.suppressOpenCloseIcons = false;
39539 var title = params.title, enabled = params.enabled, items = params.items, suppressEnabledCheckbox = params.suppressEnabledCheckbox, suppressOpenCloseIcons = params.suppressOpenCloseIcons;
39540 _this.title = title;
39541 _this.cssIdentifier = params.cssIdentifier || 'default';
39542 _this.enabled = enabled != null ? enabled : true;
39543 _this.items = items || [];
39544 _this.alignItems = params.alignItems || 'center';
39545 if (suppressEnabledCheckbox != null) {
39546 _this.suppressEnabledCheckbox = suppressEnabledCheckbox;
39547 }
39548 if (suppressOpenCloseIcons != null) {
39549 _this.suppressOpenCloseIcons = suppressOpenCloseIcons;
39550 }
39551 return _this;
39552 }
39553 AgGroupComponent.getTemplate = function (params) {
39554 var cssIdentifier = params.cssIdentifier || 'default';
39555 var direction = params.direction || 'vertical';
39556 return /* html */ "<div class=\"ag-group ag-" + cssIdentifier + "-group\" role=\"presentation\">\n <div class=\"ag-group-title-bar ag-" + cssIdentifier + "-group-title-bar ag-unselectable\" ref=\"eTitleBar\" role=\"button\">\n <span class=\"ag-group-title-bar-icon ag-" + cssIdentifier + "-group-title-bar-icon\" ref=\"eGroupOpenedIcon\" role=\"presentation\"></span>\n <span class=\"ag-group-title-bar-icon ag-" + cssIdentifier + "-group-title-bar-icon\" ref=\"eGroupClosedIcon\" role=\"presentation\"></span>\n <span ref=\"eTitle\" class=\"ag-group-title ag-" + cssIdentifier + "-group-title\"></span>\n </div>\n <div ref=\"eToolbar\" class=\"ag-group-toolbar ag-" + cssIdentifier + "-group-toolbar\">\n <ag-checkbox ref=\"cbGroupEnabled\"></ag-checkbox>\n </div>\n <div ref=\"eContainer\" class=\"ag-group-container ag-group-container-" + direction + " ag-" + cssIdentifier + "-group-container\"></div>\n </div>";
39557 };
39558 AgGroupComponent.prototype.postConstruct = function () {
39559 if (this.items.length) {
39560 var initialItems = this.items;
39561 this.items = [];
39562 this.addItems(initialItems);
39563 }
39564 var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
39565 this.cbGroupEnabled.setLabel(localeTextFunc('enabled', 'Enabled'));
39566 if (this.title) {
39567 this.setTitle(this.title);
39568 }
39569 if (this.enabled) {
39570 this.setEnabled(this.enabled);
39571 }
39572 this.setAlignItems(this.alignItems);
39573 this.hideEnabledCheckbox(this.suppressEnabledCheckbox);
39574 this.hideOpenCloseIcons(this.suppressOpenCloseIcons);
39575 this.setupExpandContract();
39576 this.refreshAriaStatus();
39577 this.refreshChildDisplay();
39578 };
39579 AgGroupComponent.prototype.setupExpandContract = function () {
39580 var _this = this;
39581 this.eGroupClosedIcon.appendChild(createIcon('columnSelectClosed', this.gridOptionsWrapper, null));
39582 this.eGroupOpenedIcon.appendChild(createIcon('columnSelectOpen', this.gridOptionsWrapper, null));
39583 this.addManagedListener(this.eTitleBar, 'click', function () { return _this.toggleGroupExpand(); });
39584 this.addManagedListener(this.eTitleBar, 'keydown', function (e) {
39585 switch (e.key) {
39586 case KeyCode.ENTER:
39587 case KeyCode.SPACE:
39588 e.preventDefault();
39589 _this.toggleGroupExpand();
39590 break;
39591 case KeyCode.RIGHT:
39592 case KeyCode.LEFT:
39593 e.preventDefault();
39594 _this.toggleGroupExpand(e.key === KeyCode.RIGHT);
39595 break;
39596 }
39597 });
39598 };
39599 AgGroupComponent.prototype.refreshAriaStatus = function () {
39600 if (!this.suppressOpenCloseIcons) {
39601 setAriaExpanded(this.eTitleBar, this.expanded);
39602 }
39603 };
39604 AgGroupComponent.prototype.refreshChildDisplay = function () {
39605 var showIcon = !this.suppressOpenCloseIcons;
39606 setDisplayed(this.eToolbar, this.expanded && !this.suppressEnabledCheckbox);
39607 setDisplayed(this.eGroupOpenedIcon, showIcon && this.expanded);
39608 setDisplayed(this.eGroupClosedIcon, showIcon && !this.expanded);
39609 };
39610 AgGroupComponent.prototype.isExpanded = function () {
39611 return this.expanded;
39612 };
39613 AgGroupComponent.prototype.setAlignItems = function (alignment) {
39614 if (this.alignItems !== alignment) {
39615 this.removeCssClass("ag-group-item-alignment-" + this.alignItems);
39616 }
39617 this.alignItems = alignment;
39618 var newCls = "ag-group-item-alignment-" + this.alignItems;
39619 this.addCssClass(newCls);
39620 return this;
39621 };
39622 AgGroupComponent.prototype.toggleGroupExpand = function (expanded) {
39623 if (this.suppressOpenCloseIcons) {
39624 this.expanded = true;
39625 this.refreshChildDisplay();
39626 setDisplayed(this.eContainer, true);
39627 return this;
39628 }
39629 expanded = expanded != null ? expanded : !this.expanded;
39630 if (this.expanded === expanded) {
39631 return this;
39632 }
39633 this.expanded = expanded;
39634 this.refreshAriaStatus();
39635 this.refreshChildDisplay();
39636 setDisplayed(this.eContainer, expanded);
39637 this.dispatchEvent({ type: this.expanded ? AgGroupComponent.EVENT_EXPANDED : AgGroupComponent.EVENT_COLLAPSED });
39638 return this;
39639 };
39640 AgGroupComponent.prototype.addItems = function (items) {
39641 var _this = this;
39642 items.forEach(function (item) { return _this.addItem(item); });
39643 };
39644 AgGroupComponent.prototype.addItem = function (item) {
39645 var container = this.eContainer;
39646 var el = item instanceof Component ? item.getGui() : item;
39647 el.classList.add('ag-group-item', "ag-" + this.cssIdentifier + "-group-item");
39648 container.appendChild(el);
39649 this.items.push(el);
39650 };
39651 AgGroupComponent.prototype.hideItem = function (hide, index) {
39652 var itemToHide = this.items[index];
39653 itemToHide.classList.toggle('ag-hidden', hide);
39654 };
39655 AgGroupComponent.prototype.setTitle = function (title) {
39656 this.eTitle.innerText = title;
39657 return this;
39658 };
39659 AgGroupComponent.prototype.addCssClassToTitleBar = function (cssClass) {
39660 this.eTitleBar.classList.add(cssClass);
39661 };
39662 AgGroupComponent.prototype.setEnabled = function (enabled, skipToggle) {
39663 this.enabled = enabled;
39664 this.refreshDisabledStyles();
39665 this.toggleGroupExpand(enabled);
39666 if (!skipToggle) {
39667 this.cbGroupEnabled.setValue(enabled);
39668 }
39669 return this;
39670 };
39671 AgGroupComponent.prototype.isEnabled = function () {
39672 return this.enabled;
39673 };
39674 AgGroupComponent.prototype.onEnableChange = function (callbackFn) {
39675 var _this = this;
39676 this.cbGroupEnabled.onValueChange(function (newSelection) {
39677 _this.setEnabled(newSelection, true);
39678 callbackFn(newSelection);
39679 });
39680 return this;
39681 };
39682 AgGroupComponent.prototype.hideEnabledCheckbox = function (hide) {
39683 this.suppressEnabledCheckbox = hide;
39684 this.refreshChildDisplay();
39685 this.refreshDisabledStyles();
39686 return this;
39687 };
39688 AgGroupComponent.prototype.hideOpenCloseIcons = function (hide) {
39689 this.suppressOpenCloseIcons = hide;
39690 if (hide) {
39691 this.toggleGroupExpand(true);
39692 }
39693 return this;
39694 };
39695 AgGroupComponent.prototype.refreshDisabledStyles = function () {
39696 this.addOrRemoveCssClass('ag-disabled', !this.enabled);
39697 if (this.suppressEnabledCheckbox && !this.enabled) {
39698 this.eTitleBar.classList.add('ag-disabled-group-title-bar');
39699 this.eTitleBar.removeAttribute('tabindex');
39700 }
39701 else {
39702 this.eTitleBar.classList.remove('ag-disabled-group-title-bar');
39703 this.eTitleBar.setAttribute('tabindex', '0');
39704 }
39705 this.eContainer.classList.toggle('ag-disabled-group-container', !this.enabled);
39706 };
39707 AgGroupComponent.EVENT_EXPANDED = 'expanded';
39708 AgGroupComponent.EVENT_COLLAPSED = 'collapsed';
39709 __decorate$1G([
39710 RefSelector('eTitleBar')
39711 ], AgGroupComponent.prototype, "eTitleBar", void 0);
39712 __decorate$1G([
39713 RefSelector('eGroupOpenedIcon')
39714 ], AgGroupComponent.prototype, "eGroupOpenedIcon", void 0);
39715 __decorate$1G([
39716 RefSelector('eGroupClosedIcon')
39717 ], AgGroupComponent.prototype, "eGroupClosedIcon", void 0);
39718 __decorate$1G([
39719 RefSelector('eToolbar')
39720 ], AgGroupComponent.prototype, "eToolbar", void 0);
39721 __decorate$1G([
39722 RefSelector('cbGroupEnabled')
39723 ], AgGroupComponent.prototype, "cbGroupEnabled", void 0);
39724 __decorate$1G([
39725 RefSelector('eTitle')
39726 ], AgGroupComponent.prototype, "eTitle", void 0);
39727 __decorate$1G([
39728 RefSelector('eContainer')
39729 ], AgGroupComponent.prototype, "eContainer", void 0);
39730 __decorate$1G([
39731 PostConstruct
39732 ], AgGroupComponent.prototype, "postConstruct", null);
39733 return AgGroupComponent;
39734}(Component));
39735
39736/**
39737 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
39738 * @version v27.3.0
39739 * @link https://www.ag-grid.com/
39740 * @license MIT
39741 */
39742var __extends$20 = (undefined && undefined.__extends) || (function () {
39743 var extendStatics = function (d, b) {
39744 extendStatics = Object.setPrototypeOf ||
39745 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
39746 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
39747 return extendStatics(d, b);
39748 };
39749 return function (d, b) {
39750 extendStatics(d, b);
39751 function __() { this.constructor = d; }
39752 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
39753 };
39754})();
39755var __decorate$1H = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
39756 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
39757 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
39758 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;
39759 return c > 3 && r && Object.defineProperty(target, key, r), r;
39760};
39761var TabGuardCtrl = /** @class */ (function (_super) {
39762 __extends$20(TabGuardCtrl, _super);
39763 function TabGuardCtrl(params) {
39764 var _this = _super.call(this) || this;
39765 _this.skipTabGuardFocus = false;
39766 var comp = params.comp, eTopGuard = params.eTopGuard, eBottomGuard = params.eBottomGuard, focusInnerElement = params.focusInnerElement, onFocusIn = params.onFocusIn, onFocusOut = params.onFocusOut, shouldStopEventPropagation = params.shouldStopEventPropagation, onTabKeyDown = params.onTabKeyDown, handleKeyDown = params.handleKeyDown, eFocusableElement = params.eFocusableElement;
39767 _this.comp = comp;
39768 _this.eTopGuard = eTopGuard;
39769 _this.eBottomGuard = eBottomGuard;
39770 _this.providedFocusInnerElement = focusInnerElement;
39771 _this.eFocusableElement = eFocusableElement;
39772 _this.providedFocusIn = onFocusIn;
39773 _this.providedFocusOut = onFocusOut;
39774 _this.providedShouldStopEventPropagation = shouldStopEventPropagation;
39775 _this.providedOnTabKeyDown = onTabKeyDown;
39776 _this.providedHandleKeyDown = handleKeyDown;
39777 return _this;
39778 }
39779 TabGuardCtrl.prototype.postConstruct = function () {
39780 var _this = this;
39781 this.createManagedBean(new ManagedFocusFeature(this.eFocusableElement, {
39782 shouldStopEventPropagation: function () { return _this.shouldStopEventPropagation(); },
39783 onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
39784 handleKeyDown: function (e) { return _this.handleKeyDown(e); },
39785 onFocusIn: function (e) { return _this.onFocusIn(e); },
39786 onFocusOut: function (e) { return _this.onFocusOut(e); }
39787 }));
39788 this.activateTabGuards();
39789 [this.eTopGuard, this.eBottomGuard].forEach(function (guard) { return _this.addManagedListener(guard, 'focus', _this.onFocus.bind(_this)); });
39790 };
39791 TabGuardCtrl.prototype.handleKeyDown = function (e) {
39792 if (this.providedHandleKeyDown) {
39793 this.providedHandleKeyDown(e);
39794 }
39795 };
39796 TabGuardCtrl.prototype.tabGuardsAreActive = function () {
39797 return !!this.eTopGuard && this.eTopGuard.hasAttribute('tabIndex');
39798 };
39799 TabGuardCtrl.prototype.shouldStopEventPropagation = function () {
39800 if (this.providedShouldStopEventPropagation) {
39801 return this.providedShouldStopEventPropagation();
39802 }
39803 return false;
39804 };
39805 TabGuardCtrl.prototype.activateTabGuards = function () {
39806 this.comp.setTabIndex(this.getGridTabIndex());
39807 };
39808 TabGuardCtrl.prototype.deactivateTabGuards = function () {
39809 this.comp.setTabIndex();
39810 };
39811 TabGuardCtrl.prototype.onFocus = function (e) {
39812 if (this.skipTabGuardFocus) {
39813 this.skipTabGuardFocus = false;
39814 return;
39815 }
39816 var fromBottom = e.target === this.eBottomGuard;
39817 if (this.providedFocusInnerElement) {
39818 this.providedFocusInnerElement(fromBottom);
39819 }
39820 else {
39821 this.focusInnerElement(fromBottom);
39822 }
39823 };
39824 TabGuardCtrl.prototype.onFocusIn = function (e) {
39825 if (this.providedFocusIn && this.providedFocusIn(e)) {
39826 return;
39827 }
39828 this.deactivateTabGuards();
39829 };
39830 TabGuardCtrl.prototype.onFocusOut = function (e) {
39831 if (this.providedFocusOut && this.providedFocusOut(e)) {
39832 return;
39833 }
39834 if (!this.eFocusableElement.contains(e.relatedTarget)) {
39835 this.activateTabGuards();
39836 }
39837 };
39838 TabGuardCtrl.prototype.onTabKeyDown = function (e) {
39839 var _this = this;
39840 if (this.providedOnTabKeyDown) {
39841 this.providedOnTabKeyDown(e);
39842 return;
39843 }
39844 if (e.defaultPrevented) {
39845 return;
39846 }
39847 var tabGuardsAreActive = this.tabGuardsAreActive();
39848 if (tabGuardsAreActive) {
39849 this.deactivateTabGuards();
39850 }
39851 var nextRoot = this.getNextFocusableElement(e.shiftKey);
39852 if (tabGuardsAreActive) {
39853 // ensure the tab guards are only re-instated once the event has finished processing, to avoid the browser
39854 // tabbing to the tab guard from inside the component
39855 setTimeout(function () { return _this.activateTabGuards(); }, 0);
39856 }
39857 if (!nextRoot) {
39858 return;
39859 }
39860 nextRoot.focus();
39861 e.preventDefault();
39862 };
39863 TabGuardCtrl.prototype.getGridTabIndex = function () {
39864 return this.gridOptionsWrapper.getGridTabIndex();
39865 };
39866 TabGuardCtrl.prototype.focusInnerElement = function (fromBottom) {
39867 if (fromBottom === void 0) { fromBottom = false; }
39868 var focusable = this.focusService.findFocusableElements(this.eFocusableElement);
39869 if (this.tabGuardsAreActive()) {
39870 // remove tab guards from this component from list of focusable elements
39871 focusable.splice(0, 1);
39872 focusable.splice(focusable.length - 1, 1);
39873 }
39874 if (!focusable.length) {
39875 return;
39876 }
39877 focusable[fromBottom ? focusable.length - 1 : 0].focus();
39878 };
39879 TabGuardCtrl.prototype.getNextFocusableElement = function (backwards) {
39880 return this.focusService.findNextFocusableElement(this.eFocusableElement, false, backwards);
39881 };
39882 TabGuardCtrl.prototype.forceFocusOutOfContainer = function (up) {
39883 if (up === void 0) { up = false; }
39884 var tabGuardToFocus = up ? this.eTopGuard : this.eBottomGuard;
39885 this.activateTabGuards();
39886 this.skipTabGuardFocus = true;
39887 tabGuardToFocus.focus();
39888 };
39889 __decorate$1H([
39890 Autowired('focusService')
39891 ], TabGuardCtrl.prototype, "focusService", void 0);
39892 __decorate$1H([
39893 PostConstruct
39894 ], TabGuardCtrl.prototype, "postConstruct", null);
39895 return TabGuardCtrl;
39896}(BeanStub));
39897
39898/**
39899 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
39900 * @version v27.3.0
39901 * @link https://www.ag-grid.com/
39902 * @license MIT
39903 */
39904var __extends$21 = (undefined && undefined.__extends) || (function () {
39905 var extendStatics = function (d, b) {
39906 extendStatics = Object.setPrototypeOf ||
39907 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
39908 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
39909 return extendStatics(d, b);
39910 };
39911 return function (d, b) {
39912 extendStatics(d, b);
39913 function __() { this.constructor = d; }
39914 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
39915 };
39916})();
39917var __read$f = (undefined && undefined.__read) || function (o, n) {
39918 var m = typeof Symbol === "function" && o[Symbol.iterator];
39919 if (!m) return o;
39920 var i = m.call(o), r, ar = [], e;
39921 try {
39922 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
39923 }
39924 catch (error) { e = { error: error }; }
39925 finally {
39926 try {
39927 if (r && !r.done && (m = i["return"])) m.call(i);
39928 }
39929 finally { if (e) throw e.error; }
39930 }
39931 return ar;
39932};
39933var __spread$b = (undefined && undefined.__spread) || function () {
39934 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$f(arguments[i]));
39935 return ar;
39936};
39937var TabGuardComp = /** @class */ (function (_super) {
39938 __extends$21(TabGuardComp, _super);
39939 function TabGuardComp() {
39940 return _super !== null && _super.apply(this, arguments) || this;
39941 }
39942 TabGuardComp.prototype.initialiseTabGuard = function (params) {
39943 this.eTopGuard = this.createTabGuard('top');
39944 this.eBottomGuard = this.createTabGuard('bottom');
39945 this.eFocusableElement = this.getFocusableElement();
39946 var tabGuards = [this.eTopGuard, this.eBottomGuard];
39947 var compProxy = {
39948 setTabIndex: function (tabIndex) {
39949 tabGuards.forEach(function (tabGuard) { return tabIndex != null ? tabGuard.setAttribute('tabIndex', tabIndex) : tabGuard.removeAttribute('tabIndex'); });
39950 }
39951 };
39952 this.addTabGuards(this.eTopGuard, this.eBottomGuard);
39953 this.tabGuardCtrl = this.createManagedBean(new TabGuardCtrl({
39954 comp: compProxy,
39955 eTopGuard: this.eTopGuard,
39956 eBottomGuard: this.eBottomGuard,
39957 eFocusableElement: this.eFocusableElement,
39958 onFocusIn: params.onFocusIn,
39959 onFocusOut: params.onFocusOut,
39960 focusInnerElement: params.focusInnerElement,
39961 handleKeyDown: params.handleKeyDown,
39962 onTabKeyDown: params.onTabKeyDown,
39963 shouldStopEventPropagation: params.shouldStopEventPropagation
39964 }));
39965 };
39966 TabGuardComp.prototype.createTabGuard = function (side) {
39967 var tabGuard = document.createElement('div');
39968 tabGuard.classList.add('ag-tab-guard', "ag-tab-guard-" + side);
39969 setAriaRole(tabGuard, 'presentation');
39970 return tabGuard;
39971 };
39972 TabGuardComp.prototype.addTabGuards = function (topTabGuard, bottomTabGuard) {
39973 this.eFocusableElement.insertAdjacentElement('afterbegin', topTabGuard);
39974 this.eFocusableElement.insertAdjacentElement('beforeend', bottomTabGuard);
39975 };
39976 TabGuardComp.prototype.removeAllChildrenExceptTabGuards = function () {
39977 var tabGuards = [this.eTopGuard, this.eBottomGuard];
39978 clearElement(this.getFocusableElement());
39979 this.addTabGuards.apply(this, __spread$b(tabGuards));
39980 };
39981 TabGuardComp.prototype.forceFocusOutOfContainer = function (up) {
39982 if (up === void 0) { up = false; }
39983 this.tabGuardCtrl.forceFocusOutOfContainer(up);
39984 };
39985 TabGuardComp.prototype.appendChild = function (newChild, container) {
39986 if (!isNodeOrElement(newChild)) {
39987 newChild = newChild.getGui();
39988 }
39989 var bottomTabGuard = this.eBottomGuard;
39990 if (bottomTabGuard) {
39991 bottomTabGuard.insertAdjacentElement('beforebegin', newChild);
39992 }
39993 else {
39994 _super.prototype.appendChild.call(this, newChild, container);
39995 }
39996 };
39997 return TabGuardComp;
39998}(Component));
39999
40000/**
40001 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
40002 * @version v27.3.0
40003 * @link https://www.ag-grid.com/
40004 * @license MIT
40005 */
40006var __extends$22 = (undefined && undefined.__extends) || (function () {
40007 var extendStatics = function (d, b) {
40008 extendStatics = Object.setPrototypeOf ||
40009 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
40010 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
40011 return extendStatics(d, b);
40012 };
40013 return function (d, b) {
40014 extendStatics(d, b);
40015 function __() { this.constructor = d; }
40016 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40017 };
40018})();
40019var __assign$f = (undefined && undefined.__assign) || function () {
40020 __assign$f = Object.assign || function(t) {
40021 for (var s, i = 1, n = arguments.length; i < n; i++) {
40022 s = arguments[i];
40023 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
40024 t[p] = s[p];
40025 }
40026 return t;
40027 };
40028 return __assign$f.apply(this, arguments);
40029};
40030var __decorate$1I = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
40031 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
40032 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
40033 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;
40034 return c > 3 && r && Object.defineProperty(target, key, r), r;
40035};
40036var AgMenuList = /** @class */ (function (_super) {
40037 __extends$22(AgMenuList, _super);
40038 function AgMenuList(level) {
40039 if (level === void 0) { level = 1; }
40040 var _this = _super.call(this, /* html */ "<div class=\"ag-menu-list\" role=\"tree\"></div>") || this;
40041 _this.level = level;
40042 _this.menuItems = [];
40043 return _this;
40044 }
40045 AgMenuList.prototype.postConstruct = function () {
40046 var _this = this;
40047 this.initialiseTabGuard({
40048 onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
40049 handleKeyDown: function (e) { return _this.handleKeyDown(e); }
40050 });
40051 };
40052 AgMenuList.prototype.onTabKeyDown = function (e) {
40053 var parent = this.getParentComponent();
40054 var parentGui = parent && parent.getGui();
40055 var isManaged = parentGui && parentGui.classList.contains('ag-focus-managed');
40056 if (!isManaged) {
40057 e.preventDefault();
40058 }
40059 if (e.shiftKey) {
40060 this.closeIfIsChild(e);
40061 }
40062 };
40063 AgMenuList.prototype.handleKeyDown = function (e) {
40064 switch (e.key) {
40065 case KeyCode.UP:
40066 case KeyCode.RIGHT:
40067 case KeyCode.DOWN:
40068 case KeyCode.LEFT:
40069 e.preventDefault();
40070 this.handleNavKey(e.key);
40071 break;
40072 case KeyCode.ESCAPE:
40073 var topMenu = this.findTopMenu();
40074 if (topMenu) {
40075 this.focusService.focusInto(topMenu.getGui());
40076 }
40077 break;
40078 }
40079 };
40080 AgMenuList.prototype.clearActiveItem = function () {
40081 if (this.activeMenuItem) {
40082 this.activeMenuItem.deactivate();
40083 this.activeMenuItem = null;
40084 }
40085 };
40086 AgMenuList.prototype.addMenuItems = function (menuItems) {
40087 var _this = this;
40088 if (menuItems == null) {
40089 return;
40090 }
40091 menuItems.forEach(function (menuItemOrString) {
40092 if (menuItemOrString === 'separator') {
40093 _this.addSeparator();
40094 }
40095 else if (typeof menuItemOrString === 'string') {
40096 console.warn("AG Grid: unrecognised menu item " + menuItemOrString);
40097 }
40098 else {
40099 _this.addItem(menuItemOrString);
40100 }
40101 });
40102 };
40103 AgMenuList.prototype.addItem = function (menuItemDef) {
40104 var _this = this;
40105 var menuItem = this.createManagedBean(new AgMenuItemComponent(__assign$f(__assign$f({}, menuItemDef), { isAnotherSubMenuOpen: function () { return _this.menuItems.some(function (m) { return m.isSubMenuOpen(); }); } })));
40106 menuItem.setParentComponent(this);
40107 setAriaLevel(menuItem.getGui(), this.level);
40108 this.menuItems.push(menuItem);
40109 this.appendChild(menuItem.getGui());
40110 this.addManagedListener(menuItem, AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED, function (event) {
40111 _this.dispatchEvent(event);
40112 });
40113 this.addManagedListener(menuItem, AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED, function (event) {
40114 if (_this.activeMenuItem && _this.activeMenuItem !== event.menuItem) {
40115 _this.activeMenuItem.deactivate();
40116 }
40117 _this.activeMenuItem = event.menuItem;
40118 });
40119 };
40120 AgMenuList.prototype.activateFirstItem = function () {
40121 var item = this.menuItems.filter(function (currentItem) { return !currentItem.isDisabled(); })[0];
40122 if (!item) {
40123 return;
40124 }
40125 item.activate();
40126 };
40127 AgMenuList.prototype.addSeparator = function () {
40128 var separatorHtml = /* html */ "\n <div class=\"ag-menu-separator\" aria-hidden=\"true\">\n <div class=\"ag-menu-separator-part\"></div>\n <div class=\"ag-menu-separator-part\"></div>\n <div class=\"ag-menu-separator-part\"></div>\n <div class=\"ag-menu-separator-part\"></div>\n </div>";
40129 this.appendChild(loadTemplate(separatorHtml));
40130 };
40131 AgMenuList.prototype.findTopMenu = function () {
40132 var parent = this.getParentComponent();
40133 if (!parent && this instanceof AgMenuList) {
40134 return this;
40135 }
40136 while (true) {
40137 var nextParent = parent && parent.getParentComponent && parent.getParentComponent();
40138 if (!nextParent || (!(nextParent instanceof AgMenuList || nextParent instanceof AgMenuItemComponent))) {
40139 break;
40140 }
40141 parent = nextParent;
40142 }
40143 return parent instanceof AgMenuList ? parent : undefined;
40144 };
40145 AgMenuList.prototype.handleNavKey = function (key) {
40146 switch (key) {
40147 case KeyCode.UP:
40148 case KeyCode.DOWN:
40149 var nextItem = this.findNextItem(key === KeyCode.UP);
40150 if (nextItem && nextItem !== this.activeMenuItem) {
40151 nextItem.activate();
40152 }
40153 return;
40154 }
40155 var left = this.gridOptionsWrapper.isEnableRtl() ? KeyCode.RIGHT : KeyCode.LEFT;
40156 if (key === left) {
40157 this.closeIfIsChild();
40158 }
40159 else {
40160 this.openChild();
40161 }
40162 };
40163 AgMenuList.prototype.closeIfIsChild = function (e) {
40164 var parentItem = this.getParentComponent();
40165 if (parentItem && parentItem instanceof AgMenuItemComponent) {
40166 if (e) {
40167 e.preventDefault();
40168 }
40169 parentItem.closeSubMenu();
40170 parentItem.getGui().focus();
40171 }
40172 };
40173 AgMenuList.prototype.openChild = function () {
40174 if (this.activeMenuItem) {
40175 this.activeMenuItem.openSubMenu(true);
40176 }
40177 };
40178 AgMenuList.prototype.findNextItem = function (up) {
40179 var items = this.menuItems.filter(function (item) { return !item.isDisabled(); });
40180 if (!items.length) {
40181 return;
40182 }
40183 if (!this.activeMenuItem) {
40184 return up ? last(items) : items[0];
40185 }
40186 if (up) {
40187 items.reverse();
40188 }
40189 var nextItem;
40190 var foundCurrent = false;
40191 for (var i = 0; i < items.length; i++) {
40192 var item = items[i];
40193 if (!foundCurrent) {
40194 if (item === this.activeMenuItem) {
40195 foundCurrent = true;
40196 }
40197 continue;
40198 }
40199 nextItem = item;
40200 break;
40201 }
40202 return nextItem || this.activeMenuItem;
40203 };
40204 AgMenuList.prototype.destroy = function () {
40205 this.clearActiveItem();
40206 _super.prototype.destroy.call(this);
40207 };
40208 __decorate$1I([
40209 Autowired('focusService')
40210 ], AgMenuList.prototype, "focusService", void 0);
40211 __decorate$1I([
40212 PostConstruct
40213 ], AgMenuList.prototype, "postConstruct", null);
40214 return AgMenuList;
40215}(TabGuardComp));
40216
40217/**
40218 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
40219 * @version v27.3.0
40220 * @link https://www.ag-grid.com/
40221 * @license MIT
40222 */
40223var __extends$23 = (undefined && undefined.__extends) || (function () {
40224 var extendStatics = function (d, b) {
40225 extendStatics = Object.setPrototypeOf ||
40226 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
40227 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
40228 return extendStatics(d, b);
40229 };
40230 return function (d, b) {
40231 extendStatics(d, b);
40232 function __() { this.constructor = d; }
40233 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40234 };
40235})();
40236var __decorate$1J = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
40237 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
40238 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
40239 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;
40240 return c > 3 && r && Object.defineProperty(target, key, r), r;
40241};
40242var AgMenuPanel = /** @class */ (function (_super) {
40243 __extends$23(AgMenuPanel, _super);
40244 function AgMenuPanel(wrappedComponent) {
40245 var _this = _super.call(this) || this;
40246 _this.wrappedComponent = wrappedComponent;
40247 _this.setTemplateFromElement(wrappedComponent.getGui());
40248 return _this;
40249 }
40250 AgMenuPanel.prototype.postConstruct = function () {
40251 var _this = this;
40252 this.initialiseTabGuard({
40253 onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
40254 handleKeyDown: function (e) { return _this.handleKeyDown(e); }
40255 });
40256 };
40257 AgMenuPanel.prototype.handleKeyDown = function (e) {
40258 if (e.key === KeyCode.ESCAPE) {
40259 this.closePanel();
40260 }
40261 };
40262 AgMenuPanel.prototype.onTabKeyDown = function (e) {
40263 if (e.defaultPrevented) {
40264 return;
40265 }
40266 this.closePanel();
40267 e.preventDefault();
40268 };
40269 AgMenuPanel.prototype.closePanel = function () {
40270 var menuItem = this.parentComponent;
40271 menuItem.closeSubMenu();
40272 setTimeout(function () { return menuItem.getGui().focus(); }, 0);
40273 };
40274 __decorate$1J([
40275 PostConstruct
40276 ], AgMenuPanel.prototype, "postConstruct", null);
40277 return AgMenuPanel;
40278}(TabGuardComp));
40279
40280/**
40281 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
40282 * @version v27.3.0
40283 * @link https://www.ag-grid.com/
40284 * @license MIT
40285 */
40286var __extends$24 = (undefined && undefined.__extends) || (function () {
40287 var extendStatics = function (d, b) {
40288 extendStatics = Object.setPrototypeOf ||
40289 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
40290 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
40291 return extendStatics(d, b);
40292 };
40293 return function (d, b) {
40294 extendStatics(d, b);
40295 function __() { this.constructor = d; }
40296 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40297 };
40298})();
40299var __decorate$1K = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
40300 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
40301 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
40302 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;
40303 return c > 3 && r && Object.defineProperty(target, key, r), r;
40304};
40305var AgMenuItemComponent = /** @class */ (function (_super) {
40306 __extends$24(AgMenuItemComponent, _super);
40307 function AgMenuItemComponent(params) {
40308 var _this = _super.call(this) || this;
40309 _this.params = params;
40310 _this.isActive = false;
40311 _this.subMenuIsOpen = false;
40312 _this.setTemplate(/* html */ "<div class=\"" + _this.getClassName() + "\" tabindex=\"-1\" role=\"treeitem\"></div>");
40313 return _this;
40314 }
40315 AgMenuItemComponent.prototype.init = function () {
40316 var _this = this;
40317 this.addIcon();
40318 this.addName();
40319 this.addShortcut();
40320 this.addSubMenu();
40321 this.addTooltip();
40322 var eGui = this.getGui();
40323 if (this.params.disabled) {
40324 this.addCssClass(this.getClassName('disabled'));
40325 setAriaDisabled(eGui, true);
40326 }
40327 else {
40328 this.addGuiEventListener('click', function (e) { return _this.onItemSelected(e); });
40329 this.addGuiEventListener('keydown', function (e) {
40330 if (e.key === KeyCode.ENTER || e.key === KeyCode.SPACE) {
40331 e.preventDefault();
40332 _this.onItemSelected(e);
40333 }
40334 });
40335 this.addGuiEventListener('mousedown', function (e) {
40336 // Prevent event bubbling to other event handlers such as PopupService triggering
40337 // premature closing of any open sub-menu popup.
40338 e.stopPropagation();
40339 e.preventDefault();
40340 });
40341 this.addGuiEventListener('mouseenter', function () { return _this.onMouseEnter(); });
40342 this.addGuiEventListener('mouseleave', function () { return _this.onMouseLeave(); });
40343 }
40344 if (this.params.cssClasses) {
40345 this.params.cssClasses.forEach(function (it) { return _this.addCssClass(it); });
40346 }
40347 };
40348 AgMenuItemComponent.prototype.isDisabled = function () {
40349 return !!this.params.disabled;
40350 };
40351 AgMenuItemComponent.prototype.openSubMenu = function (activateFirstItem) {
40352 var _this = this;
40353 if (activateFirstItem === void 0) { activateFirstItem = false; }
40354 this.closeSubMenu();
40355 if (!this.params.subMenu) {
40356 return;
40357 }
40358 var ePopup = loadTemplate(/* html */ "<div class=\"ag-menu\" role=\"presentation\"></div>");
40359 var destroySubMenu;
40360 if (this.params.subMenu instanceof Array) {
40361 var currentLevel = getAriaLevel(this.getGui());
40362 var nextLevel = isNaN(currentLevel) ? 1 : (currentLevel + 1);
40363 var childMenu_1 = this.createBean(new AgMenuList(nextLevel));
40364 childMenu_1.setParentComponent(this);
40365 childMenu_1.addMenuItems(this.params.subMenu);
40366 ePopup.appendChild(childMenu_1.getGui());
40367 // bubble menu item selected events
40368 this.addManagedListener(childMenu_1, AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED, function (e) { return _this.dispatchEvent(e); });
40369 childMenu_1.addGuiEventListener('mouseenter', function () { return _this.cancelDeactivate(); });
40370 destroySubMenu = function () { return _this.destroyBean(childMenu_1); };
40371 if (activateFirstItem) {
40372 setTimeout(function () { return childMenu_1.activateFirstItem(); }, 0);
40373 }
40374 }
40375 else {
40376 var subMenu_1 = this.params.subMenu;
40377 var menuPanel = this.createBean(new AgMenuPanel(subMenu_1));
40378 menuPanel.setParentComponent(this);
40379 var subMenuGui_1 = menuPanel.getGui();
40380 var mouseEvent_1 = 'mouseenter';
40381 var mouseEnterListener_1 = function () { return _this.cancelDeactivate(); };
40382 subMenuGui_1.addEventListener(mouseEvent_1, mouseEnterListener_1);
40383 destroySubMenu = function () { return subMenuGui_1.removeEventListener(mouseEvent_1, mouseEnterListener_1); };
40384 ePopup.appendChild(subMenuGui_1);
40385 if (subMenu_1.afterGuiAttached) {
40386 setTimeout(function () { return subMenu_1.afterGuiAttached(); }, 0);
40387 }
40388 }
40389 var eGui = this.getGui();
40390 var positionCallback = this.popupService.positionPopupForMenu.bind(this.popupService, { eventSource: eGui, ePopup: ePopup });
40391 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
40392 var addPopupRes = this.popupService.addPopup({
40393 modal: true,
40394 eChild: ePopup,
40395 positionCallback: positionCallback,
40396 anchorToElement: eGui,
40397 ariaLabel: translate('ariaLabelSubMenu', 'SubMenu')
40398 });
40399 this.subMenuIsOpen = true;
40400 setAriaExpanded(eGui, true);
40401 this.hideSubMenu = function () {
40402 if (addPopupRes) {
40403 addPopupRes.hideFunc();
40404 }
40405 _this.subMenuIsOpen = false;
40406 setAriaExpanded(eGui, false);
40407 destroySubMenu();
40408 };
40409 };
40410 AgMenuItemComponent.prototype.closeSubMenu = function () {
40411 if (!this.hideSubMenu) {
40412 return;
40413 }
40414 this.hideSubMenu();
40415 this.hideSubMenu = null;
40416 setAriaExpanded(this.getGui(), false);
40417 };
40418 AgMenuItemComponent.prototype.isSubMenuOpen = function () {
40419 return this.subMenuIsOpen;
40420 };
40421 AgMenuItemComponent.prototype.activate = function (openSubMenu) {
40422 var _this = this;
40423 this.cancelActivate();
40424 if (this.params.disabled) {
40425 return;
40426 }
40427 this.isActive = true;
40428 this.addCssClass(this.getClassName('active'));
40429 this.getGui().focus();
40430 if (openSubMenu && this.params.subMenu) {
40431 window.setTimeout(function () {
40432 if (_this.isAlive() && _this.isActive) {
40433 _this.openSubMenu();
40434 }
40435 }, 300);
40436 }
40437 this.onItemActivated();
40438 };
40439 AgMenuItemComponent.prototype.deactivate = function () {
40440 this.cancelDeactivate();
40441 this.removeCssClass(this.getClassName('active'));
40442 this.isActive = false;
40443 if (this.subMenuIsOpen) {
40444 this.hideSubMenu();
40445 }
40446 };
40447 AgMenuItemComponent.prototype.addIcon = function () {
40448 if (!this.params.checked && !this.params.icon && this.params.isCompact) {
40449 return;
40450 }
40451 var icon = loadTemplate(/* html */ "<span ref=\"eIcon\" class=\"" + this.getClassName('part') + " " + this.getClassName('icon') + "\" role=\"presentation\"></span>");
40452 if (this.params.checked) {
40453 icon.appendChild(createIconNoSpan('check', this.gridOptionsWrapper));
40454 }
40455 else if (this.params.icon) {
40456 if (isNodeOrElement(this.params.icon)) {
40457 icon.appendChild(this.params.icon);
40458 }
40459 else if (typeof this.params.icon === 'string') {
40460 icon.innerHTML = this.params.icon;
40461 }
40462 else {
40463 console.warn('AG Grid: menu item icon must be DOM node or string');
40464 }
40465 }
40466 this.getGui().appendChild(icon);
40467 };
40468 AgMenuItemComponent.prototype.addName = function () {
40469 if (!this.params.name && this.params.isCompact) {
40470 return;
40471 }
40472 var name = loadTemplate(/* html */ "<span ref=\"eName\" class=\"" + this.getClassName('part') + " " + this.getClassName('text') + "\">" + (this.params.name || '') + "</span>");
40473 this.getGui().appendChild(name);
40474 };
40475 AgMenuItemComponent.prototype.addTooltip = function () {
40476 if (!this.params.tooltip) {
40477 return;
40478 }
40479 this.tooltip = this.params.tooltip;
40480 if (this.gridOptionsWrapper.isEnableBrowserTooltips()) {
40481 this.getGui().setAttribute('title', this.tooltip);
40482 }
40483 else {
40484 this.createManagedBean(new CustomTooltipFeature(this));
40485 }
40486 };
40487 AgMenuItemComponent.prototype.getTooltipParams = function () {
40488 return {
40489 location: 'menu',
40490 value: this.tooltip
40491 };
40492 };
40493 AgMenuItemComponent.prototype.addShortcut = function () {
40494 if (!this.params.shortcut && this.params.isCompact) {
40495 return;
40496 }
40497 var shortcut = loadTemplate(/* html */ "<span ref=\"eShortcut\" class=\"" + this.getClassName('part') + " " + this.getClassName('shortcut') + "\">" + (this.params.shortcut || '') + "</span>");
40498 this.getGui().appendChild(shortcut);
40499 };
40500 AgMenuItemComponent.prototype.addSubMenu = function () {
40501 if (!this.params.subMenu && this.params.isCompact) {
40502 return;
40503 }
40504 var pointer = loadTemplate(/* html */ "<span ref=\"ePopupPointer\" class=\"" + this.getClassName('part') + " " + this.getClassName('popup-pointer') + "\"></span>");
40505 var eGui = this.getGui();
40506 if (this.params.subMenu) {
40507 var iconName = this.gridOptionsWrapper.isEnableRtl() ? 'smallLeft' : 'smallRight';
40508 setAriaExpanded(eGui, false);
40509 pointer.appendChild(createIconNoSpan(iconName, this.gridOptionsWrapper));
40510 }
40511 eGui.appendChild(pointer);
40512 };
40513 AgMenuItemComponent.prototype.onItemSelected = function (event) {
40514 if (this.params.action) {
40515 this.params.action();
40516 }
40517 else {
40518 this.openSubMenu(event && event.type === 'keydown');
40519 }
40520 if (this.params.subMenu && !this.params.action) {
40521 return;
40522 }
40523 var e = {
40524 type: AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED,
40525 action: this.params.action,
40526 checked: this.params.checked,
40527 cssClasses: this.params.cssClasses,
40528 disabled: this.params.disabled,
40529 icon: this.params.icon,
40530 name: this.params.name,
40531 shortcut: this.params.shortcut,
40532 subMenu: this.params.subMenu,
40533 tooltip: this.params.tooltip,
40534 event: event
40535 };
40536 this.dispatchEvent(e);
40537 };
40538 AgMenuItemComponent.prototype.onItemActivated = function () {
40539 var event = {
40540 type: AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED,
40541 menuItem: this,
40542 };
40543 this.dispatchEvent(event);
40544 };
40545 AgMenuItemComponent.prototype.cancelActivate = function () {
40546 if (this.activateTimeoutId) {
40547 window.clearTimeout(this.activateTimeoutId);
40548 this.activateTimeoutId = 0;
40549 }
40550 };
40551 AgMenuItemComponent.prototype.cancelDeactivate = function () {
40552 if (this.deactivateTimeoutId) {
40553 window.clearTimeout(this.deactivateTimeoutId);
40554 this.deactivateTimeoutId = 0;
40555 }
40556 };
40557 AgMenuItemComponent.prototype.onMouseEnter = function () {
40558 var _this = this;
40559 this.cancelDeactivate();
40560 if (this.params.isAnotherSubMenuOpen()) {
40561 // wait to see if the user enters the open sub-menu
40562 this.activateTimeoutId = window.setTimeout(function () { return _this.activate(true); }, AgMenuItemComponent.ACTIVATION_DELAY);
40563 }
40564 else {
40565 // activate immediately
40566 this.activate(true);
40567 }
40568 };
40569 AgMenuItemComponent.prototype.onMouseLeave = function () {
40570 var _this = this;
40571 this.cancelActivate();
40572 if (this.isSubMenuOpen()) {
40573 // wait to see if the user enters the sub-menu
40574 this.deactivateTimeoutId = window.setTimeout(function () { return _this.deactivate(); }, AgMenuItemComponent.ACTIVATION_DELAY);
40575 }
40576 else {
40577 // de-activate immediately
40578 this.deactivate();
40579 }
40580 };
40581 AgMenuItemComponent.prototype.getClassName = function (suffix) {
40582 var prefix = this.params.isCompact ? 'ag-compact-menu-option' : 'ag-menu-option';
40583 return suffix ? prefix + "-" + suffix : prefix;
40584 };
40585 AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED = 'menuItemSelected';
40586 AgMenuItemComponent.EVENT_MENU_ITEM_ACTIVATED = 'menuItemActivated';
40587 AgMenuItemComponent.ACTIVATION_DELAY = 80;
40588 __decorate$1K([
40589 Autowired('popupService')
40590 ], AgMenuItemComponent.prototype, "popupService", void 0);
40591 __decorate$1K([
40592 PostConstruct
40593 ], AgMenuItemComponent.prototype, "init", null);
40594 return AgMenuItemComponent;
40595}(Component));
40596
40597/**
40598 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
40599 * @version v27.3.0
40600 * @link https://www.ag-grid.com/
40601 * @license MIT
40602 */
40603var __extends$25 = (undefined && undefined.__extends) || (function () {
40604 var extendStatics = function (d, b) {
40605 extendStatics = Object.setPrototypeOf ||
40606 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
40607 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
40608 return extendStatics(d, b);
40609 };
40610 return function (d, b) {
40611 extendStatics(d, b);
40612 function __() { this.constructor = d; }
40613 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40614 };
40615})();
40616var __decorate$1L = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
40617 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
40618 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
40619 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;
40620 return c > 3 && r && Object.defineProperty(target, key, r), r;
40621};
40622var __read$g = (undefined && undefined.__read) || function (o, n) {
40623 var m = typeof Symbol === "function" && o[Symbol.iterator];
40624 if (!m) return o;
40625 var i = m.call(o), r, ar = [], e;
40626 try {
40627 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
40628 }
40629 catch (error) { e = { error: error }; }
40630 finally {
40631 try {
40632 if (r && !r.done && (m = i["return"])) m.call(i);
40633 }
40634 finally { if (e) throw e.error; }
40635 }
40636 return ar;
40637};
40638var __spread$c = (undefined && undefined.__spread) || function () {
40639 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$g(arguments[i]));
40640 return ar;
40641};
40642var FocusService = /** @class */ (function (_super) {
40643 __extends$25(FocusService, _super);
40644 function FocusService() {
40645 return _super !== null && _super.apply(this, arguments) || this;
40646 }
40647 FocusService_1 = FocusService;
40648 /**
40649 * Adds a gridCore to the list of the gridCores monitoring Keyboard Mode
40650 * in a specific HTMLDocument.
40651 *
40652 * @param doc {Document} - The Document containing the gridCore.
40653 * @param gridCore {GridComp} - The GridCore to be monitored.
40654 */
40655 FocusService.addKeyboardModeEvents = function (doc, controller) {
40656 var docControllers = FocusService_1.instancesMonitored.get(doc);
40657 if (docControllers && docControllers.length > 0) {
40658 if (docControllers.indexOf(controller) === -1) {
40659 docControllers.push(controller);
40660 }
40661 }
40662 else {
40663 FocusService_1.instancesMonitored.set(doc, [controller]);
40664 doc.addEventListener('keydown', FocusService_1.toggleKeyboardMode);
40665 doc.addEventListener('mousedown', FocusService_1.toggleKeyboardMode);
40666 }
40667 };
40668 /**
40669 * Removes a gridCore from the list of the gridCores monitoring Keyboard Mode
40670 * in a specific HTMLDocument.
40671 *
40672 * @param doc {Document} - The Document containing the gridCore.
40673 * @param gridCore {GridComp} - The GridCore to be removed.
40674 */
40675 FocusService.removeKeyboardModeEvents = function (doc, controller) {
40676 var docControllers = FocusService_1.instancesMonitored.get(doc);
40677 var newControllers = [];
40678 if (docControllers && docControllers.length) {
40679 newControllers = __spread$c(docControllers).filter(function (currentGridCore) { return currentGridCore !== controller; });
40680 FocusService_1.instancesMonitored.set(doc, newControllers);
40681 }
40682 if (newControllers.length === 0) {
40683 doc.removeEventListener('keydown', FocusService_1.toggleKeyboardMode);
40684 doc.removeEventListener('mousedown', FocusService_1.toggleKeyboardMode);
40685 }
40686 };
40687 /**
40688 * This method will be called by `keydown` and `mousedown` events on all Documents monitoring
40689 * KeyboardMode. It will then fire a KEYBOARD_FOCUS, MOUSE_FOCUS on each gridCore present in
40690 * the Document allowing each gridCore to maintain a state for KeyboardMode.
40691 *
40692 * @param event {KeyboardEvent | MouseEvent | TouchEvent} - The event triggered.
40693 */
40694 FocusService.toggleKeyboardMode = function (event) {
40695 var isKeyboardActive = FocusService_1.keyboardModeActive;
40696 var isKeyboardEvent = event.type === 'keydown';
40697 if (isKeyboardEvent) {
40698 // the following keys should not toggle keyboard mode.
40699 if (event.ctrlKey || event.metaKey || event.altKey) {
40700 return;
40701 }
40702 }
40703 if (isKeyboardActive && isKeyboardEvent || !isKeyboardActive && !isKeyboardEvent) {
40704 return;
40705 }
40706 FocusService_1.keyboardModeActive = isKeyboardEvent;
40707 var doc = event.target.ownerDocument;
40708 if (!doc) {
40709 return;
40710 }
40711 var controllersForDoc = FocusService_1.instancesMonitored.get(doc);
40712 if (controllersForDoc) {
40713 controllersForDoc.forEach(function (controller) {
40714 controller.dispatchEvent({ type: isKeyboardEvent ? Events.EVENT_KEYBOARD_FOCUS : Events.EVENT_MOUSE_FOCUS });
40715 });
40716 }
40717 };
40718 FocusService.prototype.init = function () {
40719 var _this = this;
40720 var clearFocusedCellListener = this.clearFocusedCell.bind(this);
40721 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, clearFocusedCellListener);
40722 this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onColumnEverythingChanged.bind(this));
40723 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, clearFocusedCellListener);
40724 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, clearFocusedCellListener);
40725 this.ctrlsService.whenReady(function (p) {
40726 _this.gridCtrl = p.gridCtrl;
40727 var doc = _this.gridOptionsWrapper.getDocument();
40728 FocusService_1.addKeyboardModeEvents(doc, _this.gridCtrl);
40729 _this.addDestroyFunc(function () { return _this.unregisterGridCompController(_this.gridCtrl); });
40730 });
40731 };
40732 FocusService.prototype.unregisterGridCompController = function (gridCompController) {
40733 var doc = this.gridOptionsWrapper.getDocument();
40734 FocusService_1.removeKeyboardModeEvents(doc, gridCompController);
40735 };
40736 FocusService.prototype.onColumnEverythingChanged = function () {
40737 // if the columns change, check and see if this column still exists. if it does, then
40738 // we can keep the focused cell. if it doesn't, then we need to drop the focused cell.
40739 if (!this.focusedCellPosition) {
40740 return;
40741 }
40742 var col = this.focusedCellPosition.column;
40743 var colFromColumnModel = this.columnModel.getGridColumn(col.getId());
40744 if (col !== colFromColumnModel) {
40745 this.clearFocusedCell();
40746 }
40747 };
40748 FocusService.prototype.isKeyboardMode = function () {
40749 return FocusService_1.keyboardModeActive;
40750 };
40751 // we check if the browser is focusing something, and if it is, and
40752 // it's the cell we think is focused, then return the cell. so this
40753 // methods returns the cell if a) we think it has focus and b) the
40754 // browser thinks it has focus. this then returns nothing if we
40755 // first focus a cell, then second click outside the grid, as then the
40756 // grid cell will still be focused as far as the grid is concerned,
40757 // however the browser focus will have moved somewhere else.
40758 FocusService.prototype.getFocusCellToUseAfterRefresh = function () {
40759 var eDocument = this.gridOptionsWrapper.getDocument();
40760 if (this.gridOptionsWrapper.isSuppressFocusAfterRefresh() || !this.focusedCellPosition) {
40761 return null;
40762 }
40763 // we check that the browser is actually focusing on the grid, if it is not, then
40764 // we have nothing to worry about. we check for ROW data, as this covers both focused Rows (for Full Width Rows)
40765 // and Cells (covers cells as cells live in rows)
40766 if (this.isDomDataMissingInHierarchy(eDocument.activeElement, RowCtrl.DOM_DATA_KEY_ROW_CTRL)) {
40767 return null;
40768 }
40769 return this.focusedCellPosition;
40770 };
40771 FocusService.prototype.getFocusHeaderToUseAfterRefresh = function () {
40772 var eDocument = this.gridOptionsWrapper.getDocument();
40773 if (this.gridOptionsWrapper.isSuppressFocusAfterRefresh() || !this.focusedHeaderPosition) {
40774 return null;
40775 }
40776 // we check that the browser is actually focusing on the grid, if it is not, then
40777 // we have nothing to worry about
40778 if (this.isDomDataMissingInHierarchy(eDocument.activeElement, AbstractHeaderCellCtrl.DOM_DATA_KEY_HEADER_CTRL)) {
40779 return null;
40780 }
40781 return this.focusedHeaderPosition;
40782 };
40783 FocusService.prototype.isDomDataMissingInHierarchy = function (eBrowserCell, key) {
40784 var ePointer = eBrowserCell;
40785 while (ePointer) {
40786 var data = this.gridOptionsWrapper.getDomData(ePointer, key);
40787 if (data) {
40788 return false;
40789 }
40790 ePointer = ePointer.parentNode;
40791 }
40792 return true;
40793 };
40794 FocusService.prototype.clearFocusedCell = function () {
40795 this.focusedCellPosition = null;
40796 this.onCellFocused(false);
40797 };
40798 FocusService.prototype.getFocusedCell = function () {
40799 return this.focusedCellPosition;
40800 };
40801 FocusService.prototype.setFocusedCell = function (rowIndex, colKey, floating, forceBrowserFocus) {
40802 if (forceBrowserFocus === void 0) { forceBrowserFocus = false; }
40803 var gridColumn = this.columnModel.getGridColumn(colKey);
40804 // if column doesn't exist, then blank the focused cell and return. this can happen when user sets new columns,
40805 // and the focused cell is in a column that no longer exists. after columns change, the grid refreshes and tries
40806 // to re-focus the focused cell.
40807 if (!gridColumn) {
40808 this.focusedCellPosition = null;
40809 return;
40810 }
40811 this.focusedCellPosition = gridColumn ? { rowIndex: rowIndex, rowPinned: makeNull(floating), column: gridColumn } : null;
40812 this.onCellFocused(forceBrowserFocus);
40813 };
40814 FocusService.prototype.isCellFocused = function (cellPosition) {
40815 if (this.focusedCellPosition == null) {
40816 return false;
40817 }
40818 return this.focusedCellPosition.column === cellPosition.column &&
40819 this.isRowFocused(cellPosition.rowIndex, cellPosition.rowPinned);
40820 };
40821 FocusService.prototype.isRowNodeFocused = function (rowNode) {
40822 return this.isRowFocused(rowNode.rowIndex, rowNode.rowPinned);
40823 };
40824 FocusService.prototype.isHeaderWrapperFocused = function (headerCtrl) {
40825 if (this.focusedHeaderPosition == null) {
40826 return false;
40827 }
40828 var column = headerCtrl.getColumnGroupChild();
40829 var headerRowIndex = headerCtrl.getRowIndex();
40830 var pinned = headerCtrl.getPinned();
40831 var _a = this.focusedHeaderPosition, focusedColumn = _a.column, focusedHeaderRowIndex = _a.headerRowIndex;
40832 return column === focusedColumn &&
40833 headerRowIndex === focusedHeaderRowIndex &&
40834 pinned == focusedColumn.getPinned();
40835 };
40836 FocusService.prototype.clearFocusedHeader = function () {
40837 this.focusedHeaderPosition = null;
40838 };
40839 FocusService.prototype.getFocusedHeader = function () {
40840 return this.focusedHeaderPosition;
40841 };
40842 FocusService.prototype.setFocusedHeader = function (headerRowIndex, column) {
40843 this.focusedHeaderPosition = { headerRowIndex: headerRowIndex, column: column };
40844 };
40845 FocusService.prototype.focusHeaderPosition = function (params) {
40846 var direction = params.direction, fromTab = params.fromTab, allowUserOverride = params.allowUserOverride, event = params.event;
40847 var headerPosition = params.headerPosition;
40848 if (allowUserOverride) {
40849 var gridOptionsWrapper = this.gridOptionsWrapper;
40850 var currentPosition = this.getFocusedHeader();
40851 var headerRowCount = this.headerNavigationService.getHeaderRowCount();
40852 if (fromTab) {
40853 var userFunc = gridOptionsWrapper.getTabToNextHeaderFunc();
40854 if (userFunc) {
40855 var params_1 = {
40856 backwards: direction === 'Before',
40857 previousHeaderPosition: currentPosition,
40858 nextHeaderPosition: headerPosition,
40859 headerRowCount: headerRowCount,
40860 };
40861 headerPosition = userFunc(params_1);
40862 }
40863 }
40864 else {
40865 var userFunc = gridOptionsWrapper.getNavigateToNextHeaderFunc();
40866 if (userFunc && event) {
40867 var params_2 = {
40868 key: event.key,
40869 previousHeaderPosition: currentPosition,
40870 nextHeaderPosition: headerPosition,
40871 headerRowCount: headerRowCount,
40872 event: event,
40873 };
40874 headerPosition = userFunc(params_2);
40875 }
40876 }
40877 }
40878 if (!headerPosition) {
40879 return false;
40880 }
40881 if (headerPosition.headerRowIndex === -1) {
40882 return this.focusGridView(headerPosition.column);
40883 }
40884 this.headerNavigationService.scrollToColumn(headerPosition.column, direction);
40885 var headerRowContainerCtrl = this.ctrlsService.getHeaderRowContainerCtrl(headerPosition.column.getPinned());
40886 // this will automatically call the setFocusedHeader method above
40887 var focusSuccess = headerRowContainerCtrl.focusHeader(headerPosition.headerRowIndex, headerPosition.column, event);
40888 return focusSuccess;
40889 };
40890 FocusService.prototype.focusFirstHeader = function () {
40891 var firstColumn = this.columnModel.getAllDisplayedColumns()[0];
40892 if (!firstColumn) {
40893 return false;
40894 }
40895 if (firstColumn.getParent()) {
40896 firstColumn = this.columnModel.getColumnGroupAtLevel(firstColumn, 0);
40897 }
40898 return this.focusHeaderPosition({
40899 headerPosition: { headerRowIndex: 0, column: firstColumn }
40900 });
40901 };
40902 FocusService.prototype.focusLastHeader = function (event) {
40903 var headerRowIndex = this.headerNavigationService.getHeaderRowCount() - 1;
40904 var column = last(this.columnModel.getAllDisplayedColumns());
40905 return this.focusHeaderPosition({
40906 headerPosition: { headerRowIndex: headerRowIndex, column: column },
40907 event: event
40908 });
40909 };
40910 FocusService.prototype.isAnyCellFocused = function () {
40911 return !!this.focusedCellPosition;
40912 };
40913 FocusService.prototype.isRowFocused = function (rowIndex, floating) {
40914 if (this.focusedCellPosition == null) {
40915 return false;
40916 }
40917 return this.focusedCellPosition.rowIndex === rowIndex && this.focusedCellPosition.rowPinned === makeNull(floating);
40918 };
40919 FocusService.prototype.findFocusableElements = function (rootNode, exclude, onlyUnmanaged) {
40920 if (onlyUnmanaged === void 0) { onlyUnmanaged = false; }
40921 var focusableString = Constants.FOCUSABLE_SELECTOR;
40922 var excludeString = Constants.FOCUSABLE_EXCLUDE;
40923 if (exclude) {
40924 excludeString += ', ' + exclude;
40925 }
40926 if (onlyUnmanaged) {
40927 excludeString += ', [tabindex="-1"]';
40928 }
40929 var nodes = Array.prototype.slice.apply(rootNode.querySelectorAll(focusableString));
40930 var excludeNodes = Array.prototype.slice.apply(rootNode.querySelectorAll(excludeString));
40931 if (!excludeNodes.length) {
40932 return nodes;
40933 }
40934 var diff = function (a, b) { return a.filter(function (element) { return b.indexOf(element) === -1; }); };
40935 return diff(nodes, excludeNodes);
40936 };
40937 FocusService.prototype.focusInto = function (rootNode, up, onlyUnmanaged) {
40938 if (up === void 0) { up = false; }
40939 if (onlyUnmanaged === void 0) { onlyUnmanaged = false; }
40940 var focusableElements = this.findFocusableElements(rootNode, null, onlyUnmanaged);
40941 var toFocus = up ? last(focusableElements) : focusableElements[0];
40942 if (toFocus) {
40943 toFocus.focus();
40944 return true;
40945 }
40946 return false;
40947 };
40948 FocusService.prototype.findNextFocusableElement = function (rootNode, onlyManaged, backwards) {
40949 if (rootNode === void 0) { rootNode = this.eGridDiv; }
40950 var focusable = this.findFocusableElements(rootNode, onlyManaged ? ':not([tabindex="-1"])' : null);
40951 var eDocument = this.gridOptionsWrapper.getDocument();
40952 var activeEl = eDocument.activeElement;
40953 var currentIndex;
40954 if (onlyManaged) {
40955 currentIndex = focusable.findIndex(function (el) { return el.contains(activeEl); });
40956 }
40957 else {
40958 currentIndex = focusable.indexOf(activeEl);
40959 }
40960 var nextIndex = currentIndex + (backwards ? -1 : 1);
40961 if (nextIndex < 0 || nextIndex >= focusable.length) {
40962 return null;
40963 }
40964 return focusable[nextIndex];
40965 };
40966 FocusService.prototype.isFocusUnderManagedComponent = function (rootNode) {
40967 var eDocument = this.gridOptionsWrapper.getDocument();
40968 var managedContainers = rootNode.querySelectorAll("." + ManagedFocusFeature.FOCUS_MANAGED_CLASS);
40969 if (!managedContainers.length) {
40970 return false;
40971 }
40972 for (var i = 0; i < managedContainers.length; i++) {
40973 if (managedContainers[i].contains(eDocument.activeElement)) {
40974 return true;
40975 }
40976 }
40977 return false;
40978 };
40979 FocusService.prototype.findTabbableParent = function (node, limit) {
40980 if (limit === void 0) { limit = 5; }
40981 var counter = 0;
40982 while (node && getTabIndex(node) === null && ++counter <= limit) {
40983 node = node.parentElement;
40984 }
40985 if (getTabIndex(node) === null) {
40986 return null;
40987 }
40988 return node;
40989 };
40990 FocusService.prototype.onCellFocused = function (forceBrowserFocus) {
40991 var event = {
40992 type: Events.EVENT_CELL_FOCUSED,
40993 forceBrowserFocus: forceBrowserFocus,
40994 rowIndex: null,
40995 column: null,
40996 floating: null,
40997 api: this.gridApi,
40998 columnApi: this.columnApi,
40999 rowPinned: null,
41000 isFullWidthCell: false
41001 };
41002 if (this.focusedCellPosition) {
41003 var rowIndex = event.rowIndex = this.focusedCellPosition.rowIndex;
41004 var rowPinned = event.rowPinned = this.focusedCellPosition.rowPinned;
41005 event.column = this.focusedCellPosition.column;
41006 var rowCtrl = this.rowRenderer.getRowByPosition({ rowIndex: rowIndex, rowPinned: rowPinned });
41007 if (rowCtrl) {
41008 event.isFullWidthCell = rowCtrl.isFullWidth();
41009 }
41010 }
41011 this.eventService.dispatchEvent(event);
41012 };
41013 FocusService.prototype.focusGridView = function (column, backwards) {
41014 // if suppressCellFocus is `true`, it means the user does not want to
41015 // navigate between the cells using tab. Instead, we put focus on either
41016 // the header or after the grid, depending on whether tab or shift-tab was pressed.
41017 if (this.gridOptionsWrapper.isSuppressCellFocus()) {
41018 if (backwards) {
41019 return this.focusLastHeader();
41020 }
41021 return this.focusNextGridCoreContainer(false);
41022 }
41023 var nextRow = backwards
41024 ? this.rowPositionUtils.getLastRow()
41025 : this.rowPositionUtils.getFirstRow();
41026 if (!nextRow) {
41027 return false;
41028 }
41029 var rowIndex = nextRow.rowIndex, rowPinned = nextRow.rowPinned;
41030 var focusedHeader = this.getFocusedHeader();
41031 if (!column && focusedHeader) {
41032 column = focusedHeader.column;
41033 }
41034 if (rowIndex == null || !column) {
41035 return false;
41036 }
41037 this.navigationService.ensureCellVisible({ rowIndex: rowIndex, column: column, rowPinned: rowPinned });
41038 this.setFocusedCell(rowIndex, column, makeNull(rowPinned), true);
41039 if (this.rangeService) {
41040 var cellPosition = { rowIndex: rowIndex, rowPinned: rowPinned, column: column };
41041 this.rangeService.setRangeToCell(cellPosition);
41042 }
41043 return true;
41044 };
41045 FocusService.prototype.focusNextGridCoreContainer = function (backwards) {
41046 if (this.gridCtrl.focusNextInnerContainer(backwards)) {
41047 return true;
41048 }
41049 if (!backwards && !this.gridCtrl.isDetailGrid()) {
41050 this.gridCtrl.forceFocusOutOfContainer();
41051 }
41052 return false;
41053 };
41054 var FocusService_1;
41055 FocusService.AG_KEYBOARD_FOCUS = 'ag-keyboard-focus';
41056 FocusService.keyboardModeActive = false;
41057 FocusService.instancesMonitored = new Map();
41058 __decorate$1L([
41059 Autowired('eGridDiv')
41060 ], FocusService.prototype, "eGridDiv", void 0);
41061 __decorate$1L([
41062 Autowired('columnModel')
41063 ], FocusService.prototype, "columnModel", void 0);
41064 __decorate$1L([
41065 Autowired('headerNavigationService')
41066 ], FocusService.prototype, "headerNavigationService", void 0);
41067 __decorate$1L([
41068 Autowired('columnApi')
41069 ], FocusService.prototype, "columnApi", void 0);
41070 __decorate$1L([
41071 Autowired('gridApi')
41072 ], FocusService.prototype, "gridApi", void 0);
41073 __decorate$1L([
41074 Autowired('rowRenderer')
41075 ], FocusService.prototype, "rowRenderer", void 0);
41076 __decorate$1L([
41077 Autowired('rowPositionUtils')
41078 ], FocusService.prototype, "rowPositionUtils", void 0);
41079 __decorate$1L([
41080 Optional('rangeService')
41081 ], FocusService.prototype, "rangeService", void 0);
41082 __decorate$1L([
41083 Autowired('navigationService')
41084 ], FocusService.prototype, "navigationService", void 0);
41085 __decorate$1L([
41086 Autowired('ctrlsService')
41087 ], FocusService.prototype, "ctrlsService", void 0);
41088 __decorate$1L([
41089 PostConstruct
41090 ], FocusService.prototype, "init", null);
41091 FocusService = FocusService_1 = __decorate$1L([
41092 Bean('focusService')
41093 ], FocusService);
41094 return FocusService;
41095}(BeanStub));
41096
41097/**
41098 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
41099 * @version v27.3.0
41100 * @link https://www.ag-grid.com/
41101 * @license MIT
41102 */
41103var __extends$26 = (undefined && undefined.__extends) || (function () {
41104 var extendStatics = function (d, b) {
41105 extendStatics = Object.setPrototypeOf ||
41106 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
41107 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
41108 return extendStatics(d, b);
41109 };
41110 return function (d, b) {
41111 extendStatics(d, b);
41112 function __() { this.constructor = d; }
41113 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41114 };
41115})();
41116var __decorate$1M = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
41117 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
41118 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
41119 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;
41120 return c > 3 && r && Object.defineProperty(target, key, r), r;
41121};
41122var DIRECTION;
41123(function (DIRECTION) {
41124 DIRECTION[DIRECTION["vertical"] = 0] = "vertical";
41125 DIRECTION[DIRECTION["horizontal"] = 1] = "horizontal";
41126})(DIRECTION || (DIRECTION = {}));
41127var instanceIdSeq = 0;
41128var PopupService = /** @class */ (function (_super) {
41129 __extends$26(PopupService, _super);
41130 function PopupService() {
41131 var _this = _super !== null && _super.apply(this, arguments) || this;
41132 _this.popupList = [];
41133 return _this;
41134 }
41135 PopupService.prototype.postConstruct = function () {
41136 var _this = this;
41137 this.ctrlsService.whenReady(function (p) {
41138 _this.gridCtrl = p.gridCtrl;
41139 _this.addManagedListener(_this.gridCtrl, Events.EVENT_KEYBOARD_FOCUS, function () {
41140 _this.popupList.forEach(function (popup) { return popup.element.classList.add(FocusService.AG_KEYBOARD_FOCUS); });
41141 });
41142 _this.addManagedListener(_this.gridCtrl, Events.EVENT_MOUSE_FOCUS, function () {
41143 _this.popupList.forEach(function (popup) { return popup.element.classList.remove(FocusService.AG_KEYBOARD_FOCUS); });
41144 });
41145 });
41146 };
41147 PopupService.prototype.getPopupParent = function () {
41148 var ePopupParent = this.gridOptionsWrapper.getPopupParent();
41149 if (ePopupParent) {
41150 return ePopupParent;
41151 }
41152 return this.gridCtrl.getGui();
41153 };
41154 PopupService.prototype.positionPopupForMenu = function (params) {
41155 var sourceRect = params.eventSource.getBoundingClientRect();
41156 var parentRect = this.getParentRect();
41157 var y = this.keepXYWithinBounds(params.ePopup, sourceRect.top - parentRect.top, DIRECTION.vertical);
41158 var minWidth = (params.ePopup.clientWidth > 0) ? params.ePopup.clientWidth : 200;
41159 params.ePopup.style.minWidth = minWidth + "px";
41160 var widthOfParent = parentRect.right - parentRect.left;
41161 var maxX = widthOfParent - minWidth;
41162 // the x position of the popup depends on RTL or LTR. for normal cases, LTR, we put the child popup
41163 // to the right, unless it doesn't fit and we then put it to the left. for RTL it's the other way around,
41164 // we try place it first to the left, and then if not to the right.
41165 var x;
41166 if (this.gridOptionsWrapper.isEnableRtl()) {
41167 // for RTL, try left first
41168 x = xLeftPosition();
41169 if (x < 0) {
41170 x = xRightPosition();
41171 }
41172 if (x > maxX) {
41173 x = 0;
41174 }
41175 }
41176 else {
41177 // for LTR, try right first
41178 x = xRightPosition();
41179 if (x > maxX) {
41180 x = xLeftPosition();
41181 }
41182 if (x < 0) {
41183 x = 0;
41184 }
41185 }
41186 params.ePopup.style.left = x + "px";
41187 params.ePopup.style.top = y + "px";
41188 function xRightPosition() {
41189 return sourceRect.right - parentRect.left - 2;
41190 }
41191 function xLeftPosition() {
41192 return sourceRect.left - parentRect.left - minWidth;
41193 }
41194 };
41195 PopupService.prototype.positionPopupUnderMouseEvent = function (params) {
41196 var ePopup = params.ePopup, nudgeX = params.nudgeX, nudgeY = params.nudgeY;
41197 var _a = this.calculatePointerAlign(params.mouseEvent), x = _a.x, y = _a.y;
41198 this.positionPopup({
41199 ePopup: ePopup,
41200 x: x,
41201 y: y,
41202 nudgeX: nudgeX,
41203 nudgeY: nudgeY,
41204 keepWithinBounds: true
41205 });
41206 this.callPostProcessPopup(params.type, params.ePopup, null, params.mouseEvent, params.column, params.rowNode);
41207 };
41208 PopupService.prototype.calculatePointerAlign = function (e) {
41209 var parentRect = this.getParentRect();
41210 return {
41211 x: e.clientX - parentRect.left,
41212 y: e.clientY - parentRect.top
41213 };
41214 };
41215 PopupService.prototype.positionPopupUnderComponent = function (params) {
41216 var sourceRect = params.eventSource.getBoundingClientRect();
41217 var alignSide = params.alignSide || 'left';
41218 var parentRect = this.getParentRect();
41219 var x = sourceRect.left - parentRect.left;
41220 if (alignSide === 'right') {
41221 x -= (params.ePopup.offsetWidth - sourceRect.width);
41222 }
41223 this.positionPopup({
41224 ePopup: params.ePopup,
41225 nudgeX: params.nudgeX,
41226 nudgeY: params.nudgeY,
41227 x: x,
41228 y: sourceRect.top - parentRect.top + sourceRect.height,
41229 keepWithinBounds: params.keepWithinBounds
41230 });
41231 this.callPostProcessPopup(params.type, params.ePopup, params.eventSource, null, params.column, params.rowNode);
41232 };
41233 PopupService.prototype.positionPopupOverComponent = function (params) {
41234 var sourceRect = params.eventSource.getBoundingClientRect();
41235 var parentRect = this.getParentRect();
41236 this.positionPopup({
41237 ePopup: params.ePopup,
41238 nudgeX: params.nudgeX,
41239 nudgeY: params.nudgeY,
41240 x: sourceRect.left - parentRect.left,
41241 y: sourceRect.top - parentRect.top,
41242 keepWithinBounds: params.keepWithinBounds
41243 });
41244 this.callPostProcessPopup(params.type, params.ePopup, params.eventSource, null, params.column, params.rowNode);
41245 };
41246 PopupService.prototype.callPostProcessPopup = function (type, ePopup, eventSource, mouseEvent, column, rowNode) {
41247 var callback = this.gridOptionsWrapper.getPostProcessPopupFunc();
41248 if (callback) {
41249 var params = {
41250 column: column,
41251 rowNode: rowNode,
41252 ePopup: ePopup,
41253 type: type,
41254 eventSource: eventSource,
41255 mouseEvent: mouseEvent
41256 };
41257 callback(params);
41258 }
41259 };
41260 PopupService.prototype.positionPopup = function (params) {
41261 var ePopup = params.ePopup, keepWithinBounds = params.keepWithinBounds, nudgeX = params.nudgeX, nudgeY = params.nudgeY;
41262 var x = params.x, y = params.y;
41263 if (nudgeX) {
41264 x += nudgeX;
41265 }
41266 if (nudgeY) {
41267 y += nudgeY;
41268 }
41269 // if popup is overflowing to the bottom, move it up
41270 if (keepWithinBounds) {
41271 x = this.keepXYWithinBounds(ePopup, x, DIRECTION.horizontal);
41272 y = this.keepXYWithinBounds(ePopup, y, DIRECTION.vertical);
41273 }
41274 ePopup.style.left = x + "px";
41275 ePopup.style.top = y + "px";
41276 };
41277 PopupService.prototype.getActivePopups = function () {
41278 return this.popupList.map(function (popup) { return popup.element; });
41279 };
41280 PopupService.prototype.getPopupList = function () {
41281 return this.popupList;
41282 };
41283 PopupService.prototype.getParentRect = function () {
41284 // subtract the popup parent borders, because popupParent.getBoundingClientRect
41285 // returns the rect outside the borders, but the 0,0 coordinate for absolute
41286 // positioning is inside the border, leading the popup to be off by the width
41287 // of the border
41288 var eDocument = this.gridOptionsWrapper.getDocument();
41289 var popupParent = this.getPopupParent();
41290 if (popupParent === eDocument.body) {
41291 popupParent = eDocument.documentElement;
41292 }
41293 var style = getComputedStyle(popupParent);
41294 var bounds = popupParent.getBoundingClientRect();
41295 return {
41296 top: bounds.top + parseFloat(style.borderTopWidth) || 0,
41297 left: bounds.left + parseFloat(style.borderLeftWidth) || 0,
41298 right: bounds.right + parseFloat(style.borderRightWidth) || 0,
41299 bottom: bounds.bottom + parseFloat(style.borderBottomWidth) || 0,
41300 };
41301 };
41302 PopupService.prototype.keepXYWithinBounds = function (ePopup, position, direction) {
41303 var isVertical = direction === DIRECTION.vertical;
41304 var sizeProperty = isVertical ? 'clientHeight' : 'clientWidth';
41305 var anchorProperty = isVertical ? 'top' : 'left';
41306 var offsetProperty = isVertical ? 'offsetHeight' : 'offsetWidth';
41307 var scrollPositionProperty = isVertical ? 'scrollTop' : 'scrollLeft';
41308 var eDocument = this.gridOptionsWrapper.getDocument();
41309 var docElement = eDocument.documentElement;
41310 var popupParent = this.getPopupParent();
41311 var parentRect = popupParent.getBoundingClientRect();
41312 var documentRect = eDocument.documentElement.getBoundingClientRect();
41313 var isBody = popupParent === eDocument.body;
41314 var offsetSize = ePopup[offsetProperty];
41315 var getSize = isVertical ? getAbsoluteHeight : getAbsoluteWidth;
41316 var sizeOfParent = isBody ? (getSize(docElement) + docElement[scrollPositionProperty]) : popupParent[sizeProperty];
41317 if (isBody) {
41318 sizeOfParent -= Math.abs(documentRect[anchorProperty] - parentRect[anchorProperty]);
41319 }
41320 var max = sizeOfParent - offsetSize;
41321 return Math.min(Math.max(position, 0), Math.abs(max));
41322 };
41323 PopupService.prototype.keepPopupPositionedRelativeTo = function (params) {
41324 var _this = this;
41325 var eParent = this.getPopupParent();
41326 var parentRect = eParent.getBoundingClientRect();
41327 var sourceRect = params.element.getBoundingClientRect();
41328 var initialDiffTop = parentRect.top - sourceRect.top;
41329 var initialDiffLeft = parentRect.left - sourceRect.left;
41330 var lastDiffTop = initialDiffTop;
41331 var lastDiffLeft = initialDiffLeft;
41332 var topPx = params.ePopup.style.top;
41333 var top = parseInt(topPx.substring(0, topPx.length - 1), 10);
41334 var leftPx = params.ePopup.style.left;
41335 var left = parseInt(leftPx.substring(0, leftPx.length - 1), 10);
41336 return new AgPromise(function (resolve) {
41337 _this.getFrameworkOverrides().setInterval(function () {
41338 var pRect = eParent.getBoundingClientRect();
41339 var sRect = params.element.getBoundingClientRect();
41340 var elementNotInDom = sRect.top == 0 && sRect.left == 0 && sRect.height == 0 && sRect.width == 0;
41341 if (elementNotInDom) {
41342 params.hidePopup();
41343 return;
41344 }
41345 var currentDiffTop = pRect.top - sRect.top;
41346 if (currentDiffTop != lastDiffTop) {
41347 var newTop = _this.keepXYWithinBounds(params.ePopup, top + initialDiffTop - currentDiffTop, DIRECTION.vertical);
41348 params.ePopup.style.top = newTop + "px";
41349 }
41350 lastDiffTop = currentDiffTop;
41351 var currentDiffLeft = pRect.left - sRect.left;
41352 if (currentDiffLeft != lastDiffLeft) {
41353 var newLeft = _this.keepXYWithinBounds(params.ePopup, left + initialDiffLeft - currentDiffLeft, DIRECTION.horizontal);
41354 params.ePopup.style.left = newLeft + "px";
41355 }
41356 lastDiffLeft = currentDiffLeft;
41357 }, 200).then(function (intervalId) {
41358 var result = function () {
41359 if (intervalId != null) {
41360 window.clearInterval(intervalId);
41361 }
41362 };
41363 resolve(result);
41364 });
41365 });
41366 };
41367 PopupService.prototype.addPopup = function (params) {
41368 var _this = this;
41369 var modal = params.modal, eChild = params.eChild, closeOnEsc = params.closeOnEsc, closedCallback = params.closedCallback, click = params.click, alwaysOnTop = params.alwaysOnTop, afterGuiAttached = params.afterGuiAttached, positionCallback = params.positionCallback, anchorToElement = params.anchorToElement, ariaLabel = params.ariaLabel;
41370 var eDocument = this.gridOptionsWrapper.getDocument();
41371 var destroyPositionTracker = new AgPromise(function (resolve) { return resolve(function () { }); });
41372 if (!eDocument) {
41373 console.warn('ag-grid: could not find the document, document is empty');
41374 return { hideFunc: function () { }, stopAnchoringPromise: destroyPositionTracker };
41375 }
41376 var pos = this.popupList.findIndex(function (popup) { return popup.element === eChild; });
41377 if (pos !== -1) {
41378 var popup = this.popupList[pos];
41379 return { hideFunc: popup.hideFunc, stopAnchoringPromise: popup.stopAnchoringPromise };
41380 }
41381 var ePopupParent = this.getPopupParent();
41382 if (eChild.style.top == null) {
41383 eChild.style.top = '0px';
41384 }
41385 if (eChild.style.left == null) {
41386 eChild.style.left = '0px';
41387 }
41388 // add env CSS class to child, in case user provided a popup parent, which means
41389 // theme class may be missing
41390 var eWrapper = document.createElement('div');
41391 var theme = this.environment.getTheme().theme;
41392 if (theme) {
41393 eWrapper.classList.add(theme);
41394 }
41395 eWrapper.classList.add('ag-popup');
41396 eChild.classList.add(this.gridOptionsWrapper.isEnableRtl() ? 'ag-rtl' : 'ag-ltr', 'ag-popup-child');
41397 if (!eChild.hasAttribute('role')) {
41398 setAriaRole(eChild, 'dialog');
41399 }
41400 setAriaLabel(eChild, ariaLabel);
41401 if (this.focusService.isKeyboardMode()) {
41402 eChild.classList.add(FocusService.AG_KEYBOARD_FOCUS);
41403 }
41404 eWrapper.appendChild(eChild);
41405 ePopupParent.appendChild(eWrapper);
41406 if (alwaysOnTop) {
41407 this.setAlwaysOnTop(eWrapper, true);
41408 }
41409 else {
41410 this.bringPopupToFront(eWrapper);
41411 }
41412 var popupHidden = false;
41413 var hidePopupOnKeyboardEvent = function (event) {
41414 if (!eWrapper.contains(eDocument.activeElement)) {
41415 return;
41416 }
41417 var key = event.key;
41418 if (key === KeyCode.ESCAPE) {
41419 hidePopup({ keyboardEvent: event });
41420 }
41421 };
41422 var hidePopupOnMouseEvent = function (event) { return hidePopup({ mouseEvent: event }); };
41423 var hidePopupOnTouchEvent = function (event) { return hidePopup({ touchEvent: event }); };
41424 var hidePopup = function (popupParams) {
41425 if (popupParams === void 0) { popupParams = {}; }
41426 var mouseEvent = popupParams.mouseEvent, touchEvent = popupParams.touchEvent, keyboardEvent = popupParams.keyboardEvent;
41427 if (
41428 // we don't hide popup if the event was on the child, or any
41429 // children of this child
41430 _this.isEventFromCurrentPopup({ mouseEvent: mouseEvent, touchEvent: touchEvent }, eChild) ||
41431 // if the event to close is actually the open event, then ignore it
41432 _this.isEventSameChainAsOriginalEvent({ originalMouseEvent: click, mouseEvent: mouseEvent, touchEvent: touchEvent }) ||
41433 // this method should only be called once. the client can have different
41434 // paths, each one wanting to close, so this method may be called multiple times.
41435 popupHidden) {
41436 return;
41437 }
41438 popupHidden = true;
41439 ePopupParent.removeChild(eWrapper);
41440 eDocument.removeEventListener('keydown', hidePopupOnKeyboardEvent);
41441 eDocument.removeEventListener('mousedown', hidePopupOnMouseEvent);
41442 eDocument.removeEventListener('touchstart', hidePopupOnTouchEvent);
41443 eDocument.removeEventListener('contextmenu', hidePopupOnMouseEvent);
41444 _this.eventService.removeEventListener(Events.EVENT_DRAG_STARTED, hidePopupOnMouseEvent);
41445 if (closedCallback) {
41446 closedCallback(mouseEvent || touchEvent || keyboardEvent);
41447 }
41448 _this.popupList = _this.popupList.filter(function (popup) { return popup.element !== eChild; });
41449 if (destroyPositionTracker) {
41450 destroyPositionTracker.then(function (destroyFunc) { return destroyFunc && destroyFunc(); });
41451 }
41452 };
41453 if (afterGuiAttached) {
41454 afterGuiAttached({ hidePopup: hidePopup });
41455 }
41456 // if we add these listeners now, then the current mouse
41457 // click will be included, which we don't want
41458 window.setTimeout(function () {
41459 if (closeOnEsc) {
41460 eDocument.addEventListener('keydown', hidePopupOnKeyboardEvent);
41461 }
41462 if (modal) {
41463 eDocument.addEventListener('mousedown', hidePopupOnMouseEvent);
41464 _this.eventService.addEventListener(Events.EVENT_DRAG_STARTED, hidePopupOnMouseEvent);
41465 eDocument.addEventListener('touchstart', hidePopupOnTouchEvent);
41466 eDocument.addEventListener('contextmenu', hidePopupOnMouseEvent);
41467 }
41468 }, 0);
41469 if (positionCallback) {
41470 positionCallback();
41471 }
41472 if (anchorToElement) {
41473 // keeps popup positioned under created, eg if context menu, if user scrolls
41474 // using touchpad and the cell moves, it moves the popup to keep it with the cell.
41475 destroyPositionTracker = this.keepPopupPositionedRelativeTo({
41476 element: anchorToElement,
41477 ePopup: eChild,
41478 hidePopup: hidePopup
41479 });
41480 }
41481 this.popupList.push({
41482 element: eChild,
41483 wrapper: eWrapper,
41484 hideFunc: hidePopup,
41485 stopAnchoringPromise: destroyPositionTracker,
41486 instanceId: instanceIdSeq++,
41487 isAnchored: !!anchorToElement
41488 });
41489 return {
41490 hideFunc: hidePopup,
41491 stopAnchoringPromise: destroyPositionTracker
41492 };
41493 };
41494 PopupService.prototype.hasAnchoredPopup = function () {
41495 return this.popupList.some(function (popup) { return popup.isAnchored; });
41496 };
41497 PopupService.prototype.isEventFromCurrentPopup = function (params, target) {
41498 var mouseEvent = params.mouseEvent, touchEvent = params.touchEvent;
41499 var event = mouseEvent ? mouseEvent : touchEvent;
41500 if (!event) {
41501 return false;
41502 }
41503 var indexOfThisChild = this.popupList.findIndex(function (popup) { return popup.element === target; });
41504 if (indexOfThisChild === -1) {
41505 return false;
41506 }
41507 for (var i = indexOfThisChild; i < this.popupList.length; i++) {
41508 var popup = this.popupList[i];
41509 if (isElementInEventPath(popup.element, event)) {
41510 return true;
41511 }
41512 }
41513 // if the user did not write their own Custom Element to be rendered as popup
41514 // and this component has an additional popup element, they should have the
41515 // `ag-custom-component-popup` class to be detected as part of the Custom Component
41516 return this.isElementWithinCustomPopup(event.target);
41517 };
41518 PopupService.prototype.isElementWithinCustomPopup = function (el) {
41519 var eDocument = this.gridOptionsWrapper.getDocument();
41520 while (el && el !== eDocument.body) {
41521 if (el.classList.contains('ag-custom-component-popup') || el.parentElement === null) {
41522 return true;
41523 }
41524 el = el.parentElement;
41525 }
41526 return false;
41527 };
41528 // in some browsers, the context menu event can be fired before the click event, which means
41529 // the context menu event could open the popup, but then the click event closes it straight away.
41530 PopupService.prototype.isEventSameChainAsOriginalEvent = function (params) {
41531 var originalMouseEvent = params.originalMouseEvent, mouseEvent = params.mouseEvent, touchEvent = params.touchEvent;
41532 // we check the coordinates of the event, to see if it's the same event. there is a 1 / 1000 chance that
41533 // the event is a different event, however that is an edge case that is not very relevant (the user clicking
41534 // twice on the same location isn't a normal path).
41535 // event could be mouse event or touch event.
41536 var mouseEventOrTouch = null;
41537 if (mouseEvent) {
41538 // mouse event can be used direction, it has coordinates
41539 mouseEventOrTouch = mouseEvent;
41540 }
41541 else if (touchEvent) {
41542 // touch event doesn't have coordinates, need it's touch object
41543 mouseEventOrTouch = touchEvent.touches[0];
41544 }
41545 if (mouseEventOrTouch && originalMouseEvent) {
41546 // for x, allow 4px margin, to cover iPads, where touch (which opens menu) is followed
41547 // by browser click (when you finger up, touch is interrupted as click in browser)
41548 var screenX_1 = mouseEvent ? mouseEvent.screenX : 0;
41549 var screenY_1 = mouseEvent ? mouseEvent.screenY : 0;
41550 var xMatch = Math.abs(originalMouseEvent.screenX - screenX_1) < 5;
41551 var yMatch = Math.abs(originalMouseEvent.screenY - screenY_1) < 5;
41552 if (xMatch && yMatch) {
41553 return true;
41554 }
41555 }
41556 return false;
41557 };
41558 PopupService.prototype.getWrapper = function (ePopup) {
41559 while (!ePopup.classList.contains('ag-popup') && ePopup.parentElement) {
41560 ePopup = ePopup.parentElement;
41561 }
41562 return ePopup.classList.contains('ag-popup') ? ePopup : null;
41563 };
41564 PopupService.prototype.setAlwaysOnTop = function (ePopup, alwaysOnTop) {
41565 var eWrapper = this.getWrapper(ePopup);
41566 if (!eWrapper) {
41567 return;
41568 }
41569 eWrapper.classList.toggle('ag-always-on-top', !!alwaysOnTop);
41570 if (alwaysOnTop) {
41571 this.bringPopupToFront(eWrapper);
41572 }
41573 };
41574 PopupService.prototype.bringPopupToFront = function (ePopup) {
41575 var parent = this.getPopupParent();
41576 var popupList = Array.prototype.slice.call(parent.querySelectorAll('.ag-popup'));
41577 var popupLen = popupList.length;
41578 var alwaysOnTopList = Array.prototype.slice.call(parent.querySelectorAll('.ag-popup.ag-always-on-top'));
41579 var onTopLength = alwaysOnTopList.length;
41580 var eWrapper = this.getWrapper(ePopup);
41581 if (!eWrapper || popupLen <= 1 || !parent.contains(ePopup)) {
41582 return;
41583 }
41584 var pos = popupList.indexOf(eWrapper);
41585 var innerEls = eWrapper.querySelectorAll('div');
41586 var innerElsScrollMap = [];
41587 innerEls.forEach(function (el) {
41588 if (el.scrollTop !== 0) {
41589 innerElsScrollMap.push([el, el.scrollTop]);
41590 }
41591 });
41592 if (onTopLength) {
41593 var isPopupAlwaysOnTop = eWrapper.classList.contains('ag-always-on-top');
41594 if (isPopupAlwaysOnTop) {
41595 if (pos !== popupLen - 1) {
41596 last(alwaysOnTopList).insertAdjacentElement('afterend', eWrapper);
41597 }
41598 }
41599 else if (pos !== popupLen - onTopLength - 1) {
41600 alwaysOnTopList[0].insertAdjacentElement('beforebegin', eWrapper);
41601 }
41602 }
41603 else if (pos !== popupLen - 1) {
41604 last(popupList).insertAdjacentElement('afterend', eWrapper);
41605 }
41606 while (innerElsScrollMap.length) {
41607 var currentEl = innerElsScrollMap.pop();
41608 currentEl[0].scrollTop = currentEl[1];
41609 }
41610 var params = {
41611 type: 'popupToFront',
41612 api: this.gridOptionsWrapper.getApi(),
41613 columnApi: this.gridOptionsWrapper.getColumnApi(),
41614 eWrapper: eWrapper
41615 };
41616 this.eventService.dispatchEvent(params);
41617 };
41618 __decorate$1M([
41619 Autowired('environment')
41620 ], PopupService.prototype, "environment", void 0);
41621 __decorate$1M([
41622 Autowired('focusService')
41623 ], PopupService.prototype, "focusService", void 0);
41624 __decorate$1M([
41625 Autowired('ctrlsService')
41626 ], PopupService.prototype, "ctrlsService", void 0);
41627 __decorate$1M([
41628 PostConstruct
41629 ], PopupService.prototype, "postConstruct", null);
41630 PopupService = __decorate$1M([
41631 Bean('popupService')
41632 ], PopupService);
41633 return PopupService;
41634}(BeanStub));
41635
41636/**
41637 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
41638 * @version v27.3.0
41639 * @link https://www.ag-grid.com/
41640 * @license MIT
41641 */
41642var __extends$27 = (undefined && undefined.__extends) || (function () {
41643 var extendStatics = function (d, b) {
41644 extendStatics = Object.setPrototypeOf ||
41645 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
41646 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
41647 return extendStatics(d, b);
41648 };
41649 return function (d, b) {
41650 extendStatics(d, b);
41651 function __() { this.constructor = d; }
41652 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41653 };
41654})();
41655var __decorate$1N = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
41656 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
41657 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
41658 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;
41659 return c > 3 && r && Object.defineProperty(target, key, r), r;
41660};
41661var VirtualList = /** @class */ (function (_super) {
41662 __extends$27(VirtualList, _super);
41663 function VirtualList(cssIdentifier, ariaRole, listName) {
41664 if (cssIdentifier === void 0) { cssIdentifier = 'default'; }
41665 if (ariaRole === void 0) { ariaRole = 'listbox'; }
41666 var _this = _super.call(this, VirtualList.getTemplate(cssIdentifier)) || this;
41667 _this.cssIdentifier = cssIdentifier;
41668 _this.ariaRole = ariaRole;
41669 _this.listName = listName;
41670 _this.renderedRows = new Map();
41671 _this.rowHeight = 20;
41672 _this.isDestroyed = false;
41673 return _this;
41674 }
41675 VirtualList.prototype.postConstruct = function () {
41676 var _this = this;
41677 this.addScrollListener();
41678 this.rowHeight = this.getItemHeight();
41679 this.addResizeObserver();
41680 this.initialiseTabGuard({
41681 onFocusIn: function (e) { return _this.onFocusIn(e); },
41682 onFocusOut: function (e) { return _this.onFocusOut(e); },
41683 focusInnerElement: function (fromBottom) { return _this.focusInnerElement(fromBottom); },
41684 onTabKeyDown: function (e) { return _this.onTabKeyDown(e); },
41685 handleKeyDown: function (e) { return _this.handleKeyDown(e); }
41686 });
41687 this.setAriaProperties();
41688 };
41689 VirtualList.prototype.setAriaProperties = function () {
41690 var translate = this.gridOptionsWrapper.getLocaleTextFunc();
41691 var listName = translate('ariaDefaultListName', this.listName || 'List');
41692 var ariaEl = this.eContainer;
41693 setAriaRole(ariaEl, this.ariaRole);
41694 setAriaLabel(ariaEl, listName);
41695 };
41696 VirtualList.prototype.addResizeObserver = function () {
41697 var listener = this.drawVirtualRows.bind(this);
41698 var destroyObserver = this.resizeObserverService.observeResize(this.getGui(), listener);
41699 this.addDestroyFunc(destroyObserver);
41700 };
41701 VirtualList.prototype.focusInnerElement = function (fromBottom) {
41702 this.focusRow(fromBottom ? this.model.getRowCount() - 1 : 0);
41703 };
41704 VirtualList.prototype.onFocusIn = function (e) {
41705 var target = e.target;
41706 if (target.classList.contains('ag-virtual-list-item')) {
41707 this.lastFocusedRowIndex = getAriaPosInSet(target) - 1;
41708 }
41709 return false;
41710 };
41711 VirtualList.prototype.onFocusOut = function (e) {
41712 if (!this.getFocusableElement().contains(e.relatedTarget)) {
41713 this.lastFocusedRowIndex = null;
41714 }
41715 return false;
41716 };
41717 VirtualList.prototype.handleKeyDown = function (e) {
41718 switch (e.key) {
41719 case KeyCode.UP:
41720 case KeyCode.DOWN:
41721 if (this.navigate(e.key === KeyCode.UP)) {
41722 e.preventDefault();
41723 }
41724 break;
41725 }
41726 };
41727 VirtualList.prototype.onTabKeyDown = function (e) {
41728 if (this.navigate(e.shiftKey)) {
41729 e.preventDefault();
41730 }
41731 else {
41732 // focus on the first or last focusable element to ensure that any other handlers start from there
41733 this.focusService.focusInto(this.getGui(), !e.shiftKey);
41734 }
41735 };
41736 VirtualList.prototype.navigate = function (up) {
41737 if (this.lastFocusedRowIndex == null) {
41738 return false;
41739 }
41740 var nextRow = this.lastFocusedRowIndex + (up ? -1 : 1);
41741 if (nextRow < 0 || nextRow >= this.model.getRowCount()) {
41742 return false;
41743 }
41744 this.focusRow(nextRow);
41745 return true;
41746 };
41747 VirtualList.prototype.getLastFocusedRow = function () {
41748 return this.lastFocusedRowIndex;
41749 };
41750 VirtualList.prototype.focusRow = function (rowNumber) {
41751 var _this = this;
41752 this.ensureIndexVisible(rowNumber);
41753 window.setTimeout(function () {
41754 var renderedRow = _this.renderedRows.get(rowNumber);
41755 if (renderedRow) {
41756 renderedRow.eDiv.focus();
41757 }
41758 }, 10);
41759 };
41760 VirtualList.prototype.getComponentAt = function (rowIndex) {
41761 var comp = this.renderedRows.get(rowIndex);
41762 return comp && comp.rowComponent;
41763 };
41764 VirtualList.getTemplate = function (cssIdentifier) {
41765 return /* html */ "\n <div class=\"ag-virtual-list-viewport ag-" + cssIdentifier + "-virtual-list-viewport\" role=\"presentation\">\n <div class=\"ag-virtual-list-container ag-" + cssIdentifier + "-virtual-list-container\" ref=\"eContainer\"></div>\n </div>";
41766 };
41767 VirtualList.prototype.getItemHeight = function () {
41768 return this.gridOptionsWrapper.getListItemHeight();
41769 };
41770 VirtualList.prototype.ensureIndexVisible = function (index) {
41771 var lastRow = this.model.getRowCount();
41772 if (typeof index !== 'number' || index < 0 || index >= lastRow) {
41773 console.warn('AG Grid: invalid row index for ensureIndexVisible: ' + index);
41774 return;
41775 }
41776 var rowTopPixel = index * this.rowHeight;
41777 var rowBottomPixel = rowTopPixel + this.rowHeight;
41778 var eGui = this.getGui();
41779 var viewportTopPixel = eGui.scrollTop;
41780 var viewportHeight = eGui.offsetHeight;
41781 var viewportBottomPixel = viewportTopPixel + viewportHeight;
41782 var viewportScrolledPastRow = viewportTopPixel > rowTopPixel;
41783 var viewportScrolledBeforeRow = viewportBottomPixel < rowBottomPixel;
41784 if (viewportScrolledPastRow) {
41785 // if row is before, scroll up with row at top
41786 eGui.scrollTop = rowTopPixel;
41787 }
41788 else if (viewportScrolledBeforeRow) {
41789 // if row is below, scroll down with row at bottom
41790 var newScrollPosition = rowBottomPixel - viewportHeight;
41791 eGui.scrollTop = newScrollPosition;
41792 }
41793 };
41794 VirtualList.prototype.setComponentCreator = function (componentCreator) {
41795 this.componentCreator = componentCreator;
41796 };
41797 VirtualList.prototype.getRowHeight = function () {
41798 return this.rowHeight;
41799 };
41800 VirtualList.prototype.getScrollTop = function () {
41801 return this.getGui().scrollTop;
41802 };
41803 VirtualList.prototype.setRowHeight = function (rowHeight) {
41804 this.rowHeight = rowHeight;
41805 this.refresh();
41806 };
41807 VirtualList.prototype.refresh = function () {
41808 var _this = this;
41809 if (this.model == null || this.isDestroyed) {
41810 return;
41811 }
41812 var rowCount = this.model.getRowCount();
41813 this.eContainer.style.height = rowCount * this.rowHeight + "px";
41814 // ensure height is applied before attempting to redraw rows
41815 waitUntil(function () { return _this.eContainer.clientHeight >= rowCount * _this.rowHeight; }, function () {
41816 if (_this.isDestroyed) {
41817 return;
41818 }
41819 _this.clearVirtualRows();
41820 _this.drawVirtualRows();
41821 });
41822 };
41823 VirtualList.prototype.clearVirtualRows = function () {
41824 var _this = this;
41825 this.renderedRows.forEach(function (_, rowIndex) { return _this.removeRow(rowIndex); });
41826 };
41827 VirtualList.prototype.drawVirtualRows = function () {
41828 var gui = this.getGui();
41829 var topPixel = gui.scrollTop;
41830 var bottomPixel = topPixel + gui.offsetHeight;
41831 var firstRow = Math.floor(topPixel / this.rowHeight);
41832 var lastRow = Math.floor(bottomPixel / this.rowHeight);
41833 this.ensureRowsRendered(firstRow, lastRow);
41834 };
41835 VirtualList.prototype.ensureRowsRendered = function (start, finish) {
41836 var _this = this;
41837 // remove any rows that are no longer required
41838 this.renderedRows.forEach(function (_, rowIndex) {
41839 if ((rowIndex < start || rowIndex > finish) && rowIndex !== _this.lastFocusedRowIndex) {
41840 _this.removeRow(rowIndex);
41841 }
41842 });
41843 // insert any required new rows
41844 for (var rowIndex = start; rowIndex <= finish; rowIndex++) {
41845 if (this.renderedRows.has(rowIndex)) {
41846 continue;
41847 }
41848 // check this row actually exists (in case overflow buffer window exceeds real data)
41849 if (rowIndex < this.model.getRowCount()) {
41850 this.insertRow(rowIndex);
41851 }
41852 }
41853 };
41854 VirtualList.prototype.insertRow = function (rowIndex) {
41855 var _this = this;
41856 var value = this.model.getRow(rowIndex);
41857 var eDiv = document.createElement('div');
41858 eDiv.classList.add('ag-virtual-list-item', "ag-" + this.cssIdentifier + "-virtual-list-item");
41859 setAriaRole(eDiv, this.ariaRole === 'tree' ? 'treeitem' : 'option');
41860 setAriaSetSize(eDiv, this.model.getRowCount());
41861 setAriaPosInSet(eDiv, rowIndex + 1);
41862 eDiv.setAttribute('tabindex', '-1');
41863 if (typeof this.model.isRowSelected === 'function') {
41864 var isSelected = this.model.isRowSelected(rowIndex);
41865 setAriaSelected(eDiv, !!isSelected);
41866 setAriaChecked(eDiv, isSelected);
41867 }
41868 eDiv.style.height = this.rowHeight + "px";
41869 eDiv.style.top = this.rowHeight * rowIndex + "px";
41870 var rowComponent = this.componentCreator(value, eDiv);
41871 rowComponent.addGuiEventListener('focusin', function () { return _this.lastFocusedRowIndex = rowIndex; });
41872 eDiv.appendChild(rowComponent.getGui());
41873 // keep the DOM order consistent with the order of the rows
41874 if (this.renderedRows.has(rowIndex - 1)) {
41875 this.renderedRows.get(rowIndex - 1).eDiv.insertAdjacentElement('afterend', eDiv);
41876 }
41877 else if (this.renderedRows.has(rowIndex + 1)) {
41878 this.renderedRows.get(rowIndex + 1).eDiv.insertAdjacentElement('beforebegin', eDiv);
41879 }
41880 else {
41881 this.eContainer.appendChild(eDiv);
41882 }
41883 this.renderedRows.set(rowIndex, { rowComponent: rowComponent, eDiv: eDiv });
41884 };
41885 VirtualList.prototype.removeRow = function (rowIndex) {
41886 var component = this.renderedRows.get(rowIndex);
41887 this.eContainer.removeChild(component.eDiv);
41888 this.destroyBean(component.rowComponent);
41889 this.renderedRows.delete(rowIndex);
41890 };
41891 VirtualList.prototype.addScrollListener = function () {
41892 var _this = this;
41893 this.addGuiEventListener('scroll', function () { return _this.drawVirtualRows(); });
41894 };
41895 VirtualList.prototype.setModel = function (model) {
41896 this.model = model;
41897 };
41898 VirtualList.prototype.destroy = function () {
41899 if (this.isDestroyed) {
41900 return;
41901 }
41902 this.clearVirtualRows();
41903 this.isDestroyed = true;
41904 _super.prototype.destroy.call(this);
41905 };
41906 __decorate$1N([
41907 Autowired('resizeObserverService')
41908 ], VirtualList.prototype, "resizeObserverService", void 0);
41909 __decorate$1N([
41910 Autowired('focusService')
41911 ], VirtualList.prototype, "focusService", void 0);
41912 __decorate$1N([
41913 RefSelector('eContainer')
41914 ], VirtualList.prototype, "eContainer", void 0);
41915 __decorate$1N([
41916 PostConstruct
41917 ], VirtualList.prototype, "postConstruct", null);
41918 return VirtualList;
41919}(TabGuardComp));
41920
41921/**
41922 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
41923 * @version v27.3.0
41924 * @link https://www.ag-grid.com/
41925 * @license MIT
41926 */
41927var OUTSIDE_ANGULAR_EVENTS = ['mouseover', 'mouseout', 'mouseenter', 'mouseleave'];
41928var PASSIVE_EVENTS$1 = ['touchstart', 'touchend', 'touchmove', 'touchcancel'];
41929/** The base frameworks, eg React & Angular, override this bean with implementations specific to their requirement. */
41930var VanillaFrameworkOverrides = /** @class */ (function () {
41931 function VanillaFrameworkOverrides() {
41932 this.isOutsideAngular = function (eventType) { return includes(OUTSIDE_ANGULAR_EVENTS, eventType); };
41933 }
41934 // for Vanilla JS, we use simple timeout
41935 VanillaFrameworkOverrides.prototype.setTimeout = function (action, timeout) {
41936 window.setTimeout(action, timeout);
41937 };
41938 VanillaFrameworkOverrides.prototype.setInterval = function (action, timeout) {
41939 return new AgPromise(function (resolve) {
41940 resolve(window.setInterval(action, timeout));
41941 });
41942 };
41943 // for Vanilla JS, we just add the event to the element
41944 VanillaFrameworkOverrides.prototype.addEventListener = function (element, type, listener, useCapture) {
41945 var isPassive = includes(PASSIVE_EVENTS$1, type);
41946 element.addEventListener(type, listener, { capture: !!useCapture, passive: isPassive });
41947 };
41948 // for Vanilla JS, we just execute the listener
41949 VanillaFrameworkOverrides.prototype.dispatchEvent = function (eventType, listener, global) {
41950 listener();
41951 };
41952 VanillaFrameworkOverrides.prototype.frameworkComponent = function (name) {
41953 return null;
41954 };
41955 VanillaFrameworkOverrides.prototype.isFrameworkComponent = function (comp) {
41956 return false;
41957 };
41958 return VanillaFrameworkOverrides;
41959}());
41960
41961/**
41962 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
41963 * @version v27.3.0
41964 * @link https://www.ag-grid.com/
41965 * @license MIT
41966 */
41967var __extends$28 = (undefined && undefined.__extends) || (function () {
41968 var extendStatics = function (d, b) {
41969 extendStatics = Object.setPrototypeOf ||
41970 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
41971 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
41972 return extendStatics(d, b);
41973 };
41974 return function (d, b) {
41975 extendStatics(d, b);
41976 function __() { this.constructor = d; }
41977 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41978 };
41979})();
41980var __decorate$1O = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
41981 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
41982 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
41983 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;
41984 return c > 3 && r && Object.defineProperty(target, key, r), r;
41985};
41986var CellNavigationService = /** @class */ (function (_super) {
41987 __extends$28(CellNavigationService, _super);
41988 function CellNavigationService() {
41989 return _super !== null && _super.apply(this, arguments) || this;
41990 }
41991 // returns null if no cell to focus on, ie at the end of the grid
41992 CellNavigationService.prototype.getNextCellToFocus = function (key, focusedCell, ctrlPressed) {
41993 if (ctrlPressed === void 0) { ctrlPressed = false; }
41994 if (ctrlPressed) {
41995 return this.getNextCellToFocusWithCtrlPressed(key, focusedCell);
41996 }
41997 return this.getNextCellToFocusWithoutCtrlPressed(key, focusedCell);
41998 };
41999 CellNavigationService.prototype.getNextCellToFocusWithCtrlPressed = function (key, focusedCell) {
42000 var upKey = key === KeyCode.UP;
42001 var downKey = key === KeyCode.DOWN;
42002 var leftKey = key === KeyCode.LEFT;
42003 var column;
42004 var rowIndex;
42005 if (upKey || downKey) {
42006 rowIndex = upKey ? this.paginationProxy.getPageFirstRow() : this.paginationProxy.getPageLastRow();
42007 column = focusedCell.column;
42008 }
42009 else {
42010 var allColumns = this.columnModel.getAllDisplayedColumns();
42011 var isRtl = this.gridOptionsWrapper.isEnableRtl();
42012 rowIndex = focusedCell.rowIndex;
42013 column = leftKey !== isRtl ? allColumns[0] : last(allColumns);
42014 }
42015 return {
42016 rowIndex: rowIndex,
42017 rowPinned: null,
42018 column: column
42019 };
42020 };
42021 CellNavigationService.prototype.getNextCellToFocusWithoutCtrlPressed = function (key, focusedCell) {
42022 // starting with the provided cell, we keep moving until we find a cell we can
42023 // focus on.
42024 var pointer = focusedCell;
42025 var finished = false;
42026 // finished will be true when either:
42027 // a) cell found that we can focus on
42028 // b) run out of cells (ie the method returns null)
42029 while (!finished) {
42030 switch (key) {
42031 case KeyCode.UP:
42032 pointer = this.getCellAbove(pointer);
42033 break;
42034 case KeyCode.DOWN:
42035 pointer = this.getCellBelow(pointer);
42036 break;
42037 case KeyCode.RIGHT:
42038 if (this.gridOptionsWrapper.isEnableRtl()) {
42039 pointer = this.getCellToLeft(pointer);
42040 }
42041 else {
42042 pointer = this.getCellToRight(pointer);
42043 }
42044 break;
42045 case KeyCode.LEFT:
42046 if (this.gridOptionsWrapper.isEnableRtl()) {
42047 pointer = this.getCellToRight(pointer);
42048 }
42049 else {
42050 pointer = this.getCellToLeft(pointer);
42051 }
42052 break;
42053 default:
42054 pointer = null;
42055 console.warn('AG Grid: unknown key for navigation ' + key);
42056 break;
42057 }
42058 if (pointer) {
42059 finished = this.isCellGoodToFocusOn(pointer);
42060 }
42061 else {
42062 finished = true;
42063 }
42064 }
42065 return pointer;
42066 };
42067 CellNavigationService.prototype.isCellGoodToFocusOn = function (gridCell) {
42068 var column = gridCell.column;
42069 var rowNode;
42070 switch (gridCell.rowPinned) {
42071 case Constants.PINNED_TOP:
42072 rowNode = this.pinnedRowModel.getPinnedTopRow(gridCell.rowIndex);
42073 break;
42074 case Constants.PINNED_BOTTOM:
42075 rowNode = this.pinnedRowModel.getPinnedBottomRow(gridCell.rowIndex);
42076 break;
42077 default:
42078 rowNode = this.rowModel.getRow(gridCell.rowIndex);
42079 break;
42080 }
42081 if (!rowNode) {
42082 return false;
42083 }
42084 var suppressNavigable = column.isSuppressNavigable(rowNode);
42085 return !suppressNavigable;
42086 };
42087 CellNavigationService.prototype.getCellToLeft = function (lastCell) {
42088 if (!lastCell) {
42089 return null;
42090 }
42091 var colToLeft = this.columnModel.getDisplayedColBefore(lastCell.column);
42092 if (!colToLeft) {
42093 return null;
42094 }
42095 return {
42096 rowIndex: lastCell.rowIndex,
42097 column: colToLeft,
42098 rowPinned: lastCell.rowPinned
42099 };
42100 };
42101 CellNavigationService.prototype.getCellToRight = function (lastCell) {
42102 if (!lastCell) {
42103 return null;
42104 }
42105 var colToRight = this.columnModel.getDisplayedColAfter(lastCell.column);
42106 // if already on right, do nothing
42107 if (!colToRight) {
42108 return null;
42109 }
42110 return {
42111 rowIndex: lastCell.rowIndex,
42112 column: colToRight,
42113 rowPinned: lastCell.rowPinned
42114 };
42115 };
42116 CellNavigationService.prototype.getRowBelow = function (rowPosition) {
42117 // if already on top row, do nothing
42118 var index = rowPosition.rowIndex;
42119 var pinned = rowPosition.rowPinned;
42120 if (this.isLastRowInContainer(rowPosition)) {
42121 switch (pinned) {
42122 case Constants.PINNED_BOTTOM:
42123 // never any rows after pinned bottom
42124 return null;
42125 case Constants.PINNED_TOP:
42126 // if on last row of pinned top, then next row is main body (if rows exist),
42127 // otherwise it's the pinned bottom
42128 if (this.rowModel.isRowsToRender()) {
42129 return { rowIndex: this.paginationProxy.getPageFirstRow(), rowPinned: null };
42130 }
42131 if (this.pinnedRowModel.isRowsToRender(Constants.PINNED_BOTTOM)) {
42132 return { rowIndex: 0, rowPinned: Constants.PINNED_BOTTOM };
42133 }
42134 return null;
42135 default:
42136 // if in the main body, then try pinned bottom, otherwise return nothing
42137 if (this.pinnedRowModel.isRowsToRender(Constants.PINNED_BOTTOM)) {
42138 return { rowIndex: 0, rowPinned: Constants.PINNED_BOTTOM };
42139 }
42140 return null;
42141 }
42142 }
42143 return { rowIndex: index + 1, rowPinned: pinned };
42144 };
42145 CellNavigationService.prototype.getCellBelow = function (lastCell) {
42146 if (!lastCell) {
42147 return null;
42148 }
42149 var rowBelow = this.getRowBelow(lastCell);
42150 if (rowBelow) {
42151 return {
42152 rowIndex: rowBelow.rowIndex,
42153 column: lastCell.column,
42154 rowPinned: rowBelow.rowPinned
42155 };
42156 }
42157 return null;
42158 };
42159 CellNavigationService.prototype.isLastRowInContainer = function (rowPosition) {
42160 var pinned = rowPosition.rowPinned;
42161 var index = rowPosition.rowIndex;
42162 if (pinned === Constants.PINNED_TOP) {
42163 var lastTopIndex = this.pinnedRowModel.getPinnedTopRowData().length - 1;
42164 return lastTopIndex <= index;
42165 }
42166 if (pinned === Constants.PINNED_BOTTOM) {
42167 var lastBottomIndex = this.pinnedRowModel.getPinnedBottomRowData().length - 1;
42168 return lastBottomIndex <= index;
42169 }
42170 var lastBodyIndex = this.paginationProxy.getPageLastRow();
42171 return lastBodyIndex <= index;
42172 };
42173 CellNavigationService.prototype.getRowAbove = function (rowPosition) {
42174 // if already on top row, do nothing
42175 var index = rowPosition.rowIndex;
42176 var pinned = rowPosition.rowPinned;
42177 var isFirstRow = pinned ? index === 0 : index === this.paginationProxy.getPageFirstRow();
42178 // if already on top row, do nothing
42179 if (isFirstRow) {
42180 if (pinned === Constants.PINNED_TOP) {
42181 return null;
42182 }
42183 if (!pinned) {
42184 if (this.pinnedRowModel.isRowsToRender(Constants.PINNED_TOP)) {
42185 return this.getLastFloatingTopRow();
42186 }
42187 return null;
42188 }
42189 // last floating bottom
42190 if (this.rowModel.isRowsToRender()) {
42191 return this.getLastBodyCell();
42192 }
42193 if (this.pinnedRowModel.isRowsToRender(Constants.PINNED_TOP)) {
42194 return this.getLastFloatingTopRow();
42195 }
42196 return null;
42197 }
42198 return { rowIndex: index - 1, rowPinned: pinned };
42199 };
42200 CellNavigationService.prototype.getCellAbove = function (lastCell) {
42201 if (!lastCell) {
42202 return null;
42203 }
42204 var rowAbove = this.getRowAbove({ rowIndex: lastCell.rowIndex, rowPinned: lastCell.rowPinned });
42205 if (rowAbove) {
42206 return {
42207 rowIndex: rowAbove.rowIndex,
42208 column: lastCell.column,
42209 rowPinned: rowAbove.rowPinned
42210 };
42211 }
42212 return null;
42213 };
42214 CellNavigationService.prototype.getLastBodyCell = function () {
42215 var lastBodyRow = this.paginationProxy.getPageLastRow();
42216 return { rowIndex: lastBodyRow, rowPinned: null };
42217 };
42218 CellNavigationService.prototype.getLastFloatingTopRow = function () {
42219 var lastFloatingRow = this.pinnedRowModel.getPinnedTopRowData().length - 1;
42220 return { rowIndex: lastFloatingRow, rowPinned: Constants.PINNED_TOP };
42221 };
42222 CellNavigationService.prototype.getNextTabbedCell = function (gridCell, backwards) {
42223 if (backwards) {
42224 return this.getNextTabbedCellBackwards(gridCell);
42225 }
42226 return this.getNextTabbedCellForwards(gridCell);
42227 };
42228 CellNavigationService.prototype.getNextTabbedCellForwards = function (gridCell) {
42229 var displayedColumns = this.columnModel.getAllDisplayedColumns();
42230 var newRowIndex = gridCell.rowIndex;
42231 var newFloating = gridCell.rowPinned;
42232 // move along to the next cell
42233 var newColumn = this.columnModel.getDisplayedColAfter(gridCell.column);
42234 // check if end of the row, and if so, go forward a row
42235 if (!newColumn) {
42236 newColumn = displayedColumns[0];
42237 var rowBelow = this.getRowBelow(gridCell);
42238 if (missing(rowBelow)) {
42239 return null;
42240 }
42241 // If we are tabbing and there is a paging panel present, tabbing should go
42242 // to the paging panel instead of loading the next page.
42243 if (!rowBelow.rowPinned && !this.paginationProxy.isRowInPage(rowBelow)) {
42244 return null;
42245 }
42246 newRowIndex = rowBelow ? rowBelow.rowIndex : null;
42247 newFloating = rowBelow ? rowBelow.rowPinned : null;
42248 }
42249 return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating };
42250 };
42251 CellNavigationService.prototype.getNextTabbedCellBackwards = function (gridCell) {
42252 var displayedColumns = this.columnModel.getAllDisplayedColumns();
42253 var newRowIndex = gridCell.rowIndex;
42254 var newFloating = gridCell.rowPinned;
42255 // move along to the next cell
42256 var newColumn = this.columnModel.getDisplayedColBefore(gridCell.column);
42257 // check if end of the row, and if so, go forward a row
42258 if (!newColumn) {
42259 newColumn = last(displayedColumns);
42260 var rowAbove = this.getRowAbove({ rowIndex: gridCell.rowIndex, rowPinned: gridCell.rowPinned });
42261 if (missing(rowAbove)) {
42262 return null;
42263 }
42264 // If we are tabbing and there is a paging panel present, tabbing should go
42265 // to the paging panel instead of loading the next page.
42266 if (!rowAbove.rowPinned && !this.paginationProxy.isRowInPage(rowAbove)) {
42267 return null;
42268 }
42269 newRowIndex = rowAbove ? rowAbove.rowIndex : null;
42270 newFloating = rowAbove ? rowAbove.rowPinned : null;
42271 }
42272 return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating };
42273 };
42274 __decorate$1O([
42275 Autowired('columnModel')
42276 ], CellNavigationService.prototype, "columnModel", void 0);
42277 __decorate$1O([
42278 Autowired('rowModel')
42279 ], CellNavigationService.prototype, "rowModel", void 0);
42280 __decorate$1O([
42281 Autowired('pinnedRowModel')
42282 ], CellNavigationService.prototype, "pinnedRowModel", void 0);
42283 __decorate$1O([
42284 Autowired('paginationProxy')
42285 ], CellNavigationService.prototype, "paginationProxy", void 0);
42286 CellNavigationService = __decorate$1O([
42287 Bean('cellNavigationService')
42288 ], CellNavigationService);
42289 return CellNavigationService;
42290}(BeanStub));
42291
42292/**
42293 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
42294 * @version v27.3.0
42295 * @link https://www.ag-grid.com/
42296 * @license MIT
42297 */
42298var __extends$29 = (undefined && undefined.__extends) || (function () {
42299 var extendStatics = function (d, b) {
42300 extendStatics = Object.setPrototypeOf ||
42301 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
42302 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
42303 return extendStatics(d, b);
42304 };
42305 return function (d, b) {
42306 extendStatics(d, b);
42307 function __() { this.constructor = d; }
42308 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
42309 };
42310})();
42311var __decorate$1P = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
42312 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
42313 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
42314 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;
42315 return c > 3 && r && Object.defineProperty(target, key, r), r;
42316};
42317var __param$5 = (undefined && undefined.__param) || function (paramIndex, decorator) {
42318 return function (target, key) { decorator(target, key, paramIndex); }
42319};
42320var AlignedGridsService = /** @class */ (function (_super) {
42321 __extends$29(AlignedGridsService, _super);
42322 function AlignedGridsService() {
42323 var _this = _super !== null && _super.apply(this, arguments) || this;
42324 // flag to mark if we are consuming. to avoid cyclic events (ie other grid firing back to master
42325 // while processing a master event) we mark this if consuming an event, and if we are, then
42326 // we don't fire back any events.
42327 _this.consuming = false;
42328 return _this;
42329 }
42330 AlignedGridsService.prototype.setBeans = function (loggerFactory) {
42331 this.logger = loggerFactory.create('AlignedGridsService');
42332 };
42333 AlignedGridsService.prototype.init = function () {
42334 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, this.fireColumnEvent.bind(this));
42335 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, this.fireColumnEvent.bind(this));
42336 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, this.fireColumnEvent.bind(this));
42337 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, this.fireColumnEvent.bind(this));
42338 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_RESIZED, this.fireColumnEvent.bind(this));
42339 this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, this.fireScrollEvent.bind(this));
42340 };
42341 // common logic across all the fire methods
42342 AlignedGridsService.prototype.fireEvent = function (callback) {
42343 // if we are already consuming, then we are acting on an event from a master,
42344 // so we don't cause a cyclic firing of events
42345 if (this.consuming) {
42346 return;
42347 }
42348 // iterate through the aligned grids, and pass each aligned grid service to the callback
42349 var otherGrids = this.gridOptionsWrapper.getAlignedGrids();
42350 if (otherGrids) {
42351 otherGrids.forEach(function (otherGridOptions) {
42352 if (otherGridOptions.api) {
42353 var alignedGridService = otherGridOptions.api.__getAlignedGridService();
42354 callback(alignedGridService);
42355 }
42356 });
42357 }
42358 };
42359 // common logic across all consume methods. very little common logic, however extracting
42360 // guarantees consistency across the methods.
42361 AlignedGridsService.prototype.onEvent = function (callback) {
42362 this.consuming = true;
42363 callback();
42364 this.consuming = false;
42365 };
42366 AlignedGridsService.prototype.fireColumnEvent = function (event) {
42367 this.fireEvent(function (alignedGridsService) {
42368 alignedGridsService.onColumnEvent(event);
42369 });
42370 };
42371 AlignedGridsService.prototype.fireScrollEvent = function (event) {
42372 if (event.direction !== 'horizontal') {
42373 return;
42374 }
42375 this.fireEvent(function (alignedGridsService) {
42376 alignedGridsService.onScrollEvent(event);
42377 });
42378 };
42379 AlignedGridsService.prototype.onScrollEvent = function (event) {
42380 var _this = this;
42381 this.onEvent(function () {
42382 var gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
42383 gridBodyCon.getScrollFeature().setHorizontalScrollPosition(event.left);
42384 });
42385 };
42386 AlignedGridsService.prototype.getMasterColumns = function (event) {
42387 var result = [];
42388 if (event.columns) {
42389 event.columns.forEach(function (column) {
42390 result.push(column);
42391 });
42392 }
42393 else if (event.column) {
42394 result.push(event.column);
42395 }
42396 return result;
42397 };
42398 AlignedGridsService.prototype.getColumnIds = function (event) {
42399 var result = [];
42400 if (event.columns) {
42401 event.columns.forEach(function (column) {
42402 result.push(column.getColId());
42403 });
42404 }
42405 else if (event.column) {
42406 result.push(event.column.getColId());
42407 }
42408 return result;
42409 };
42410 AlignedGridsService.prototype.onColumnEvent = function (event) {
42411 var _this = this;
42412 this.onEvent(function () {
42413 switch (event.type) {
42414 case Events.EVENT_COLUMN_MOVED:
42415 case Events.EVENT_COLUMN_VISIBLE:
42416 case Events.EVENT_COLUMN_PINNED:
42417 case Events.EVENT_COLUMN_RESIZED:
42418 var colEvent = event;
42419 _this.processColumnEvent(colEvent);
42420 break;
42421 case Events.EVENT_COLUMN_GROUP_OPENED:
42422 var groupOpenedEvent = event;
42423 _this.processGroupOpenedEvent(groupOpenedEvent);
42424 break;
42425 case Events.EVENT_COLUMN_PIVOT_CHANGED:
42426 // we cannot support pivoting with aligned grids as the columns will be out of sync as the
42427 // grids will have columns created based on the row data of the grid.
42428 console.warn('AG Grid: pivoting is not supported with aligned grids. ' +
42429 'You can only use one of these features at a time in a grid.');
42430 break;
42431 }
42432 });
42433 };
42434 AlignedGridsService.prototype.processGroupOpenedEvent = function (groupOpenedEvent) {
42435 // likewise for column group
42436 var masterColumnGroup = groupOpenedEvent.columnGroup;
42437 var otherColumnGroup = null;
42438 if (masterColumnGroup) {
42439 var groupId = masterColumnGroup.getGroupId();
42440 otherColumnGroup = this.columnModel.getProvidedColumnGroup(groupId);
42441 }
42442 if (masterColumnGroup && !otherColumnGroup) {
42443 return;
42444 }
42445 this.logger.log('onColumnEvent-> processing ' + groupOpenedEvent + ' expanded = ' + masterColumnGroup.isExpanded());
42446 this.columnModel.setColumnGroupOpened(otherColumnGroup, masterColumnGroup.isExpanded(), "alignedGridChanged");
42447 };
42448 AlignedGridsService.prototype.processColumnEvent = function (colEvent) {
42449 var _this = this;
42450 // the column in the event is from the master grid. need to
42451 // look up the equivalent from this (other) grid
42452 var masterColumn = colEvent.column;
42453 var otherColumn = null;
42454 if (masterColumn) {
42455 otherColumn = this.columnModel.getPrimaryColumn(masterColumn.getColId());
42456 }
42457 // if event was with respect to a master column, that is not present in this
42458 // grid, then we ignore the event
42459 if (masterColumn && !otherColumn) {
42460 return;
42461 }
42462 // in time, all the methods below should use the column ids, it's a more generic way
42463 // of handling columns, and also allows for single or multi column events
42464 var masterColumns = this.getMasterColumns(colEvent);
42465 switch (colEvent.type) {
42466 case Events.EVENT_COLUMN_MOVED:
42467 // when the user moves columns via setColumnState, we can't depend on moving specific columns
42468 // to an index, as there maybe be many indexes columns moved to (as wasn't result of a mouse drag).
42469 // so only way to be sure is match the order of all columns using Column State.
42470 {
42471 var movedEvent = colEvent;
42472 var srcColState = colEvent.columnApi.getColumnState();
42473 var destColState = srcColState.map(function (s) { return ({ colId: s.colId }); });
42474 this.columnModel.applyColumnState({ state: destColState, applyOrder: true }, "alignedGridChanged");
42475 this.logger.log("onColumnEvent-> processing " + colEvent.type + " toIndex = " + movedEvent.toIndex);
42476 }
42477 break;
42478 case Events.EVENT_COLUMN_VISIBLE:
42479 // when the user changes visibility via setColumnState, we can't depend on visibility flag in event
42480 // as there maybe be mix of true/false (as wasn't result of a mouse click to set visiblity).
42481 // so only way to be sure is match the visibility of all columns using Column State.
42482 {
42483 var visibleEvent = colEvent;
42484 var srcColState = colEvent.columnApi.getColumnState();
42485 var destColState = srcColState.map(function (s) { return ({ colId: s.colId, hide: s.hide }); });
42486 this.columnModel.applyColumnState({ state: destColState }, "alignedGridChanged");
42487 this.logger.log("onColumnEvent-> processing " + colEvent.type + " visible = " + visibleEvent.visible);
42488 }
42489 break;
42490 case Events.EVENT_COLUMN_PINNED:
42491 {
42492 var pinnedEvent = colEvent;
42493 var srcColState = colEvent.columnApi.getColumnState();
42494 var destColState = srcColState.map(function (s) { return ({ colId: s.colId, pinned: s.pinned }); });
42495 this.columnModel.applyColumnState({ state: destColState }, "alignedGridChanged");
42496 this.logger.log("onColumnEvent-> processing " + colEvent.type + " pinned = " + pinnedEvent.pinned);
42497 }
42498 break;
42499 case Events.EVENT_COLUMN_RESIZED:
42500 var resizedEvent_1 = colEvent;
42501 masterColumns.forEach(function (column) {
42502 _this.logger.log("onColumnEvent-> processing " + colEvent.type + " actualWidth = " + column.getActualWidth());
42503 var columnWidths = [{ key: column.getColId(), newWidth: column.getActualWidth() }];
42504 _this.columnModel.setColumnWidths(columnWidths, false, resizedEvent_1.finished, "alignedGridChanged");
42505 });
42506 break;
42507 }
42508 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
42509 var isVerticalScrollShowing = gridBodyCon.isVerticalScrollShowing();
42510 var alignedGrids = this.gridOptionsWrapper.getAlignedGrids();
42511 if (alignedGrids) {
42512 alignedGrids.forEach(function (grid) {
42513 if (grid.api) {
42514 grid.api.setAlwaysShowVerticalScroll(isVerticalScrollShowing);
42515 }
42516 });
42517 }
42518 };
42519 __decorate$1P([
42520 Autowired('columnModel')
42521 ], AlignedGridsService.prototype, "columnModel", void 0);
42522 __decorate$1P([
42523 Autowired('ctrlsService')
42524 ], AlignedGridsService.prototype, "ctrlsService", void 0);
42525 __decorate$1P([
42526 __param$5(0, Qualifier('loggerFactory'))
42527 ], AlignedGridsService.prototype, "setBeans", null);
42528 __decorate$1P([
42529 PostConstruct
42530 ], AlignedGridsService.prototype, "init", null);
42531 AlignedGridsService = __decorate$1P([
42532 Bean('alignedGridsService')
42533 ], AlignedGridsService);
42534 return AlignedGridsService;
42535}(BeanStub));
42536
42537/**
42538 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
42539 * @version v27.3.0
42540 * @link https://www.ag-grid.com/
42541 * @license MIT
42542 */
42543var __extends$2a = (undefined && undefined.__extends) || (function () {
42544 var extendStatics = function (d, b) {
42545 extendStatics = Object.setPrototypeOf ||
42546 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
42547 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
42548 return extendStatics(d, b);
42549 };
42550 return function (d, b) {
42551 extendStatics(d, b);
42552 function __() { this.constructor = d; }
42553 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
42554 };
42555})();
42556var __decorate$1Q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
42557 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
42558 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
42559 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;
42560 return c > 3 && r && Object.defineProperty(target, key, r), r;
42561};
42562var __param$6 = (undefined && undefined.__param) || function (paramIndex, decorator) {
42563 return function (target, key) { decorator(target, key, paramIndex); }
42564};
42565var SelectionService = /** @class */ (function (_super) {
42566 __extends$2a(SelectionService, _super);
42567 function SelectionService() {
42568 return _super !== null && _super.apply(this, arguments) || this;
42569 }
42570 SelectionService.prototype.setBeans = function (loggerFactory) {
42571 this.logger = loggerFactory.create('selectionService');
42572 this.reset();
42573 };
42574 SelectionService.prototype.init = function () {
42575 this.groupSelectsChildren = this.gridOptionsWrapper.isGroupSelectsChildren();
42576 this.addManagedListener(this.eventService, Events.EVENT_ROW_SELECTED, this.onRowSelected.bind(this));
42577 };
42578 SelectionService.prototype.setLastSelectedNode = function (rowNode) {
42579 this.lastSelectedNode = rowNode;
42580 };
42581 SelectionService.prototype.getLastSelectedNode = function () {
42582 return this.lastSelectedNode;
42583 };
42584 SelectionService.prototype.getSelectedNodes = function () {
42585 var selectedNodes = [];
42586 iterateObject(this.selectedNodes, function (key, rowNode) {
42587 if (rowNode) {
42588 selectedNodes.push(rowNode);
42589 }
42590 });
42591 return selectedNodes;
42592 };
42593 SelectionService.prototype.getSelectedRows = function () {
42594 var selectedRows = [];
42595 iterateObject(this.selectedNodes, function (key, rowNode) {
42596 if (rowNode && rowNode.data) {
42597 selectedRows.push(rowNode.data);
42598 }
42599 });
42600 return selectedRows;
42601 };
42602 SelectionService.prototype.removeGroupsFromSelection = function () {
42603 var _this = this;
42604 iterateObject(this.selectedNodes, function (key, rowNode) {
42605 if (rowNode && rowNode.group) {
42606 _this.selectedNodes[rowNode.id] = undefined;
42607 }
42608 });
42609 };
42610 // should only be called if groupSelectsChildren=true
42611 SelectionService.prototype.updateGroupsFromChildrenSelections = function (changedPath) {
42612 // we only do this when group selection state depends on selected children
42613 if (!this.gridOptionsWrapper.isGroupSelectsChildren()) {
42614 return;
42615 }
42616 // also only do it if CSRM (code should never allow this anyway)
42617 if (this.rowModel.getType() !== Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
42618 return;
42619 }
42620 var clientSideRowModel = this.rowModel;
42621 var rootNode = clientSideRowModel.getRootNode();
42622 if (!changedPath) {
42623 changedPath = new ChangedPath(true, rootNode);
42624 changedPath.setInactive();
42625 }
42626 changedPath.forEachChangedNodeDepthFirst(function (rowNode) {
42627 if (rowNode !== rootNode) {
42628 rowNode.calculateSelectedFromChildren();
42629 }
42630 });
42631 // clientSideRowModel.getTopLevelNodes()!.forEach((rowNode: RowNode) => {
42632 // rowNode.depthFirstSearch((node) => {
42633 // if (node.group) {
42634 // }
42635 // });
42636 // });
42637 };
42638 SelectionService.prototype.getNodeForIdIfSelected = function (id) {
42639 return this.selectedNodes[id];
42640 };
42641 SelectionService.prototype.clearOtherNodes = function (rowNodeToKeepSelected) {
42642 var _this = this;
42643 var groupsToRefresh = {};
42644 var updatedCount = 0;
42645 iterateObject(this.selectedNodes, function (key, otherRowNode) {
42646 if (otherRowNode && otherRowNode.id !== rowNodeToKeepSelected.id) {
42647 var rowNode = _this.selectedNodes[otherRowNode.id];
42648 updatedCount += rowNode.setSelectedParams({
42649 newValue: false,
42650 clearSelection: false,
42651 suppressFinishActions: true
42652 });
42653 if (_this.groupSelectsChildren && otherRowNode.parent) {
42654 groupsToRefresh[otherRowNode.parent.id] = otherRowNode.parent;
42655 }
42656 }
42657 });
42658 iterateObject(groupsToRefresh, function (key, group) {
42659 group.calculateSelectedFromChildren();
42660 });
42661 return updatedCount;
42662 };
42663 SelectionService.prototype.onRowSelected = function (event) {
42664 var rowNode = event.node;
42665 // we do not store the group rows when the groups select children
42666 if (this.groupSelectsChildren && rowNode.group) {
42667 return;
42668 }
42669 if (rowNode.isSelected()) {
42670 this.selectedNodes[rowNode.id] = rowNode;
42671 }
42672 else {
42673 this.selectedNodes[rowNode.id] = undefined;
42674 }
42675 };
42676 SelectionService.prototype.syncInRowNode = function (rowNode, oldNode) {
42677 this.syncInOldRowNode(rowNode, oldNode);
42678 this.syncInNewRowNode(rowNode);
42679 };
42680 // if the id has changed for the node, then this means the rowNode
42681 // is getting used for a different data item, which breaks
42682 // our selectedNodes, as the node now is mapped by the old id
42683 // which is inconsistent. so to keep the old node as selected,
42684 // we swap in the clone (with the old id and old data). this means
42685 // the oldNode is effectively a daemon we keep a reference to,
42686 // so if client calls api.getSelectedNodes(), it gets the daemon
42687 // in the result. when the client un-selects, the reference to the
42688 // daemon is removed. the daemon, because it's an oldNode, is not
42689 // used by the grid for rendering, it's a copy of what the node used
42690 // to be like before the id was changed.
42691 SelectionService.prototype.syncInOldRowNode = function (rowNode, oldNode) {
42692 var oldNodeHasDifferentId = exists(oldNode) && (rowNode.id !== oldNode.id);
42693 if (oldNodeHasDifferentId && oldNode) {
42694 var id = oldNode.id;
42695 var oldNodeSelected = this.selectedNodes[id] == rowNode;
42696 if (oldNodeSelected) {
42697 this.selectedNodes[oldNode.id] = oldNode;
42698 }
42699 }
42700 };
42701 SelectionService.prototype.syncInNewRowNode = function (rowNode) {
42702 if (exists(this.selectedNodes[rowNode.id])) {
42703 rowNode.setSelectedInitialValue(true);
42704 this.selectedNodes[rowNode.id] = rowNode;
42705 }
42706 else {
42707 rowNode.setSelectedInitialValue(false);
42708 }
42709 };
42710 SelectionService.prototype.reset = function () {
42711 this.logger.log('reset');
42712 this.selectedNodes = {};
42713 this.lastSelectedNode = null;
42714 };
42715 // returns a list of all nodes at 'best cost' - a feature to be used
42716 // with groups / trees. if a group has all it's children selected,
42717 // then the group appears in the result, but not the children.
42718 // Designed for use with 'children' as the group selection type,
42719 // where groups don't actually appear in the selection normally.
42720 SelectionService.prototype.getBestCostNodeSelection = function () {
42721 if (this.rowModel.getType() !== Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
42722 console.warn('AG Grid: `getBestCostNodeSelection` is only available when using normal row model');
42723 return;
42724 }
42725 var clientSideRowModel = this.rowModel;
42726 var topLevelNodes = clientSideRowModel.getTopLevelNodes();
42727 if (topLevelNodes === null) {
42728 console.warn('AG Grid: `selectAll` not available doing `rowModel=virtual`');
42729 return;
42730 }
42731 var result = [];
42732 // recursive function, to find the selected nodes
42733 function traverse(nodes) {
42734 for (var i = 0, l = nodes.length; i < l; i++) {
42735 var node = nodes[i];
42736 if (node.isSelected()) {
42737 result.push(node);
42738 }
42739 else {
42740 // if not selected, then if it's a group, and the group
42741 // has children, continue to search for selections
42742 var maybeGroup = node;
42743 if (maybeGroup.group && maybeGroup.children) {
42744 traverse(maybeGroup.children);
42745 }
42746 }
42747 }
42748 }
42749 traverse(topLevelNodes);
42750 return result;
42751 };
42752 SelectionService.prototype.setRowModel = function (rowModel) {
42753 this.rowModel = rowModel;
42754 };
42755 SelectionService.prototype.isEmpty = function () {
42756 var count = 0;
42757 iterateObject(this.selectedNodes, function (nodeId, rowNode) {
42758 if (rowNode) {
42759 count++;
42760 }
42761 });
42762 return count === 0;
42763 };
42764 SelectionService.prototype.deselectAllRowNodes = function (justFiltered) {
42765 if (justFiltered === void 0) { justFiltered = false; }
42766 var callback = function (rowNode) { return rowNode.selectThisNode(false); };
42767 var rowModelClientSide = this.rowModel.getType() === Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
42768 if (justFiltered) {
42769 if (!rowModelClientSide) {
42770 console.error('AG Grid: selecting just filtered only works with In Memory Row Model');
42771 return;
42772 }
42773 var clientSideRowModel = this.rowModel;
42774 clientSideRowModel.forEachNodeAfterFilter(callback);
42775 }
42776 else {
42777 iterateObject(this.selectedNodes, function (id, rowNode) {
42778 // remember the reference can be to null, as we never 'delete' from the map
42779 if (rowNode) {
42780 callback(rowNode);
42781 }
42782 });
42783 // this clears down the map (whereas above only sets the items in map to 'undefined')
42784 this.reset();
42785 }
42786 // the above does not clean up the parent rows if they are selected
42787 if (rowModelClientSide && this.groupSelectsChildren) {
42788 this.updateGroupsFromChildrenSelections();
42789 }
42790 var event = {
42791 type: Events.EVENT_SELECTION_CHANGED,
42792 api: this.gridApi,
42793 columnApi: this.columnApi
42794 };
42795 this.eventService.dispatchEvent(event);
42796 };
42797 SelectionService.prototype.selectAllRowNodes = function (justFiltered) {
42798 if (justFiltered === void 0) { justFiltered = false; }
42799 if (this.rowModel.getType() !== Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
42800 throw new Error("selectAll only available with normal row model, ie not " + this.rowModel.getType());
42801 }
42802 var clientSideRowModel = this.rowModel;
42803 var callback = function (rowNode) { return rowNode.selectThisNode(true); };
42804 if (justFiltered) {
42805 clientSideRowModel.forEachNodeAfterFilter(callback);
42806 }
42807 else {
42808 clientSideRowModel.forEachNode(callback);
42809 }
42810 // the above does not clean up the parent rows if they are selected
42811 if (this.rowModel.getType() === Constants.ROW_MODEL_TYPE_CLIENT_SIDE && this.groupSelectsChildren) {
42812 this.updateGroupsFromChildrenSelections();
42813 }
42814 var event = {
42815 type: Events.EVENT_SELECTION_CHANGED,
42816 api: this.gridApi,
42817 columnApi: this.columnApi
42818 };
42819 this.eventService.dispatchEvent(event);
42820 };
42821 /**
42822 * @method
42823 * @deprecated
42824 */
42825 SelectionService.prototype.selectNode = function (rowNode, tryMulti) {
42826 if (rowNode) {
42827 rowNode.setSelectedParams({ newValue: true, clearSelection: !tryMulti });
42828 }
42829 };
42830 /**
42831 * @method
42832 * @deprecated
42833 */
42834 SelectionService.prototype.deselectIndex = function (rowIndex) {
42835 var node = this.rowModel.getRow(rowIndex);
42836 this.deselectNode(node);
42837 };
42838 /**
42839 * @method
42840 * @deprecated
42841 */
42842 SelectionService.prototype.deselectNode = function (rowNode) {
42843 if (rowNode) {
42844 rowNode.setSelectedParams({ newValue: false, clearSelection: false });
42845 }
42846 };
42847 /**
42848 * @method
42849 * @deprecated
42850 */
42851 SelectionService.prototype.selectIndex = function (index, tryMulti) {
42852 var node = this.rowModel.getRow(index);
42853 this.selectNode(node, tryMulti);
42854 };
42855 __decorate$1Q([
42856 Autowired('rowModel')
42857 ], SelectionService.prototype, "rowModel", void 0);
42858 __decorate$1Q([
42859 Autowired('columnApi')
42860 ], SelectionService.prototype, "columnApi", void 0);
42861 __decorate$1Q([
42862 Autowired('gridApi')
42863 ], SelectionService.prototype, "gridApi", void 0);
42864 __decorate$1Q([
42865 __param$6(0, Qualifier('loggerFactory'))
42866 ], SelectionService.prototype, "setBeans", null);
42867 __decorate$1Q([
42868 PostConstruct
42869 ], SelectionService.prototype, "init", null);
42870 SelectionService = __decorate$1Q([
42871 Bean('selectionService')
42872 ], SelectionService);
42873 return SelectionService;
42874}(BeanStub));
42875
42876/**
42877 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
42878 * @version v27.3.0
42879 * @link https://www.ag-grid.com/
42880 * @license MIT
42881 */
42882var __decorate$1R = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
42883 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
42884 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
42885 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;
42886 return c > 3 && r && Object.defineProperty(target, key, r), r;
42887};
42888var ColumnApi = /** @class */ (function () {
42889 function ColumnApi() {
42890 }
42891 /** Gets the grid to size the columns to the specified width in pixels, e.g. `sizeColumnsToFit(900)`. To have the grid fit the columns to the grid's width, use the Grid API `gridApi.sizeColumnsToFit()` instead. */
42892 ColumnApi.prototype.sizeColumnsToFit = function (gridWidth) {
42893 // AG-3403 validate that gridWidth is provided because this method has the same name as
42894 // a method on the grid API that takes no arguments, and it's easy to confuse the two
42895 if (typeof gridWidth === "undefined") {
42896 console.error('AG Grid: missing parameter to columnApi.sizeColumnsToFit(gridWidth)');
42897 }
42898 this.columnModel.sizeColumnsToFit(gridWidth, 'api');
42899 };
42900 /** Call this if you want to open or close a column group. */
42901 ColumnApi.prototype.setColumnGroupOpened = function (group, newValue) { this.columnModel.setColumnGroupOpened(group, newValue, 'api'); };
42902 /** Returns the column group with the given name. */
42903 ColumnApi.prototype.getColumnGroup = function (name, instanceId) { return this.columnModel.getColumnGroup(name, instanceId); };
42904 /** Returns the provided column group with the given name. */
42905 ColumnApi.prototype.getProvidedColumnGroup = function (name) { return this.columnModel.getProvidedColumnGroup(name); };
42906 /** Returns the display name for a column. Useful if you are doing your own header rendering and want the grid to work out if `headerValueGetter` is used, or if you are doing your own column management GUI, to know what to show as the column name. */
42907 ColumnApi.prototype.getDisplayNameForColumn = function (column, location) { return this.columnModel.getDisplayNameForColumn(column, location) || ''; };
42908 /** Returns the display name for a column group (when grouping columns). */
42909 ColumnApi.prototype.getDisplayNameForColumnGroup = function (columnGroup, location) { return this.columnModel.getDisplayNameForColumnGroup(columnGroup, location) || ''; };
42910 /** Returns the column with the given `colKey`, which can either be the `colId` (a string) or the `colDef` (an object). */
42911 ColumnApi.prototype.getColumn = function (key) { return this.columnModel.getPrimaryColumn(key); };
42912 /** Applies the state of the columns from a previous state. Returns `false` if one or more columns could not be found. */
42913 ColumnApi.prototype.applyColumnState = function (params) { return this.columnModel.applyColumnState(params, 'api'); };
42914 /** Gets the state of the columns. Typically used when saving column state. */
42915 ColumnApi.prototype.getColumnState = function () { return this.columnModel.getColumnState(); };
42916 /** Sets the state back to match the originally provided column definitions. */
42917 ColumnApi.prototype.resetColumnState = function () { this.columnModel.resetColumnState('api'); };
42918 /** Gets the state of the column groups. Typically used when saving column group state. */
42919 ColumnApi.prototype.getColumnGroupState = function () { return this.columnModel.getColumnGroupState(); };
42920 /** Sets the state of the column group state from a previous state. */
42921 ColumnApi.prototype.setColumnGroupState = function (stateItems) { this.columnModel.setColumnGroupState(stateItems, 'api'); };
42922 /** Sets the state back to match the originally provided column definitions. */
42923 ColumnApi.prototype.resetColumnGroupState = function () { this.columnModel.resetColumnGroupState('api'); };
42924 /** Returns `true` if pinning left or right, otherwise `false`. */
42925 ColumnApi.prototype.isPinning = function () { return this.columnModel.isPinningLeft() || this.columnModel.isPinningRight(); };
42926 /** Returns `true` if pinning left, otherwise `false`. */
42927 ColumnApi.prototype.isPinningLeft = function () { return this.columnModel.isPinningLeft(); };
42928 /** Returns `true` if pinning right, otherwise `false`. */
42929 ColumnApi.prototype.isPinningRight = function () { return this.columnModel.isPinningRight(); };
42930 /** Returns the column to the right of the provided column, taking into consideration open / closed column groups and visible columns. This is useful if you need to know what column is beside yours e.g. if implementing your own cell navigation. */
42931 ColumnApi.prototype.getDisplayedColAfter = function (col) { return this.columnModel.getDisplayedColAfter(col); };
42932 /** Same as `getVisibleColAfter` except gives column to the left. */
42933 ColumnApi.prototype.getDisplayedColBefore = function (col) { return this.columnModel.getDisplayedColBefore(col); };
42934 /** Sets the visibility of a column. Key can be the column ID or `Column` object. */
42935 ColumnApi.prototype.setColumnVisible = function (key, visible) { this.columnModel.setColumnVisible(key, visible, 'api'); };
42936 /** Same as `setColumnVisible`, but provide a list of column keys. */
42937 ColumnApi.prototype.setColumnsVisible = function (keys, visible) { this.columnModel.setColumnsVisible(keys, visible, 'api'); };
42938 /** Sets the column pinned / unpinned. Key can be the column ID, field, `ColDef` object or `Column` object. */
42939 ColumnApi.prototype.setColumnPinned = function (key, pinned) { this.columnModel.setColumnPinned(key, pinned, 'api'); };
42940 /** Same as `setColumnPinned`, but provide a list of column keys. */
42941 ColumnApi.prototype.setColumnsPinned = function (keys, pinned) { this.columnModel.setColumnsPinned(keys, pinned, 'api'); };
42942 /** Returns all the columns, regardless of visible or not. */
42943 ColumnApi.prototype.getAllColumns = function () { return this.columnModel.getAllPrimaryColumns(); };
42944 /**
42945 * Returns all the grid columns, same as `getAllColumns()`, except
42946 *
42947 * a) it has the order of the columns that are presented in the grid
42948 *
42949 * b) it's after the 'pivot' step, so if pivoting, has the value columns for the pivot.
42950 */
42951 ColumnApi.prototype.getAllGridColumns = function () { return this.columnModel.getAllGridColumns(); };
42952 /** Same as `getAllDisplayedColumns` but just for the pinned left portion of the grid. */
42953 ColumnApi.prototype.getDisplayedLeftColumns = function () { return this.columnModel.getDisplayedLeftColumns(); };
42954 /** Same as `getAllDisplayedColumns` but just for the center portion of the grid. */
42955 ColumnApi.prototype.getDisplayedCenterColumns = function () { return this.columnModel.getDisplayedCenterColumns(); };
42956 /** Same as `getAllDisplayedColumns` but just for the pinned right portion of the grid. */
42957 ColumnApi.prototype.getDisplayedRightColumns = function () { return this.columnModel.getDisplayedRightColumns(); };
42958 /** Returns all columns currently displayed (e.g. are visible and if in a group, the group is showing the columns) for the pinned left, centre and pinned right portions of the grid. */
42959 ColumnApi.prototype.getAllDisplayedColumns = function () { return this.columnModel.getAllDisplayedColumns(); };
42960 /** Same as `getAllGridColumns()`, except only returns rendered columns, i.e. columns that are not within the viewport and therefore not rendered, due to column virtualisation, are not displayed. */
42961 ColumnApi.prototype.getAllDisplayedVirtualColumns = function () { return this.columnModel.getViewportColumns(); };
42962 /** Moves a column to `toIndex`. The column is first removed, then added at the `toIndex` location, thus index locations will change to the right of the column after the removal. */
42963 ColumnApi.prototype.moveColumn = function (key, toIndex) {
42964 if (typeof key === 'number') {
42965 // moveColumn used to take indexes, so this is advising user who hasn't moved to new method name
42966 console.warn('AG Grid: you are using moveColumn(fromIndex, toIndex) - moveColumn takes a column key and a destination index, not two indexes, to move with indexes use moveColumnByIndex(from,to) instead');
42967 this.columnModel.moveColumnByIndex(key, toIndex, 'api');
42968 }
42969 else {
42970 this.columnModel.moveColumn(key, toIndex, 'api');
42971 }
42972 };
42973 /** Same as `moveColumn` but works on index locations. */
42974 ColumnApi.prototype.moveColumnByIndex = function (fromIndex, toIndex) { this.columnModel.moveColumnByIndex(fromIndex, toIndex, 'api'); };
42975 /** Same as `moveColumn` but works on list. */
42976 ColumnApi.prototype.moveColumns = function (columnsToMoveKeys, toIndex) { this.columnModel.moveColumns(columnsToMoveKeys, toIndex, 'api'); };
42977 /** Move the column to a new position in the row grouping order. */
42978 ColumnApi.prototype.moveRowGroupColumn = function (fromIndex, toIndex) { this.columnModel.moveRowGroupColumn(fromIndex, toIndex); };
42979 /** Sets the agg function for a column. `aggFunc` can be one of `'min' | 'max' | 'sum'`. */
42980 ColumnApi.prototype.setColumnAggFunc = function (key, aggFunc) { this.columnModel.setColumnAggFunc(key, aggFunc); };
42981 /** Sets the column width on a single column. The finished flag gets included in the resulting event and not used internally by the grid. The finished flag is intended for dragging, where a dragging action will produce many `columnWidth` events, so the consumer of events knows when it receives the last event in a stream. The finished parameter is optional, and defaults to `true`. */
42982 ColumnApi.prototype.setColumnWidth = function (key, newWidth, finished, source) {
42983 if (finished === void 0) { finished = true; }
42984 this.columnModel.setColumnWidths([{ key: key, newWidth: newWidth }], false, finished, source);
42985 };
42986 /** Sets the column widths on multiple columns. This method offers better performance than calling `setColumnWidth` multiple times. The finished flag gets included in the resulting event and not used internally by the grid. The finished flag is intended for dragging, where a dragging action will produce many `columnWidth` events, so the consumer of events knows when it receives the last event in a stream. The finished parameter is optional, and defaults to `true`. */
42987 ColumnApi.prototype.setColumnWidths = function (columnWidths, finished, source) {
42988 if (finished === void 0) { finished = true; }
42989 this.columnModel.setColumnWidths(columnWidths, false, finished, source);
42990 };
42991 /** Set the pivot mode. */
42992 ColumnApi.prototype.setPivotMode = function (pivotMode) { this.columnModel.setPivotMode(pivotMode); };
42993 /** Get the pivot mode. */
42994 ColumnApi.prototype.isPivotMode = function () { return this.columnModel.isPivotMode(); };
42995 /** Returns the pivot column for the given `pivotKeys` and `valueColId`. Useful to then call operations on the pivot column. */
42996 ColumnApi.prototype.getSecondaryPivotColumn = function (pivotKeys, valueColKey) { return this.columnModel.getSecondaryPivotColumn(pivotKeys, valueColKey); };
42997 /** Set the value columns. */
42998 ColumnApi.prototype.setValueColumns = function (colKeys) { this.columnModel.setValueColumns(colKeys, 'api'); };
42999 /** Get value columns. */
43000 ColumnApi.prototype.getValueColumns = function () { return this.columnModel.getValueColumns(); };
43001 /** Remove a value column. */
43002 ColumnApi.prototype.removeValueColumn = function (colKey) { this.columnModel.removeValueColumn(colKey, 'api'); };
43003 /** Same as `removeValueColumns` but provide a list. */
43004 ColumnApi.prototype.removeValueColumns = function (colKeys) { this.columnModel.removeValueColumns(colKeys, 'api'); };
43005 /** Add a value column. */
43006 ColumnApi.prototype.addValueColumn = function (colKey) { this.columnModel.addValueColumn(colKey, 'api'); };
43007 /** Same as `addValueColumn` but provide a list. */
43008 ColumnApi.prototype.addValueColumns = function (colKeys) { this.columnModel.addValueColumns(colKeys, 'api'); };
43009 /** Set the row group columns. */
43010 ColumnApi.prototype.setRowGroupColumns = function (colKeys) { this.columnModel.setRowGroupColumns(colKeys, 'api'); };
43011 /** Remove a column from the row groups. */
43012 ColumnApi.prototype.removeRowGroupColumn = function (colKey) { this.columnModel.removeRowGroupColumn(colKey, 'api'); };
43013 /** Same as `removeRowGroupColumn` but provide a list of columns. */
43014 ColumnApi.prototype.removeRowGroupColumns = function (colKeys) { this.columnModel.removeRowGroupColumns(colKeys, 'api'); };
43015 /** Add a column to the row groups. */
43016 ColumnApi.prototype.addRowGroupColumn = function (colKey) { this.columnModel.addRowGroupColumn(colKey, 'api'); };
43017 /** Same as `addRowGroupColumn` but provide a list of columns. */
43018 ColumnApi.prototype.addRowGroupColumns = function (colKeys) { this.columnModel.addRowGroupColumns(colKeys, 'api'); };
43019 /** Get row group columns. */
43020 ColumnApi.prototype.getRowGroupColumns = function () { return this.columnModel.getRowGroupColumns(); };
43021 /** Set the pivot columns. */
43022 ColumnApi.prototype.setPivotColumns = function (colKeys) { this.columnModel.setPivotColumns(colKeys, 'api'); };
43023 /** Remove a pivot column. */
43024 ColumnApi.prototype.removePivotColumn = function (colKey) { this.columnModel.removePivotColumn(colKey, 'api'); };
43025 /** Same as `removePivotColumn` but provide a list of columns. */
43026 ColumnApi.prototype.removePivotColumns = function (colKeys) { this.columnModel.removePivotColumns(colKeys, 'api'); };
43027 /** Add a pivot column. */
43028 ColumnApi.prototype.addPivotColumn = function (colKey) { this.columnModel.addPivotColumn(colKey, 'api'); };
43029 /** Same as `addPivotColumn` but provide a list of columns. */
43030 ColumnApi.prototype.addPivotColumns = function (colKeys) { this.columnModel.addPivotColumns(colKeys, 'api'); };
43031 /** Get the pivot columns. */
43032 ColumnApi.prototype.getPivotColumns = function () { return this.columnModel.getPivotColumns(); };
43033 /** Same as `getAllDisplayedColumnGroups` but just for the pinned left portion of the grid. */
43034 ColumnApi.prototype.getLeftDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeLeft(); };
43035 /** Same as `getAllDisplayedColumnGroups` but just for the center portion of the grid. */
43036 ColumnApi.prototype.getCenterDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeCentre(); };
43037 /** Same as `getAllDisplayedColumnGroups` but just for the pinned right portion of the grid. */
43038 ColumnApi.prototype.getRightDisplayedColumnGroups = function () { return this.columnModel.getDisplayedTreeRight(); };
43039 /** Returns all 'root' column headers. If you are not grouping columns, these return the columns. If you are grouping, these return the top level groups - you can navigate down through each one to get the other lower level headers and finally the columns at the bottom. */
43040 ColumnApi.prototype.getAllDisplayedColumnGroups = function () { return this.columnModel.getAllDisplayedTrees(); };
43041 /** Auto-sizes a column based on its contents. */
43042 ColumnApi.prototype.autoSizeColumn = function (key, skipHeader) { return this.columnModel.autoSizeColumn(key, skipHeader, 'api'); };
43043 /** Same as `autoSizeColumn`, but provide a list of column keys. */
43044 ColumnApi.prototype.autoSizeColumns = function (keys, skipHeader) {
43045 this.columnModel.autoSizeColumns({ columns: keys, skipHeader: skipHeader });
43046 };
43047 /** Calls `autoSizeColumns` on all displayed columns. */
43048 ColumnApi.prototype.autoSizeAllColumns = function (skipHeader) { this.columnModel.autoSizeAllColumns(skipHeader, 'api'); };
43049 /** Set the secondary pivot columns. */
43050 ColumnApi.prototype.setSecondaryColumns = function (colDefs) { this.columnModel.setSecondaryColumns(colDefs, 'api'); };
43051 /** Returns the grid's secondary columns. */
43052 ColumnApi.prototype.getSecondaryColumns = function () { return this.columnModel.getSecondaryColumns(); };
43053 /** Returns the grid's primary columns. */
43054 ColumnApi.prototype.getPrimaryColumns = function () { return this.columnModel.getAllPrimaryColumns(); };
43055 ColumnApi.prototype.cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid = function () {
43056 // some users were raising support issues with regards memory leaks. the problem was the customers applications
43057 // were keeping references to the API. trying to educate them all would be difficult, easier to just remove
43058 // all references in the API so at least the core grid can be garbage collected.
43059 //
43060 // wait about 100ms before clearing down the references, in case user has some cleanup to do,
43061 // and needs to deference the API first
43062 setTimeout(_.removeAllReferences.bind(window, this, 'Column API'), 100);
43063 };
43064 // below goes through deprecated items, prints message to user, then calls the new version of the same method
43065 // public getColumnDefs(): (ColDef | ColGroupDef)[] {
43066 // this.setColumnGroupOpened(group, newValue);
43067 // return null;
43068 // }
43069 /** @deprecated columnGroupOpened no longer exists, use setColumnGroupOpened */
43070 ColumnApi.prototype.columnGroupOpened = function (group, newValue) {
43071 console.error('AG Grid: columnGroupOpened no longer exists, use setColumnGroupOpened');
43072 this.setColumnGroupOpened(group, newValue);
43073 };
43074 /** @deprecated hideColumns is deprecated, use setColumnsVisible */
43075 ColumnApi.prototype.hideColumns = function (colIds, hide) {
43076 console.error('AG Grid: hideColumns is deprecated, use setColumnsVisible');
43077 this.columnModel.setColumnsVisible(colIds, !hide, 'api');
43078 };
43079 /** @deprecated hideColumn is deprecated, use setColumnVisible */
43080 ColumnApi.prototype.hideColumn = function (colId, hide) {
43081 console.error('AG Grid: hideColumn is deprecated, use setColumnVisible');
43082 this.columnModel.setColumnVisible(colId, !hide, 'api');
43083 };
43084 /** @deprecated setState is deprecated, use setColumnState */
43085 ColumnApi.prototype.setState = function (columnState) {
43086 console.error('AG Grid: setState is deprecated, use setColumnState');
43087 return this.setColumnState(columnState);
43088 };
43089 /** @deprecated getState is deprecated, use getColumnState */
43090 ColumnApi.prototype.getState = function () {
43091 console.error('AG Grid: getState is deprecated, use getColumnState');
43092 return this.getColumnState();
43093 };
43094 /** @deprecated resetState is deprecated, use resetColumnState */
43095 ColumnApi.prototype.resetState = function () {
43096 console.error('AG Grid: resetState is deprecated, use resetColumnState');
43097 this.resetColumnState();
43098 };
43099 /** @deprecated getAggregationColumns is deprecated, use getValueColumns */
43100 ColumnApi.prototype.getAggregationColumns = function () {
43101 console.error('AG Grid: getAggregationColumns is deprecated, use getValueColumns');
43102 return this.columnModel.getValueColumns();
43103 };
43104 /** @deprecated removeAggregationColumn is deprecated, use removeValueColumn */
43105 ColumnApi.prototype.removeAggregationColumn = function (colKey) {
43106 console.error('AG Grid: removeAggregationColumn is deprecated, use removeValueColumn');
43107 this.columnModel.removeValueColumn(colKey, 'api');
43108 };
43109 /** @deprecated removeAggregationColumns is deprecated, use removeValueColumns */
43110 ColumnApi.prototype.removeAggregationColumns = function (colKeys) {
43111 console.error('AG Grid: removeAggregationColumns is deprecated, use removeValueColumns');
43112 this.columnModel.removeValueColumns(colKeys, 'api');
43113 };
43114 /** @deprecated addAggregationColumn is deprecated, use addValueColumn */
43115 ColumnApi.prototype.addAggregationColumn = function (colKey) {
43116 console.error('AG Grid: addAggregationColumn is deprecated, use addValueColumn');
43117 this.columnModel.addValueColumn(colKey, 'api');
43118 };
43119 /** @deprecated addAggregationColumns is deprecated, use addValueColumns */
43120 ColumnApi.prototype.addAggregationColumns = function (colKeys) {
43121 console.error('AG Grid: addAggregationColumns is deprecated, use addValueColumns');
43122 this.columnModel.addValueColumns(colKeys, 'api');
43123 };
43124 /** @deprecated setColumnAggFunction is deprecated, use setColumnAggFunc */
43125 ColumnApi.prototype.setColumnAggFunction = function (column, aggFunc) {
43126 console.error('AG Grid: setColumnAggFunction is deprecated, use setColumnAggFunc');
43127 this.columnModel.setColumnAggFunc(column, aggFunc, 'api');
43128 };
43129 /** @deprecated getDisplayNameForCol is deprecated, use getDisplayNameForColumn */
43130 ColumnApi.prototype.getDisplayNameForCol = function (column) {
43131 console.error('AG Grid: getDisplayNameForCol is deprecated, use getDisplayNameForColumn');
43132 return this.getDisplayNameForColumn(column, null);
43133 };
43134 /** @deprecated setColumnState is deprecated, use applyColumnState. */
43135 ColumnApi.prototype.setColumnState = function (columnState) {
43136 console.error('AG Grid: setColumnState is deprecated, use applyColumnState');
43137 return this.columnModel.applyColumnState({ state: columnState, applyOrder: true }, 'api');
43138 };
43139 /** @deprecated getOriginalColumnGroup is deprecated, use getProvidedColumnGroup. */
43140 ColumnApi.prototype.getOriginalColumnGroup = function (name) {
43141 console.error('AG Grid: getOriginalColumnGroup is deprecated, use getProvidedColumnGroup');
43142 return this.columnModel.getProvidedColumnGroup(name);
43143 };
43144 __decorate$1R([
43145 Autowired('columnModel')
43146 ], ColumnApi.prototype, "columnModel", void 0);
43147 __decorate$1R([
43148 PreDestroy
43149 ], ColumnApi.prototype, "cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid", null);
43150 ColumnApi = __decorate$1R([
43151 Bean('columnApi')
43152 ], ColumnApi);
43153 return ColumnApi;
43154}());
43155
43156/**
43157 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
43158 * @version v27.3.0
43159 * @link https://www.ag-grid.com/
43160 * @license MIT
43161 */
43162var __extends$2b = (undefined && undefined.__extends) || (function () {
43163 var extendStatics = function (d, b) {
43164 extendStatics = Object.setPrototypeOf ||
43165 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
43166 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
43167 return extendStatics(d, b);
43168 };
43169 return function (d, b) {
43170 extendStatics(d, b);
43171 function __() { this.constructor = d; }
43172 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
43173 };
43174})();
43175var __decorate$1S = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
43176 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
43177 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
43178 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;
43179 return c > 3 && r && Object.defineProperty(target, key, r), r;
43180};
43181var ValueService = /** @class */ (function (_super) {
43182 __extends$2b(ValueService, _super);
43183 function ValueService() {
43184 var _this = _super !== null && _super.apply(this, arguments) || this;
43185 _this.initialised = false;
43186 return _this;
43187 }
43188 ValueService.prototype.init = function () {
43189 var _this = this;
43190 this.cellExpressions = this.gridOptionsWrapper.isEnableCellExpressions();
43191 this.initialised = true;
43192 // We listen to our own event and use it to call the columnSpecific callback,
43193 // this way the handler calls are correctly interleaved with other global events
43194 this.eventService.addEventListener(Events.EVENT_CELL_VALUE_CHANGED, function (event) { return _this.callColumnCellValueChangedHandler(event); }, this.gridOptionsWrapper.useAsyncEvents());
43195 };
43196 ValueService.prototype.getValue = function (column, rowNode, forFilter, ignoreAggData) {
43197 if (forFilter === void 0) { forFilter = false; }
43198 if (ignoreAggData === void 0) { ignoreAggData = false; }
43199 // hack - the grid is getting refreshed before this bean gets initialised, race condition.
43200 // really should have a way so they get initialised in the right order???
43201 if (!this.initialised) {
43202 this.init();
43203 }
43204 if (!rowNode) {
43205 return;
43206 }
43207 // pull these out to make code below easier to read
43208 var colDef = column.getColDef();
43209 var field = colDef.field;
43210 var colId = column.getId();
43211 var data = rowNode.data;
43212 var result;
43213 // if there is a value getter, this gets precedence over a field
43214 var groupDataExists = rowNode.groupData && rowNode.groupData[colId] !== undefined;
43215 var aggDataExists = !ignoreAggData && rowNode.aggData && rowNode.aggData[colId] !== undefined;
43216 if (forFilter && colDef.filterValueGetter) {
43217 result = this.executeFilterValueGetter(colDef.filterValueGetter, data, column, rowNode);
43218 }
43219 else if (this.gridOptionsWrapper.isTreeData() && aggDataExists) {
43220 result = rowNode.aggData[colId];
43221 }
43222 else if (this.gridOptionsWrapper.isTreeData() && colDef.valueGetter) {
43223 result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);
43224 }
43225 else if (this.gridOptionsWrapper.isTreeData() && (field && data)) {
43226 result = getValueUsingField(data, field, column.isFieldContainsDots());
43227 }
43228 else if (groupDataExists) {
43229 result = rowNode.groupData[colId];
43230 }
43231 else if (aggDataExists) {
43232 result = rowNode.aggData[colId];
43233 }
43234 else if (colDef.valueGetter) {
43235 result = this.executeValueGetter(colDef.valueGetter, data, column, rowNode);
43236 }
43237 else if (field && data) {
43238 result = getValueUsingField(data, field, column.isFieldContainsDots());
43239 }
43240 // the result could be an expression itself, if we are allowing cell values to be expressions
43241 if (this.cellExpressions && (typeof result === 'string') && result.indexOf('=') === 0) {
43242 var cellValueGetter = result.substring(1);
43243 result = this.executeValueGetter(cellValueGetter, data, column, rowNode);
43244 }
43245 if (result == null) {
43246 var openedGroup = this.getOpenedGroup(rowNode, column);
43247 if (openedGroup != null) {
43248 return openedGroup;
43249 }
43250 }
43251 return result;
43252 };
43253 ValueService.prototype.getOpenedGroup = function (rowNode, column) {
43254 if (!this.gridOptionsWrapper.isShowOpenedGroup()) {
43255 return;
43256 }
43257 var colDef = column.getColDef();
43258 if (!colDef.showRowGroup) {
43259 return;
43260 }
43261 var showRowGroup = column.getColDef().showRowGroup;
43262 var pointer = rowNode.parent;
43263 while (pointer != null) {
43264 if (pointer.rowGroupColumn && (showRowGroup === true || showRowGroup === pointer.rowGroupColumn.getId())) {
43265 return pointer.key;
43266 }
43267 pointer = pointer.parent;
43268 }
43269 return undefined;
43270 };
43271 /**
43272 * Sets the value of a GridCell
43273 * @param rowNode The `RowNode` to be updated
43274 * @param colKey The `Column` to be updated
43275 * @param newValue The new value to be set
43276 * @param eventSource The event source
43277 * @returns `True` if the value has been updated, otherwise`False`.
43278 */
43279 ValueService.prototype.setValue = function (rowNode, colKey, newValue, eventSource) {
43280 var column = this.columnModel.getPrimaryColumn(colKey);
43281 if (!rowNode || !column) {
43282 return false;
43283 }
43284 // this will only happen if user is trying to paste into a group row, which doesn't make sense
43285 // the user should not be trying to paste into group rows
43286 if (missing(rowNode.data)) {
43287 rowNode.data = {};
43288 }
43289 // for backwards compatibility we are also retrieving the newValueHandler as well as the valueSetter
43290 var _a = column.getColDef(), field = _a.field, newValueHandler = _a.newValueHandler, valueSetter = _a.valueSetter;
43291 // need either a field or a newValueHandler for this to work
43292 if (missing(field) && missing(newValueHandler) && missing(valueSetter)) {
43293 // we don't tell user about newValueHandler, as that is deprecated
43294 console.warn("AG Grid: you need either field or valueSetter set on colDef for editing to work");
43295 return false;
43296 }
43297 var params = {
43298 node: rowNode,
43299 data: rowNode.data,
43300 oldValue: this.getValue(column, rowNode),
43301 newValue: newValue,
43302 colDef: column.getColDef(),
43303 column: column,
43304 api: this.gridOptionsWrapper.getApi(),
43305 columnApi: this.gridOptionsWrapper.getColumnApi(),
43306 context: this.gridOptionsWrapper.getContext()
43307 };
43308 params.newValue = newValue;
43309 var valueWasDifferent;
43310 if (newValueHandler && exists(newValueHandler)) {
43311 valueWasDifferent = newValueHandler(params);
43312 }
43313 else if (exists(valueSetter)) {
43314 valueWasDifferent = this.expressionService.evaluate(valueSetter, params);
43315 }
43316 else {
43317 valueWasDifferent = this.setValueUsingField(rowNode.data, field, newValue, column.isFieldContainsDots());
43318 }
43319 // in case user forgot to return something (possible if they are not using TypeScript
43320 // and just forgot, or using an old newValueHandler we didn't always expect a return
43321 // value here), we default the return value to true, so we always refresh.
43322 if (valueWasDifferent === undefined) {
43323 valueWasDifferent = true;
43324 }
43325 // if no change to the value, then no need to do the updating, or notifying via events.
43326 // otherwise the user could be tabbing around the grid, and cellValueChange would get called
43327 // all the time.
43328 if (!valueWasDifferent) {
43329 return false;
43330 }
43331 // reset quick filter on this row
43332 rowNode.resetQuickFilterAggregateText();
43333 this.valueCache.onDataChanged();
43334 params.newValue = this.getValue(column, rowNode);
43335 var event = {
43336 type: Events.EVENT_CELL_VALUE_CHANGED,
43337 event: null,
43338 rowIndex: rowNode.rowIndex,
43339 rowPinned: rowNode.rowPinned,
43340 column: params.column,
43341 api: params.api,
43342 columnApi: params.columnApi,
43343 colDef: params.colDef,
43344 context: params.context,
43345 data: rowNode.data,
43346 node: rowNode,
43347 oldValue: params.oldValue,
43348 newValue: params.newValue,
43349 value: params.newValue,
43350 source: eventSource
43351 };
43352 this.eventService.dispatchEvent(event);
43353 return true;
43354 };
43355 ValueService.prototype.callColumnCellValueChangedHandler = function (event) {
43356 var onCellValueChanged = event.colDef.onCellValueChanged;
43357 if (typeof onCellValueChanged === 'function') {
43358 onCellValueChanged({
43359 node: event.node,
43360 data: event.data,
43361 oldValue: event.oldValue,
43362 newValue: event.newValue,
43363 colDef: event.colDef,
43364 column: event.column,
43365 api: event.api,
43366 columnApi: event.columnApi,
43367 context: event.context
43368 });
43369 }
43370 };
43371 ValueService.prototype.setValueUsingField = function (data, field, newValue, isFieldContainsDots) {
43372 if (!field) {
43373 return false;
43374 }
43375 // if no '.', then it's not a deep value
43376 var valuesAreSame = false;
43377 if (!isFieldContainsDots) {
43378 data[field] = newValue;
43379 }
43380 else {
43381 // otherwise it is a deep value, so need to dig for it
43382 var fieldPieces = field.split('.');
43383 var currentObject = data;
43384 while (fieldPieces.length > 0 && currentObject) {
43385 var fieldPiece = fieldPieces.shift();
43386 if (fieldPieces.length === 0) {
43387 currentObject[fieldPiece] = newValue;
43388 }
43389 else {
43390 currentObject = currentObject[fieldPiece];
43391 }
43392 }
43393 }
43394 return !valuesAreSame;
43395 };
43396 ValueService.prototype.executeFilterValueGetter = function (valueGetter, data, column, rowNode) {
43397 var params = {
43398 data: data,
43399 node: rowNode,
43400 column: column,
43401 colDef: column.getColDef(),
43402 api: this.gridOptionsWrapper.getApi(),
43403 columnApi: this.gridOptionsWrapper.getColumnApi(),
43404 context: this.gridOptionsWrapper.getContext(),
43405 getValue: this.getValueCallback.bind(this, rowNode)
43406 };
43407 return this.expressionService.evaluate(valueGetter, params);
43408 };
43409 ValueService.prototype.executeValueGetter = function (valueGetter, data, column, rowNode) {
43410 var colId = column.getId();
43411 // if inside the same turn, just return back the value we got last time
43412 var valueFromCache = this.valueCache.getValue(rowNode, colId);
43413 if (valueFromCache !== undefined) {
43414 return valueFromCache;
43415 }
43416 var params = {
43417 data: data,
43418 node: rowNode,
43419 column: column,
43420 colDef: column.getColDef(),
43421 api: this.gridOptionsWrapper.getApi(),
43422 columnApi: this.gridOptionsWrapper.getColumnApi(),
43423 context: this.gridOptionsWrapper.getContext(),
43424 getValue: this.getValueCallback.bind(this, rowNode)
43425 };
43426 var result = this.expressionService.evaluate(valueGetter, params);
43427 // if a turn is active, store the value in case the grid asks for it again
43428 this.valueCache.setValue(rowNode, colId, result);
43429 return result;
43430 };
43431 ValueService.prototype.getValueCallback = function (node, field) {
43432 var otherColumn = this.columnModel.getPrimaryColumn(field);
43433 if (otherColumn) {
43434 return this.getValue(otherColumn, node);
43435 }
43436 return null;
43437 };
43438 // used by row grouping and pivot, to get key for a row. col can be a pivot col or a row grouping col
43439 ValueService.prototype.getKeyForNode = function (col, rowNode) {
43440 var value = this.getValue(col, rowNode);
43441 var keyCreator = col.getColDef().keyCreator;
43442 var result = value;
43443 if (keyCreator) {
43444 var keyParams = {
43445 value: value,
43446 colDef: col.getColDef(),
43447 column: col,
43448 node: rowNode,
43449 data: rowNode.data,
43450 api: this.gridOptionsWrapper.getApi(),
43451 columnApi: this.gridOptionsWrapper.getColumnApi(),
43452 context: this.gridOptionsWrapper.getContext()
43453 };
43454 result = keyCreator(keyParams);
43455 }
43456 // if already a string, or missing, just return it
43457 if (typeof result === 'string' || result == null) {
43458 return result;
43459 }
43460 result = String(result);
43461 if (result === '[object Object]') {
43462 doOnce(function () {
43463 console.warn('AG Grid: a column you are grouping or pivoting by has objects as values. If you want to group by complex objects then either a) use a colDef.keyCreator (se AG Grid docs) or b) to toString() on the object to return a key');
43464 }, 'getKeyForNode - warn about [object,object]');
43465 }
43466 return result;
43467 };
43468 __decorate$1S([
43469 Autowired('expressionService')
43470 ], ValueService.prototype, "expressionService", void 0);
43471 __decorate$1S([
43472 Autowired('columnModel')
43473 ], ValueService.prototype, "columnModel", void 0);
43474 __decorate$1S([
43475 Autowired('valueCache')
43476 ], ValueService.prototype, "valueCache", void 0);
43477 __decorate$1S([
43478 PostConstruct
43479 ], ValueService.prototype, "init", null);
43480 ValueService = __decorate$1S([
43481 Bean('valueService')
43482 ], ValueService);
43483 return ValueService;
43484}(BeanStub));
43485
43486/**
43487 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
43488 * @version v27.3.0
43489 * @link https://www.ag-grid.com/
43490 * @license MIT
43491 */
43492var __extends$2c = (undefined && undefined.__extends) || (function () {
43493 var extendStatics = function (d, b) {
43494 extendStatics = Object.setPrototypeOf ||
43495 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
43496 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
43497 return extendStatics(d, b);
43498 };
43499 return function (d, b) {
43500 extendStatics(d, b);
43501 function __() { this.constructor = d; }
43502 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
43503 };
43504})();
43505var __decorate$1T = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
43506 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
43507 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
43508 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;
43509 return c > 3 && r && Object.defineProperty(target, key, r), r;
43510};
43511var __param$7 = (undefined && undefined.__param) || function (paramIndex, decorator) {
43512 return function (target, key) { decorator(target, key, paramIndex); }
43513};
43514var ExpressionService = /** @class */ (function (_super) {
43515 __extends$2c(ExpressionService, _super);
43516 function ExpressionService() {
43517 var _this = _super !== null && _super.apply(this, arguments) || this;
43518 _this.expressionToFunctionCache = {};
43519 return _this;
43520 }
43521 ExpressionService.prototype.setBeans = function (loggerFactory) {
43522 this.logger = loggerFactory.create('ExpressionService');
43523 };
43524 ExpressionService.prototype.evaluate = function (expressionOrFunc, params) {
43525 if (typeof expressionOrFunc === 'function') {
43526 // valueGetter is a function, so just call it
43527 var func = expressionOrFunc;
43528 return func(params);
43529 }
43530 else if (typeof expressionOrFunc === 'string') {
43531 // valueGetter is an expression, so execute the expression
43532 var expression = expressionOrFunc;
43533 return this.evaluateExpression(expression, params);
43534 }
43535 else {
43536 console.error('AG Grid: value should be either a string or a function', expressionOrFunc);
43537 }
43538 };
43539 ExpressionService.prototype.evaluateExpression = function (expression, params) {
43540 try {
43541 var javaScriptFunction = this.createExpressionFunction(expression);
43542 // the params don't have all these values, rather we add every possible
43543 // value a params can have, which makes whatever is in the params available.
43544 var result = javaScriptFunction(params.value, params.context, params.oldValue, params.newValue, params.value, params.node, params.data, params.colDef, params.rowIndex, params.api, params.columnApi, params.getValue, params.column, params.columnGroup);
43545 return result;
43546 }
43547 catch (e) {
43548 // the expression failed, which can happen, as it's the client that
43549 // provides the expression. so print a nice message
43550 // tslint:disable-next-line
43551 console.log('Processing of the expression failed');
43552 // tslint:disable-next-line
43553 console.log('Expression = ' + expression);
43554 // tslint:disable-next-line
43555 console.log('Params =', params);
43556 // tslint:disable-next-line
43557 console.log('Exception = ' + e);
43558 return null;
43559 }
43560 };
43561 ExpressionService.prototype.createExpressionFunction = function (expression) {
43562 // check cache first
43563 if (this.expressionToFunctionCache[expression]) {
43564 return this.expressionToFunctionCache[expression];
43565 }
43566 // if not found in cache, return the function
43567 var functionBody = this.createFunctionBody(expression);
43568 var theFunction = new Function('x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, columnApi, getValue, column, columnGroup', functionBody);
43569 // store in cache
43570 this.expressionToFunctionCache[expression] = theFunction;
43571 return theFunction;
43572 };
43573 ExpressionService.prototype.createFunctionBody = function (expression) {
43574 // if the expression has the 'return' word in it, then use as is,
43575 // if not, then wrap it with return and ';' to make a function
43576 if (expression.indexOf('return') >= 0) {
43577 return expression;
43578 }
43579 else {
43580 return 'return ' + expression + ';';
43581 }
43582 };
43583 __decorate$1T([
43584 __param$7(0, Qualifier('loggerFactory'))
43585 ], ExpressionService.prototype, "setBeans", null);
43586 ExpressionService = __decorate$1T([
43587 Bean('expressionService')
43588 ], ExpressionService);
43589 return ExpressionService;
43590}(BeanStub));
43591
43592/**
43593 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
43594 * @version v27.3.0
43595 * @link https://www.ag-grid.com/
43596 * @license MIT
43597 */
43598var __extends$2d = (undefined && undefined.__extends) || (function () {
43599 var extendStatics = function (d, b) {
43600 extendStatics = Object.setPrototypeOf ||
43601 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
43602 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
43603 return extendStatics(d, b);
43604 };
43605 return function (d, b) {
43606 extendStatics(d, b);
43607 function __() { this.constructor = d; }
43608 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
43609 };
43610})();
43611var __decorate$1U = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
43612 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
43613 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
43614 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;
43615 return c > 3 && r && Object.defineProperty(target, key, r), r;
43616};
43617var TemplateService = /** @class */ (function (_super) {
43618 __extends$2d(TemplateService, _super);
43619 function TemplateService() {
43620 var _this = _super !== null && _super.apply(this, arguments) || this;
43621 _this.templateCache = {};
43622 _this.waitingCallbacks = {};
43623 return _this;
43624 }
43625 // returns the template if it is loaded, or null if it is not loaded
43626 // but will call the callback when it is loaded
43627 TemplateService.prototype.getTemplate = function (url, callback) {
43628 var templateFromCache = this.templateCache[url];
43629 if (templateFromCache) {
43630 return templateFromCache;
43631 }
43632 var callbackList = this.waitingCallbacks[url];
43633 var that = this;
43634 if (!callbackList) {
43635 // first time this was called, so need a new list for callbacks
43636 callbackList = [];
43637 this.waitingCallbacks[url] = callbackList;
43638 // and also need to do the http request
43639 var client = new XMLHttpRequest();
43640 client.onload = function () {
43641 that.handleHttpResult(this, url);
43642 };
43643 client.open("GET", url);
43644 client.send();
43645 }
43646 // add this callback
43647 if (callback) {
43648 callbackList.push(callback);
43649 }
43650 // caller needs to wait for template to load, so return null
43651 return null;
43652 };
43653 TemplateService.prototype.handleHttpResult = function (httpResult, url) {
43654 if (httpResult.status !== 200 || httpResult.response === null) {
43655 console.warn("AG Grid: Unable to get template error " + httpResult.status + " - " + url);
43656 return;
43657 }
43658 // response success, so process it
43659 // in IE9 the response is in - responseText
43660 this.templateCache[url] = httpResult.response || httpResult.responseText;
43661 // inform all listeners that this is now in the cache
43662 var callbacks = this.waitingCallbacks[url];
43663 for (var i = 0; i < callbacks.length; i++) {
43664 var callback = callbacks[i];
43665 // we could pass the callback the response, however we know the client of this code
43666 // is the cell renderer, and it passes the 'cellRefresh' method in as the callback
43667 // which doesn't take any parameters.
43668 callback();
43669 }
43670 };
43671 TemplateService = __decorate$1U([
43672 Bean('templateService')
43673 ], TemplateService);
43674 return TemplateService;
43675}(BeanStub));
43676
43677/**
43678 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
43679 * @version v27.3.0
43680 * @link https://www.ag-grid.com/
43681 * @license MIT
43682 */
43683var __extends$2e = (undefined && undefined.__extends) || (function () {
43684 var extendStatics = function (d, b) {
43685 extendStatics = Object.setPrototypeOf ||
43686 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
43687 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
43688 return extendStatics(d, b);
43689 };
43690 return function (d, b) {
43691 extendStatics(d, b);
43692 function __() { this.constructor = d; }
43693 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
43694 };
43695})();
43696var __decorate$1V = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
43697 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
43698 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
43699 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;
43700 return c > 3 && r && Object.defineProperty(target, key, r), r;
43701};
43702var __param$8 = (undefined && undefined.__param) || function (paramIndex, decorator) {
43703 return function (target, key) { decorator(target, key, paramIndex); }
43704};
43705var LoggerFactory = /** @class */ (function (_super) {
43706 __extends$2e(LoggerFactory, _super);
43707 function LoggerFactory() {
43708 return _super !== null && _super.apply(this, arguments) || this;
43709 }
43710 LoggerFactory.prototype.setBeans = function (gridOptionsWrapper) {
43711 this.logging = gridOptionsWrapper.isDebug();
43712 };
43713 LoggerFactory.prototype.create = function (name) {
43714 return new Logger(name, this.isLogging.bind(this));
43715 };
43716 LoggerFactory.prototype.isLogging = function () {
43717 return this.logging;
43718 };
43719 __decorate$1V([
43720 __param$8(0, Qualifier('gridOptionsWrapper'))
43721 ], LoggerFactory.prototype, "setBeans", null);
43722 LoggerFactory = __decorate$1V([
43723 Bean('loggerFactory')
43724 ], LoggerFactory);
43725 return LoggerFactory;
43726}(BeanStub));
43727var Logger = /** @class */ (function () {
43728 function Logger(name, isLoggingFunc) {
43729 this.name = name;
43730 this.isLoggingFunc = isLoggingFunc;
43731 }
43732 Logger.prototype.isLogging = function () {
43733 return this.isLoggingFunc();
43734 };
43735 Logger.prototype.log = function (message) {
43736 if (this.isLoggingFunc()) {
43737 // tslint:disable-next-line
43738 console.log('AG Grid.' + this.name + ': ' + message);
43739 }
43740 };
43741 return Logger;
43742}());
43743
43744/**
43745 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
43746 * @version v27.3.0
43747 * @link https://www.ag-grid.com/
43748 * @license MIT
43749 */
43750var __extends$2f = (undefined && undefined.__extends) || (function () {
43751 var extendStatics = function (d, b) {
43752 extendStatics = Object.setPrototypeOf ||
43753 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
43754 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
43755 return extendStatics(d, b);
43756 };
43757 return function (d, b) {
43758 extendStatics(d, b);
43759 function __() { this.constructor = d; }
43760 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
43761 };
43762})();
43763var __decorate$1W = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
43764 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
43765 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
43766 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;
43767 return c > 3 && r && Object.defineProperty(target, key, r), r;
43768};
43769var GridCtrl = /** @class */ (function (_super) {
43770 __extends$2f(GridCtrl, _super);
43771 function GridCtrl() {
43772 return _super !== null && _super.apply(this, arguments) || this;
43773 }
43774 GridCtrl.prototype.setComp = function (view, eGridDiv, eGui) {
43775 var _this = this;
43776 this.view = view;
43777 this.eGridHostDiv = eGridDiv;
43778 this.eGui = eGui;
43779 this.mouseEventService.stampTopLevelGridCompWithGridInstance(eGridDiv);
43780 this.createManagedBean(new LayoutFeature(this.view));
43781 // important to set rtl before doLayout, as setting the RTL class impacts the scroll position,
43782 // which doLayout indirectly depends on
43783 this.addRtlSupport();
43784 this.addManagedListener(this, Events.EVENT_KEYBOARD_FOCUS, function () {
43785 _this.view.addOrRemoveKeyboardFocusClass(true);
43786 });
43787 this.addManagedListener(this, Events.EVENT_MOUSE_FOCUS, function () {
43788 _this.view.addOrRemoveKeyboardFocusClass(false);
43789 });
43790 var unsubscribeFromResize = this.resizeObserverService.observeResize(this.eGridHostDiv, this.onGridSizeChanged.bind(this));
43791 this.addDestroyFunc(function () { return unsubscribeFromResize(); });
43792 this.ctrlsService.registerGridCtrl(this);
43793 };
43794 GridCtrl.prototype.isDetailGrid = function () {
43795 var _a, _b;
43796 var el = this.focusService.findTabbableParent(this.getGui());
43797 return ((_b = (_a = el) === null || _a === void 0 ? void 0 : _a.getAttribute('row-id')) === null || _b === void 0 ? void 0 : _b.startsWith('detail')) || false;
43798 };
43799 GridCtrl.prototype.showDropZones = function () {
43800 return ModuleRegistry.isRegistered(exports.ModuleNames.RowGroupingModule);
43801 };
43802 GridCtrl.prototype.showSideBar = function () {
43803 return ModuleRegistry.isRegistered(exports.ModuleNames.SideBarModule);
43804 };
43805 GridCtrl.prototype.showStatusBar = function () {
43806 return ModuleRegistry.isRegistered(exports.ModuleNames.StatusBarModule);
43807 };
43808 GridCtrl.prototype.showWatermark = function () {
43809 return ModuleRegistry.isRegistered(exports.ModuleNames.EnterpriseCoreModule);
43810 };
43811 GridCtrl.prototype.onGridSizeChanged = function () {
43812 var event = {
43813 type: Events.EVENT_GRID_SIZE_CHANGED,
43814 api: this.gridApi,
43815 columnApi: this.columnApi,
43816 clientWidth: this.eGridHostDiv.clientWidth,
43817 clientHeight: this.eGridHostDiv.clientHeight
43818 };
43819 this.eventService.dispatchEvent(event);
43820 };
43821 GridCtrl.prototype.addRtlSupport = function () {
43822 var cssClass = this.gridOptionsWrapper.isEnableRtl() ? 'ag-rtl' : 'ag-ltr';
43823 this.view.setRtlClass(cssClass);
43824 };
43825 GridCtrl.prototype.destroyGridUi = function () {
43826 this.view.destroyGridUi();
43827 };
43828 GridCtrl.prototype.getGui = function () {
43829 return this.eGui;
43830 };
43831 GridCtrl.prototype.setResizeCursor = function (on) {
43832 this.view.setCursor(on ? 'ew-resize' : null);
43833 };
43834 GridCtrl.prototype.disableUserSelect = function (on) {
43835 this.view.setUserSelect(on ? 'none' : null);
43836 };
43837 GridCtrl.prototype.focusNextInnerContainer = function (backwards) {
43838 var eDocument = this.gridOptionsWrapper.getDocument();
43839 var focusableContainers = this.view.getFocusableContainers();
43840 var idxWithFocus = focusableContainers.findIndex(function (container) { return container.contains(eDocument.activeElement); });
43841 var nextIdx = idxWithFocus + (backwards ? -1 : 1);
43842 if (nextIdx <= 0 || nextIdx >= focusableContainers.length) {
43843 return false;
43844 }
43845 return this.focusService.focusInto(focusableContainers[nextIdx]);
43846 };
43847 GridCtrl.prototype.focusInnerElement = function (fromBottom) {
43848 var focusableContainers = this.view.getFocusableContainers();
43849 if (fromBottom) {
43850 if (focusableContainers.length > 1) {
43851 return this.focusService.focusInto(last(focusableContainers), true);
43852 }
43853 var lastColumn = last(this.columnModel.getAllDisplayedColumns());
43854 if (this.focusService.focusGridView(lastColumn, true)) {
43855 return true;
43856 }
43857 }
43858 return this.focusService.focusFirstHeader();
43859 };
43860 GridCtrl.prototype.forceFocusOutOfContainer = function (up) {
43861 if (up === void 0) { up = false; }
43862 this.view.forceFocusOutOfContainer(up);
43863 };
43864 __decorate$1W([
43865 Autowired('columnApi')
43866 ], GridCtrl.prototype, "columnApi", void 0);
43867 __decorate$1W([
43868 Autowired('gridApi')
43869 ], GridCtrl.prototype, "gridApi", void 0);
43870 __decorate$1W([
43871 Autowired('focusService')
43872 ], GridCtrl.prototype, "focusService", void 0);
43873 __decorate$1W([
43874 Autowired('resizeObserverService')
43875 ], GridCtrl.prototype, "resizeObserverService", void 0);
43876 __decorate$1W([
43877 Autowired('columnModel')
43878 ], GridCtrl.prototype, "columnModel", void 0);
43879 __decorate$1W([
43880 Autowired('ctrlsService')
43881 ], GridCtrl.prototype, "ctrlsService", void 0);
43882 __decorate$1W([
43883 Autowired('mouseEventService')
43884 ], GridCtrl.prototype, "mouseEventService", void 0);
43885 return GridCtrl;
43886}(BeanStub));
43887
43888/**
43889 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
43890 * @version v27.3.0
43891 * @link https://www.ag-grid.com/
43892 * @license MIT
43893 */
43894var __extends$2g = (undefined && undefined.__extends) || (function () {
43895 var extendStatics = function (d, b) {
43896 extendStatics = Object.setPrototypeOf ||
43897 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
43898 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
43899 return extendStatics(d, b);
43900 };
43901 return function (d, b) {
43902 extendStatics(d, b);
43903 function __() { this.constructor = d; }
43904 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
43905 };
43906})();
43907var __decorate$1X = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
43908 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
43909 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
43910 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;
43911 return c > 3 && r && Object.defineProperty(target, key, r), r;
43912};
43913var GridComp = /** @class */ (function (_super) {
43914 __extends$2g(GridComp, _super);
43915 function GridComp(eGridDiv) {
43916 var _this = _super.call(this, undefined) || this;
43917 _this.eGridDiv = eGridDiv;
43918 return _this;
43919 }
43920 GridComp.prototype.postConstruct = function () {
43921 var _this = this;
43922 this.logger = this.loggerFactory.create('GridComp');
43923 var compProxy = {
43924 destroyGridUi: function () { return _this.destroyBean(_this); },
43925 setRtlClass: function (cssClass) { return _this.addCssClass(cssClass); },
43926 addOrRemoveKeyboardFocusClass: function (addOrRemove) { return _this.addOrRemoveCssClass(FocusService.AG_KEYBOARD_FOCUS, addOrRemove); },
43927 forceFocusOutOfContainer: this.forceFocusOutOfContainer.bind(this),
43928 updateLayoutClasses: this.updateLayoutClasses.bind(this),
43929 getFocusableContainers: this.getFocusableContainers.bind(this),
43930 setUserSelect: function (value) {
43931 _this.getGui().style.userSelect = value != null ? value : '';
43932 _this.getGui().style.webkitUserSelect = value != null ? value : '';
43933 },
43934 setCursor: function (value) {
43935 _this.getGui().style.cursor = value != null ? value : '';
43936 }
43937 };
43938 this.ctrl = this.createManagedBean(new GridCtrl());
43939 var template = this.createTemplate();
43940 this.setTemplate(template);
43941 this.ctrl.setComp(compProxy, this.eGridDiv, this.getGui());
43942 this.insertGridIntoDom();
43943 this.initialiseTabGuard({
43944 // we want to override the default behaviour to do nothing for onTabKeyDown
43945 onTabKeyDown: function () { return undefined; },
43946 focusInnerElement: function (fromBottom) { return _this.ctrl.focusInnerElement(fromBottom); }
43947 });
43948 };
43949 GridComp.prototype.insertGridIntoDom = function () {
43950 var _this = this;
43951 var eGui = this.getGui();
43952 this.eGridDiv.appendChild(eGui);
43953 this.addDestroyFunc(function () {
43954 _this.eGridDiv.removeChild(eGui);
43955 _this.logger.log('Grid removed from DOM');
43956 });
43957 };
43958 GridComp.prototype.updateLayoutClasses = function (cssClass, params) {
43959 var eRootWrapperBodyClassList = this.eRootWrapperBody.classList;
43960 eRootWrapperBodyClassList.toggle(exports.LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
43961 eRootWrapperBodyClassList.toggle(exports.LayoutCssClasses.NORMAL, params.normal);
43962 eRootWrapperBodyClassList.toggle(exports.LayoutCssClasses.PRINT, params.print);
43963 this.addOrRemoveCssClass(exports.LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
43964 this.addOrRemoveCssClass(exports.LayoutCssClasses.NORMAL, params.normal);
43965 this.addOrRemoveCssClass(exports.LayoutCssClasses.PRINT, params.print);
43966 };
43967 GridComp.prototype.createTemplate = function () {
43968 var dropZones = this.ctrl.showDropZones() ? '<ag-grid-header-drop-zones></ag-grid-header-drop-zones>' : '';
43969 var sideBar = this.ctrl.showSideBar() ? '<ag-side-bar ref="sideBar"></ag-side-bar>' : '';
43970 var statusBar = this.ctrl.showStatusBar() ? '<ag-status-bar ref="statusBar"></ag-status-bar>' : '';
43971 var watermark = this.ctrl.showWatermark() ? '<ag-watermark></ag-watermark>' : '';
43972 var template = /* html */ "<div class=\"ag-root-wrapper\">\n " + dropZones + "\n <div class=\"ag-root-wrapper-body\" ref=\"rootWrapperBody\">\n <ag-grid-body ref=\"gridBody\"></ag-grid-body>\n " + sideBar + "\n </div>\n " + statusBar + "\n <ag-pagination></ag-pagination>\n " + watermark + "\n </div>";
43973 return template;
43974 };
43975 GridComp.prototype.getFocusableElement = function () {
43976 return this.eRootWrapperBody;
43977 };
43978 GridComp.prototype.getFocusableContainers = function () {
43979 var focusableContainers = [
43980 this.gridBodyComp.getGui()
43981 ];
43982 if (this.sideBarComp) {
43983 focusableContainers.push(this.sideBarComp.getGui());
43984 }
43985 return focusableContainers.filter(function (el) { return isVisible(el); });
43986 };
43987 __decorate$1X([
43988 Autowired('loggerFactory')
43989 ], GridComp.prototype, "loggerFactory", void 0);
43990 __decorate$1X([
43991 RefSelector('gridBody')
43992 ], GridComp.prototype, "gridBodyComp", void 0);
43993 __decorate$1X([
43994 RefSelector('sideBar')
43995 ], GridComp.prototype, "sideBarComp", void 0);
43996 __decorate$1X([
43997 RefSelector('rootWrapperBody')
43998 ], GridComp.prototype, "eRootWrapperBody", void 0);
43999 __decorate$1X([
44000 PostConstruct
44001 ], GridComp.prototype, "postConstruct", null);
44002 return GridComp;
44003}(TabGuardComp));
44004
44005/**
44006 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44007 * @version v27.3.0
44008 * @link https://www.ag-grid.com/
44009 * @license MIT
44010 */
44011var __extends$2h = (undefined && undefined.__extends) || (function () {
44012 var extendStatics = function (d, b) {
44013 extendStatics = Object.setPrototypeOf ||
44014 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44015 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44016 return extendStatics(d, b);
44017 };
44018 return function (d, b) {
44019 extendStatics(d, b);
44020 function __() { this.constructor = d; }
44021 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44022 };
44023})();
44024var __decorate$1Y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44025 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44026 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44027 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;
44028 return c > 3 && r && Object.defineProperty(target, key, r), r;
44029};
44030var SortController = /** @class */ (function (_super) {
44031 __extends$2h(SortController, _super);
44032 function SortController() {
44033 return _super !== null && _super.apply(this, arguments) || this;
44034 }
44035 SortController_1 = SortController;
44036 SortController.prototype.progressSort = function (column, multiSort, source) {
44037 var nextDirection = this.getNextSortDirection(column);
44038 this.setSortForColumn(column, nextDirection, multiSort, source);
44039 };
44040 SortController.prototype.setSortForColumn = function (column, sort, multiSort, source) {
44041 // auto correct - if sort not legal value, then set it to 'no sort' (which is null)
44042 if (sort !== Constants.SORT_ASC && sort !== Constants.SORT_DESC) {
44043 sort = null;
44044 }
44045 // update sort on current col
44046 column.setSort(sort, source);
44047 var doingMultiSort = (multiSort || this.gridOptionsWrapper.isAlwaysMultiSort()) && !this.gridOptionsWrapper.isSuppressMultiSort();
44048 // clear sort on all columns except this one, and update the icons
44049 if (!doingMultiSort) {
44050 this.clearSortBarThisColumn(column, source);
44051 }
44052 // sortIndex used for knowing order of cols when multi-col sort
44053 this.updateSortIndex(column);
44054 this.dispatchSortChangedEvents(source);
44055 };
44056 SortController.prototype.updateSortIndex = function (lastColToChange) {
44057 // update sortIndex on all sorting cols
44058 var allSortedCols = this.getColumnsWithSortingOrdered();
44059 var sortIndex = 0;
44060 allSortedCols.forEach(function (col) {
44061 if (col !== lastColToChange) {
44062 col.setSortIndex(sortIndex);
44063 sortIndex++;
44064 }
44065 });
44066 // last col to change always gets the last sort index, it's added to the end
44067 if (lastColToChange.getSort()) {
44068 lastColToChange.setSortIndex(sortIndex);
44069 }
44070 // clear sort index on all cols not sorting
44071 var allCols = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();
44072 allCols.filter(function (col) { return col.getSort() == null; }).forEach(function (col) { return col.setSortIndex(); });
44073 };
44074 // gets called by API, so if data changes, use can call this, which will end up
44075 // working out the sort order again of the rows.
44076 SortController.prototype.onSortChanged = function (source) {
44077 this.dispatchSortChangedEvents(source);
44078 };
44079 SortController.prototype.isSortActive = function () {
44080 // pull out all the columns that have sorting set
44081 var allCols = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();
44082 var sortedCols = allCols.filter(function (column) { return !!column.getSort(); });
44083 return sortedCols && sortedCols.length > 0;
44084 };
44085 SortController.prototype.dispatchSortChangedEvents = function (source) {
44086 var event = {
44087 type: Events.EVENT_SORT_CHANGED,
44088 api: this.gridApi,
44089 columnApi: this.columnApi,
44090 source: source
44091 };
44092 this.eventService.dispatchEvent(event);
44093 };
44094 SortController.prototype.clearSortBarThisColumn = function (columnToSkip, source) {
44095 this.columnModel.getPrimaryAndSecondaryAndAutoColumns().forEach(function (columnToClear) {
44096 // Do not clear if either holding shift, or if column in question was clicked
44097 if (columnToClear !== columnToSkip) {
44098 // setting to 'undefined' as null means 'none' rather than cleared, otherwise issue will arise
44099 // if sort order is: ['desc', null , 'asc'], as it will start at null rather than 'desc'.
44100 columnToClear.setSort(undefined, source);
44101 }
44102 });
44103 };
44104 SortController.prototype.getNextSortDirection = function (column) {
44105 var sortingOrder;
44106 if (column.getColDef().sortingOrder) {
44107 sortingOrder = column.getColDef().sortingOrder;
44108 }
44109 else if (this.gridOptionsWrapper.getSortingOrder()) {
44110 sortingOrder = this.gridOptionsWrapper.getSortingOrder();
44111 }
44112 else {
44113 sortingOrder = SortController_1.DEFAULT_SORTING_ORDER;
44114 }
44115 if (!Array.isArray(sortingOrder) || sortingOrder.length <= 0) {
44116 console.warn("AG Grid: sortingOrder must be an array with at least one element, currently it's " + sortingOrder);
44117 return null;
44118 }
44119 var currentIndex = sortingOrder.indexOf(column.getSort());
44120 var notInArray = currentIndex < 0;
44121 var lastItemInArray = currentIndex == sortingOrder.length - 1;
44122 var result;
44123 if (notInArray || lastItemInArray) {
44124 result = sortingOrder[0];
44125 }
44126 else {
44127 result = sortingOrder[currentIndex + 1];
44128 }
44129 // verify the sort type exists, as the user could provide the sortingOrder, need to make sure it's valid
44130 if (SortController_1.DEFAULT_SORTING_ORDER.indexOf(result) < 0) {
44131 console.warn('AG Grid: invalid sort type ' + result);
44132 return null;
44133 }
44134 return result;
44135 };
44136 SortController.prototype.getColumnsWithSortingOrdered = function () {
44137 // pull out all the columns that have sorting set
44138 var allColumnsIncludingAuto = this.columnModel.getPrimaryAndSecondaryAndAutoColumns();
44139 var columnsWithSorting = allColumnsIncludingAuto.filter(function (column) { return !!column.getSort(); });
44140 // when both cols are missing sortIndex, we use the position of the col in all cols list.
44141 // this means if colDefs only have sort, but no sortIndex, we deterministically pick which
44142 // cols is sorted by first.
44143 var allColsIndexes = {};
44144 allColumnsIncludingAuto.forEach(function (col, index) { return allColsIndexes[col.getId()] = index; });
44145 // put the columns in order of which one got sorted first
44146 columnsWithSorting.sort(function (a, b) {
44147 var iA = a.getSortIndex();
44148 var iB = b.getSortIndex();
44149 if (iA != null && iB != null) {
44150 return iA - iB; // both present, normal comparison
44151 }
44152 else if (iA == null && iB == null) {
44153 // both missing, compare using column positions
44154 var posA = allColsIndexes[a.getId()];
44155 var posB = allColsIndexes[b.getId()];
44156 return posA > posB ? 1 : -1;
44157 }
44158 else if (iB == null) {
44159 return -1; // iB missing
44160 }
44161 else {
44162 return 1; // iA missing
44163 }
44164 });
44165 return columnsWithSorting;
44166 };
44167 // used by server side row models, to sent sort to server
44168 SortController.prototype.getSortModel = function () {
44169 return this.getColumnsWithSortingOrdered().map(function (column) { return ({
44170 sort: column.getSort(),
44171 colId: column.getId()
44172 }); });
44173 };
44174 SortController.prototype.getSortOptions = function () {
44175 return this.getColumnsWithSortingOrdered().map(function (column) { return ({
44176 sort: column.getSort(),
44177 column: column
44178 }); });
44179 };
44180 var SortController_1;
44181 SortController.DEFAULT_SORTING_ORDER = [Constants.SORT_ASC, Constants.SORT_DESC, null];
44182 __decorate$1Y([
44183 Autowired('columnModel')
44184 ], SortController.prototype, "columnModel", void 0);
44185 __decorate$1Y([
44186 Autowired('columnApi')
44187 ], SortController.prototype, "columnApi", void 0);
44188 __decorate$1Y([
44189 Autowired('gridApi')
44190 ], SortController.prototype, "gridApi", void 0);
44191 SortController = SortController_1 = __decorate$1Y([
44192 Bean('sortController')
44193 ], SortController);
44194 return SortController;
44195}(BeanStub));
44196
44197/**
44198 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44199 * @version v27.3.0
44200 * @link https://www.ag-grid.com/
44201 * @license MIT
44202 */
44203var __extends$2i = (undefined && undefined.__extends) || (function () {
44204 var extendStatics = function (d, b) {
44205 extendStatics = Object.setPrototypeOf ||
44206 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44207 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44208 return extendStatics(d, b);
44209 };
44210 return function (d, b) {
44211 extendStatics(d, b);
44212 function __() { this.constructor = d; }
44213 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44214 };
44215})();
44216var __decorate$1Z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44217 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44218 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44219 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;
44220 return c > 3 && r && Object.defineProperty(target, key, r), r;
44221};
44222var ColumnHoverService = /** @class */ (function (_super) {
44223 __extends$2i(ColumnHoverService, _super);
44224 function ColumnHoverService() {
44225 return _super !== null && _super.apply(this, arguments) || this;
44226 }
44227 ColumnHoverService.prototype.setMouseOver = function (columns) {
44228 this.selectedColumns = columns;
44229 var event = {
44230 type: Events.EVENT_COLUMN_HOVER_CHANGED,
44231 api: this.gridApi,
44232 columnApi: this.columnApi
44233 };
44234 this.eventService.dispatchEvent(event);
44235 };
44236 ColumnHoverService.prototype.clearMouseOver = function () {
44237 this.selectedColumns = null;
44238 var event = {
44239 type: Events.EVENT_COLUMN_HOVER_CHANGED,
44240 api: this.gridApi,
44241 columnApi: this.columnApi
44242 };
44243 this.eventService.dispatchEvent(event);
44244 };
44245 ColumnHoverService.prototype.isHovered = function (column) {
44246 return !!this.selectedColumns && this.selectedColumns.indexOf(column) >= 0;
44247 };
44248 __decorate$1Z([
44249 Autowired('columnApi')
44250 ], ColumnHoverService.prototype, "columnApi", void 0);
44251 __decorate$1Z([
44252 Autowired('gridApi')
44253 ], ColumnHoverService.prototype, "gridApi", void 0);
44254 ColumnHoverService = __decorate$1Z([
44255 Bean('columnHoverService')
44256 ], ColumnHoverService);
44257 return ColumnHoverService;
44258}(BeanStub));
44259
44260/**
44261 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44262 * @version v27.3.0
44263 * @link https://www.ag-grid.com/
44264 * @license MIT
44265 */
44266var __extends$2j = (undefined && undefined.__extends) || (function () {
44267 var extendStatics = function (d, b) {
44268 extendStatics = Object.setPrototypeOf ||
44269 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44270 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44271 return extendStatics(d, b);
44272 };
44273 return function (d, b) {
44274 extendStatics(d, b);
44275 function __() { this.constructor = d; }
44276 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44277 };
44278})();
44279var __decorate$1_ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44280 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44281 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44282 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;
44283 return c > 3 && r && Object.defineProperty(target, key, r), r;
44284};
44285var ColumnAnimationService = /** @class */ (function (_super) {
44286 __extends$2j(ColumnAnimationService, _super);
44287 function ColumnAnimationService() {
44288 var _this = _super !== null && _super.apply(this, arguments) || this;
44289 _this.executeNextFuncs = [];
44290 _this.executeLaterFuncs = [];
44291 _this.active = false;
44292 _this.animationThreadCount = 0;
44293 return _this;
44294 }
44295 ColumnAnimationService.prototype.postConstruct = function () {
44296 var _this = this;
44297 this.ctrlsService.whenReady(function (p) { return _this.gridBodyCtrl = p.gridBodyCtrl; });
44298 };
44299 ColumnAnimationService.prototype.isActive = function () {
44300 return this.active;
44301 };
44302 ColumnAnimationService.prototype.start = function () {
44303 if (this.active) {
44304 return;
44305 }
44306 if (this.gridOptionsWrapper.isSuppressColumnMoveAnimation()) {
44307 return;
44308 }
44309 // if doing RTL, we don't animate open / close as due to how the pixels are inverted,
44310 // the animation moves all the row the the right rather than to the left (ie it's the static
44311 // columns that actually get their coordinates updated)
44312 if (this.gridOptionsWrapper.isEnableRtl()) {
44313 return;
44314 }
44315 this.ensureAnimationCssClassPresent();
44316 this.active = true;
44317 };
44318 ColumnAnimationService.prototype.finish = function () {
44319 if (!this.active) {
44320 return;
44321 }
44322 this.flush();
44323 this.active = false;
44324 };
44325 ColumnAnimationService.prototype.executeNextVMTurn = function (func) {
44326 if (this.active) {
44327 this.executeNextFuncs.push(func);
44328 }
44329 else {
44330 func();
44331 }
44332 };
44333 ColumnAnimationService.prototype.executeLaterVMTurn = function (func) {
44334 if (this.active) {
44335 this.executeLaterFuncs.push(func);
44336 }
44337 else {
44338 func();
44339 }
44340 };
44341 ColumnAnimationService.prototype.ensureAnimationCssClassPresent = function () {
44342 var _this = this;
44343 // up the count, so we can tell if someone else has updated the count
44344 // by the time the 'wait' func executes
44345 this.animationThreadCount++;
44346 var animationThreadCountCopy = this.animationThreadCount;
44347 this.gridBodyCtrl.setColumnMovingCss(true);
44348 this.executeLaterFuncs.push(function () {
44349 // only remove the class if this thread was the last one to update it
44350 if (_this.animationThreadCount === animationThreadCountCopy) {
44351 _this.gridBodyCtrl.setColumnMovingCss(false);
44352 }
44353 });
44354 };
44355 ColumnAnimationService.prototype.flush = function () {
44356 var nowFuncs = this.executeNextFuncs;
44357 this.executeNextFuncs = [];
44358 var waitFuncs = this.executeLaterFuncs;
44359 this.executeLaterFuncs = [];
44360 if (nowFuncs.length === 0 && waitFuncs.length === 0) {
44361 return;
44362 }
44363 window.setTimeout(function () { return nowFuncs.forEach(function (func) { return func(); }); }, 0);
44364 window.setTimeout(function () { return waitFuncs.forEach(function (func) { return func(); }); }, 300);
44365 };
44366 __decorate$1_([
44367 Autowired('ctrlsService')
44368 ], ColumnAnimationService.prototype, "ctrlsService", void 0);
44369 __decorate$1_([
44370 PostConstruct
44371 ], ColumnAnimationService.prototype, "postConstruct", null);
44372 ColumnAnimationService = __decorate$1_([
44373 Bean('columnAnimationService')
44374 ], ColumnAnimationService);
44375 return ColumnAnimationService;
44376}(BeanStub));
44377
44378/**
44379 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44380 * @version v27.3.0
44381 * @link https://www.ag-grid.com/
44382 * @license MIT
44383 */
44384var __extends$2k = (undefined && undefined.__extends) || (function () {
44385 var extendStatics = function (d, b) {
44386 extendStatics = Object.setPrototypeOf ||
44387 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44388 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44389 return extendStatics(d, b);
44390 };
44391 return function (d, b) {
44392 extendStatics(d, b);
44393 function __() { this.constructor = d; }
44394 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44395 };
44396})();
44397var __decorate$1$ = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44398 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44399 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44400 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;
44401 return c > 3 && r && Object.defineProperty(target, key, r), r;
44402};
44403var AutoGroupColService = /** @class */ (function (_super) {
44404 __extends$2k(AutoGroupColService, _super);
44405 function AutoGroupColService() {
44406 return _super !== null && _super.apply(this, arguments) || this;
44407 }
44408 AutoGroupColService_1 = AutoGroupColService;
44409 AutoGroupColService.prototype.createAutoGroupColumns = function (existingCols, rowGroupColumns) {
44410 var _this = this;
44411 var groupAutoColumns = [];
44412 var doingTreeData = this.gridOptionsWrapper.isTreeData();
44413 var doingMultiAutoColumn = this.gridOptionsWrapper.isGroupMultiAutoColumn();
44414 if (doingTreeData && doingMultiAutoColumn) {
44415 console.warn('AG Grid: you cannot mix groupMultiAutoColumn with treeData, only one column can be used to display groups when doing tree data');
44416 doingMultiAutoColumn = false;
44417 }
44418 // if doing groupMultiAutoColumn, then we call the method multiple times, once
44419 // for each column we are grouping by
44420 if (doingMultiAutoColumn) {
44421 rowGroupColumns.forEach(function (rowGroupCol, index) {
44422 groupAutoColumns.push(_this.createOneAutoGroupColumn(existingCols, rowGroupCol, index));
44423 });
44424 }
44425 else {
44426 groupAutoColumns.push(this.createOneAutoGroupColumn(existingCols));
44427 }
44428 return groupAutoColumns;
44429 };
44430 // rowGroupCol and index are missing if groupMultiAutoColumn=false
44431 AutoGroupColService.prototype.createOneAutoGroupColumn = function (existingCols, rowGroupCol, index) {
44432 // if one provided by user, use it, otherwise create one
44433 var defaultAutoColDef = this.generateDefaultColDef(rowGroupCol);
44434 // if doing multi, set the field
44435 var colId;
44436 if (rowGroupCol) {
44437 colId = Constants.GROUP_AUTO_COLUMN_ID + "-" + rowGroupCol.getId();
44438 }
44439 else {
44440 colId = AutoGroupColService_1.GROUP_AUTO_COLUMN_BUNDLE_ID;
44441 }
44442 var userAutoColDef = this.gridOptionsWrapper.getAutoGroupColumnDef();
44443 mergeDeep(defaultAutoColDef, userAutoColDef);
44444 defaultAutoColDef = this.columnFactory.mergeColDefs(defaultAutoColDef);
44445 defaultAutoColDef.colId = colId;
44446 // For tree data the filter is always allowed
44447 if (!this.gridOptionsWrapper.isTreeData()) {
44448 // we would only allow filter if the user has provided field or value getter. otherwise the filter
44449 // would not be able to work.
44450 var noFieldOrValueGetter = missing(defaultAutoColDef.field) && missing(defaultAutoColDef.valueGetter) && missing(defaultAutoColDef.filterValueGetter);
44451 if (noFieldOrValueGetter) {
44452 defaultAutoColDef.filter = false;
44453 }
44454 }
44455 // if showing many cols, we don't want to show more than one with a checkbox for selection
44456 if (index && index > 0) {
44457 defaultAutoColDef.headerCheckboxSelection = false;
44458 }
44459 var existingCol = existingCols.find(function (col) { return col.getId() == colId; });
44460 if (existingCol) {
44461 existingCol.setColDef(defaultAutoColDef, null);
44462 this.columnFactory.applyColumnState(existingCol, defaultAutoColDef);
44463 return existingCol;
44464 }
44465 var newCol = new Column(defaultAutoColDef, null, colId, true);
44466 this.context.createBean(newCol);
44467 return newCol;
44468 };
44469 AutoGroupColService.prototype.generateDefaultColDef = function (rowGroupCol) {
44470 var userDef = this.gridOptionsWrapper.getAutoGroupColumnDef();
44471 var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
44472 var res = {
44473 headerName: localeTextFunc('group', 'Group')
44474 };
44475 var userHasProvidedGroupCellRenderer = userDef &&
44476 (userDef.cellRenderer || userDef.cellRendererFramework || userDef.cellRendererSelector);
44477 // only add the default group cell renderer if user hasn't provided one
44478 if (!userHasProvidedGroupCellRenderer) {
44479 res.cellRenderer = 'agGroupCellRenderer';
44480 }
44481 // we never allow moving the group column
44482 // defaultAutoColDef.suppressMovable = true;
44483 if (rowGroupCol) {
44484 var colDef = rowGroupCol.getColDef();
44485 Object.assign(res, {
44486 // cellRendererParams.groupKey: colDefToCopy.field;
44487 headerName: this.columnModel.getDisplayNameForColumn(rowGroupCol, 'header'),
44488 headerValueGetter: colDef.headerValueGetter
44489 });
44490 if (colDef.cellRenderer || colDef.cellRendererFramework) {
44491 Object.assign(res, {
44492 cellRendererParams: {
44493 innerRenderer: colDef.cellRenderer,
44494 innerRendererFramework: colDef.cellRendererFramework,
44495 innerRendererParams: colDef.cellRendererParams
44496 }
44497 });
44498 }
44499 res.showRowGroup = rowGroupCol.getColId();
44500 }
44501 else {
44502 res.showRowGroup = true;
44503 }
44504 return res;
44505 };
44506 var AutoGroupColService_1;
44507 AutoGroupColService.GROUP_AUTO_COLUMN_BUNDLE_ID = Constants.GROUP_AUTO_COLUMN_ID;
44508 __decorate$1$([
44509 Autowired('columnModel')
44510 ], AutoGroupColService.prototype, "columnModel", void 0);
44511 __decorate$1$([
44512 Autowired('columnFactory')
44513 ], AutoGroupColService.prototype, "columnFactory", void 0);
44514 AutoGroupColService = AutoGroupColService_1 = __decorate$1$([
44515 Bean('autoGroupColService')
44516 ], AutoGroupColService);
44517 return AutoGroupColService;
44518}(BeanStub));
44519
44520/**
44521 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44522 * @version v27.3.0
44523 * @link https://www.ag-grid.com/
44524 * @license MIT
44525 */
44526var __extends$2l = (undefined && undefined.__extends) || (function () {
44527 var extendStatics = function (d, b) {
44528 extendStatics = Object.setPrototypeOf ||
44529 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44530 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44531 return extendStatics(d, b);
44532 };
44533 return function (d, b) {
44534 extendStatics(d, b);
44535 function __() { this.constructor = d; }
44536 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44537 };
44538})();
44539var __decorate$20 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44540 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44541 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44542 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;
44543 return c > 3 && r && Object.defineProperty(target, key, r), r;
44544};
44545var PaginationAutoPageSizeService = /** @class */ (function (_super) {
44546 __extends$2l(PaginationAutoPageSizeService, _super);
44547 function PaginationAutoPageSizeService() {
44548 return _super !== null && _super.apply(this, arguments) || this;
44549 }
44550 PaginationAutoPageSizeService.prototype.postConstruct = function () {
44551 var _this = this;
44552 this.ctrlsService.whenReady(function (p) {
44553 _this.centerRowContainerCon = p.centerRowContainerCtrl;
44554 _this.addManagedListener(_this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, _this.onBodyHeightChanged.bind(_this));
44555 _this.addManagedListener(_this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, _this.onScrollVisibilityChanged.bind(_this));
44556 _this.checkPageSize();
44557 });
44558 };
44559 PaginationAutoPageSizeService.prototype.notActive = function () {
44560 return !this.gridOptionsWrapper.isPaginationAutoPageSize();
44561 };
44562 PaginationAutoPageSizeService.prototype.onScrollVisibilityChanged = function () {
44563 this.checkPageSize();
44564 };
44565 PaginationAutoPageSizeService.prototype.onBodyHeightChanged = function () {
44566 this.checkPageSize();
44567 };
44568 PaginationAutoPageSizeService.prototype.checkPageSize = function () {
44569 if (this.notActive()) {
44570 return;
44571 }
44572 var rowHeight = this.gridOptionsWrapper.getRowHeightAsNumber();
44573 var bodyHeight = this.centerRowContainerCon.getViewportSizeFeature().getBodyHeight();
44574 if (bodyHeight > 0) {
44575 var newPageSize = Math.floor(bodyHeight / rowHeight);
44576 this.gridOptionsWrapper.setProperty('paginationPageSize', newPageSize);
44577 }
44578 };
44579 __decorate$20([
44580 Autowired('ctrlsService')
44581 ], PaginationAutoPageSizeService.prototype, "ctrlsService", void 0);
44582 __decorate$20([
44583 PostConstruct
44584 ], PaginationAutoPageSizeService.prototype, "postConstruct", null);
44585 PaginationAutoPageSizeService = __decorate$20([
44586 Bean('paginationAutoPageSizeService')
44587 ], PaginationAutoPageSizeService);
44588 return PaginationAutoPageSizeService;
44589}(BeanStub));
44590
44591/**
44592 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44593 * @version v27.3.0
44594 * @link https://www.ag-grid.com/
44595 * @license MIT
44596 */
44597var __extends$2m = (undefined && undefined.__extends) || (function () {
44598 var extendStatics = function (d, b) {
44599 extendStatics = Object.setPrototypeOf ||
44600 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44601 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44602 return extendStatics(d, b);
44603 };
44604 return function (d, b) {
44605 extendStatics(d, b);
44606 function __() { this.constructor = d; }
44607 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44608 };
44609})();
44610var __decorate$21 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44611 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44612 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44613 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;
44614 return c > 3 && r && Object.defineProperty(target, key, r), r;
44615};
44616var ValueCache = /** @class */ (function (_super) {
44617 __extends$2m(ValueCache, _super);
44618 function ValueCache() {
44619 var _this = _super !== null && _super.apply(this, arguments) || this;
44620 _this.cacheVersion = 0;
44621 return _this;
44622 }
44623 ValueCache.prototype.init = function () {
44624 this.active = this.gridOptionsWrapper.isValueCache();
44625 this.neverExpires = this.gridOptionsWrapper.isValueCacheNeverExpires();
44626 };
44627 ValueCache.prototype.onDataChanged = function () {
44628 if (this.neverExpires) {
44629 return;
44630 }
44631 this.expire();
44632 };
44633 ValueCache.prototype.expire = function () {
44634 this.cacheVersion++;
44635 };
44636 ValueCache.prototype.setValue = function (rowNode, colId, value) {
44637 if (this.active) {
44638 if (rowNode.__cacheVersion !== this.cacheVersion) {
44639 rowNode.__cacheVersion = this.cacheVersion;
44640 rowNode.__cacheData = {};
44641 }
44642 rowNode.__cacheData[colId] = value;
44643 }
44644 };
44645 ValueCache.prototype.getValue = function (rowNode, colId) {
44646 if (!this.active || rowNode.__cacheVersion !== this.cacheVersion) {
44647 return undefined;
44648 }
44649 return rowNode.__cacheData[colId];
44650 };
44651 __decorate$21([
44652 PostConstruct
44653 ], ValueCache.prototype, "init", null);
44654 ValueCache = __decorate$21([
44655 Bean('valueCache')
44656 ], ValueCache);
44657 return ValueCache;
44658}(BeanStub));
44659
44660/**
44661 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44662 * @version v27.3.0
44663 * @link https://www.ag-grid.com/
44664 * @license MIT
44665 */
44666var __extends$2n = (undefined && undefined.__extends) || (function () {
44667 var extendStatics = function (d, b) {
44668 extendStatics = Object.setPrototypeOf ||
44669 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44670 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44671 return extendStatics(d, b);
44672 };
44673 return function (d, b) {
44674 extendStatics(d, b);
44675 function __() { this.constructor = d; }
44676 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44677 };
44678})();
44679var __decorate$22 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44680 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44681 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44682 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;
44683 return c > 3 && r && Object.defineProperty(target, key, r), r;
44684};
44685var ChangeDetectionService = /** @class */ (function (_super) {
44686 __extends$2n(ChangeDetectionService, _super);
44687 function ChangeDetectionService() {
44688 return _super !== null && _super.apply(this, arguments) || this;
44689 }
44690 ChangeDetectionService.prototype.init = function () {
44691 if (this.rowModel.getType() === Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
44692 this.clientSideRowModel = this.rowModel;
44693 }
44694 this.addManagedListener(this.eventService, Events.EVENT_CELL_VALUE_CHANGED, this.onCellValueChanged.bind(this));
44695 };
44696 ChangeDetectionService.prototype.onCellValueChanged = function (event) {
44697 // Clipboard service manages its own change detection, so no need to do it here.
44698 // The clipboard manages its own as otherwise this would happen once for every cell
44699 // that got updated as part of a paste operation, so e.g. if 100 cells in a paste operation,
44700 // this doChangeDetection would get called 100 times (once for each cell), instead clipboard
44701 // service executes the logic we have here once (in essence batching up all cell changes
44702 // into one change detection).
44703 if (event.source === Constants.SOURCE_PASTE) {
44704 return;
44705 }
44706 this.doChangeDetection(event.node, event.column);
44707 };
44708 ChangeDetectionService.prototype.doChangeDetection = function (rowNode, column) {
44709 if (this.gridOptionsWrapper.isSuppressChangeDetection()) {
44710 return;
44711 }
44712 // step 1 of change detection is to update the aggregated values
44713 if (this.clientSideRowModel && !rowNode.isRowPinned()) {
44714 var onlyChangedColumns = this.gridOptionsWrapper.isAggregateOnlyChangedColumns();
44715 var changedPath = new ChangedPath(onlyChangedColumns, this.clientSideRowModel.getRootNode());
44716 changedPath.addParentNode(rowNode.parent, [column]);
44717 this.clientSideRowModel.doAggregate(changedPath);
44718 }
44719 // step 2 of change detection is to refresh the cells
44720 this.rowRenderer.refreshCells();
44721 };
44722 __decorate$22([
44723 Autowired('rowModel')
44724 ], ChangeDetectionService.prototype, "rowModel", void 0);
44725 __decorate$22([
44726 Autowired('rowRenderer')
44727 ], ChangeDetectionService.prototype, "rowRenderer", void 0);
44728 __decorate$22([
44729 PostConstruct
44730 ], ChangeDetectionService.prototype, "init", null);
44731 ChangeDetectionService = __decorate$22([
44732 Bean('changeDetectionService')
44733 ], ChangeDetectionService);
44734 return ChangeDetectionService;
44735}(BeanStub));
44736
44737/**
44738 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44739 * @version v27.3.0
44740 * @link https://www.ag-grid.com/
44741 * @license MIT
44742 */
44743var __extends$2o = (undefined && undefined.__extends) || (function () {
44744 var extendStatics = function (d, b) {
44745 extendStatics = Object.setPrototypeOf ||
44746 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44747 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44748 return extendStatics(d, b);
44749 };
44750 return function (d, b) {
44751 extendStatics(d, b);
44752 function __() { this.constructor = d; }
44753 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44754 };
44755})();
44756var __decorate$23 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44757 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44758 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44759 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;
44760 return c > 3 && r && Object.defineProperty(target, key, r), r;
44761};
44762var AgComponentUtils = /** @class */ (function (_super) {
44763 __extends$2o(AgComponentUtils, _super);
44764 function AgComponentUtils() {
44765 return _super !== null && _super.apply(this, arguments) || this;
44766 }
44767 AgComponentUtils.prototype.adaptFunction = function (propertyName, jsCompFunc) {
44768 var metadata = this.componentMetadataProvider.retrieve(propertyName);
44769 if (metadata && metadata.functionAdapter) {
44770 return metadata.functionAdapter(jsCompFunc);
44771 }
44772 return null;
44773 };
44774 AgComponentUtils.prototype.adaptCellRendererFunction = function (callback) {
44775 var Adapter = /** @class */ (function () {
44776 function Adapter() {
44777 }
44778 Adapter.prototype.refresh = function (params) {
44779 return false;
44780 };
44781 Adapter.prototype.getGui = function () {
44782 return this.eGui;
44783 };
44784 Adapter.prototype.init = function (params) {
44785 var callbackResult = callback(params);
44786 var type = typeof callbackResult;
44787 if (type === 'string' || type === 'number' || type === 'boolean') {
44788 this.eGui = loadTemplate('<span>' + callbackResult + '</span>');
44789 return;
44790 }
44791 if (callbackResult == null) {
44792 this.eGui = loadTemplate('<span></span>');
44793 return;
44794 }
44795 this.eGui = callbackResult;
44796 };
44797 return Adapter;
44798 }());
44799 return Adapter;
44800 };
44801 AgComponentUtils.prototype.doesImplementIComponent = function (candidate) {
44802 if (!candidate) {
44803 return false;
44804 }
44805 return candidate.prototype && 'getGui' in candidate.prototype;
44806 };
44807 __decorate$23([
44808 Autowired("componentMetadataProvider")
44809 ], AgComponentUtils.prototype, "componentMetadataProvider", void 0);
44810 AgComponentUtils = __decorate$23([
44811 Bean("agComponentUtils")
44812 ], AgComponentUtils);
44813 return AgComponentUtils;
44814}(BeanStub));
44815
44816/**
44817 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44818 * @version v27.3.0
44819 * @link https://www.ag-grid.com/
44820 * @license MIT
44821 */
44822var __extends$2p = (undefined && undefined.__extends) || (function () {
44823 var extendStatics = function (d, b) {
44824 extendStatics = Object.setPrototypeOf ||
44825 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44826 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44827 return extendStatics(d, b);
44828 };
44829 return function (d, b) {
44830 extendStatics(d, b);
44831 function __() { this.constructor = d; }
44832 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44833 };
44834})();
44835var __decorate$24 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44836 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44837 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44838 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;
44839 return c > 3 && r && Object.defineProperty(target, key, r), r;
44840};
44841var ComponentMetadataProvider = /** @class */ (function (_super) {
44842 __extends$2p(ComponentMetadataProvider, _super);
44843 function ComponentMetadataProvider() {
44844 return _super !== null && _super.apply(this, arguments) || this;
44845 }
44846 ComponentMetadataProvider.prototype.postConstruct = function () {
44847 this.componentMetaData = {
44848 dateComponent: {
44849 mandatoryMethodList: ['getDate', 'setDate'],
44850 optionalMethodList: ['afterGuiAttached', 'setInputPlaceholder', 'setInputAriaLabel']
44851 },
44852 detailCellRenderer: {
44853 mandatoryMethodList: [],
44854 optionalMethodList: ['refresh'],
44855 functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
44856 },
44857 headerComponent: {
44858 mandatoryMethodList: [],
44859 optionalMethodList: ['refresh']
44860 },
44861 headerGroupComponent: {
44862 mandatoryMethodList: [],
44863 optionalMethodList: []
44864 },
44865 loadingCellRenderer: {
44866 mandatoryMethodList: [],
44867 optionalMethodList: []
44868 },
44869 loadingOverlayComponent: {
44870 mandatoryMethodList: [],
44871 optionalMethodList: []
44872 },
44873 noRowsOverlayComponent: {
44874 mandatoryMethodList: [],
44875 optionalMethodList: []
44876 },
44877 floatingFilterComponent: {
44878 mandatoryMethodList: ['onParentModelChanged'],
44879 optionalMethodList: ['afterGuiAttached']
44880 },
44881 floatingFilterWrapperComponent: {
44882 mandatoryMethodList: [],
44883 optionalMethodList: []
44884 },
44885 cellRenderer: {
44886 mandatoryMethodList: [],
44887 optionalMethodList: ['refresh', 'afterGuiAttached'],
44888 functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
44889 },
44890 cellEditor: {
44891 mandatoryMethodList: ['getValue'],
44892 optionalMethodList: ['isPopup', 'isCancelBeforeStart', 'isCancelAfterEnd', 'getPopupPosition', 'focusIn', 'focusOut', 'afterGuiAttached']
44893 },
44894 innerRenderer: {
44895 mandatoryMethodList: [],
44896 optionalMethodList: ['afterGuiAttached'],
44897 functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
44898 },
44899 fullWidthCellRenderer: {
44900 mandatoryMethodList: [],
44901 optionalMethodList: ['refresh', 'afterGuiAttached'],
44902 functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
44903 },
44904 pinnedRowCellRenderer: {
44905 mandatoryMethodList: [],
44906 optionalMethodList: ['refresh', 'afterGuiAttached'],
44907 functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
44908 },
44909 groupRowRenderer: {
44910 mandatoryMethodList: [],
44911 optionalMethodList: ['afterGuiAttached'],
44912 functionAdapter: this.agComponentUtils.adaptCellRendererFunction.bind(this.agComponentUtils)
44913 },
44914 filter: {
44915 mandatoryMethodList: ['isFilterActive', 'doesFilterPass', 'getModel', 'setModel'],
44916 optionalMethodList: ['afterGuiAttached', 'onNewRowsLoaded', 'getModelAsString', 'onFloatingFilterChanged']
44917 },
44918 filterComponent: {
44919 mandatoryMethodList: ['isFilterActive', 'doesFilterPass', 'getModel', 'setModel'],
44920 optionalMethodList: ['afterGuiAttached', 'onNewRowsLoaded', 'getModelAsString', 'onFloatingFilterChanged']
44921 },
44922 statusPanel: {
44923 mandatoryMethodList: [],
44924 optionalMethodList: ['afterGuiAttached'],
44925 },
44926 toolPanel: {
44927 mandatoryMethodList: [],
44928 optionalMethodList: ['refresh', 'afterGuiAttached']
44929 },
44930 tooltipComponent: {
44931 mandatoryMethodList: [],
44932 optionalMethodList: []
44933 }
44934 };
44935 };
44936 ComponentMetadataProvider.prototype.retrieve = function (name) {
44937 return this.componentMetaData[name];
44938 };
44939 __decorate$24([
44940 Autowired("agComponentUtils")
44941 ], ComponentMetadataProvider.prototype, "agComponentUtils", void 0);
44942 __decorate$24([
44943 PostConstruct
44944 ], ComponentMetadataProvider.prototype, "postConstruct", null);
44945 ComponentMetadataProvider = __decorate$24([
44946 Bean("componentMetadataProvider")
44947 ], ComponentMetadataProvider);
44948 return ComponentMetadataProvider;
44949}(BeanStub));
44950
44951/**
44952 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
44953 * @version v27.3.0
44954 * @link https://www.ag-grid.com/
44955 * @license MIT
44956 */
44957var __extends$2q = (undefined && undefined.__extends) || (function () {
44958 var extendStatics = function (d, b) {
44959 extendStatics = Object.setPrototypeOf ||
44960 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44961 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44962 return extendStatics(d, b);
44963 };
44964 return function (d, b) {
44965 extendStatics(d, b);
44966 function __() { this.constructor = d; }
44967 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44968 };
44969})();
44970var __decorate$25 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
44971 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44972 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44973 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;
44974 return c > 3 && r && Object.defineProperty(target, key, r), r;
44975};
44976var MAT_GRID_SIZE = 8;
44977var BASE_GRID_SIZE = 4;
44978var BALHAM_GRID_SIZE = 4;
44979var ALPINE_GRID_SIZE = 6;
44980var HARD_CODED_SIZES = {
44981 // this item is required for custom themes
44982 'ag-theme-custom': {
44983 headerHeight: 25,
44984 headerCellMinWidth: 24,
44985 listItemHeight: BASE_GRID_SIZE * 5,
44986 rowHeight: 25,
44987 chartMenuPanelWidth: 220
44988 },
44989 'ag-theme-material': {
44990 headerHeight: MAT_GRID_SIZE * 7,
44991 headerCellMinWidth: 48,
44992 listItemHeight: MAT_GRID_SIZE * 4,
44993 rowHeight: MAT_GRID_SIZE * 6,
44994 chartMenuPanelWidth: 240
44995 },
44996 'ag-theme-balham': {
44997 headerHeight: BALHAM_GRID_SIZE * 8,
44998 headerCellMinWidth: 24,
44999 listItemHeight: BALHAM_GRID_SIZE * 6,
45000 rowHeight: BALHAM_GRID_SIZE * 7,
45001 chartMenuPanelWidth: 220
45002 },
45003 'ag-theme-alpine': {
45004 headerHeight: ALPINE_GRID_SIZE * 8,
45005 headerCellMinWidth: 36,
45006 listItemHeight: ALPINE_GRID_SIZE * 4,
45007 rowHeight: ALPINE_GRID_SIZE * 7,
45008 chartMenuPanelWidth: 240
45009 }
45010};
45011/**
45012 * this object contains a list of Sass variables and an array
45013 * of CSS styles required to get the correct value.
45014 * eg. $virtual-item-height requires a structure, so we can get its height.
45015 * <div class="ag-theme-balham">
45016 * <div class="ag-virtual-list-container">
45017 * <div class="ag-virtual-list-item"></div>
45018 * </div>
45019 * </div>
45020 */
45021var SASS_PROPERTY_BUILDER = {
45022 headerHeight: ['ag-header-row'],
45023 headerCellMinWidth: ['ag-header-cell'],
45024 listItemHeight: ['ag-virtual-list-item'],
45025 rowHeight: ['ag-row'],
45026 chartMenuPanelWidth: ['ag-chart-docked-container']
45027};
45028var CALCULATED_SIZES = {};
45029var Environment = /** @class */ (function (_super) {
45030 __extends$2q(Environment, _super);
45031 function Environment() {
45032 return _super !== null && _super.apply(this, arguments) || this;
45033 }
45034 Environment.prototype.getSassVariable = function (theme, key) {
45035 var useTheme = 'ag-theme-' + (theme.match('material') ? 'material' : theme.match('balham') ? 'balham' : theme.match('alpine') ? 'alpine' : 'custom');
45036 var defaultValue = HARD_CODED_SIZES[useTheme][key];
45037 var calculatedValue = 0;
45038 if (!CALCULATED_SIZES[theme]) {
45039 CALCULATED_SIZES[theme] = {};
45040 }
45041 var size = CALCULATED_SIZES[theme][key];
45042 if (size != null) {
45043 return size;
45044 }
45045 if (SASS_PROPERTY_BUILDER[key]) {
45046 var classList = SASS_PROPERTY_BUILDER[key];
45047 var div = document.createElement('div');
45048 div.classList.add(theme);
45049 div.style.position = 'absolute';
45050 var el = classList.reduce(function (prevEl, currentClass) {
45051 var currentDiv = document.createElement('div');
45052 currentDiv.style.position = 'static';
45053 currentDiv.classList.add(currentClass);
45054 prevEl.appendChild(currentDiv);
45055 return currentDiv;
45056 }, div);
45057 if (document.body) {
45058 document.body.appendChild(div);
45059 var sizeName = key.toLowerCase().indexOf('height') !== -1 ? 'height' : 'width';
45060 calculatedValue = parseInt(window.getComputedStyle(el)[sizeName], 10);
45061 document.body.removeChild(div);
45062 }
45063 }
45064 CALCULATED_SIZES[theme][key] = calculatedValue || defaultValue;
45065 return CALCULATED_SIZES[theme][key];
45066 };
45067 Environment.prototype.isThemeDark = function () {
45068 var theme = this.getTheme().theme;
45069 return !!theme && theme.indexOf('dark') >= 0;
45070 };
45071 Environment.prototype.chartMenuPanelWidth = function () {
45072 var theme = this.getTheme().themeFamily;
45073 return this.getSassVariable(theme, 'chartMenuPanelWidth');
45074 };
45075 Environment.prototype.getTheme = function () {
45076 var reg = /\bag-(material|(?:theme-([\w\-]*)))\b/;
45077 var el = this.eGridDiv;
45078 var themeMatch = null;
45079 while (el) {
45080 themeMatch = reg.exec(el.className);
45081 if (!themeMatch) {
45082 el = el.parentElement || undefined;
45083 }
45084 else {
45085 break;
45086 }
45087 }
45088 if (!themeMatch) {
45089 return {};
45090 }
45091 var theme = themeMatch[0];
45092 var usingOldTheme = themeMatch[2] === undefined;
45093 if (usingOldTheme) {
45094 var newTheme_1 = theme.replace('ag-', 'ag-theme-');
45095 doOnce(function () { return console.warn("AG Grid: As of v19 old theme are no longer provided. Please replace " + theme + " with " + newTheme_1 + "."); }, 'using-old-theme');
45096 }
45097 return { theme: theme, el: el, themeFamily: theme.replace(/-dark$/, '') };
45098 };
45099 __decorate$25([
45100 Autowired('eGridDiv')
45101 ], Environment.prototype, "eGridDiv", void 0);
45102 Environment = __decorate$25([
45103 Bean('environment')
45104 ], Environment);
45105 return Environment;
45106}(BeanStub));
45107
45108/**
45109 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
45110 * @version v27.3.0
45111 * @link https://www.ag-grid.com/
45112 * @license MIT
45113 */
45114var __extends$2r = (undefined && undefined.__extends) || (function () {
45115 var extendStatics = function (d, b) {
45116 extendStatics = Object.setPrototypeOf ||
45117 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45118 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
45119 return extendStatics(d, b);
45120 };
45121 return function (d, b) {
45122 extendStatics(d, b);
45123 function __() { this.constructor = d; }
45124 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45125 };
45126})();
45127var __decorate$26 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
45128 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45129 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45130 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;
45131 return c > 3 && r && Object.defineProperty(target, key, r), r;
45132};
45133var __param$9 = (undefined && undefined.__param) || function (paramIndex, decorator) {
45134 return function (target, key) { decorator(target, key, paramIndex); }
45135};
45136/**
45137 * This class solves the 'max height' problem, where the user might want to show more data than
45138 * the max div height actually allows.
45139 */
45140var RowContainerHeightService = /** @class */ (function (_super) {
45141 __extends$2r(RowContainerHeightService, _super);
45142 function RowContainerHeightService() {
45143 var _this = _super !== null && _super.apply(this, arguments) || this;
45144 // the scrollY position
45145 _this.scrollY = 0;
45146 // how tall the body is
45147 _this.uiBodyHeight = 0;
45148 return _this;
45149 }
45150 RowContainerHeightService.prototype.agWire = function (loggerFactory) {
45151 this.logger = loggerFactory.create("RowContainerHeightService");
45152 };
45153 RowContainerHeightService.prototype.postConstruct = function () {
45154 this.addManagedListener(this.eventService, Events.EVENT_BODY_HEIGHT_CHANGED, this.updateOffset.bind(this));
45155 this.maxDivHeight = getMaxDivHeight();
45156 this.logger.log('maxDivHeight = ' + this.maxDivHeight);
45157 };
45158 RowContainerHeightService.prototype.isStretching = function () {
45159 return this.stretching;
45160 };
45161 RowContainerHeightService.prototype.getDivStretchOffset = function () {
45162 return this.divStretchOffset;
45163 };
45164 RowContainerHeightService.prototype.updateOffset = function () {
45165 if (!this.stretching) {
45166 return;
45167 }
45168 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
45169 var newScrollY = gridBodyCon.getScrollFeature().getVScrollPosition().top;
45170 var newBodyHeight = this.getUiBodyHeight();
45171 var atLeastOneChanged = newScrollY !== this.scrollY || newBodyHeight !== this.uiBodyHeight;
45172 if (atLeastOneChanged) {
45173 this.scrollY = newScrollY;
45174 this.uiBodyHeight = newBodyHeight;
45175 this.calculateOffset();
45176 }
45177 };
45178 RowContainerHeightService.prototype.calculateOffset = function () {
45179 this.setUiContainerHeight(this.maxDivHeight);
45180 this.pixelsToShave = this.modelHeight - this.uiContainerHeight;
45181 this.maxScrollY = this.uiContainerHeight - this.uiBodyHeight;
45182 var scrollPercent = this.scrollY / this.maxScrollY;
45183 var divStretchOffset = scrollPercent * this.pixelsToShave;
45184 this.logger.log("Div Stretch Offset = " + divStretchOffset + " (" + this.pixelsToShave + " * " + scrollPercent + ")");
45185 this.setDivStretchOffset(divStretchOffset);
45186 };
45187 RowContainerHeightService.prototype.setUiContainerHeight = function (height) {
45188 if (height !== this.uiContainerHeight) {
45189 this.uiContainerHeight = height;
45190 this.eventService.dispatchEvent({ type: Events.EVENT_ROW_CONTAINER_HEIGHT_CHANGED });
45191 }
45192 };
45193 RowContainerHeightService.prototype.clearOffset = function () {
45194 this.setUiContainerHeight(this.modelHeight);
45195 this.pixelsToShave = 0;
45196 this.setDivStretchOffset(0);
45197 };
45198 RowContainerHeightService.prototype.setDivStretchOffset = function (newOffset) {
45199 // because we are talking pixels, no point in confusing things with half numbers
45200 var newOffsetFloor = typeof newOffset === 'number' ? Math.floor(newOffset) : null;
45201 if (this.divStretchOffset === newOffsetFloor) {
45202 return;
45203 }
45204 this.divStretchOffset = newOffsetFloor;
45205 this.eventService.dispatchEvent({ type: Events.EVENT_HEIGHT_SCALE_CHANGED });
45206 };
45207 RowContainerHeightService.prototype.setModelHeight = function (modelHeight) {
45208 this.modelHeight = modelHeight;
45209 this.stretching = modelHeight != null // null happens when in print layout
45210 && this.maxDivHeight > 0
45211 && modelHeight > this.maxDivHeight;
45212 if (this.stretching) {
45213 this.calculateOffset();
45214 }
45215 else {
45216 this.clearOffset();
45217 }
45218 };
45219 RowContainerHeightService.prototype.getUiContainerHeight = function () {
45220 return this.uiContainerHeight;
45221 };
45222 RowContainerHeightService.prototype.getRealPixelPosition = function (modelPixel) {
45223 return modelPixel - this.divStretchOffset;
45224 };
45225 RowContainerHeightService.prototype.getUiBodyHeight = function () {
45226 var gridBodyCon = this.ctrlsService.getGridBodyCtrl();
45227 var pos = gridBodyCon.getScrollFeature().getVScrollPosition();
45228 return pos.bottom - pos.top;
45229 };
45230 RowContainerHeightService.prototype.getScrollPositionForPixel = function (rowTop) {
45231 if (this.pixelsToShave <= 0) {
45232 return rowTop;
45233 }
45234 var modelMaxScroll = this.modelHeight - this.getUiBodyHeight();
45235 var scrollPercent = rowTop / modelMaxScroll;
45236 var scrollPixel = this.maxScrollY * scrollPercent;
45237 return scrollPixel;
45238 };
45239 __decorate$26([
45240 Autowired('ctrlsService')
45241 ], RowContainerHeightService.prototype, "ctrlsService", void 0);
45242 __decorate$26([
45243 __param$9(0, Qualifier("loggerFactory"))
45244 ], RowContainerHeightService.prototype, "agWire", null);
45245 __decorate$26([
45246 PostConstruct
45247 ], RowContainerHeightService.prototype, "postConstruct", null);
45248 RowContainerHeightService = __decorate$26([
45249 Bean('rowContainerHeightService')
45250 ], RowContainerHeightService);
45251 return RowContainerHeightService;
45252}(BeanStub));
45253
45254/**
45255 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
45256 * @version v27.3.0
45257 * @link https://www.ag-grid.com/
45258 * @license MIT
45259 */
45260var __extends$2s = (undefined && undefined.__extends) || (function () {
45261 var extendStatics = function (d, b) {
45262 extendStatics = Object.setPrototypeOf ||
45263 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45264 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
45265 return extendStatics(d, b);
45266 };
45267 return function (d, b) {
45268 extendStatics(d, b);
45269 function __() { this.constructor = d; }
45270 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45271 };
45272})();
45273var __decorate$27 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
45274 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45275 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45276 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;
45277 return c > 3 && r && Object.defineProperty(target, key, r), r;
45278};
45279var SelectableService = /** @class */ (function (_super) {
45280 __extends$2s(SelectableService, _super);
45281 function SelectableService() {
45282 return _super !== null && _super.apply(this, arguments) || this;
45283 }
45284 SelectableService.prototype.init = function () {
45285 this.groupSelectsChildren = this.gridOptionsWrapper.isGroupSelectsChildren();
45286 this.isRowSelectableFunc = this.gridOptionsWrapper.getIsRowSelectableFunc();
45287 };
45288 SelectableService.prototype.updateSelectableAfterGrouping = function (rowNode) {
45289 if (this.isRowSelectableFunc) {
45290 var nextChildrenFunc = function (node) { return node.childrenAfterGroup; };
45291 this.recurseDown(rowNode.childrenAfterGroup, nextChildrenFunc);
45292 }
45293 };
45294 SelectableService.prototype.recurseDown = function (children, nextChildrenFunc) {
45295 var _this = this;
45296 if (!children) {
45297 return;
45298 }
45299 children.forEach(function (child) {
45300 if (!child.group) {
45301 return;
45302 } // only interested in groups
45303 if (child.hasChildren()) {
45304 _this.recurseDown(nextChildrenFunc(child), nextChildrenFunc);
45305 }
45306 var rowSelectable;
45307 if (_this.groupSelectsChildren) {
45308 // have this group selectable if at least one direct child is selectable
45309 var firstSelectable = (nextChildrenFunc(child) || []).find(function (rowNode) { return rowNode.selectable === true; });
45310 rowSelectable = exists(firstSelectable);
45311 }
45312 else {
45313 // directly retrieve selectable value from user callback
45314 rowSelectable = _this.isRowSelectableFunc ? _this.isRowSelectableFunc(child) : false;
45315 }
45316 child.setRowSelectable(rowSelectable);
45317 });
45318 };
45319 __decorate$27([
45320 PostConstruct
45321 ], SelectableService.prototype, "init", null);
45322 SelectableService = __decorate$27([
45323 Bean('selectableService')
45324 ], SelectableService);
45325 return SelectableService;
45326}(BeanStub));
45327
45328/**
45329 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
45330 * @version v27.3.0
45331 * @link https://www.ag-grid.com/
45332 * @license MIT
45333 */
45334var __extends$2t = (undefined && undefined.__extends) || (function () {
45335 var extendStatics = function (d, b) {
45336 extendStatics = Object.setPrototypeOf ||
45337 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45338 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
45339 return extendStatics(d, b);
45340 };
45341 return function (d, b) {
45342 extendStatics(d, b);
45343 function __() { this.constructor = d; }
45344 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45345 };
45346})();
45347var __decorate$28 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
45348 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45349 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45350 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;
45351 return c > 3 && r && Object.defineProperty(target, key, r), r;
45352};
45353var PaginationComp = /** @class */ (function (_super) {
45354 __extends$2t(PaginationComp, _super);
45355 function PaginationComp() {
45356 var _this = _super.call(this) || this;
45357 _this.previousAndFirstButtonsDisabled = false;
45358 _this.nextButtonDisabled = false;
45359 _this.lastButtonDisabled = false;
45360 return _this;
45361 }
45362 PaginationComp.prototype.postConstruct = function () {
45363 var _this = this;
45364 var isRtl = this.gridOptionsWrapper.isEnableRtl();
45365 this.setTemplate(this.getTemplate());
45366 this.btFirst.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'last' : 'first', this.gridOptionsWrapper));
45367 this.btPrevious.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'next' : 'previous', this.gridOptionsWrapper));
45368 this.btNext.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'previous' : 'next', this.gridOptionsWrapper));
45369 this.btLast.insertAdjacentElement('afterbegin', createIconNoSpan(isRtl ? 'first' : 'last', this.gridOptionsWrapper));
45370 var isPaging = this.gridOptionsWrapper.isPagination();
45371 var paginationPanelEnabled = isPaging && !this.gridOptionsWrapper.isSuppressPaginationPanel();
45372 if (!paginationPanelEnabled) {
45373 this.setDisplayed(false);
45374 return;
45375 }
45376 this.addManagedListener(this.eventService, Events.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this));
45377 [
45378 { el: this.btFirst, fn: this.onBtFirst.bind(this) },
45379 { el: this.btPrevious, fn: this.onBtPrevious.bind(this) },
45380 { el: this.btNext, fn: this.onBtNext.bind(this) },
45381 { el: this.btLast, fn: this.onBtLast.bind(this) }
45382 ].forEach(function (item) {
45383 var el = item.el, fn = item.fn;
45384 _this.addManagedListener(el, 'click', fn);
45385 _this.addManagedListener(el, 'keydown', function (e) {
45386 if (e.key === KeyCode.ENTER || e.key === KeyCode.SPACE) {
45387 e.preventDefault();
45388 fn();
45389 }
45390 });
45391 });
45392 this.onPaginationChanged();
45393 };
45394 PaginationComp.prototype.onPaginationChanged = function () {
45395 this.enableOrDisableButtons();
45396 this.updateRowLabels();
45397 this.setCurrentPageLabel();
45398 this.setTotalLabels();
45399 };
45400 PaginationComp.prototype.onBtFirst = function () {
45401 if (!this.previousAndFirstButtonsDisabled) {
45402 this.paginationProxy.goToFirstPage();
45403 }
45404 };
45405 PaginationComp.prototype.setCurrentPageLabel = function () {
45406 var pagesExist = this.paginationProxy.getTotalPages() > 0;
45407 var currentPage = this.paginationProxy.getCurrentPage();
45408 var toDisplay = pagesExist ? currentPage + 1 : 0;
45409 this.lbCurrent.innerHTML = this.formatNumber(toDisplay);
45410 };
45411 PaginationComp.prototype.formatNumber = function (value) {
45412 var userFunc = this.gridOptionsWrapper.getPaginationNumberFormatterFunc();
45413 if (userFunc) {
45414 var params = { value: value };
45415 return userFunc(params);
45416 }
45417 var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
45418 var thousandSeparator = localeTextFunc('thousandSeparator', ',');
45419 var decimalSeparator = localeTextFunc('decimalSeparator', '.');
45420 return formatNumberCommas(value, thousandSeparator, decimalSeparator);
45421 };
45422 PaginationComp.prototype.getTemplate = function () {
45423 var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
45424 var strPage = localeTextFunc('page', 'Page');
45425 var strTo = localeTextFunc('to', 'to');
45426 var strOf = localeTextFunc('of', 'of');
45427 var strFirst = localeTextFunc('firstPage', 'First Page');
45428 var strPrevious = localeTextFunc('previousPage', 'Previous Page');
45429 var strNext = localeTextFunc('nextPage', 'Next Page');
45430 var strLast = localeTextFunc('lastPage', 'Last Page');
45431 var compId = this.getCompId();
45432 return /* html */ "<div class=\"ag-paging-panel ag-unselectable\" id=\"ag-" + compId + "\">\n <span class=\"ag-paging-row-summary-panel\" role=\"status\">\n <span id=\"ag-" + compId + "-first-row\" ref=\"lbFirstRowOnPage\" class=\"ag-paging-row-summary-panel-number\"></span>\n <span id=\"ag-" + compId + "-to\">" + strTo + "</span>\n <span id=\"ag-" + compId + "-last-row\" ref=\"lbLastRowOnPage\" class=\"ag-paging-row-summary-panel-number\"></span>\n <span id=\"ag-" + compId + "-of\">" + strOf + "</span>\n <span id=\"ag-" + compId + "-row-count\" ref=\"lbRecordCount\" class=\"ag-paging-row-summary-panel-number\"></span>\n </span>\n <span class=\"ag-paging-page-summary-panel\" role=\"presentation\">\n <div ref=\"btFirst\" class=\"ag-paging-button\" role=\"button\" aria-label=\"" + strFirst + "\"></div>\n <div ref=\"btPrevious\" class=\"ag-paging-button\" role=\"button\" aria-label=\"" + strPrevious + "\"></div>\n <span class=\"ag-paging-description\" role=\"status\">\n <span id=\"ag-" + compId + "-start-page\">" + strPage + "</span>\n <span id=\"ag-" + compId + "-start-page-number\" ref=\"lbCurrent\" class=\"ag-paging-number\"></span>\n <span id=\"ag-" + compId + "-of-page\">" + strOf + "</span>\n <span id=\"ag-" + compId + "-of-page-number\" ref=\"lbTotal\" class=\"ag-paging-number\"></span>\n </span>\n <div ref=\"btNext\" class=\"ag-paging-button\" role=\"button\" aria-label=\"" + strNext + "\"></div>\n <div ref=\"btLast\" class=\"ag-paging-button\" role=\"button\" aria-label=\"" + strLast + "\"></div>\n </span>\n </div>";
45433 };
45434 PaginationComp.prototype.onBtNext = function () {
45435 if (!this.nextButtonDisabled) {
45436 this.paginationProxy.goToNextPage();
45437 }
45438 };
45439 PaginationComp.prototype.onBtPrevious = function () {
45440 if (!this.previousAndFirstButtonsDisabled) {
45441 this.paginationProxy.goToPreviousPage();
45442 }
45443 };
45444 PaginationComp.prototype.onBtLast = function () {
45445 if (!this.lastButtonDisabled) {
45446 this.paginationProxy.goToLastPage();
45447 }
45448 };
45449 PaginationComp.prototype.enableOrDisableButtons = function () {
45450 var currentPage = this.paginationProxy.getCurrentPage();
45451 var maxRowFound = this.paginationProxy.isLastPageFound();
45452 var totalPages = this.paginationProxy.getTotalPages();
45453 this.previousAndFirstButtonsDisabled = currentPage === 0;
45454 this.toggleButtonDisabled(this.btFirst, this.previousAndFirstButtonsDisabled);
45455 this.toggleButtonDisabled(this.btPrevious, this.previousAndFirstButtonsDisabled);
45456 var zeroPagesToDisplay = this.isZeroPagesToDisplay();
45457 var onLastPage = maxRowFound && currentPage === (totalPages - 1);
45458 this.nextButtonDisabled = onLastPage || zeroPagesToDisplay;
45459 this.lastButtonDisabled = !maxRowFound || zeroPagesToDisplay || currentPage === (totalPages - 1);
45460 this.toggleButtonDisabled(this.btNext, this.nextButtonDisabled);
45461 this.toggleButtonDisabled(this.btLast, this.lastButtonDisabled);
45462 };
45463 PaginationComp.prototype.toggleButtonDisabled = function (button, disabled) {
45464 setAriaDisabled(button, disabled);
45465 button.classList.toggle('ag-disabled', disabled);
45466 if (disabled) {
45467 button.removeAttribute('tabindex');
45468 }
45469 else {
45470 button.setAttribute('tabindex', '0');
45471 }
45472 };
45473 PaginationComp.prototype.updateRowLabels = function () {
45474 var currentPage = this.paginationProxy.getCurrentPage();
45475 var pageSize = this.paginationProxy.getPageSize();
45476 var maxRowFound = this.paginationProxy.isLastPageFound();
45477 var rowCount = this.paginationProxy.isLastPageFound() ?
45478 this.paginationProxy.getMasterRowCount() : null;
45479 var startRow;
45480 var endRow;
45481 if (this.isZeroPagesToDisplay()) {
45482 startRow = endRow = 0;
45483 }
45484 else {
45485 startRow = (pageSize * currentPage) + 1;
45486 endRow = startRow + pageSize - 1;
45487 if (maxRowFound && endRow > rowCount) {
45488 endRow = rowCount;
45489 }
45490 }
45491 this.lbFirstRowOnPage.innerHTML = this.formatNumber(startRow);
45492 if (this.rowNodeBlockLoader.isLoading()) {
45493 this.lbLastRowOnPage.innerHTML = '?';
45494 }
45495 else {
45496 this.lbLastRowOnPage.innerHTML = this.formatNumber(endRow);
45497 }
45498 };
45499 PaginationComp.prototype.isZeroPagesToDisplay = function () {
45500 var maxRowFound = this.paginationProxy.isLastPageFound();
45501 var totalPages = this.paginationProxy.getTotalPages();
45502 return maxRowFound && totalPages === 0;
45503 };
45504 PaginationComp.prototype.setTotalLabels = function () {
45505 var lastPageFound = this.paginationProxy.isLastPageFound();
45506 var totalPages = this.paginationProxy.getTotalPages();
45507 var rowCount = lastPageFound ? this.paginationProxy.getMasterRowCount() : null;
45508 // When `pivotMode=true` and no grouping or value columns exist, a single 'hidden' group row (root node) is in
45509 // the grid and the pagination totals will correctly display total = 1. However this is confusing to users as
45510 // they can't see it. To address this UX issue we simply set the totals to zero in the pagination panel.
45511 if (rowCount === 1) {
45512 var firstRow = this.paginationProxy.getRow(0);
45513 // a group node with no group or agg data will not be visible to users
45514 var hiddenGroupRow = firstRow && firstRow.group && !(firstRow.groupData || firstRow.aggData);
45515 if (hiddenGroupRow) {
45516 this.setTotalLabelsToZero();
45517 return;
45518 }
45519 }
45520 if (lastPageFound) {
45521 this.lbTotal.innerHTML = this.formatNumber(totalPages);
45522 this.lbRecordCount.innerHTML = this.formatNumber(rowCount);
45523 }
45524 else {
45525 var moreText = this.gridOptionsWrapper.getLocaleTextFunc()('more', 'more');
45526 this.lbTotal.innerHTML = moreText;
45527 this.lbRecordCount.innerHTML = moreText;
45528 }
45529 };
45530 PaginationComp.prototype.setTotalLabelsToZero = function () {
45531 this.lbFirstRowOnPage.innerHTML = this.formatNumber(0);
45532 this.lbCurrent.innerHTML = this.formatNumber(0);
45533 this.lbLastRowOnPage.innerHTML = this.formatNumber(0);
45534 this.lbTotal.innerHTML = this.formatNumber(0);
45535 this.lbRecordCount.innerHTML = this.formatNumber(0);
45536 };
45537 __decorate$28([
45538 Autowired('paginationProxy')
45539 ], PaginationComp.prototype, "paginationProxy", void 0);
45540 __decorate$28([
45541 Autowired('rowNodeBlockLoader')
45542 ], PaginationComp.prototype, "rowNodeBlockLoader", void 0);
45543 __decorate$28([
45544 RefSelector('btFirst')
45545 ], PaginationComp.prototype, "btFirst", void 0);
45546 __decorate$28([
45547 RefSelector('btPrevious')
45548 ], PaginationComp.prototype, "btPrevious", void 0);
45549 __decorate$28([
45550 RefSelector('btNext')
45551 ], PaginationComp.prototype, "btNext", void 0);
45552 __decorate$28([
45553 RefSelector('btLast')
45554 ], PaginationComp.prototype, "btLast", void 0);
45555 __decorate$28([
45556 RefSelector('lbRecordCount')
45557 ], PaginationComp.prototype, "lbRecordCount", void 0);
45558 __decorate$28([
45559 RefSelector('lbFirstRowOnPage')
45560 ], PaginationComp.prototype, "lbFirstRowOnPage", void 0);
45561 __decorate$28([
45562 RefSelector('lbLastRowOnPage')
45563 ], PaginationComp.prototype, "lbLastRowOnPage", void 0);
45564 __decorate$28([
45565 RefSelector('lbCurrent')
45566 ], PaginationComp.prototype, "lbCurrent", void 0);
45567 __decorate$28([
45568 RefSelector('lbTotal')
45569 ], PaginationComp.prototype, "lbTotal", void 0);
45570 __decorate$28([
45571 PostConstruct
45572 ], PaginationComp.prototype, "postConstruct", null);
45573 return PaginationComp;
45574}(Component));
45575
45576/**
45577 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
45578 * @version v27.3.0
45579 * @link https://www.ag-grid.com/
45580 * @license MIT
45581 */
45582var __extends$2u = (undefined && undefined.__extends) || (function () {
45583 var extendStatics = function (d, b) {
45584 extendStatics = Object.setPrototypeOf ||
45585 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45586 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
45587 return extendStatics(d, b);
45588 };
45589 return function (d, b) {
45590 extendStatics(d, b);
45591 function __() { this.constructor = d; }
45592 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45593 };
45594})();
45595var __decorate$29 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
45596 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45597 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45598 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;
45599 return c > 3 && r && Object.defineProperty(target, key, r), r;
45600};
45601var LoadingType;
45602(function (LoadingType) {
45603 LoadingType[LoadingType["Loading"] = 0] = "Loading";
45604 LoadingType[LoadingType["NoRows"] = 1] = "NoRows";
45605})(LoadingType || (LoadingType = {}));
45606var OverlayWrapperComponent = /** @class */ (function (_super) {
45607 __extends$2u(OverlayWrapperComponent, _super);
45608 function OverlayWrapperComponent() {
45609 var _this = _super.call(this, OverlayWrapperComponent.TEMPLATE) || this;
45610 _this.inProgress = false;
45611 _this.destroyRequested = false;
45612 _this.manuallyDisplayed = false;
45613 return _this;
45614 }
45615 OverlayWrapperComponent.prototype.updateLayoutClasses = function (cssClass, params) {
45616 var overlayWrapperClassList = this.eOverlayWrapper.classList;
45617 overlayWrapperClassList.toggle(exports.LayoutCssClasses.AUTO_HEIGHT, params.autoHeight);
45618 overlayWrapperClassList.toggle(exports.LayoutCssClasses.NORMAL, params.normal);
45619 overlayWrapperClassList.toggle(exports.LayoutCssClasses.PRINT, params.print);
45620 };
45621 OverlayWrapperComponent.prototype.postConstruct = function () {
45622 this.createManagedBean(new LayoutFeature(this));
45623 this.setDisplayed(false);
45624 this.addManagedListener(this.eventService, Events.EVENT_ROW_DATA_CHANGED, this.onRowDataChanged.bind(this));
45625 this.addManagedListener(this.eventService, Events.EVENT_ROW_DATA_UPDATED, this.onRowDataChanged.bind(this));
45626 this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onNewColumnsLoaded.bind(this));
45627 if (this.gridOptionsWrapper.isRowModelDefault() && !this.gridOptionsWrapper.getRowData()) {
45628 this.showLoadingOverlay();
45629 }
45630 this.gridApi.registerOverlayWrapperComp(this);
45631 };
45632 OverlayWrapperComponent.prototype.setWrapperTypeClass = function (loadingType) {
45633 var overlayWrapperClassList = this.eOverlayWrapper.classList;
45634 overlayWrapperClassList.toggle('ag-overlay-loading-wrapper', loadingType === LoadingType.Loading);
45635 overlayWrapperClassList.toggle('ag-overlay-no-rows-wrapper', loadingType === LoadingType.NoRows);
45636 };
45637 OverlayWrapperComponent.prototype.showLoadingOverlay = function () {
45638 if (this.gridOptionsWrapper.isSuppressLoadingOverlay()) {
45639 return;
45640 }
45641 var params = {};
45642 var compDetails = this.userComponentFactory.getLoadingOverlayCompDetails(params);
45643 var promise = compDetails.newAgStackInstance();
45644 this.showOverlay(promise, LoadingType.Loading);
45645 };
45646 OverlayWrapperComponent.prototype.showNoRowsOverlay = function () {
45647 if (this.gridOptionsWrapper.isSuppressNoRowsOverlay()) {
45648 return;
45649 }
45650 var params = {};
45651 var compDetails = this.userComponentFactory.getNoRowsOverlayCompDetails(params);
45652 var promise = compDetails.newAgStackInstance();
45653 this.showOverlay(promise, LoadingType.NoRows);
45654 };
45655 OverlayWrapperComponent.prototype.showOverlay = function (workItem, type) {
45656 var _this = this;
45657 if (this.inProgress) {
45658 return;
45659 }
45660 this.setWrapperTypeClass(type);
45661 this.destroyActiveOverlay();
45662 this.inProgress = true;
45663 if (workItem) {
45664 workItem.then(function (comp) {
45665 _this.inProgress = false;
45666 _this.eOverlayWrapper.appendChild(comp.getGui());
45667 _this.activeOverlay = comp;
45668 if (_this.destroyRequested) {
45669 _this.destroyRequested = false;
45670 _this.destroyActiveOverlay();
45671 }
45672 });
45673 }
45674 this.manuallyDisplayed = this.columnModel.isReady() && !this.paginationProxy.isEmpty();
45675 this.setDisplayed(true);
45676 };
45677 OverlayWrapperComponent.prototype.destroyActiveOverlay = function () {
45678 if (this.inProgress) {
45679 this.destroyRequested = true;
45680 return;
45681 }
45682 if (!this.activeOverlay) {
45683 return;
45684 }
45685 this.activeOverlay = this.getContext().destroyBean(this.activeOverlay);
45686 clearElement(this.eOverlayWrapper);
45687 };
45688 OverlayWrapperComponent.prototype.hideOverlay = function () {
45689 this.manuallyDisplayed = false;
45690 this.destroyActiveOverlay();
45691 this.setDisplayed(false);
45692 };
45693 OverlayWrapperComponent.prototype.destroy = function () {
45694 this.destroyActiveOverlay();
45695 _super.prototype.destroy.call(this);
45696 };
45697 OverlayWrapperComponent.prototype.showOrHideOverlay = function () {
45698 var isEmpty = this.paginationProxy.isEmpty();
45699 var isSuppressNoRowsOverlay = this.gridOptionsWrapper.isSuppressNoRowsOverlay();
45700 if (isEmpty && !isSuppressNoRowsOverlay) {
45701 this.showNoRowsOverlay();
45702 }
45703 else {
45704 this.hideOverlay();
45705 }
45706 };
45707 OverlayWrapperComponent.prototype.onRowDataChanged = function () {
45708 this.showOrHideOverlay();
45709 };
45710 OverlayWrapperComponent.prototype.onNewColumnsLoaded = function () {
45711 // hide overlay if columns and rows exist, this can happen if columns are loaded after data.
45712 // this problem exists before of the race condition between the services (column controller in this case)
45713 // and the view (grid panel). if the model beans were all initialised first, and then the view beans second,
45714 // this race condition would not happen.
45715 if (this.columnModel.isReady() && !this.paginationProxy.isEmpty() && !this.manuallyDisplayed) {
45716 this.hideOverlay();
45717 }
45718 };
45719 // wrapping in outer div, and wrapper, is needed to center the loading icon
45720 // The idea for centering came from here: http://www.vanseodesign.com/css/vertical-centering/
45721 OverlayWrapperComponent.TEMPLATE = "\n <div class=\"ag-overlay\" aria-hidden=\"true\">\n <div class=\"ag-overlay-panel\">\n <div class=\"ag-overlay-wrapper\" ref=\"eOverlayWrapper\"></div>\n </div>\n </div>";
45722 __decorate$29([
45723 Autowired('userComponentFactory')
45724 ], OverlayWrapperComponent.prototype, "userComponentFactory", void 0);
45725 __decorate$29([
45726 Autowired('paginationProxy')
45727 ], OverlayWrapperComponent.prototype, "paginationProxy", void 0);
45728 __decorate$29([
45729 Autowired('gridApi')
45730 ], OverlayWrapperComponent.prototype, "gridApi", void 0);
45731 __decorate$29([
45732 Autowired('columnModel')
45733 ], OverlayWrapperComponent.prototype, "columnModel", void 0);
45734 __decorate$29([
45735 RefSelector('eOverlayWrapper')
45736 ], OverlayWrapperComponent.prototype, "eOverlayWrapper", void 0);
45737 __decorate$29([
45738 PostConstruct
45739 ], OverlayWrapperComponent.prototype, "postConstruct", null);
45740 return OverlayWrapperComponent;
45741}(Component));
45742
45743/**
45744 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
45745 * @version v27.3.0
45746 * @link https://www.ag-grid.com/
45747 * @license MIT
45748 */
45749var __extends$2v = (undefined && undefined.__extends) || (function () {
45750 var extendStatics = function (d, b) {
45751 extendStatics = Object.setPrototypeOf ||
45752 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45753 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
45754 return extendStatics(d, b);
45755 };
45756 return function (d, b) {
45757 extendStatics(d, b);
45758 function __() { this.constructor = d; }
45759 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45760 };
45761})();
45762var __decorate$2a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
45763 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45764 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45765 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;
45766 return c > 3 && r && Object.defineProperty(target, key, r), r;
45767};
45768var RowPositionUtils = /** @class */ (function (_super) {
45769 __extends$2v(RowPositionUtils, _super);
45770 function RowPositionUtils() {
45771 return _super !== null && _super.apply(this, arguments) || this;
45772 }
45773 RowPositionUtils.prototype.getFirstRow = function () {
45774 var rowIndex = 0;
45775 var rowPinned;
45776 if (this.pinnedRowModel.getPinnedTopRowCount()) {
45777 rowPinned = Constants.PINNED_TOP;
45778 }
45779 else if (this.rowModel.getRowCount()) {
45780 rowPinned = null;
45781 rowIndex = this.paginationProxy.getPageFirstRow();
45782 }
45783 else if (this.pinnedRowModel.getPinnedBottomRowCount()) {
45784 rowPinned = Constants.PINNED_BOTTOM;
45785 }
45786 return rowPinned === undefined ? null : { rowIndex: rowIndex, rowPinned: rowPinned };
45787 };
45788 RowPositionUtils.prototype.getLastRow = function () {
45789 var rowIndex;
45790 var rowPinned = null;
45791 var pinnedBottomCount = this.pinnedRowModel.getPinnedBottomRowCount();
45792 var pinnedTopCount = this.pinnedRowModel.getPinnedTopRowCount();
45793 if (pinnedBottomCount) {
45794 rowPinned = Constants.PINNED_BOTTOM;
45795 rowIndex = pinnedBottomCount - 1;
45796 }
45797 else if (this.rowModel.getRowCount()) {
45798 rowPinned = null;
45799 rowIndex = this.paginationProxy.getPageLastRow();
45800 }
45801 else if (pinnedTopCount) {
45802 rowPinned = Constants.PINNED_TOP;
45803 rowIndex = pinnedTopCount - 1;
45804 }
45805 return rowIndex === undefined ? null : { rowIndex: rowIndex, rowPinned: rowPinned };
45806 };
45807 RowPositionUtils.prototype.getRowNode = function (gridRow) {
45808 switch (gridRow.rowPinned) {
45809 case Constants.PINNED_TOP:
45810 return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
45811 case Constants.PINNED_BOTTOM:
45812 return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
45813 default:
45814 return this.rowModel.getRow(gridRow.rowIndex);
45815 }
45816 };
45817 RowPositionUtils.prototype.sameRow = function (rowA, rowB) {
45818 // if both missing
45819 if (!rowA && !rowB) {
45820 return true;
45821 }
45822 // if only one missing
45823 if ((rowA && !rowB) || (!rowA && rowB)) {
45824 return false;
45825 }
45826 // otherwise compare (use == to compare rowPinned because it can be null or undefined)
45827 return rowA.rowIndex === rowB.rowIndex && rowA.rowPinned == rowB.rowPinned;
45828 };
45829 // tests if this row selection is before the other row selection
45830 RowPositionUtils.prototype.before = function (rowA, rowB) {
45831 switch (rowA.rowPinned) {
45832 case Constants.PINNED_TOP:
45833 // we we are floating top, and other isn't, then we are always before
45834 if (rowB.rowPinned !== Constants.PINNED_TOP) {
45835 return true;
45836 }
45837 break;
45838 case Constants.PINNED_BOTTOM:
45839 // if we are floating bottom, and the other isn't, then we are never before
45840 if (rowB.rowPinned !== Constants.PINNED_BOTTOM) {
45841 return false;
45842 }
45843 break;
45844 default:
45845 // if we are not floating, but the other one is floating...
45846 if (exists(rowB.rowPinned)) {
45847 return rowB.rowPinned !== Constants.PINNED_TOP;
45848 }
45849 break;
45850 }
45851 return rowA.rowIndex < rowB.rowIndex;
45852 };
45853 __decorate$2a([
45854 Autowired('rowModel')
45855 ], RowPositionUtils.prototype, "rowModel", void 0);
45856 __decorate$2a([
45857 Autowired('pinnedRowModel')
45858 ], RowPositionUtils.prototype, "pinnedRowModel", void 0);
45859 __decorate$2a([
45860 Autowired('paginationProxy')
45861 ], RowPositionUtils.prototype, "paginationProxy", void 0);
45862 RowPositionUtils = __decorate$2a([
45863 Bean('rowPositionUtils')
45864 ], RowPositionUtils);
45865 return RowPositionUtils;
45866}(BeanStub));
45867
45868/**
45869 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
45870 * @version v27.3.0
45871 * @link https://www.ag-grid.com/
45872 * @license MIT
45873 */
45874var __extends$2w = (undefined && undefined.__extends) || (function () {
45875 var extendStatics = function (d, b) {
45876 extendStatics = Object.setPrototypeOf ||
45877 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45878 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
45879 return extendStatics(d, b);
45880 };
45881 return function (d, b) {
45882 extendStatics(d, b);
45883 function __() { this.constructor = d; }
45884 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45885 };
45886})();
45887var __decorate$2b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
45888 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45889 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45890 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;
45891 return c > 3 && r && Object.defineProperty(target, key, r), r;
45892};
45893var CellPositionUtils = /** @class */ (function (_super) {
45894 __extends$2w(CellPositionUtils, _super);
45895 function CellPositionUtils() {
45896 return _super !== null && _super.apply(this, arguments) || this;
45897 }
45898 CellPositionUtils.prototype.createId = function (cellPosition) {
45899 var rowIndex = cellPosition.rowIndex, rowPinned = cellPosition.rowPinned, column = cellPosition.column;
45900 return this.createIdFromValues(rowIndex, column, rowPinned);
45901 };
45902 CellPositionUtils.prototype.createIdFromValues = function (rowIndex, column, rowPinned) {
45903 return rowIndex + "." + (rowPinned == null ? 'null' : rowPinned) + "." + column.getId();
45904 };
45905 CellPositionUtils.prototype.equals = function (cellA, cellB) {
45906 var colsMatch = cellA.column === cellB.column;
45907 var floatingMatch = cellA.rowPinned === cellB.rowPinned;
45908 var indexMatch = cellA.rowIndex === cellB.rowIndex;
45909 return colsMatch && floatingMatch && indexMatch;
45910 };
45911 CellPositionUtils = __decorate$2b([
45912 Bean('cellPositionUtils')
45913 ], CellPositionUtils);
45914 return CellPositionUtils;
45915}(BeanStub));
45916
45917/**
45918 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
45919 * @version v27.3.0
45920 * @link https://www.ag-grid.com/
45921 * @license MIT
45922 */
45923var __extends$2x = (undefined && undefined.__extends) || (function () {
45924 var extendStatics = function (d, b) {
45925 extendStatics = Object.setPrototypeOf ||
45926 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45927 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
45928 return extendStatics(d, b);
45929 };
45930 return function (d, b) {
45931 extendStatics(d, b);
45932 function __() { this.constructor = d; }
45933 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45934 };
45935})();
45936var UndoRedoAction = /** @class */ (function () {
45937 function UndoRedoAction(cellValueChanges) {
45938 this.cellValueChanges = cellValueChanges;
45939 }
45940 return UndoRedoAction;
45941}());
45942var FillUndoRedoAction = /** @class */ (function (_super) {
45943 __extends$2x(FillUndoRedoAction, _super);
45944 function FillUndoRedoAction(cellValueChanges, initialRange, finalRange) {
45945 var _this = _super.call(this, cellValueChanges) || this;
45946 _this.initialRange = initialRange;
45947 _this.finalRange = finalRange;
45948 return _this;
45949 }
45950 return FillUndoRedoAction;
45951}(UndoRedoAction));
45952var UndoRedoStack = /** @class */ (function () {
45953 function UndoRedoStack(maxStackSize) {
45954 this.actionStack = [];
45955 this.maxStackSize = maxStackSize ? maxStackSize : UndoRedoStack.DEFAULT_STACK_SIZE;
45956 this.actionStack = new Array(this.maxStackSize);
45957 }
45958 UndoRedoStack.prototype.pop = function () {
45959 return this.actionStack.pop();
45960 };
45961 UndoRedoStack.prototype.push = function (item) {
45962 var shouldAddActions = item.cellValueChanges && item.cellValueChanges.length > 0;
45963 if (!shouldAddActions) {
45964 return;
45965 }
45966 if (this.actionStack.length === this.maxStackSize) {
45967 this.actionStack.shift();
45968 }
45969 this.actionStack.push(item);
45970 };
45971 UndoRedoStack.prototype.clear = function () {
45972 this.actionStack = [];
45973 };
45974 UndoRedoStack.prototype.getCurrentStackSize = function () {
45975 return this.actionStack.length;
45976 };
45977 UndoRedoStack.DEFAULT_STACK_SIZE = 10;
45978 return UndoRedoStack;
45979}());
45980
45981/**
45982 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
45983 * @version v27.3.0
45984 * @link https://www.ag-grid.com/
45985 * @license MIT
45986 */
45987var __extends$2y = (undefined && undefined.__extends) || (function () {
45988 var extendStatics = function (d, b) {
45989 extendStatics = Object.setPrototypeOf ||
45990 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45991 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
45992 return extendStatics(d, b);
45993 };
45994 return function (d, b) {
45995 extendStatics(d, b);
45996 function __() { this.constructor = d; }
45997 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45998 };
45999})();
46000var __decorate$2c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
46001 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46002 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
46003 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;
46004 return c > 3 && r && Object.defineProperty(target, key, r), r;
46005};
46006var UndoRedoService = /** @class */ (function (_super) {
46007 __extends$2y(UndoRedoService, _super);
46008 function UndoRedoService() {
46009 var _this = _super !== null && _super.apply(this, arguments) || this;
46010 _this.cellValueChanges = [];
46011 _this.activeCellEdit = null;
46012 _this.activeRowEdit = null;
46013 _this.isPasting = false;
46014 _this.isFilling = false;
46015 _this.onCellValueChanged = function (event) {
46016 var eventCell = { column: event.column, rowIndex: event.rowIndex, rowPinned: event.rowPinned };
46017 var isCellEditing = _this.activeCellEdit !== null && _this.cellPositionUtils.equals(_this.activeCellEdit, eventCell);
46018 var isRowEditing = _this.activeRowEdit !== null && _this.rowPositionUtils.sameRow(_this.activeRowEdit, eventCell);
46019 var shouldCaptureAction = isCellEditing || isRowEditing || _this.isPasting || _this.isFilling;
46020 if (!shouldCaptureAction) {
46021 return;
46022 }
46023 var rowPinned = event.rowPinned, rowIndex = event.rowIndex, column = event.column, oldValue = event.oldValue, value = event.value;
46024 var cellValueChange = {
46025 rowPinned: rowPinned,
46026 rowIndex: rowIndex,
46027 columnId: column.getColId(),
46028 newValue: value,
46029 oldValue: oldValue
46030 };
46031 _this.cellValueChanges.push(cellValueChange);
46032 };
46033 _this.clearStacks = function () {
46034 _this.undoStack.clear();
46035 _this.redoStack.clear();
46036 };
46037 return _this;
46038 }
46039 UndoRedoService.prototype.init = function () {
46040 if (!this.gridOptionsWrapper.isUndoRedoCellEditing()) {
46041 return;
46042 }
46043 var undoRedoLimit = this.gridOptionsWrapper.getUndoRedoCellEditingLimit();
46044 if (undoRedoLimit <= 0) {
46045 return;
46046 }
46047 this.undoStack = new UndoRedoStack(undoRedoLimit);
46048 this.redoStack = new UndoRedoStack(undoRedoLimit);
46049 this.addRowEditingListeners();
46050 this.addCellEditingListeners();
46051 this.addPasteListeners();
46052 this.addFillListeners();
46053 this.addManagedListener(this.eventService, Events.EVENT_CELL_VALUE_CHANGED, this.onCellValueChanged);
46054 // undo / redo is restricted to actual editing so we clear the stacks when other operations are
46055 // performed that change the order of the row / cols.
46056 this.addManagedListener(this.eventService, Events.EVENT_MODEL_UPDATED, this.clearStacks);
46057 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.clearStacks);
46058 this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.clearStacks);
46059 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_GROUP_OPENED, this.clearStacks);
46060 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.clearStacks);
46061 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_MOVED, this.clearStacks);
46062 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PINNED, this.clearStacks);
46063 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VISIBLE, this.clearStacks);
46064 this.addManagedListener(this.eventService, Events.EVENT_ROW_DRAG_END, this.clearStacks);
46065 };
46066 UndoRedoService.prototype.getCurrentUndoStackSize = function () {
46067 return this.undoStack ? this.undoStack.getCurrentStackSize() : 0;
46068 };
46069 UndoRedoService.prototype.getCurrentRedoStackSize = function () {
46070 return this.redoStack ? this.redoStack.getCurrentStackSize() : 0;
46071 };
46072 UndoRedoService.prototype.undo = function () {
46073 if (!this.undoStack) {
46074 return;
46075 }
46076 var undoAction = this.undoStack.pop();
46077 if (!undoAction || !undoAction.cellValueChanges) {
46078 return;
46079 }
46080 this.processAction(undoAction, function (cellValueChange) { return cellValueChange.oldValue; });
46081 if (undoAction instanceof FillUndoRedoAction) {
46082 this.processRangeAndCellFocus(undoAction.cellValueChanges, undoAction.initialRange);
46083 }
46084 else {
46085 this.processRangeAndCellFocus(undoAction.cellValueChanges);
46086 }
46087 this.redoStack.push(undoAction);
46088 };
46089 UndoRedoService.prototype.redo = function () {
46090 if (!this.redoStack) {
46091 return;
46092 }
46093 var redoAction = this.redoStack.pop();
46094 if (!redoAction || !redoAction.cellValueChanges) {
46095 return;
46096 }
46097 this.processAction(redoAction, function (cellValueChange) { return cellValueChange.newValue; });
46098 if (redoAction instanceof FillUndoRedoAction) {
46099 this.processRangeAndCellFocus(redoAction.cellValueChanges, redoAction.finalRange);
46100 }
46101 else {
46102 this.processRangeAndCellFocus(redoAction.cellValueChanges);
46103 }
46104 this.undoStack.push(redoAction);
46105 };
46106 UndoRedoService.prototype.processAction = function (action, valueExtractor) {
46107 var _this = this;
46108 action.cellValueChanges.forEach(function (cellValueChange) {
46109 var rowIndex = cellValueChange.rowIndex, rowPinned = cellValueChange.rowPinned, columnId = cellValueChange.columnId;
46110 var rowPosition = { rowIndex: rowIndex, rowPinned: rowPinned };
46111 var currentRow = _this.getRowNode(rowPosition);
46112 // checks if the row has been filtered out
46113 if (!currentRow.displayed) {
46114 return;
46115 }
46116 currentRow.setDataValue(columnId, valueExtractor(cellValueChange));
46117 });
46118 };
46119 UndoRedoService.prototype.processRangeAndCellFocus = function (cellValueChanges, range) {
46120 var lastFocusedCell;
46121 if (range) {
46122 var startRow = range.startRow;
46123 var endRow = range.endRow;
46124 lastFocusedCell = {
46125 rowPinned: startRow.rowPinned,
46126 rowIndex: startRow.rowIndex,
46127 columnId: range.startColumn.getColId()
46128 };
46129 this.setLastFocusedCell(lastFocusedCell);
46130 var cellRangeParams = {
46131 rowStartIndex: startRow.rowIndex,
46132 rowStartPinned: startRow.rowPinned,
46133 rowEndIndex: endRow.rowIndex,
46134 rowEndPinned: endRow.rowPinned,
46135 columnStart: range.startColumn,
46136 columns: range.columns
46137 };
46138 this.gridApi.addCellRange(cellRangeParams);
46139 return;
46140 }
46141 var cellValueChange = cellValueChanges[0];
46142 var rowIndex = cellValueChange.rowIndex, rowPinned = cellValueChange.rowPinned;
46143 var rowPosition = { rowIndex: rowIndex, rowPinned: rowPinned };
46144 var row = this.getRowNode(rowPosition);
46145 lastFocusedCell = {
46146 rowPinned: cellValueChange.rowPinned,
46147 rowIndex: row.rowIndex,
46148 columnId: cellValueChange.columnId
46149 };
46150 this.setLastFocusedCell(lastFocusedCell);
46151 };
46152 UndoRedoService.prototype.setLastFocusedCell = function (lastFocusedCell) {
46153 var rowIndex = lastFocusedCell.rowIndex, columnId = lastFocusedCell.columnId, rowPinned = lastFocusedCell.rowPinned;
46154 this.gridApi.ensureIndexVisible(rowIndex);
46155 this.gridApi.ensureColumnVisible(columnId);
46156 if (ModuleRegistry.isRegistered(exports.ModuleNames.RangeSelectionModule)) {
46157 this.gridApi.clearRangeSelection();
46158 }
46159 this.focusService.setFocusedCell(rowIndex, columnId, rowPinned, true);
46160 };
46161 UndoRedoService.prototype.addRowEditingListeners = function () {
46162 var _this = this;
46163 this.addManagedListener(this.eventService, Events.EVENT_ROW_EDITING_STARTED, function (e) {
46164 _this.activeRowEdit = { rowIndex: e.rowIndex, rowPinned: e.rowPinned };
46165 });
46166 this.addManagedListener(this.eventService, Events.EVENT_ROW_EDITING_STOPPED, function () {
46167 var action = new UndoRedoAction(_this.cellValueChanges);
46168 _this.pushActionsToUndoStack(action);
46169 _this.activeRowEdit = null;
46170 });
46171 };
46172 UndoRedoService.prototype.addCellEditingListeners = function () {
46173 var _this = this;
46174 this.addManagedListener(this.eventService, Events.EVENT_CELL_EDITING_STARTED, function (e) {
46175 _this.activeCellEdit = { column: e.column, rowIndex: e.rowIndex, rowPinned: e.rowPinned };
46176 });
46177 this.addManagedListener(this.eventService, Events.EVENT_CELL_EDITING_STOPPED, function () {
46178 _this.activeCellEdit = null;
46179 var shouldPushAction = !_this.activeRowEdit && !_this.isPasting && !_this.isFilling;
46180 if (shouldPushAction) {
46181 var action = new UndoRedoAction(_this.cellValueChanges);
46182 _this.pushActionsToUndoStack(action);
46183 }
46184 });
46185 };
46186 UndoRedoService.prototype.addPasteListeners = function () {
46187 var _this = this;
46188 this.addManagedListener(this.eventService, Events.EVENT_PASTE_START, function () {
46189 _this.isPasting = true;
46190 });
46191 this.addManagedListener(this.eventService, Events.EVENT_PASTE_END, function () {
46192 var action = new UndoRedoAction(_this.cellValueChanges);
46193 _this.pushActionsToUndoStack(action);
46194 _this.isPasting = false;
46195 });
46196 };
46197 UndoRedoService.prototype.addFillListeners = function () {
46198 var _this = this;
46199 this.addManagedListener(this.eventService, Events.EVENT_FILL_START, function () {
46200 _this.isFilling = true;
46201 });
46202 this.addManagedListener(this.eventService, Events.EVENT_FILL_END, function (event) {
46203 var action = new FillUndoRedoAction(_this.cellValueChanges, event.initialRange, event.finalRange);
46204 _this.pushActionsToUndoStack(action);
46205 _this.isFilling = false;
46206 });
46207 };
46208 UndoRedoService.prototype.pushActionsToUndoStack = function (action) {
46209 this.undoStack.push(action);
46210 this.cellValueChanges = [];
46211 this.redoStack.clear();
46212 };
46213 UndoRedoService.prototype.getRowNode = function (gridRow) {
46214 switch (gridRow.rowPinned) {
46215 case Constants.PINNED_TOP:
46216 return this.pinnedRowModel.getPinnedTopRowData()[gridRow.rowIndex];
46217 case Constants.PINNED_BOTTOM:
46218 return this.pinnedRowModel.getPinnedBottomRowData()[gridRow.rowIndex];
46219 default:
46220 return this.rowModel.getRow(gridRow.rowIndex);
46221 }
46222 };
46223 __decorate$2c([
46224 Autowired('focusService')
46225 ], UndoRedoService.prototype, "focusService", void 0);
46226 __decorate$2c([
46227 Autowired('gridApi')
46228 ], UndoRedoService.prototype, "gridApi", void 0);
46229 __decorate$2c([
46230 Autowired('rowModel')
46231 ], UndoRedoService.prototype, "rowModel", void 0);
46232 __decorate$2c([
46233 Autowired('pinnedRowModel')
46234 ], UndoRedoService.prototype, "pinnedRowModel", void 0);
46235 __decorate$2c([
46236 Autowired('cellPositionUtils')
46237 ], UndoRedoService.prototype, "cellPositionUtils", void 0);
46238 __decorate$2c([
46239 Autowired('rowPositionUtils')
46240 ], UndoRedoService.prototype, "rowPositionUtils", void 0);
46241 __decorate$2c([
46242 PostConstruct
46243 ], UndoRedoService.prototype, "init", null);
46244 UndoRedoService = __decorate$2c([
46245 Bean('undoRedoService')
46246 ], UndoRedoService);
46247 return UndoRedoService;
46248}(BeanStub));
46249
46250/**
46251 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
46252 * @version v27.3.0
46253 * @link https://www.ag-grid.com/
46254 * @license MIT
46255 */
46256var __extends$2z = (undefined && undefined.__extends) || (function () {
46257 var extendStatics = function (d, b) {
46258 extendStatics = Object.setPrototypeOf ||
46259 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
46260 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
46261 return extendStatics(d, b);
46262 };
46263 return function (d, b) {
46264 extendStatics(d, b);
46265 function __() { this.constructor = d; }
46266 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
46267 };
46268})();
46269var __decorate$2d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
46270 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46271 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
46272 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;
46273 return c > 3 && r && Object.defineProperty(target, key, r), r;
46274};
46275var HeaderPositionUtils = /** @class */ (function (_super) {
46276 __extends$2z(HeaderPositionUtils, _super);
46277 function HeaderPositionUtils() {
46278 return _super !== null && _super.apply(this, arguments) || this;
46279 }
46280 HeaderPositionUtils.prototype.findHeader = function (focusedHeader, direction) {
46281 var nextColumn;
46282 var getGroupMethod;
46283 var getColMethod;
46284 if (focusedHeader.column instanceof ColumnGroup) {
46285 getGroupMethod = "getDisplayedGroup" + direction;
46286 nextColumn = this.columnModel[getGroupMethod](focusedHeader.column);
46287 }
46288 else {
46289 getColMethod = "getDisplayedCol" + direction;
46290 nextColumn = this.columnModel[getColMethod](focusedHeader.column);
46291 }
46292 if (nextColumn) {
46293 return {
46294 column: nextColumn,
46295 headerRowIndex: focusedHeader.headerRowIndex
46296 };
46297 }
46298 };
46299 HeaderPositionUtils.prototype.findColAtEdgeForHeaderRow = function (level, position) {
46300 var displayedColumns = this.columnModel.getAllDisplayedColumns();
46301 var column = displayedColumns[position === 'start' ? 0 : displayedColumns.length - 1];
46302 if (!column) {
46303 return;
46304 }
46305 var childContainer = this.ctrlsService.getHeaderRowContainerCtrl(column.getPinned());
46306 var type = childContainer.getRowType(level);
46307 if (type == exports.HeaderRowType.COLUMN_GROUP) {
46308 var columnGroup = this.columnModel.getColumnGroupAtLevel(column, level);
46309 return {
46310 headerRowIndex: level,
46311 column: columnGroup
46312 };
46313 }
46314 return {
46315 // if type==null, means the header level didn't exist
46316 headerRowIndex: type == null ? -1 : level,
46317 column: column
46318 };
46319 };
46320 __decorate$2d([
46321 Autowired('columnModel')
46322 ], HeaderPositionUtils.prototype, "columnModel", void 0);
46323 __decorate$2d([
46324 Autowired('ctrlsService')
46325 ], HeaderPositionUtils.prototype, "ctrlsService", void 0);
46326 HeaderPositionUtils = __decorate$2d([
46327 Bean('headerPositionUtils')
46328 ], HeaderPositionUtils);
46329 return HeaderPositionUtils;
46330}(BeanStub));
46331
46332/**
46333 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
46334 * @version v27.3.0
46335 * @link https://www.ag-grid.com/
46336 * @license MIT
46337 */
46338var __decorate$2e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
46339 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46340 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
46341 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;
46342 return c > 3 && r && Object.defineProperty(target, key, r), r;
46343};
46344var ColumnDefFactory = /** @class */ (function () {
46345 function ColumnDefFactory() {
46346 }
46347 ColumnDefFactory.prototype.buildColumnDefs = function (cols, rowGroupColumns, pivotColumns) {
46348 var _this = this;
46349 var res = [];
46350 var colGroupDefs = {};
46351 cols.forEach(function (col) {
46352 var colDef = _this.createDefFromColumn(col, rowGroupColumns, pivotColumns);
46353 var addToResult = true;
46354 var childDef = colDef;
46355 var pointer = col.getOriginalParent();
46356 while (pointer) {
46357 var parentDef = null;
46358 // we don't include padding groups, as the column groups provided
46359 // by application didn't have these. the whole point of padding groups
46360 // is to balance the column tree that the user provided.
46361 if (pointer.isPadding()) {
46362 pointer = pointer.getOriginalParent();
46363 continue;
46364 }
46365 // if colDef for this group already exists, use it
46366 var existingParentDef = colGroupDefs[pointer.getGroupId()];
46367 if (existingParentDef) {
46368 existingParentDef.children.push(childDef);
46369 // if we added to result, it would be the second time we did it
46370 addToResult = false;
46371 // we don't want to continue up the tree, as it has already been
46372 // done for this group
46373 break;
46374 }
46375 parentDef = _this.createDefFromGroup(pointer);
46376 if (parentDef) {
46377 parentDef.children = [childDef];
46378 colGroupDefs[parentDef.groupId] = parentDef;
46379 childDef = parentDef;
46380 pointer = pointer.getOriginalParent();
46381 }
46382 }
46383 if (addToResult) {
46384 res.push(childDef);
46385 }
46386 });
46387 return res;
46388 };
46389 ColumnDefFactory.prototype.createDefFromGroup = function (group) {
46390 var defCloned = deepCloneDefinition(group.getColGroupDef(), ['children']);
46391 if (defCloned) {
46392 defCloned.groupId = group.getGroupId();
46393 }
46394 return defCloned;
46395 };
46396 ColumnDefFactory.prototype.createDefFromColumn = function (col, rowGroupColumns, pivotColumns) {
46397 var colDefCloned = deepCloneDefinition(col.getColDef());
46398 colDefCloned.colId = col.getColId();
46399 colDefCloned.width = col.getActualWidth();
46400 colDefCloned.rowGroup = col.isRowGroupActive();
46401 colDefCloned.rowGroupIndex = col.isRowGroupActive() ? rowGroupColumns.indexOf(col) : null;
46402 colDefCloned.pivot = col.isPivotActive();
46403 colDefCloned.pivotIndex = col.isPivotActive() ? pivotColumns.indexOf(col) : null;
46404 colDefCloned.aggFunc = col.isValueActive() ? col.getAggFunc() : null;
46405 colDefCloned.hide = col.isVisible() ? undefined : true;
46406 colDefCloned.pinned = col.isPinned() ? col.getPinned() : null;
46407 colDefCloned.sort = col.getSort() ? col.getSort() : null;
46408 colDefCloned.sortIndex = col.getSortIndex() != null ? col.getSortIndex() : null;
46409 return colDefCloned;
46410 };
46411 ColumnDefFactory = __decorate$2e([
46412 Bean('columnDefFactory')
46413 ], ColumnDefFactory);
46414 return ColumnDefFactory;
46415}());
46416
46417/**
46418 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
46419 * @version v27.3.0
46420 * @link https://www.ag-grid.com/
46421 * @license MIT
46422 */
46423var __decorate$2f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
46424 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46425 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
46426 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;
46427 return c > 3 && r && Object.defineProperty(target, key, r), r;
46428};
46429var RowCssClassCalculator = /** @class */ (function () {
46430 function RowCssClassCalculator() {
46431 }
46432 RowCssClassCalculator.prototype.getInitialRowClasses = function (params) {
46433 var classes = [];
46434 if (exists(params.extraCssClass)) {
46435 classes.push(params.extraCssClass);
46436 }
46437 classes.push('ag-row');
46438 classes.push(params.rowFocused ? 'ag-row-focus' : 'ag-row-no-focus');
46439 if (params.fadeRowIn) {
46440 classes.push('ag-opacity-zero');
46441 }
46442 classes.push(params.rowIsEven ? 'ag-row-even' : 'ag-row-odd');
46443 if (params.rowNode.isRowPinned()) {
46444 classes.push('ag-row-pinned');
46445 }
46446 if (params.rowNode.isSelected()) {
46447 classes.push('ag-row-selected');
46448 }
46449 if (params.rowNode.footer) {
46450 classes.push('ag-row-footer');
46451 }
46452 classes.push('ag-row-level-' + params.rowLevel);
46453 if (params.rowNode.stub) {
46454 classes.push('ag-row-loading');
46455 }
46456 if (params.fullWidthRow) {
46457 classes.push('ag-full-width-row');
46458 }
46459 if (params.expandable) {
46460 classes.push('ag-row-group');
46461 classes.push(params.rowNode.expanded ? 'ag-row-group-expanded' : 'ag-row-group-contracted');
46462 }
46463 if (params.rowNode.dragging) {
46464 classes.push('ag-row-dragging');
46465 }
46466 pushAll(classes, this.processClassesFromGridOptions(params.rowNode));
46467 pushAll(classes, this.preProcessRowClassRules(params.rowNode));
46468 // we use absolute position unless we are doing print layout
46469 classes.push(params.printLayout ? 'ag-row-position-relative' : 'ag-row-position-absolute');
46470 if (params.firstRowOnPage) {
46471 classes.push('ag-row-first');
46472 }
46473 if (params.lastRowOnPage) {
46474 classes.push('ag-row-last');
46475 }
46476 if (params.fullWidthRow) {
46477 if (params.pinned === Constants.PINNED_LEFT) {
46478 classes.push('ag-cell-last-left-pinned');
46479 }
46480 if (params.pinned === Constants.PINNED_RIGHT) {
46481 classes.push('ag-cell-first-right-pinned');
46482 }
46483 }
46484 return classes;
46485 };
46486 RowCssClassCalculator.prototype.processClassesFromGridOptions = function (rowNode) {
46487 var res = [];
46488 var process = function (rowCls) {
46489 if (typeof rowCls === 'string') {
46490 res.push(rowCls);
46491 }
46492 else if (Array.isArray(rowCls)) {
46493 rowCls.forEach(function (e) { return res.push(e); });
46494 }
46495 };
46496 // part 1 - rowClass
46497 var rowClass = this.gridOptionsWrapper.getRowClass();
46498 if (rowClass) {
46499 if (typeof rowClass === 'function') {
46500 console.warn('AG Grid: rowClass should not be a function, please use getRowClass instead');
46501 return [];
46502 }
46503 process(rowClass);
46504 }
46505 // part 2 - rowClassFunc
46506 var rowClassFunc = this.gridOptionsWrapper.getRowClassFunc();
46507 if (rowClassFunc) {
46508 var params = {
46509 data: rowNode.data,
46510 node: rowNode,
46511 rowIndex: rowNode.rowIndex
46512 };
46513 var rowClassFuncResult = rowClassFunc(params);
46514 process(rowClassFuncResult);
46515 }
46516 return res;
46517 };
46518 RowCssClassCalculator.prototype.preProcessRowClassRules = function (rowNode) {
46519 var res = [];
46520 this.processRowClassRules(rowNode, function (className) {
46521 res.push(className);
46522 }, function (className) {
46523 // not catered for, if creating, no need
46524 // to remove class as it was never there
46525 });
46526 return res;
46527 };
46528 RowCssClassCalculator.prototype.processRowClassRules = function (rowNode, onApplicableClass, onNotApplicableClass) {
46529 var rowClassParams = {
46530 data: rowNode.data,
46531 node: rowNode,
46532 rowIndex: rowNode.rowIndex,
46533 api: this.gridOptionsWrapper.getApi(),
46534 columnApi: this.gridOptionsWrapper.getColumnApi(),
46535 context: this.gridOptionsWrapper.getContext()
46536 };
46537 this.stylingService.processClassRules(this.gridOptionsWrapper.rowClassRules(), rowClassParams, onApplicableClass, onNotApplicableClass);
46538 };
46539 RowCssClassCalculator.prototype.calculateRowLevel = function (rowNode) {
46540 if (rowNode.group) {
46541 return rowNode.level;
46542 }
46543 // if a leaf, and a parent exists, put a level of the parent, else put level of 0 for top level item
46544 return rowNode.parent ? (rowNode.parent.level + 1) : 0;
46545 };
46546 __decorate$2f([
46547 Autowired('stylingService')
46548 ], RowCssClassCalculator.prototype, "stylingService", void 0);
46549 __decorate$2f([
46550 Autowired('gridOptionsWrapper')
46551 ], RowCssClassCalculator.prototype, "gridOptionsWrapper", void 0);
46552 RowCssClassCalculator = __decorate$2f([
46553 Bean('rowCssClassCalculator')
46554 ], RowCssClassCalculator);
46555 return RowCssClassCalculator;
46556}());
46557
46558/**
46559 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
46560 * @version v27.3.0
46561 * @link https://www.ag-grid.com/
46562 * @license MIT
46563 */
46564var __decorate$2g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
46565 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46566 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
46567 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;
46568 return c > 3 && r && Object.defineProperty(target, key, r), r;
46569};
46570// this logic is used by both SSRM and CSRM
46571var RowNodeSorter = /** @class */ (function () {
46572 function RowNodeSorter() {
46573 }
46574 RowNodeSorter.prototype.doFullSort = function (rowNodes, sortOptions) {
46575 var mapper = function (rowNode, pos) { return ({ currentPos: pos, rowNode: rowNode }); };
46576 var sortedRowNodes = rowNodes.map(mapper);
46577 sortedRowNodes.sort(this.compareRowNodes.bind(this, sortOptions));
46578 return sortedRowNodes.map(function (item) { return item.rowNode; });
46579 };
46580 RowNodeSorter.prototype.compareRowNodes = function (sortOptions, sortedNodeA, sortedNodeB) {
46581 var nodeA = sortedNodeA.rowNode;
46582 var nodeB = sortedNodeB.rowNode;
46583 // Iterate columns, return the first that doesn't match
46584 for (var i = 0, len = sortOptions.length; i < len; i++) {
46585 var sortOption = sortOptions[i];
46586 var isInverted = sortOption.sort === Constants.SORT_DESC;
46587 var valueA = this.getValue(nodeA, sortOption.column);
46588 var valueB = this.getValue(nodeB, sortOption.column);
46589 var comparatorResult = void 0;
46590 var providedComparator = this.getComparator(sortOption, nodeA);
46591 if (providedComparator) {
46592 //if comparator provided, use it
46593 comparatorResult = providedComparator(valueA, valueB, nodeA, nodeB, isInverted);
46594 }
46595 else {
46596 //otherwise do our own comparison
46597 comparatorResult = _.defaultComparator(valueA, valueB, this.gridOptionsWrapper.isAccentedSort());
46598 }
46599 // user provided comparators can return 'NaN' if they don't correctly handle 'undefined' values, this
46600 // typically occurs when the comparator is used on a group row
46601 var validResult = !isNaN(comparatorResult);
46602 if (validResult && comparatorResult !== 0) {
46603 return sortOption.sort === Constants.SORT_ASC ? comparatorResult : comparatorResult * -1;
46604 }
46605 }
46606 // All matched, we make is so that the original sort order is kept:
46607 return sortedNodeA.currentPos - sortedNodeB.currentPos;
46608 };
46609 RowNodeSorter.prototype.getComparator = function (sortOption, rowNode) {
46610 var column = sortOption.column;
46611 // comparator on col get preference over everything else
46612 var comparatorOnCol = column.getColDef().comparator;
46613 if (comparatorOnCol != null) {
46614 return comparatorOnCol;
46615 }
46616 // if no comparator on col, see if we are showing a group, and if we are, get comparator from row group col
46617 if (rowNode.rowGroupColumn) {
46618 return rowNode.rowGroupColumn.getColDef().comparator;
46619 }
46620 if (!column.getColDef().showRowGroup) {
46621 return;
46622 }
46623 // if a 'field' is supplied on the autoGroupColumnDef we need to use the associated column comparator
46624 var groupLeafField = !rowNode.group && column.getColDef().field;
46625 if (!groupLeafField) {
46626 return;
46627 }
46628 var primaryColumn = this.columnModel.getPrimaryColumn(groupLeafField);
46629 if (!primaryColumn) {
46630 return;
46631 }
46632 return primaryColumn.getColDef().comparator;
46633 };
46634 RowNodeSorter.prototype.getValue = function (nodeA, column) {
46635 return this.valueService.getValue(column, nodeA, false, false);
46636 };
46637 __decorate$2g([
46638 Autowired('gridOptionsWrapper')
46639 ], RowNodeSorter.prototype, "gridOptionsWrapper", void 0);
46640 __decorate$2g([
46641 Autowired('valueService')
46642 ], RowNodeSorter.prototype, "valueService", void 0);
46643 __decorate$2g([
46644 Autowired('columnModel')
46645 ], RowNodeSorter.prototype, "columnModel", void 0);
46646 RowNodeSorter = __decorate$2g([
46647 Bean('rowNodeSorter')
46648 ], RowNodeSorter);
46649 return RowNodeSorter;
46650}());
46651
46652/**
46653 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
46654 * @version v27.3.0
46655 * @link https://www.ag-grid.com/
46656 * @license MIT
46657 */
46658var __extends$2A = (undefined && undefined.__extends) || (function () {
46659 var extendStatics = function (d, b) {
46660 extendStatics = Object.setPrototypeOf ||
46661 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
46662 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
46663 return extendStatics(d, b);
46664 };
46665 return function (d, b) {
46666 extendStatics(d, b);
46667 function __() { this.constructor = d; }
46668 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
46669 };
46670})();
46671var __decorate$2h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
46672 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46673 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
46674 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;
46675 return c > 3 && r && Object.defineProperty(target, key, r), r;
46676};
46677var CtrlsService = /** @class */ (function (_super) {
46678 __extends$2A(CtrlsService, _super);
46679 function CtrlsService() {
46680 var _this = _super !== null && _super.apply(this, arguments) || this;
46681 _this.ready = false;
46682 _this.readyCallbacks = [];
46683 return _this;
46684 }
46685 CtrlsService_1 = CtrlsService;
46686 CtrlsService.prototype.checkReady = function () {
46687 this.ready =
46688 this.gridCtrl != null
46689 && this.gridBodyCtrl != null
46690 && this.centerRowContainerCtrl != null
46691 && this.leftRowContainerCtrl != null
46692 && this.rightRowContainerCtrl != null
46693 && this.bottomCenterRowContainerCtrl != null
46694 && this.bottomLeftRowContainerCtrl != null
46695 && this.bottomRightRowContainerCtrl != null
46696 && this.topCenterRowContainerCtrl != null
46697 && this.topLeftRowContainerCtrl != null
46698 && this.topRightRowContainerCtrl != null
46699 && this.centerHeaderRowContainerCtrl != null
46700 && this.leftHeaderRowContainerCtrl != null
46701 && this.rightHeaderRowContainerCtrl != null
46702 && this.fakeHScrollCtrl != null
46703 && this.gridHeaderCtrl != null;
46704 if (this.ready) {
46705 var p_1 = this.createReadyParams();
46706 this.readyCallbacks.forEach(function (c) { return c(p_1); });
46707 this.readyCallbacks.length = 0;
46708 }
46709 };
46710 CtrlsService.prototype.whenReady = function (callback) {
46711 if (this.ready) {
46712 callback(this.createReadyParams());
46713 }
46714 else {
46715 this.readyCallbacks.push(callback);
46716 }
46717 };
46718 CtrlsService.prototype.createReadyParams = function () {
46719 return {
46720 centerRowContainerCtrl: this.centerRowContainerCtrl,
46721 leftRowContainerCtrl: this.leftRowContainerCtrl,
46722 rightRowContainerCtrl: this.rightRowContainerCtrl,
46723 bottomCenterRowContainerCtrl: this.bottomCenterRowContainerCtrl,
46724 bottomLeftRowContainerCtrl: this.bottomLeftRowContainerCtrl,
46725 bottomRightRowContainerCtrl: this.bottomRightRowContainerCtrl,
46726 topCenterRowContainerCtrl: this.topCenterRowContainerCtrl,
46727 topLeftRowContainerCtrl: this.topLeftRowContainerCtrl,
46728 topRightRowContainerCtrl: this.topRightRowContainerCtrl,
46729 centerHeaderRowContainerCtrl: this.centerHeaderRowContainerCtrl,
46730 leftHeaderRowContainerCtrl: this.leftHeaderRowContainerCtrl,
46731 rightHeaderRowContainerCtrl: this.rightHeaderRowContainerCtrl,
46732 fakeHScrollCtrl: this.fakeHScrollCtrl,
46733 gridBodyCtrl: this.gridBodyCtrl,
46734 gridCtrl: this.gridCtrl,
46735 gridHeaderCtrl: this.gridHeaderCtrl,
46736 };
46737 };
46738 CtrlsService.prototype.registerFakeHScrollCtrl = function (ctrl) {
46739 this.fakeHScrollCtrl = ctrl;
46740 this.checkReady();
46741 };
46742 CtrlsService.prototype.registerGridHeaderCtrl = function (gridHeaderCtrl) {
46743 this.gridHeaderCtrl = gridHeaderCtrl;
46744 this.checkReady();
46745 };
46746 CtrlsService.prototype.registerCenterRowContainerCtrl = function (ctrl) {
46747 this.centerRowContainerCtrl = ctrl;
46748 this.checkReady();
46749 };
46750 CtrlsService.prototype.registerLeftRowContainerCtrl = function (ctrl) {
46751 this.leftRowContainerCtrl = ctrl;
46752 this.checkReady();
46753 };
46754 CtrlsService.prototype.registerRightRowContainerCtrl = function (ctrl) {
46755 this.rightRowContainerCtrl = ctrl;
46756 this.checkReady();
46757 };
46758 CtrlsService.prototype.registerTopCenterRowContainerCtrl = function (ctrl) {
46759 this.topCenterRowContainerCtrl = ctrl;
46760 this.checkReady();
46761 };
46762 CtrlsService.prototype.registerTopLeftRowContainerCon = function (ctrl) {
46763 this.topLeftRowContainerCtrl = ctrl;
46764 this.checkReady();
46765 };
46766 CtrlsService.prototype.registerTopRightRowContainerCtrl = function (ctrl) {
46767 this.topRightRowContainerCtrl = ctrl;
46768 this.checkReady();
46769 };
46770 CtrlsService.prototype.registerBottomCenterRowContainerCtrl = function (ctrl) {
46771 this.bottomCenterRowContainerCtrl = ctrl;
46772 this.checkReady();
46773 };
46774 CtrlsService.prototype.registerBottomLeftRowContainerCtrl = function (ctrl) {
46775 this.bottomLeftRowContainerCtrl = ctrl;
46776 this.checkReady();
46777 };
46778 CtrlsService.prototype.registerBottomRightRowContainerCtrl = function (ctrl) {
46779 this.bottomRightRowContainerCtrl = ctrl;
46780 this.checkReady();
46781 };
46782 CtrlsService.prototype.registerHeaderContainer = function (ctrl, pinned) {
46783 switch (pinned) {
46784 case Constants.PINNED_LEFT:
46785 this.leftHeaderRowContainerCtrl = ctrl;
46786 break;
46787 case Constants.PINNED_RIGHT:
46788 this.rightHeaderRowContainerCtrl = ctrl;
46789 break;
46790 default:
46791 this.centerHeaderRowContainerCtrl = ctrl;
46792 break;
46793 }
46794 this.checkReady();
46795 };
46796 CtrlsService.prototype.registerGridBodyCtrl = function (ctrl) {
46797 this.gridBodyCtrl = ctrl;
46798 this.checkReady();
46799 };
46800 CtrlsService.prototype.registerGridCtrl = function (ctrl) {
46801 this.gridCtrl = ctrl;
46802 this.checkReady();
46803 };
46804 CtrlsService.prototype.getFakeHScrollCtrl = function () {
46805 return this.fakeHScrollCtrl;
46806 };
46807 CtrlsService.prototype.getGridHeaderCtrl = function () {
46808 return this.gridHeaderCtrl;
46809 };
46810 CtrlsService.prototype.getGridCtrl = function () {
46811 return this.gridCtrl;
46812 };
46813 CtrlsService.prototype.getCenterRowContainerCtrl = function () {
46814 return this.centerRowContainerCtrl;
46815 };
46816 CtrlsService.prototype.getTopCenterRowContainerCtrl = function () {
46817 return this.topCenterRowContainerCtrl;
46818 };
46819 CtrlsService.prototype.getBottomCenterRowContainerCtrl = function () {
46820 return this.bottomCenterRowContainerCtrl;
46821 };
46822 CtrlsService.prototype.getGridBodyCtrl = function () {
46823 return this.gridBodyCtrl;
46824 };
46825 CtrlsService.prototype.getHeaderRowContainerCtrls = function () {
46826 return [this.leftHeaderRowContainerCtrl, this.rightHeaderRowContainerCtrl, this.centerHeaderRowContainerCtrl];
46827 };
46828 CtrlsService.prototype.getHeaderRowContainerCtrl = function (pinned) {
46829 switch (pinned) {
46830 case Constants.PINNED_LEFT: return this.leftHeaderRowContainerCtrl;
46831 case Constants.PINNED_RIGHT: return this.rightHeaderRowContainerCtrl;
46832 default: return this.centerHeaderRowContainerCtrl;
46833 }
46834 };
46835 var CtrlsService_1;
46836 CtrlsService.NAME = 'ctrlsService';
46837 CtrlsService = CtrlsService_1 = __decorate$2h([
46838 Bean(CtrlsService_1.NAME)
46839 ], CtrlsService);
46840 return CtrlsService;
46841}(BeanStub));
46842
46843/**
46844 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
46845 * @version v27.3.0
46846 * @link https://www.ag-grid.com/
46847 * @license MIT
46848 */
46849var __extends$2B = (undefined && undefined.__extends) || (function () {
46850 var extendStatics = function (d, b) {
46851 extendStatics = Object.setPrototypeOf ||
46852 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
46853 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
46854 return extendStatics(d, b);
46855 };
46856 return function (d, b) {
46857 extendStatics(d, b);
46858 function __() { this.constructor = d; }
46859 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
46860 };
46861})();
46862var __decorate$2i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
46863 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46864 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
46865 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;
46866 return c > 3 && r && Object.defineProperty(target, key, r), r;
46867};
46868var CtrlsFactory = /** @class */ (function (_super) {
46869 __extends$2B(CtrlsFactory, _super);
46870 function CtrlsFactory() {
46871 var _this = _super !== null && _super.apply(this, arguments) || this;
46872 _this.registry = {};
46873 return _this;
46874 }
46875 CtrlsFactory.prototype.register = function (meta) {
46876 this.registry[meta.controllerName] = meta.controllerClass;
46877 };
46878 CtrlsFactory.prototype.getInstance = function (name) {
46879 var ControllerClass = this.registry[name];
46880 if (ControllerClass == null) {
46881 return undefined;
46882 }
46883 return new ControllerClass();
46884 };
46885 CtrlsFactory = __decorate$2i([
46886 Bean('ctrlsFactory')
46887 ], CtrlsFactory);
46888 return CtrlsFactory;
46889}(BeanStub));
46890
46891/**
46892 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
46893 * @version v27.3.0
46894 * @link https://www.ag-grid.com/
46895 * @license MIT
46896 */
46897var __extends$2C = (undefined && undefined.__extends) || (function () {
46898 var extendStatics = function (d, b) {
46899 extendStatics = Object.setPrototypeOf ||
46900 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
46901 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
46902 return extendStatics(d, b);
46903 };
46904 return function (d, b) {
46905 extendStatics(d, b);
46906 function __() { this.constructor = d; }
46907 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
46908 };
46909})();
46910var __decorate$2j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
46911 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46912 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
46913 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;
46914 return c > 3 && r && Object.defineProperty(target, key, r), r;
46915};
46916var FakeHScrollCtrl = /** @class */ (function (_super) {
46917 __extends$2C(FakeHScrollCtrl, _super);
46918 function FakeHScrollCtrl() {
46919 return _super.call(this) || this;
46920 }
46921 FakeHScrollCtrl.prototype.setComp = function (view, eGui, eViewport, eContainer) {
46922 this.view = view;
46923 this.eViewport = eViewport;
46924 this.eContainer = eContainer;
46925 this.eGui = eGui;
46926 this.addManagedListener(this.eventService, Events.EVENT_SCROLL_VISIBILITY_CHANGED, this.onScrollVisibilityChanged.bind(this));
46927 this.onScrollVisibilityChanged();
46928 // When doing printing, this changes whether cols are pinned or not
46929 var spacerWidthsListener = this.setFakeHScrollSpacerWidths.bind(this);
46930 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, spacerWidthsListener);
46931 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, spacerWidthsListener);
46932 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, spacerWidthsListener);
46933 this.setFakeHScrollSpacerWidths();
46934 if (this.invisibleScrollbar) {
46935 this.hideAndShowInvisibleScrollAsNeeded();
46936 this.addActiveListenerToggles();
46937 }
46938 this.ctrlsService.registerFakeHScrollCtrl(this);
46939 };
46940 FakeHScrollCtrl.prototype.addActiveListenerToggles = function () {
46941 var _this = this;
46942 var activateEvents = ['mouseenter', 'mousedown', 'touchstart'];
46943 var deactivateEvents = ['mouseleave', 'mouseup', 'touchend'];
46944 activateEvents.forEach(function (eventName) { return _this.addManagedListener(_this.eGui, eventName, function () { return _this.view.addOrRemoveCssClass('ag-scrollbar-active', true); }); });
46945 deactivateEvents.forEach(function (eventName) { return _this.addManagedListener(_this.eGui, eventName, function () { return _this.view.addOrRemoveCssClass('ag-scrollbar-active', false); }); });
46946 };
46947 FakeHScrollCtrl.prototype.postConstruct = function () {
46948 this.enableRtl = this.gridOptionsWrapper.isEnableRtl();
46949 this.invisibleScrollbar = isInvisibleScrollbar();
46950 };
46951 FakeHScrollCtrl.prototype.onScrollVisibilityChanged = function () {
46952 this.setScrollVisible();
46953 this.setFakeHScrollSpacerWidths();
46954 };
46955 FakeHScrollCtrl.prototype.hideAndShowInvisibleScrollAsNeeded = function () {
46956 var _this = this;
46957 this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL, function (params) {
46958 if (params.direction === 'horizontal') {
46959 _this.view.addOrRemoveCssClass('ag-scrollbar-scrolling', true);
46960 }
46961 });
46962 this.addManagedListener(this.eventService, Events.EVENT_BODY_SCROLL_END, function () { return _this.view.addOrRemoveCssClass('ag-scrollbar-scrolling', false); });
46963 };
46964 FakeHScrollCtrl.prototype.setFakeHScrollSpacerWidths = function () {
46965 var vScrollShowing = this.scrollVisibleService.isVerticalScrollShowing();
46966 // we pad the right based on a) if cols are pinned to the right and
46967 // b) if v scroll is showing on the right (normal position of scroll)
46968 var rightSpacing = this.columnModel.getDisplayedColumnsRightWidth();
46969 var scrollOnRight = !this.enableRtl && vScrollShowing;
46970 var scrollbarWidth = this.gridOptionsWrapper.getScrollbarWidth();
46971 if (scrollOnRight) {
46972 rightSpacing += scrollbarWidth;
46973 }
46974 this.view.setRightSpacerFixedWidth(rightSpacing);
46975 this.view.includeRightSpacerScrollerCss('ag-scroller-corner', rightSpacing <= scrollbarWidth);
46976 // we pad the left based on a) if cols are pinned to the left and
46977 // b) if v scroll is showing on the left (happens in LTR layout only)
46978 var leftSpacing = this.columnModel.getDisplayedColumnsLeftWidth();
46979 var scrollOnLeft = this.enableRtl && vScrollShowing;
46980 if (scrollOnLeft) {
46981 leftSpacing += scrollbarWidth;
46982 }
46983 this.view.setLeftSpacerFixedWidth(leftSpacing);
46984 this.view.includeLeftSpacerScrollerCss('ag-scroller-corner', leftSpacing <= scrollbarWidth);
46985 };
46986 FakeHScrollCtrl.prototype.setScrollVisible = function () {
46987 var hScrollShowing = this.scrollVisibleService.isHorizontalScrollShowing();
46988 var invisibleScrollbar = this.invisibleScrollbar;
46989 var isSuppressHorizontalScroll = this.gridOptionsWrapper.isSuppressHorizontalScroll();
46990 var scrollbarWidth = hScrollShowing ? (this.gridOptionsWrapper.getScrollbarWidth() || 0) : 0;
46991 var adjustedScrollbarWidth = (scrollbarWidth === 0 && invisibleScrollbar) ? 15 : scrollbarWidth;
46992 var scrollContainerSize = !isSuppressHorizontalScroll ? adjustedScrollbarWidth : 0;
46993 this.view.addOrRemoveCssClass('ag-scrollbar-invisible', invisibleScrollbar);
46994 this.view.setHeight(scrollContainerSize);
46995 this.view.setViewportHeight(scrollContainerSize);
46996 this.view.setContainerHeight(scrollContainerSize);
46997 };
46998 FakeHScrollCtrl.prototype.getViewport = function () {
46999 return this.eViewport;
47000 };
47001 FakeHScrollCtrl.prototype.getContainer = function () {
47002 return this.eContainer;
47003 };
47004 __decorate$2j([
47005 Autowired('scrollVisibleService')
47006 ], FakeHScrollCtrl.prototype, "scrollVisibleService", void 0);
47007 __decorate$2j([
47008 Autowired('columnModel')
47009 ], FakeHScrollCtrl.prototype, "columnModel", void 0);
47010 __decorate$2j([
47011 Autowired('ctrlsService')
47012 ], FakeHScrollCtrl.prototype, "ctrlsService", void 0);
47013 __decorate$2j([
47014 PostConstruct
47015 ], FakeHScrollCtrl.prototype, "postConstruct", null);
47016 return FakeHScrollCtrl;
47017}(BeanStub));
47018
47019/**
47020 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
47021 * @version v27.3.0
47022 * @link https://www.ag-grid.com/
47023 * @license MIT
47024 */
47025var __extends$2D = (undefined && undefined.__extends) || (function () {
47026 var extendStatics = function (d, b) {
47027 extendStatics = Object.setPrototypeOf ||
47028 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
47029 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
47030 return extendStatics(d, b);
47031 };
47032 return function (d, b) {
47033 extendStatics(d, b);
47034 function __() { this.constructor = d; }
47035 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
47036 };
47037})();
47038var __decorate$2k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
47039 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
47040 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
47041 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;
47042 return c > 3 && r && Object.defineProperty(target, key, r), r;
47043};
47044var FakeHScrollComp = /** @class */ (function (_super) {
47045 __extends$2D(FakeHScrollComp, _super);
47046 function FakeHScrollComp() {
47047 return _super.call(this, FakeHScrollComp.TEMPLATE) || this;
47048 }
47049 FakeHScrollComp.prototype.postConstruct = function () {
47050 var _this = this;
47051 var compProxy = {
47052 addOrRemoveCssClass: function (cssClassName, on) { return _this.addOrRemoveCssClass(cssClassName, on); },
47053 setHeight: function (height) { return setFixedHeight(_this.getGui(), height); },
47054 setContainerHeight: function (height) { return setFixedHeight(_this.eContainer, height); },
47055 setViewportHeight: function (height) { return setFixedHeight(_this.eViewport, height); },
47056 setRightSpacerFixedWidth: function (width) { return setFixedWidth(_this.eRightSpacer, width); },
47057 setLeftSpacerFixedWidth: function (width) { return setFixedWidth(_this.eLeftSpacer, width); },
47058 includeLeftSpacerScrollerCss: function (cssClass, include) {
47059 return _this.eLeftSpacer.classList.toggle(cssClass, include);
47060 },
47061 includeRightSpacerScrollerCss: function (cssClass, include) {
47062 return _this.eRightSpacer.classList.toggle(cssClass, include);
47063 },
47064 };
47065 var ctrl = this.createManagedBean(new FakeHScrollCtrl());
47066 ctrl.setComp(compProxy, this.getGui(), this.eViewport, this.eContainer);
47067 this.createManagedBean(new CenterWidthFeature(function (width) { return _this.eContainer.style.width = width + "px"; }));
47068 };
47069 FakeHScrollComp.TEMPLATE = "<div class=\"ag-body-horizontal-scroll\" aria-hidden=\"true\">\n <div class=\"ag-horizontal-left-spacer\" ref=\"eLeftSpacer\"></div>\n <div class=\"ag-body-horizontal-scroll-viewport\" ref=\"eViewport\">\n <div class=\"ag-body-horizontal-scroll-container\" ref=\"eContainer\"></div>\n </div>\n <div class=\"ag-horizontal-right-spacer\" ref=\"eRightSpacer\"></div>\n </div>";
47070 __decorate$2k([
47071 RefSelector('eLeftSpacer')
47072 ], FakeHScrollComp.prototype, "eLeftSpacer", void 0);
47073 __decorate$2k([
47074 RefSelector('eRightSpacer')
47075 ], FakeHScrollComp.prototype, "eRightSpacer", void 0);
47076 __decorate$2k([
47077 RefSelector('eViewport')
47078 ], FakeHScrollComp.prototype, "eViewport", void 0);
47079 __decorate$2k([
47080 RefSelector('eContainer')
47081 ], FakeHScrollComp.prototype, "eContainer", void 0);
47082 __decorate$2k([
47083 PostConstruct
47084 ], FakeHScrollComp.prototype, "postConstruct", null);
47085 return FakeHScrollComp;
47086}(Component));
47087
47088/**
47089 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
47090 * @version v27.3.0
47091 * @link https://www.ag-grid.com/
47092 * @license MIT
47093 */
47094var __extends$2E = (undefined && undefined.__extends) || (function () {
47095 var extendStatics = function (d, b) {
47096 extendStatics = Object.setPrototypeOf ||
47097 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
47098 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
47099 return extendStatics(d, b);
47100 };
47101 return function (d, b) {
47102 extendStatics(d, b);
47103 function __() { this.constructor = d; }
47104 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
47105 };
47106})();
47107var __decorate$2l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
47108 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
47109 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
47110 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;
47111 return c > 3 && r && Object.defineProperty(target, key, r), r;
47112};
47113var PinnedWidthService = /** @class */ (function (_super) {
47114 __extends$2E(PinnedWidthService, _super);
47115 function PinnedWidthService() {
47116 return _super !== null && _super.apply(this, arguments) || this;
47117 }
47118 PinnedWidthService.prototype.postConstruct = function () {
47119 var listener = this.checkContainerWidths.bind(this);
47120 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, listener);
47121 this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, listener);
47122 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_DOM_LAYOUT, listener);
47123 };
47124 PinnedWidthService.prototype.checkContainerWidths = function () {
47125 var printLayout = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_PRINT;
47126 var newLeftWidth = printLayout ? 0 : this.columnModel.getDisplayedColumnsLeftWidth();
47127 var newRightWidth = printLayout ? 0 : this.columnModel.getDisplayedColumnsRightWidth();
47128 if (newLeftWidth != this.leftWidth) {
47129 this.leftWidth = newLeftWidth;
47130 this.eventService.dispatchEvent({ type: Events.EVENT_LEFT_PINNED_WIDTH_CHANGED });
47131 }
47132 if (newRightWidth != this.rightWidth) {
47133 this.rightWidth = newRightWidth;
47134 this.eventService.dispatchEvent({ type: Events.EVENT_RIGHT_PINNED_WIDTH_CHANGED });
47135 }
47136 };
47137 PinnedWidthService.prototype.getPinnedRightWidth = function () {
47138 return this.rightWidth;
47139 };
47140 PinnedWidthService.prototype.getPinnedLeftWidth = function () {
47141 return this.leftWidth;
47142 };
47143 __decorate$2l([
47144 Autowired('columnModel')
47145 ], PinnedWidthService.prototype, "columnModel", void 0);
47146 __decorate$2l([
47147 PostConstruct
47148 ], PinnedWidthService.prototype, "postConstruct", null);
47149 PinnedWidthService = __decorate$2l([
47150 Bean('pinnedWidthService')
47151 ], PinnedWidthService);
47152 return PinnedWidthService;
47153}(BeanStub));
47154
47155/**
47156 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
47157 * @version v27.3.0
47158 * @link https://www.ag-grid.com/
47159 * @license MIT
47160 */
47161var __extends$2F = (undefined && undefined.__extends) || (function () {
47162 var extendStatics = function (d, b) {
47163 extendStatics = Object.setPrototypeOf ||
47164 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
47165 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
47166 return extendStatics(d, b);
47167 };
47168 return function (d, b) {
47169 extendStatics(d, b);
47170 function __() { this.constructor = d; }
47171 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
47172 };
47173})();
47174var __decorate$2m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
47175 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
47176 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
47177 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;
47178 return c > 3 && r && Object.defineProperty(target, key, r), r;
47179};
47180var RowNodeEventThrottle = /** @class */ (function (_super) {
47181 __extends$2F(RowNodeEventThrottle, _super);
47182 function RowNodeEventThrottle() {
47183 var _this = _super !== null && _super.apply(this, arguments) || this;
47184 _this.events = [];
47185 return _this;
47186 }
47187 RowNodeEventThrottle.prototype.postConstruct = function () {
47188 if (this.rowModel.getType() == Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
47189 this.clientSideRowModel = this.rowModel;
47190 }
47191 };
47192 // because the user can call rowNode.setExpanded() many times in one VM turn,
47193 // we throttle the calls to ClientSideRowModel using animationFrameService. this means for 100
47194 // row nodes getting expanded, we only update the CSRM once, and then we fire all events after
47195 // CSRM has updated.
47196 //
47197 // if we did not do this, then the user could call setExpanded on 100+ rows, causing the grid
47198 // to re-render 100+ times, which would be a performance lag.
47199 //
47200 // we use animationFrameService
47201 // rather than _.debounce() so this will get done if anyone flushes the animationFrameService
47202 // (eg user calls api.ensureRowVisible(), which in turn flushes ).
47203 RowNodeEventThrottle.prototype.dispatchExpanded = function (event) {
47204 var _this = this;
47205 // if not using CSRM, we don't debounce. otherwise this breaks the SSRM.
47206 if (this.clientSideRowModel == null) {
47207 this.eventService.dispatchEvent(event);
47208 return;
47209 }
47210 this.events.push(event);
47211 var func = function () {
47212 if (_this.clientSideRowModel) {
47213 _this.clientSideRowModel.onRowGroupOpened();
47214 }
47215 _this.events.forEach(function (e) { return _this.eventService.dispatchEvent(e); });
47216 _this.events = [];
47217 };
47218 if (this.dispatchExpandedDebounced == null) {
47219 this.dispatchExpandedDebounced = this.animationFrameService.debounce(func);
47220 }
47221 this.dispatchExpandedDebounced();
47222 };
47223 __decorate$2m([
47224 Autowired('animationFrameService')
47225 ], RowNodeEventThrottle.prototype, "animationFrameService", void 0);
47226 __decorate$2m([
47227 Autowired('rowModel')
47228 ], RowNodeEventThrottle.prototype, "rowModel", void 0);
47229 __decorate$2m([
47230 PostConstruct
47231 ], RowNodeEventThrottle.prototype, "postConstruct", null);
47232 RowNodeEventThrottle = __decorate$2m([
47233 Bean('rowNodeEventThrottle')
47234 ], RowNodeEventThrottle);
47235 return RowNodeEventThrottle;
47236}(BeanStub));
47237
47238/**
47239 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
47240 * @version v27.3.0
47241 * @link https://www.ag-grid.com/
47242 * @license MIT
47243 */
47244var __read$h = (undefined && undefined.__read) || function (o, n) {
47245 var m = typeof Symbol === "function" && o[Symbol.iterator];
47246 if (!m) return o;
47247 var i = m.call(o), r, ar = [], e;
47248 try {
47249 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
47250 }
47251 catch (error) { e = { error: error }; }
47252 finally {
47253 try {
47254 if (r && !r.done && (m = i["return"])) m.call(i);
47255 }
47256 finally { if (e) throw e.error; }
47257 }
47258 return ar;
47259};
47260var __spread$d = (undefined && undefined.__spread) || function () {
47261 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$h(arguments[i]));
47262 return ar;
47263};
47264// creates JavaScript vanilla Grid, including JavaScript (ag-stack) components, which can
47265// be wrapped by the framework wrappers
47266var Grid = /** @class */ (function () {
47267 function Grid(eGridDiv, gridOptions, params) {
47268 if (!gridOptions) {
47269 console.error('AG Grid: no gridOptions provided to the grid');
47270 return;
47271 }
47272 this.gridOptions = gridOptions;
47273 new GridCoreCreator().create(eGridDiv, gridOptions, function (context) {
47274 var gridComp = new GridComp(eGridDiv);
47275 context.createBean(gridComp);
47276 }, undefined, params);
47277 }
47278 Grid.prototype.destroy = function () {
47279 if (this.gridOptions && this.gridOptions.api) {
47280 this.gridOptions.api.destroy();
47281 }
47282 };
47283 return Grid;
47284}());
47285// created services of grid only, no UI, so frameworks can use this if providing
47286// their own UI
47287var GridCoreCreator = /** @class */ (function () {
47288 function GridCoreCreator() {
47289 }
47290 GridCoreCreator.prototype.create = function (eGridDiv, gridOptions, createUi, acceptChanges, params) {
47291 var _this = this;
47292 var debug = !!gridOptions.debug;
47293 var registeredModules = this.getRegisteredModules(params);
47294 var beanClasses = this.createBeansList(gridOptions.rowModelType, registeredModules);
47295 var providedBeanInstances = this.createProvidedBeans(eGridDiv, gridOptions, params);
47296 if (!beanClasses) {
47297 return;
47298 } // happens when no row model found
47299 var contextParams = {
47300 providedBeanInstances: providedBeanInstances,
47301 beanClasses: beanClasses,
47302 debug: debug
47303 };
47304 var logger = new Logger('AG Grid', function () { return gridOptions.debug; });
47305 var contextLogger = new Logger('Context', function () { return contextParams.debug; });
47306 var context = new Context(contextParams, contextLogger);
47307 var beans = context.getBean('beans');
47308 this.registerModuleUserComponents(beans, registeredModules);
47309 this.registerStackComponents(beans, registeredModules);
47310 this.registerControllers(beans, registeredModules);
47311 createUi(context);
47312 // we wait until the UI has finished initialising before setting in columns and rows
47313 beans.ctrlsService.whenReady(function () {
47314 _this.setColumnsAndData(beans);
47315 _this.dispatchGridReadyEvent(beans, gridOptions);
47316 var isEnterprise = ModuleRegistry.isRegistered(exports.ModuleNames.EnterpriseCoreModule);
47317 logger.log("initialised successfully, enterprise = " + isEnterprise);
47318 });
47319 if (acceptChanges) {
47320 acceptChanges(context);
47321 }
47322 };
47323 GridCoreCreator.prototype.registerControllers = function (beans, registeredModules) {
47324 registeredModules.forEach(function (module) {
47325 if (module.controllers) {
47326 module.controllers.forEach(function (meta) { return beans.ctrlsFactory.register(meta); });
47327 }
47328 });
47329 };
47330 GridCoreCreator.prototype.registerStackComponents = function (beans, registeredModules) {
47331 var agStackComponents = this.createAgStackComponentsList(registeredModules);
47332 beans.agStackComponentsRegistry.setupComponents(agStackComponents);
47333 };
47334 GridCoreCreator.prototype.getRegisteredModules = function (params) {
47335 var passedViaConstructor = params ? params.modules : null;
47336 var registered = ModuleRegistry.getRegisteredModules();
47337 var allModules = [];
47338 var mapNames = {};
47339 // adds to list and removes duplicates
47340 function addModule(moduleBased, mod) {
47341 function addIndividualModule(currentModule) {
47342 if (!mapNames[currentModule.moduleName]) {
47343 mapNames[currentModule.moduleName] = true;
47344 allModules.push(currentModule);
47345 ModuleRegistry.register(currentModule, moduleBased);
47346 }
47347 }
47348 addIndividualModule(mod);
47349 if (mod.dependantModules) {
47350 mod.dependantModules.forEach(addModule.bind(null, moduleBased));
47351 }
47352 }
47353 if (passedViaConstructor) {
47354 passedViaConstructor.forEach(addModule.bind(null, true));
47355 }
47356 if (registered) {
47357 registered.forEach(addModule.bind(null, !ModuleRegistry.isPackageBased()));
47358 }
47359 return allModules;
47360 };
47361 GridCoreCreator.prototype.registerModuleUserComponents = function (beans, registeredModules) {
47362 var moduleUserComps = this.extractModuleEntity(registeredModules, function (module) { return module.userComponents ? module.userComponents : []; });
47363 moduleUserComps.forEach(function (compMeta) {
47364 beans.userComponentRegistry.registerDefaultComponent(compMeta.componentName, compMeta.componentClass);
47365 });
47366 };
47367 GridCoreCreator.prototype.createProvidedBeans = function (eGridDiv, gridOptions, params) {
47368 var frameworkOverrides = params ? params.frameworkOverrides : null;
47369 if (missing(frameworkOverrides)) {
47370 frameworkOverrides = new VanillaFrameworkOverrides();
47371 }
47372 var seed = {
47373 gridOptions: gridOptions,
47374 eGridDiv: eGridDiv,
47375 globalEventListener: params ? params.globalEventListener : null,
47376 frameworkOverrides: frameworkOverrides
47377 };
47378 if (params && params.providedBeanInstances) {
47379 Object.assign(seed, params.providedBeanInstances);
47380 }
47381 return seed;
47382 };
47383 GridCoreCreator.prototype.createAgStackComponentsList = function (registeredModules) {
47384 var components = [
47385 { componentName: 'AgCheckbox', componentClass: AgCheckbox },
47386 { componentName: 'AgRadioButton', componentClass: AgRadioButton },
47387 { componentName: 'AgToggleButton', componentClass: AgToggleButton },
47388 { componentName: 'AgInputTextField', componentClass: AgInputTextField },
47389 { componentName: 'AgInputTextArea', componentClass: AgInputTextArea },
47390 { componentName: 'AgInputNumberField', componentClass: AgInputNumberField },
47391 { componentName: 'AgInputRange', componentClass: AgInputRange },
47392 { componentName: 'AgSelect', componentClass: AgSelect },
47393 { componentName: 'AgSlider', componentClass: AgSlider },
47394 { componentName: 'AgAngleSelect', componentClass: AgAngleSelect },
47395 { componentName: 'AgColorPicker', componentClass: AgColorPicker },
47396 { componentName: 'AgGridBody', componentClass: GridBodyComp },
47397 { componentName: 'AgHeaderRoot', componentClass: GridHeaderComp },
47398 { componentName: 'AgPagination', componentClass: PaginationComp },
47399 { componentName: 'AgOverlayWrapper', componentClass: OverlayWrapperComponent },
47400 { componentName: 'AgGroupComponent', componentClass: AgGroupComponent },
47401 { componentName: 'AgPanel', componentClass: AgPanel },
47402 { componentName: 'AgDialog', componentClass: AgDialog },
47403 { componentName: 'AgRowContainer', componentClass: RowContainerComp },
47404 { componentName: 'AgFakeHorizontalScroll', componentClass: FakeHScrollComp }
47405 ];
47406 var moduleAgStackComps = this.extractModuleEntity(registeredModules, function (module) { return module.agStackComponents ? module.agStackComponents : []; });
47407 components = components.concat(moduleAgStackComps);
47408 return components;
47409 };
47410 GridCoreCreator.prototype.createBeansList = function (rowModelType, registeredModules) {
47411 var rowModelClass = this.getRowModelClass(rowModelType, registeredModules);
47412 if (!rowModelClass) {
47413 return;
47414 }
47415 // beans should only contain SERVICES, it should NEVER contain COMPONENTS
47416 var beans = [
47417 rowModelClass, Beans, RowPositionUtils, CellPositionUtils, HeaderPositionUtils,
47418 PaginationAutoPageSizeService, GridApi, UserComponentRegistry, AgComponentUtils,
47419 ComponentMetadataProvider, ResizeObserverService, UserComponentFactory,
47420 RowContainerHeightService, HorizontalResizeService,
47421 PinnedRowModel, DragService, DisplayedGroupCreator, EventService, GridOptionsWrapper,
47422 PopupService, SelectionService, FilterManager, ColumnModel, HeaderNavigationService,
47423 PaginationProxy, RowRenderer, ExpressionService, ColumnFactory, TemplateService,
47424 AlignedGridsService, NavigationService, ValueCache, ValueService, LoggerFactory,
47425 ColumnUtils, AutoWidthCalculator, StandardMenuFactory, DragAndDropService, ColumnApi,
47426 FocusService, MouseEventService, Environment, CellNavigationService, ValueFormatterService,
47427 StylingService, ScrollVisibleService, SortController, ColumnHoverService, ColumnAnimationService,
47428 SelectableService, AutoGroupColService, ChangeDetectionService, AnimationFrameService,
47429 UndoRedoService, AgStackComponentsRegistry, ColumnDefFactory,
47430 RowCssClassCalculator, RowNodeBlockLoader, RowNodeSorter, CtrlsService,
47431 PinnedWidthService, RowNodeEventThrottle, CtrlsFactory
47432 ];
47433 var moduleBeans = this.extractModuleEntity(registeredModules, function (module) { return module.beans ? module.beans : []; });
47434 beans.push.apply(beans, __spread$d(moduleBeans));
47435 // check for duplicates, as different modules could include the same beans that
47436 // they depend on, eg ClientSideRowModel in enterprise, and ClientSideRowModel in community
47437 var beansNoDuplicates = [];
47438 beans.forEach(function (bean) {
47439 if (beansNoDuplicates.indexOf(bean) < 0) {
47440 beansNoDuplicates.push(bean);
47441 }
47442 });
47443 return beansNoDuplicates;
47444 };
47445 GridCoreCreator.prototype.extractModuleEntity = function (moduleEntities, extractor) {
47446 return [].concat.apply([], __spread$d(moduleEntities.map(extractor)));
47447 };
47448 GridCoreCreator.prototype.setColumnsAndData = function (beans) {
47449 var columnDefs = beans.gridOptionsWrapper.getColumnDefs();
47450 beans.columnModel.setColumnDefs(columnDefs || [], "gridInitializing");
47451 beans.rowModel.start();
47452 };
47453 GridCoreCreator.prototype.dispatchGridReadyEvent = function (beans, gridOptions) {
47454 var readyEvent = {
47455 type: Events.EVENT_GRID_READY,
47456 api: gridOptions.api,
47457 columnApi: gridOptions.columnApi
47458 };
47459 beans.eventService.dispatchEvent(readyEvent);
47460 };
47461 GridCoreCreator.prototype.getRowModelClass = function (rowModelType, registeredModules) {
47462 // default to client side
47463 if (!rowModelType) {
47464 rowModelType = Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
47465 }
47466 var rowModelClasses = {};
47467 registeredModules.forEach(function (module) {
47468 iterateObject(module.rowModels, function (key, value) {
47469 rowModelClasses[key] = value;
47470 });
47471 });
47472 var rowModelClass = rowModelClasses[rowModelType];
47473 if (exists(rowModelClass)) {
47474 return rowModelClass;
47475 }
47476 if (ModuleRegistry.isPackageBased()) {
47477 if ([Constants.ROW_MODEL_TYPE_VIEWPORT, Constants.ROW_MODEL_TYPE_SERVER_SIDE].includes(rowModelType))
47478 // If package based only the enterprise row models could be missing.
47479 console.error("AG Grid: Row Model \"" + rowModelType + "\" not found. Please ensure the package 'ag-grid-enterprise' is imported. Please see: https://www.ag-grid.com/javascript-grid/packages/");
47480 else {
47481 console.error('AG Grid: could not find row model for rowModelType ' + rowModelType);
47482 }
47483 }
47484 else {
47485 if (rowModelType === Constants.ROW_MODEL_TYPE_INFINITE) {
47486 console.error("AG Grid: Row Model \"Infinite\" not found. Please ensure the " + exports.ModuleNames.InfiniteRowModelModule + " module is registered. Please see: https://www.ag-grid.com/javascript-grid/modules/");
47487 }
47488 else if (rowModelType === Constants.ROW_MODEL_TYPE_VIEWPORT) {
47489 console.error("AG Grid: Row Model \"Viewport\" not found. Please ensure the AG Grid Enterprise Module " + exports.ModuleNames.ViewportRowModelModule + " module is registered. Please see: https://www.ag-grid.com/javascript-grid/modules/");
47490 }
47491 else if (rowModelType === Constants.ROW_MODEL_TYPE_SERVER_SIDE) {
47492 console.error("AG Grid: Row Model \"Server Side\" not found. Please ensure the AG Grid Enterprise Module " + exports.ModuleNames.ServerSideRowModelModule + " module is registered. Please see: https://www.ag-grid.com/javascript-grid/modules/");
47493 }
47494 else if (rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
47495 console.error("AG Grid: Row Model \"Client Side\" not found. Please ensure the " + exports.ModuleNames.ClientSideRowModelModule + " module is registered. Please see: https://www.ag-grid.com/javascript-grid/modules/");
47496 }
47497 else {
47498 console.error('AG Grid: could not find row model for rowModelType ' + rowModelType);
47499 }
47500 }
47501 };
47502 return GridCoreCreator;
47503}());
47504
47505/**
47506 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
47507 * @version v27.3.0
47508 * @link https://www.ag-grid.com/
47509 * @license MIT
47510 */
47511function defaultGroupComparator(valueA, valueB, nodeA, nodeB, accentedCompare) {
47512 if (accentedCompare === void 0) { accentedCompare = false; }
47513 console.warn('AG Grid: Since ag-grid 11.0.0 defaultGroupComparator is not necessary. You can remove this from your colDef');
47514 var nodeAIsGroup = exists(nodeA) && nodeA.group;
47515 var nodeBIsGroup = exists(nodeB) && nodeB.group;
47516 var bothAreGroups = nodeAIsGroup && nodeBIsGroup;
47517 var bothAreNormal = !nodeAIsGroup && !nodeBIsGroup;
47518 if (bothAreGroups) {
47519 return defaultComparator(nodeA.key, nodeB.key, accentedCompare);
47520 }
47521 if (bothAreNormal) {
47522 return defaultComparator(valueA, valueB, accentedCompare);
47523 }
47524 if (nodeAIsGroup) {
47525 return 1;
47526 }
47527 return -1;
47528}
47529
47530/**
47531 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
47532 * @version v27.3.0
47533 * @link https://www.ag-grid.com/
47534 * @license MIT
47535 */
47536var BaseComponentWrapper = /** @class */ (function () {
47537 function BaseComponentWrapper() {
47538 }
47539 BaseComponentWrapper.prototype.wrap = function (OriginalConstructor, mandatoryMethodList, optionalMethodList, componentType) {
47540 var _this = this;
47541 if (optionalMethodList === void 0) { optionalMethodList = []; }
47542 var wrapper = this.createWrapper(OriginalConstructor, componentType);
47543 mandatoryMethodList.forEach((function (methodName) {
47544 _this.createMethod(wrapper, methodName, true);
47545 }));
47546 optionalMethodList.forEach((function (methodName) {
47547 _this.createMethod(wrapper, methodName, false);
47548 }));
47549 return wrapper;
47550 };
47551 BaseComponentWrapper.prototype.unwrap = function (comp) {
47552 return comp;
47553 };
47554 BaseComponentWrapper.prototype.createMethod = function (wrapper, methodName, mandatory) {
47555 wrapper.addMethod(methodName, this.createMethodProxy(wrapper, methodName, mandatory));
47556 };
47557 BaseComponentWrapper.prototype.createMethodProxy = function (wrapper, methodName, mandatory) {
47558 return function () {
47559 if (wrapper.hasMethod(methodName)) {
47560 return wrapper.callMethod(methodName, arguments);
47561 }
47562 if (mandatory) {
47563 console.warn('AG Grid: Framework component is missing the method ' + methodName + '()');
47564 }
47565 return null;
47566 };
47567 };
47568 return BaseComponentWrapper;
47569}());
47570
47571/**
47572 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
47573 * @version v27.3.0
47574 * @link https://www.ag-grid.com/
47575 * @license MIT
47576 */
47577(function (BarColumnLabelPlacement) {
47578 BarColumnLabelPlacement["InsideBase"] = "insideBase";
47579 BarColumnLabelPlacement["InsideEnd"] = "insideEnd";
47580 BarColumnLabelPlacement["Center"] = "center";
47581 BarColumnLabelPlacement["OutsideEnd"] = "outsideEnd";
47582})(exports.BarColumnLabelPlacement || (exports.BarColumnLabelPlacement = {}));
47583
47584/**
47585 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
47586 * @version v27.3.0
47587 * @link https://www.ag-grid.com/
47588 * @license MIT
47589 */
47590var globalObj = typeof global === 'undefined' ? {} : global;
47591globalObj.HTMLElement = typeof HTMLElement === 'undefined' ? {} : HTMLElement;
47592globalObj.HTMLButtonElement = typeof HTMLButtonElement === 'undefined' ? {} : HTMLButtonElement;
47593globalObj.HTMLSelectElement = typeof HTMLSelectElement === 'undefined' ? {} : HTMLSelectElement;
47594globalObj.HTMLInputElement = typeof HTMLInputElement === 'undefined' ? {} : HTMLInputElement;
47595globalObj.Node = typeof Node === 'undefined' ? {} : Node;
47596globalObj.MouseEvent = typeof MouseEvent === 'undefined' ? {} : MouseEvent;
47597
47598var __read$i = (undefined && undefined.__read) || function (o, n) {
47599 var m = typeof Symbol === "function" && o[Symbol.iterator];
47600 if (!m) return o;
47601 var i = m.call(o), r, ar = [], e;
47602 try {
47603 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
47604 }
47605 catch (error) { e = { error: error }; }
47606 finally {
47607 try {
47608 if (r && !r.done && (m = i["return"])) m.call(i);
47609 }
47610 finally { if (e) throw e.error; }
47611 }
47612 return ar;
47613};
47614var __spread$e = (undefined && undefined.__spread) || function () {
47615 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$i(arguments[i]));
47616 return ar;
47617};
47618var ClientSideNodeManager = /** @class */ (function () {
47619 function ClientSideNodeManager(rootNode, gridOptionsWrapper, eventService, columnModel, gridApi, columnApi, selectionService, beans) {
47620 this.nextId = 0;
47621 // when user is provide the id's, we also keep a map of ids to row nodes for convenience
47622 this.allNodesMap = {};
47623 this.rootNode = rootNode;
47624 this.gridOptionsWrapper = gridOptionsWrapper;
47625 this.eventService = eventService;
47626 this.columnModel = columnModel;
47627 this.gridApi = gridApi;
47628 this.columnApi = columnApi;
47629 this.beans = beans;
47630 this.selectionService = selectionService;
47631 this.rootNode.group = true;
47632 this.rootNode.level = -1;
47633 this.rootNode.id = ClientSideNodeManager.ROOT_NODE_ID;
47634 this.rootNode.allLeafChildren = [];
47635 this.rootNode.childrenAfterGroup = [];
47636 this.rootNode.childrenAfterSort = [];
47637 this.rootNode.childrenAfterAggFilter = [];
47638 this.rootNode.childrenAfterFilter = [];
47639 // if we make this class a bean, then can annotate postConstruct
47640 this.postConstruct();
47641 }
47642 // @PostConstruct - this is not a bean, so postConstruct called by constructor
47643 ClientSideNodeManager.prototype.postConstruct = function () {
47644 // func below doesn't have 'this' pointer, so need to pull out these bits
47645 this.suppressParentsInRowNodes = this.gridOptionsWrapper.isSuppressParentsInRowNodes();
47646 this.isRowMasterFunc = this.gridOptionsWrapper.getIsRowMasterFunc();
47647 this.doingTreeData = this.gridOptionsWrapper.isTreeData();
47648 this.doingMasterDetail = this.gridOptionsWrapper.isMasterDetail();
47649 };
47650 ClientSideNodeManager.prototype.getCopyOfNodesMap = function () {
47651 return _.cloneObject(this.allNodesMap);
47652 };
47653 ClientSideNodeManager.prototype.getRowNode = function (id) {
47654 return this.allNodesMap[id];
47655 };
47656 ClientSideNodeManager.prototype.setRowData = function (rowData) {
47657 var _this = this;
47658 if (typeof rowData === 'string') {
47659 console.warn('AG Grid: rowData must be an array, however you passed in a string. If you are loading JSON, make sure you convert the JSON string to JavaScript objects first');
47660 return;
47661 }
47662 var rootNode = this.rootNode;
47663 var sibling = this.rootNode.sibling;
47664 rootNode.childrenAfterFilter = null;
47665 rootNode.childrenAfterGroup = null;
47666 rootNode.childrenAfterAggFilter = null;
47667 rootNode.childrenAfterSort = null;
47668 rootNode.childrenMapped = null;
47669 rootNode.updateHasChildren();
47670 this.nextId = 0;
47671 this.allNodesMap = {};
47672 if (rowData) {
47673 // we use rootNode as the parent, however if using ag-grid-enterprise, the grouping stage
47674 // sets the parent node on each row (even if we are not grouping). so setting parent node
47675 // here is for benefit of ag-grid-community users
47676 rootNode.allLeafChildren = rowData.map(function (dataItem) { return _this.createNode(dataItem, _this.rootNode, ClientSideNodeManager.TOP_LEVEL); });
47677 }
47678 else {
47679 rootNode.allLeafChildren = [];
47680 rootNode.childrenAfterGroup = [];
47681 }
47682 if (sibling) {
47683 sibling.childrenAfterFilter = rootNode.childrenAfterFilter;
47684 sibling.childrenAfterGroup = rootNode.childrenAfterGroup;
47685 sibling.childrenAfterAggFilter = rootNode.childrenAfterAggFilter;
47686 sibling.childrenAfterSort = rootNode.childrenAfterSort;
47687 sibling.childrenMapped = rootNode.childrenMapped;
47688 sibling.allLeafChildren = rootNode.allLeafChildren;
47689 }
47690 };
47691 ClientSideNodeManager.prototype.updateRowData = function (rowDataTran, rowNodeOrder) {
47692 var rowNodeTransaction = {
47693 remove: [],
47694 update: [],
47695 add: []
47696 };
47697 var nodesToUnselect = [];
47698 this.executeRemove(rowDataTran, rowNodeTransaction, nodesToUnselect);
47699 this.executeUpdate(rowDataTran, rowNodeTransaction, nodesToUnselect);
47700 this.executeAdd(rowDataTran, rowNodeTransaction);
47701 this.updateSelection(nodesToUnselect);
47702 if (rowNodeOrder) {
47703 _.sortRowNodesByOrder(this.rootNode.allLeafChildren, rowNodeOrder);
47704 }
47705 return rowNodeTransaction;
47706 };
47707 ClientSideNodeManager.prototype.updateSelection = function (nodesToUnselect) {
47708 var selectionChanged = nodesToUnselect.length > 0;
47709 if (selectionChanged) {
47710 nodesToUnselect.forEach(function (rowNode) {
47711 rowNode.setSelected(false, false, true);
47712 });
47713 }
47714 // we do this regardless of nodes to unselect or not, as it's possible
47715 // a new node was inserted, so a parent that was previously selected (as all
47716 // children were selected) should not be tri-state (as new one unselected against
47717 // all other selected children).
47718 this.selectionService.updateGroupsFromChildrenSelections();
47719 if (selectionChanged) {
47720 var event_1 = {
47721 type: Events.EVENT_SELECTION_CHANGED,
47722 api: this.gridApi,
47723 columnApi: this.columnApi
47724 };
47725 this.eventService.dispatchEvent(event_1);
47726 }
47727 };
47728 ClientSideNodeManager.prototype.executeAdd = function (rowDataTran, rowNodeTransaction) {
47729 var _this = this;
47730 var add = rowDataTran.add, addIndex = rowDataTran.addIndex;
47731 if (_.missingOrEmpty(add)) {
47732 return;
47733 }
47734 // create new row nodes for each data item
47735 var newNodes = add.map(function (item) { return _this.createNode(item, _this.rootNode, ClientSideNodeManager.TOP_LEVEL); });
47736 // add new row nodes to the root nodes 'allLeafChildren'
47737 var useIndex = typeof addIndex === 'number' && addIndex >= 0;
47738 var nodesBeforeIndex;
47739 var nodesAfterIndex;
47740 if (useIndex) {
47741 // new rows are inserted in one go by concatenating them in between the existing rows at the desired index.
47742 // this is much faster than splicing them individually into 'allLeafChildren' when there are large inserts.
47743 // allLeafChildren can be out of order, so we loop over all the Nodes to find the correct index that
47744 // represents the position `addIndex` intended to be.
47745 var allLeafChildren_1 = this.rootNode.allLeafChildren;
47746 // if addIndex is 0, it should always be added at the start of the array
47747 // there is no need to verify the order of node by nodeIndex.
47748 var normalizedAddIndex = addIndex === 0 ? 0 : (allLeafChildren_1.reduce(function (prevIdx, currNode, currIdx) {
47749 var _a;
47750 var rowIndex = currNode.rowIndex;
47751 var prevValueAtIndex = (_a = allLeafChildren_1[prevIdx]) === null || _a === void 0 ? void 0 : _a.rowIndex;
47752 var shouldUpdateIndex = rowIndex != null && prevValueAtIndex != null && rowIndex < addIndex && rowIndex > prevValueAtIndex;
47753 return shouldUpdateIndex ? currIdx : prevIdx;
47754 }, 0) + 1);
47755 nodesBeforeIndex = allLeafChildren_1.slice(0, normalizedAddIndex);
47756 nodesAfterIndex = allLeafChildren_1.slice(normalizedAddIndex, allLeafChildren_1.length);
47757 }
47758 else {
47759 nodesBeforeIndex = this.rootNode.allLeafChildren;
47760 nodesAfterIndex = [];
47761 }
47762 this.rootNode.allLeafChildren = __spread$e(nodesBeforeIndex, newNodes, nodesAfterIndex);
47763 if (this.rootNode.sibling) {
47764 this.rootNode.sibling.allLeafChildren = this.rootNode.allLeafChildren;
47765 }
47766 // add new row nodes to the transaction add items
47767 rowNodeTransaction.add = newNodes;
47768 };
47769 ClientSideNodeManager.prototype.executeRemove = function (rowDataTran, rowNodeTransaction, nodesToUnselect) {
47770 var _this = this;
47771 var remove = rowDataTran.remove;
47772 if (_.missingOrEmpty(remove)) {
47773 return;
47774 }
47775 var rowIdsRemoved = {};
47776 remove.forEach(function (item) {
47777 var rowNode = _this.lookupRowNode(item);
47778 if (!rowNode) {
47779 return;
47780 }
47781 // do delete - setting 'suppressFinishActions = true' to ensure EVENT_SELECTION_CHANGED is not raised for
47782 // each row node updated, instead it is raised once by the calling code if any selected nodes exist.
47783 if (rowNode.isSelected()) {
47784 nodesToUnselect.push(rowNode);
47785 }
47786 // so row renderer knows to fade row out (and not reposition it)
47787 rowNode.clearRowTopAndRowIndex();
47788 // NOTE: were we could remove from allLeaveChildren, however _.removeFromArray() is expensive, especially
47789 // if called multiple times (eg deleting lots of rows) and if allLeafChildren is a large list
47790 rowIdsRemoved[rowNode.id] = true;
47791 // _.removeFromArray(this.rootNode.allLeafChildren, rowNode);
47792 delete _this.allNodesMap[rowNode.id];
47793 rowNodeTransaction.remove.push(rowNode);
47794 });
47795 this.rootNode.allLeafChildren = this.rootNode.allLeafChildren.filter(function (rowNode) { return !rowIdsRemoved[rowNode.id]; });
47796 if (this.rootNode.sibling) {
47797 this.rootNode.sibling.allLeafChildren = this.rootNode.allLeafChildren;
47798 }
47799 };
47800 ClientSideNodeManager.prototype.executeUpdate = function (rowDataTran, rowNodeTransaction, nodesToUnselect) {
47801 var _this = this;
47802 var update = rowDataTran.update;
47803 if (_.missingOrEmpty(update)) {
47804 return;
47805 }
47806 update.forEach(function (item) {
47807 var rowNode = _this.lookupRowNode(item);
47808 if (!rowNode) {
47809 return;
47810 }
47811 rowNode.updateData(item);
47812 if (!rowNode.selectable && rowNode.isSelected()) {
47813 nodesToUnselect.push(rowNode);
47814 }
47815 _this.setMasterForRow(rowNode, item, ClientSideNodeManager.TOP_LEVEL, false);
47816 rowNodeTransaction.update.push(rowNode);
47817 });
47818 };
47819 ClientSideNodeManager.prototype.lookupRowNode = function (data) {
47820 var getRowIdFunc = this.gridOptionsWrapper.getRowIdFunc();
47821 var rowNode;
47822 if (getRowIdFunc) {
47823 // find rowNode using id
47824 var id = getRowIdFunc({ data: data, level: 0 });
47825 rowNode = this.allNodesMap[id];
47826 if (!rowNode) {
47827 console.error("AG Grid: could not find row id=" + id + ", data item was not found for this id");
47828 return null;
47829 }
47830 }
47831 else {
47832 // find rowNode using object references
47833 rowNode = this.rootNode.allLeafChildren.find(function (node) { return node.data === data; });
47834 if (!rowNode) {
47835 console.error("AG Grid: could not find data item as object was not found", data);
47836 console.error("Consider using getRowId to help the Grid find matching row data");
47837 return null;
47838 }
47839 }
47840 return rowNode || null;
47841 };
47842 ClientSideNodeManager.prototype.createNode = function (dataItem, parent, level) {
47843 var node = new RowNode(this.beans);
47844 node.group = false;
47845 this.setMasterForRow(node, dataItem, level, true);
47846 if (parent && !this.suppressParentsInRowNodes) {
47847 node.parent = parent;
47848 }
47849 node.level = level;
47850 node.setDataAndId(dataItem, this.nextId.toString());
47851 if (this.allNodesMap[node.id]) {
47852 console.warn("AG Grid: duplicate node id '" + node.id + "' detected from getRowId callback, this could cause issues in your grid.");
47853 }
47854 this.allNodesMap[node.id] = node;
47855 this.nextId++;
47856 return node;
47857 };
47858 ClientSideNodeManager.prototype.setMasterForRow = function (rowNode, data, level, setExpanded) {
47859 if (this.doingTreeData) {
47860 rowNode.setMaster(false);
47861 if (setExpanded) {
47862 rowNode.expanded = false;
47863 }
47864 }
47865 else {
47866 // this is the default, for when doing grid data
47867 if (this.doingMasterDetail) {
47868 // if we are doing master detail, then the
47869 // default is that everything can be a Master Row.
47870 if (this.isRowMasterFunc) {
47871 rowNode.setMaster(this.isRowMasterFunc(data));
47872 }
47873 else {
47874 rowNode.setMaster(true);
47875 }
47876 }
47877 else {
47878 rowNode.setMaster(false);
47879 }
47880 if (setExpanded) {
47881 var rowGroupColumns = this.columnModel.getRowGroupColumns();
47882 var numRowGroupColumns = rowGroupColumns ? rowGroupColumns.length : 0;
47883 // need to take row group into account when determining level
47884 var masterRowLevel = level + numRowGroupColumns;
47885 rowNode.expanded = rowNode.master ? this.isExpanded(masterRowLevel) : false;
47886 }
47887 }
47888 };
47889 ClientSideNodeManager.prototype.isExpanded = function (level) {
47890 var expandByDefault = this.gridOptionsWrapper.getGroupDefaultExpanded();
47891 if (expandByDefault === -1) {
47892 return true;
47893 }
47894 return level < expandByDefault;
47895 };
47896 ClientSideNodeManager.TOP_LEVEL = 0;
47897 ClientSideNodeManager.ROOT_NODE_ID = 'ROOT_NODE_ID';
47898 return ClientSideNodeManager;
47899}());
47900
47901var __extends$2G = (undefined && undefined.__extends) || (function () {
47902 var extendStatics = function (d, b) {
47903 extendStatics = Object.setPrototypeOf ||
47904 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
47905 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
47906 return extendStatics(d, b);
47907 };
47908 return function (d, b) {
47909 extendStatics(d, b);
47910 function __() { this.constructor = d; }
47911 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
47912 };
47913})();
47914var __decorate$2n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
47915 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
47916 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
47917 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;
47918 return c > 3 && r && Object.defineProperty(target, key, r), r;
47919};
47920var RecursionType;
47921(function (RecursionType) {
47922 RecursionType[RecursionType["Normal"] = 0] = "Normal";
47923 RecursionType[RecursionType["AfterFilter"] = 1] = "AfterFilter";
47924 RecursionType[RecursionType["AfterFilterAndSort"] = 2] = "AfterFilterAndSort";
47925 RecursionType[RecursionType["PivotNodes"] = 3] = "PivotNodes";
47926})(RecursionType || (RecursionType = {}));
47927var ClientSideRowModel = /** @class */ (function (_super) {
47928 __extends$2G(ClientSideRowModel, _super);
47929 function ClientSideRowModel() {
47930 return _super !== null && _super.apply(this, arguments) || this;
47931 }
47932 ClientSideRowModel.prototype.init = function () {
47933 var refreshEverythingFunc = this.refreshModel.bind(this, { step: exports.ClientSideRowModelSteps.EVERYTHING });
47934 var animate = !this.gridOptionsWrapper.isSuppressAnimationFrame();
47935 var refreshEverythingAfterColsChangedFunc = this.refreshModel.bind(this, {
47936 step: exports.ClientSideRowModelSteps.EVERYTHING,
47937 afterColumnsChanged: true,
47938 keepRenderedRows: true,
47939 animate: animate
47940 });
47941 this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, refreshEverythingAfterColsChangedFunc);
47942 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc);
47943 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this));
47944 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_CHANGED, this.refreshModel.bind(this, { step: exports.ClientSideRowModelSteps.PIVOT }));
47945 this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
47946 this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
47947 this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, refreshEverythingFunc);
47948 var refreshMapListener = this.refreshModel.bind(this, {
47949 step: exports.ClientSideRowModelSteps.MAP,
47950 keepRenderedRows: true,
47951 animate: animate
47952 });
47953 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, refreshMapListener);
47954 this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, refreshMapListener);
47955 this.rootNode = new RowNode(this.beans);
47956 this.nodeManager = new ClientSideNodeManager(this.rootNode, this.gridOptionsWrapper, this.eventService, this.columnModel, this.gridApi, this.columnApi, this.selectionService, this.beans);
47957 };
47958 ClientSideRowModel.prototype.start = function () {
47959 var rowData = this.gridOptionsWrapper.getRowData();
47960 if (rowData) {
47961 this.setRowData(rowData);
47962 }
47963 };
47964 ClientSideRowModel.prototype.ensureRowHeightsValid = function (startPixel, endPixel, startLimitIndex, endLimitIndex) {
47965 var atLeastOneChange;
47966 var res = false;
47967 // we do this multiple times as changing the row heights can also change the first and last rows,
47968 // so the first pass can make lots of rows smaller, which means the second pass we end up changing
47969 // more rows.
47970 do {
47971 atLeastOneChange = false;
47972 var rowAtStartPixel = this.getRowIndexAtPixel(startPixel);
47973 var rowAtEndPixel = this.getRowIndexAtPixel(endPixel);
47974 // keep check to current page if doing pagination
47975 var firstRow = Math.max(rowAtStartPixel, startLimitIndex);
47976 var lastRow = Math.min(rowAtEndPixel, endLimitIndex);
47977 for (var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++) {
47978 var rowNode = this.getRow(rowIndex);
47979 if (rowNode.rowHeightEstimated) {
47980 var rowHeight = this.gridOptionsWrapper.getRowHeightForNode(rowNode);
47981 rowNode.setRowHeight(rowHeight.height);
47982 atLeastOneChange = true;
47983 res = true;
47984 }
47985 }
47986 if (atLeastOneChange) {
47987 this.setRowTopAndRowIndex();
47988 }
47989 } while (atLeastOneChange);
47990 return res;
47991 };
47992 ClientSideRowModel.prototype.setRowTopAndRowIndex = function () {
47993 var defaultRowHeight = this.gridOptionsWrapper.getDefaultRowHeight();
47994 var nextRowTop = 0;
47995 // mapping displayed rows is not needed for this method, however it's used in
47996 // clearRowTopAndRowIndex(), and given we are looping through this.rowsToDisplay here,
47997 // we create the map here for performance reasons, so we don't loop a second time
47998 // in clearRowTopAndRowIndex()
47999 var displayedRowsMapped = new Set();
48000 // we don't estimate if doing fullHeight or autoHeight, as all rows get rendered all the time
48001 // with these two layouts.
48002 var allowEstimate = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_NORMAL;
48003 for (var i = 0; i < this.rowsToDisplay.length; i++) {
48004 var rowNode = this.rowsToDisplay[i];
48005 if (rowNode.id != null) {
48006 displayedRowsMapped.add(rowNode.id);
48007 }
48008 if (rowNode.rowHeight == null) {
48009 var rowHeight = this.gridOptionsWrapper.getRowHeightForNode(rowNode, allowEstimate, defaultRowHeight);
48010 rowNode.setRowHeight(rowHeight.height, rowHeight.estimated);
48011 }
48012 rowNode.setRowTop(nextRowTop);
48013 rowNode.setRowIndex(i);
48014 nextRowTop += rowNode.rowHeight;
48015 }
48016 return displayedRowsMapped;
48017 };
48018 ClientSideRowModel.prototype.clearRowTopAndRowIndex = function (changedPath, displayedRowsMapped) {
48019 var changedPathActive = changedPath.isActive();
48020 var clearIfNotDisplayed = function (rowNode) {
48021 if (rowNode && rowNode.id != null && !displayedRowsMapped.has(rowNode.id)) {
48022 rowNode.clearRowTopAndRowIndex();
48023 }
48024 };
48025 var recurse = function (rowNode) {
48026 clearIfNotDisplayed(rowNode);
48027 clearIfNotDisplayed(rowNode.detailNode);
48028 clearIfNotDisplayed(rowNode.sibling);
48029 if (rowNode.hasChildren()) {
48030 if (rowNode.childrenAfterGroup) {
48031 // if a changedPath is active, it means we are here because of a transaction update or
48032 // a change detection. neither of these impacts the open/closed state of groups. so if
48033 // a group is not open this time, it was not open last time. so we know all closed groups
48034 // already have their top positions cleared. so there is no need to traverse all the way
48035 // when changedPath is active and the rowNode is not expanded.
48036 var isRootNode = rowNode.level == -1; // we need to give special consideration for root node,
48037 // as expanded=undefined for root node
48038 var skipChildren = changedPathActive && !isRootNode && !rowNode.expanded;
48039 if (!skipChildren) {
48040 rowNode.childrenAfterGroup.forEach(recurse);
48041 }
48042 }
48043 }
48044 };
48045 recurse(this.rootNode);
48046 };
48047 // returns false if row was moved, otherwise true
48048 ClientSideRowModel.prototype.ensureRowsAtPixel = function (rowNodes, pixel, increment) {
48049 var _this = this;
48050 if (increment === void 0) { increment = 0; }
48051 var indexAtPixelNow = this.getRowIndexAtPixel(pixel);
48052 var rowNodeAtPixelNow = this.getRow(indexAtPixelNow);
48053 var animate = !this.gridOptionsWrapper.isSuppressAnimationFrame();
48054 if (rowNodeAtPixelNow === rowNodes[0]) {
48055 return false;
48056 }
48057 rowNodes.forEach(function (rowNode) {
48058 _.removeFromArray(_this.rootNode.allLeafChildren, rowNode);
48059 });
48060 rowNodes.forEach(function (rowNode, idx) {
48061 _.insertIntoArray(_this.rootNode.allLeafChildren, rowNode, Math.max(indexAtPixelNow + increment, 0) + idx);
48062 });
48063 this.refreshModel({
48064 step: exports.ClientSideRowModelSteps.EVERYTHING,
48065 keepRenderedRows: true,
48066 keepEditingRows: true,
48067 animate: animate
48068 });
48069 return true;
48070 };
48071 ClientSideRowModel.prototype.highlightRowAtPixel = function (rowNode, pixel) {
48072 var indexAtPixelNow = pixel != null ? this.getRowIndexAtPixel(pixel) : null;
48073 var rowNodeAtPixelNow = indexAtPixelNow != null ? this.getRow(indexAtPixelNow) : null;
48074 if (!rowNodeAtPixelNow || !rowNode || rowNodeAtPixelNow === rowNode || pixel == null) {
48075 if (this.lastHighlightedRow) {
48076 this.lastHighlightedRow.setHighlighted(null);
48077 this.lastHighlightedRow = null;
48078 }
48079 return;
48080 }
48081 var highlight = this.getHighlightPosition(pixel, rowNodeAtPixelNow);
48082 if (this.lastHighlightedRow && this.lastHighlightedRow !== rowNodeAtPixelNow) {
48083 this.lastHighlightedRow.setHighlighted(null);
48084 this.lastHighlightedRow = null;
48085 }
48086 rowNodeAtPixelNow.setHighlighted(highlight);
48087 this.lastHighlightedRow = rowNodeAtPixelNow;
48088 };
48089 ClientSideRowModel.prototype.getHighlightPosition = function (pixel, rowNode) {
48090 if (!rowNode) {
48091 var index = this.getRowIndexAtPixel(pixel);
48092 rowNode = this.getRow(index || 0);
48093 if (!rowNode) {
48094 return exports.RowHighlightPosition.Below;
48095 }
48096 }
48097 var rowTop = rowNode.rowTop, rowHeight = rowNode.rowHeight;
48098 return pixel - rowTop < rowHeight / 2 ? exports.RowHighlightPosition.Above : exports.RowHighlightPosition.Below;
48099 };
48100 ClientSideRowModel.prototype.getLastHighlightedRowNode = function () {
48101 return this.lastHighlightedRow;
48102 };
48103 ClientSideRowModel.prototype.isLastRowIndexKnown = function () {
48104 return true;
48105 };
48106 ClientSideRowModel.prototype.getRowCount = function () {
48107 if (this.rowsToDisplay) {
48108 return this.rowsToDisplay.length;
48109 }
48110 return 0;
48111 };
48112 ClientSideRowModel.prototype.getTopLevelRowCount = function () {
48113 var showingRootNode = this.rowsToDisplay && this.rowsToDisplay[0] === this.rootNode;
48114 if (showingRootNode) {
48115 return 1;
48116 }
48117 var filteredChildren = this.rootNode.childrenAfterAggFilter;
48118 return filteredChildren ? filteredChildren.length : 0;
48119 };
48120 ClientSideRowModel.prototype.getTopLevelRowDisplayedIndex = function (topLevelIndex) {
48121 var showingRootNode = this.rowsToDisplay && this.rowsToDisplay[0] === this.rootNode;
48122 if (showingRootNode) {
48123 return topLevelIndex;
48124 }
48125 var rowNode = this.rootNode.childrenAfterSort[topLevelIndex];
48126 if (this.gridOptionsWrapper.isGroupHideOpenParents()) {
48127 // if hideOpenParents, and this row open, then this row is now displayed at this index, first child is
48128 while (rowNode.expanded && rowNode.childrenAfterSort && rowNode.childrenAfterSort.length > 0) {
48129 rowNode = rowNode.childrenAfterSort[0];
48130 }
48131 }
48132 return rowNode.rowIndex;
48133 };
48134 ClientSideRowModel.prototype.getRowBounds = function (index) {
48135 if (_.missing(this.rowsToDisplay)) {
48136 return null;
48137 }
48138 var rowNode = this.rowsToDisplay[index];
48139 if (rowNode) {
48140 return {
48141 rowTop: rowNode.rowTop,
48142 rowHeight: rowNode.rowHeight
48143 };
48144 }
48145 return null;
48146 };
48147 ClientSideRowModel.prototype.onRowGroupOpened = function () {
48148 var animate = this.gridOptionsWrapper.isAnimateRows();
48149 this.refreshModel({ step: exports.ClientSideRowModelSteps.MAP, keepRenderedRows: true, animate: animate });
48150 };
48151 ClientSideRowModel.prototype.onFilterChanged = function (event) {
48152 if (event.afterDataChange) {
48153 return;
48154 }
48155 var animate = this.gridOptionsWrapper.isAnimateRows();
48156 var primaryOrQuickFilterChanged = event.columns.length === 0 || event.columns.some(function (col) { return col.isPrimary(); });
48157 var step = primaryOrQuickFilterChanged ? exports.ClientSideRowModelSteps.FILTER : exports.ClientSideRowModelSteps.FILTER_AGGREGATES;
48158 this.refreshModel({ step: step, keepRenderedRows: true, animate: animate });
48159 };
48160 ClientSideRowModel.prototype.onSortChanged = function () {
48161 var animate = this.gridOptionsWrapper.isAnimateRows();
48162 this.refreshModel({ step: exports.ClientSideRowModelSteps.SORT, keepRenderedRows: true, animate: animate, keepEditingRows: true });
48163 };
48164 ClientSideRowModel.prototype.getType = function () {
48165 return Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
48166 };
48167 ClientSideRowModel.prototype.onValueChanged = function () {
48168 if (this.columnModel.isPivotActive()) {
48169 this.refreshModel({ step: exports.ClientSideRowModelSteps.PIVOT });
48170 }
48171 else {
48172 this.refreshModel({ step: exports.ClientSideRowModelSteps.AGGREGATE });
48173 }
48174 };
48175 ClientSideRowModel.prototype.createChangePath = function (rowNodeTransactions) {
48176 // for updates, if the row is updated at all, then we re-calc all the values
48177 // in that row. we could compare each value to each old value, however if we
48178 // did this, we would be calling the valueService twice, once on the old value
48179 // and once on the new value. so it's less valueGetter calls if we just assume
48180 // each column is different. that way the changedPath is used so that only
48181 // the impacted parent rows are recalculated, parents who's children have
48182 // not changed are not impacted.
48183 var noTransactions = _.missingOrEmpty(rowNodeTransactions);
48184 var changedPath = new ChangedPath(false, this.rootNode);
48185 if (noTransactions || this.gridOptionsWrapper.isTreeData()) {
48186 changedPath.setInactive();
48187 }
48188 return changedPath;
48189 };
48190 ClientSideRowModel.prototype.isSuppressModelUpdateAfterUpdateTransaction = function (params) {
48191 if (!this.gridOptionsWrapper.isSuppressModelUpdateAfterUpdateTransaction()) {
48192 return false;
48193 }
48194 // return true if we are only doing update transactions
48195 if (params.rowNodeTransactions == null) {
48196 return false;
48197 }
48198 var transWithAddsOrDeletes = params.rowNodeTransactions.filter(function (tx) {
48199 return (tx.add != null && tx.add.length > 0) || (tx.remove != null && tx.remove.length > 0);
48200 });
48201 var transactionsContainUpdatesOnly = transWithAddsOrDeletes == null || transWithAddsOrDeletes.length == 0;
48202 return transactionsContainUpdatesOnly;
48203 };
48204 ClientSideRowModel.prototype.refreshModel = function (params) {
48205 if (this.isSuppressModelUpdateAfterUpdateTransaction(params)) {
48206 return;
48207 }
48208 // this goes through the pipeline of stages. what's in my head is similar
48209 // to the diagram on this page:
48210 // http://commons.apache.org/sandbox/commons-pipeline/pipeline_basics.html
48211 // however we want to keep the results of each stage, hence we manually call
48212 // each step rather than have them chain each other.
48213 // fallthrough in below switch is on purpose,
48214 // eg if STEP_FILTER, then all steps below this
48215 // step get done
48216 // let start: number;
48217 // console.log('======= start =======');
48218 var changedPath = this.createChangePath(params.rowNodeTransactions);
48219 switch (params.step) {
48220 case exports.ClientSideRowModelSteps.EVERYTHING:
48221 this.doRowGrouping(params.groupState, params.rowNodeTransactions, params.rowNodeOrder, changedPath, !!params.afterColumnsChanged);
48222 case exports.ClientSideRowModelSteps.FILTER:
48223 this.doFilter(changedPath);
48224 case exports.ClientSideRowModelSteps.PIVOT:
48225 this.doPivot(changedPath);
48226 case exports.ClientSideRowModelSteps.AGGREGATE: // depends on agg fields
48227 this.doAggregate(changedPath);
48228 case exports.ClientSideRowModelSteps.FILTER_AGGREGATES:
48229 this.doFilterAggregates(changedPath);
48230 case exports.ClientSideRowModelSteps.SORT:
48231 this.doSort(params.rowNodeTransactions, changedPath);
48232 case exports.ClientSideRowModelSteps.MAP:
48233 this.doRowsToDisplay();
48234 }
48235 // set all row tops to null, then set row tops on all visible rows. if we don't
48236 // do this, then the algorithm below only sets row tops, old row tops from old rows
48237 // will still lie around
48238 var displayedNodesMapped = this.setRowTopAndRowIndex();
48239 this.clearRowTopAndRowIndex(changedPath, displayedNodesMapped);
48240 var event = {
48241 type: Events.EVENT_MODEL_UPDATED,
48242 api: this.gridApi,
48243 columnApi: this.columnApi,
48244 animate: params.animate,
48245 keepRenderedRows: params.keepRenderedRows,
48246 newData: params.newData,
48247 newPage: false
48248 };
48249 this.eventService.dispatchEvent(event);
48250 };
48251 ClientSideRowModel.prototype.isEmpty = function () {
48252 var rowsMissing = _.missing(this.rootNode.allLeafChildren) || this.rootNode.allLeafChildren.length === 0;
48253 return _.missing(this.rootNode) || rowsMissing || !this.columnModel.isReady();
48254 };
48255 ClientSideRowModel.prototype.isRowsToRender = function () {
48256 return _.exists(this.rowsToDisplay) && this.rowsToDisplay.length > 0;
48257 };
48258 ClientSideRowModel.prototype.getNodesInRangeForSelection = function (firstInRange, lastInRange) {
48259 // if lastSelectedNode is missing, we start at the first row
48260 var firstRowHit = !lastInRange;
48261 var lastRowHit = false;
48262 var lastRow;
48263 var result = [];
48264 var groupsSelectChildren = this.gridOptionsWrapper.isGroupSelectsChildren();
48265 this.forEachNodeAfterFilterAndSort(function (rowNode) {
48266 var lookingForLastRow = firstRowHit && !lastRowHit;
48267 // check if we need to flip the select switch
48268 if (!firstRowHit) {
48269 if (rowNode === lastInRange || rowNode === firstInRange) {
48270 firstRowHit = true;
48271 }
48272 }
48273 var skipThisGroupNode = rowNode.group && groupsSelectChildren;
48274 if (!skipThisGroupNode) {
48275 var inRange = firstRowHit && !lastRowHit;
48276 var childOfLastRow = rowNode.isParentOfNode(lastRow);
48277 if (inRange || childOfLastRow) {
48278 result.push(rowNode);
48279 }
48280 }
48281 if (lookingForLastRow) {
48282 if (rowNode === lastInRange || rowNode === firstInRange) {
48283 lastRowHit = true;
48284 if (rowNode === lastInRange) {
48285 lastRow = lastInRange;
48286 }
48287 else {
48288 lastRow = firstInRange;
48289 }
48290 }
48291 }
48292 });
48293 return result;
48294 };
48295 ClientSideRowModel.prototype.setDatasource = function (datasource) {
48296 console.error('AG Grid: should never call setDatasource on clientSideRowController');
48297 };
48298 ClientSideRowModel.prototype.getTopLevelNodes = function () {
48299 return this.rootNode ? this.rootNode.childrenAfterGroup : null;
48300 };
48301 ClientSideRowModel.prototype.getRootNode = function () {
48302 return this.rootNode;
48303 };
48304 ClientSideRowModel.prototype.getRow = function (index) {
48305 return this.rowsToDisplay[index];
48306 };
48307 ClientSideRowModel.prototype.isRowPresent = function (rowNode) {
48308 return this.rowsToDisplay.indexOf(rowNode) >= 0;
48309 };
48310 ClientSideRowModel.prototype.getRowIndexAtPixel = function (pixelToMatch) {
48311 if (this.isEmpty()) {
48312 return -1;
48313 }
48314 // do binary search of tree
48315 // http://oli.me.uk/2013/06/08/searching-javascript-arrays-with-a-binary-search/
48316 var bottomPointer = 0;
48317 var topPointer = this.rowsToDisplay.length - 1;
48318 // quick check, if the pixel is out of bounds, then return last row
48319 if (pixelToMatch <= 0) {
48320 // if pixel is less than or equal zero, it's always the first row
48321 return 0;
48322 }
48323 var lastNode = _.last(this.rowsToDisplay);
48324 if (lastNode.rowTop <= pixelToMatch) {
48325 return this.rowsToDisplay.length - 1;
48326 }
48327 while (true) {
48328 var midPointer = Math.floor((bottomPointer + topPointer) / 2);
48329 var currentRowNode = this.rowsToDisplay[midPointer];
48330 if (this.isRowInPixel(currentRowNode, pixelToMatch)) {
48331 return midPointer;
48332 }
48333 if (currentRowNode.rowTop < pixelToMatch) {
48334 bottomPointer = midPointer + 1;
48335 }
48336 else if (currentRowNode.rowTop > pixelToMatch) {
48337 topPointer = midPointer - 1;
48338 }
48339 }
48340 };
48341 ClientSideRowModel.prototype.isRowInPixel = function (rowNode, pixelToMatch) {
48342 var topPixel = rowNode.rowTop;
48343 var bottomPixel = rowNode.rowTop + rowNode.rowHeight;
48344 var pixelInRow = topPixel <= pixelToMatch && bottomPixel > pixelToMatch;
48345 return pixelInRow;
48346 };
48347 ClientSideRowModel.prototype.forEachLeafNode = function (callback) {
48348 if (this.rootNode.allLeafChildren) {
48349 this.rootNode.allLeafChildren.forEach(function (rowNode, index) { return callback(rowNode, index); });
48350 }
48351 };
48352 ClientSideRowModel.prototype.forEachNode = function (callback) {
48353 this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterGroup, callback, RecursionType.Normal, 0);
48354 };
48355 ClientSideRowModel.prototype.forEachNodeAfterFilter = function (callback) {
48356 this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterAggFilter, callback, RecursionType.AfterFilter, 0);
48357 };
48358 ClientSideRowModel.prototype.forEachNodeAfterFilterAndSort = function (callback) {
48359 this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterSort, callback, RecursionType.AfterFilterAndSort, 0);
48360 };
48361 ClientSideRowModel.prototype.forEachPivotNode = function (callback) {
48362 this.recursivelyWalkNodesAndCallback([this.rootNode], callback, RecursionType.PivotNodes, 0);
48363 };
48364 // iterates through each item in memory, and calls the callback function
48365 // nodes - the rowNodes to traverse
48366 // callback - the user provided callback
48367 // recursion type - need this to know what child nodes to recurse, eg if looking at all nodes, or filtered notes etc
48368 // index - works similar to the index in forEach in javascript's array function
48369 ClientSideRowModel.prototype.recursivelyWalkNodesAndCallback = function (nodes, callback, recursionType, index) {
48370 if (!nodes) {
48371 return index;
48372 }
48373 for (var i = 0; i < nodes.length; i++) {
48374 var node = nodes[i];
48375 callback(node, index++);
48376 // go to the next level if it is a group
48377 if (node.hasChildren()) {
48378 // depending on the recursion type, we pick a difference set of children
48379 var nodeChildren = null;
48380 switch (recursionType) {
48381 case RecursionType.Normal:
48382 nodeChildren = node.childrenAfterGroup;
48383 break;
48384 case RecursionType.AfterFilter:
48385 nodeChildren = node.childrenAfterAggFilter;
48386 break;
48387 case RecursionType.AfterFilterAndSort:
48388 nodeChildren = node.childrenAfterSort;
48389 break;
48390 case RecursionType.PivotNodes:
48391 // for pivot, we don't go below leafGroup levels
48392 nodeChildren = !node.leafGroup ? node.childrenAfterSort : null;
48393 break;
48394 }
48395 if (nodeChildren) {
48396 index = this.recursivelyWalkNodesAndCallback(nodeChildren, callback, recursionType, index);
48397 }
48398 }
48399 }
48400 return index;
48401 };
48402 // it's possible to recompute the aggregate without doing the other parts
48403 // + gridApi.recomputeAggregates()
48404 ClientSideRowModel.prototype.doAggregate = function (changedPath) {
48405 if (this.aggregationStage) {
48406 this.aggregationStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
48407 }
48408 };
48409 ClientSideRowModel.prototype.doFilterAggregates = function (changedPath) {
48410 if (this.filterAggregatesStage) {
48411 this.filterAggregatesStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
48412 }
48413 else {
48414 // If filterAggregatesStage is undefined, then so is the grouping stage, so all children should be on the rootNode.
48415 this.rootNode.childrenAfterAggFilter = this.rootNode.childrenAfterFilter;
48416 }
48417 };
48418 // + gridApi.expandAll()
48419 // + gridApi.collapseAll()
48420 ClientSideRowModel.prototype.expandOrCollapseAll = function (expand) {
48421 var usingTreeData = this.gridOptionsWrapper.isTreeData();
48422 var usingPivotMode = this.columnModel.isPivotActive();
48423 var recursiveExpandOrCollapse = function (rowNodes) {
48424 if (!rowNodes) {
48425 return;
48426 }
48427 rowNodes.forEach(function (rowNode) {
48428 var actionRow = function () {
48429 rowNode.expanded = expand;
48430 recursiveExpandOrCollapse(rowNode.childrenAfterGroup);
48431 };
48432 if (usingTreeData) {
48433 var hasChildren = _.exists(rowNode.childrenAfterGroup);
48434 if (hasChildren) {
48435 actionRow();
48436 }
48437 return;
48438 }
48439 if (usingPivotMode) {
48440 var notLeafGroup = !rowNode.leafGroup;
48441 if (notLeafGroup) {
48442 actionRow();
48443 }
48444 return;
48445 }
48446 var isRowGroup = rowNode.group;
48447 if (isRowGroup) {
48448 actionRow();
48449 }
48450 });
48451 };
48452 if (this.rootNode) {
48453 recursiveExpandOrCollapse(this.rootNode.childrenAfterGroup);
48454 }
48455 this.refreshModel({ step: exports.ClientSideRowModelSteps.MAP });
48456 var eventSource = expand ? 'expandAll' : 'collapseAll';
48457 var event = {
48458 api: this.gridApi,
48459 columnApi: this.columnApi,
48460 type: Events.EVENT_EXPAND_COLLAPSE_ALL,
48461 source: eventSource
48462 };
48463 this.eventService.dispatchEvent(event);
48464 };
48465 ClientSideRowModel.prototype.doSort = function (rowNodeTransactions, changedPath) {
48466 this.sortStage.execute({
48467 rowNode: this.rootNode,
48468 rowNodeTransactions: rowNodeTransactions,
48469 changedPath: changedPath
48470 });
48471 };
48472 ClientSideRowModel.prototype.doRowGrouping = function (groupState, rowNodeTransactions, rowNodeOrder, changedPath, afterColumnsChanged) {
48473 if (this.groupStage) {
48474 if (rowNodeTransactions) {
48475 this.groupStage.execute({
48476 rowNode: this.rootNode,
48477 rowNodeTransactions: rowNodeTransactions,
48478 rowNodeOrder: rowNodeOrder,
48479 changedPath: changedPath
48480 });
48481 }
48482 else {
48483 this.groupStage.execute({
48484 rowNode: this.rootNode,
48485 changedPath: changedPath,
48486 afterColumnsChanged: afterColumnsChanged
48487 });
48488 // set open/closed state on groups
48489 this.restoreGroupState(groupState);
48490 }
48491 if (this.gridOptionsWrapper.isGroupSelectsChildren()) {
48492 this.selectionService.updateGroupsFromChildrenSelections(changedPath);
48493 }
48494 }
48495 else {
48496 this.rootNode.childrenAfterGroup = this.rootNode.allLeafChildren;
48497 if (this.rootNode.sibling) {
48498 this.rootNode.sibling.childrenAfterGroup = this.rootNode.childrenAfterGroup;
48499 }
48500 this.rootNode.updateHasChildren();
48501 }
48502 };
48503 ClientSideRowModel.prototype.restoreGroupState = function (groupState) {
48504 if (!groupState) {
48505 return;
48506 }
48507 _.traverseNodesWithKey(this.rootNode.childrenAfterGroup, function (node, key) {
48508 // if the group was open last time, then open it this time. however
48509 // if was not open last time, then don't touch the group, so the 'groupDefaultExpanded'
48510 // setting will take effect.
48511 if (typeof groupState[key] === 'boolean') {
48512 node.expanded = groupState[key];
48513 }
48514 });
48515 };
48516 ClientSideRowModel.prototype.doFilter = function (changedPath) {
48517 this.filterStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
48518 };
48519 ClientSideRowModel.prototype.doPivot = function (changedPath) {
48520 if (this.pivotStage) {
48521 this.pivotStage.execute({ rowNode: this.rootNode, changedPath: changedPath });
48522 }
48523 };
48524 ClientSideRowModel.prototype.getGroupState = function () {
48525 if (!this.rootNode.childrenAfterGroup || !this.gridOptionsWrapper.isRememberGroupStateWhenNewData()) {
48526 return null;
48527 }
48528 var result = {};
48529 _.traverseNodesWithKey(this.rootNode.childrenAfterGroup, function (node, key) { return result[key] = node.expanded; });
48530 return result;
48531 };
48532 ClientSideRowModel.prototype.getCopyOfNodesMap = function () {
48533 return this.nodeManager.getCopyOfNodesMap();
48534 };
48535 ClientSideRowModel.prototype.getRowNode = function (id) {
48536 // although id is typed a string, this could be called by the user, and they could have passed a number
48537 var idIsGroup = typeof id == 'string' && id.indexOf(RowNode.ID_PREFIX_ROW_GROUP) == 0;
48538 if (idIsGroup) {
48539 // only one users complained about getRowNode not working for groups, after years of
48540 // this working for normal rows. so have done quick implementation. if users complain
48541 // about performance, then GroupStage should store / manage created groups in a map,
48542 // which is a chunk of work.
48543 var res_1 = undefined;
48544 this.forEachNode(function (node) {
48545 if (node.id === id) {
48546 res_1 = node;
48547 }
48548 });
48549 return res_1;
48550 }
48551 return this.nodeManager.getRowNode(id);
48552 };
48553 // rows: the rows to put into the model
48554 ClientSideRowModel.prototype.setRowData = function (rowData) {
48555 // no need to invalidate cache, as the cache is stored on the rowNode,
48556 // so new rowNodes means the cache is wiped anyway.
48557 // remember group state, so we can expand groups that should be expanded
48558 var groupState = this.getGroupState();
48559 this.nodeManager.setRowData(rowData);
48560 // - clears selection
48561 this.selectionService.reset();
48562 // - updates filters
48563 this.filterManager.onNewRowsLoaded('rowDataUpdated');
48564 // this event kicks off:
48565 // - shows 'no rows' overlay if needed
48566 var rowDataChangedEvent = {
48567 type: Events.EVENT_ROW_DATA_CHANGED,
48568 api: this.gridApi,
48569 columnApi: this.columnApi
48570 };
48571 this.eventService.dispatchEvent(rowDataChangedEvent);
48572 this.refreshModel({
48573 step: exports.ClientSideRowModelSteps.EVERYTHING,
48574 groupState: groupState,
48575 newData: true
48576 });
48577 };
48578 ClientSideRowModel.prototype.batchUpdateRowData = function (rowDataTransaction, callback) {
48579 var _this = this;
48580 if (this.applyAsyncTransactionsTimeout == null) {
48581 this.rowDataTransactionBatch = [];
48582 var waitMillis = this.gridOptionsWrapper.getAsyncTransactionWaitMillis();
48583 this.applyAsyncTransactionsTimeout = window.setTimeout(function () {
48584 _this.executeBatchUpdateRowData();
48585 }, waitMillis);
48586 }
48587 this.rowDataTransactionBatch.push({ rowDataTransaction: rowDataTransaction, callback: callback });
48588 };
48589 ClientSideRowModel.prototype.flushAsyncTransactions = function () {
48590 if (this.applyAsyncTransactionsTimeout != null) {
48591 clearTimeout(this.applyAsyncTransactionsTimeout);
48592 this.executeBatchUpdateRowData();
48593 }
48594 };
48595 ClientSideRowModel.prototype.executeBatchUpdateRowData = function () {
48596 var _this = this;
48597 this.valueCache.onDataChanged();
48598 var callbackFuncsBound = [];
48599 var rowNodeTrans = [];
48600 // The rowGroup stage uses rowNodeOrder if order was provided. if we didn't pass 'true' to
48601 // commonUpdateRowData, using addIndex would have no effect when grouping.
48602 var forceRowNodeOrder = false;
48603 if (this.rowDataTransactionBatch) {
48604 this.rowDataTransactionBatch.forEach(function (tranItem) {
48605 var rowNodeTran = _this.nodeManager.updateRowData(tranItem.rowDataTransaction, undefined);
48606 rowNodeTrans.push(rowNodeTran);
48607 if (tranItem.callback) {
48608 callbackFuncsBound.push(tranItem.callback.bind(null, rowNodeTran));
48609 }
48610 if (typeof tranItem.rowDataTransaction.addIndex === 'number') {
48611 forceRowNodeOrder = true;
48612 }
48613 });
48614 }
48615 this.commonUpdateRowData(rowNodeTrans, undefined, forceRowNodeOrder);
48616 // do callbacks in next VM turn so it's async
48617 if (callbackFuncsBound.length > 0) {
48618 window.setTimeout(function () {
48619 callbackFuncsBound.forEach(function (func) { return func(); });
48620 }, 0);
48621 }
48622 if (rowNodeTrans.length > 0) {
48623 var event_1 = {
48624 api: this.gridOptionsWrapper.getApi(),
48625 columnApi: this.gridOptionsWrapper.getColumnApi(),
48626 type: Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,
48627 results: rowNodeTrans
48628 };
48629 this.eventService.dispatchEvent(event_1);
48630 }
48631 this.rowDataTransactionBatch = null;
48632 this.applyAsyncTransactionsTimeout = undefined;
48633 };
48634 ClientSideRowModel.prototype.updateRowData = function (rowDataTran, rowNodeOrder) {
48635 this.valueCache.onDataChanged();
48636 var rowNodeTran = this.nodeManager.updateRowData(rowDataTran, rowNodeOrder);
48637 // if doing immutableData, addIndex is never present. however if doing standard transaction, and user
48638 // provided addIndex, then this is used in updateRowData. However if doing Enterprise, then the rowGroup
48639 // stage also uses the
48640 var forceRowNodeOrder = typeof rowDataTran.addIndex === 'number';
48641 this.commonUpdateRowData([rowNodeTran], rowNodeOrder, forceRowNodeOrder);
48642 return rowNodeTran;
48643 };
48644 ClientSideRowModel.prototype.createRowNodeOrder = function () {
48645 var suppressSortOrder = this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder();
48646 if (suppressSortOrder) {
48647 return;
48648 }
48649 var orderMap = {};
48650 if (this.rootNode && this.rootNode.allLeafChildren) {
48651 for (var index = 0; index < this.rootNode.allLeafChildren.length; index++) {
48652 var node = this.rootNode.allLeafChildren[index];
48653 orderMap[node.id] = index;
48654 }
48655 }
48656 return orderMap;
48657 };
48658 // common to updateRowData and batchUpdateRowData
48659 ClientSideRowModel.prototype.commonUpdateRowData = function (rowNodeTrans, rowNodeOrder, forceRowNodeOrder) {
48660 var animate = !this.gridOptionsWrapper.isSuppressAnimationFrame();
48661 if (forceRowNodeOrder) {
48662 rowNodeOrder = this.createRowNodeOrder();
48663 }
48664 this.refreshModel({
48665 step: exports.ClientSideRowModelSteps.EVERYTHING,
48666 rowNodeTransactions: rowNodeTrans,
48667 rowNodeOrder: rowNodeOrder,
48668 keepRenderedRows: true,
48669 keepEditingRows: true,
48670 animate: animate
48671 });
48672 var event = {
48673 type: Events.EVENT_ROW_DATA_UPDATED,
48674 api: this.gridApi,
48675 columnApi: this.columnApi
48676 };
48677 this.eventService.dispatchEvent(event);
48678 };
48679 ClientSideRowModel.prototype.doRowsToDisplay = function () {
48680 this.rowsToDisplay = this.flattenStage.execute({ rowNode: this.rootNode });
48681 };
48682 ClientSideRowModel.prototype.onRowHeightChanged = function () {
48683 this.refreshModel({ step: exports.ClientSideRowModelSteps.MAP, keepRenderedRows: true, keepEditingRows: true });
48684 };
48685 ClientSideRowModel.prototype.resetRowHeights = function () {
48686 var atLeastOne = false;
48687 this.forEachNode(function (rowNode) {
48688 rowNode.setRowHeight(rowNode.rowHeight, true);
48689 // we keep the height each row is at, however we set estimated=true rather than clear the height.
48690 // this means the grid will not reset the row heights back to defaults, rather it will re-calc
48691 // the height for each row as the row is displayed. otherwise the scroll will jump when heights are reset.
48692 var detailNode = rowNode.detailNode;
48693 if (detailNode) {
48694 detailNode.setRowHeight(detailNode.rowHeight, true);
48695 }
48696 atLeastOne = true;
48697 });
48698 if (atLeastOne) {
48699 this.onRowHeightChanged();
48700 }
48701 };
48702 __decorate$2n([
48703 Autowired('columnModel')
48704 ], ClientSideRowModel.prototype, "columnModel", void 0);
48705 __decorate$2n([
48706 Autowired('selectionService')
48707 ], ClientSideRowModel.prototype, "selectionService", void 0);
48708 __decorate$2n([
48709 Autowired('filterManager')
48710 ], ClientSideRowModel.prototype, "filterManager", void 0);
48711 __decorate$2n([
48712 Autowired('valueCache')
48713 ], ClientSideRowModel.prototype, "valueCache", void 0);
48714 __decorate$2n([
48715 Autowired('columnApi')
48716 ], ClientSideRowModel.prototype, "columnApi", void 0);
48717 __decorate$2n([
48718 Autowired('gridApi')
48719 ], ClientSideRowModel.prototype, "gridApi", void 0);
48720 __decorate$2n([
48721 Autowired('animationFrameService')
48722 ], ClientSideRowModel.prototype, "animationFrameService", void 0);
48723 __decorate$2n([
48724 Autowired('beans')
48725 ], ClientSideRowModel.prototype, "beans", void 0);
48726 __decorate$2n([
48727 Autowired('filterStage')
48728 ], ClientSideRowModel.prototype, "filterStage", void 0);
48729 __decorate$2n([
48730 Autowired('sortStage')
48731 ], ClientSideRowModel.prototype, "sortStage", void 0);
48732 __decorate$2n([
48733 Autowired('flattenStage')
48734 ], ClientSideRowModel.prototype, "flattenStage", void 0);
48735 __decorate$2n([
48736 Optional('groupStage')
48737 ], ClientSideRowModel.prototype, "groupStage", void 0);
48738 __decorate$2n([
48739 Optional('aggregationStage')
48740 ], ClientSideRowModel.prototype, "aggregationStage", void 0);
48741 __decorate$2n([
48742 Optional('pivotStage')
48743 ], ClientSideRowModel.prototype, "pivotStage", void 0);
48744 __decorate$2n([
48745 Optional('filterAggregatesStage')
48746 ], ClientSideRowModel.prototype, "filterAggregatesStage", void 0);
48747 __decorate$2n([
48748 PostConstruct
48749 ], ClientSideRowModel.prototype, "init", null);
48750 ClientSideRowModel = __decorate$2n([
48751 Bean('rowModel')
48752 ], ClientSideRowModel);
48753 return ClientSideRowModel;
48754}(BeanStub));
48755
48756var __extends$2H = (undefined && undefined.__extends) || (function () {
48757 var extendStatics = function (d, b) {
48758 extendStatics = Object.setPrototypeOf ||
48759 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
48760 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
48761 return extendStatics(d, b);
48762 };
48763 return function (d, b) {
48764 extendStatics(d, b);
48765 function __() { this.constructor = d; }
48766 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
48767 };
48768})();
48769var __decorate$2o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
48770 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
48771 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
48772 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;
48773 return c > 3 && r && Object.defineProperty(target, key, r), r;
48774};
48775var FilterStage = /** @class */ (function (_super) {
48776 __extends$2H(FilterStage, _super);
48777 function FilterStage() {
48778 return _super !== null && _super.apply(this, arguments) || this;
48779 }
48780 FilterStage.prototype.execute = function (params) {
48781 var changedPath = params.changedPath;
48782 this.filterService.filter(changedPath);
48783 };
48784 __decorate$2o([
48785 Autowired('filterService')
48786 ], FilterStage.prototype, "filterService", void 0);
48787 FilterStage = __decorate$2o([
48788 Bean('filterStage')
48789 ], FilterStage);
48790 return FilterStage;
48791}(BeanStub));
48792
48793var __extends$2I = (undefined && undefined.__extends) || (function () {
48794 var extendStatics = function (d, b) {
48795 extendStatics = Object.setPrototypeOf ||
48796 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
48797 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
48798 return extendStatics(d, b);
48799 };
48800 return function (d, b) {
48801 extendStatics(d, b);
48802 function __() { this.constructor = d; }
48803 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
48804 };
48805})();
48806var __decorate$2p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
48807 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
48808 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
48809 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;
48810 return c > 3 && r && Object.defineProperty(target, key, r), r;
48811};
48812var SortStage = /** @class */ (function (_super) {
48813 __extends$2I(SortStage, _super);
48814 function SortStage() {
48815 return _super !== null && _super.apply(this, arguments) || this;
48816 }
48817 SortStage.prototype.execute = function (params) {
48818 var sortOptions = this.sortController.getSortOptions();
48819 var sortActive = _.exists(sortOptions) && sortOptions.length > 0;
48820 var deltaSort = sortActive
48821 && _.exists(params.rowNodeTransactions)
48822 // in time we can remove this check, so that delta sort is always
48823 // on if transactions are present. it's off for now so that we can
48824 // selectively turn it on and test it with some select users before
48825 // rolling out to everyone.
48826 && this.gridOptionsWrapper.isDeltaSort();
48827 var sortContainsGroupColumns = sortOptions.some(function (opt) { return !!opt.column.getColDef().showRowGroup; });
48828 this.sortService.sort(sortOptions, sortActive, deltaSort, params.rowNodeTransactions, params.changedPath, sortContainsGroupColumns);
48829 };
48830 __decorate$2p([
48831 Autowired('sortService')
48832 ], SortStage.prototype, "sortService", void 0);
48833 __decorate$2p([
48834 Autowired('sortController')
48835 ], SortStage.prototype, "sortController", void 0);
48836 __decorate$2p([
48837 Autowired('columnModel')
48838 ], SortStage.prototype, "columnModel", void 0);
48839 SortStage = __decorate$2p([
48840 Bean('sortStage')
48841 ], SortStage);
48842 return SortStage;
48843}(BeanStub));
48844
48845var __extends$2J = (undefined && undefined.__extends) || (function () {
48846 var extendStatics = function (d, b) {
48847 extendStatics = Object.setPrototypeOf ||
48848 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
48849 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
48850 return extendStatics(d, b);
48851 };
48852 return function (d, b) {
48853 extendStatics(d, b);
48854 function __() { this.constructor = d; }
48855 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
48856 };
48857})();
48858var __decorate$2q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
48859 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
48860 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
48861 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;
48862 return c > 3 && r && Object.defineProperty(target, key, r), r;
48863};
48864var FlattenStage = /** @class */ (function (_super) {
48865 __extends$2J(FlattenStage, _super);
48866 function FlattenStage() {
48867 return _super !== null && _super.apply(this, arguments) || this;
48868 }
48869 FlattenStage.prototype.execute = function (params) {
48870 var rootNode = params.rowNode;
48871 // even if not doing grouping, we do the mapping, as the client might
48872 // of passed in data that already has a grouping in it somewhere
48873 var result = [];
48874 // putting value into a wrapper so it's passed by reference
48875 var nextRowTop = { value: 0 };
48876 var skipLeafNodes = this.columnModel.isPivotMode();
48877 // if we are reducing, and not grouping, then we want to show the root node, as that
48878 // is where the pivot values are
48879 var showRootNode = skipLeafNodes && rootNode.leafGroup;
48880 var topList = showRootNode ? [rootNode] : rootNode.childrenAfterSort;
48881 this.recursivelyAddToRowsToDisplay(topList, result, nextRowTop, skipLeafNodes, 0);
48882 // we do not want the footer total if the gris is empty
48883 var atLeastOneRowPresent = result.length > 0;
48884 var includeGroupTotalFooter = !showRootNode
48885 // don't show total footer when showRootNode is true (i.e. in pivot mode and no groups)
48886 && atLeastOneRowPresent
48887 && this.gridOptionsWrapper.isGroupIncludeTotalFooter();
48888 if (includeGroupTotalFooter) {
48889 this.ensureFooterNodeExists(rootNode);
48890 this.addRowNodeToRowsToDisplay(rootNode.sibling, result, nextRowTop, 0);
48891 }
48892 return result;
48893 };
48894 FlattenStage.prototype.recursivelyAddToRowsToDisplay = function (rowsToFlatten, result, nextRowTop, skipLeafNodes, uiLevel) {
48895 if (_.missingOrEmpty(rowsToFlatten)) {
48896 return;
48897 }
48898 var hideOpenParents = this.gridOptionsWrapper.isGroupHideOpenParents();
48899 // these two are mutually exclusive, so if first set, we don't set the second
48900 var groupRemoveSingleChildren = this.gridOptionsWrapper.isGroupRemoveSingleChildren();
48901 var groupRemoveLowestSingleChildren = !groupRemoveSingleChildren && this.gridOptionsWrapper.isGroupRemoveLowestSingleChildren();
48902 for (var i = 0; i < rowsToFlatten.length; i++) {
48903 var rowNode = rowsToFlatten[i];
48904 // check all these cases, for working out if this row should be included in the final mapped list
48905 var isParent = rowNode.hasChildren();
48906 var isSkippedLeafNode = skipLeafNodes && !isParent;
48907 var isRemovedSingleChildrenGroup = groupRemoveSingleChildren &&
48908 isParent &&
48909 rowNode.childrenAfterGroup.length === 1;
48910 var isRemovedLowestSingleChildrenGroup = groupRemoveLowestSingleChildren &&
48911 isParent &&
48912 rowNode.leafGroup &&
48913 rowNode.childrenAfterGroup.length === 1;
48914 // hide open parents means when group is open, we don't show it. we also need to make sure the
48915 // group is expandable in the first place (as leaf groups are not expandable if pivot mode is on).
48916 // the UI will never allow expanding leaf groups, however the user might via the API (or menu option 'expand all')
48917 var neverAllowToExpand = skipLeafNodes && rowNode.leafGroup;
48918 var isHiddenOpenParent = hideOpenParents && rowNode.expanded && !rowNode.master && (!neverAllowToExpand);
48919 var thisRowShouldBeRendered = !isSkippedLeafNode && !isHiddenOpenParent &&
48920 !isRemovedSingleChildrenGroup && !isRemovedLowestSingleChildrenGroup;
48921 if (thisRowShouldBeRendered) {
48922 this.addRowNodeToRowsToDisplay(rowNode, result, nextRowTop, uiLevel);
48923 }
48924 // if we are pivoting, we never map below the leaf group
48925 if (skipLeafNodes && rowNode.leafGroup) {
48926 continue;
48927 }
48928 if (isParent) {
48929 var excludedParent = isRemovedSingleChildrenGroup || isRemovedLowestSingleChildrenGroup;
48930 // we traverse the group if it is expended, however we always traverse if the parent node
48931 // was removed (as the group will never be opened if it is not displayed, we show the children instead)
48932 if (rowNode.expanded || excludedParent) {
48933 // if the parent was excluded, then ui level is that of the parent
48934 var uiLevelForChildren = excludedParent ? uiLevel : uiLevel + 1;
48935 this.recursivelyAddToRowsToDisplay(rowNode.childrenAfterSort, result, nextRowTop, skipLeafNodes, uiLevelForChildren);
48936 // put a footer in if user is looking for it
48937 if (this.gridOptionsWrapper.isGroupIncludeFooter()) {
48938 this.ensureFooterNodeExists(rowNode);
48939 this.addRowNodeToRowsToDisplay(rowNode.sibling, result, nextRowTop, uiLevel);
48940 }
48941 }
48942 }
48943 else if (rowNode.master && rowNode.expanded) {
48944 var detailNode = this.createDetailNode(rowNode);
48945 this.addRowNodeToRowsToDisplay(detailNode, result, nextRowTop, uiLevel);
48946 }
48947 }
48948 };
48949 // duplicated method, it's also in floatingRowModel
48950 FlattenStage.prototype.addRowNodeToRowsToDisplay = function (rowNode, result, nextRowTop, uiLevel) {
48951 var isGroupMultiAutoColumn = this.gridOptionsWrapper.isGroupMultiAutoColumn();
48952 result.push(rowNode);
48953 rowNode.setUiLevel(isGroupMultiAutoColumn ? 0 : uiLevel);
48954 };
48955 FlattenStage.prototype.ensureFooterNodeExists = function (groupNode) {
48956 // only create footer node once, otherwise we have daemons and
48957 // the animate screws up with the daemons hanging around
48958 if (_.exists(groupNode.sibling)) {
48959 return;
48960 }
48961 var footerNode = new RowNode(this.beans);
48962 Object.keys(groupNode).forEach(function (key) {
48963 footerNode[key] = groupNode[key];
48964 });
48965 footerNode.footer = true;
48966 footerNode.setRowTop(null);
48967 footerNode.setRowIndex(null);
48968 // manually set oldRowTop to null so we discard any
48969 // previous information about its position.
48970 footerNode.oldRowTop = null;
48971 if (_.exists(footerNode.id)) {
48972 footerNode.id = 'rowGroupFooter_' + footerNode.id;
48973 }
48974 // get both header and footer to reference each other as siblings. this is never undone,
48975 // only overwritten. so if a group is expanded, then contracted, it will have a ghost
48976 // sibling - but that's fine, as we can ignore this if the header is contracted.
48977 footerNode.sibling = groupNode;
48978 groupNode.sibling = footerNode;
48979 };
48980 FlattenStage.prototype.createDetailNode = function (masterNode) {
48981 if (_.exists(masterNode.detailNode)) {
48982 return masterNode.detailNode;
48983 }
48984 var detailNode = new RowNode(this.beans);
48985 detailNode.detail = true;
48986 detailNode.selectable = false;
48987 detailNode.parent = masterNode;
48988 if (_.exists(masterNode.id)) {
48989 detailNode.id = 'detail_' + masterNode.id;
48990 }
48991 detailNode.data = masterNode.data;
48992 detailNode.level = masterNode.level + 1;
48993 masterNode.detailNode = detailNode;
48994 return detailNode;
48995 };
48996 __decorate$2q([
48997 Autowired('columnModel')
48998 ], FlattenStage.prototype, "columnModel", void 0);
48999 __decorate$2q([
49000 Autowired('beans')
49001 ], FlattenStage.prototype, "beans", void 0);
49002 FlattenStage = __decorate$2q([
49003 Bean('flattenStage')
49004 ], FlattenStage);
49005 return FlattenStage;
49006}(BeanStub));
49007
49008var __extends$2K = (undefined && undefined.__extends) || (function () {
49009 var extendStatics = function (d, b) {
49010 extendStatics = Object.setPrototypeOf ||
49011 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
49012 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
49013 return extendStatics(d, b);
49014 };
49015 return function (d, b) {
49016 extendStatics(d, b);
49017 function __() { this.constructor = d; }
49018 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49019 };
49020})();
49021var __decorate$2r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
49022 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
49023 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
49024 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;
49025 return c > 3 && r && Object.defineProperty(target, key, r), r;
49026};
49027var SortService = /** @class */ (function (_super) {
49028 __extends$2K(SortService, _super);
49029 function SortService() {
49030 return _super !== null && _super.apply(this, arguments) || this;
49031 }
49032 SortService.prototype.init = function () {
49033 this.postSortFunc = this.gridOptionsWrapper.getPostSortFunc();
49034 };
49035 SortService.prototype.sort = function (sortOptions, sortActive, useDeltaSort, rowNodeTransactions, changedPath, sortContainsGroupColumns) {
49036 var _this = this;
49037 var groupMaintainOrder = this.gridOptionsWrapper.isGroupMaintainOrder();
49038 var groupColumnsPresent = this.columnModel.getAllGridColumns().some(function (c) { return c.isRowGroupActive(); });
49039 var allDirtyNodes = {};
49040 if (useDeltaSort && rowNodeTransactions) {
49041 allDirtyNodes = this.calculateDirtyNodes(rowNodeTransactions);
49042 }
49043 var isPivotMode = this.columnModel.isPivotMode();
49044 var callback = function (rowNode) {
49045 // we clear out the 'pull down open parents' first, as the values mix up the sorting
49046 _this.pullDownGroupDataForHideOpenParents(rowNode.childrenAfterAggFilter, true);
49047 // It's pointless to sort rows which aren't being displayed. in pivot mode we don't need to sort the leaf group children.
49048 var skipSortingPivotLeafs = isPivotMode && rowNode.leafGroup;
49049 // Javascript sort is non deterministic when all the array items are equals, ie Comparator always returns 0,
49050 // so to ensure the array keeps its order, add an additional sorting condition manually, in this case we
49051 // are going to inspect the original array position. This is what sortedRowNodes is for.
49052 var skipSortingGroups = groupMaintainOrder && groupColumnsPresent && !rowNode.leafGroup && !sortContainsGroupColumns;
49053 if (!sortActive || skipSortingGroups || skipSortingPivotLeafs) {
49054 // when 'groupMaintainOrder' is enabled we skip sorting groups unless we are sorting on group columns
49055 var childrenToBeSorted = rowNode.childrenAfterAggFilter.slice(0);
49056 if (groupMaintainOrder && rowNode.childrenAfterSort) {
49057 var indexedOrders_1 = rowNode.childrenAfterSort.reduce(function (acc, row, idx) {
49058 acc[row.id] = idx;
49059 return acc;
49060 }, {});
49061 childrenToBeSorted.sort(function (row1, row2) { return (indexedOrders_1[row1.id] || 0) - (indexedOrders_1[row2.id] || 0); });
49062 }
49063 rowNode.childrenAfterSort = childrenToBeSorted;
49064 }
49065 else if (useDeltaSort) {
49066 rowNode.childrenAfterSort = _this.doDeltaSort(rowNode, allDirtyNodes, changedPath, sortOptions);
49067 }
49068 else {
49069 rowNode.childrenAfterSort = _this.rowNodeSorter.doFullSort(rowNode.childrenAfterAggFilter, sortOptions);
49070 }
49071 if (rowNode.sibling) {
49072 rowNode.sibling.childrenAfterSort = rowNode.childrenAfterSort;
49073 }
49074 _this.updateChildIndexes(rowNode);
49075 if (_this.postSortFunc) {
49076 var params = { nodes: rowNode.childrenAfterSort };
49077 _this.postSortFunc(params);
49078 }
49079 };
49080 if (changedPath) {
49081 changedPath.forEachChangedNodeDepthFirst(callback);
49082 }
49083 this.updateGroupDataForHideOpenParents(changedPath);
49084 };
49085 SortService.prototype.calculateDirtyNodes = function (rowNodeTransactions) {
49086 var dirtyNodes = {};
49087 var addNodesFunc = function (rowNodes) {
49088 if (rowNodes) {
49089 rowNodes.forEach(function (rowNode) { return dirtyNodes[rowNode.id] = true; });
49090 }
49091 };
49092 // all leaf level nodes in the transaction were impacted
49093 if (rowNodeTransactions) {
49094 rowNodeTransactions.forEach(function (tran) {
49095 addNodesFunc(tran.add);
49096 addNodesFunc(tran.update);
49097 addNodesFunc(tran.remove);
49098 });
49099 }
49100 return dirtyNodes;
49101 };
49102 SortService.prototype.doDeltaSort = function (rowNode, allTouchedNodes, changedPath, sortOptions) {
49103 var _this = this;
49104 var unsortedRows = rowNode.childrenAfterAggFilter;
49105 var oldSortedRows = rowNode.childrenAfterSort;
49106 if (!oldSortedRows) {
49107 return this.rowNodeSorter.doFullSort(unsortedRows, sortOptions);
49108 }
49109 var untouchedRowsMap = {};
49110 var touchedRows = [];
49111 unsortedRows.forEach(function (row) {
49112 if (allTouchedNodes[row.id] || !changedPath.canSkip(row)) {
49113 touchedRows.push(row);
49114 }
49115 else {
49116 untouchedRowsMap[row.id] = true;
49117 }
49118 });
49119 var sortedUntouchedRows = oldSortedRows.filter(function (child) { return untouchedRowsMap[child.id]; });
49120 var mapNodeToSortedNode = function (rowNode, pos) { return ({ currentPos: pos, rowNode: rowNode }); };
49121 var sortedChangedRows = touchedRows
49122 .map(mapNodeToSortedNode)
49123 .sort(function (a, b) { return _this.rowNodeSorter.compareRowNodes(sortOptions, a, b); });
49124 return this.mergeSortedArrays(sortOptions, sortedChangedRows, sortedUntouchedRows.map(mapNodeToSortedNode)).map(function (_a) {
49125 var rowNode = _a.rowNode;
49126 return rowNode;
49127 });
49128 };
49129 // Merge two sorted arrays into each other
49130 SortService.prototype.mergeSortedArrays = function (sortOptions, arr1, arr2) {
49131 var res = [];
49132 var i = 0;
49133 var j = 0;
49134 // Traverse both array, adding them in order
49135 while (i < arr1.length && j < arr2.length) {
49136 // Check if current element of first
49137 // array is smaller than current element
49138 // of second array. If yes, store first
49139 // array element and increment first array
49140 // index. Otherwise do same with second array
49141 var compareResult = this.rowNodeSorter.compareRowNodes(sortOptions, arr1[i], arr2[j]);
49142 if (compareResult < 0) {
49143 res.push(arr1[i++]);
49144 }
49145 else {
49146 res.push(arr2[j++]);
49147 }
49148 }
49149 // add remaining from arr1
49150 while (i < arr1.length) {
49151 res.push(arr1[i++]);
49152 }
49153 // add remaining from arr2
49154 while (j < arr2.length) {
49155 res.push(arr2[j++]);
49156 }
49157 return res;
49158 };
49159 SortService.prototype.updateChildIndexes = function (rowNode) {
49160 if (_.missing(rowNode.childrenAfterSort)) {
49161 return;
49162 }
49163 var listToSort = rowNode.childrenAfterSort;
49164 for (var i = 0; i < listToSort.length; i++) {
49165 var child = listToSort[i];
49166 var firstChild = i === 0;
49167 var lastChild = i === rowNode.childrenAfterSort.length - 1;
49168 child.setFirstChild(firstChild);
49169 child.setLastChild(lastChild);
49170 child.setChildIndex(i);
49171 }
49172 };
49173 SortService.prototype.updateGroupDataForHideOpenParents = function (changedPath) {
49174 var _this = this;
49175 if (!this.gridOptionsWrapper.isGroupHideOpenParents()) {
49176 return;
49177 }
49178 if (this.gridOptionsWrapper.isTreeData()) {
49179 var msg_1 = "AG Grid: The property hideOpenParents dose not work with Tree Data. This is because Tree Data has values at the group level, it doesn't make sense to hide them (as opposed to Row Grouping, which only has Aggregated Values at the group level).";
49180 _.doOnce(function () { return console.warn(msg_1); }, 'sortService.hideOpenParentsWithTreeData');
49181 return false;
49182 }
49183 // recurse breadth first over group nodes after sort to 'pull down' group data to child groups
49184 var callback = function (rowNode) {
49185 _this.pullDownGroupDataForHideOpenParents(rowNode.childrenAfterSort, false);
49186 rowNode.childrenAfterSort.forEach(function (child) {
49187 if (child.hasChildren()) {
49188 callback(child);
49189 }
49190 });
49191 };
49192 if (changedPath) {
49193 changedPath.executeFromRootNode(function (rowNode) { return callback(rowNode); });
49194 }
49195 };
49196 SortService.prototype.pullDownGroupDataForHideOpenParents = function (rowNodes, clearOperation) {
49197 var _this = this;
49198 if (!this.gridOptionsWrapper.isGroupHideOpenParents() || _.missing(rowNodes)) {
49199 return;
49200 }
49201 rowNodes.forEach(function (childRowNode) {
49202 var groupDisplayCols = _this.columnModel.getGroupDisplayColumns();
49203 groupDisplayCols.forEach(function (groupDisplayCol) {
49204 var showRowGroup = groupDisplayCol.getColDef().showRowGroup;
49205 if (typeof showRowGroup !== 'string') {
49206 console.error('AG Grid: groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup');
49207 return;
49208 }
49209 var displayingGroupKey = showRowGroup;
49210 var rowGroupColumn = _this.columnModel.getPrimaryColumn(displayingGroupKey);
49211 var thisRowNodeMatches = rowGroupColumn === childRowNode.rowGroupColumn;
49212 if (thisRowNodeMatches) {
49213 return;
49214 }
49215 if (clearOperation) {
49216 // if doing a clear operation, we clear down the value for every possible group column
49217 childRowNode.setGroupValue(groupDisplayCol.getId(), undefined);
49218 }
49219 else {
49220 // if doing a set operation, we set only where the pull down is to occur
49221 var parentToStealFrom = childRowNode.getFirstChildOfFirstChild(rowGroupColumn);
49222 if (parentToStealFrom) {
49223 childRowNode.setGroupValue(groupDisplayCol.getId(), parentToStealFrom.key);
49224 }
49225 }
49226 });
49227 });
49228 };
49229 __decorate$2r([
49230 Autowired('columnModel')
49231 ], SortService.prototype, "columnModel", void 0);
49232 __decorate$2r([
49233 Autowired('rowNodeSorter')
49234 ], SortService.prototype, "rowNodeSorter", void 0);
49235 __decorate$2r([
49236 PostConstruct
49237 ], SortService.prototype, "init", null);
49238 SortService = __decorate$2r([
49239 Bean('sortService')
49240 ], SortService);
49241 return SortService;
49242}(BeanStub));
49243
49244var __extends$2L = (undefined && undefined.__extends) || (function () {
49245 var extendStatics = function (d, b) {
49246 extendStatics = Object.setPrototypeOf ||
49247 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
49248 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
49249 return extendStatics(d, b);
49250 };
49251 return function (d, b) {
49252 extendStatics(d, b);
49253 function __() { this.constructor = d; }
49254 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49255 };
49256})();
49257var __decorate$2s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
49258 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
49259 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
49260 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;
49261 return c > 3 && r && Object.defineProperty(target, key, r), r;
49262};
49263var FilterService = /** @class */ (function (_super) {
49264 __extends$2L(FilterService, _super);
49265 function FilterService() {
49266 return _super !== null && _super.apply(this, arguments) || this;
49267 }
49268 FilterService.prototype.filter = function (changedPath) {
49269 var filterActive = this.filterManager.isColumnFilterPresent()
49270 || this.filterManager.isQuickFilterPresent()
49271 || this.gridOptionsWrapper.isExternalFilterPresent();
49272 this.filterNodes(filterActive, changedPath);
49273 };
49274 FilterService.prototype.filterNodes = function (filterActive, changedPath) {
49275 var _this = this;
49276 var filterCallback = function (rowNode, includeChildNodes) {
49277 // recursively get all children that are groups to also filter
49278 if (rowNode.hasChildren()) {
49279 // result of filter for this node. when filtering tree data, includeChildNodes = true when parent passes
49280 if (filterActive && !includeChildNodes) {
49281 rowNode.childrenAfterFilter = rowNode.childrenAfterGroup.filter(function (childNode) {
49282 // a group is included in the result if it has any children of it's own.
49283 // by this stage, the child groups are already filtered
49284 var passBecauseChildren = childNode.childrenAfterFilter && childNode.childrenAfterFilter.length > 0;
49285 // both leaf level nodes and tree data nodes have data. these get added if
49286 // the data passes the filter
49287 var passBecauseDataPasses = childNode.data
49288 && _this.filterManager.doesRowPassFilter({ rowNode: childNode });
49289 // note - tree data nodes pass either if a) they pass themselves or b) any children of that node pass
49290 return passBecauseChildren || passBecauseDataPasses;
49291 });
49292 }
49293 else {
49294 // if not filtering, the result is the original list
49295 rowNode.childrenAfterFilter = rowNode.childrenAfterGroup;
49296 }
49297 }
49298 else {
49299 rowNode.childrenAfterFilter = rowNode.childrenAfterGroup;
49300 }
49301 if (rowNode.sibling) {
49302 rowNode.sibling.childrenAfterFilter = rowNode.childrenAfterFilter;
49303 }
49304 };
49305 if (this.doingTreeDataFiltering()) {
49306 var treeDataDepthFirstFilter_1 = function (rowNode, alreadyFoundInParent) {
49307 // tree data filter traverses the hierarchy depth first and includes child nodes if parent passes
49308 // filter, and parent nodes will be include if any children exist.
49309 if (rowNode.childrenAfterGroup) {
49310 for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) {
49311 var childNode = rowNode.childrenAfterGroup[i];
49312 // first check if current node passes filter before invoking child nodes
49313 var foundInParent = alreadyFoundInParent
49314 || _this.filterManager.doesRowPassFilter({ rowNode: childNode });
49315 if (childNode.childrenAfterGroup) {
49316 treeDataDepthFirstFilter_1(rowNode.childrenAfterGroup[i], foundInParent);
49317 }
49318 else {
49319 filterCallback(childNode, foundInParent);
49320 }
49321 }
49322 }
49323 filterCallback(rowNode, alreadyFoundInParent);
49324 };
49325 var treeDataFilterCallback = function (rowNode) { return treeDataDepthFirstFilter_1(rowNode, false); };
49326 changedPath.executeFromRootNode(treeDataFilterCallback);
49327 }
49328 else {
49329 var defaultFilterCallback = function (rowNode) { return filterCallback(rowNode, false); };
49330 changedPath.forEachChangedNodeDepthFirst(defaultFilterCallback, true);
49331 }
49332 };
49333 FilterService.prototype.doingTreeDataFiltering = function () {
49334 return this.gridOptionsWrapper.isTreeData() && !this.gridOptionsWrapper.isExcludeChildrenWhenTreeDataFiltering();
49335 };
49336 __decorate$2s([
49337 Autowired('filterManager')
49338 ], FilterService.prototype, "filterManager", void 0);
49339 FilterService = __decorate$2s([
49340 Bean("filterService")
49341 ], FilterService);
49342 return FilterService;
49343}(BeanStub));
49344
49345var __extends$2M = (undefined && undefined.__extends) || (function () {
49346 var extendStatics = function (d, b) {
49347 extendStatics = Object.setPrototypeOf ||
49348 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
49349 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
49350 return extendStatics(d, b);
49351 };
49352 return function (d, b) {
49353 extendStatics(d, b);
49354 function __() { this.constructor = d; }
49355 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49356 };
49357})();
49358var __decorate$2t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
49359 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
49360 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
49361 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;
49362 return c > 3 && r && Object.defineProperty(target, key, r), r;
49363};
49364var __read$j = (undefined && undefined.__read) || function (o, n) {
49365 var m = typeof Symbol === "function" && o[Symbol.iterator];
49366 if (!m) return o;
49367 var i = m.call(o), r, ar = [], e;
49368 try {
49369 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
49370 }
49371 catch (error) { e = { error: error }; }
49372 finally {
49373 try {
49374 if (r && !r.done && (m = i["return"])) m.call(i);
49375 }
49376 finally { if (e) throw e.error; }
49377 }
49378 return ar;
49379};
49380var ImmutableService = /** @class */ (function (_super) {
49381 __extends$2M(ImmutableService, _super);
49382 function ImmutableService() {
49383 return _super !== null && _super.apply(this, arguments) || this;
49384 }
49385 ImmutableService.prototype.postConstruct = function () {
49386 if (this.rowModel.getType() === Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
49387 this.clientSideRowModel = this.rowModel;
49388 }
49389 };
49390 ImmutableService.prototype.isActive = function () {
49391 return this.gridOptionsWrapper.isImmutableData();
49392 };
49393 ImmutableService.prototype.setRowData = function (rowData) {
49394 var transactionAndMap = this.createTransactionForRowData(rowData);
49395 if (!transactionAndMap) {
49396 return;
49397 }
49398 var _a = __read$j(transactionAndMap, 2), transaction = _a[0], orderIdMap = _a[1];
49399 var nodeTransaction = this.clientSideRowModel.updateRowData(transaction, orderIdMap);
49400 // need to force updating of full width rows - note this wouldn't be necessary the full width cell comp listened
49401 // to the data change event on the row node and refreshed itself.
49402 if (nodeTransaction) {
49403 this.rowRenderer.refreshFullWidthRows(nodeTransaction.update);
49404 }
49405 // - shows 'no rows' overlay if needed
49406 var rowDataChangedEvent = {
49407 type: Events.EVENT_ROW_DATA_CHANGED,
49408 api: this.gridApi,
49409 columnApi: this.columnApi
49410 };
49411 this.eventService.dispatchEvent(rowDataChangedEvent);
49412 };
49413 // converts the setRowData() command to a transaction
49414 ImmutableService.prototype.createTransactionForRowData = function (rowData) {
49415 if (_.missing(this.clientSideRowModel)) {
49416 console.error('AG Grid: ImmutableService only works with ClientSideRowModel');
49417 return;
49418 }
49419 var getRowIdFunc = this.gridOptionsWrapper.getRowIdFunc();
49420 if (getRowIdFunc == null) {
49421 console.error('AG Grid: ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!');
49422 return;
49423 }
49424 // convert the data into a transaction object by working out adds, removes and updates
49425 var transaction = {
49426 remove: [],
49427 update: [],
49428 add: []
49429 };
49430 var existingNodesMap = this.clientSideRowModel.getCopyOfNodesMap();
49431 var suppressSortOrder = this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder();
49432 var orderMap = suppressSortOrder ? undefined : {};
49433 if (_.exists(rowData)) {
49434 // split all the new data in the following:
49435 // if new, push to 'add'
49436 // if update, push to 'update'
49437 // if not changed, do not include in the transaction
49438 rowData.forEach(function (data, index) {
49439 var id = getRowIdFunc({ data: data, level: 0 });
49440 var existingNode = existingNodesMap[id];
49441 if (orderMap) {
49442 orderMap[id] = index;
49443 }
49444 if (existingNode) {
49445 var dataHasChanged = existingNode.data !== data;
49446 if (dataHasChanged) {
49447 transaction.update.push(data);
49448 }
49449 // otherwise, if data not changed, we just don't include it anywhere, as it's not a delta
49450 // remove from list, so we know the item is not to be removed
49451 existingNodesMap[id] = undefined;
49452 }
49453 else {
49454 transaction.add.push(data);
49455 }
49456 });
49457 }
49458 // at this point, all rows that are left, should be removed
49459 _.iterateObject(existingNodesMap, function (id, rowNode) {
49460 if (rowNode) {
49461 transaction.remove.push(rowNode.data);
49462 }
49463 });
49464 return [transaction, orderMap];
49465 };
49466 __decorate$2t([
49467 Autowired('rowModel')
49468 ], ImmutableService.prototype, "rowModel", void 0);
49469 __decorate$2t([
49470 Autowired('rowRenderer')
49471 ], ImmutableService.prototype, "rowRenderer", void 0);
49472 __decorate$2t([
49473 Autowired('columnApi')
49474 ], ImmutableService.prototype, "columnApi", void 0);
49475 __decorate$2t([
49476 Autowired('gridApi')
49477 ], ImmutableService.prototype, "gridApi", void 0);
49478 __decorate$2t([
49479 PostConstruct
49480 ], ImmutableService.prototype, "postConstruct", null);
49481 ImmutableService = __decorate$2t([
49482 Bean('immutableService')
49483 ], ImmutableService);
49484 return ImmutableService;
49485}(BeanStub));
49486
49487var ClientSideRowModelModule = {
49488 moduleName: exports.ModuleNames.ClientSideRowModelModule,
49489 beans: [FilterStage, SortStage, FlattenStage, SortService, FilterService, ImmutableService],
49490 rowModels: { clientSide: ClientSideRowModel }
49491};
49492
49493var __extends$2N = (undefined && undefined.__extends) || (function () {
49494 var extendStatics = function (d, b) {
49495 extendStatics = Object.setPrototypeOf ||
49496 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
49497 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
49498 return extendStatics(d, b);
49499 };
49500 return function (d, b) {
49501 extendStatics(d, b);
49502 function __() { this.constructor = d; }
49503 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49504 };
49505})();
49506var __decorate$2u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
49507 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
49508 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
49509 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;
49510 return c > 3 && r && Object.defineProperty(target, key, r), r;
49511};
49512var InfiniteBlock = /** @class */ (function (_super) {
49513 __extends$2N(InfiniteBlock, _super);
49514 function InfiniteBlock(id, parentCache, params) {
49515 var _this = _super.call(this, id) || this;
49516 _this.parentCache = parentCache;
49517 _this.params = params;
49518 // we don't need to calculate these now, as the inputs don't change,
49519 // however it makes the code easier to read if we work them out up front
49520 _this.startRow = id * params.blockSize;
49521 _this.endRow = _this.startRow + params.blockSize;
49522 return _this;
49523 }
49524 InfiniteBlock.prototype.postConstruct = function () {
49525 this.createRowNodes();
49526 };
49527 InfiniteBlock.prototype.getBlockStateJson = function () {
49528 return {
49529 id: '' + this.getId(),
49530 state: {
49531 blockNumber: this.getId(),
49532 startRow: this.getStartRow(),
49533 endRow: this.getEndRow(),
49534 pageStatus: this.getState()
49535 }
49536 };
49537 };
49538 InfiniteBlock.prototype.setDataAndId = function (rowNode, data, index) {
49539 // if there's no id and the rowNode was rendered before, it means this
49540 // was a placeholder rowNode and should not be recycled. Setting
49541 // `alreadyRendered` to `false` forces the rowRenderer to flush it.
49542 if (!rowNode.id && rowNode.alreadyRendered) {
49543 rowNode.alreadyRendered = false;
49544 }
49545 if (_.exists(data)) {
49546 // this means if the user is not providing id's we just use the
49547 // index for the row. this will allow selection to work (that is based
49548 // on index) as long user is not inserting or deleting rows,
49549 // or wanting to keep selection between server side sorting or filtering
49550 rowNode.setDataAndId(data, index.toString());
49551 }
49552 else {
49553 rowNode.setDataAndId(undefined, undefined);
49554 }
49555 };
49556 InfiniteBlock.prototype.loadFromDatasource = function () {
49557 var _this = this;
49558 var params = this.createLoadParams();
49559 if (_.missing(this.params.datasource.getRows)) {
49560 console.warn("AG Grid: datasource is missing getRows method");
49561 return;
49562 }
49563 // put in timeout, to force result to be async
49564 window.setTimeout(function () {
49565 _this.params.datasource.getRows(params);
49566 }, 0);
49567 };
49568 InfiniteBlock.prototype.processServerFail = function () {
49569 // todo - this method has better handling in SSRM
49570 };
49571 InfiniteBlock.prototype.createLoadParams = function () {
49572 // PROBLEM . . . . when the user sets sort via colDef.sort, then this code
49573 // is executing before the sort is set up, so server is not getting the sort
49574 // model. need to change with regards order - so the server side request is
49575 // AFTER thus it gets the right sort model.
49576 var params = {
49577 startRow: this.getStartRow(),
49578 endRow: this.getEndRow(),
49579 successCallback: this.pageLoaded.bind(this, this.getVersion()),
49580 failCallback: this.pageLoadFailed.bind(this, this.getVersion()),
49581 sortModel: this.params.sortModel,
49582 filterModel: this.params.filterModel,
49583 context: this.gridOptionsWrapper.getContext()
49584 };
49585 return params;
49586 };
49587 InfiniteBlock.prototype.forEachNode = function (callback, sequence, rowCount) {
49588 var _this = this;
49589 this.rowNodes.forEach(function (rowNode, index) {
49590 var rowIndex = _this.startRow + index;
49591 if (rowIndex < rowCount) {
49592 callback(rowNode, sequence.next());
49593 }
49594 });
49595 };
49596 InfiniteBlock.prototype.getLastAccessed = function () {
49597 return this.lastAccessed;
49598 };
49599 InfiniteBlock.prototype.getRow = function (rowIndex, dontTouchLastAccessed) {
49600 if (dontTouchLastAccessed === void 0) { dontTouchLastAccessed = false; }
49601 if (!dontTouchLastAccessed) {
49602 this.lastAccessed = this.params.lastAccessedSequence.next();
49603 }
49604 var localIndex = rowIndex - this.startRow;
49605 return this.rowNodes[localIndex];
49606 };
49607 InfiniteBlock.prototype.getStartRow = function () {
49608 return this.startRow;
49609 };
49610 InfiniteBlock.prototype.getEndRow = function () {
49611 return this.endRow;
49612 };
49613 // creates empty row nodes, data is missing as not loaded yet
49614 InfiniteBlock.prototype.createRowNodes = function () {
49615 this.rowNodes = [];
49616 for (var i = 0; i < this.params.blockSize; i++) {
49617 var rowIndex = this.startRow + i;
49618 var rowNode = new RowNode(this.beans);
49619 rowNode.setRowHeight(this.params.rowHeight);
49620 rowNode.uiLevel = 0;
49621 rowNode.setRowIndex(rowIndex);
49622 rowNode.setRowTop(this.params.rowHeight * rowIndex);
49623 this.rowNodes.push(rowNode);
49624 }
49625 };
49626 InfiniteBlock.prototype.processServerResult = function (params) {
49627 var _this = this;
49628 this.rowNodes.forEach(function (rowNode, index) {
49629 var data = params.rowData ? params.rowData[index] : undefined;
49630 _this.setDataAndId(rowNode, data, _this.startRow + index);
49631 });
49632 var finalRowCount = params.rowCount != null && params.rowCount >= 0 ? params.rowCount : undefined;
49633 this.parentCache.pageLoaded(this, finalRowCount);
49634 };
49635 InfiniteBlock.prototype.destroyRowNodes = function () {
49636 this.rowNodes.forEach(function (rowNode) {
49637 // this is needed, so row render knows to fade out the row, otherwise it
49638 // sees row top is present, and thinks the row should be shown.
49639 rowNode.clearRowTopAndRowIndex();
49640 });
49641 };
49642 __decorate$2u([
49643 Autowired('beans')
49644 ], InfiniteBlock.prototype, "beans", void 0);
49645 __decorate$2u([
49646 PostConstruct
49647 ], InfiniteBlock.prototype, "postConstruct", null);
49648 __decorate$2u([
49649 PreDestroy
49650 ], InfiniteBlock.prototype, "destroyRowNodes", null);
49651 return InfiniteBlock;
49652}(RowNodeBlock));
49653
49654var __extends$2O = (undefined && undefined.__extends) || (function () {
49655 var extendStatics = function (d, b) {
49656 extendStatics = Object.setPrototypeOf ||
49657 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
49658 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
49659 return extendStatics(d, b);
49660 };
49661 return function (d, b) {
49662 extendStatics(d, b);
49663 function __() { this.constructor = d; }
49664 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49665 };
49666})();
49667var __decorate$2v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
49668 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
49669 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
49670 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;
49671 return c > 3 && r && Object.defineProperty(target, key, r), r;
49672};
49673var __param$a = (undefined && undefined.__param) || function (paramIndex, decorator) {
49674 return function (target, key) { decorator(target, key, paramIndex); }
49675};
49676var InfiniteCache = /** @class */ (function (_super) {
49677 __extends$2O(InfiniteCache, _super);
49678 function InfiniteCache(params) {
49679 var _this = _super.call(this) || this;
49680 _this.lastRowIndexKnown = false;
49681 _this.blocks = {};
49682 _this.blockCount = 0;
49683 _this.rowCount = params.initialRowCount;
49684 _this.params = params;
49685 return _this;
49686 }
49687 InfiniteCache.prototype.setBeans = function (loggerFactory) {
49688 this.logger = loggerFactory.create('InfiniteCache');
49689 };
49690 // the rowRenderer will not pass dontCreatePage, meaning when rendering the grid,
49691 // it will want new pages in the cache as it asks for rows. only when we are inserting /
49692 // removing rows via the api is dontCreatePage set, where we move rows between the pages.
49693 InfiniteCache.prototype.getRow = function (rowIndex, dontCreatePage) {
49694 if (dontCreatePage === void 0) { dontCreatePage = false; }
49695 var blockId = Math.floor(rowIndex / this.params.blockSize);
49696 var block = this.blocks[blockId];
49697 if (!block) {
49698 if (dontCreatePage) {
49699 return undefined;
49700 }
49701 block = this.createBlock(blockId);
49702 }
49703 return block.getRow(rowIndex);
49704 };
49705 InfiniteCache.prototype.createBlock = function (blockNumber) {
49706 var newBlock = this.createBean(new InfiniteBlock(blockNumber, this, this.params));
49707 this.blocks[newBlock.getId()] = newBlock;
49708 this.blockCount++;
49709 this.purgeBlocksIfNeeded(newBlock);
49710 this.params.rowNodeBlockLoader.addBlock(newBlock);
49711 return newBlock;
49712 };
49713 // we have this on infinite row model only, not server side row model,
49714 // because for server side, it would leave the children in inconsistent
49715 // state - eg if a node had children, but after the refresh it had data
49716 // for a different row, then the children would be with the wrong row node.
49717 InfiniteCache.prototype.refreshCache = function () {
49718 var nothingToRefresh = this.blockCount == 0;
49719 if (nothingToRefresh) {
49720 this.purgeCache();
49721 return;
49722 }
49723 this.getBlocksInOrder().forEach(function (block) { return block.setStateWaitingToLoad(); });
49724 this.params.rowNodeBlockLoader.checkBlockToLoad();
49725 };
49726 InfiniteCache.prototype.destroyAllBlocks = function () {
49727 var _this = this;
49728 this.getBlocksInOrder().forEach(function (block) { return _this.destroyBlock(block); });
49729 };
49730 InfiniteCache.prototype.getRowCount = function () {
49731 return this.rowCount;
49732 };
49733 InfiniteCache.prototype.isLastRowIndexKnown = function () {
49734 return this.lastRowIndexKnown;
49735 };
49736 // block calls this, when page loaded
49737 InfiniteCache.prototype.pageLoaded = function (block, lastRow) {
49738 // if we are not active, then we ignore all events, otherwise we could end up getting the
49739 // grid to refresh even though we are no longer the active cache
49740 if (!this.isAlive()) {
49741 return;
49742 }
49743 this.logger.log("onPageLoaded: page = " + block.getId() + ", lastRow = " + lastRow);
49744 this.checkRowCount(block, lastRow);
49745 // we fire cacheUpdated even if the row count has not changed, as some items need updating even
49746 // if no new rows to render. for example the pagination panel has '?' as the total rows when loading
49747 // is underway, which would need to get updated when loading finishes.
49748 this.onCacheUpdated();
49749 };
49750 InfiniteCache.prototype.purgeBlocksIfNeeded = function (blockToExclude) {
49751 var _this = this;
49752 // we exclude checking for the page just created, as this has yet to be accessed and hence
49753 // the lastAccessed stamp will not be updated for the first time yet
49754 var blocksForPurging = this.getBlocksInOrder().filter(function (b) { return b != blockToExclude; });
49755 var lastAccessedComparator = function (a, b) { return b.getLastAccessed() - a.getLastAccessed(); };
49756 blocksForPurging.sort(lastAccessedComparator);
49757 // we remove (maxBlocksInCache - 1) as we already excluded the 'just created' page.
49758 // in other words, after the splice operation below, we have taken out the blocks
49759 // we want to keep, which means we are left with blocks that we can potentially purge
49760 var maxBlocksProvided = this.params.maxBlocksInCache > 0;
49761 var blocksToKeep = maxBlocksProvided ? this.params.maxBlocksInCache - 1 : null;
49762 var emptyBlocksToKeep = InfiniteCache.MAX_EMPTY_BLOCKS_TO_KEEP - 1;
49763 blocksForPurging.forEach(function (block, index) {
49764 var purgeBecauseBlockEmpty = block.getState() === InfiniteBlock.STATE_WAITING_TO_LOAD && index >= emptyBlocksToKeep;
49765 var purgeBecauseCacheFull = maxBlocksProvided ? index >= blocksToKeep : false;
49766 if (purgeBecauseBlockEmpty || purgeBecauseCacheFull) {
49767 // if the block currently has rows been displayed, then don't remove it either.
49768 // this can happen if user has maxBlocks=2, and blockSize=5 (thus 10 max rows in cache)
49769 // but the screen is showing 20 rows, so at least 4 blocks are needed.
49770 if (_this.isBlockCurrentlyDisplayed(block)) {
49771 return;
49772 }
49773 // don't want to loose keyboard focus, so keyboard navigation can continue. so keep focused blocks.
49774 if (_this.isBlockFocused(block)) {
49775 return;
49776 }
49777 // at this point, block is not needed, so burn baby burn
49778 _this.removeBlockFromCache(block);
49779 }
49780 });
49781 };
49782 InfiniteCache.prototype.isBlockFocused = function (block) {
49783 var focusedCell = this.focusService.getFocusCellToUseAfterRefresh();
49784 if (!focusedCell) {
49785 return false;
49786 }
49787 if (focusedCell.rowPinned != null) {
49788 return false;
49789 }
49790 var blockIndexStart = block.getStartRow();
49791 var blockIndexEnd = block.getEndRow();
49792 var hasFocus = focusedCell.rowIndex >= blockIndexStart && focusedCell.rowIndex < blockIndexEnd;
49793 return hasFocus;
49794 };
49795 InfiniteCache.prototype.isBlockCurrentlyDisplayed = function (block) {
49796 var startIndex = block.getStartRow();
49797 var endIndex = block.getEndRow() - 1;
49798 return this.rowRenderer.isRangeInRenderedViewport(startIndex, endIndex);
49799 };
49800 InfiniteCache.prototype.removeBlockFromCache = function (blockToRemove) {
49801 if (!blockToRemove) {
49802 return;
49803 }
49804 this.destroyBlock(blockToRemove);
49805 // we do not want to remove the 'loaded' event listener, as the
49806 // concurrent loads count needs to be updated when the load is complete
49807 // if the purged page is in loading state
49808 };
49809 InfiniteCache.prototype.checkRowCount = function (block, lastRow) {
49810 // if client provided a last row, we always use it, as it could change between server calls
49811 // if user deleted data and then called refresh on the grid.
49812 if (typeof lastRow === 'number' && lastRow >= 0) {
49813 this.rowCount = lastRow;
49814 this.lastRowIndexKnown = true;
49815 }
49816 else if (!this.lastRowIndexKnown) {
49817 // otherwise, see if we need to add some virtual rows
49818 var lastRowIndex = (block.getId() + 1) * this.params.blockSize;
49819 var lastRowIndexPlusOverflow = lastRowIndex + this.params.overflowSize;
49820 if (this.rowCount < lastRowIndexPlusOverflow) {
49821 this.rowCount = lastRowIndexPlusOverflow;
49822 }
49823 }
49824 };
49825 InfiniteCache.prototype.setRowCount = function (rowCount, lastRowIndexKnown) {
49826 this.rowCount = rowCount;
49827 // if undefined is passed, we do not set this value, if one of {true,false}
49828 // is passed, we do set the value.
49829 if (_.exists(lastRowIndexKnown)) {
49830 this.lastRowIndexKnown = lastRowIndexKnown;
49831 }
49832 // if we are still searching, then the row count must not end at the end
49833 // of a particular page, otherwise the searching will not pop into the
49834 // next page
49835 if (!this.lastRowIndexKnown) {
49836 if (this.rowCount % this.params.blockSize === 0) {
49837 this.rowCount++;
49838 }
49839 }
49840 this.onCacheUpdated();
49841 };
49842 InfiniteCache.prototype.forEachNodeDeep = function (callback) {
49843 var _this = this;
49844 var sequence = new NumberSequence();
49845 this.getBlocksInOrder().forEach(function (block) { return block.forEachNode(callback, sequence, _this.rowCount); });
49846 };
49847 InfiniteCache.prototype.getBlocksInOrder = function () {
49848 // get all page id's as NUMBERS (not strings, as we need to sort as numbers) and in descending order
49849 var blockComparator = function (a, b) { return a.getId() - b.getId(); };
49850 var blocks = _.getAllValuesInObject(this.blocks).sort(blockComparator);
49851 return blocks;
49852 };
49853 InfiniteCache.prototype.destroyBlock = function (block) {
49854 delete this.blocks[block.getId()];
49855 this.destroyBean(block);
49856 this.blockCount--;
49857 this.params.rowNodeBlockLoader.removeBlock(block);
49858 };
49859 // gets called 1) row count changed 2) cache purged 3) items inserted
49860 InfiniteCache.prototype.onCacheUpdated = function () {
49861 if (this.isAlive()) {
49862 // if the virtualRowCount is shortened, then it's possible blocks exist that are no longer
49863 // in the valid range. so we must remove these. this can happen if user explicitly sets
49864 // the virtual row count, or the datasource returns a result and sets lastRow to something
49865 // less than virtualRowCount (can happen if user scrolls down, server reduces dataset size).
49866 this.destroyAllBlocksPastVirtualRowCount();
49867 // this results in both row models (infinite and server side) firing ModelUpdated,
49868 // however server side row model also updates the row indexes first
49869 var event_1 = {
49870 type: Events.EVENT_STORE_UPDATED
49871 };
49872 this.eventService.dispatchEvent(event_1);
49873 }
49874 };
49875 InfiniteCache.prototype.destroyAllBlocksPastVirtualRowCount = function () {
49876 var _this = this;
49877 var blocksToDestroy = [];
49878 this.getBlocksInOrder().forEach(function (block) {
49879 var startRow = block.getId() * _this.params.blockSize;
49880 if (startRow >= _this.rowCount) {
49881 blocksToDestroy.push(block);
49882 }
49883 });
49884 if (blocksToDestroy.length > 0) {
49885 blocksToDestroy.forEach(function (block) { return _this.destroyBlock(block); });
49886 }
49887 };
49888 InfiniteCache.prototype.purgeCache = function () {
49889 var _this = this;
49890 this.getBlocksInOrder().forEach(function (block) { return _this.removeBlockFromCache(block); });
49891 this.lastRowIndexKnown = false;
49892 // if zero rows in the cache, we need to get the SSRM to start asking for rows again.
49893 // otherwise if set to zero rows last time, and we don't update the row count, then after
49894 // the purge there will still be zero rows, meaning the SSRM won't request any rows.
49895 // to kick things off, at least one row needs to be asked for.
49896 if (this.rowCount === 0) {
49897 this.rowCount = this.params.initialRowCount;
49898 }
49899 this.onCacheUpdated();
49900 };
49901 InfiniteCache.prototype.getRowNodesInRange = function (firstInRange, lastInRange) {
49902 var _this = this;
49903 var result = [];
49904 var lastBlockId = -1;
49905 var inActiveRange = false;
49906 var numberSequence = new NumberSequence();
49907 // if only one node passed, we start the selection at the top
49908 if (_.missing(firstInRange)) {
49909 inActiveRange = true;
49910 }
49911 var foundGapInSelection = false;
49912 this.getBlocksInOrder().forEach(function (block) {
49913 if (foundGapInSelection) {
49914 return;
49915 }
49916 if (inActiveRange && (lastBlockId + 1 !== block.getId())) {
49917 foundGapInSelection = true;
49918 return;
49919 }
49920 lastBlockId = block.getId();
49921 block.forEachNode(function (rowNode) {
49922 var hitFirstOrLast = rowNode === firstInRange || rowNode === lastInRange;
49923 if (inActiveRange || hitFirstOrLast) {
49924 result.push(rowNode);
49925 }
49926 if (hitFirstOrLast) {
49927 inActiveRange = !inActiveRange;
49928 }
49929 }, numberSequence, _this.rowCount);
49930 });
49931 // inActiveRange will be still true if we never hit the second rowNode
49932 var invalidRange = foundGapInSelection || inActiveRange;
49933 return invalidRange ? [] : result;
49934 };
49935 // this property says how many empty blocks should be in a cache, eg if scrolls down fast and creates 10
49936 // blocks all for loading, the grid will only load the last 2 - it will assume the blocks the user quickly
49937 // scrolled over are not needed to be loaded.
49938 InfiniteCache.MAX_EMPTY_BLOCKS_TO_KEEP = 2;
49939 __decorate$2v([
49940 Autowired('rowRenderer')
49941 ], InfiniteCache.prototype, "rowRenderer", void 0);
49942 __decorate$2v([
49943 Autowired("focusService")
49944 ], InfiniteCache.prototype, "focusService", void 0);
49945 __decorate$2v([
49946 __param$a(0, Qualifier('loggerFactory'))
49947 ], InfiniteCache.prototype, "setBeans", null);
49948 __decorate$2v([
49949 PreDestroy
49950 ], InfiniteCache.prototype, "destroyAllBlocks", null);
49951 return InfiniteCache;
49952}(BeanStub));
49953
49954var __extends$2P = (undefined && undefined.__extends) || (function () {
49955 var extendStatics = function (d, b) {
49956 extendStatics = Object.setPrototypeOf ||
49957 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
49958 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
49959 return extendStatics(d, b);
49960 };
49961 return function (d, b) {
49962 extendStatics(d, b);
49963 function __() { this.constructor = d; }
49964 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49965 };
49966})();
49967var __decorate$2w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
49968 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
49969 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
49970 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;
49971 return c > 3 && r && Object.defineProperty(target, key, r), r;
49972};
49973var InfiniteRowModel = /** @class */ (function (_super) {
49974 __extends$2P(InfiniteRowModel, _super);
49975 function InfiniteRowModel() {
49976 return _super !== null && _super.apply(this, arguments) || this;
49977 }
49978 InfiniteRowModel.prototype.getRowBounds = function (index) {
49979 return {
49980 rowHeight: this.rowHeight,
49981 rowTop: this.rowHeight * index
49982 };
49983 };
49984 // we don't implement as lazy row heights is not supported in this row model
49985 InfiniteRowModel.prototype.ensureRowHeightsValid = function (startPixel, endPixel, startLimitIndex, endLimitIndex) {
49986 return false;
49987 };
49988 InfiniteRowModel.prototype.init = function () {
49989 var _this = this;
49990 if (!this.gridOptionsWrapper.isRowModelInfinite()) {
49991 return;
49992 }
49993 this.rowHeight = this.gridOptionsWrapper.getRowHeightAsNumber();
49994 this.addEventListeners();
49995 this.addDestroyFunc(function () { return _this.destroyCache(); });
49996 this.verifyProps();
49997 };
49998 InfiniteRowModel.prototype.verifyProps = function () {
49999 if (this.gridOptionsWrapper.getInitialGroupOrderComparator() != null) {
50000 var message_1 = "AG Grid: initialGroupOrderComparator cannot be used with Infinite Row Model. If using Infinite Row Model, then sorting is done on the server side, nothing to do with the client.";
50001 _.doOnce(function () { return console.warn(message_1); }, 'IRM.InitialGroupOrderComparator');
50002 }
50003 };
50004 InfiniteRowModel.prototype.start = function () {
50005 this.setDatasource(this.gridOptionsWrapper.getDatasource());
50006 };
50007 InfiniteRowModel.prototype.destroyDatasource = function () {
50008 if (this.datasource) {
50009 this.getContext().destroyBean(this.datasource);
50010 this.rowRenderer.datasourceChanged();
50011 this.datasource = null;
50012 }
50013 };
50014 InfiniteRowModel.prototype.addEventListeners = function () {
50015 this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
50016 this.addManagedListener(this.eventService, Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
50017 this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onColumnEverything.bind(this));
50018 this.addManagedListener(this.eventService, Events.EVENT_STORE_UPDATED, this.onCacheUpdated.bind(this));
50019 };
50020 InfiniteRowModel.prototype.onFilterChanged = function () {
50021 this.reset();
50022 };
50023 InfiniteRowModel.prototype.onSortChanged = function () {
50024 this.reset();
50025 };
50026 InfiniteRowModel.prototype.onColumnEverything = function () {
50027 var resetRequired;
50028 // if cache params, we require reset only if sort model has changed. we don't need to check
50029 // for filter model, as the filter manager will fire an event when columns change that result
50030 // in the filter changing.
50031 if (this.cacheParams) {
50032 resetRequired = this.isSortModelDifferent();
50033 }
50034 else {
50035 // if no cacheParams, means first time creating the cache, so always create one
50036 resetRequired = true;
50037 }
50038 if (resetRequired) {
50039 this.reset();
50040 }
50041 };
50042 InfiniteRowModel.prototype.isSortModelDifferent = function () {
50043 return !_.jsonEquals(this.cacheParams.sortModel, this.sortController.getSortModel());
50044 };
50045 InfiniteRowModel.prototype.getType = function () {
50046 return Constants.ROW_MODEL_TYPE_INFINITE;
50047 };
50048 InfiniteRowModel.prototype.setDatasource = function (datasource) {
50049 this.destroyDatasource();
50050 this.datasource = datasource;
50051 // only reset if we have a valid datasource to working with
50052 if (datasource) {
50053 this.reset();
50054 }
50055 };
50056 InfiniteRowModel.prototype.isEmpty = function () {
50057 return !this.infiniteCache;
50058 };
50059 InfiniteRowModel.prototype.isRowsToRender = function () {
50060 return !!this.infiniteCache;
50061 };
50062 InfiniteRowModel.prototype.getNodesInRangeForSelection = function (firstInRange, lastInRange) {
50063 return this.infiniteCache ? this.infiniteCache.getRowNodesInRange(firstInRange, lastInRange) : [];
50064 };
50065 InfiniteRowModel.prototype.reset = function () {
50066 // important to return here, as the user could be setting filter or sort before
50067 // data-source is set
50068 if (!this.datasource) {
50069 return;
50070 }
50071 // if user is providing id's, then this means we can keep the selection between datasource hits,
50072 // as the rows will keep their unique id's even if, for example, server side sorting or filtering
50073 // is done.
50074 var getRowIdFunc = this.gridOptionsWrapper.getRowIdFunc();
50075 var userGeneratingIds = getRowIdFunc != null;
50076 if (!userGeneratingIds) {
50077 this.selectionService.reset();
50078 }
50079 this.resetCache();
50080 var event = this.createModelUpdatedEvent();
50081 this.eventService.dispatchEvent(event);
50082 };
50083 InfiniteRowModel.prototype.createModelUpdatedEvent = function () {
50084 return {
50085 type: Events.EVENT_MODEL_UPDATED,
50086 api: this.gridApi,
50087 columnApi: this.columnApi,
50088 // not sure if these should all be false - noticed if after implementing,
50089 // maybe they should be true?
50090 newPage: false,
50091 newData: false,
50092 keepRenderedRows: true,
50093 animate: false
50094 };
50095 };
50096 InfiniteRowModel.prototype.resetCache = function () {
50097 // if not first time creating a cache, need to destroy the old one
50098 this.destroyCache();
50099 this.cacheParams = {
50100 // the user provided datasource
50101 datasource: this.datasource,
50102 // sort and filter model
50103 filterModel: this.filterManager.getFilterModel(),
50104 sortModel: this.sortController.getSortModel(),
50105 rowNodeBlockLoader: this.rowNodeBlockLoader,
50106 // properties - this way we take a snapshot of them, so if user changes any, they will be
50107 // used next time we create a new cache, which is generally after a filter or sort change,
50108 // or a new datasource is set
50109 initialRowCount: this.defaultIfInvalid(this.gridOptionsWrapper.getInfiniteInitialRowCount(), 1),
50110 maxBlocksInCache: this.gridOptionsWrapper.getMaxBlocksInCache(),
50111 rowHeight: this.gridOptionsWrapper.getRowHeightAsNumber(),
50112 // if user doesn't provide overflow, we use default overflow of 1, so user can scroll past
50113 // the current page and request first row of next page
50114 overflowSize: this.defaultIfInvalid(this.gridOptionsWrapper.getCacheOverflowSize(), 1),
50115 // page size needs to be 1 or greater. having it at 1 would be silly, as you would be hitting the
50116 // server for one page at a time. so the default if not specified is 100.
50117 blockSize: this.defaultIfInvalid(this.gridOptionsWrapper.getCacheBlockSize(), 100),
50118 // the cache could create this, however it is also used by the pages, so handy to create it
50119 // here as the settings are also passed to the pages
50120 lastAccessedSequence: new NumberSequence()
50121 };
50122 this.infiniteCache = this.createBean(new InfiniteCache(this.cacheParams));
50123 };
50124 InfiniteRowModel.prototype.defaultIfInvalid = function (value, defaultValue) {
50125 return value > 0 ? value : defaultValue;
50126 };
50127 InfiniteRowModel.prototype.destroyCache = function () {
50128 if (this.infiniteCache) {
50129 this.infiniteCache = this.destroyBean(this.infiniteCache);
50130 }
50131 };
50132 InfiniteRowModel.prototype.onCacheUpdated = function () {
50133 var event = this.createModelUpdatedEvent();
50134 this.eventService.dispatchEvent(event);
50135 };
50136 InfiniteRowModel.prototype.getRow = function (rowIndex) {
50137 if (!this.infiniteCache) {
50138 return undefined;
50139 }
50140 if (rowIndex >= this.infiniteCache.getRowCount()) {
50141 return undefined;
50142 }
50143 return this.infiniteCache.getRow(rowIndex);
50144 };
50145 InfiniteRowModel.prototype.getRowNode = function (id) {
50146 var result;
50147 this.forEachNode(function (rowNode) {
50148 if (rowNode.id === id) {
50149 result = rowNode;
50150 }
50151 });
50152 return result;
50153 };
50154 InfiniteRowModel.prototype.forEachNode = function (callback) {
50155 if (this.infiniteCache) {
50156 this.infiniteCache.forEachNodeDeep(callback);
50157 }
50158 };
50159 InfiniteRowModel.prototype.getTopLevelRowCount = function () {
50160 return this.getRowCount();
50161 };
50162 InfiniteRowModel.prototype.getTopLevelRowDisplayedIndex = function (topLevelIndex) {
50163 return topLevelIndex;
50164 };
50165 InfiniteRowModel.prototype.getRowIndexAtPixel = function (pixel) {
50166 if (this.rowHeight !== 0) { // avoid divide by zero error
50167 var rowIndexForPixel = Math.floor(pixel / this.rowHeight);
50168 var lastRowIndex = this.getRowCount() - 1;
50169 if (rowIndexForPixel > lastRowIndex) {
50170 return lastRowIndex;
50171 }
50172 return rowIndexForPixel;
50173 }
50174 return 0;
50175 };
50176 InfiniteRowModel.prototype.getRowCount = function () {
50177 return this.infiniteCache ? this.infiniteCache.getRowCount() : 0;
50178 };
50179 InfiniteRowModel.prototype.isRowPresent = function (rowNode) {
50180 var foundRowNode = this.getRowNode(rowNode.id);
50181 return !!foundRowNode;
50182 };
50183 InfiniteRowModel.prototype.refreshCache = function () {
50184 if (this.infiniteCache) {
50185 this.infiniteCache.refreshCache();
50186 }
50187 };
50188 InfiniteRowModel.prototype.purgeCache = function () {
50189 if (this.infiniteCache) {
50190 this.infiniteCache.purgeCache();
50191 }
50192 };
50193 // for iRowModel
50194 InfiniteRowModel.prototype.isLastRowIndexKnown = function () {
50195 if (this.infiniteCache) {
50196 return this.infiniteCache.isLastRowIndexKnown();
50197 }
50198 return false;
50199 };
50200 InfiniteRowModel.prototype.setRowCount = function (rowCount, lastRowIndexKnown) {
50201 if (this.infiniteCache) {
50202 this.infiniteCache.setRowCount(rowCount, lastRowIndexKnown);
50203 }
50204 };
50205 __decorate$2w([
50206 Autowired('filterManager')
50207 ], InfiniteRowModel.prototype, "filterManager", void 0);
50208 __decorate$2w([
50209 Autowired('sortController')
50210 ], InfiniteRowModel.prototype, "sortController", void 0);
50211 __decorate$2w([
50212 Autowired('selectionService')
50213 ], InfiniteRowModel.prototype, "selectionService", void 0);
50214 __decorate$2w([
50215 Autowired('gridApi')
50216 ], InfiniteRowModel.prototype, "gridApi", void 0);
50217 __decorate$2w([
50218 Autowired('columnApi')
50219 ], InfiniteRowModel.prototype, "columnApi", void 0);
50220 __decorate$2w([
50221 Autowired('rowRenderer')
50222 ], InfiniteRowModel.prototype, "rowRenderer", void 0);
50223 __decorate$2w([
50224 Autowired('rowNodeBlockLoader')
50225 ], InfiniteRowModel.prototype, "rowNodeBlockLoader", void 0);
50226 __decorate$2w([
50227 PostConstruct
50228 ], InfiniteRowModel.prototype, "init", null);
50229 __decorate$2w([
50230 PreDestroy
50231 ], InfiniteRowModel.prototype, "destroyDatasource", null);
50232 InfiniteRowModel = __decorate$2w([
50233 Bean('rowModel')
50234 ], InfiniteRowModel);
50235 return InfiniteRowModel;
50236}(BeanStub));
50237
50238var InfiniteRowModelModule = {
50239 moduleName: exports.ModuleNames.InfiniteRowModelModule,
50240 rowModels: { infinite: InfiniteRowModel }
50241};
50242
50243var BaseCreator = /** @class */ (function () {
50244 function BaseCreator() {
50245 }
50246 BaseCreator.prototype.setBeans = function (beans) {
50247 this.beans = beans;
50248 };
50249 BaseCreator.prototype.getFileName = function (fileName) {
50250 var extension = this.getDefaultFileExtension();
50251 if (fileName == null || !fileName.length) {
50252 fileName = this.getDefaultFileName();
50253 }
50254 return fileName.indexOf('.') === -1 ? fileName + "." + extension : fileName;
50255 };
50256 BaseCreator.prototype.getData = function (params) {
50257 var serializingSession = this.createSerializingSession(params);
50258 var data = this.beans.gridSerializer.serialize(serializingSession, params);
50259 return data;
50260 };
50261 return BaseCreator;
50262}());
50263
50264var BaseGridSerializingSession = /** @class */ (function () {
50265 function BaseGridSerializingSession(config) {
50266 this.groupColumns = [];
50267 var columnModel = config.columnModel, valueService = config.valueService, gridOptionsWrapper = config.gridOptionsWrapper, processCellCallback = config.processCellCallback, processHeaderCallback = config.processHeaderCallback, processGroupHeaderCallback = config.processGroupHeaderCallback, processRowGroupCallback = config.processRowGroupCallback;
50268 this.columnModel = columnModel;
50269 this.valueService = valueService;
50270 this.gridOptionsWrapper = gridOptionsWrapper;
50271 this.processCellCallback = processCellCallback;
50272 this.processHeaderCallback = processHeaderCallback;
50273 this.processGroupHeaderCallback = processGroupHeaderCallback;
50274 this.processRowGroupCallback = processRowGroupCallback;
50275 }
50276 BaseGridSerializingSession.prototype.prepare = function (columnsToExport) {
50277 this.groupColumns = columnsToExport.filter(function (col) { return !!col.getColDef().showRowGroup; });
50278 };
50279 BaseGridSerializingSession.prototype.extractHeaderValue = function (column) {
50280 var value = this.getHeaderName(this.processHeaderCallback, column);
50281 return value != null ? value : '';
50282 };
50283 BaseGridSerializingSession.prototype.extractRowCellValue = function (column, index, accumulatedRowIndex, type, node) {
50284 // we render the group summary text e.g. "-> Parent -> Child"...
50285 var groupIndex = this.gridOptionsWrapper.isGroupMultiAutoColumn() ? node.rowGroupIndex : 0;
50286 var renderGroupSummaryCell =
50287 // on group rows
50288 node && node.group
50289 && (
50290 // in the group column if groups appear in regular grid cells
50291 index === groupIndex && this.groupColumns.indexOf(column) !== -1
50292 // or the first cell in the row, if we're doing full width rows
50293 || (index === 0 && this.gridOptionsWrapper.isGroupUseEntireRow(this.columnModel.isPivotMode())));
50294 var valueForCell;
50295 if (renderGroupSummaryCell) {
50296 valueForCell = this.createValueForGroupNode(node);
50297 }
50298 else {
50299 valueForCell = this.valueService.getValue(column, node);
50300 }
50301 var value = this.processCell(accumulatedRowIndex, node, column, valueForCell, this.processCellCallback, type);
50302 return value != null ? value : '';
50303 };
50304 BaseGridSerializingSession.prototype.getHeaderName = function (callback, column) {
50305 if (callback) {
50306 return callback({
50307 column: column,
50308 api: this.gridOptionsWrapper.getApi(),
50309 columnApi: this.gridOptionsWrapper.getColumnApi(),
50310 context: this.gridOptionsWrapper.getContext()
50311 });
50312 }
50313 return this.columnModel.getDisplayNameForColumn(column, 'csv', true);
50314 };
50315 BaseGridSerializingSession.prototype.createValueForGroupNode = function (node) {
50316 if (this.processRowGroupCallback) {
50317 return this.processRowGroupCallback({
50318 node: node,
50319 api: this.gridOptionsWrapper.getApi(),
50320 columnApi: this.gridOptionsWrapper.getColumnApi(),
50321 context: this.gridOptionsWrapper.getContext(),
50322 });
50323 }
50324 var keys = [node.key];
50325 if (!this.gridOptionsWrapper.isGroupMultiAutoColumn()) {
50326 while (node.parent) {
50327 node = node.parent;
50328 keys.push(node.key);
50329 }
50330 }
50331 return keys.reverse().join(' -> ');
50332 };
50333 BaseGridSerializingSession.prototype.processCell = function (accumulatedRowIndex, rowNode, column, value, processCellCallback, type) {
50334 if (processCellCallback) {
50335 return processCellCallback({
50336 accumulatedRowIndex: accumulatedRowIndex,
50337 column: column,
50338 node: rowNode,
50339 value: value,
50340 api: this.gridOptionsWrapper.getApi(),
50341 columnApi: this.gridOptionsWrapper.getColumnApi(),
50342 context: this.gridOptionsWrapper.getContext(),
50343 type: type
50344 });
50345 }
50346 return value != null ? value : '';
50347 };
50348 return BaseGridSerializingSession;
50349}());
50350
50351var Downloader = /** @class */ (function () {
50352 function Downloader() {
50353 }
50354 Downloader.download = function (fileName, content) {
50355 var win = document.defaultView || window;
50356 if (!win) {
50357 console.warn('AG Grid: There is no `window` associated with the current `document`');
50358 return;
50359 }
50360 var element = document.createElement('a');
50361 // @ts-ignore
50362 var url = win.URL.createObjectURL(content);
50363 element.setAttribute('href', url);
50364 element.setAttribute('download', fileName);
50365 element.style.display = 'none';
50366 document.body.appendChild(element);
50367 element.dispatchEvent(new MouseEvent('click', {
50368 bubbles: false,
50369 cancelable: true,
50370 view: win
50371 }));
50372 document.body.removeChild(element);
50373 win.setTimeout(function () {
50374 // @ts-ignore
50375 win.URL.revokeObjectURL(url);
50376 }, 0);
50377 };
50378 return Downloader;
50379}());
50380
50381var __extends$2Q = (undefined && undefined.__extends) || (function () {
50382 var extendStatics = function (d, b) {
50383 extendStatics = Object.setPrototypeOf ||
50384 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
50385 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
50386 return extendStatics(d, b);
50387 };
50388 return function (d, b) {
50389 extendStatics(d, b);
50390 function __() { this.constructor = d; }
50391 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
50392 };
50393})();
50394var LINE_SEPARATOR = '\r\n';
50395var CsvSerializingSession = /** @class */ (function (_super) {
50396 __extends$2Q(CsvSerializingSession, _super);
50397 function CsvSerializingSession(config) {
50398 var _this = _super.call(this, config) || this;
50399 _this.isFirstLine = true;
50400 _this.result = '';
50401 var suppressQuotes = config.suppressQuotes, columnSeparator = config.columnSeparator;
50402 _this.suppressQuotes = suppressQuotes;
50403 _this.columnSeparator = columnSeparator;
50404 return _this;
50405 }
50406 CsvSerializingSession.prototype.addCustomContent = function (content) {
50407 var _this = this;
50408 if (!content) {
50409 return;
50410 }
50411 if (typeof content === 'string') {
50412 if (!/^\s*\n/.test(content)) {
50413 this.beginNewLine();
50414 }
50415 // replace whatever newlines are supplied with the style we're using
50416 content = content.replace(/\r?\n/g, LINE_SEPARATOR);
50417 this.result += content;
50418 }
50419 else {
50420 content.forEach(function (row) {
50421 _this.beginNewLine();
50422 row.forEach(function (cell, index) {
50423 if (index !== 0) {
50424 _this.result += _this.columnSeparator;
50425 }
50426 _this.result += _this.putInQuotes(cell.data.value || '');
50427 if (cell.mergeAcross) {
50428 _this.appendEmptyCells(cell.mergeAcross);
50429 }
50430 });
50431 });
50432 }
50433 };
50434 CsvSerializingSession.prototype.onNewHeaderGroupingRow = function () {
50435 this.beginNewLine();
50436 return {
50437 onColumn: this.onNewHeaderGroupingRowColumn.bind(this)
50438 };
50439 };
50440 CsvSerializingSession.prototype.onNewHeaderGroupingRowColumn = function (header, index, span) {
50441 if (index != 0) {
50442 this.result += this.columnSeparator;
50443 }
50444 this.result += this.putInQuotes(header);
50445 this.appendEmptyCells(span);
50446 };
50447 CsvSerializingSession.prototype.appendEmptyCells = function (count) {
50448 for (var i = 1; i <= count; i++) {
50449 this.result += this.columnSeparator + this.putInQuotes("");
50450 }
50451 };
50452 CsvSerializingSession.prototype.onNewHeaderRow = function () {
50453 this.beginNewLine();
50454 return {
50455 onColumn: this.onNewHeaderRowColumn.bind(this)
50456 };
50457 };
50458 CsvSerializingSession.prototype.onNewHeaderRowColumn = function (column, index) {
50459 if (index != 0) {
50460 this.result += this.columnSeparator;
50461 }
50462 this.result += this.putInQuotes(this.extractHeaderValue(column));
50463 };
50464 CsvSerializingSession.prototype.onNewBodyRow = function () {
50465 this.beginNewLine();
50466 return {
50467 onColumn: this.onNewBodyRowColumn.bind(this)
50468 };
50469 };
50470 CsvSerializingSession.prototype.onNewBodyRowColumn = function (column, index, node) {
50471 if (index != 0) {
50472 this.result += this.columnSeparator;
50473 }
50474 this.result += this.putInQuotes(this.extractRowCellValue(column, index, index, Constants.EXPORT_TYPE_CSV, node));
50475 };
50476 CsvSerializingSession.prototype.putInQuotes = function (value) {
50477 if (this.suppressQuotes) {
50478 return value;
50479 }
50480 if (value === null || value === undefined) {
50481 return '""';
50482 }
50483 var stringValue;
50484 if (typeof value === 'string') {
50485 stringValue = value;
50486 }
50487 else if (typeof value.toString === 'function') {
50488 stringValue = value.toString();
50489 }
50490 else {
50491 console.warn('AG Grid: unknown value type during csv conversion');
50492 stringValue = '';
50493 }
50494 // replace each " with "" (ie two sets of double quotes is how to do double quotes in csv)
50495 var valueEscaped = stringValue.replace(/"/g, "\"\"");
50496 return '"' + valueEscaped + '"';
50497 };
50498 CsvSerializingSession.prototype.parse = function () {
50499 return this.result;
50500 };
50501 CsvSerializingSession.prototype.beginNewLine = function () {
50502 if (!this.isFirstLine) {
50503 this.result += LINE_SEPARATOR;
50504 }
50505 this.isFirstLine = false;
50506 };
50507 return CsvSerializingSession;
50508}(BaseGridSerializingSession));
50509
50510var __extends$2R = (undefined && undefined.__extends) || (function () {
50511 var extendStatics = function (d, b) {
50512 extendStatics = Object.setPrototypeOf ||
50513 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
50514 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
50515 return extendStatics(d, b);
50516 };
50517 return function (d, b) {
50518 extendStatics(d, b);
50519 function __() { this.constructor = d; }
50520 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
50521 };
50522})();
50523var __decorate$2x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
50524 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
50525 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
50526 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;
50527 return c > 3 && r && Object.defineProperty(target, key, r), r;
50528};
50529var CsvCreator = /** @class */ (function (_super) {
50530 __extends$2R(CsvCreator, _super);
50531 function CsvCreator() {
50532 return _super !== null && _super.apply(this, arguments) || this;
50533 }
50534 CsvCreator.prototype.postConstruct = function () {
50535 this.setBeans({
50536 gridSerializer: this.gridSerializer,
50537 gridOptionsWrapper: this.gridOptionsWrapper
50538 });
50539 };
50540 CsvCreator.prototype.getMergedParams = function (params) {
50541 var baseParams = this.gridOptionsWrapper.getDefaultExportParams('csv');
50542 return Object.assign({}, baseParams, params);
50543 };
50544 CsvCreator.prototype.export = function (userParams) {
50545 if (this.isExportSuppressed()) {
50546 console.warn("AG Grid: Export cancelled. Export is not allowed as per your configuration.");
50547 return '';
50548 }
50549 var mergedParams = this.getMergedParams(userParams);
50550 var data = this.getData(mergedParams);
50551 var packagedFile = new Blob(["\ufeff", data], { type: 'text/plain' });
50552 Downloader.download(this.getFileName(mergedParams.fileName), packagedFile);
50553 return data;
50554 };
50555 CsvCreator.prototype.exportDataAsCsv = function (params) {
50556 return this.export(params);
50557 };
50558 CsvCreator.prototype.getDataAsCsv = function (params) {
50559 var mergedParams = this.getMergedParams(params);
50560 return this.getData(mergedParams);
50561 };
50562 CsvCreator.prototype.getDefaultFileName = function () {
50563 return 'export.csv';
50564 };
50565 CsvCreator.prototype.getDefaultFileExtension = function () {
50566 return 'csv';
50567 };
50568 CsvCreator.prototype.createSerializingSession = function (params) {
50569 var _a = this, columnModel = _a.columnModel, valueService = _a.valueService, gridOptionsWrapper = _a.gridOptionsWrapper;
50570 var _b = params, processCellCallback = _b.processCellCallback, processHeaderCallback = _b.processHeaderCallback, processGroupHeaderCallback = _b.processGroupHeaderCallback, processRowGroupCallback = _b.processRowGroupCallback, suppressQuotes = _b.suppressQuotes, columnSeparator = _b.columnSeparator;
50571 return new CsvSerializingSession({
50572 columnModel: columnModel,
50573 valueService: valueService,
50574 gridOptionsWrapper: gridOptionsWrapper,
50575 processCellCallback: processCellCallback || undefined,
50576 processHeaderCallback: processHeaderCallback || undefined,
50577 processGroupHeaderCallback: processGroupHeaderCallback || undefined,
50578 processRowGroupCallback: processRowGroupCallback || undefined,
50579 suppressQuotes: suppressQuotes || false,
50580 columnSeparator: columnSeparator || ','
50581 });
50582 };
50583 CsvCreator.prototype.isExportSuppressed = function () {
50584 return this.gridOptionsWrapper.isSuppressCsvExport();
50585 };
50586 __decorate$2x([
50587 Autowired('columnModel')
50588 ], CsvCreator.prototype, "columnModel", void 0);
50589 __decorate$2x([
50590 Autowired('valueService')
50591 ], CsvCreator.prototype, "valueService", void 0);
50592 __decorate$2x([
50593 Autowired('gridSerializer')
50594 ], CsvCreator.prototype, "gridSerializer", void 0);
50595 __decorate$2x([
50596 Autowired('gridOptionsWrapper')
50597 ], CsvCreator.prototype, "gridOptionsWrapper", void 0);
50598 __decorate$2x([
50599 PostConstruct
50600 ], CsvCreator.prototype, "postConstruct", null);
50601 CsvCreator = __decorate$2x([
50602 Bean('csvCreator')
50603 ], CsvCreator);
50604 return CsvCreator;
50605}(BaseCreator));
50606
50607var __extends$2S = (undefined && undefined.__extends) || (function () {
50608 var extendStatics = function (d, b) {
50609 extendStatics = Object.setPrototypeOf ||
50610 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
50611 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
50612 return extendStatics(d, b);
50613 };
50614 return function (d, b) {
50615 extendStatics(d, b);
50616 function __() { this.constructor = d; }
50617 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
50618 };
50619})();
50620var __decorate$2y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
50621 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
50622 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
50623 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;
50624 return c > 3 && r && Object.defineProperty(target, key, r), r;
50625};
50626(function (RowType) {
50627 RowType[RowType["HEADER_GROUPING"] = 0] = "HEADER_GROUPING";
50628 RowType[RowType["HEADER"] = 1] = "HEADER";
50629 RowType[RowType["BODY"] = 2] = "BODY";
50630})(exports.RowType || (exports.RowType = {}));
50631var GridSerializer = /** @class */ (function (_super) {
50632 __extends$2S(GridSerializer, _super);
50633 function GridSerializer() {
50634 return _super !== null && _super.apply(this, arguments) || this;
50635 }
50636 GridSerializer.prototype.serialize = function (gridSerializingSession, params) {
50637 if (params === void 0) { params = {}; }
50638 var columnsToExport = this.getColumnsToExport(params.allColumns, params.columnKeys);
50639 var serializeChain = _.compose(
50640 // first pass, put in the header names of the cols
50641 this.prepareSession(columnsToExport), this.prependContent(params), this.exportColumnGroups(params, columnsToExport), this.exportHeaders(params, columnsToExport), this.processPinnedTopRows(params, columnsToExport), this.processRows(params, columnsToExport), this.processPinnedBottomRows(params, columnsToExport), this.appendContent(params));
50642 return serializeChain(gridSerializingSession).parse();
50643 };
50644 GridSerializer.prototype.processRow = function (gridSerializingSession, params, columnsToExport, node) {
50645 var _this = this;
50646 var rowSkipper = params.shouldRowBeSkipped || (function () { return false; });
50647 var gridOptionsWrapper = this.gridOptionsWrapper;
50648 var context = gridOptionsWrapper.getContext();
50649 var api = gridOptionsWrapper.getApi();
50650 var columnApi = gridOptionsWrapper.getColumnApi();
50651 var skipSingleChildrenGroup = gridOptionsWrapper.isGroupRemoveSingleChildren();
50652 var hideOpenParents = gridOptionsWrapper.isGroupHideOpenParents();
50653 var skipLowestSingleChildrenGroup = gridOptionsWrapper.isGroupRemoveLowestSingleChildren();
50654 var isLeafNode = this.columnModel.isPivotMode() ? node.leafGroup : !node.group;
50655 var skipRowGroups = params.skipGroups || params.skipRowGroups;
50656 var shouldSkipLowestGroup = skipLowestSingleChildrenGroup && node.leafGroup;
50657 var shouldSkipCurrentGroup = node.allChildrenCount === 1 && (skipSingleChildrenGroup || shouldSkipLowestGroup);
50658 if (skipRowGroups && params.skipGroups) {
50659 _.doOnce(function () { return console.warn('AG Grid: Since v25.2 `skipGroups` has been renamed to `skipRowGroups`.'); }, 'gridSerializer-skipGroups');
50660 }
50661 var rowPosition = { rowIndex: node.rowIndex, rowPinned: node.rowPinned };
50662 if ((!isLeafNode && (params.skipRowGroups || shouldSkipCurrentGroup || hideOpenParents)) ||
50663 (params.onlySelected && !node.isSelected()) ||
50664 (params.rowNodes && !params.rowNodes.some(function (position) { return _this.rowPositionUtils.sameRow(position, rowPosition); })) ||
50665 (params.skipPinnedTop && node.rowPinned === 'top') ||
50666 (params.skipPinnedBottom && node.rowPinned === 'bottom')) {
50667 return;
50668 }
50669 // if we are in pivotMode, then the grid will show the root node only
50670 // if it's not a leaf group
50671 var nodeIsRootNode = node.level === -1;
50672 if (nodeIsRootNode && !node.leafGroup) {
50673 return;
50674 }
50675 var shouldRowBeSkipped = rowSkipper({ node: node, api: api, columnApi: columnApi, context: context });
50676 if (shouldRowBeSkipped) {
50677 return;
50678 }
50679 var rowAccumulator = gridSerializingSession.onNewBodyRow();
50680 columnsToExport.forEach(function (column, index) {
50681 rowAccumulator.onColumn(column, index, node);
50682 });
50683 if (params.getCustomContentBelowRow) {
50684 var content = params.getCustomContentBelowRow({ node: node, api: api, columnApi: columnApi, context: context });
50685 if (content) {
50686 gridSerializingSession.addCustomContent(content);
50687 }
50688 }
50689 };
50690 GridSerializer.prototype.appendContent = function (params) {
50691 return function (gridSerializingSession) {
50692 var appendContent = params.customFooter || params.appendContent;
50693 if (appendContent) {
50694 if (params.customFooter) {
50695 _.doOnce(function () { return console.warn('AG Grid: Since version 25.2.0 the `customFooter` param has been deprecated. Use `appendContent` instead.'); }, 'gridSerializer-customFooter');
50696 }
50697 gridSerializingSession.addCustomContent(appendContent);
50698 }
50699 return gridSerializingSession;
50700 };
50701 };
50702 GridSerializer.prototype.prependContent = function (params) {
50703 return function (gridSerializingSession) {
50704 var prependContent = params.customHeader || params.prependContent;
50705 if (prependContent) {
50706 if (params.customHeader) {
50707 _.doOnce(function () { return console.warn('AG Grid: Since version 25.2.0 the `customHeader` param has been deprecated. Use `prependContent` instead.'); }, 'gridSerializer-customHeader');
50708 }
50709 gridSerializingSession.addCustomContent(prependContent);
50710 }
50711 return gridSerializingSession;
50712 };
50713 };
50714 GridSerializer.prototype.prepareSession = function (columnsToExport) {
50715 return function (gridSerializingSession) {
50716 gridSerializingSession.prepare(columnsToExport);
50717 return gridSerializingSession;
50718 };
50719 };
50720 GridSerializer.prototype.exportColumnGroups = function (params, columnsToExport) {
50721 var _this = this;
50722 return function (gridSerializingSession) {
50723 if (!params.skipColumnGroupHeaders) {
50724 var groupInstanceIdCreator = new GroupInstanceIdCreator();
50725 var displayedGroups = _this.displayedGroupCreator.createDisplayedGroups(columnsToExport, _this.columnModel.getGridBalancedTree(), groupInstanceIdCreator, null);
50726 _this.recursivelyAddHeaderGroups(displayedGroups, gridSerializingSession, params.processGroupHeaderCallback);
50727 }
50728 else if (params.columnGroups) {
50729 _.doOnce(function () { return console.warn('AG Grid: Since v25.2 the `columnGroups` param has deprecated, and groups are exported by default.'); }, 'gridSerializer-columnGroups');
50730 }
50731 return gridSerializingSession;
50732 };
50733 };
50734 GridSerializer.prototype.exportHeaders = function (params, columnsToExport) {
50735 return function (gridSerializingSession) {
50736 if (!params.skipHeader && !params.skipColumnHeaders) {
50737 var gridRowIterator_1 = gridSerializingSession.onNewHeaderRow();
50738 columnsToExport.forEach(function (column, index) {
50739 gridRowIterator_1.onColumn(column, index, undefined);
50740 });
50741 }
50742 else if (params.skipHeader) {
50743 _.doOnce(function () { return console.warn('AG Grid: Since v25.2 the `skipHeader` param has been renamed to `skipColumnHeaders`.'); }, 'gridSerializer-skipHeader');
50744 }
50745 return gridSerializingSession;
50746 };
50747 };
50748 GridSerializer.prototype.processPinnedTopRows = function (params, columnsToExport) {
50749 var _this = this;
50750 return function (gridSerializingSession) {
50751 var processRow = _this.processRow.bind(_this, gridSerializingSession, params, columnsToExport);
50752 _this.pinnedRowModel.forEachPinnedTopRow(processRow);
50753 return gridSerializingSession;
50754 };
50755 };
50756 GridSerializer.prototype.processRows = function (params, columnsToExport) {
50757 var _this = this;
50758 return function (gridSerializingSession) {
50759 // when in pivot mode, we always render cols on screen, never 'all columns'
50760 var rowModel = _this.rowModel;
50761 var rowModelType = rowModel.getType();
50762 var usingCsrm = rowModelType === Constants.ROW_MODEL_TYPE_CLIENT_SIDE;
50763 var usingSsrm = rowModelType === Constants.ROW_MODEL_TYPE_SERVER_SIDE;
50764 var onlySelectedNonStandardModel = !usingCsrm && params.onlySelected;
50765 var processRow = _this.processRow.bind(_this, gridSerializingSession, params, columnsToExport);
50766 if (_this.columnModel.isPivotMode()) {
50767 if (usingCsrm) {
50768 rowModel.forEachPivotNode(processRow);
50769 }
50770 else {
50771 // must be enterprise, so we can just loop through all the nodes
50772 rowModel.forEachNode(processRow);
50773 }
50774 }
50775 else {
50776 // onlySelectedAllPages: user doing pagination and wants selected items from
50777 // other pages, so cannot use the standard row model as it won't have rows from
50778 // other pages.
50779 // onlySelectedNonStandardModel: if user wants selected in non standard row model
50780 // (eg viewport) then again RowModel cannot be used, so need to use selected instead.
50781 if (params.onlySelectedAllPages || onlySelectedNonStandardModel) {
50782 var selectedNodes = _this.selectionService.getSelectedNodes();
50783 selectedNodes.forEach(processRow);
50784 }
50785 else {
50786 // here is everything else - including standard row model and selected. we don't use
50787 // the selection model even when just using selected, so that the result is the order
50788 // of the rows appearing on the screen.
50789 if (usingCsrm) {
50790 rowModel.forEachNodeAfterFilterAndSort(processRow);
50791 }
50792 else if (usingSsrm) {
50793 rowModel.forEachNodeAfterFilterAndSort(processRow);
50794 }
50795 else {
50796 rowModel.forEachNode(processRow);
50797 }
50798 }
50799 }
50800 return gridSerializingSession;
50801 };
50802 };
50803 GridSerializer.prototype.processPinnedBottomRows = function (params, columnsToExport) {
50804 var _this = this;
50805 return function (gridSerializingSession) {
50806 var processRow = _this.processRow.bind(_this, gridSerializingSession, params, columnsToExport);
50807 _this.pinnedRowModel.forEachPinnedBottomRow(processRow);
50808 return gridSerializingSession;
50809 };
50810 };
50811 GridSerializer.prototype.getColumnsToExport = function (allColumns, columnKeys) {
50812 if (allColumns === void 0) { allColumns = false; }
50813 var isPivotMode = this.columnModel.isPivotMode();
50814 if (columnKeys && columnKeys.length) {
50815 return this.columnModel.getGridColumns(columnKeys);
50816 }
50817 if (allColumns && !isPivotMode) {
50818 // add auto group column for tree data
50819 var columns = this.gridOptionsWrapper.isTreeData()
50820 ? this.columnModel.getGridColumns([Constants.GROUP_AUTO_COLUMN_ID])
50821 : [];
50822 return columns.concat(this.columnModel.getAllPrimaryColumns() || []);
50823 }
50824 return this.columnModel.getAllDisplayedColumns();
50825 };
50826 GridSerializer.prototype.recursivelyAddHeaderGroups = function (displayedGroups, gridSerializingSession, processGroupHeaderCallback) {
50827 var directChildrenHeaderGroups = [];
50828 displayedGroups.forEach(function (columnGroupChild) {
50829 var columnGroup = columnGroupChild;
50830 if (!columnGroup.getChildren) {
50831 return;
50832 }
50833 columnGroup.getChildren().forEach(function (it) { return directChildrenHeaderGroups.push(it); });
50834 });
50835 if (displayedGroups.length > 0 && displayedGroups[0] instanceof ColumnGroup) {
50836 this.doAddHeaderHeader(gridSerializingSession, displayedGroups, processGroupHeaderCallback);
50837 }
50838 if (directChildrenHeaderGroups && directChildrenHeaderGroups.length > 0) {
50839 this.recursivelyAddHeaderGroups(directChildrenHeaderGroups, gridSerializingSession, processGroupHeaderCallback);
50840 }
50841 };
50842 GridSerializer.prototype.doAddHeaderHeader = function (gridSerializingSession, displayedGroups, processGroupHeaderCallback) {
50843 var _this = this;
50844 var gridRowIterator = gridSerializingSession.onNewHeaderGroupingRow();
50845 var columnIndex = 0;
50846 displayedGroups.forEach(function (columnGroupChild) {
50847 var columnGroup = columnGroupChild;
50848 var name;
50849 if (processGroupHeaderCallback) {
50850 name = processGroupHeaderCallback({
50851 columnGroup: columnGroup,
50852 api: _this.gridOptionsWrapper.getApi(),
50853 columnApi: _this.gridOptionsWrapper.getColumnApi(),
50854 context: _this.gridOptionsWrapper.getContext()
50855 });
50856 }
50857 else {
50858 name = _this.columnModel.getDisplayNameForColumnGroup(columnGroup, 'header');
50859 }
50860 var collapsibleGroupRanges = columnGroup.getLeafColumns().reduce(function (collapsibleGroups, currentColumn, currentIdx, arr) {
50861 var lastGroup = _.last(collapsibleGroups);
50862 var groupShow = currentColumn.getColumnGroupShow() === 'open';
50863 if (!groupShow) {
50864 if (lastGroup && lastGroup[1] == null) {
50865 lastGroup[1] = currentIdx - 1;
50866 }
50867 }
50868 else if (!lastGroup || lastGroup[1] != null) {
50869 lastGroup = [currentIdx];
50870 collapsibleGroups.push(lastGroup);
50871 }
50872 if (currentIdx === arr.length - 1 && lastGroup && lastGroup[1] == null) {
50873 lastGroup[1] = currentIdx;
50874 }
50875 return collapsibleGroups;
50876 }, []);
50877 gridRowIterator.onColumn(name || '', columnIndex++, columnGroup.getLeafColumns().length - 1, collapsibleGroupRanges);
50878 });
50879 };
50880 __decorate$2y([
50881 Autowired('displayedGroupCreator')
50882 ], GridSerializer.prototype, "displayedGroupCreator", void 0);
50883 __decorate$2y([
50884 Autowired('columnModel')
50885 ], GridSerializer.prototype, "columnModel", void 0);
50886 __decorate$2y([
50887 Autowired('rowModel')
50888 ], GridSerializer.prototype, "rowModel", void 0);
50889 __decorate$2y([
50890 Autowired('pinnedRowModel')
50891 ], GridSerializer.prototype, "pinnedRowModel", void 0);
50892 __decorate$2y([
50893 Autowired('selectionService')
50894 ], GridSerializer.prototype, "selectionService", void 0);
50895 __decorate$2y([
50896 Autowired('rowPositionUtils')
50897 ], GridSerializer.prototype, "rowPositionUtils", void 0);
50898 GridSerializer = __decorate$2y([
50899 Bean("gridSerializer")
50900 ], GridSerializer);
50901 return GridSerializer;
50902}(BeanStub));
50903
50904var CsvExportModule = {
50905 moduleName: exports.ModuleNames.CsvExportModule,
50906 beans: [CsvCreator, GridSerializer]
50907};
50908
50909var LINE_SEPARATOR$1 = '\r\n';
50910var XmlFactory = /** @class */ (function () {
50911 function XmlFactory() {
50912 }
50913 XmlFactory.createHeader = function (headerElement) {
50914 if (headerElement === void 0) { headerElement = {}; }
50915 var headerStart = '<?';
50916 var headerEnd = '?>';
50917 var keys = ['version'];
50918 if (!headerElement.version) {
50919 headerElement.version = "1.0";
50920 }
50921 if (headerElement.encoding) {
50922 keys.push('encoding');
50923 }
50924 if (headerElement.standalone) {
50925 keys.push('standalone');
50926 }
50927 var att = keys.map(function (key) { return key + "=\"" + headerElement[key] + "\""; }).join(' ');
50928 return headerStart + "xml " + att + " " + headerEnd;
50929 };
50930 XmlFactory.createXml = function (xmlElement, booleanTransformer) {
50931 var _this = this;
50932 var props = '';
50933 if (xmlElement.properties) {
50934 if (xmlElement.properties.prefixedAttributes) {
50935 xmlElement.properties.prefixedAttributes.forEach(function (prefixedSet) {
50936 Object.keys(prefixedSet.map).forEach(function (key) {
50937 props += _this.returnAttributeIfPopulated(prefixedSet.prefix + key, prefixedSet.map[key], booleanTransformer);
50938 });
50939 });
50940 }
50941 if (xmlElement.properties.rawMap) {
50942 Object.keys(xmlElement.properties.rawMap).forEach(function (key) {
50943 props += _this.returnAttributeIfPopulated(key, xmlElement.properties.rawMap[key], booleanTransformer);
50944 });
50945 }
50946 }
50947 var result = '<' + xmlElement.name + props;
50948 if (!xmlElement.children && xmlElement.textNode == null) {
50949 return result + '/>' + LINE_SEPARATOR$1;
50950 }
50951 if (xmlElement.textNode != null) {
50952 return result + '>' + xmlElement.textNode + '</' + xmlElement.name + '>' + LINE_SEPARATOR$1;
50953 }
50954 result += '>' + LINE_SEPARATOR$1;
50955 if (xmlElement.children) {
50956 xmlElement.children.forEach(function (it) {
50957 result += _this.createXml(it, booleanTransformer);
50958 });
50959 }
50960 return result + '</' + xmlElement.name + '>' + LINE_SEPARATOR$1;
50961 };
50962 XmlFactory.returnAttributeIfPopulated = function (key, value, booleanTransformer) {
50963 if (!value && value !== '' && value !== 0) {
50964 return '';
50965 }
50966 var xmlValue = value;
50967 if ((typeof (value) === 'boolean')) {
50968 if (booleanTransformer) {
50969 xmlValue = booleanTransformer(value);
50970 }
50971 }
50972 return " " + key + "=\"" + xmlValue + "\"";
50973 };
50974 return XmlFactory;
50975}());
50976
50977var __values$3 = (undefined && undefined.__values) || function(o) {
50978 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
50979 if (m) return m.call(o);
50980 if (o && typeof o.length === "number") return {
50981 next: function () {
50982 if (o && i >= o.length) o = void 0;
50983 return { value: o && o[i++], done: !o };
50984 }
50985 };
50986 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
50987};
50988// table for crc calculation
50989// from: https://referencesource.microsoft.com/#System/sys/System/IO/compression/Crc32Helper.cs,3b31978c7d7f7246,references
50990var crcTable = new Uint32Array([
50991 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
50992 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
50993 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
50994 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
50995 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
50996 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
50997 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
50998 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
50999 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
51000 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
51001 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
51002 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
51003 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
51004 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
51005 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
51006 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
51007 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
51008 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
51009 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
51010 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
51011 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
51012 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
51013 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
51014 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
51015 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
51016 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
51017 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
51018 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
51019 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
51020 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
51021 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
51022 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
51023 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
51024 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
51025 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
51026 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
51027 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
51028 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
51029 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
51030 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
51031 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
51032 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
51033 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
51034]);
51035var ZipContainer = /** @class */ (function () {
51036 function ZipContainer() {
51037 }
51038 ZipContainer.addFolders = function (paths) {
51039 paths.forEach(this.addFolder.bind(this));
51040 };
51041 ZipContainer.addFolder = function (path) {
51042 this.folders.push({
51043 path: path,
51044 created: new Date(),
51045 isBase64: false
51046 });
51047 };
51048 ZipContainer.addFile = function (path, content, isBase64) {
51049 if (isBase64 === void 0) { isBase64 = false; }
51050 this.files.push({
51051 path: path,
51052 created: new Date(),
51053 content: content,
51054 isBase64: isBase64
51055 });
51056 };
51057 ZipContainer.getContent = function (mimeType) {
51058 if (mimeType === void 0) { mimeType = 'application/zip'; }
51059 var textOutput = this.buildFileStream();
51060 var uInt8Output = this.buildUint8Array(textOutput);
51061 this.clearStream();
51062 return new Blob([uInt8Output], { type: mimeType });
51063 };
51064 ZipContainer.clearStream = function () {
51065 this.folders = [];
51066 this.files = [];
51067 };
51068 ZipContainer.buildFileStream = function (fData) {
51069 var e_1, _a;
51070 if (fData === void 0) { fData = ''; }
51071 var totalFiles = this.folders.concat(this.files);
51072 var len = totalFiles.length;
51073 var foData = '';
51074 var lL = 0;
51075 var cL = 0;
51076 try {
51077 for (var totalFiles_1 = __values$3(totalFiles), totalFiles_1_1 = totalFiles_1.next(); !totalFiles_1_1.done; totalFiles_1_1 = totalFiles_1.next()) {
51078 var currentFile = totalFiles_1_1.value;
51079 var _b = this.getHeader(currentFile, lL), fileHeader = _b.fileHeader, folderHeader = _b.folderHeader, content = _b.content;
51080 lL += fileHeader.length + content.length;
51081 cL += folderHeader.length;
51082 fData += fileHeader + content;
51083 foData += folderHeader;
51084 }
51085 }
51086 catch (e_1_1) { e_1 = { error: e_1_1 }; }
51087 finally {
51088 try {
51089 if (totalFiles_1_1 && !totalFiles_1_1.done && (_a = totalFiles_1.return)) _a.call(totalFiles_1);
51090 }
51091 finally { if (e_1) throw e_1.error; }
51092 }
51093 var foEnd = this.buildFolderEnd(len, cL, lL);
51094 return fData + foData + foEnd;
51095 };
51096 ZipContainer.getHeader = function (currentFile, offset) {
51097 var content = currentFile.content, path = currentFile.path, created = currentFile.created, isBase64 = currentFile.isBase64;
51098 var utf8_encode = _.utf8_encode, decToHex = _.decToHex;
51099 var utfPath = utf8_encode(path);
51100 var isUTF8 = utfPath !== path;
51101 var time = this.convertTime(created);
51102 var dt = this.convertDate(created);
51103 var extraFields = '';
51104 if (isUTF8) {
51105 var uExtraFieldPath = decToHex(1, 1) + decToHex(this.getFromCrc32Table(utfPath), 4) + utfPath;
51106 extraFields = "\x75\x70" + decToHex(uExtraFieldPath.length, 2) + uExtraFieldPath;
51107 }
51108 var _a = !content ? { size: 0, content: '' } : this.getConvertedContent(content, isBase64), size = _a.size, convertedContent = _a.content;
51109 var header = '\x0A\x00' +
51110 (isUTF8 ? '\x00\x08' : '\x00\x00') +
51111 '\x00\x00' +
51112 decToHex(time, 2) + // last modified time
51113 decToHex(dt, 2) + // last modified date
51114 decToHex(size ? this.getFromCrc32Table(convertedContent) : 0, 4) +
51115 decToHex(size, 4) + // compressed size
51116 decToHex(size, 4) + // uncompressed size
51117 decToHex(utfPath.length, 2) + // file name length
51118 decToHex(extraFields.length, 2); // extra field length
51119 var fileHeader = 'PK\x03\x04' + header + utfPath + extraFields;
51120 var folderHeader = 'PK\x01\x02' + // central header
51121 '\x14\x00' +
51122 header + // file header
51123 '\x00\x00' +
51124 '\x00\x00' +
51125 '\x00\x00' +
51126 (content ? '\x00\x00\x00\x00' : '\x10\x00\x00\x00') + // external file attributes
51127 decToHex(offset, 4) + // relative offset of local header
51128 utfPath + // file name
51129 extraFields; // extra field
51130 return { fileHeader: fileHeader, folderHeader: folderHeader, content: convertedContent || '' };
51131 };
51132 ZipContainer.getConvertedContent = function (content, isBase64) {
51133 if (isBase64 === void 0) { isBase64 = false; }
51134 if (isBase64) {
51135 content = content.split(';base64,')[1];
51136 }
51137 content = isBase64 ? atob(content) : content;
51138 return {
51139 size: content.length,
51140 content: content
51141 };
51142 };
51143 ZipContainer.buildFolderEnd = function (tLen, cLen, lLen) {
51144 var decToHex = _.decToHex;
51145 return 'PK\x05\x06' + // central folder end
51146 '\x00\x00' +
51147 '\x00\x00' +
51148 decToHex(tLen, 2) + // total number of entries in the central folder
51149 decToHex(tLen, 2) + // total number of entries in the central folder
51150 decToHex(cLen, 4) + // size of the central folder
51151 decToHex(lLen, 4) + // central folder start offset
51152 '\x00\x00';
51153 };
51154 ZipContainer.buildUint8Array = function (content) {
51155 var uint8 = new Uint8Array(content.length);
51156 for (var i = 0; i < uint8.length; i++) {
51157 uint8[i] = content.charCodeAt(i);
51158 }
51159 return uint8;
51160 };
51161 ZipContainer.getFromCrc32Table = function (content) {
51162 if (!content.length) {
51163 return 0;
51164 }
51165 var size = content.length;
51166 var iterable = new Uint8Array(size);
51167 for (var i = 0; i < size; i++) {
51168 iterable[i] = content.charCodeAt(i);
51169 }
51170 var crc = 0 ^ (-1);
51171 var j = 0;
51172 var k = 0;
51173 var l = 0;
51174 for (var i = 0; i < size; i++) {
51175 j = iterable[i];
51176 k = (crc ^ j) & 0xFF;
51177 l = crcTable[k];
51178 crc = (crc >>> 8) ^ l;
51179 }
51180 return crc ^ (-1);
51181 };
51182 ZipContainer.convertTime = function (date) {
51183 var time = date.getHours();
51184 time <<= 6;
51185 time = time | date.getMinutes();
51186 time <<= 5;
51187 time = time | date.getSeconds() / 2;
51188 return time;
51189 };
51190 ZipContainer.convertDate = function (date) {
51191 var dt = date.getFullYear() - 1980;
51192 dt <<= 4;
51193 dt = dt | (date.getMonth() + 1);
51194 dt <<= 5;
51195 dt = dt | date.getDate();
51196 return dt;
51197 };
51198 ZipContainer.folders = [];
51199 ZipContainer.files = [];
51200 return ZipContainer;
51201}());
51202
51203ModuleRegistry.register(ClientSideRowModelModule, false);
51204ModuleRegistry.register(InfiniteRowModelModule, false);
51205ModuleRegistry.register(CsvExportModule, false);
51206
51207exports.AbstractHeaderCellCtrl = AbstractHeaderCellCtrl;
51208exports.AgAbstractField = AgAbstractField;
51209exports.AgAngleSelect = AgAngleSelect;
51210exports.AgCheckbox = AgCheckbox;
51211exports.AgColorPicker = AgColorPicker;
51212exports.AgDialog = AgDialog;
51213exports.AgGroupComponent = AgGroupComponent;
51214exports.AgInputNumberField = AgInputNumberField;
51215exports.AgInputRange = AgInputRange;
51216exports.AgInputTextArea = AgInputTextArea;
51217exports.AgInputTextField = AgInputTextField;
51218exports.AgMenuItemComponent = AgMenuItemComponent;
51219exports.AgMenuList = AgMenuList;
51220exports.AgMenuPanel = AgMenuPanel;
51221exports.AgPanel = AgPanel;
51222exports.AgPromise = AgPromise;
51223exports.AgRadioButton = AgRadioButton;
51224exports.AgSelect = AgSelect;
51225exports.AgSlider = AgSlider;
51226exports.AgStackComponentsRegistry = AgStackComponentsRegistry;
51227exports.AgToggleButton = AgToggleButton;
51228exports.AlignedGridsService = AlignedGridsService;
51229exports.AnimateShowChangeCellRenderer = AnimateShowChangeCellRenderer;
51230exports.AnimateSlideCellRenderer = AnimateSlideCellRenderer;
51231exports.AnimationFrameService = AnimationFrameService;
51232exports.AutoScrollService = AutoScrollService;
51233exports.AutoWidthCalculator = AutoWidthCalculator;
51234exports.Autowired = Autowired;
51235exports.BaseComponentWrapper = BaseComponentWrapper;
51236exports.BaseCreator = BaseCreator;
51237exports.BaseGridSerializingSession = BaseGridSerializingSession;
51238exports.Bean = Bean;
51239exports.BeanStub = BeanStub;
51240exports.Beans = Beans;
51241exports.BodyDropPivotTarget = BodyDropPivotTarget;
51242exports.BodyDropTarget = BodyDropTarget;
51243exports.CellComp = CellComp;
51244exports.CellCtrl = CellCtrl;
51245exports.CellNavigationService = CellNavigationService;
51246exports.CellPositionUtils = CellPositionUtils;
51247exports.ChangedPath = ChangedPath;
51248exports.CheckboxSelectionComponent = CheckboxSelectionComponent;
51249exports.ColDefUtil = ColDefUtil;
51250exports.Color = Color;
51251exports.Column = Column;
51252exports.ColumnApi = ColumnApi;
51253exports.ColumnFactory = ColumnFactory;
51254exports.ColumnGroup = ColumnGroup;
51255exports.ColumnKeyCreator = ColumnKeyCreator;
51256exports.ColumnModel = ColumnModel;
51257exports.ColumnUtils = ColumnUtils;
51258exports.Component = Component;
51259exports.ComponentUtil = ComponentUtil;
51260exports.Constants = Constants;
51261exports.Context = Context;
51262exports.CssClassApplier = CssClassApplier;
51263exports.CssClassManager = CssClassManager;
51264exports.CsvCreator = CsvCreator;
51265exports.CsvExportModule = CsvExportModule;
51266exports.CtrlsService = CtrlsService;
51267exports.CustomTooltipFeature = CustomTooltipFeature;
51268exports.DateFilter = DateFilter;
51269exports.DisplayedGroupCreator = DisplayedGroupCreator;
51270exports.Downloader = Downloader;
51271exports.DragAndDropService = DragAndDropService;
51272exports.DragService = DragService;
51273exports.Environment = Environment;
51274exports.EventService = EventService;
51275exports.Events = Events;
51276exports.ExpressionService = ExpressionService;
51277exports.FilterManager = FilterManager;
51278exports.FloatingFilterMapper = FloatingFilterMapper;
51279exports.FocusService = FocusService;
51280exports.Grid = Grid;
51281exports.GridApi = GridApi;
51282exports.GridBodyComp = GridBodyComp;
51283exports.GridBodyCtrl = GridBodyCtrl;
51284exports.GridComp = GridComp;
51285exports.GridCoreCreator = GridCoreCreator;
51286exports.GridCtrl = GridCtrl;
51287exports.GridHeaderComp = GridHeaderComp;
51288exports.GridHeaderCtrl = GridHeaderCtrl;
51289exports.GridOptionsWrapper = GridOptionsWrapper;
51290exports.GridSerializer = GridSerializer;
51291exports.GroupCellRenderer = GroupCellRenderer;
51292exports.GroupCellRendererCtrl = GroupCellRendererCtrl;
51293exports.GroupInstanceIdCreator = GroupInstanceIdCreator;
51294exports.HeaderCellCtrl = HeaderCellCtrl;
51295exports.HeaderFilterCellComp = HeaderFilterCellComp;
51296exports.HeaderFilterCellCtrl = HeaderFilterCellCtrl;
51297exports.HeaderGroupCellCtrl = HeaderGroupCellCtrl;
51298exports.HeaderNavigationService = HeaderNavigationService;
51299exports.HeaderPositionUtils = HeaderPositionUtils;
51300exports.HeaderRowComp = HeaderRowComp;
51301exports.HeaderRowContainerComp = HeaderRowContainerComp;
51302exports.HeaderRowContainerCtrl = HeaderRowContainerCtrl;
51303exports.HeaderRowCtrl = HeaderRowCtrl;
51304exports.HorizontalResizeService = HorizontalResizeService;
51305exports.KeyCode = KeyCode;
51306exports.LargeTextCellEditor = LargeTextCellEditor;
51307exports.Logger = Logger;
51308exports.LoggerFactory = LoggerFactory;
51309exports.ManagedFocusFeature = ManagedFocusFeature;
51310exports.ModuleRegistry = ModuleRegistry;
51311exports.MouseEventService = MouseEventService;
51312exports.MoveColumnFeature = MoveColumnFeature;
51313exports.NavigationService = NavigationService;
51314exports.NumberFilter = NumberFilter;
51315exports.NumberSequence = NumberSequence;
51316exports.Optional = Optional;
51317exports.PaginationProxy = PaginationProxy;
51318exports.PinnedRowModel = PinnedRowModel;
51319exports.PopupComponent = PopupComponent;
51320exports.PopupEditorWrapper = PopupEditorWrapper;
51321exports.PopupSelectCellEditor = PopupSelectCellEditor;
51322exports.PopupService = PopupService;
51323exports.PopupTextCellEditor = PopupTextCellEditor;
51324exports.PositionableFeature = PositionableFeature;
51325exports.PostConstruct = PostConstruct;
51326exports.PreConstruct = PreConstruct;
51327exports.PreDestroy = PreDestroy;
51328exports.PropertyKeys = PropertyKeys;
51329exports.ProvidedColumnGroup = ProvidedColumnGroup;
51330exports.ProvidedFilter = ProvidedFilter;
51331exports.Qualifier = Qualifier;
51332exports.QuerySelector = QuerySelector;
51333exports.RefSelector = RefSelector;
51334exports.ResizeObserverService = ResizeObserverService;
51335exports.RowContainerComp = RowContainerComp;
51336exports.RowContainerCtrl = RowContainerCtrl;
51337exports.RowCtrl = RowCtrl;
51338exports.RowNode = RowNode;
51339exports.RowNodeBlock = RowNodeBlock;
51340exports.RowNodeBlockLoader = RowNodeBlockLoader;
51341exports.RowNodeSorter = RowNodeSorter;
51342exports.RowPositionUtils = RowPositionUtils;
51343exports.RowRenderer = RowRenderer;
51344exports.ScalarFilter = ScalarFilter;
51345exports.ScrollVisibleService = ScrollVisibleService;
51346exports.SelectCellEditor = SelectCellEditor;
51347exports.SelectableService = SelectableService;
51348exports.SelectionService = SelectionService;
51349exports.SetLeftFeature = SetLeftFeature;
51350exports.SimpleFilter = SimpleFilter;
51351exports.SortController = SortController;
51352exports.StandardMenuFactory = StandardMenuFactory;
51353exports.StylingService = StylingService;
51354exports.TabGuardComp = TabGuardComp;
51355exports.TabGuardCtrl = TabGuardCtrl;
51356exports.TabbedLayout = TabbedLayout;
51357exports.TemplateService = TemplateService;
51358exports.TextCellEditor = TextCellEditor;
51359exports.TextFilter = TextFilter;
51360exports.TextFloatingFilter = TextFloatingFilter;
51361exports.Timer = Timer;
51362exports.TouchListener = TouchListener;
51363exports.UserComponentFactory = UserComponentFactory;
51364exports.UserComponentRegistry = UserComponentRegistry;
51365exports.ValueCache = ValueCache;
51366exports.ValueFormatterService = ValueFormatterService;
51367exports.ValueService = ValueService;
51368exports.VanillaFrameworkOverrides = VanillaFrameworkOverrides;
51369exports.VirtualList = VirtualList;
51370exports.XmlFactory = XmlFactory;
51371exports.ZipContainer = ZipContainer;
51372exports._ = _;
51373exports.defaultGroupComparator = defaultGroupComparator;
51374exports.getRowContainerTypeForName = getRowContainerTypeForName;
51375exports.simpleHttpRequest = simpleHttpRequest;
51376exports.stringToArray = stringToArray;